diff --git a/plugin/scripts/search-server.js b/plugin/scripts/search-server.js index c5d0b0fd..a3393d3e 100755 --- a/plugin/scripts/search-server.js +++ b/plugin/scripts/search-server.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -var xl=Object.create;var Ia=Object.defineProperty;var Rl=Object.getOwnPropertyDescriptor;var Tl=Object.getOwnPropertyNames;var Pl=Object.getPrototypeOf,Ol=Object.prototype.hasOwnProperty;var X=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),wl=(a,e)=>{for(var t in e)Ia(a,t,{get:e[t],enumerable:!0})},Il=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Tl(e))!Ol.call(a,r)&&r!==t&&Ia(a,r,{get:()=>e[r],enumerable:!(s=Rl(e,r))||s.enumerable});return a};var Al=(a,e,t)=>(t=a!=null?xl(Pl(a)):{},Il(e||!a||!a.__esModule?Ia(t,"default",{value:a,enumerable:!0}):t,a));var yn=X((Gt,gn)=>{(function(a,e){typeof Gt=="object"&&typeof gn<"u"?e(Gt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Gt,function(a){"use strict";function e(){for(var h=arguments.length,f=Array(h),y=0;y1){f[0]=f[0].slice(0,-1);for(var b=f.length-1,x=1;x= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=d-g,U=Math.floor,M=String.fromCharCode;function j(h){throw new RangeError(q[h])}function I(h,f){for(var y=[],b=h.length;b--;)y[b]=f(h[b]);return y}function C(h,f){var y=h.split("@"),b="";y.length>1&&(b=y[0]+"@",h=y[1]),h=h.replace(V,".");var x=h.split("."),L=I(x,f).join(".");return b+L}function F(h){for(var f=[],y=0,b=h.length;y=55296&&x<=56319&&y>1,f+=U(f/y);f>D*_>>1;x+=d)f=U(f/D);return U(x+(D+1)*f/(f+v))},H=function(f){var y=[],b=f.length,x=0,L=R,G=O,ae=f.lastIndexOf(P);ae<0&&(ae=0);for(var oe=0;oe=128&&j("not-basic"),y.push(f.charCodeAt(oe));for(var Ee=ae>0?ae+1:0;Ee=b&&j("invalid-input");var de=J(f.charCodeAt(Ee++));(de>=d||de>U((E-x)/pe))&&j("overflow"),x+=de*pe;var ne=be<=G?g:be>=G+_?_:be-G;if(deU(E/he)&&j("overflow"),pe*=he}var ce=y.length+1;G=K(x-te,ce,te==0),U(x/ce)>E-L&&j("overflow"),L+=U(x/ce),x%=ce,y.splice(x++,0,L)}return String.fromCodePoint.apply(String,y)},me=function(f){var y=[];f=F(f);var b=f.length,x=R,L=0,G=O,ae=!0,oe=!1,Ee=void 0;try{for(var te=f[Symbol.iterator](),pe;!(ae=(pe=te.next()).done);ae=!0){var be=pe.value;be<128&&y.push(M(be))}}catch(Nr){oe=!0,Ee=Nr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw Ee}}var de=y.length,ne=de;for(de&&y.push(P);ne=x&&FeU((E-L)/Ue)&&j("overflow"),L+=(he-x)*Ue,x=he;var tr=!0,Ar=!1,ur=void 0;try{for(var mt=f[Symbol.iterator](),Dt;!(tr=(Dt=mt.next()).done);tr=!0){var Ct=Dt.value;if(CtE&&j("overflow"),Ct==x){for(var Jr=L,Yr=d;;Yr+=d){var dr=Yr<=G?g:Yr>=G+_?_:Yr-G;if(Jr>6|192).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase():y="%"+(f>>12|224).toString(16).toUpperCase()+"%"+(f>>6&63|128).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase(),y}function Ie(h){for(var f="",y=0,b=h.length;y=194&&x<224){if(b-y>=6){var L=parseInt(h.substr(y+4,2),16);f+=String.fromCharCode((x&31)<<6|L&63)}else f+=h.substr(y,6);y+=6}else if(x>=224){if(b-y>=9){var G=parseInt(h.substr(y+4,2),16),ae=parseInt(h.substr(y+7,2),16);f+=String.fromCharCode((x&15)<<12|(G&63)<<6|ae&63)}else f+=h.substr(y,9);y+=9}else f+=h.substr(y,3),y+=3}return f}function gr(h,f){function y(b){var x=Ie(b);return x.match(f.UNRESERVED)?x:b}return h.scheme&&(h.scheme=String(h.scheme).replace(f.PCT_ENCODED,y).toLowerCase().replace(f.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(f.PCT_ENCODED,y).replace(f.NOT_USERINFO,Se).replace(f.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(f.PCT_ENCODED,y).toLowerCase().replace(f.NOT_HOST,Se).replace(f.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(f.PCT_ENCODED,y).replace(h.scheme?f.NOT_PATH:f.NOT_PATH_NOSCHEME,Se).replace(f.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(f.PCT_ENCODED,y).replace(f.NOT_QUERY,Se).replace(f.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(f.PCT_ENCODED,y).replace(f.NOT_FRAGMENT,Se).replace(f.PCT_ENCODED,r)),h}function lr(h){return h.replace(/^0*(.*)/,"$1")||"0"}function _e(h,f){var y=h.match(f.IPV4ADDRESS)||[],b=p(y,2),x=b[1];return x?x.split(".").map(lr).join("."):h}function ve(h,f){var y=h.match(f.IPV6ADDRESS)||[],b=p(y,3),x=b[1],L=b[2];if(x){for(var G=x.toLowerCase().split("::").reverse(),ae=p(G,2),oe=ae[0],Ee=ae[1],te=Ee?Ee.split(":").map(lr):[],pe=oe.split(":").map(lr),be=f.IPV4ADDRESS.test(pe[pe.length-1]),de=be?7:8,ne=pe.length-de,he=Array(de),ce=0;ce1){var ue=he.slice(0,je.index),Fe=he.slice(je.index+je.length);qe=ue.join(":")+"::"+Fe.join(":")}else qe=he.join(":");return L&&(qe+="%"+L),qe}else return h}var Pr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Pe="".match(/(){0}/)[1]===void 0;function ie(h){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={},b=f.iri!==!1?u:c;f.reference==="suffix"&&(h=(f.scheme?f.scheme+":":"")+"//"+h);var x=h.match(Pr);if(x){Pe?(y.scheme=x[1],y.userinfo=x[3],y.host=x[4],y.port=parseInt(x[5],10),y.path=x[6]||"",y.query=x[7],y.fragment=x[8],isNaN(y.port)&&(y.port=x[5])):(y.scheme=x[1]||void 0,y.userinfo=h.indexOf("@")!==-1?x[3]:void 0,y.host=h.indexOf("//")!==-1?x[4]:void 0,y.port=parseInt(x[5],10),y.path=x[6]||"",y.query=h.indexOf("?")!==-1?x[7]:void 0,y.fragment=h.indexOf("#")!==-1?x[8]:void 0,isNaN(y.port)&&(y.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?x[4]:void 0)),y.host&&(y.host=ve(_e(y.host,b),b)),y.scheme===void 0&&y.userinfo===void 0&&y.host===void 0&&y.port===void 0&&!y.path&&y.query===void 0?y.reference="same-document":y.scheme===void 0?y.reference="relative":y.fragment===void 0?y.reference="absolute":y.reference="uri",f.reference&&f.reference!=="suffix"&&f.reference!==y.reference&&(y.error=y.error||"URI is not a "+f.reference+" reference.");var L=ye[(f.scheme||y.scheme||"").toLowerCase()];if(!f.unicodeSupport&&(!L||!L.unicodeSupport)){if(y.host&&(f.domainHost||L&&L.domainHost))try{y.host=se.toASCII(y.host.replace(b.PCT_ENCODED,Ie).toLowerCase())}catch(G){y.error=y.error||"Host's domain name can not be converted to ASCII via punycode: "+G}gr(y,c)}else gr(y,b);L&&L.parse&&L.parse(y,f)}else y.error=y.error||"URI can not be parsed.";return y}function yr(h,f){var y=f.iri!==!1?u:c,b=[];return h.userinfo!==void 0&&(b.push(h.userinfo),b.push("@")),h.host!==void 0&&b.push(ve(_e(String(h.host),y),y).replace(y.IPV6ADDRESS,function(x,L,G){return"["+L+(G?"%25"+G:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(b.push(":"),b.push(String(h.port))),b.length?b.join(""):void 0}var cr=/^\.\.?\//,Or=/^\/\.(\/|$)/,wr=/^\/\.\.(\/|$)/,xe=/^\/?(?:.|\n)*?(?=\/|$)/;function Me(h){for(var f=[];h.length;)if(h.match(cr))h=h.replace(cr,"");else if(h.match(Or))h=h.replace(Or,"/");else if(h.match(wr))h=h.replace(wr,"/"),f.pop();else if(h==="."||h==="..")h="";else{var y=h.match(xe);if(y){var b=y[0];h=h.slice(b.length),f.push(b)}else throw new Error("Unexpected dot segment condition")}return f.join("")}function De(h){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=f.iri?u:c,b=[],x=ye[(f.scheme||h.scheme||"").toLowerCase()];if(x&&x.serialize&&x.serialize(h,f),h.host&&!y.IPV6ADDRESS.test(h.host)){if(f.domainHost||x&&x.domainHost)try{h.host=f.iri?se.toUnicode(h.host):se.toASCII(h.host.replace(y.PCT_ENCODED,Ie).toLowerCase())}catch(ae){h.error=h.error||"Host's domain name can not be converted to "+(f.iri?"Unicode":"ASCII")+" via punycode: "+ae}}gr(h,y),f.reference!=="suffix"&&h.scheme&&(b.push(h.scheme),b.push(":"));var L=yr(h,f);if(L!==void 0&&(f.reference!=="suffix"&&b.push("//"),b.push(L),h.path&&h.path.charAt(0)!=="/"&&b.push("/")),h.path!==void 0){var G=h.path;!f.absolutePath&&(!x||!x.absolutePath)&&(G=Me(G)),L===void 0&&(G=G.replace(/^\/\//,"/%2F")),b.push(G)}return h.query!==void 0&&(b.push("?"),b.push(h.query)),h.fragment!==void 0&&(b.push("#"),b.push(h.fragment)),b.join("")}function Ae(h,f){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},b=arguments[3],x={};return b||(h=ie(De(h,y),y),f=ie(De(f,y),y)),y=y||{},!y.tolerant&&f.scheme?(x.scheme=f.scheme,x.userinfo=f.userinfo,x.host=f.host,x.port=f.port,x.path=Me(f.path||""),x.query=f.query):(f.userinfo!==void 0||f.host!==void 0||f.port!==void 0?(x.userinfo=f.userinfo,x.host=f.host,x.port=f.port,x.path=Me(f.path||""),x.query=f.query):(f.path?(f.path.charAt(0)==="/"?x.path=Me(f.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?x.path="/"+f.path:h.path?x.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+f.path:x.path=f.path,x.path=Me(x.path)),x.query=f.query):(x.path=h.path,f.query!==void 0?x.query=f.query:x.query=h.query),x.userinfo=h.userinfo,x.host=h.host,x.port=h.port),x.scheme=h.scheme),x.fragment=f.fragment,x}function er(h,f,y){var b=i({scheme:"null"},y);return De(Ae(ie(h,b),ie(f,b),b,!0),b)}function Le(h,f){return typeof h=="string"?h=De(ie(h,f),f):s(h)==="object"&&(h=ie(De(h,f),f)),h}function Nt(h,f,y){return typeof h=="string"?h=De(ie(h,y),y):s(h)==="object"&&(h=De(h,y)),typeof f=="string"?f=De(ie(f,y),y):s(f)==="object"&&(f=De(f,y)),h===f}function Ta(h,f){return h&&h.toString().replace(!f||!f.iri?c.ESCAPE:u.ESCAPE,Se)}function Xe(h,f){return h&&h.toString().replace(!f||!f.iri?c.PCT_ENCODED:u.PCT_ENCODED,Ie)}var pt={scheme:"http",domainHost:!0,parse:function(f,y){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f},serialize:function(f,y){var b=String(f.scheme).toLowerCase()==="https";return(f.port===(b?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}},ws={scheme:"https",domainHost:pt.domainHost,parse:pt.parse,serialize:pt.serialize};function Is(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var ht={scheme:"ws",domainHost:!0,parse:function(f,y){var b=f;return b.secure=Is(b),b.resourceName=(b.path||"/")+(b.query?"?"+b.query:""),b.path=void 0,b.query=void 0,b},serialize:function(f,y){if((f.port===(Is(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){var b=f.resourceName.split("?"),x=p(b,2),L=x[0],G=x[1];f.path=L&&L!=="/"?L:void 0,f.query=G,f.resourceName=void 0}return f.fragment=void 0,f}},As={scheme:"wss",domainHost:ht.domainHost,parse:ht.parse,serialize:ht.serialize},sl={},nl=!0,Ns="[A-Za-z0-9\\-\\.\\_\\~"+(nl?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",rr="[0-9A-Fa-f]",il=t(t("%[EFef]"+rr+"%"+rr+rr+"%"+rr+rr)+"|"+t("%[89A-Fa-f]"+rr+"%"+rr+rr)+"|"+t("%"+rr+rr)),ol="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",ll="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",cl=e(ll,'[\\"\\\\]'),ul="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",dl=new RegExp(Ns,"g"),Kr=new RegExp(il,"g"),fl=new RegExp(e("[^]",ol,"[\\.]",'[\\"]',cl),"g"),Ds=new RegExp(e("[^]",Ns,ul),"g"),pl=Ds;function Pa(h){var f=Ie(h);return f.match(dl)?f:h}var Cs={scheme:"mailto",parse:function(f,y){var b=f,x=b.to=b.path?b.path.split(","):[];if(b.path=void 0,b.query){for(var L=!1,G={},ae=b.query.split("&"),oe=0,Ee=ae.length;oe{"use strict";_n.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 i=n[r];if(!a(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}});var bn=X((Pp,En)=>{"use strict";En.exports=function(e){for(var t=0,s=e.length,r=0,n;r=55296&&n<=56319&&r{"use strict";Rn.exports={copy:ju,checkDataType:Xa,checkDataTypes:Fu,coerceToTypes:Mu,toHash:Ga,getProperty:Wa,escapeQuotes:Ka,equal:Wt(),ucs2length:bn(),varOccurences:zu,varReplace:Vu,schemaHasRules:Hu,schemaHasRulesExcept:Bu,schemaUnknownRules:Zu,toQuotedString:Qa,getPathExpr:Xu,getPath:Qu,getData:Ku,unescapeFragment:Ju,unescapeJsonPointer:Ya,escapeFragment:Yu,escapeJsonPointer:Ja};function ju(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Xa(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",o=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+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+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Fu(a,e,t){switch(a.length){case 1:return Xa(a[0],e,t,!0);default:var s="",r=Ga(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?" && ":"")+Xa(n,e,t,!0);return s}}var Sn=Ga(["string","number","integer","boolean","null"]);function Mu(a,e){if(Array.isArray(e)){for(var t=[],s=0;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,c=r.split("/"),u=0;u{"use strict";var ed=Qr();Tn.exports=rd;function rd(a){ed.copy(a,this)}});var On=X((Ip,Pn)=>{"use strict";var xr=Pn.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Kt(e,s,r,a,"",a)};xr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};xr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xr.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 Kt(a,e,t,s,r,n,i,o,c,u){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,c,u);for(var p in s){var m=s[p];if(Array.isArray(m)){if(p in xr.arrayKeywords)for(var E=0;E{"use strict";var Ot=yn(),wn=Wt(),ra=Qr(),Jt=es(),ad=On();Nn.exports=Tr;Tr.normalizeId=Rr;Tr.fullPath=Yt;Tr.url=ea;Tr.ids=ld;Tr.inlineRef=rs;Tr.schema=ta;function Tr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Tr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Jt)return rs(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=ta.call(this,e,t),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Jt?i=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(i=rs(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),i}function ta(a,e){var t=Ot.parse(e),s=An(t),r=Yt(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Rr(s),i=this._refs[n];if(typeof i=="string")return sd.call(this,a,i,t);if(i instanceof Jt)i.validate||this._compile(i),a=i;else if(i=this._schemas[n],i instanceof Jt){if(i.validate||this._compile(i),n==Rr(e))return{schema:i,root:a,baseId:r};a=i}else return;if(!a.schema)return;r=Yt(this._getId(a.schema))}return In.call(this,t,r,a.schema,a)}function sd(a,e,t){var s=ta.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var i=this._getId(r);return i&&(n=ea(n,i)),In.call(this,t,n,r,a)}}var nd=ra.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{"use strict";var ss=aa();Cn.exports={Validation:Dn(cd),MissingRef:Dn(ns)};function cd(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}ns.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function ns(a,e,t){this.message=t||ns.message(a,e),this.missingRef=ss.url(a,e),this.missingSchema=ss.normalizeId(ss.fullPath(this.missingRef))}function Dn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var is=X((Dp,$n)=>{"use strict";$n.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(i){return function(o,c){var u={key:o,value:i[o]},p={key:c,value:i[c]};return n(u,p)}}}(e.cmp),r=[];return function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,c;if(Array.isArray(i)){for(c="[",o=0;o{"use strict";kn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}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"||!(i||e.schema.$ref)){var t="false schema",p=e.level,m=e.dataLevel,E=e.schema[t],d=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,A=!e.opts.allErrors,q,_="data"+(m||""),P="valid"+p;if(e.schema===!1){e.isTop?A=!0:r+=" var "+P+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , 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 S=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+P+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var O=e.isTop,p=e.level=0,m=e.dataLevel=0,_="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var R="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(R);else throw new Error(R)}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 P="valid"+p,A=!e.opts.allErrors,N="",V="",q,D=e.schema.type,U=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(U?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],U=!0)),U&&D.length==1&&(D=D[0],U=!1),e.schema.$ref&&i){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&&(i=!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")),D){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,D);var j=e.RULES.types[D];if(M||U||j===!0||j&&!xe(j)){var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",d=e.schemaPath+".type",g=e.errSchemaPath+"/type",I=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[I](D,_,e.opts.strictNumbers,!0)+") { ",M){var C="dataType"+p,F="coerced"+p;r+=" var "+C+" = typeof "+_+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+C+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+C+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+F+" = "+_+"; } "),r+=" if ("+F+" !== undefined) ; ";var le=M;if(le)for(var J,re=-1,K=le.length-1;re{"use strict";var na=aa(),oa=Qr(),jn=sa(),ud=is(),Ln=os(),dd=oa.ucs2length,fd=Wt(),pd=jn.Validation;Mn.exports=ls;function ls(a,e,t,s){var r=this,n=this._opts,i=[void 0],o={},c=[],u={},p=[],m={},E=[];e=e||{schema:a,refVal:i,refs:o};var d=hd.call(this,a,e,s),g=this._compilations[d.index];if(d.compiling)return g.callValidate=R;var _=this._formats,v=this.RULES;try{var S=P(a,e,t,s);g.validate=S;var O=g.callValidate;return O&&(O.schema=S.schema,O.errors=null,O.refs=S.refs,O.refVal=S.refVal,O.root=S.root,O.$async=S.$async,n.sourceCode&&(O.source=S.source)),S}finally{md.call(this,a,e,s)}function R(){var I=g.validate,C=I.apply(this,arguments);return R.errors=I.errors,C}function P(I,C,F,le){var J=!C||C&&C.schema==I;if(C.schema!=e.schema)return ls.call(r,I,C,F,le);var re=I.$async===!0,K=Ln({isTop:!0,schema:I,isRoot:J,baseId:le,root:C,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:jn.MissingRef,RULES:v,validate:Ln,util:oa,resolve:na,resolveRef:A,usePattern:U,useDefault:M,useCustomRule:j,opts:n,formats:_,logger:r.logger,self:r});K=ia(i,yd)+ia(c,vd)+ia(p,gd)+ia(E,_d)+K,n.processCode&&(K=n.processCode(K,I));var H;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",K);H=me(r,v,_,e,i,p,E,fd,dd,pd),i[0]=H}catch(Te){throw r.logger.error("Error compiling schema, function code:",K),Te}return H.schema=I,H.errors=null,H.refs=o,H.refVal=i,H.root=J?H:C,re&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:K,patterns:c,defaults:p}),H}function A(I,C,F){C=na.url(I,C);var le=o[C],J,re;if(le!==void 0)return J=i[le],re="refVal["+le+"]",D(J,re);if(!F&&e.refs){var K=e.refs[C];if(K!==void 0)return J=e.refVal[K],re=N(C,J),D(J,re)}re=N(C);var H=na.call(r,P,e,C);if(H===void 0){var me=t&&t[C];me&&(H=na.inlineRef(me,n.inlineRefs)?me:ls.call(r,me,e,t,I))}if(H===void 0)V(C);else return q(C,H),D(H,re)}function N(I,C){var F=i.length;return i[F]=C,o[I]=F,"refVal"+F}function V(I){delete o[I]}function q(I,C){var F=o[I];i[F]=C}function D(I,C){return typeof I=="object"||typeof I=="boolean"?{code:C,schema:I,inline:!0}:{code:C,$async:I&&!!I.$async}}function U(I){var C=u[I];return C===void 0&&(C=u[I]=c.length,c[C]=I),"pattern"+C}function M(I){switch(typeof I){case"boolean":case"number":return""+I;case"string":return oa.toQuotedString(I);case"object":if(I===null)return"null";var C=ud(I),F=m[C];return F===void 0&&(F=m[C]=p.length,p[F]=I),"default"+F}}function j(I,C,F,le){if(r._opts.validateSchema!==!1){var J=I.definition.dependencies;if(J&&!J.every(function(Se){return Object.prototype.hasOwnProperty.call(F,Se)}))throw new Error("parent schema must have all required keywords: "+J.join(","));var re=I.definition.validateSchema;if(re){var K=re(C);if(!K){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=I.definition.compile,Te=I.definition.inline,we=I.definition.macro,se;if(me)se=me.call(r,C,F,le);else if(we)se=we.call(r,C,F,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Te)se=Te.call(r,le,I.keyword,C,F);else if(se=I.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+I.keyword+'"failed to compile');var ye=E.length;return E[ye]=se,{code:"customRule"+ye,validate:se}}}function hd(a,e,t){var s=Fn.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 md(a,e,t){var s=Fn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Fn(a,e,t){for(var s=0;s{"use strict";var la=Un.exports=function(){this._cache={}};la.prototype.put=function(e,t){this._cache[e]=t};la.prototype.get=function(e){return this._cache[e]};la.prototype.del=function(e){delete this._cache[e]};la.prototype.clear=function(){this._cache={}}});var ei=X((Lp,Yn)=>{"use strict";var Ed=Qr(),bd=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Sd=[0,31,28,31,30,31,30,31,31,30,31,30,31],xd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Vn=/^(?=.{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,Rd=/^(?:[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,Td=/^(?:[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,Hn=/^(?:(?:[^\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,Bn=/^(?:(?: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,Zn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Xn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Qn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Gn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Yn.exports=ca;function ca(a){return a=a=="full"?"full":"fast",Ed.copy(ca[a])}ca.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":Hn,url:Bn,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:Vn,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:Jn,uuid:Zn,"json-pointer":Xn,"json-pointer-uri-fragment":Qn,"relative-json-pointer":Gn};ca.full={date:Wn,time:Kn,"date-time":wd,uri:Ad,"uri-reference":Td,"uri-template":Hn,url:Bn,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:Vn,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:Jn,uuid:Zn,"json-pointer":Xn,"json-pointer-uri-fragment":Qn,"relative-json-pointer":Gn};function Pd(a){return a%4===0&&(a%100!==0||a%400===0)}function Wn(a){var e=a.match(bd);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Pd(t)?29:Sd[s])}function Kn(a,e){var t=a.match(xd);if(!t)return!1;var s=t[1],r=t[2],n=t[3],i=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var Od=/t|\s/i;function wd(a){var e=a.split(Od);return e.length==2&&Wn(e[0])&&Kn(e[1],!0)}var Id=/\/|:/;function Ad(a){return Id.test(a)&&Rd.test(a)}var Nd=/[^\\]\\Z/;function Jn(a){if(Nd.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var ti=X((jp,ri)=>{"use strict";ri.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(i||""),m="valid"+n,E,d;if(o=="#"||o=="#/")e.isRoot?(E=e.async,d="validate"):(E=e.root.schema.$async===!0,d="root.refVal[0]");else{var g=e.resolveRef(e.baseId,o,e.isRoot);if(g===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(c)+" , 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 S=r;r=v.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),u&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,_)}else if(g.inline){var O=e.util.copy(e);O.level++;var R="valid"+O.level;O.schema=g.schema,O.schemaPath="",O.errSchemaPath=o;var P=e.validate(O).replace(/validate\.schema/g,g.code);r+=" "+P+" ",u&&(r+=" if ("+R+") { ")}else E=g.$async===!0||e.async&&g.$async!==!1,d=g.code}if(d){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var A=i?"data"+(i-1||""):"parentData",N=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+A+" , "+N+", rootData) ";var V=r;if(r=v.pop(),E){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(r+=" var "+m+"; "),r+=" try { await "+V+"; ",u&&(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; ",u&&(r+=" "+m+" = false; "),r+=" } ",u&&(r+=" if ("+m+") { ")}else r+=" if (!"+V+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",u&&(r+=" else { ")}return r}});var si=X((Fp,ai)=>{"use strict";ai.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u=e.util.copy(e),p="";u.level++;var m="valid"+u.level,E=u.baseId,d=!0,g=n;if(g)for(var _,v=-1,S=g.length-1;v0||_===!1:e.util.schemaHasRules(_,e.RULES.all))&&(d=!1,u.schema=_,u.schemaPath=i+"["+v+"]",u.errSchemaPath=o+"/"+v,r+=" "+e.validate(u)+" ",u.baseId=E,c&&(r+=" if ("+m+") { ",p+="}"));return c&&(d?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var ii=X((Mp,ni)=>{"use strict";ni.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S=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(S){var O=g.baseId;r+=" var "+d+" = errors; var "+E+" = false; ";var R=e.compositeRule;e.compositeRule=g.compositeRule=!0;var P=o;if(P)for(var A,N=-1,V=P.length-1;N{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,c=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+c+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r}});var ui=X((Up,ci)=>{"use strict";ci.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d=e.opts.$data&&o&&o.$data,g;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o,d||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+E+" = equal("+m+", schema"+n+"); if (!"+E+") { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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 fi=X((zp,di)=>{"use strict";di.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S="i"+n,O=g.dataLevel=e.dataLevel+1,R="data"+O,P=e.baseId,A=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+d+" = errors;var "+E+";",A){var N=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=o,g.schemaPath=c,g.errSchemaPath=u,r+=" var "+v+" = false; for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var V=m+"["+S+"]";g.dataPathArr[O]=S;var q=e.validate(g);g.baseId=P,e.util.varOccurences(q,R)<2?r+=" "+e.util.varReplace(q,R,V)+" ":r+=" var "+R+" = "+V+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=g.compositeRule=N,r+=" "+_+" if (!"+v+") {"}else r+=" if ("+m+".length == 0) {";var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var U=r;return r=D.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 { ",A&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var hi=X((Vp,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,d=e.util.copy(e),g="";d.level++;var _="valid"+d.level,v={},S={},O=e.opts.ownProperties;for(N in o)if(N!="__proto__"){var R=o[N],P=Array.isArray(R)?S:v;P[N]=R}r+="var "+E+" = errors;";var A=e.errorPath;r+="var missing"+n+";";for(var N in S)if(P=S[N],P.length){if(r+=" if ( "+m+e.util.getProperty(N)+" !== undefined ",O&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(N)+"') "),p){r+=" && ( ";var V=P;if(V)for(var q,D=-1,U=V.length-1;D0||R===!1:e.util.schemaHasRules(R,e.RULES.all))&&(r+=" "+_+" = true; if ( "+m+e.util.getProperty(N)+" !== undefined ",O&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(N)+"') "),r+=") { ",d.schema=R,d.schemaPath=c+e.util.getProperty(N),d.errSchemaPath=u+"/"+e.util.escapeFragment(N),r+=" "+e.validate(d)+" ",d.baseId=H,r+=" } ",p&&(r+=" if ("+_+") { ",g+="}"))}return p&&(r+=" "+g+" if ("+E+" == errors) {"),r}});var vi=X((Hp,mi)=>{"use strict";mi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d=e.opts.$data&&o&&o.$data,g;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o;var _="i"+n,v="schema"+n;d||(r+=" var "+v+" = validate.schema"+c+";"),r+="var "+E+";",d&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=""+E+" = false;for (var "+_+"=0; "+_+"<"+v+".length; "+_+"++) if (equal("+m+", "+v+"["+_+"])) { "+E+" = true; break; }",d&&(r+=" } "),r+=" if (!"+E+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var O=r;return r=S.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var yi=X((Bp,gi)=>{"use strict";gi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var E=e.opts.$data&&o&&o.$data,d;E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var g=e.opts.unknownFormats,_=Array.isArray(g);if(E){var v="format"+n,S="isObject"+n,O="formatType"+n;r+=" var "+v+" = formats["+d+"]; var "+S+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+O+" = "+S+" && "+v+".type || 'string'; if ("+S+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",g!="ignore"&&(r+=" ("+d+" && !"+v+" ",_&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+v+" && "+O+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+m+") : "+v+"("+m+")) ":r+=" "+v+"("+m+") ",r+=" : "+v+".test("+m+"))))) {"}else{var v=e.formats[o];if(!v){if(g=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),p&&(r+=" if (true) { "),r;if(_&&g.indexOf(o)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,O=S&&v.type||"string";if(S){var R=v.async===!0;v=v.validate}if(O!=s)return p&&(r+=" if (true) { "),r;if(R){if(!e.async)throw new Error("async format in sync schema");var P="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+P+"("+m+"))) { "}else{r+=" if (! ";var P="formats"+e.util.getProperty(o);S&&(P+=".validate"),typeof v=="function"?r+=" "+P+"("+m+") ":r+=" "+P+".test("+m+") ",r+=") { "}}var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",E?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,E?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var N=r;return r=A.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+N+"]); ":r+=" validate.errors = ["+N+"]; return false; ":r+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var Ei=X((Zp,_i)=>{"use strict";_i.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e);g.level++;var _="valid"+g.level,v=e.schema.then,S=e.schema.else,O=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),R=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)),P=g.baseId;if(O||R){var A;g.createErrors=!1,g.schema=o,g.schemaPath=c,g.errSchemaPath=u,r+=" var "+d+" = errors; var "+E+" = true; ";var N=e.compositeRule;e.compositeRule=g.compositeRule=!0,r+=" "+e.validate(g)+" ",g.baseId=P,g.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=N,O?(r+=" if ("+_+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(g)+" ",g.baseId=P,r+=" "+E+" = "+_+"; ",O&&R?(A="ifClause"+n,r+=" var "+A+" = 'then'; "):A="'then'",r+=" } ",R&&(r+=" else { ")):r+=" if (!"+_+") { ",R&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(g)+" ",g.baseId=P,r+=" "+E+" = "+_+"; ",O&&R?(A="ifClause"+n,r+=" var "+A+" = 'else'; "):A="'else'",r+=" } "),r+=" if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+A+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+A+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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 Si=X((Xp,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S="i"+n,O=g.dataLevel=e.dataLevel+1,R="data"+O,P=e.baseId;if(r+="var "+d+" = errors;var "+E+";",Array.isArray(o)){var A=e.schema.additionalItems;if(A===!1){r+=" "+E+" = "+m+".length <= "+o.length+"; ";var N=u;u=e.errSchemaPath+"/additionalItems",r+=" if (!"+E+") { ";var V=V||[];V.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , 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=V.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+=" } ",u=N,p&&(_+="}",r+=" else { ")}var D=o;if(D){for(var U,M=-1,j=D.length-1;M0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+m+".length > "+M+") { ";var I=m+"["+M+"]";g.schema=U,g.schemaPath=c+"["+M+"]",g.errSchemaPath=u+"/"+M,g.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),g.dataPathArr[O]=M;var C=e.validate(g);g.baseId=P,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",r+=" } ",p&&(r+=" if ("+v+") { ",_+="}")}}if(typeof A=="object"&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))){g.schema=A,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+m+".length > "+o.length+") { for (var "+S+" = "+o.length+"; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=m+"["+S+"]";g.dataPathArr[O]=S;var C=e.validate(g);g.baseId=P,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",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)){g.schema=o,g.schemaPath=c,g.errSchemaPath=u,r+=" for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=m+"["+S+"]";g.dataPathArr[O]=S;var C=e.validate(g);g.baseId=P,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",p&&(r+=" if (!"+v+") break; "),r+=" }"}return p&&(r+=" "+_+" if ("+d+" == errors) {"),r}});var cs=X((Qp,xi)=>{"use strict";xi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,P,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var g=t=="maximum",_=g?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[_],S=e.opts.$data&&v&&v.$data,O=g?"<":">",R=g?">":"<",P=void 0;if(!(E||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(S||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(_+" must be number or boolean");if(S){var A=e.util.getData(v.$data,i,e.dataPathArr),N="exclusive"+n,V="exclType"+n,q="exclIsNumber"+n,D="op"+n,U="' + "+D+" + '";r+=" var schemaExcl"+n+" = "+A+"; ",A="schemaExcl"+n,r+=" var "+N+"; var "+V+" = typeof "+A+"; if ("+V+" != 'boolean' && "+V+" != 'undefined' && "+V+" != 'number') { ";var P=_,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(P||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var j=r;r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+j+"]); ":r+=" validate.errors = ["+j+"]; return false; ":r+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+V+" == 'number' ? ( ("+N+" = "+d+" === undefined || "+A+" "+O+"= "+d+") ? "+m+" "+R+"= "+A+" : "+m+" "+R+" "+d+" ) : ( ("+N+" = "+A+" === true) ? "+m+" "+R+"= "+d+" : "+m+" "+R+" "+d+" ) || "+m+" !== "+m+") { var op"+n+" = "+N+" ? '"+O+"' : '"+O+"='; ",o===void 0&&(P=_,u=e.errSchemaPath+"/"+_,d=A,E=S)}else{var q=typeof v=="number",U=O;if(q&&E){var D="'"+U+"'";r+=" if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+v+" "+O+"= "+d+" ? "+m+" "+R+"= "+v+" : "+m+" "+R+" "+d+" ) || "+m+" !== "+m+") { "}else{q&&o===void 0?(N=!0,P=_,u=e.errSchemaPath+"/"+_,d=v,R+="="):(q&&(d=Math[g?"min":"max"](v,o)),v===(q?d:!0)?(N=!0,P=_,u=e.errSchemaPath+"/"+_,R+="="):(N=!1,U+="="));var D="'"+U+"'";r+=" if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+m+" "+R+" "+d+" || "+m+" !== "+m+") { "}}P=P||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(P||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+D+", limit: "+d+", exclusive: "+N+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",E?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var j=r;return r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+j+"]); ":r+=" validate.errors = ["+j+"]; return false; ":r+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var us=X((Gp,Ri)=>{"use strict";Ri.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;if(E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(E||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";r+="if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+m+".length "+g+" "+d+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+d+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var ds=X((Wp,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;if(E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(E||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";r+="if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+g+" "+d+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",E?r+="' + "+d+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var fs=X((Kp,Pi)=>{"use strict";Pi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;if(E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(E||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";r+="if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+m+").length "+g+" "+d+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+d+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var wi=X((Jp,Oi)=>{"use strict";Oi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;if(E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(E||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",E&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",E&&(r+=" ) "),r+=" ) { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",E?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=g.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 Ai=X((Yp,Ii)=>{"use strict";Ii.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,d=e.util.copy(e);d.level++;var g="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=u,r+=" var "+E+" = errors; ";var _=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var v;d.opts.allErrors&&(v=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,v&&(d.opts.allErrors=v),e.compositeRule=d.compositeRule=_,r+=" if ("+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var O=r;r=S.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+E+"; if (vErrors !== null) { if ("+E+") vErrors.length = "+E+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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 Di=X((eh,Ni)=>{"use strict";Ni.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S=g.baseId,O="prevValid"+n,R="passingSchemas"+n;r+="var "+d+" = errors , "+O+" = false , "+E+" = false , "+R+" = null; ";var P=e.compositeRule;e.compositeRule=g.compositeRule=!0;var A=o;if(A)for(var N,V=-1,q=A.length-1;V0||N===!1:e.util.schemaHasRules(N,e.RULES.all))?(g.schema=N,g.schemaPath=c+"["+V+"]",g.errSchemaPath=u+"/"+V,r+=" "+e.validate(g)+" ",g.baseId=S):r+=" var "+v+" = true; ",V&&(r+=" if ("+v+" && "+O+") { "+E+" = false; "+R+" = ["+R+", "+V+"]; } else { ",_+="}"),r+=" if ("+v+") { "+E+" = "+O+" = true; "+R+" = "+V+"; }";return e.compositeRule=g.compositeRule=P,r+=""+_+"if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+R+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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 = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var $i=X((rh,Ci)=>{"use strict";Ci.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var g=E?"(new RegExp("+d+"))":e.usePattern(o);r+="if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+g+".test("+m+") ) { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",E?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,E?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c: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=X((th,ki)=>{"use strict";ki.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,d=e.util.copy(e),g="";d.level++;var _="valid"+d.level,v="key"+n,S="idx"+n,O=d.dataLevel=e.dataLevel+1,R="data"+O,P="dataProperties"+n,A=Object.keys(o||{}).filter(re),N=e.schema.patternProperties||{},V=Object.keys(N).filter(re),q=e.schema.additionalProperties,D=A.length||V.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,j=e.opts.removeAdditional,I=U||M||j,C=e.opts.ownProperties,F=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length8)r+=" || validate.schema"+c+".hasOwnProperty("+v+") ";else{var K=A;if(K)for(var H,me=-1,Te=K.length-1;me0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){var Me=e.util.getProperty(H),Pe=m+Me,De=yr&&xe.default!==void 0;d.schema=xe,d.schemaPath=c+Me,d.errSchemaPath=u+"/"+e.util.escapeFragment(H),d.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),d.dataPathArr[O]=e.util.toQuotedString(H);var ie=e.validate(d);if(d.baseId=F,e.util.varOccurences(ie,R)<2){ie=e.util.varReplace(ie,R,Pe);var Ae=Pe}else{var Ae=R;r+=" var "+R+" = "+Pe+"; "}if(De)r+=" "+ie+" ";else{if(J&&J[H]){r+=" if ( "+Ae+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = false; ";var Ie=e.errorPath,lr=u,er=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ie,H,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+er+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+er+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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++; ",u=lr,e.errorPath=Ie,r+=" } else { "}else p?(r+=" if ( "+Ae+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = true; } else { "):(r+=" if ("+Ae+" !== undefined ",C&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+ie+" } "}}p&&(r+=" if ("+_+") { ",g+="}")}}if(V.length){var Le=V;if(Le)for(var se,Nt=-1,Ta=Le.length-1;Nt0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){d.schema=xe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),C?r+=" "+P+" = "+P+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+P+".length; "+S+"++) { var "+v+" = "+P+"["+S+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Pe=m+"["+v+"]";d.dataPathArr[O]=v;var ie=e.validate(d);d.baseId=F,e.util.varOccurences(ie,R)<2?r+=" "+e.util.varReplace(ie,R,Pe)+" ":r+=" var "+R+" = "+Pe+"; "+ie+" ",p&&(r+=" if (!"+_+") break; "),r+=" } ",p&&(r+=" else "+_+" = true; "),r+=" } ",p&&(r+=" if ("+_+") { ",g+="}")}}}return p&&(r+=" "+g+" if ("+E+" == errors) {"),r}});var Fi=X((ah,ji)=>{"use strict";ji.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,d=e.util.copy(e),g="";d.level++;var _="valid"+d.level;if(r+="var "+E+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=u;var v="key"+n,S="idx"+n,O="i"+n,R="' + "+v+" + '",P=d.dataLevel=e.dataLevel+1,A="data"+P,N="dataProperties"+n,V=e.opts.ownProperties,q=e.baseId;V&&(r+=" var "+N+" = undefined; "),V?r+=" "+N+" = "+N+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+N+".length; "+S+"++) { var "+v+" = "+N+"["+S+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var D=v,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var M=e.validate(d);d.baseId=q,e.util.varOccurences(M,A)<2?r+=" "+e.util.varReplace(M,A,D)+" ":r+=" var "+A+" = "+D+"; "+M+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+_+") { for (var "+O+"=startErrs"+n+"; "+O+"{"use strict";Mi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d=e.opts.$data&&o&&o.$data,g;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o;var _="schema"+n;if(!d)if(o.length0||A===!1:e.util.schemaHasRules(A,e.RULES.all))||(v[v.length]=O)}}else var v=o;if(d||v.length){var N=e.errorPath,V=d||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",V){d||(r+=" var "+_+" = validate.schema"+c+"; ");var D="i"+n,U="schema"+n+"["+D+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(N,U,e.opts.jsonPointers)),r+=" var "+E+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=" for (var "+D+" = 0; "+D+" < "+_+".length; "+D+"++) { "+E+" = "+m+"["+_+"["+D+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+_+"["+D+"]) "),r+="; if (!"+E+") break; } ",d&&(r+=" } "),r+=" if (!"+E+") { ";var j=j||[];j.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;r=j.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+=" } else { "}else{r+=" if ( ";var C=v;if(C)for(var F,D=-1,le=C.length-1;D{"use strict";Ui.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d=e.opts.$data&&o&&o.$data,g;if(d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+E+"; if ("+g+" === false || "+g+" === undefined) "+E+" = true; else if (typeof "+g+" != 'boolean') "+E+" = false; else { "),r+=" var i = "+m+".length , "+E+" = true , j; if (i > 1) { ";var _=e.schema.items&&e.schema.items.type,v=Array.isArray(_);if(!_||_=="object"||_=="array"||v&&(_.indexOf("object")>=0||_.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+E+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var S="checkDataType"+(v?"s":"");r+=" if ("+e.util[S](_,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+E+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+E+") { ";var O=O||[];O.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var R=r;r=O.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+R+"]); ":r+=" validate.errors = ["+R+"]; return false; ":r+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Hi=X((ih,Vi)=>{"use strict";Vi.exports={$ref:ti(),allOf:si(),anyOf:ii(),$comment:li(),const:ui(),contains:fi(),dependencies:hi(),enum:vi(),format:yi(),if:Ei(),items:Si(),maximum:cs(),minimum:cs(),maxItems:us(),minItems:us(),maxLength:ds(),minLength:ds(),maxProperties:fs(),minProperties:fs(),multipleOf:wi(),not:Ai(),oneOf:Di(),pattern:$i(),properties:Li(),propertyNames:Fi(),required:qi(),uniqueItems:zi(),validate:os()}});var Xi=X((oh,Zi)=>{"use strict";var Bi=Hi(),ps=Qr().toHash;Zi.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=ps(t),e.types=ps(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var c=Object.keys(i)[0];o=i[c],i=c,o.forEach(function(p){t.push(p),e.all[p]=!0})}t.push(i);var u=e.all[i]={keyword:i,code:Bi[i],implements:o};return u}),e.all.$comment={keyword:"$comment",code:Bi.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=ps(t.concat(s)),e.custom={},e}});var Wi=X((lh,Gi)=>{"use strict";var Qi=["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{"use strict";var Dd=sa().MissingRef;Ji.exports=Ki;function Ki(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||i(o)});return t&&r.then(function(o){t(null,o)},t),r;function n(o){var c=o.$schema;return c&&!s.getSchema(c)?Ki.call(s,{$ref:c},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(u){if(u instanceof Dd)return c(u);throw u}function c(u){var p=u.missingSchema;if(d(p))throw new Error("Schema "+p+" is loaded but "+u.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(E,E)),m.then(function(g){if(!d(p))return n(g).then(function(){d(p)||s.addSchema(g,p,void 0,e)})}).then(function(){return i(o)});function E(){delete s._loadingSchemas[p]}function d(g){return s._refs[g]||s._schemas[g]}}}}});var ro=X((uh,eo)=>{"use strict";eo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m,E="data"+(i||""),d="valid"+n,g="errs__"+n,_=e.opts.$data&&o&&o.$data,v;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",v="schema"+n):v=o;var S=this,O="definition"+n,R=S.definition,P="",A,N,V,q,D;if(_&&R.$data){D="keywordValidate"+n;var U=R.validateSchema;r+=" var "+O+" = RULES.custom['"+t+"'].definition; var "+D+" = "+O+".validate;"}else{if(q=e.useCustomRule(S,o,e.schema,e),!q)return;v="validate.schema"+c,D=q.code,A=R.compile,N=R.inline,V=R.macro}var M=D+".errors",j="i"+n,I="ruleErr"+n,C=R.async;if(C&&!e.async)throw new Error("async keyword in sync schema");if(N||V||(r+=""+M+" = null;"),r+="var "+g+" = errors;var "+d+";",_&&R.$data&&(P+="}",r+=" if ("+v+" === undefined) { "+d+" = true; } else { ",U&&(P+="}",r+=" "+d+" = "+O+".validateSchema("+v+"); if ("+d+") { ")),N)R.statements?r+=" "+q.validate+" ":r+=" "+d+" = "+q.validate+"; ";else if(V){var F=e.util.copy(e),P="";F.level++;var le="valid"+F.level;F.schema=q.validate,F.schemaPath="";var J=e.compositeRule;e.compositeRule=F.compositeRule=!0;var re=e.validate(F).replace(/validate\.schema/g,D);e.compositeRule=F.compositeRule=J,r+=" "+re}else{var K=K||[];K.push(r),r="",r+=" "+D+".call( ",e.opts.passContext?r+="this":r+="self",A||R.schema===!1?r+=" , "+E+" ":r+=" , "+v+" , "+E+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=i?"data"+(i-1||""):"parentData",me=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+H+" , "+me+" , rootData ) ";var Te=r;r=K.pop(),R.errors===!1?(r+=" "+d+" = ",C&&(r+="await "),r+=""+Te+"; "):C?(M="customErrors"+n,r+=" var "+M+" = null; try { "+d+" = await "+Te+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+d+" = "+Te+"; "}if(R.modifying&&(r+=" if ("+H+") "+E+" = "+H+"["+me+"];"),r+=""+P,R.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",R.valid===void 0?(r+=" !",V?r+=""+le:r+=""+d):r+=" "+!R.valid+" ",r+=") { ",m=S.keyword;var K=K||[];K.push(r),r="";var K=K||[];K.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+E+" "),r+=" } "):r+=" {} ";var we=r;r=K.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+we+"]); ":r+=" validate.errors = ["+we+"]; return false; ":r+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=K.pop(),N?R.errors?R.errors!="full"&&(r+=" for (var "+j+"="+g+"; "+j+"{Cd.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 so=X((fh,ao)=>{"use strict";var to=hs();ao.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:to.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:to.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 io=X((ph,no)=>{"use strict";var $d=/^[a-z_$][a-z0-9_$-]*$/i,kd=ro(),Ld=so();no.exports={add:jd,get:Fd,remove:Md,validate:ms};function jd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!$d.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{qd.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var yo=X((mh,go)=>{"use strict";var co=qn(),Gr=aa(),Ud=zn(),uo=es(),zd=is(),Vd=ei(),Hd=Xi(),fo=Wi(),po=Qr();go.exports=ge;ge.prototype.validate=Zd;ge.prototype.compile=Xd;ge.prototype.addSchema=Qd;ge.prototype.addMetaSchema=Gd;ge.prototype.validateSchema=Wd;ge.prototype.getSchema=Jd;ge.prototype.removeSchema=ef;ge.prototype.addFormat=cf;ge.prototype.errorsText=lf;ge.prototype._addSchema=rf;ge.prototype._compile=tf;ge.prototype.compileAsync=Yi();var fa=io();ge.prototype.addKeyword=fa.add;ge.prototype.getKeyword=fa.get;ge.prototype.removeKeyword=fa.remove;ge.prototype.validateKeyword=fa.validate;var ho=sa();ge.ValidationError=ho.Validation;ge.MissingRefError=ho.MissingRef;ge.$dataMetaSchema=fo;var da="http://json-schema.org/draft-07/schema",lo=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Bd=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=po.copy(a)||{},mf(this),this._schemas={},this._refs={},this._fragments={},this._formats=Vd(a.format),this._cache=a.cache||new Ud,this._loadingSchemas={},this._compilations=[],this.RULES=Hd(),this._getId=af(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=zd),this._metaOpts=hf(this),a.formats&&ff(this),a.keywords&&pf(this),uf(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),df(this)}function Zd(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 Xd(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Qd(a,e,t,s){if(Array.isArray(a)){for(var r=0;rtc,DIRTY:()=>Dr,EMPTY_PATH:()=>$l,INVALID:()=>B,NEVER:()=>qc,OK:()=>Oe,ParseStatus:()=>Re,Schema:()=>W,ZodAny:()=>br,ZodArray:()=>vr,ZodBigInt:()=>$r,ZodBoolean:()=>kr,ZodBranded:()=>bt,ZodCatch:()=>Zr,ZodDate:()=>Lr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>jt,ZodEffects:()=>He,ZodEnum:()=>Vr,ZodError:()=>Ce,ZodFirstPartyTypeKind:()=>w,ZodFunction:()=>Mt,ZodIntersection:()=>qr,ZodIssueCode:()=>T,ZodLazy:()=>Ur,ZodLiteral:()=>zr,ZodMap:()=>ct,ZodNaN:()=>dt,ZodNativeEnum:()=>Hr,ZodNever:()=>Qe,ZodNull:()=>Fr,ZodNullable:()=>nr,ZodNumber:()=>Cr,ZodObject:()=>$e,ZodOptional:()=>ze,ZodParsedType:()=>k,ZodPipeline:()=>St,ZodPromise:()=>Sr,ZodReadonly:()=>Xr,ZodRecord:()=>Ft,ZodSchema:()=>W,ZodSet:()=>ut,ZodString:()=>Er,ZodSymbol:()=>ot,ZodTransformer:()=>He,ZodTuple:()=>sr,ZodType:()=>W,ZodUndefined:()=>jr,ZodUnion:()=>Mr,ZodUnknown:()=>mr,ZodVoid:()=>lt,addIssueToContext:()=>$,any:()=>dc,array:()=>mc,bigint:()=>ic,boolean:()=>Ws,coerce:()=>Mc,custom:()=>Xs,date:()=>oc,datetimeRegex:()=>Bs,defaultErrorMap:()=>pr,discriminatedUnion:()=>_c,effect:()=>Nc,enum:()=>wc,function:()=>Tc,getErrorMap:()=>st,getParsedType:()=>ar,instanceof:()=>sc,intersection:()=>Ec,isAborted:()=>kt,isAsync:()=>nt,isDirty:()=>Lt,isValid:()=>_r,late:()=>ac,lazy:()=>Pc,literal:()=>Oc,makeIssue:()=>Et,map:()=>xc,nan:()=>nc,nativeEnum:()=>Ic,never:()=>pc,null:()=>uc,nullable:()=>Cc,number:()=>Gs,object:()=>vc,objectUtil:()=>Aa,oboolean:()=>Fc,onumber:()=>jc,optional:()=>Dc,ostring:()=>Lc,pipeline:()=>kc,preprocess:()=>$c,promise:()=>Ac,quotelessJson:()=>Nl,record:()=>Sc,set:()=>Rc,setErrorMap:()=>Cl,strictObject:()=>gc,string:()=>Qs,symbol:()=>lc,transformer:()=>Nc,tuple:()=>bc,undefined:()=>cc,union:()=>yc,unknown:()=>fc,util:()=>Y,void:()=>hc});var Y;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let i of r)n[i]=i;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(let o of n)i[o]=r[o];return a.objectValues(i)},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 i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},a.find=(r,n)=>{for(let i of r)if(n(i))return i},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(i=>typeof i=="string"?`'${i}'`:i).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Y||(Y={}));var Aa;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Aa||(Aa={}));var k=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ar=a=>{switch(typeof a){case"undefined":return k.undefined;case"string":return k.string;case"number":return Number.isNaN(a)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":return Array.isArray(a)?k.array:a===null?k.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?k.promise:typeof Map<"u"&&a instanceof Map?k.map:typeof Set<"u"&&a instanceof Set?k.set:typeof Date<"u"&&a instanceof Date?k.date:k.object;default:return k.unknown}};var T=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nl=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ce=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;ct.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ce.create=a=>new Ce(a);var Dl=(a,e)=>{let t;switch(a.code){case T.invalid_type:a.received===k.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,Y.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${Y.joinValues(a.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Y.joinValues(a.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${Y.joinValues(a.options)}, received '${a.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:Y.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case T.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 T.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 T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,Y.assertNever(a)}return{message:t}},pr=Dl;var qs=pr;function Cl(a){qs=a}function st(){return qs}var Et=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",c=s.filter(u=>!!u).slice().reverse();for(let u of c)o=u(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},$l=[];function $(a,e){let t=st(),s=Et({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===pr?void 0:pr].filter(r=>!!r)});a.common.issues.push(s)}var Re=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return B;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,i=await r.value;s.push({key:n,value:i})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return B;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}},B=Object.freeze({status:"aborted"}),Dr=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),kt=a=>a.status==="aborted",Lt=a=>a.status==="dirty",_r=a=>a.status==="valid",nt=a=>typeof Promise<"u"&&a instanceof Promise;var z;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(z||(z={}));var Ve=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}},Us=(a,e)=>{if(_r(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ce(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{let{message:c}=a;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:r}}var W=class{get description(){return this._def.description}_getType(e){return ar(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Re,ctx:{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nt(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:ar(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Us(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return _r(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=>_r(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:ar(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(nt(r)?r:Promise.resolve(r));return Us(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 i=e(r),o=()=>n.addIssue({code:T.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!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 He({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ze.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vr.create(this)}promise(){return Sr.create(this,this._def)}or(e){return Mr.create([this,e],this._def)}and(e){return qr.create(this,e,this._def)}transform(e){return new He({...Q(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...Q(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new bt({typeName:w.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Zr({...Q(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return St.create(this,e)}readonly(){return Xr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kl=/^c[^\s-]{8,}$/i,Ll=/^[0-9a-z]+$/,jl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fl=/^[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,Ml=/^[a-z0-9_-]{21}$/i,ql=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ul=/^[-+]?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)?)??$/,zl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Na,Hl=/^(?:(?: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])$/,Bl=/^(?:(?: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])$/,Zl=/^(([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]))$/,Xl=/^(([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])$/,Ql=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vs="((\\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])))",Wl=new RegExp(`^${Vs}$`);function Hs(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 Kl(a){return new RegExp(`^${Hs(a)}$`)}function Bs(a){let e=`${Vs}T${Hs(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 Jl(a,e){return!!((e==="v4"||!e)&&Hl.test(a)||(e==="v6"||!e)&&Zl.test(a))}function Yl(a,e){if(!ql.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function ec(a,e){return!!((e==="v4"||!e)&&Bl.test(a)||(e==="v6"||!e)&&Xl.test(a))}var Er=class a extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==k.string){let n=this._getOrReturnCtx(e);return $(n,{code:T.invalid_type,expected:k.string,received:n.parsedType}),B}let s=new Re,r;for(let n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(r=this._getOrReturnCtx(e,r),$(r,{code:T.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,o=e.data.lengthe.test(r),{validation:t,code:T.invalid_string,...z.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.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,...z.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,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...z.errToObj(t)})}nonempty(e){return this.min(1,z.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.valuenew Er({checks:[],typeName:w.ZodString,coerce:a?.coerce??!1,...Q(a)});function rc(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(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}var Cr=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==k.number){let n=this._getOrReturnCtx(e);return $(n,{code:T.invalid_type,expected:k.number,received:n.parsedType}),B}let s,r=new Re;for(let n of this._def.checks)n.kind==="int"?Y.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:T.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),$(s,{code:T.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?rc(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),$(s,{code:T.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:T.not_finite,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.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.valuee.kind==="int"||e.kind==="multipleOf"&&Y.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.valuenew Cr({checks:[],typeName:w.ZodNumber,coerce:a?.coerce||!1,...Q(a)});var $r=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==k.bigint)return this._getInvalidInput(e);let s,r=new Re;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),$(s,{code:T.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),$(s,{code:T.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return $(t,{code:T.invalid_type,expected:k.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.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:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.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.valuenew $r({checks:[],typeName:w.ZodBigInt,coerce:a?.coerce??!1,...Q(a)});var kr=class extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==k.boolean){let s=this._getOrReturnCtx(e);return $(s,{code:T.invalid_type,expected:k.boolean,received:s.parsedType}),B}return Oe(e.data)}};kr.create=a=>new kr({typeName:w.ZodBoolean,coerce:a?.coerce||!1,...Q(a)});var Lr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==k.date){let n=this._getOrReturnCtx(e);return $(n,{code:T.invalid_type,expected:k.date,received:n.parsedType}),B}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return $(n,{code:T.invalid_date}),B}let s=new Re,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(r=this._getOrReturnCtx(e,r),$(r,{code:T.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Y.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:z.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.valuenew Lr({checks:[],coerce:a?.coerce||!1,typeName:w.ZodDate,...Q(a)});var ot=class extends W{_parse(e){if(this._getType(e)!==k.symbol){let s=this._getOrReturnCtx(e);return $(s,{code:T.invalid_type,expected:k.symbol,received:s.parsedType}),B}return Oe(e.data)}};ot.create=a=>new ot({typeName:w.ZodSymbol,...Q(a)});var jr=class extends W{_parse(e){if(this._getType(e)!==k.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:T.invalid_type,expected:k.undefined,received:s.parsedType}),B}return Oe(e.data)}};jr.create=a=>new jr({typeName:w.ZodUndefined,...Q(a)});var Fr=class extends W{_parse(e){if(this._getType(e)!==k.null){let s=this._getOrReturnCtx(e);return $(s,{code:T.invalid_type,expected:k.null,received:s.parsedType}),B}return Oe(e.data)}};Fr.create=a=>new Fr({typeName:w.ZodNull,...Q(a)});var br=class extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};br.create=a=>new br({typeName:w.ZodAny,...Q(a)});var mr=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};mr.create=a=>new mr({typeName:w.ZodUnknown,...Q(a)});var Qe=class extends W{_parse(e){let t=this._getOrReturnCtx(e);return $(t,{code:T.invalid_type,expected:k.never,received:t.parsedType}),B}};Qe.create=a=>new Qe({typeName:w.ZodNever,...Q(a)});var lt=class extends W{_parse(e){if(this._getType(e)!==k.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:T.invalid_type,expected:k.void,received:s.parsedType}),B}return Oe(e.data)}};lt.create=a=>new lt({typeName:w.ZodVoid,...Q(a)});var vr=class a extends W{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==k.array)return $(t,{code:T.invalid_type,expected:k.array,received:t.parsedType}),B;if(r.exactLength!==null){let i=t.data.length>r.exactLength.value,o=t.data.lengthr.maxLength.value&&($(t,{code:T.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((i,o)=>r.type._parseAsync(new Ve(t,i,t.path,o)))).then(i=>Re.mergeArray(s,i));let n=[...t.data].map((i,o)=>r.type._parseSync(new Ve(t,i,t.path,o)));return Re.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:z.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:z.toString(t)}})}nonempty(e){return this.min(1,e)}};vr.create=(a,e)=>new vr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...Q(e)});function it(a){if(a instanceof $e){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=ze.create(it(s))}return new $e({...a._def,shape:()=>e})}else return a instanceof vr?new vr({...a._def,type:it(a.element)}):a instanceof ze?ze.create(it(a.unwrap())):a instanceof nr?nr.create(it(a.unwrap())):a instanceof sr?sr.create(a.items.map(e=>it(e))):a}var $e=class a extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Y.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==k.object){let u=this._getOrReturnCtx(e);return $(u,{code:T.invalid_type,expected:k.object,received:u.parsedType}),B}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Qe&&this._def.unknownKeys==="strip"))for(let u in r.data)i.includes(u)||o.push(u);let c=[];for(let u of i){let p=n[u],m=r.data[u];c.push({key:{status:"valid",value:u},value:p._parse(new Ve(r,m,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof Qe){let u=this._def.unknownKeys;if(u==="passthrough")for(let p of o)c.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(u==="strict")o.length>0&&($(r,{code:T.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let p of o){let m=r.data[p];c.push({key:{status:"valid",value:p},value:u._parse(new Ve(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let p of c){let m=await p.key,E=await p.value;u.push({key:m,value:E,alwaysSet:p.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(s,u)):Re.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return z.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:z.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of Y.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of Y.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return it(this)}partial(e){let t={};for(let s of Y.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of Y.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Zs(Y.objectKeys(this.shape))}};$e.create=(a,e)=>new $e({shape:()=>a,unknownKeys:"strip",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});$e.strictCreate=(a,e)=>new $e({shape:()=>a,unknownKeys:"strict",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});$e.lazycreate=(a,e)=>new $e({shape:a,unknownKeys:"strip",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});var Mr=class extends W{_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 i=n.map(o=>new Ce(o.ctx.common.issues));return $(t,{code:T.invalid_union,unionErrors:i}),B}if(t.common.async)return Promise.all(s.map(async n=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let n,i=[];for(let c of s){let u={...t,common:{...t.common,issues:[]},parent:null},p=c._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=i.map(c=>new Ce(c));return $(t,{code:T.invalid_union,unionErrors:o}),B}}get options(){return this._def.options}};Mr.create=(a,e)=>new Mr({options:a,typeName:w.ZodUnion,...Q(e)});var hr=a=>a instanceof Ur?hr(a.schema):a instanceof He?hr(a.innerType()):a instanceof zr?[a.value]:a instanceof Vr?a.options:a instanceof Hr?Y.objectValues(a.enum):a instanceof Br?hr(a._def.innerType):a instanceof jr?[void 0]:a instanceof Fr?[null]:a instanceof ze?[void 0,...hr(a.unwrap())]:a instanceof nr?[null,...hr(a.unwrap())]:a instanceof bt||a instanceof Xr?hr(a.unwrap()):a instanceof Zr?hr(a._def.innerType):[],jt=class a extends W{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.object)return $(t,{code:T.invalid_type,expected:k.object,received:t.parsedType}),B;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):($(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let i=hr(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new a({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function Da(a,e){let t=ar(a),s=ar(e);if(a===e)return{valid:!0,data:a};if(t===k.object&&s===k.object){let r=Y.objectKeys(e),n=Y.objectKeys(a).filter(o=>r.indexOf(o)!==-1),i={...a,...e};for(let o of n){let c=Da(a[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===k.array&&s===k.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n{if(kt(n)||kt(i))return B;let o=Da(n.value,i.value);return o.valid?((Lt(n)||Lt(i))&&t.dirty(),{status:t.value,value:o.data}):($(s,{code:T.invalid_intersection_types}),B)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>r(n,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};qr.create=(a,e,t)=>new qr({left:a,right:e,typeName:w.ZodIntersection,...Q(t)});var sr=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.array)return $(s,{code:T.invalid_type,expected:k.array,received:s.parsedType}),B;if(s.data.lengththis._def.items.length&&($(s,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new Ve(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>Re.mergeArray(t,i)):Re.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};sr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sr({items:a,typeName:w.ZodTuple,rest:null,...Q(e)})};var Ft=class a extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.object)return $(s,{code:T.invalid_type,expected:k.object,received:s.parsedType}),B;let r=[],n=this._def.keyType,i=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new Ve(s,o,s.path,o)),value:i._parse(new Ve(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Re.mergeObjectAsync(t,r):Re.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof W?new a({keyType:e,valueType:t,typeName:w.ZodRecord,...Q(s)}):new a({keyType:Er.create(),valueType:e,typeName:w.ZodRecord,...Q(t)})}},ct=class extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.map)return $(s,{code:T.invalid_type,expected:k.map,received:s.parsedType}),B;let r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:r._parse(new Ve(s,o,s.path,[u,"key"])),value:n._parse(new Ve(s,c,s.path,[u,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,p=await c.value;if(u.status==="aborted"||p.status==="aborted")return B;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of i){let u=c.key,p=c.value;if(u.status==="aborted"||p.status==="aborted")return B;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}}}};ct.create=(a,e,t)=>new ct({valueType:e,keyType:a,typeName:w.ZodMap,...Q(t)});var ut=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.set)return $(s,{code:T.invalid_type,expected:k.set,received:s.parsedType}),B;let r=this._def;r.minSize!==null&&s.data.sizer.maxSize.value&&($(s,{code:T.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function i(c){let u=new Set;for(let p of c){if(p.status==="aborted")return B;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}let o=[...s.data.values()].map((c,u)=>n._parse(new Ve(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new a({...this._def,minSize:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ut.create=(a,e)=>new ut({valueType:a,minSize:null,maxSize:null,typeName:w.ZodSet,...Q(e)});var Mt=class a extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.function)return $(t,{code:T.invalid_type,expected:k.function,received:t.parsedType}),B;function s(o,c){return Et({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(u=>!!u),issueData:{code:T.invalid_arguments,argumentsError:c}})}function r(o,c){return Et({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(u=>!!u),issueData:{code:T.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Sr){let o=this;return Oe(async function(...c){let u=new Ce([]),p=await o._def.args.parseAsync(c,n).catch(d=>{throw u.addIssue(s(c,d)),u}),m=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(m,n).catch(d=>{throw u.addIssue(r(m,d)),u})})}else{let o=this;return Oe(function(...c){let u=o._def.args.safeParse(c,n);if(!u.success)throw new Ce([s(c,u.error)]);let p=Reflect.apply(i,this,u.data),m=o._def.returns.safeParse(p,n);if(!m.success)throw new Ce([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:sr.create(e).rest(mr.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||sr.create([]).rest(mr.create()),returns:t||mr.create(),typeName:w.ZodFunction,...Q(s)})}},Ur=class extends W{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})}};Ur.create=(a,e)=>new Ur({getter:a,typeName:w.ZodLazy,...Q(e)});var zr=class extends W{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return $(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};zr.create=(a,e)=>new zr({value:a,typeName:w.ZodLiteral,...Q(e)});function Zs(a,e){return new Vr({values:a,typeName:w.ZodEnum,...Q(e)})}var Vr=class a extends W{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{expected:Y.joinValues(s),received:t.parsedType,code:T.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{received:t.data,code:T.invalid_enum_value,options:s}),B}return Oe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Vr.create=Zs;var Hr=class extends W{_parse(e){let t=Y.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==k.string&&s.parsedType!==k.number){let r=Y.objectValues(t);return $(s,{expected:Y.joinValues(r),received:s.parsedType,code:T.invalid_type}),B}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=Y.objectValues(t);return $(s,{received:s.data,code:T.invalid_enum_value,options:r}),B}return Oe(e.data)}get enum(){return this._def.values}};Hr.create=(a,e)=>new Hr({values:a,typeName:w.ZodNativeEnum,...Q(e)});var Sr=class extends W{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.promise&&t.common.async===!1)return $(t,{code:T.invalid_type,expected:k.promise,received:t.parsedType}),B;let s=t.parsedType===k.promise?t.data:Promise.resolve(t.data);return Oe(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Sr.create=(a,e)=>new Sr({type:a,typeName:w.ZodPromise,...Q(e)});var He=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:i=>{$(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return B;let c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?B:c.status==="dirty"?Dr(c.value):t.value==="dirty"?Dr(c.value):c});{if(t.value==="aborted")return B;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?B:o.status==="dirty"?Dr(o.value):t.value==="dirty"?Dr(o.value):o}}if(r.type==="refinement"){let i=o=>{let c=r.refinement(o,n);if(s.common.async)return Promise.resolve(c);if(c 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"?B:(o.status==="dirty"&&t.dirty(),i(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"?B:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!_r(i))return B;let o=r.transform(i.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(i=>_r(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:t.value,value:o})):B);Y.assertNever(r)}};He.create=(a,e,t)=>new He({schema:a,typeName:w.ZodEffects,effect:e,...Q(t)});He.createWithPreprocess=(a,e,t)=>new He({schema:e,effect:{type:"preprocess",transform:a},typeName:w.ZodEffects,...Q(t)});var ze=class extends W{_parse(e){return this._getType(e)===k.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ze.create=(a,e)=>new ze({innerType:a,typeName:w.ZodOptional,...Q(e)});var nr=class extends W{_parse(e){return this._getType(e)===k.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(a,e)=>new nr({innerType:a,typeName:w.ZodNullable,...Q(e)});var Br=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===k.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Br.create=(a,e)=>new Br({innerType:a,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Zr=class extends W{_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 nt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ce(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ce(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Zr.create=(a,e)=>new Zr({innerType:a,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var dt=class extends W{_parse(e){if(this._getType(e)!==k.nan){let s=this._getOrReturnCtx(e);return $(s,{code:T.invalid_type,expected:k.nan,received:s.parsedType}),B}return{status:"valid",value:e.data}}};dt.create=a=>new dt({typeName:w.ZodNaN,...Q(a)});var tc=Symbol("zod_brand"),bt=class extends W{_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}},St=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?B:n.status==="dirty"?(t.dirty(),Dr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?B:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:w.ZodPipeline})}},Xr=class extends W{_parse(e){let t=this._def.innerType._parse(e),s=r=>(_r(r)&&(r.value=Object.freeze(r.value)),r);return nt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Xr.create=(a,e)=>new Xr({innerType:a,typeName:w.ZodReadonly,...Q(e)});function zs(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Xs(a,e={},t){return a?br.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(i=>{if(!i){let o=zs(e,s),c=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:c})}});if(!n){let i=zs(e,s),o=i.fatal??t??!0;r.addIssue({code:"custom",...i,fatal:o})}}):br.create()}var ac={object:$e.lazycreate},w;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(w||(w={}));var sc=(a,e={message:`Input not instance of ${a.name}`})=>Xs(t=>t instanceof a,e),Qs=Er.create,Gs=Cr.create,nc=dt.create,ic=$r.create,Ws=kr.create,oc=Lr.create,lc=ot.create,cc=jr.create,uc=Fr.create,dc=br.create,fc=mr.create,pc=Qe.create,hc=lt.create,mc=vr.create,vc=$e.create,gc=$e.strictCreate,yc=Mr.create,_c=jt.create,Ec=qr.create,bc=sr.create,Sc=Ft.create,xc=ct.create,Rc=ut.create,Tc=Mt.create,Pc=Ur.create,Oc=zr.create,wc=Vr.create,Ic=Hr.create,Ac=Sr.create,Nc=He.create,Dc=ze.create,Cc=nr.create,$c=He.createWithPreprocess,kc=St.create,Lc=()=>Qs().optional(),jc=()=>Gs().optional(),Fc=()=>Ws().optional(),Mc={string:a=>Er.create({...a,coerce:!0}),number:a=>Cr.create({...a,coerce:!0}),boolean:a=>kr.create({...a,coerce:!0}),bigint:a=>$r.create({...a,coerce:!0}),date:a=>Lr.create({...a,coerce:!0})};var qc=B;var Ca="2025-06-18";var Ks=[Ca,"2025-03-26","2024-11-05","2024-10-07"],qt="2.0",Js=l.union([l.string(),l.number().int()]),Ys=l.string(),Uc=l.object({progressToken:l.optional(Js)}).passthrough(),Be=l.object({_meta:l.optional(Uc)}).passthrough(),ke=l.object({method:l.string(),params:l.optional(Be)}),xt=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),ir=l.object({method:l.string(),params:l.optional(xt)}),Ze=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ut=l.union([l.string(),l.number().int()]),en=l.object({jsonrpc:l.literal(qt),id:Ut}).merge(ke).strict(),rn=a=>en.safeParse(a).success,tn=l.object({jsonrpc:l.literal(qt)}).merge(ir).strict(),an=a=>tn.safeParse(a).success,sn=l.object({jsonrpc:l.literal(qt),id:Ut,result:Ze}).strict(),$a=a=>sn.safeParse(a).success,Ge;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(Ge||(Ge={}));var nn=l.object({jsonrpc:l.literal(qt),id:Ut,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),on=a=>nn.safeParse(a).success,ln=l.union([en,tn,sn,nn]),zt=Ze.strict(),Vt=ir.extend({method:l.literal("notifications/cancelled"),params:xt.extend({requestId:Ut,reason:l.string().optional()})}),zc=l.object({src:l.string(),mimeType:l.optional(l.string()),sizes:l.optional(l.array(l.string()))}).passthrough(),Rt=l.object({icons:l.array(zc).optional()}).passthrough(),Tt=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),cn=Tt.extend({version:l.string(),websiteUrl:l.optional(l.string())}).merge(Rt),Vc=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),ka=ke.extend({method:l.literal("initialize"),params:Be.extend({protocolVersion:l.string(),capabilities:Vc,clientInfo:cn})});var Hc=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),Bc=Ze.extend({protocolVersion:l.string(),capabilities:Hc,serverInfo:cn,instructions:l.optional(l.string())}),La=ir.extend({method:l.literal("notifications/initialized")});var Ht=ke.extend({method:l.literal("ping")}),Zc=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),Bt=ir.extend({method:l.literal("notifications/progress"),params:xt.merge(Zc).extend({progressToken:Js})}),Zt=ke.extend({params:Be.extend({cursor:l.optional(Ys)}).optional()}),Xt=Ze.extend({nextCursor:l.optional(Ys)}),un=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),dn=un.extend({text:l.string()}),ja=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),fn=un.extend({blob:ja}),pn=Tt.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).merge(Rt),Xc=Tt.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).merge(Rt),Qc=Zt.extend({method:l.literal("resources/list")}),Gc=Xt.extend({resources:l.array(pn)}),Wc=Zt.extend({method:l.literal("resources/templates/list")}),Kc=Xt.extend({resourceTemplates:l.array(Xc)}),Jc=ke.extend({method:l.literal("resources/read"),params:Be.extend({uri:l.string()})}),Yc=Ze.extend({contents:l.array(l.union([dn,fn]))}),eu=ir.extend({method:l.literal("notifications/resources/list_changed")}),ru=ke.extend({method:l.literal("resources/subscribe"),params:Be.extend({uri:l.string()})}),tu=ke.extend({method:l.literal("resources/unsubscribe"),params:Be.extend({uri:l.string()})}),au=ir.extend({method:l.literal("notifications/resources/updated"),params:xt.extend({uri:l.string()})}),su=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),nu=Tt.extend({description:l.optional(l.string()),arguments:l.optional(l.array(su)),_meta:l.optional(l.object({}).passthrough())}).merge(Rt),iu=Zt.extend({method:l.literal("prompts/list")}),ou=Xt.extend({prompts:l.array(nu)}),lu=ke.extend({method:l.literal("prompts/get"),params:Be.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),Fa=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ma=l.object({type:l.literal("image"),data:ja,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),qa=l.object({type:l.literal("audio"),data:ja,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),cu=l.object({type:l.literal("resource"),resource:l.union([dn,fn]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),uu=pn.extend({type:l.literal("resource_link")}),hn=l.union([Fa,Ma,qa,uu,cu]),du=l.object({role:l.enum(["user","assistant"]),content:hn}).passthrough(),fu=Ze.extend({description:l.optional(l.string()),messages:l.array(du)}),pu=ir.extend({method:l.literal("notifications/prompts/list_changed")}),hu=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),mu=Tt.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(hu),_meta:l.optional(l.object({}).passthrough())}).merge(Rt),Ua=Zt.extend({method:l.literal("tools/list")}),vu=Xt.extend({tools:l.array(mu)}),mn=Ze.extend({content:l.array(hn).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),mp=mn.or(Ze.extend({toolResult:l.unknown()})),za=ke.extend({method:l.literal("tools/call"),params:Be.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),gu=ir.extend({method:l.literal("notifications/tools/list_changed")}),Pt=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Va=ke.extend({method:l.literal("logging/setLevel"),params:Be.extend({level:Pt})}),yu=ir.extend({method:l.literal("notifications/message"),params:xt.extend({level:Pt,logger:l.optional(l.string()),data:l.unknown()})}),_u=l.object({name:l.string().optional()}).passthrough(),Eu=l.object({hints:l.optional(l.array(_u)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),bu=l.object({role:l.enum(["user","assistant"]),content:l.union([Fa,Ma,qa])}).passthrough(),Su=ke.extend({method:l.literal("sampling/createMessage"),params:Be.extend({messages:l.array(bu),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(Eu)})}),Ha=Ze.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[Fa,Ma,qa])}),xu=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),Ru=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),Tu=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),Pu=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),Ou=l.union([xu,Ru,Tu,Pu]),wu=ke.extend({method:l.literal("elicitation/create"),params:Be.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),Ou),required:l.optional(l.array(l.string()))}).passthrough()})}),Ba=Ze.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),Iu=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var Au=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),Nu=ke.extend({method:l.literal("completion/complete"),params:Be.extend({ref:l.union([Au,Iu]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),Du=Ze.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),Cu=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),$u=ke.extend({method:l.literal("roots/list")}),Za=Ze.extend({roots:l.array(Cu)}),ku=ir.extend({method:l.literal("notifications/roots/list_changed")}),vp=l.union([Ht,ka,Nu,Va,lu,iu,Qc,Wc,Jc,ru,tu,za,Ua]),gp=l.union([Vt,Bt,La,ku]),yp=l.union([zt,Ha,Ba,Za]),_p=l.union([Ht,Su,wu,$u]),Ep=l.union([Vt,Bt,yu,au,eu,gu,pu]),bp=l.union([zt,Bc,Du,fu,ou,Gc,Kc,Yc,mn,vu]),We=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Lu=6e4,Qt=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(Vt,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Bt,t=>{this._onprogress(t)}),this.setRequestHandler(Ht,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 We(Ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,u)=>{o?.(c,u),$a(c)||on(c)?this._onresponse(c):rn(c)?this._onrequest(c,u):an(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},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 We(Ge.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:Ge.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let c={signal:o.signal,sessionId:i?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,p,m)=>this.request(u,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,c)).then(u=>{if(!o.signal.aborted)return i?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var p;if(!o.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:Ge.InternalError,message:(p=u.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).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 i=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){i(c);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),$a(e))s(e);else{let r=new We(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:i}=s??{};return new Promise((o,c)=>{var u,p,m,E,d,g;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.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 S=P=>{var A;this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),(A=this._transport)===null||A===void 0||A.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(P)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`))),c(P)};this._responseHandlers.set(_,P=>{var A;if(!(!((A=s?.signal)===null||A===void 0)&&A.aborted)){if(P instanceof Error)return c(P);try{let N=t.parse(P.result);o(N)}catch(N){c(N)}}}),(E=s?.signal)===null||E===void 0||E.addEventListener("abort",()=>{var P;S((P=s?.signal)===null||P===void 0?void 0:P.reason)});let O=(d=s?.timeout)!==null&&d!==void 0?d:Lu,R=()=>S(new We(Ge.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(_,O,s?.maxTotalTimeout,R,(g=s?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(_),c(P)})})}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 c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,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 vn(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 _o=Al(yo(),1),pa=class extends Qt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Pt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(r)this._oninitialize(r)),this.setNotificationHandler(La,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Va,async(r,n)=>{var i;let o=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:c}=r.params,u=Pt.safeParse(c);return u.success&&this._loggingLevels.set(o,u.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=vn(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:Ks.includes(t)?t:Ca,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},zt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Ha,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 _o.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new We(Ge.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof We?r:new We(Ge.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Za,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"})}};import bo from"node:process";var ha=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` +var xl=Object.create;var Ia=Object.defineProperty;var Rl=Object.getOwnPropertyDescriptor;var Tl=Object.getOwnPropertyNames;var Pl=Object.getPrototypeOf,Ol=Object.prototype.hasOwnProperty;var X=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),wl=(a,e)=>{for(var t in e)Ia(a,t,{get:e[t],enumerable:!0})},Il=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Tl(e))!Ol.call(a,r)&&r!==t&&Ia(a,r,{get:()=>e[r],enumerable:!(s=Rl(e,r))||s.enumerable});return a};var Al=(a,e,t)=>(t=a!=null?xl(Pl(a)):{},Il(e||!a||!a.__esModule?Ia(t,"default",{value:a,enumerable:!0}):t,a));var yn=X((Gt,gn)=>{(function(a,e){typeof Gt=="object"&&typeof gn<"u"?e(Gt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Gt,function(a){"use strict";function e(){for(var h=arguments.length,f=Array(h),y=0;y1){f[0]=f[0].slice(0,-1);for(var b=f.length-1,x=1;x= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=d-g,U=Math.floor,M=String.fromCharCode;function j(h){throw new RangeError(q[h])}function I(h,f){for(var y=[],b=h.length;b--;)y[b]=f(h[b]);return y}function C(h,f){var y=h.split("@"),b="";y.length>1&&(b=y[0]+"@",h=y[1]),h=h.replace(V,".");var x=h.split("."),L=I(x,f).join(".");return b+L}function F(h){for(var f=[],y=0,b=h.length;y=55296&&x<=56319&&y>1,f+=U(f/y);f>D*_>>1;x+=d)f=U(f/D);return U(x+(D+1)*f/(f+v))},H=function(f){var y=[],b=f.length,x=0,L=R,G=T,ae=f.lastIndexOf(P);ae<0&&(ae=0);for(var oe=0;oe=128&&j("not-basic"),y.push(f.charCodeAt(oe));for(var Ee=ae>0?ae+1:0;Ee=b&&j("invalid-input");var de=J(f.charCodeAt(Ee++));(de>=d||de>U((E-x)/pe))&&j("overflow"),x+=de*pe;var ne=be<=G?g:be>=G+_?_:be-G;if(deU(E/he)&&j("overflow"),pe*=he}var ce=y.length+1;G=K(x-te,ce,te==0),U(x/ce)>E-L&&j("overflow"),L+=U(x/ce),x%=ce,y.splice(x++,0,L)}return String.fromCodePoint.apply(String,y)},me=function(f){var y=[];f=F(f);var b=f.length,x=R,L=0,G=T,ae=!0,oe=!1,Ee=void 0;try{for(var te=f[Symbol.iterator](),pe;!(ae=(pe=te.next()).done);ae=!0){var be=pe.value;be<128&&y.push(M(be))}}catch(Nr){oe=!0,Ee=Nr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw Ee}}var de=y.length,ne=de;for(de&&y.push(P);ne=x&&FeU((E-L)/Ue)&&j("overflow"),L+=(he-x)*Ue,x=he;var tr=!0,Ar=!1,ur=void 0;try{for(var mt=f[Symbol.iterator](),Dt;!(tr=(Dt=mt.next()).done);tr=!0){var Ct=Dt.value;if(CtE&&j("overflow"),Ct==x){for(var Jr=L,Yr=d;;Yr+=d){var dr=Yr<=G?g:Yr>=G+_?_:Yr-G;if(Jr>6|192).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase():y="%"+(f>>12|224).toString(16).toUpperCase()+"%"+(f>>6&63|128).toString(16).toUpperCase()+"%"+(f&63|128).toString(16).toUpperCase(),y}function Ie(h){for(var f="",y=0,b=h.length;y=194&&x<224){if(b-y>=6){var L=parseInt(h.substr(y+4,2),16);f+=String.fromCharCode((x&31)<<6|L&63)}else f+=h.substr(y,6);y+=6}else if(x>=224){if(b-y>=9){var G=parseInt(h.substr(y+4,2),16),ae=parseInt(h.substr(y+7,2),16);f+=String.fromCharCode((x&15)<<12|(G&63)<<6|ae&63)}else f+=h.substr(y,9);y+=9}else f+=h.substr(y,3),y+=3}return f}function gr(h,f){function y(b){var x=Ie(b);return x.match(f.UNRESERVED)?x:b}return h.scheme&&(h.scheme=String(h.scheme).replace(f.PCT_ENCODED,y).toLowerCase().replace(f.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(f.PCT_ENCODED,y).replace(f.NOT_USERINFO,Se).replace(f.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(f.PCT_ENCODED,y).toLowerCase().replace(f.NOT_HOST,Se).replace(f.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(f.PCT_ENCODED,y).replace(h.scheme?f.NOT_PATH:f.NOT_PATH_NOSCHEME,Se).replace(f.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(f.PCT_ENCODED,y).replace(f.NOT_QUERY,Se).replace(f.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(f.PCT_ENCODED,y).replace(f.NOT_FRAGMENT,Se).replace(f.PCT_ENCODED,r)),h}function lr(h){return h.replace(/^0*(.*)/,"$1")||"0"}function _e(h,f){var y=h.match(f.IPV4ADDRESS)||[],b=p(y,2),x=b[1];return x?x.split(".").map(lr).join("."):h}function ve(h,f){var y=h.match(f.IPV6ADDRESS)||[],b=p(y,3),x=b[1],L=b[2];if(x){for(var G=x.toLowerCase().split("::").reverse(),ae=p(G,2),oe=ae[0],Ee=ae[1],te=Ee?Ee.split(":").map(lr):[],pe=oe.split(":").map(lr),be=f.IPV4ADDRESS.test(pe[pe.length-1]),de=be?7:8,ne=pe.length-de,he=Array(de),ce=0;ce1){var ue=he.slice(0,je.index),Fe=he.slice(je.index+je.length);qe=ue.join(":")+"::"+Fe.join(":")}else qe=he.join(":");return L&&(qe+="%"+L),qe}else return h}var Pr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Pe="".match(/(){0}/)[1]===void 0;function ie(h){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y={},b=f.iri!==!1?u:c;f.reference==="suffix"&&(h=(f.scheme?f.scheme+":":"")+"//"+h);var x=h.match(Pr);if(x){Pe?(y.scheme=x[1],y.userinfo=x[3],y.host=x[4],y.port=parseInt(x[5],10),y.path=x[6]||"",y.query=x[7],y.fragment=x[8],isNaN(y.port)&&(y.port=x[5])):(y.scheme=x[1]||void 0,y.userinfo=h.indexOf("@")!==-1?x[3]:void 0,y.host=h.indexOf("//")!==-1?x[4]:void 0,y.port=parseInt(x[5],10),y.path=x[6]||"",y.query=h.indexOf("?")!==-1?x[7]:void 0,y.fragment=h.indexOf("#")!==-1?x[8]:void 0,isNaN(y.port)&&(y.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?x[4]:void 0)),y.host&&(y.host=ve(_e(y.host,b),b)),y.scheme===void 0&&y.userinfo===void 0&&y.host===void 0&&y.port===void 0&&!y.path&&y.query===void 0?y.reference="same-document":y.scheme===void 0?y.reference="relative":y.fragment===void 0?y.reference="absolute":y.reference="uri",f.reference&&f.reference!=="suffix"&&f.reference!==y.reference&&(y.error=y.error||"URI is not a "+f.reference+" reference.");var L=ye[(f.scheme||y.scheme||"").toLowerCase()];if(!f.unicodeSupport&&(!L||!L.unicodeSupport)){if(y.host&&(f.domainHost||L&&L.domainHost))try{y.host=se.toASCII(y.host.replace(b.PCT_ENCODED,Ie).toLowerCase())}catch(G){y.error=y.error||"Host's domain name can not be converted to ASCII via punycode: "+G}gr(y,c)}else gr(y,b);L&&L.parse&&L.parse(y,f)}else y.error=y.error||"URI can not be parsed.";return y}function yr(h,f){var y=f.iri!==!1?u:c,b=[];return h.userinfo!==void 0&&(b.push(h.userinfo),b.push("@")),h.host!==void 0&&b.push(ve(_e(String(h.host),y),y).replace(y.IPV6ADDRESS,function(x,L,G){return"["+L+(G?"%25"+G:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(b.push(":"),b.push(String(h.port))),b.length?b.join(""):void 0}var cr=/^\.\.?\//,Or=/^\/\.(\/|$)/,wr=/^\/\.\.(\/|$)/,xe=/^\/?(?:.|\n)*?(?=\/|$)/;function Me(h){for(var f=[];h.length;)if(h.match(cr))h=h.replace(cr,"");else if(h.match(Or))h=h.replace(Or,"/");else if(h.match(wr))h=h.replace(wr,"/"),f.pop();else if(h==="."||h==="..")h="";else{var y=h.match(xe);if(y){var b=y[0];h=h.slice(b.length),f.push(b)}else throw new Error("Unexpected dot segment condition")}return f.join("")}function De(h){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=f.iri?u:c,b=[],x=ye[(f.scheme||h.scheme||"").toLowerCase()];if(x&&x.serialize&&x.serialize(h,f),h.host&&!y.IPV6ADDRESS.test(h.host)){if(f.domainHost||x&&x.domainHost)try{h.host=f.iri?se.toUnicode(h.host):se.toASCII(h.host.replace(y.PCT_ENCODED,Ie).toLowerCase())}catch(ae){h.error=h.error||"Host's domain name can not be converted to "+(f.iri?"Unicode":"ASCII")+" via punycode: "+ae}}gr(h,y),f.reference!=="suffix"&&h.scheme&&(b.push(h.scheme),b.push(":"));var L=yr(h,f);if(L!==void 0&&(f.reference!=="suffix"&&b.push("//"),b.push(L),h.path&&h.path.charAt(0)!=="/"&&b.push("/")),h.path!==void 0){var G=h.path;!f.absolutePath&&(!x||!x.absolutePath)&&(G=Me(G)),L===void 0&&(G=G.replace(/^\/\//,"/%2F")),b.push(G)}return h.query!==void 0&&(b.push("?"),b.push(h.query)),h.fragment!==void 0&&(b.push("#"),b.push(h.fragment)),b.join("")}function Ae(h,f){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},b=arguments[3],x={};return b||(h=ie(De(h,y),y),f=ie(De(f,y),y)),y=y||{},!y.tolerant&&f.scheme?(x.scheme=f.scheme,x.userinfo=f.userinfo,x.host=f.host,x.port=f.port,x.path=Me(f.path||""),x.query=f.query):(f.userinfo!==void 0||f.host!==void 0||f.port!==void 0?(x.userinfo=f.userinfo,x.host=f.host,x.port=f.port,x.path=Me(f.path||""),x.query=f.query):(f.path?(f.path.charAt(0)==="/"?x.path=Me(f.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?x.path="/"+f.path:h.path?x.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+f.path:x.path=f.path,x.path=Me(x.path)),x.query=f.query):(x.path=h.path,f.query!==void 0?x.query=f.query:x.query=h.query),x.userinfo=h.userinfo,x.host=h.host,x.port=h.port),x.scheme=h.scheme),x.fragment=f.fragment,x}function er(h,f,y){var b=i({scheme:"null"},y);return De(Ae(ie(h,b),ie(f,b),b,!0),b)}function Le(h,f){return typeof h=="string"?h=De(ie(h,f),f):s(h)==="object"&&(h=ie(De(h,f),f)),h}function Nt(h,f,y){return typeof h=="string"?h=De(ie(h,y),y):s(h)==="object"&&(h=De(h,y)),typeof f=="string"?f=De(ie(f,y),y):s(f)==="object"&&(f=De(f,y)),h===f}function Ta(h,f){return h&&h.toString().replace(!f||!f.iri?c.ESCAPE:u.ESCAPE,Se)}function Xe(h,f){return h&&h.toString().replace(!f||!f.iri?c.PCT_ENCODED:u.PCT_ENCODED,Ie)}var pt={scheme:"http",domainHost:!0,parse:function(f,y){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f},serialize:function(f,y){var b=String(f.scheme).toLowerCase()==="https";return(f.port===(b?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}},ws={scheme:"https",domainHost:pt.domainHost,parse:pt.parse,serialize:pt.serialize};function Is(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var ht={scheme:"ws",domainHost:!0,parse:function(f,y){var b=f;return b.secure=Is(b),b.resourceName=(b.path||"/")+(b.query?"?"+b.query:""),b.path=void 0,b.query=void 0,b},serialize:function(f,y){if((f.port===(Is(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){var b=f.resourceName.split("?"),x=p(b,2),L=x[0],G=x[1];f.path=L&&L!=="/"?L:void 0,f.query=G,f.resourceName=void 0}return f.fragment=void 0,f}},As={scheme:"wss",domainHost:ht.domainHost,parse:ht.parse,serialize:ht.serialize},sl={},nl=!0,Ns="[A-Za-z0-9\\-\\.\\_\\~"+(nl?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",rr="[0-9A-Fa-f]",il=t(t("%[EFef]"+rr+"%"+rr+rr+"%"+rr+rr)+"|"+t("%[89A-Fa-f]"+rr+"%"+rr+rr)+"|"+t("%"+rr+rr)),ol="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",ll="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",cl=e(ll,'[\\"\\\\]'),ul="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",dl=new RegExp(Ns,"g"),Kr=new RegExp(il,"g"),fl=new RegExp(e("[^]",ol,"[\\.]",'[\\"]',cl),"g"),Ds=new RegExp(e("[^]",Ns,ul),"g"),pl=Ds;function Pa(h){var f=Ie(h);return f.match(dl)?f:h}var Cs={scheme:"mailto",parse:function(f,y){var b=f,x=b.to=b.path?b.path.split(","):[];if(b.path=void 0,b.query){for(var L=!1,G={},ae=b.query.split("&"),oe=0,Ee=ae.length;oe{"use strict";_n.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 i=n[r];if(!a(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}});var bn=X((Pp,En)=>{"use strict";En.exports=function(e){for(var t=0,s=e.length,r=0,n;r=55296&&n<=56319&&r{"use strict";Rn.exports={copy:ju,checkDataType:Xa,checkDataTypes:Fu,coerceToTypes:Mu,toHash:Ga,getProperty:Wa,escapeQuotes:Ka,equal:Wt(),ucs2length:bn(),varOccurences:zu,varReplace:Vu,schemaHasRules:Hu,schemaHasRulesExcept:Bu,schemaUnknownRules:Zu,toQuotedString:Qa,getPathExpr:Xu,getPath:Qu,getData:Ku,unescapeFragment:Ju,unescapeJsonPointer:Ya,escapeFragment:Yu,escapeJsonPointer:Ja};function ju(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Xa(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",o=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+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+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Fu(a,e,t){switch(a.length){case 1:return Xa(a[0],e,t,!0);default:var s="",r=Ga(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?" && ":"")+Xa(n,e,t,!0);return s}}var Sn=Ga(["string","number","integer","boolean","null"]);function Mu(a,e){if(Array.isArray(e)){for(var t=[],s=0;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,c=r.split("/"),u=0;u{"use strict";var ed=Qr();Tn.exports=rd;function rd(a){ed.copy(a,this)}});var On=X((Ip,Pn)=>{"use strict";var xr=Pn.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Kt(e,s,r,a,"",a)};xr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};xr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xr.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 Kt(a,e,t,s,r,n,i,o,c,u){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,c,u);for(var p in s){var m=s[p];if(Array.isArray(m)){if(p in xr.arrayKeywords)for(var E=0;E{"use strict";var Ot=yn(),wn=Wt(),ra=Qr(),Jt=es(),ad=On();Nn.exports=Tr;Tr.normalizeId=Rr;Tr.fullPath=Yt;Tr.url=ea;Tr.ids=ld;Tr.inlineRef=rs;Tr.schema=ta;function Tr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Tr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Jt)return rs(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=ta.call(this,e,t),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Jt?i=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(i=rs(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),i}function ta(a,e){var t=Ot.parse(e),s=An(t),r=Yt(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Rr(s),i=this._refs[n];if(typeof i=="string")return sd.call(this,a,i,t);if(i instanceof Jt)i.validate||this._compile(i),a=i;else if(i=this._schemas[n],i instanceof Jt){if(i.validate||this._compile(i),n==Rr(e))return{schema:i,root:a,baseId:r};a=i}else return;if(!a.schema)return;r=Yt(this._getId(a.schema))}return In.call(this,t,r,a.schema,a)}function sd(a,e,t){var s=ta.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var i=this._getId(r);return i&&(n=ea(n,i)),In.call(this,t,n,r,a)}}var nd=ra.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{"use strict";var ss=aa();Cn.exports={Validation:Dn(cd),MissingRef:Dn(ns)};function cd(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}ns.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function ns(a,e,t){this.message=t||ns.message(a,e),this.missingRef=ss.url(a,e),this.missingSchema=ss.normalizeId(ss.fullPath(this.missingRef))}function Dn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var is=X((Dp,$n)=>{"use strict";$n.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(i){return function(o,c){var u={key:o,value:i[o]},p={key:c,value:i[c]};return n(u,p)}}}(e.cmp),r=[];return function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,c;if(Array.isArray(i)){for(c="[",o=0;o{"use strict";kn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var c=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(c){var u="unknown keyword: "+c;if(e.opts.strictKeywords==="log")e.logger.warn(u);else throw new Error(u)}}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"||!(i||e.schema.$ref)){var t="false schema",p=e.level,m=e.dataLevel,E=e.schema[t],d=e.schemaPath+e.util.getProperty(t),g=e.errSchemaPath+"/"+t,A=!e.opts.allErrors,q,_="data"+(m||""),P="valid"+p;if(e.schema===!1){e.isTop?A=!0:r+=" var "+P+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(g)+" , 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 S=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+P+" = 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 R="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(R);else throw new Error(R)}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 P="valid"+p,A=!e.opts.allErrors,N="",V="",q,D=e.schema.type,U=Array.isArray(D);if(D&&e.opts.nullable&&e.schema.nullable===!0&&(U?D.indexOf("null")==-1&&(D=D.concat("null")):D!="null"&&(D=[D,"null"],U=!0)),U&&D.length==1&&(D=D[0],U=!1),e.schema.$ref&&i){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&&(i=!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")),D){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,D);var j=e.RULES.types[D];if(M||U||j===!0||j&&!xe(j)){var d=e.schemaPath+".type",g=e.errSchemaPath+"/type",d=e.schemaPath+".type",g=e.errSchemaPath+"/type",I=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[I](D,_,e.opts.strictNumbers,!0)+") { ",M){var C="dataType"+p,F="coerced"+p;r+=" var "+C+" = typeof "+_+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+C+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+C+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+F+" = "+_+"; } "),r+=" if ("+F+" !== undefined) ; ";var le=M;if(le)for(var J,re=-1,K=le.length-1;re{"use strict";var na=aa(),oa=Qr(),jn=sa(),ud=is(),Ln=os(),dd=oa.ucs2length,fd=Wt(),pd=jn.Validation;Mn.exports=ls;function ls(a,e,t,s){var r=this,n=this._opts,i=[void 0],o={},c=[],u={},p=[],m={},E=[];e=e||{schema:a,refVal:i,refs:o};var d=hd.call(this,a,e,s),g=this._compilations[d.index];if(d.compiling)return g.callValidate=R;var _=this._formats,v=this.RULES;try{var S=P(a,e,t,s);g.validate=S;var T=g.callValidate;return T&&(T.schema=S.schema,T.errors=null,T.refs=S.refs,T.refVal=S.refVal,T.root=S.root,T.$async=S.$async,n.sourceCode&&(T.source=S.source)),S}finally{md.call(this,a,e,s)}function R(){var I=g.validate,C=I.apply(this,arguments);return R.errors=I.errors,C}function P(I,C,F,le){var J=!C||C&&C.schema==I;if(C.schema!=e.schema)return ls.call(r,I,C,F,le);var re=I.$async===!0,K=Ln({isTop:!0,schema:I,isRoot:J,baseId:le,root:C,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:jn.MissingRef,RULES:v,validate:Ln,util:oa,resolve:na,resolveRef:A,usePattern:U,useDefault:M,useCustomRule:j,opts:n,formats:_,logger:r.logger,self:r});K=ia(i,yd)+ia(c,vd)+ia(p,gd)+ia(E,_d)+K,n.processCode&&(K=n.processCode(K,I));var H;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",K);H=me(r,v,_,e,i,p,E,fd,dd,pd),i[0]=H}catch(Te){throw r.logger.error("Error compiling schema, function code:",K),Te}return H.schema=I,H.errors=null,H.refs=o,H.refVal=i,H.root=J?H:C,re&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:K,patterns:c,defaults:p}),H}function A(I,C,F){C=na.url(I,C);var le=o[C],J,re;if(le!==void 0)return J=i[le],re="refVal["+le+"]",D(J,re);if(!F&&e.refs){var K=e.refs[C];if(K!==void 0)return J=e.refVal[K],re=N(C,J),D(J,re)}re=N(C);var H=na.call(r,P,e,C);if(H===void 0){var me=t&&t[C];me&&(H=na.inlineRef(me,n.inlineRefs)?me:ls.call(r,me,e,t,I))}if(H===void 0)V(C);else return q(C,H),D(H,re)}function N(I,C){var F=i.length;return i[F]=C,o[I]=F,"refVal"+F}function V(I){delete o[I]}function q(I,C){var F=o[I];i[F]=C}function D(I,C){return typeof I=="object"||typeof I=="boolean"?{code:C,schema:I,inline:!0}:{code:C,$async:I&&!!I.$async}}function U(I){var C=u[I];return C===void 0&&(C=u[I]=c.length,c[C]=I),"pattern"+C}function M(I){switch(typeof I){case"boolean":case"number":return""+I;case"string":return oa.toQuotedString(I);case"object":if(I===null)return"null";var C=ud(I),F=m[C];return F===void 0&&(F=m[C]=p.length,p[F]=I),"default"+F}}function j(I,C,F,le){if(r._opts.validateSchema!==!1){var J=I.definition.dependencies;if(J&&!J.every(function(Se){return Object.prototype.hasOwnProperty.call(F,Se)}))throw new Error("parent schema must have all required keywords: "+J.join(","));var re=I.definition.validateSchema;if(re){var K=re(C);if(!K){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=I.definition.compile,Te=I.definition.inline,we=I.definition.macro,se;if(me)se=me.call(r,C,F,le);else if(we)se=we.call(r,C,F,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Te)se=Te.call(r,le,I.keyword,C,F);else if(se=I.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+I.keyword+'"failed to compile');var ye=E.length;return E[ye]=se,{code:"customRule"+ye,validate:se}}}function hd(a,e,t){var s=Fn.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 md(a,e,t){var s=Fn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Fn(a,e,t){for(var s=0;s{"use strict";var la=Un.exports=function(){this._cache={}};la.prototype.put=function(e,t){this._cache[e]=t};la.prototype.get=function(e){return this._cache[e]};la.prototype.del=function(e){delete this._cache[e]};la.prototype.clear=function(){this._cache={}}});var ei=X((Lp,Yn)=>{"use strict";var Ed=Qr(),bd=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Sd=[0,31,28,31,30,31,30,31,31,30,31,30,31],xd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Vn=/^(?=.{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,Rd=/^(?:[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,Td=/^(?:[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,Hn=/^(?:(?:[^\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,Bn=/^(?:(?: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,Zn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Xn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Qn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Gn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Yn.exports=ca;function ca(a){return a=a=="full"?"full":"fast",Ed.copy(ca[a])}ca.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":Hn,url:Bn,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:Vn,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:Jn,uuid:Zn,"json-pointer":Xn,"json-pointer-uri-fragment":Qn,"relative-json-pointer":Gn};ca.full={date:Wn,time:Kn,"date-time":wd,uri:Ad,"uri-reference":Td,"uri-template":Hn,url:Bn,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:Vn,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:Jn,uuid:Zn,"json-pointer":Xn,"json-pointer-uri-fragment":Qn,"relative-json-pointer":Gn};function Pd(a){return a%4===0&&(a%100!==0||a%400===0)}function Wn(a){var e=a.match(bd);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Pd(t)?29:Sd[s])}function Kn(a,e){var t=a.match(xd);if(!t)return!1;var s=t[1],r=t[2],n=t[3],i=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var Od=/t|\s/i;function wd(a){var e=a.split(Od);return e.length==2&&Wn(e[0])&&Kn(e[1],!0)}var Id=/\/|:/;function Ad(a){return Id.test(a)&&Rd.test(a)}var Nd=/[^\\]\\Z/;function Jn(a){if(Nd.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var ti=X((jp,ri)=>{"use strict";ri.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,p="data"+(i||""),m="valid"+n,E,d;if(o=="#"||o=="#/")e.isRoot?(E=e.async,d="validate"):(E=e.root.schema.$async===!0,d="root.refVal[0]");else{var g=e.resolveRef(e.baseId,o,e.isRoot);if(g===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(c)+" , 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 S=r;r=v.pop(),!e.compositeRule&&u?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),u&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,_)}else if(g.inline){var T=e.util.copy(e);T.level++;var R="valid"+T.level;T.schema=g.schema,T.schemaPath="",T.errSchemaPath=o;var P=e.validate(T).replace(/validate\.schema/g,g.code);r+=" "+P+" ",u&&(r+=" if ("+R+") { ")}else E=g.$async===!0||e.async&&g.$async!==!1,d=g.code}if(d){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var A=i?"data"+(i-1||""):"parentData",N=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+A+" , "+N+", rootData) ";var V=r;if(r=v.pop(),E){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(r+=" var "+m+"; "),r+=" try { await "+V+"; ",u&&(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; ",u&&(r+=" "+m+" = false; "),r+=" } ",u&&(r+=" if ("+m+") { ")}else r+=" if (!"+V+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",u&&(r+=" else { ")}return r}});var si=X((Fp,ai)=>{"use strict";ai.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u=e.util.copy(e),p="";u.level++;var m="valid"+u.level,E=u.baseId,d=!0,g=n;if(g)for(var _,v=-1,S=g.length-1;v0||_===!1:e.util.schemaHasRules(_,e.RULES.all))&&(d=!1,u.schema=_,u.schemaPath=i+"["+v+"]",u.errSchemaPath=o+"/"+v,r+=" "+e.validate(u)+" ",u.baseId=E,c&&(r+=" if ("+m+") { ",p+="}"));return c&&(d?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var ii=X((Mp,ni)=>{"use strict";ni.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S=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(S){var T=g.baseId;r+=" var "+d+" = errors; var "+E+" = false; ";var R=e.compositeRule;e.compositeRule=g.compositeRule=!0;var P=o;if(P)for(var A,N=-1,V=P.length-1;N{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,c=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+c+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+c+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r}});var ui=X((Up,ci)=>{"use strict";ci.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d=e.opts.$data&&o&&o.$data,g;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o,d||(r+=" var schema"+n+" = validate.schema"+c+";"),r+="var "+E+" = equal("+m+", schema"+n+"); if (!"+E+") { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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 fi=X((zp,di)=>{"use strict";di.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S="i"+n,T=g.dataLevel=e.dataLevel+1,R="data"+T,P=e.baseId,A=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+d+" = errors;var "+E+";",A){var N=e.compositeRule;e.compositeRule=g.compositeRule=!0,g.schema=o,g.schemaPath=c,g.errSchemaPath=u,r+=" var "+v+" = false; for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var V=m+"["+S+"]";g.dataPathArr[T]=S;var q=e.validate(g);g.baseId=P,e.util.varOccurences(q,R)<2?r+=" "+e.util.varReplace(q,R,V)+" ":r+=" var "+R+" = "+V+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=g.compositeRule=N,r+=" "+_+" if (!"+v+") {"}else r+=" if ("+m+".length == 0) {";var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var U=r;return r=D.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 { ",A&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var hi=X((Vp,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,d=e.util.copy(e),g="";d.level++;var _="valid"+d.level,v={},S={},T=e.opts.ownProperties;for(N in o)if(N!="__proto__"){var R=o[N],P=Array.isArray(R)?S:v;P[N]=R}r+="var "+E+" = errors;";var A=e.errorPath;r+="var missing"+n+";";for(var N in S)if(P=S[N],P.length){if(r+=" if ( "+m+e.util.getProperty(N)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(N)+"') "),p){r+=" && ( ";var V=P;if(V)for(var q,D=-1,U=V.length-1;D0||R===!1:e.util.schemaHasRules(R,e.RULES.all))&&(r+=" "+_+" = true; if ( "+m+e.util.getProperty(N)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(N)+"') "),r+=") { ",d.schema=R,d.schemaPath=c+e.util.getProperty(N),d.errSchemaPath=u+"/"+e.util.escapeFragment(N),r+=" "+e.validate(d)+" ",d.baseId=H,r+=" } ",p&&(r+=" if ("+_+") { ",g+="}"))}return p&&(r+=" "+g+" if ("+E+" == errors) {"),r}});var vi=X((Hp,mi)=>{"use strict";mi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d=e.opts.$data&&o&&o.$data,g;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o;var _="i"+n,v="schema"+n;d||(r+=" var "+v+" = validate.schema"+c+";"),r+="var "+E+";",d&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=""+E+" = false;for (var "+_+"=0; "+_+"<"+v+".length; "+_+"++) if (equal("+m+", "+v+"["+_+"])) { "+E+" = true; break; }",d&&(r+=" } "),r+=" if (!"+E+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var T=r;return r=S.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 yi=X((Bp,gi)=>{"use strict";gi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var E=e.opts.$data&&o&&o.$data,d;E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var g=e.opts.unknownFormats,_=Array.isArray(g);if(E){var v="format"+n,S="isObject"+n,T="formatType"+n;r+=" var "+v+" = formats["+d+"]; var "+S+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+T+" = "+S+" && "+v+".type || 'string'; if ("+S+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",g!="ignore"&&(r+=" ("+d+" && !"+v+" ",_&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -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(g=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),p&&(r+=" if (true) { "),r;if(_&&g.indexOf(o)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var S=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,T=S&&v.type||"string";if(S){var R=v.async===!0;v=v.validate}if(T!=s)return p&&(r+=" if (true) { "),r;if(R){if(!e.async)throw new Error("async format in sync schema");var P="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+P+"("+m+"))) { "}else{r+=" if (! ";var P="formats"+e.util.getProperty(o);S&&(P+=".validate"),typeof v=="function"?r+=" "+P+"("+m+") ":r+=" "+P+".test("+m+") ",r+=") { "}}var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { format: ",E?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,E?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var N=r;return r=A.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+N+"]); ":r+=" validate.errors = ["+N+"]; return false; ":r+=" var err = "+N+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var Ei=X((Zp,_i)=>{"use strict";_i.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e);g.level++;var _="valid"+g.level,v=e.schema.then,S=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)),R=S!==void 0&&(e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)),P=g.baseId;if(T||R){var A;g.createErrors=!1,g.schema=o,g.schemaPath=c,g.errSchemaPath=u,r+=" var "+d+" = errors; var "+E+" = true; ";var N=e.compositeRule;e.compositeRule=g.compositeRule=!0,r+=" "+e.validate(g)+" ",g.baseId=P,g.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=g.compositeRule=N,T?(r+=" if ("+_+") { ",g.schema=e.schema.then,g.schemaPath=e.schemaPath+".then",g.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(g)+" ",g.baseId=P,r+=" "+E+" = "+_+"; ",T&&R?(A="ifClause"+n,r+=" var "+A+" = 'then'; "):A="'then'",r+=" } ",R&&(r+=" else { ")):r+=" if (!"+_+") { ",R&&(g.schema=e.schema.else,g.schemaPath=e.schemaPath+".else",g.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(g)+" ",g.baseId=P,r+=" "+E+" = "+_+"; ",T&&R?(A="ifClause"+n,r+=" var "+A+" = 'else'; "):A="'else'",r+=" } "),r+=" if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { failingKeyword: "+A+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+A+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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 Si=X((Xp,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S="i"+n,T=g.dataLevel=e.dataLevel+1,R="data"+T,P=e.baseId;if(r+="var "+d+" = errors;var "+E+";",Array.isArray(o)){var A=e.schema.additionalItems;if(A===!1){r+=" "+E+" = "+m+".length <= "+o.length+"; ";var N=u;u=e.errSchemaPath+"/additionalItems",r+=" if (!"+E+") { ";var V=V||[];V.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , 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=V.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+=" } ",u=N,p&&(_+="}",r+=" else { ")}var D=o;if(D){for(var U,M=-1,j=D.length-1;M0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+m+".length > "+M+") { ";var I=m+"["+M+"]";g.schema=U,g.schemaPath=c+"["+M+"]",g.errSchemaPath=u+"/"+M,g.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),g.dataPathArr[T]=M;var C=e.validate(g);g.baseId=P,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",r+=" } ",p&&(r+=" if ("+v+") { ",_+="}")}}if(typeof A=="object"&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))){g.schema=A,g.schemaPath=e.schemaPath+".additionalItems",g.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+m+".length > "+o.length+") { for (var "+S+" = "+o.length+"; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=m+"["+S+"]";g.dataPathArr[T]=S;var C=e.validate(g);g.baseId=P,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",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)){g.schema=o,g.schemaPath=c,g.errSchemaPath=u,r+=" for (var "+S+" = 0; "+S+" < "+m+".length; "+S+"++) { ",g.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0);var I=m+"["+S+"]";g.dataPathArr[T]=S;var C=e.validate(g);g.baseId=P,e.util.varOccurences(C,R)<2?r+=" "+e.util.varReplace(C,R,I)+" ":r+=" var "+R+" = "+I+"; "+C+" ",p&&(r+=" if (!"+v+") break; "),r+=" }"}return p&&(r+=" "+_+" if ("+d+" == errors) {"),r}});var cs=X((Qp,xi)=>{"use strict";xi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,P,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var g=t=="maximum",_=g?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[_],S=e.opts.$data&&v&&v.$data,T=g?"<":">",R=g?">":"<",P=void 0;if(!(E||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(S||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(_+" must be number or boolean");if(S){var A=e.util.getData(v.$data,i,e.dataPathArr),N="exclusive"+n,V="exclType"+n,q="exclIsNumber"+n,D="op"+n,U="' + "+D+" + '";r+=" var schemaExcl"+n+" = "+A+"; ",A="schemaExcl"+n,r+=" var "+N+"; var "+V+" = typeof "+A+"; if ("+V+" != 'boolean' && "+V+" != 'undefined' && "+V+" != 'number') { ";var P=_,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(P||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var j=r;r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+j+"]); ":r+=" validate.errors = ["+j+"]; return false; ":r+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+V+" == 'number' ? ( ("+N+" = "+d+" === undefined || "+A+" "+T+"= "+d+") ? "+m+" "+R+"= "+A+" : "+m+" "+R+" "+d+" ) : ( ("+N+" = "+A+" === true) ? "+m+" "+R+"= "+d+" : "+m+" "+R+" "+d+" ) || "+m+" !== "+m+") { var op"+n+" = "+N+" ? '"+T+"' : '"+T+"='; ",o===void 0&&(P=_,u=e.errSchemaPath+"/"+_,d=A,E=S)}else{var q=typeof v=="number",U=T;if(q&&E){var D="'"+U+"'";r+=" if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+v+" "+T+"= "+d+" ? "+m+" "+R+"= "+v+" : "+m+" "+R+" "+d+" ) || "+m+" !== "+m+") { "}else{q&&o===void 0?(N=!0,P=_,u=e.errSchemaPath+"/"+_,d=v,R+="="):(q&&(d=Math[g?"min":"max"](v,o)),v===(q?d:!0)?(N=!0,P=_,u=e.errSchemaPath+"/"+_,R+="="):(N=!1,U+="="));var D="'"+U+"'";r+=" if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+m+" "+R+" "+d+" || "+m+" !== "+m+") { "}}P=P||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(P||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { comparison: "+D+", limit: "+d+", exclusive: "+N+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",E?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var j=r;return r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+j+"]); ":r+=" validate.errors = ["+j+"]; return false; ":r+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var us=X((Gp,Ri)=>{"use strict";Ri.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;if(E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(E||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxItems"?">":"<";r+="if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+m+".length "+g+" "+d+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+d+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var ds=X((Wp,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;if(E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(E||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxLength"?">":"<";r+="if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+g+" "+d+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",E?r+="' + "+d+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var fs=X((Kp,Pi)=>{"use strict";Pi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;if(E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(E||typeof o=="number"))throw new Error(t+" must be number");var g=t=="maxProperties"?">":"<";r+="if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+m+").length "+g+" "+d+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+d+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var S=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var wi=X((Jp,Oi)=>{"use strict";Oi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;if(E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(E||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",E&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",E&&(r+=" ) "),r+=" ) { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",E?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=g.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 Ai=X((Yp,Ii)=>{"use strict";Ii.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,d=e.util.copy(e);d.level++;var g="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=u,r+=" var "+E+" = errors; ";var _=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var v;d.opts.allErrors&&(v=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,v&&(d.opts.allErrors=v),e.compositeRule=d.compositeRule=_,r+=" if ("+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var T=r;r=S.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 = "+E+"; if (vErrors !== null) { if ("+E+") vErrors.length = "+E+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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 Di=X((eh,Ni)=>{"use strict";Ni.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d="errs__"+n,g=e.util.copy(e),_="";g.level++;var v="valid"+g.level,S=g.baseId,T="prevValid"+n,R="passingSchemas"+n;r+="var "+d+" = errors , "+T+" = false , "+E+" = false , "+R+" = null; ";var P=e.compositeRule;e.compositeRule=g.compositeRule=!0;var A=o;if(A)for(var N,V=-1,q=A.length-1;V0||N===!1:e.util.schemaHasRules(N,e.RULES.all))?(g.schema=N,g.schemaPath=c+"["+V+"]",g.errSchemaPath=u+"/"+V,r+=" "+e.validate(g)+" ",g.baseId=S):r+=" var "+v+" = true; ",V&&(r+=" if ("+v+" && "+T+") { "+E+" = false; "+R+" = ["+R+", "+V+"]; } else { ",_+="}"),r+=" if ("+v+") { "+E+" = "+T+" = true; "+R+" = "+V+"; }";return e.compositeRule=g.compositeRule=P,r+=""+_+"if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { passingSchemas: "+R+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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 = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var $i=X((rh,Ci)=>{"use strict";Ci.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E=e.opts.$data&&o&&o.$data,d;E?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var g=E?"(new RegExp("+d+"))":e.usePattern(o);r+="if ( ",E&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+g+".test("+m+") ) { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { pattern: ",E?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,E?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+c: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=X((th,ki)=>{"use strict";ki.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,d=e.util.copy(e),g="";d.level++;var _="valid"+d.level,v="key"+n,S="idx"+n,T=d.dataLevel=e.dataLevel+1,R="data"+T,P="dataProperties"+n,A=Object.keys(o||{}).filter(re),N=e.schema.patternProperties||{},V=Object.keys(N).filter(re),q=e.schema.additionalProperties,D=A.length||V.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,j=e.opts.removeAdditional,I=U||M||j,C=e.opts.ownProperties,F=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length8)r+=" || validate.schema"+c+".hasOwnProperty("+v+") ";else{var K=A;if(K)for(var H,me=-1,Te=K.length-1;me0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){var Me=e.util.getProperty(H),Pe=m+Me,De=yr&&xe.default!==void 0;d.schema=xe,d.schemaPath=c+Me,d.errSchemaPath=u+"/"+e.util.escapeFragment(H),d.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),d.dataPathArr[T]=e.util.toQuotedString(H);var ie=e.validate(d);if(d.baseId=F,e.util.varOccurences(ie,R)<2){ie=e.util.varReplace(ie,R,Pe);var Ae=Pe}else{var Ae=R;r+=" var "+R+" = "+Pe+"; "}if(De)r+=" "+ie+" ";else{if(J&&J[H]){r+=" if ( "+Ae+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = false; ";var Ie=e.errorPath,lr=u,er=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ie,H,e.opts.jsonPointers)),u=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { missingProperty: '"+er+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+er+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , 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++; ",u=lr,e.errorPath=Ie,r+=" } else { "}else p?(r+=" if ( "+Ae+" === undefined ",C&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = true; } else { "):(r+=" if ("+Ae+" !== undefined ",C&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+ie+" } "}}p&&(r+=" if ("+_+") { ",g+="}")}}if(V.length){var Le=V;if(Le)for(var se,Nt=-1,Ta=Le.length-1;Nt0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){d.schema=xe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),C?r+=" "+P+" = "+P+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+P+".length; "+S+"++) { var "+v+" = "+P+"["+S+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Pe=m+"["+v+"]";d.dataPathArr[T]=v;var ie=e.validate(d);d.baseId=F,e.util.varOccurences(ie,R)<2?r+=" "+e.util.varReplace(ie,R,Pe)+" ":r+=" var "+R+" = "+Pe+"; "+ie+" ",p&&(r+=" if (!"+_+") break; "),r+=" } ",p&&(r+=" else "+_+" = true; "),r+=" } ",p&&(r+=" if ("+_+") { ",g+="}")}}}return p&&(r+=" "+g+" if ("+E+" == errors) {"),r}});var Fi=X((ah,ji)=>{"use strict";ji.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="errs__"+n,d=e.util.copy(e),g="";d.level++;var _="valid"+d.level;if(r+="var "+E+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=c,d.errSchemaPath=u;var v="key"+n,S="idx"+n,T="i"+n,R="' + "+v+" + '",P=d.dataLevel=e.dataLevel+1,A="data"+P,N="dataProperties"+n,V=e.opts.ownProperties,q=e.baseId;V&&(r+=" var "+N+" = undefined; "),V?r+=" "+N+" = "+N+" || Object.keys("+m+"); for (var "+S+"=0; "+S+"<"+N+".length; "+S+"++) { var "+v+" = "+N+"["+S+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var D=v,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var M=e.validate(d);d.baseId=q,e.util.varOccurences(M,A)<2?r+=" "+e.util.varReplace(M,A,D)+" ":r+=" var "+A+" = "+D+"; "+M+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+_+") { for (var "+T+"=startErrs"+n+"; "+T+"{"use strict";Mi.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d=e.opts.$data&&o&&o.$data,g;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o;var _="schema"+n;if(!d)if(o.length0||A===!1:e.util.schemaHasRules(A,e.RULES.all))||(v[v.length]=T)}}else var v=o;if(d||v.length){var N=e.errorPath,V=d||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",V){d||(r+=" var "+_+" = validate.schema"+c+"; ");var D="i"+n,U="schema"+n+"["+D+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(N,U,e.opts.jsonPointers)),r+=" var "+E+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=" for (var "+D+" = 0; "+D+" < "+_+".length; "+D+"++) { "+E+" = "+m+"["+_+"["+D+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+_+"["+D+"]) "),r+="; if (!"+E+") break; } ",d&&(r+=" } "),r+=" if (!"+E+") { ";var j=j||[];j.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , 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"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;r=j.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+=" } else { "}else{r+=" if ( ";var C=v;if(C)for(var F,D=-1,le=C.length-1;D{"use strict";Ui.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(i||""),E="valid"+n,d=e.opts.$data&&o&&o.$data,g;if(d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",g="schema"+n):g=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+E+"; if ("+g+" === false || "+g+" === undefined) "+E+" = true; else if (typeof "+g+" != 'boolean') "+E+" = false; else { "),r+=" var i = "+m+".length , "+E+" = true , j; if (i > 1) { ";var _=e.schema.items&&e.schema.items.type,v=Array.isArray(_);if(!_||_=="object"||_=="array"||v&&(_.indexOf("object")>=0||_.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+E+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var S="checkDataType"+(v?"s":"");r+=" if ("+e.util[S](_,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+E+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+E+") { ";var T=T||[];T.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+c:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var R=r;r=T.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+R+"]); ":r+=" validate.errors = ["+R+"]; return false; ":r+=" var err = "+R+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Hi=X((ih,Vi)=>{"use strict";Vi.exports={$ref:ti(),allOf:si(),anyOf:ii(),$comment:li(),const:ui(),contains:fi(),dependencies:hi(),enum:vi(),format:yi(),if:Ei(),items:Si(),maximum:cs(),minimum:cs(),maxItems:us(),minItems:us(),maxLength:ds(),minLength:ds(),maxProperties:fs(),minProperties:fs(),multipleOf:wi(),not:Ai(),oneOf:Di(),pattern:$i(),properties:Li(),propertyNames:Fi(),required:qi(),uniqueItems:zi(),validate:os()}});var Xi=X((oh,Zi)=>{"use strict";var Bi=Hi(),ps=Qr().toHash;Zi.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=ps(t),e.types=ps(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var c=Object.keys(i)[0];o=i[c],i=c,o.forEach(function(p){t.push(p),e.all[p]=!0})}t.push(i);var u=e.all[i]={keyword:i,code:Bi[i],implements:o};return u}),e.all.$comment={keyword:"$comment",code:Bi.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=ps(t.concat(s)),e.custom={},e}});var Wi=X((lh,Gi)=>{"use strict";var Qi=["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{"use strict";var Dd=sa().MissingRef;Ji.exports=Ki;function Ki(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||i(o)});return t&&r.then(function(o){t(null,o)},t),r;function n(o){var c=o.$schema;return c&&!s.getSchema(c)?Ki.call(s,{$ref:c},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(u){if(u instanceof Dd)return c(u);throw u}function c(u){var p=u.missingSchema;if(d(p))throw new Error("Schema "+p+" is loaded but "+u.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(E,E)),m.then(function(g){if(!d(p))return n(g).then(function(){d(p)||s.addSchema(g,p,void 0,e)})}).then(function(){return i(o)});function E(){delete s._loadingSchemas[p]}function d(g){return s._refs[g]||s._schemas[g]}}}}});var ro=X((uh,eo)=>{"use strict";eo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m,E="data"+(i||""),d="valid"+n,g="errs__"+n,_=e.opts.$data&&o&&o.$data,v;_?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",v="schema"+n):v=o;var S=this,T="definition"+n,R=S.definition,P="",A,N,V,q,D;if(_&&R.$data){D="keywordValidate"+n;var U=R.validateSchema;r+=" var "+T+" = RULES.custom['"+t+"'].definition; var "+D+" = "+T+".validate;"}else{if(q=e.useCustomRule(S,o,e.schema,e),!q)return;v="validate.schema"+c,D=q.code,A=R.compile,N=R.inline,V=R.macro}var M=D+".errors",j="i"+n,I="ruleErr"+n,C=R.async;if(C&&!e.async)throw new Error("async keyword in sync schema");if(N||V||(r+=""+M+" = null;"),r+="var "+g+" = errors;var "+d+";",_&&R.$data&&(P+="}",r+=" if ("+v+" === undefined) { "+d+" = true; } else { ",U&&(P+="}",r+=" "+d+" = "+T+".validateSchema("+v+"); if ("+d+") { ")),N)R.statements?r+=" "+q.validate+" ":r+=" "+d+" = "+q.validate+"; ";else if(V){var F=e.util.copy(e),P="";F.level++;var le="valid"+F.level;F.schema=q.validate,F.schemaPath="";var J=e.compositeRule;e.compositeRule=F.compositeRule=!0;var re=e.validate(F).replace(/validate\.schema/g,D);e.compositeRule=F.compositeRule=J,r+=" "+re}else{var K=K||[];K.push(r),r="",r+=" "+D+".call( ",e.opts.passContext?r+="this":r+="self",A||R.schema===!1?r+=" , "+E+" ":r+=" , "+v+" , "+E+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=i?"data"+(i-1||""):"parentData",me=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+H+" , "+me+" , rootData ) ";var Te=r;r=K.pop(),R.errors===!1?(r+=" "+d+" = ",C&&(r+="await "),r+=""+Te+"; "):C?(M="customErrors"+n,r+=" var "+M+" = null; try { "+d+" = await "+Te+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+d+" = "+Te+"; "}if(R.modifying&&(r+=" if ("+H+") "+E+" = "+H+"["+me+"];"),r+=""+P,R.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",R.valid===void 0?(r+=" !",V?r+=""+le:r+=""+d):r+=" "+!R.valid+" ",r+=") { ",m=S.keyword;var K=K||[];K.push(r),r="";var K=K||[];K.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+S.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+S.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+E+" "),r+=" } "):r+=" {} ";var we=r;r=K.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+we+"]); ":r+=" validate.errors = ["+we+"]; return false; ":r+=" var err = "+we+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=K.pop(),N?R.errors?R.errors!="full"&&(r+=" for (var "+j+"="+g+"; "+j+"{Cd.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 so=X((fh,ao)=>{"use strict";var to=hs();ao.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:to.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:to.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 io=X((ph,no)=>{"use strict";var $d=/^[a-z_$][a-z0-9_$-]*$/i,kd=ro(),Ld=so();no.exports={add:jd,get:Fd,remove:Md,validate:ms};function jd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!$d.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{qd.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var yo=X((mh,go)=>{"use strict";var co=qn(),Gr=aa(),Ud=zn(),uo=es(),zd=is(),Vd=ei(),Hd=Xi(),fo=Wi(),po=Qr();go.exports=ge;ge.prototype.validate=Zd;ge.prototype.compile=Xd;ge.prototype.addSchema=Qd;ge.prototype.addMetaSchema=Gd;ge.prototype.validateSchema=Wd;ge.prototype.getSchema=Jd;ge.prototype.removeSchema=ef;ge.prototype.addFormat=cf;ge.prototype.errorsText=lf;ge.prototype._addSchema=rf;ge.prototype._compile=tf;ge.prototype.compileAsync=Yi();var fa=io();ge.prototype.addKeyword=fa.add;ge.prototype.getKeyword=fa.get;ge.prototype.removeKeyword=fa.remove;ge.prototype.validateKeyword=fa.validate;var ho=sa();ge.ValidationError=ho.Validation;ge.MissingRefError=ho.MissingRef;ge.$dataMetaSchema=fo;var da="http://json-schema.org/draft-07/schema",lo=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Bd=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=po.copy(a)||{},mf(this),this._schemas={},this._refs={},this._fragments={},this._formats=Vd(a.format),this._cache=a.cache||new Ud,this._loadingSchemas={},this._compilations=[],this.RULES=Hd(),this._getId=af(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=zd),this._metaOpts=hf(this),a.formats&&ff(this),a.keywords&&pf(this),uf(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),df(this)}function Zd(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 Xd(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Qd(a,e,t,s){if(Array.isArray(a)){for(var r=0;rtc,DIRTY:()=>Dr,EMPTY_PATH:()=>$l,INVALID:()=>B,NEVER:()=>qc,OK:()=>Oe,ParseStatus:()=>Re,Schema:()=>W,ZodAny:()=>br,ZodArray:()=>vr,ZodBigInt:()=>$r,ZodBoolean:()=>kr,ZodBranded:()=>bt,ZodCatch:()=>Zr,ZodDate:()=>Lr,ZodDefault:()=>Br,ZodDiscriminatedUnion:()=>jt,ZodEffects:()=>He,ZodEnum:()=>Vr,ZodError:()=>Ce,ZodFirstPartyTypeKind:()=>w,ZodFunction:()=>Mt,ZodIntersection:()=>qr,ZodIssueCode:()=>O,ZodLazy:()=>Ur,ZodLiteral:()=>zr,ZodMap:()=>ct,ZodNaN:()=>dt,ZodNativeEnum:()=>Hr,ZodNever:()=>Qe,ZodNull:()=>Fr,ZodNullable:()=>nr,ZodNumber:()=>Cr,ZodObject:()=>$e,ZodOptional:()=>ze,ZodParsedType:()=>k,ZodPipeline:()=>St,ZodPromise:()=>Sr,ZodReadonly:()=>Xr,ZodRecord:()=>Ft,ZodSchema:()=>W,ZodSet:()=>ut,ZodString:()=>Er,ZodSymbol:()=>ot,ZodTransformer:()=>He,ZodTuple:()=>sr,ZodType:()=>W,ZodUndefined:()=>jr,ZodUnion:()=>Mr,ZodUnknown:()=>mr,ZodVoid:()=>lt,addIssueToContext:()=>$,any:()=>dc,array:()=>mc,bigint:()=>ic,boolean:()=>Ws,coerce:()=>Mc,custom:()=>Xs,date:()=>oc,datetimeRegex:()=>Bs,defaultErrorMap:()=>pr,discriminatedUnion:()=>_c,effect:()=>Nc,enum:()=>wc,function:()=>Tc,getErrorMap:()=>st,getParsedType:()=>ar,instanceof:()=>sc,intersection:()=>Ec,isAborted:()=>kt,isAsync:()=>nt,isDirty:()=>Lt,isValid:()=>_r,late:()=>ac,lazy:()=>Pc,literal:()=>Oc,makeIssue:()=>Et,map:()=>xc,nan:()=>nc,nativeEnum:()=>Ic,never:()=>pc,null:()=>uc,nullable:()=>Cc,number:()=>Gs,object:()=>vc,objectUtil:()=>Aa,oboolean:()=>Fc,onumber:()=>jc,optional:()=>Dc,ostring:()=>Lc,pipeline:()=>kc,preprocess:()=>$c,promise:()=>Ac,quotelessJson:()=>Nl,record:()=>Sc,set:()=>Rc,setErrorMap:()=>Cl,strictObject:()=>gc,string:()=>Qs,symbol:()=>lc,transformer:()=>Nc,tuple:()=>bc,undefined:()=>cc,union:()=>yc,unknown:()=>fc,util:()=>Y,void:()=>hc});var Y;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let i of r)n[i]=i;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(let o of n)i[o]=r[o];return a.objectValues(i)},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 i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},a.find=(r,n)=>{for(let i of r)if(n(i))return i},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(i=>typeof i=="string"?`'${i}'`:i).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Y||(Y={}));var Aa;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Aa||(Aa={}));var k=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ar=a=>{switch(typeof a){case"undefined":return k.undefined;case"string":return k.string;case"number":return Number.isNaN(a)?k.nan:k.number;case"boolean":return k.boolean;case"function":return k.function;case"bigint":return k.bigint;case"symbol":return k.symbol;case"object":return Array.isArray(a)?k.array:a===null?k.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?k.promise:typeof Map<"u"&&a instanceof Map?k.map:typeof Set<"u"&&a instanceof Set?k.set:typeof Date<"u"&&a instanceof Date?k.date:k.object;default:return k.unknown}};var O=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nl=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ce=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;ct.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ce.create=a=>new Ce(a);var Dl=(a,e)=>{let t;switch(a.code){case O.invalid_type:a.received===k.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case O.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,Y.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:t=`Unrecognized key(s) in object: ${Y.joinValues(a.keys,", ")}`;break;case O.invalid_union:t="Invalid input";break;case O.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Y.joinValues(a.options)}`;break;case O.invalid_enum_value:t=`Invalid enum value. Expected ${Y.joinValues(a.options)}, received '${a.received}'`;break;case O.invalid_arguments:t="Invalid function arguments";break;case O.invalid_return_type:t="Invalid function return type";break;case O.invalid_date:t="Invalid date";break;case O.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:Y.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case O.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 O.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 O.custom:t="Invalid input";break;case O.invalid_intersection_types:t="Intersection results could not be merged";break;case O.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case O.not_finite:t="Number must be finite";break;default:t=e.defaultError,Y.assertNever(a)}return{message:t}},pr=Dl;var qs=pr;function Cl(a){qs=a}function st(){return qs}var Et=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",c=s.filter(u=>!!u).slice().reverse();for(let u of c)o=u(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},$l=[];function $(a,e){let t=st(),s=Et({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===pr?void 0:pr].filter(r=>!!r)});a.common.issues.push(s)}var Re=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return B;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,i=await r.value;s.push({key:n,value:i})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return B;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}},B=Object.freeze({status:"aborted"}),Dr=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),kt=a=>a.status==="aborted",Lt=a=>a.status==="dirty",_r=a=>a.status==="valid",nt=a=>typeof Promise<"u"&&a instanceof Promise;var z;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(z||(z={}));var Ve=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}},Us=(a,e)=>{if(_r(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ce(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{let{message:c}=a;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:r}}var W=class{get description(){return this._def.description}_getType(e){return ar(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Re,ctx:{common:e.parent.common,data:e.data,parsedType:ar(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(nt(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:ar(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Us(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ar(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return _r(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=>_r(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:ar(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(nt(r)?r:Promise.resolve(r));return Us(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 i=e(r),o=()=>n.addIssue({code:O.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!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 He({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ze.create(this,this._def)}nullable(){return nr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vr.create(this)}promise(){return Sr.create(this,this._def)}or(e){return Mr.create([this,e],this._def)}and(e){return qr.create(this,e,this._def)}transform(e){return new He({...Q(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Br({...Q(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new bt({typeName:w.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Zr({...Q(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return St.create(this,e)}readonly(){return Xr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kl=/^c[^\s-]{8,}$/i,Ll=/^[0-9a-z]+$/,jl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fl=/^[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,Ml=/^[a-z0-9_-]{21}$/i,ql=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ul=/^[-+]?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)?)??$/,zl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Na,Hl=/^(?:(?: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])$/,Bl=/^(?:(?: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])$/,Zl=/^(([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]))$/,Xl=/^(([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])$/,Ql=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vs="((\\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])))",Wl=new RegExp(`^${Vs}$`);function Hs(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 Kl(a){return new RegExp(`^${Hs(a)}$`)}function Bs(a){let e=`${Vs}T${Hs(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 Jl(a,e){return!!((e==="v4"||!e)&&Hl.test(a)||(e==="v6"||!e)&&Zl.test(a))}function Yl(a,e){if(!ql.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function ec(a,e){return!!((e==="v4"||!e)&&Bl.test(a)||(e==="v6"||!e)&&Xl.test(a))}var Er=class a extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==k.string){let n=this._getOrReturnCtx(e);return $(n,{code:O.invalid_type,expected:k.string,received:n.parsedType}),B}let s=new Re,r;for(let n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(r=this._getOrReturnCtx(e,r),$(r,{code:O.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,o=e.data.lengthe.test(r),{validation:t,code:O.invalid_string,...z.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.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,...z.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,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...z.errToObj(t)})}nonempty(e){return this.min(1,z.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.valuenew Er({checks:[],typeName:w.ZodString,coerce:a?.coerce??!1,...Q(a)});function rc(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(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}var Cr=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==k.number){let n=this._getOrReturnCtx(e);return $(n,{code:O.invalid_type,expected:k.number,received:n.parsedType}),B}let s,r=new Re;for(let n of this._def.checks)n.kind==="int"?Y.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:O.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),$(s,{code:O.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?rc(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),$(s,{code:O.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),$(s,{code:O.not_finite,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.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.valuee.kind==="int"||e.kind==="multipleOf"&&Y.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.valuenew Cr({checks:[],typeName:w.ZodNumber,coerce:a?.coerce||!1,...Q(a)});var $r=class a extends W{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==k.bigint)return this._getInvalidInput(e);let s,r=new Re;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),$(s,{code:O.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),$(s,{code:O.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return $(t,{code:O.invalid_type,expected:k.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,z.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:z.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:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:z.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.valuenew $r({checks:[],typeName:w.ZodBigInt,coerce:a?.coerce??!1,...Q(a)});var kr=class extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==k.boolean){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.boolean,received:s.parsedType}),B}return Oe(e.data)}};kr.create=a=>new kr({typeName:w.ZodBoolean,coerce:a?.coerce||!1,...Q(a)});var Lr=class a extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==k.date){let n=this._getOrReturnCtx(e);return $(n,{code:O.invalid_type,expected:k.date,received:n.parsedType}),B}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return $(n,{code:O.invalid_date}),B}let s=new Re,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(r=this._getOrReturnCtx(e,r),$(r,{code:O.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):Y.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:z.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.valuenew Lr({checks:[],coerce:a?.coerce||!1,typeName:w.ZodDate,...Q(a)});var ot=class extends W{_parse(e){if(this._getType(e)!==k.symbol){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.symbol,received:s.parsedType}),B}return Oe(e.data)}};ot.create=a=>new ot({typeName:w.ZodSymbol,...Q(a)});var jr=class extends W{_parse(e){if(this._getType(e)!==k.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.undefined,received:s.parsedType}),B}return Oe(e.data)}};jr.create=a=>new jr({typeName:w.ZodUndefined,...Q(a)});var Fr=class extends W{_parse(e){if(this._getType(e)!==k.null){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.null,received:s.parsedType}),B}return Oe(e.data)}};Fr.create=a=>new Fr({typeName:w.ZodNull,...Q(a)});var br=class extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};br.create=a=>new br({typeName:w.ZodAny,...Q(a)});var mr=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};mr.create=a=>new mr({typeName:w.ZodUnknown,...Q(a)});var Qe=class extends W{_parse(e){let t=this._getOrReturnCtx(e);return $(t,{code:O.invalid_type,expected:k.never,received:t.parsedType}),B}};Qe.create=a=>new Qe({typeName:w.ZodNever,...Q(a)});var lt=class extends W{_parse(e){if(this._getType(e)!==k.undefined){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.void,received:s.parsedType}),B}return Oe(e.data)}};lt.create=a=>new lt({typeName:w.ZodVoid,...Q(a)});var vr=class a extends W{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==k.array)return $(t,{code:O.invalid_type,expected:k.array,received:t.parsedType}),B;if(r.exactLength!==null){let i=t.data.length>r.exactLength.value,o=t.data.lengthr.maxLength.value&&($(t,{code:O.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((i,o)=>r.type._parseAsync(new Ve(t,i,t.path,o)))).then(i=>Re.mergeArray(s,i));let n=[...t.data].map((i,o)=>r.type._parseSync(new Ve(t,i,t.path,o)));return Re.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:z.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:z.toString(t)}})}nonempty(e){return this.min(1,e)}};vr.create=(a,e)=>new vr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...Q(e)});function it(a){if(a instanceof $e){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=ze.create(it(s))}return new $e({...a._def,shape:()=>e})}else return a instanceof vr?new vr({...a._def,type:it(a.element)}):a instanceof ze?ze.create(it(a.unwrap())):a instanceof nr?nr.create(it(a.unwrap())):a instanceof sr?sr.create(a.items.map(e=>it(e))):a}var $e=class a extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Y.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==k.object){let u=this._getOrReturnCtx(e);return $(u,{code:O.invalid_type,expected:k.object,received:u.parsedType}),B}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Qe&&this._def.unknownKeys==="strip"))for(let u in r.data)i.includes(u)||o.push(u);let c=[];for(let u of i){let p=n[u],m=r.data[u];c.push({key:{status:"valid",value:u},value:p._parse(new Ve(r,m,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof Qe){let u=this._def.unknownKeys;if(u==="passthrough")for(let p of o)c.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(u==="strict")o.length>0&&($(r,{code:O.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let p of o){let m=r.data[p];c.push({key:{status:"valid",value:p},value:u._parse(new Ve(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let p of c){let m=await p.key,E=await p.value;u.push({key:m,value:E,alwaysSet:p.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(s,u)):Re.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return z.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:z.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of Y.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of Y.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return it(this)}partial(e){let t={};for(let s of Y.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of Y.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Zs(Y.objectKeys(this.shape))}};$e.create=(a,e)=>new $e({shape:()=>a,unknownKeys:"strip",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});$e.strictCreate=(a,e)=>new $e({shape:()=>a,unknownKeys:"strict",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});$e.lazycreate=(a,e)=>new $e({shape:a,unknownKeys:"strip",catchall:Qe.create(),typeName:w.ZodObject,...Q(e)});var Mr=class extends W{_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 i=n.map(o=>new Ce(o.ctx.common.issues));return $(t,{code:O.invalid_union,unionErrors:i}),B}if(t.common.async)return Promise.all(s.map(async n=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let n,i=[];for(let c of s){let u={...t,common:{...t.common,issues:[]},parent:null},p=c._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=i.map(c=>new Ce(c));return $(t,{code:O.invalid_union,unionErrors:o}),B}}get options(){return this._def.options}};Mr.create=(a,e)=>new Mr({options:a,typeName:w.ZodUnion,...Q(e)});var hr=a=>a instanceof Ur?hr(a.schema):a instanceof He?hr(a.innerType()):a instanceof zr?[a.value]:a instanceof Vr?a.options:a instanceof Hr?Y.objectValues(a.enum):a instanceof Br?hr(a._def.innerType):a instanceof jr?[void 0]:a instanceof Fr?[null]:a instanceof ze?[void 0,...hr(a.unwrap())]:a instanceof nr?[null,...hr(a.unwrap())]:a instanceof bt||a instanceof Xr?hr(a.unwrap()):a instanceof Zr?hr(a._def.innerType):[],jt=class a extends W{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.object)return $(t,{code:O.invalid_type,expected:k.object,received:t.parsedType}),B;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):($(t,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let i=hr(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new a({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function Da(a,e){let t=ar(a),s=ar(e);if(a===e)return{valid:!0,data:a};if(t===k.object&&s===k.object){let r=Y.objectKeys(e),n=Y.objectKeys(a).filter(o=>r.indexOf(o)!==-1),i={...a,...e};for(let o of n){let c=Da(a[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===k.array&&s===k.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n{if(kt(n)||kt(i))return B;let o=Da(n.value,i.value);return o.valid?((Lt(n)||Lt(i))&&t.dirty(),{status:t.value,value:o.data}):($(s,{code:O.invalid_intersection_types}),B)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>r(n,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};qr.create=(a,e,t)=>new qr({left:a,right:e,typeName:w.ZodIntersection,...Q(t)});var sr=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.array)return $(s,{code:O.invalid_type,expected:k.array,received:s.parsedType}),B;if(s.data.lengththis._def.items.length&&($(s,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new Ve(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>Re.mergeArray(t,i)):Re.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};sr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sr({items:a,typeName:w.ZodTuple,rest:null,...Q(e)})};var Ft=class a extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.object)return $(s,{code:O.invalid_type,expected:k.object,received:s.parsedType}),B;let r=[],n=this._def.keyType,i=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new Ve(s,o,s.path,o)),value:i._parse(new Ve(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Re.mergeObjectAsync(t,r):Re.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof W?new a({keyType:e,valueType:t,typeName:w.ZodRecord,...Q(s)}):new a({keyType:Er.create(),valueType:e,typeName:w.ZodRecord,...Q(t)})}},ct=class extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.map)return $(s,{code:O.invalid_type,expected:k.map,received:s.parsedType}),B;let r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:r._parse(new Ve(s,o,s.path,[u,"key"])),value:n._parse(new Ve(s,c,s.path,[u,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,p=await c.value;if(u.status==="aborted"||p.status==="aborted")return B;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of i){let u=c.key,p=c.value;if(u.status==="aborted"||p.status==="aborted")return B;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}}}};ct.create=(a,e,t)=>new ct({valueType:e,keyType:a,typeName:w.ZodMap,...Q(t)});var ut=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==k.set)return $(s,{code:O.invalid_type,expected:k.set,received:s.parsedType}),B;let r=this._def;r.minSize!==null&&s.data.sizer.maxSize.value&&($(s,{code:O.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function i(c){let u=new Set;for(let p of c){if(p.status==="aborted")return B;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}let o=[...s.data.values()].map((c,u)=>n._parse(new Ve(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new a({...this._def,minSize:{value:e,message:z.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ut.create=(a,e)=>new ut({valueType:a,minSize:null,maxSize:null,typeName:w.ZodSet,...Q(e)});var Mt=class a extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.function)return $(t,{code:O.invalid_type,expected:k.function,received:t.parsedType}),B;function s(o,c){return Et({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(u=>!!u),issueData:{code:O.invalid_arguments,argumentsError:c}})}function r(o,c){return Et({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,st(),pr].filter(u=>!!u),issueData:{code:O.invalid_return_type,returnTypeError:c}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Sr){let o=this;return Oe(async function(...c){let u=new Ce([]),p=await o._def.args.parseAsync(c,n).catch(d=>{throw u.addIssue(s(c,d)),u}),m=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(m,n).catch(d=>{throw u.addIssue(r(m,d)),u})})}else{let o=this;return Oe(function(...c){let u=o._def.args.safeParse(c,n);if(!u.success)throw new Ce([s(c,u.error)]);let p=Reflect.apply(i,this,u.data),m=o._def.returns.safeParse(p,n);if(!m.success)throw new Ce([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:sr.create(e).rest(mr.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||sr.create([]).rest(mr.create()),returns:t||mr.create(),typeName:w.ZodFunction,...Q(s)})}},Ur=class extends W{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})}};Ur.create=(a,e)=>new Ur({getter:a,typeName:w.ZodLazy,...Q(e)});var zr=class extends W{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return $(t,{received:t.data,code:O.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};zr.create=(a,e)=>new zr({value:a,typeName:w.ZodLiteral,...Q(e)});function Zs(a,e){return new Vr({values:a,typeName:w.ZodEnum,...Q(e)})}var Vr=class a extends W{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{expected:Y.joinValues(s),received:t.parsedType,code:O.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return $(t,{received:t.data,code:O.invalid_enum_value,options:s}),B}return Oe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Vr.create=Zs;var Hr=class extends W{_parse(e){let t=Y.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==k.string&&s.parsedType!==k.number){let r=Y.objectValues(t);return $(s,{expected:Y.joinValues(r),received:s.parsedType,code:O.invalid_type}),B}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=Y.objectValues(t);return $(s,{received:s.data,code:O.invalid_enum_value,options:r}),B}return Oe(e.data)}get enum(){return this._def.values}};Hr.create=(a,e)=>new Hr({values:a,typeName:w.ZodNativeEnum,...Q(e)});var Sr=class extends W{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==k.promise&&t.common.async===!1)return $(t,{code:O.invalid_type,expected:k.promise,received:t.parsedType}),B;let s=t.parsedType===k.promise?t.data:Promise.resolve(t.data);return Oe(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Sr.create=(a,e)=>new Sr({type:a,typeName:w.ZodPromise,...Q(e)});var He=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:i=>{$(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return B;let c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?B:c.status==="dirty"?Dr(c.value):t.value==="dirty"?Dr(c.value):c});{if(t.value==="aborted")return B;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?B:o.status==="dirty"?Dr(o.value):t.value==="dirty"?Dr(o.value):o}}if(r.type==="refinement"){let i=o=>{let c=r.refinement(o,n);if(s.common.async)return Promise.resolve(c);if(c 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"?B:(o.status==="dirty"&&t.dirty(),i(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"?B:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!_r(i))return B;let o=r.transform(i.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(i=>_r(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:t.value,value:o})):B);Y.assertNever(r)}};He.create=(a,e,t)=>new He({schema:a,typeName:w.ZodEffects,effect:e,...Q(t)});He.createWithPreprocess=(a,e,t)=>new He({schema:e,effect:{type:"preprocess",transform:a},typeName:w.ZodEffects,...Q(t)});var ze=class extends W{_parse(e){return this._getType(e)===k.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ze.create=(a,e)=>new ze({innerType:a,typeName:w.ZodOptional,...Q(e)});var nr=class extends W{_parse(e){return this._getType(e)===k.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};nr.create=(a,e)=>new nr({innerType:a,typeName:w.ZodNullable,...Q(e)});var Br=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===k.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Br.create=(a,e)=>new Br({innerType:a,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Zr=class extends W{_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 nt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ce(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ce(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Zr.create=(a,e)=>new Zr({innerType:a,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var dt=class extends W{_parse(e){if(this._getType(e)!==k.nan){let s=this._getOrReturnCtx(e);return $(s,{code:O.invalid_type,expected:k.nan,received:s.parsedType}),B}return{status:"valid",value:e.data}}};dt.create=a=>new dt({typeName:w.ZodNaN,...Q(a)});var tc=Symbol("zod_brand"),bt=class extends W{_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}},St=class a extends W{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?B:n.status==="dirty"?(t.dirty(),Dr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?B:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:w.ZodPipeline})}},Xr=class extends W{_parse(e){let t=this._def.innerType._parse(e),s=r=>(_r(r)&&(r.value=Object.freeze(r.value)),r);return nt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Xr.create=(a,e)=>new Xr({innerType:a,typeName:w.ZodReadonly,...Q(e)});function zs(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Xs(a,e={},t){return a?br.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(i=>{if(!i){let o=zs(e,s),c=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:c})}});if(!n){let i=zs(e,s),o=i.fatal??t??!0;r.addIssue({code:"custom",...i,fatal:o})}}):br.create()}var ac={object:$e.lazycreate},w;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(w||(w={}));var sc=(a,e={message:`Input not instance of ${a.name}`})=>Xs(t=>t instanceof a,e),Qs=Er.create,Gs=Cr.create,nc=dt.create,ic=$r.create,Ws=kr.create,oc=Lr.create,lc=ot.create,cc=jr.create,uc=Fr.create,dc=br.create,fc=mr.create,pc=Qe.create,hc=lt.create,mc=vr.create,vc=$e.create,gc=$e.strictCreate,yc=Mr.create,_c=jt.create,Ec=qr.create,bc=sr.create,Sc=Ft.create,xc=ct.create,Rc=ut.create,Tc=Mt.create,Pc=Ur.create,Oc=zr.create,wc=Vr.create,Ic=Hr.create,Ac=Sr.create,Nc=He.create,Dc=ze.create,Cc=nr.create,$c=He.createWithPreprocess,kc=St.create,Lc=()=>Qs().optional(),jc=()=>Gs().optional(),Fc=()=>Ws().optional(),Mc={string:a=>Er.create({...a,coerce:!0}),number:a=>Cr.create({...a,coerce:!0}),boolean:a=>kr.create({...a,coerce:!0}),bigint:a=>$r.create({...a,coerce:!0}),date:a=>Lr.create({...a,coerce:!0})};var qc=B;var Ca="2025-06-18";var Ks=[Ca,"2025-03-26","2024-11-05","2024-10-07"],qt="2.0",Js=l.union([l.string(),l.number().int()]),Ys=l.string(),Uc=l.object({progressToken:l.optional(Js)}).passthrough(),Be=l.object({_meta:l.optional(Uc)}).passthrough(),ke=l.object({method:l.string(),params:l.optional(Be)}),xt=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),ir=l.object({method:l.string(),params:l.optional(xt)}),Ze=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ut=l.union([l.string(),l.number().int()]),en=l.object({jsonrpc:l.literal(qt),id:Ut}).merge(ke).strict(),rn=a=>en.safeParse(a).success,tn=l.object({jsonrpc:l.literal(qt)}).merge(ir).strict(),an=a=>tn.safeParse(a).success,sn=l.object({jsonrpc:l.literal(qt),id:Ut,result:Ze}).strict(),$a=a=>sn.safeParse(a).success,Ge;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(Ge||(Ge={}));var nn=l.object({jsonrpc:l.literal(qt),id:Ut,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),on=a=>nn.safeParse(a).success,ln=l.union([en,tn,sn,nn]),zt=Ze.strict(),Vt=ir.extend({method:l.literal("notifications/cancelled"),params:xt.extend({requestId:Ut,reason:l.string().optional()})}),zc=l.object({src:l.string(),mimeType:l.optional(l.string()),sizes:l.optional(l.array(l.string()))}).passthrough(),Rt=l.object({icons:l.array(zc).optional()}).passthrough(),Tt=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),cn=Tt.extend({version:l.string(),websiteUrl:l.optional(l.string())}).merge(Rt),Vc=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),ka=ke.extend({method:l.literal("initialize"),params:Be.extend({protocolVersion:l.string(),capabilities:Vc,clientInfo:cn})});var Hc=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),Bc=Ze.extend({protocolVersion:l.string(),capabilities:Hc,serverInfo:cn,instructions:l.optional(l.string())}),La=ir.extend({method:l.literal("notifications/initialized")});var Ht=ke.extend({method:l.literal("ping")}),Zc=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),Bt=ir.extend({method:l.literal("notifications/progress"),params:xt.merge(Zc).extend({progressToken:Js})}),Zt=ke.extend({params:Be.extend({cursor:l.optional(Ys)}).optional()}),Xt=Ze.extend({nextCursor:l.optional(Ys)}),un=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),dn=un.extend({text:l.string()}),ja=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),fn=un.extend({blob:ja}),pn=Tt.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).merge(Rt),Xc=Tt.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).merge(Rt),Qc=Zt.extend({method:l.literal("resources/list")}),Gc=Xt.extend({resources:l.array(pn)}),Wc=Zt.extend({method:l.literal("resources/templates/list")}),Kc=Xt.extend({resourceTemplates:l.array(Xc)}),Jc=ke.extend({method:l.literal("resources/read"),params:Be.extend({uri:l.string()})}),Yc=Ze.extend({contents:l.array(l.union([dn,fn]))}),eu=ir.extend({method:l.literal("notifications/resources/list_changed")}),ru=ke.extend({method:l.literal("resources/subscribe"),params:Be.extend({uri:l.string()})}),tu=ke.extend({method:l.literal("resources/unsubscribe"),params:Be.extend({uri:l.string()})}),au=ir.extend({method:l.literal("notifications/resources/updated"),params:xt.extend({uri:l.string()})}),su=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),nu=Tt.extend({description:l.optional(l.string()),arguments:l.optional(l.array(su)),_meta:l.optional(l.object({}).passthrough())}).merge(Rt),iu=Zt.extend({method:l.literal("prompts/list")}),ou=Xt.extend({prompts:l.array(nu)}),lu=ke.extend({method:l.literal("prompts/get"),params:Be.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),Fa=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ma=l.object({type:l.literal("image"),data:ja,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),qa=l.object({type:l.literal("audio"),data:ja,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),cu=l.object({type:l.literal("resource"),resource:l.union([dn,fn]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),uu=pn.extend({type:l.literal("resource_link")}),hn=l.union([Fa,Ma,qa,uu,cu]),du=l.object({role:l.enum(["user","assistant"]),content:hn}).passthrough(),fu=Ze.extend({description:l.optional(l.string()),messages:l.array(du)}),pu=ir.extend({method:l.literal("notifications/prompts/list_changed")}),hu=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),mu=Tt.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(hu),_meta:l.optional(l.object({}).passthrough())}).merge(Rt),Ua=Zt.extend({method:l.literal("tools/list")}),vu=Xt.extend({tools:l.array(mu)}),mn=Ze.extend({content:l.array(hn).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),mp=mn.or(Ze.extend({toolResult:l.unknown()})),za=ke.extend({method:l.literal("tools/call"),params:Be.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),gu=ir.extend({method:l.literal("notifications/tools/list_changed")}),Pt=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Va=ke.extend({method:l.literal("logging/setLevel"),params:Be.extend({level:Pt})}),yu=ir.extend({method:l.literal("notifications/message"),params:xt.extend({level:Pt,logger:l.optional(l.string()),data:l.unknown()})}),_u=l.object({name:l.string().optional()}).passthrough(),Eu=l.object({hints:l.optional(l.array(_u)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),bu=l.object({role:l.enum(["user","assistant"]),content:l.union([Fa,Ma,qa])}).passthrough(),Su=ke.extend({method:l.literal("sampling/createMessage"),params:Be.extend({messages:l.array(bu),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(Eu)})}),Ha=Ze.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[Fa,Ma,qa])}),xu=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),Ru=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),Tu=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),Pu=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),Ou=l.union([xu,Ru,Tu,Pu]),wu=ke.extend({method:l.literal("elicitation/create"),params:Be.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),Ou),required:l.optional(l.array(l.string()))}).passthrough()})}),Ba=Ze.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),Iu=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var Au=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),Nu=ke.extend({method:l.literal("completion/complete"),params:Be.extend({ref:l.union([Au,Iu]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),Du=Ze.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),Cu=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),$u=ke.extend({method:l.literal("roots/list")}),Za=Ze.extend({roots:l.array(Cu)}),ku=ir.extend({method:l.literal("notifications/roots/list_changed")}),vp=l.union([Ht,ka,Nu,Va,lu,iu,Qc,Wc,Jc,ru,tu,za,Ua]),gp=l.union([Vt,Bt,La,ku]),yp=l.union([zt,Ha,Ba,Za]),_p=l.union([Ht,Su,wu,$u]),Ep=l.union([Vt,Bt,yu,au,eu,gu,pu]),bp=l.union([zt,Bc,Du,fu,ou,Gc,Kc,Yc,mn,vu]),We=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Lu=6e4,Qt=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(Vt,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Bt,t=>{this._onprogress(t)}),this.setRequestHandler(Ht,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 We(Ge.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(c,u)=>{o?.(c,u),$a(c)||on(c)?this._onresponse(c):rn(c)?this._onrequest(c,u):an(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},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 We(Ge.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:Ge.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let c={signal:o.signal,sessionId:i?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,p,m)=>this.request(u,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,c)).then(u=>{if(!o.signal.aborted)return i?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var p;if(!o.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:Ge.InternalError,message:(p=u.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).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 i=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){i(c);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),$a(e))s(e);else{let r=new We(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:i}=s??{};return new Promise((o,c)=>{var u,p,m,E,d,g;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.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 S=P=>{var A;this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),(A=this._transport)===null||A===void 0||A.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(P)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`))),c(P)};this._responseHandlers.set(_,P=>{var A;if(!(!((A=s?.signal)===null||A===void 0)&&A.aborted)){if(P instanceof Error)return c(P);try{let N=t.parse(P.result);o(N)}catch(N){c(N)}}}),(E=s?.signal)===null||E===void 0||E.addEventListener("abort",()=>{var P;S((P=s?.signal)===null||P===void 0?void 0:P.reason)});let T=(d=s?.timeout)!==null&&d!==void 0?d:Lu,R=()=>S(new We(Ge.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(_,T,s?.maxTotalTimeout,R,(g=s?.resetTimeoutOnProgress)!==null&&g!==void 0?g:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(_),c(P)})})}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 c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,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 vn(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 _o=Al(yo(),1),pa=class extends Qt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Pt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(r)this._oninitialize(r)),this.setNotificationHandler(La,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Va,async(r,n)=>{var i;let o=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:c}=r.params,u=Pt.safeParse(c);return u.success&&this._loggingLevels.set(o,u.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=vn(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:Ks.includes(t)?t:Ca,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},zt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Ha,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 _o.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new We(Ge.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof We?r:new We(Ge.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Za,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"})}};import bo from"node:process";var ha=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),vf(t)}clear(){this._buffer=void 0}};function vf(a){return ln.parse(JSON.parse(a))}function Eo(a){return JSON.stringify(a)+` `}var ma=class{constructor(e=bo.stdin,t=bo.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new ha,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=Eo(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var xo=Symbol("Let zodToJsonSchema decide on which parser to use");var So={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"},Ro=a=>typeof a=="string"?{...So,name:a}:{...So,...a};var To=a=>{let e=Ro(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 gs(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,gs(a,e,s,r)}var va=(a,e)=>{let t=0;for(;tZ(a.innerType._def,e);function ys(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>ys(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 gf(a,e)}}var gf=(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 Ao(a,e){return{...Z(a.innerType._def,e),default:a.defaultValue()}}function No(a,e){return e.effectStrategy==="input"?Z(a.schema._def,e):fe(e)}function Do(a){return{type:"string",enum:Array.from(a.values)}}var yf=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Co(a,e){let t=[Z(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Z(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(yf(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...c}=n;i=c}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function $o(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 _s,Ke={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:()=>(_s===void 0&&(_s=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),_s),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 ya(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":Je(t,"email",s.message,e);break;case"format:idn-email":Je(t,"idn-email",s.message,e);break;case"pattern:zod":Ne(t,Ke.email,s.message,e);break}break;case"url":Je(t,"uri",s.message,e);break;case"uuid":Je(t,"uuid",s.message,e);break;case"regex":Ne(t,s.regex,s.message,e);break;case"cuid":Ne(t,Ke.cuid,s.message,e);break;case"cuid2":Ne(t,Ke.cuid2,s.message,e);break;case"startsWith":Ne(t,RegExp(`^${Es(s.value,e)}`),s.message,e);break;case"endsWith":Ne(t,RegExp(`${Es(s.value,e)}$`),s.message,e);break;case"datetime":Je(t,"date-time",s.message,e);break;case"date":Je(t,"date",s.message,e);break;case"time":Je(t,"time",s.message,e);break;case"duration":Je(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":{Ne(t,RegExp(Es(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&Je(t,"ipv4",s.message,e),s.version!=="v4"&&Je(t,"ipv6",s.message,e);break}case"base64url":Ne(t,Ke.base64url,s.message,e);break;case"jwt":Ne(t,Ke.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ne(t,Ke.ipv4Cidr,s.message,e),s.version!=="v4"&&Ne(t,Ke.ipv6Cidr,s.message,e);break}case"emoji":Ne(t,Ke.emoji(),s.message,e);break;case"ulid":{Ne(t,Ke.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Je(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ne(t,Ke.base64,s.message,e);break}}break}case"nanoid":Ne(t,Ke.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function Es(a,e){return e.patternStrategy==="escape"?Ef(a):a}var _f=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ef(a){let e="";for(let t=0;tr.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 Ne(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:ko(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",ko(e,s),t,s)}function ko(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,i=!1,o=!1;for(let c=0;c0){let v=Math.min(..._.map(R=>R.rank||0)),O=Math.max(..._.map(R=>R.rank||0))-v||1;_.forEach(R=>{R.rank!==void 0&&(R.score=1-(R.rank-v)/O)})}return _}findByConcept(e,t={}){let s=[],r={...t,concepts:e},i=` + `;s.push(r,n);let _=this.db.prepare(g).all(...s);if(_.length>0){let v=Math.min(..._.map(R=>R.rank||0)),T=Math.max(..._.map(R=>R.rank||0))-v||1;_.forEach(R=>{R.rank!==void 0&&(R.score=1-(R.rank-v)/T)})}return _}findByConcept(e,t={}){let s=[],{limit:r=50,offset:n=0,orderBy:i="date_desc",...o}=t,c={...o,concepts:e},u=this.buildFilterClause(c,s,"o"),p=this.buildOrderClause(i,!1),m=` SELECT o.* FROM observations o - WHERE ${this.buildFilterClause(r,s,"o")} - ORDER BY o.created_at_epoch DESC - `;return this.db.prepare(i).all(...s)}findByFile(e,t={}){let s=[],r={...t,files:e},i=` + WHERE ${u} + ${p} + LIMIT ? OFFSET ? + `;return s.push(r,n),this.db.prepare(m).all(...s)}findByFile(e,t={}){let s=[],{limit:r=50,offset:n=0,orderBy:i="date_desc",...o}=t,c={...o,files:e},u=this.buildFilterClause(c,s,"o"),p=this.buildOrderClause(i,!1),m=` SELECT o.* FROM observations o - WHERE ${this.buildFilterClause(r,s,"o")} - ORDER BY o.created_at_epoch DESC - `,o=this.db.prepare(i).all(...s),c=[],u={...t};delete u.type;let p=[];if(u.project&&(p.push("s.project = ?"),c.push(u.project)),u.dateRange){let{start:d,end:g}=u.dateRange;if(d){let _=typeof d=="number"?d:new Date(d).getTime();p.push("s.created_at_epoch >= ?"),c.push(_)}if(g){let _=typeof g=="number"?g:new Date(g).getTime();p.push("s.created_at_epoch <= ?"),c.push(_)}}p.push(`( + WHERE ${u} + ${p} + LIMIT ? OFFSET ? + `;s.push(r,n);let E=this.db.prepare(m).all(...s),d=[],g={...o};delete g.type;let _=[];if(g.project&&(_.push("s.project = ?"),d.push(g.project)),g.dateRange){let{start:T,end:R}=g.dateRange;if(T){let P=typeof T=="number"?T:new Date(T).getTime();_.push("s.created_at_epoch >= ?"),d.push(P)}if(R){let P=typeof R=="number"?R:new Date(R).getTime();_.push("s.created_at_epoch <= ?"),d.push(P)}}_.push(`( EXISTS (SELECT 1 FROM json_each(s.files_read) WHERE value LIKE ?) OR EXISTS (SELECT 1 FROM json_each(s.files_edited) WHERE value LIKE ?) - )`),c.push(`%${e}%`,`%${e}%`);let m=` + )`),d.push(`%${e}%`,`%${e}%`);let v=` SELECT s.* FROM session_summaries s - WHERE ${p.join(" AND ")} + WHERE ${_.join(" AND ")} ORDER BY s.created_at_epoch DESC - `,E=this.db.prepare(m).all(...c);return{observations:o,sessions:E}}findByType(e,t={}){let s=[],r={...t,type:e},i=` + LIMIT ? OFFSET ? + `;d.push(r,n);let S=this.db.prepare(v).all(...d);return{observations:E,sessions:S}}findByType(e,t={}){let s=[],{limit:r=50,offset:n=0,orderBy:i="date_desc",...o}=t,c={...o,type:e},u=this.buildFilterClause(c,s,"o"),p=this.buildOrderClause(i,!1),m=` SELECT o.* FROM observations o - WHERE ${this.buildFilterClause(r,s,"o")} - ORDER BY o.created_at_epoch DESC - `;return this.db.prepare(i).all(...s)}advancedSearch(e){let{textQuery:t,searchSessions:s=!0,...r}=e,n=[],i=[];if(t)n=this.searchObservations(t,r),s&&(i=this.searchSessions(t,r));else{let o=[],c=this.buildFilterClause(r,o,"o");if(c){let u=` + WHERE ${u} + ${p} + LIMIT ? OFFSET ? + `;return s.push(r,n),this.db.prepare(m).all(...s)}advancedSearch(e){let{textQuery:t,searchSessions:s=!0,...r}=e,n=[],i=[];if(t)n=this.searchObservations(t,r),s&&(i=this.searchSessions(t,r));else{let o=[],c=this.buildFilterClause(r,o,"o");if(c){let u=` SELECT o.* FROM observations o WHERE ${c} @@ -129,7 +133,7 @@ var xl=Object.create;var Ia=Object.defineProperty;var Rl=Object.getOwnPropertyDe LIMIT ? OFFSET ? `;u.push(r.limit||50,r.offset||0),i=this.db.prepare(E).all(...u)}}}return{observations:n,sessions:i}}close(){this.db.close()}};import Af from"better-sqlite3";var xs=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.SILENT=4]="SILENT",n))(xs||{}),Rs=class{level;useColor;constructor(){let e=process.env.CLAUDE_MEM_LOG_LEVEL?.toUpperCase()||"INFO";this.level=xs[e]??1,this.useColor=process.stdout.isTTY??!1}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.level===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(e0&&(m=` {${Object.entries(v).map(([O,R])=>`${O}=${R}`).join(", ")}}`)}let E=`[${i}] [${o}] [${c}] ${u}${s}${m}${p}`;e===3?console.error(E):console.log(E)}debug(e,t,s,r){this.log(0,e,t,s,r)}info(e,t,s,r){this.log(1,e,t,s,r)}warn(e,t,s,r){this.log(2,e,t,s,r)}error(e,t,s,r){this.log(3,e,t,s,r)}dataIn(e,t,s,r){this.info(e,`\u2192 ${t}`,s,r)}dataOut(e,t,s,r){this.info(e,`\u2190 ${t}`,s,r)}success(e,t,s,r){this.info(e,`\u2713 ${t}`,s,r)}failure(e,t,s,r){this.error(e,`\u2717 ${t}`,s,r)}timing(e,t,s,r){this.info(e,`\u23F1 ${t}`,r,{duration:`${s}ms`})}},rl=new Rs;var xa=class{db;constructor(){ba(or),this.db=new Af(Ea),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable()}initializeSchema(){try{this.db.exec(` +`+JSON.stringify(n,null,2):p=" "+this.formatData(n));let m="";if(r){let{sessionId:d,sdkSessionId:g,correlationId:_,...v}=r;Object.keys(v).length>0&&(m=` {${Object.entries(v).map(([T,R])=>`${T}=${R}`).join(", ")}}`)}let E=`[${i}] [${o}] [${c}] ${u}${s}${m}${p}`;e===3?console.error(E):console.log(E)}debug(e,t,s,r){this.log(0,e,t,s,r)}info(e,t,s,r){this.log(1,e,t,s,r)}warn(e,t,s,r){this.log(2,e,t,s,r)}error(e,t,s,r){this.log(3,e,t,s,r)}dataIn(e,t,s,r){this.info(e,`\u2192 ${t}`,s,r)}dataOut(e,t,s,r){this.info(e,`\u2190 ${t}`,s,r)}success(e,t,s,r){this.info(e,`\u2713 ${t}`,s,r)}failure(e,t,s,r){this.error(e,`\u2717 ${t}`,s,r)}timing(e,t,s,r){this.info(e,`\u23F1 ${t}`,r,{duration:`${s}ms`})}},rl=new Rs;var xa=class{db;constructor(){ba(or),this.db=new Af(Ea),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable()}initializeSchema(){try{this.db.exec(` CREATE TABLE IF NOT EXISTS schema_versions ( id INTEGER PRIMARY KEY, version INTEGER UNIQUE NOT NULL, @@ -416,7 +420,7 @@ Other tips: --- -`);return{content:[{type:"text",text:n}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_concept",description:'Find observations tagged with a specific concept. 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:l.object({concept:l.string().describe("Concept tag to search for"),format:l.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)'),project:l.string().optional().describe("Filter by project name"),dateRange:l.object({start:l.union([l.string(),l.number()]).optional(),end:l.union([l.string(),l.number()]).optional()}).optional().describe("Filter by date range"),limit:l.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:l.number().min(0).default(0).describe("Number of results to skip"),orderBy:l.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{concept:e,format:t="index",...s}=a,r=Wr.findByConcept(e,s);if(r.length===0)return{content:[{type:"text",text:`No observations found with concept "${e}"`}]};let n;if(t==="index"){let i=`Found ${r.length} observation(s) with concept "${e}": +`);return{content:[{type:"text",text:n}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_concept",description:'Find observations tagged with a specific concept. 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:l.object({concept:l.string().describe("Concept tag to search for"),format:l.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)'),project:l.string().optional().describe("Filter by project name"),dateRange:l.object({start:l.union([l.string(),l.number()]).optional(),end:l.union([l.string(),l.number()]).optional()}).optional().describe("Filter by date range"),limit:l.number().min(1).max(100).default(20).describe("Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode."),offset:l.number().min(0).default(0).describe("Number of results to skip"),orderBy:l.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{concept:e,format:t="index",...s}=a,r=Wr.findByConcept(e,s);if(r.length===0)return{content:[{type:"text",text:`No observations found with concept "${e}"`}]};let n;if(t==="index"){let i=`Found ${r.length} observation(s) with concept "${e}": `,o=r.map((c,u)=>It(c,u));n=i+o.join(` @@ -424,7 +428,7 @@ Other tips: --- -`);return{content:[{type:"text",text:n}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_file",description:'Find observations and sessions that reference a specific file path. 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:l.object({filePath:l.string().describe("File path to search for (supports partial matching)"),format:l.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)'),project:l.string().optional().describe("Filter by project name"),dateRange:l.object({start:l.union([l.string(),l.number()]).optional(),end:l.union([l.string(),l.number()]).optional()}).optional().describe("Filter by date range"),limit:l.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:l.number().min(0).default(0).describe("Number of results to skip"),orderBy:l.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{filePath:e,format:t="index",...s}=a,r=Wr.findByFile(e,s),n=r.observations.length+r.sessions.length;if(n===0)return{content:[{type:"text",text:`No results found for file "${e}"`}]};let i;if(t==="index"){let o=`Found ${n} result(s) for file "${e}": +`);return{content:[{type:"text",text:n}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_file",description:'Find observations and sessions that reference a specific file path. 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:l.object({filePath:l.string().describe("File path to search for (supports partial matching)"),format:l.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)'),project:l.string().optional().describe("Filter by project name"),dateRange:l.object({start:l.union([l.string(),l.number()]).optional(),end:l.union([l.string(),l.number()]).optional()}).optional().describe("Filter by date range"),limit:l.number().min(1).max(100).default(20).describe("Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode."),offset:l.number().min(0).default(0).describe("Number of results to skip"),orderBy:l.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{filePath:e,format:t="index",...s}=a,r=Wr.findByFile(e,s),n=r.observations.length+r.sessions.length;if(n===0)return{content:[{type:"text",text:`No results found for file "${e}"`}]};let i;if(t==="index"){let o=`Found ${n} result(s) for file "${e}": `,c=[];r.observations.forEach((u,p)=>{c.push(It(u,p))}),r.sessions.forEach((u,p)=>{c.push(Ts(u,p+r.observations.length))}),i=o+c.join(` @@ -432,7 +436,7 @@ Other tips: --- -`)}return{content:[{type:"text",text:i}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_type",description:'Find observations of a specific type (decision, bugfix, feature, refactor, discovery, change). 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:l.object({type:l.union([l.enum(["decision","bugfix","feature","refactor","discovery","change"]),l.array(l.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).describe("Observation type(s) to filter by"),format:l.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)'),project:l.string().optional().describe("Filter by project name"),dateRange:l.object({start:l.union([l.string(),l.number()]).optional(),end:l.union([l.string(),l.number()]).optional()}).optional().describe("Filter by date range"),limit:l.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:l.number().min(0).default(0).describe("Number of results to skip"),orderBy:l.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{type:e,format:t="index",...s}=a,r=Wr.findByType(e,s);if(r.length===0)return{content:[{type:"text",text:`No observations found with type "${Array.isArray(e)?e.join(", "):e}"`}]};let n=Array.isArray(e)?e.join(", "):e,i;if(t==="index"){let o=`Found ${r.length} observation(s) with type "${n}": +`)}return{content:[{type:"text",text:i}]}}catch(e){return{content:[{type:"text",text:`Search failed: ${e.message}`}],isError:!0}}}},{name:"find_by_type",description:'Find observations of a specific type (decision, bugfix, feature, refactor, discovery, change). 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:l.object({type:l.union([l.enum(["decision","bugfix","feature","refactor","discovery","change"]),l.array(l.enum(["decision","bugfix","feature","refactor","discovery","change"]))]).describe("Observation type(s) to filter by"),format:l.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)'),project:l.string().optional().describe("Filter by project name"),dateRange:l.object({start:l.union([l.string(),l.number()]).optional(),end:l.union([l.string(),l.number()]).optional()}).optional().describe("Filter by date range"),limit:l.number().min(1).max(100).default(20).describe("Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode."),offset:l.number().min(0).default(0).describe("Number of results to skip"),orderBy:l.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{try{let{type:e,format:t="index",...s}=a,r=Wr.findByType(e,s);if(r.length===0)return{content:[{type:"text",text:`No observations found with type "${Array.isArray(e)?e.join(", "):e}"`}]};let n=Array.isArray(e)?e.join(", "):e,i;if(t==="index"){let o=`Found ${r.length} observation(s) with type "${n}": `,c=r.map((u,p)=>It(u,p));i=o+c.join(` diff --git a/plugin/scripts/worker-service.cjs b/plugin/scripts/worker-service.cjs index c917b71e..6d0981dd 100755 --- a/plugin/scripts/worker-service.cjs +++ b/plugin/scripts/worker-service.cjs @@ -49,7 +49,7 @@ Please see the 3.x to 4.x migration guide for details on how to update your app.
`+e+`
-`}function q4(){return function(){this.error(404)}}function $4(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=hc.original(this.req);r.path=null,r.pathname=D4(r.pathname+"/");var a=O4(I4.format(r)),i=N4("Redirecting","Redirecting to "+C4(a));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(i)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",a),e.end(i)}}});var iv=I((oa,nv)=>{"use strict";var Wi=Pf(),L4=require("events").EventEmitter,ev=Rf(),av=ch(),F4=Mo(),M4=Uo(),tv=Dh(),rv=Qh();oa=nv.exports=z4;function z4(){var t=function(e,r,a){t.handle(e,r,a)};return ev(t,L4.prototype,!1),ev(t,av,!1),t.request=Object.create(tv,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.response=Object.create(rv,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.init(),t}oa.application=av;oa.request=tv;oa.response=rv;oa.Route=F4;oa.Router=M4;oa.json=Wi.json;oa.query=Bo();oa.raw=Wi.raw;oa.static=Yh();oa.text=Wi.text;oa.urlencoded=Wi.urlencoded;var U4=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];U4.forEach(function(t){Object.defineProperty(oa,t,{get:function(){throw new Error("Most middleware (like "+t+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var ov=I((N6,sv)=>{"use strict";sv.exports=iv()});var e9={};Hg(e9,{WorkerService:()=>us});module.exports=Vg(e9);var Vc=vs(ov(),1);var bc=require("path"),Pv=require("url"),Tv=require("events"),Ov=require("child_process"),Cv=require("readline"),re=vs(require("fs"),1),Av=require("fs/promises"),$v=require("path"),Lv=require("os"),Dt=require("path"),Sc=require("process"),Fv=require("crypto"),W2={},B4=Object.create,H4=Object.getPrototypeOf,yc=Object.defineProperty,V4=Object.getOwnPropertyNames,Z4=Object.prototype.hasOwnProperty,G4=(t,e,r)=>{r=t!=null?B4(H4(t)):{};let a=e||!t||!t.__esModule?yc(r,"default",{value:t,enumerable:!0}):r;for(let i of V4(t))Z4.call(a,i)||yc(a,i,{get:()=>t[i],enumerable:!0});return a},ie=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),W4=(t,e)=>{for(var r in e)yc(t,r,{get:e[r],enumerable:!0,configurable:!0,set:a=>e[r]=()=>a})},X4=ie((t,e)=>{(function(r,a){typeof t=="object"&&typeof e<"u"?a(t):typeof define=="function"&&define.amd?define(["exports"],a):a(r.URI=r.URI||{})})(t,function(r){function a(){for(var _=arguments.length,x=Array(_),S=0;S<_;S++)x[S]=arguments[S];if(x.length>1){x[0]=x[0].slice(0,-1);for(var D=x.length-1,q=1;q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=f-g,k=Math.floor,T=String.fromCharCode;function $(_){throw new RangeError(L[_])}function F(_,x){for(var S=[],D=_.length;D--;)S[D]=x(_[D]);return S}function B(_,x){var S=_.split("@"),D="";S.length>1&&(D=S[0]+"@",_=S[1]),_=_.replace(N,".");var q=_.split("."),G=F(q,x).join(".");return D+G}function V(_){for(var x=[],S=0,D=_.length;S=55296&&q<=56319&&S>1,x+=k(x/S);x>O*b>>1;q+=f)x=k(x/O);return k(q+(O+1)*x/(x+y))},se=function(x){var S=[],D=x.length,q=0,G=C,ue=A,ge=x.lastIndexOf(E);ge<0&&(ge=0);for(var we=0;we=128&&$("not-basic"),S.push(x.charCodeAt(we));for(var ze=ge>0?ge+1:0;ze=D&&$("invalid-input");var je=K(x.charCodeAt(ze++));(je>=f||je>k((v-q)/Ne))&&$("overflow"),q+=je*Ne;var ye=Ue<=ue?g:Ue>=ue+b?b:Ue-ue;if(jek(v/qe)&&$("overflow"),Ne*=qe}var Se=S.length+1;ue=ee(q-he,Se,he==0),k(q/Se)>v-G&&$("overflow"),G+=k(q/Se),q%=Se,S.splice(q++,0,G)}return String.fromCodePoint.apply(String,S)},We=function(x){var S=[];x=V(x);var D=x.length,q=C,G=0,ue=A,ge=!0,we=!1,ze=void 0;try{for(var he=x[Symbol.iterator](),Ne;!(ge=(Ne=he.next()).done);ge=!0){var Ue=Ne.value;Ue<128&&S.push(T(Ue))}}catch(gt){we=!0,ze=gt}finally{try{!ge&&he.return&&he.return()}finally{if(we)throw ze}}var je=S.length,ye=je;for(je&&S.push(E);ye=q&&dak((v-G)/xa)&&$("overflow"),G+=(qe-q)*xa,q=qe;var Da=!0,vt=!1,Za=void 0;try{for(var Vr=x[Symbol.iterator](),Mn;!(Da=(Mn=Vr.next()).done);Da=!0){var zn=Mn.value;if(znv&&$("overflow"),zn==q){for(var Jt=G,Yt=f;;Yt+=f){var Ga=Yt<=ue?g:Yt>=ue+b?b:Yt-ue;if(Jt>6|192).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase():S="%"+(x>>12|224).toString(16).toUpperCase()+"%"+(x>>6&63|128).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase(),S}function M(_){for(var x="",S=0,D=_.length;S=194&&q<224){if(D-S>=6){var G=parseInt(_.substr(S+4,2),16);x+=String.fromCharCode((q&31)<<6|G&63)}else x+=_.substr(S,6);S+=6}else if(q>=224){if(D-S>=9){var ue=parseInt(_.substr(S+4,2),16),ge=parseInt(_.substr(S+7,2),16);x+=String.fromCharCode((q&15)<<12|(ue&63)<<6|ge&63)}else x+=_.substr(S,9);S+=9}else x+=_.substr(S,3),S+=3}return x}function X(_,x){function S(D){var q=M(D);return q.match(x.UNRESERVED)?q:D}return _.scheme&&(_.scheme=String(_.scheme).replace(x.PCT_ENCODED,S).toLowerCase().replace(x.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(x.PCT_ENCODED,S).replace(x.NOT_USERINFO,R).replace(x.PCT_ENCODED,n)),_.host!==void 0&&(_.host=String(_.host).replace(x.PCT_ENCODED,S).toLowerCase().replace(x.NOT_HOST,R).replace(x.PCT_ENCODED,n)),_.path!==void 0&&(_.path=String(_.path).replace(x.PCT_ENCODED,S).replace(_.scheme?x.NOT_PATH:x.NOT_PATH_NOSCHEME,R).replace(x.PCT_ENCODED,n)),_.query!==void 0&&(_.query=String(_.query).replace(x.PCT_ENCODED,S).replace(x.NOT_QUERY,R).replace(x.PCT_ENCODED,n)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(x.PCT_ENCODED,S).replace(x.NOT_FRAGMENT,R).replace(x.PCT_ENCODED,n)),_}function oe(_){return _.replace(/^0*(.*)/,"$1")||"0"}function z(_,x){var S=_.match(x.IPV4ADDRESS)||[],D=d(S,2),q=D[1];return q?q.split(".").map(oe).join("."):_}function H(_,x){var S=_.match(x.IPV6ADDRESS)||[],D=d(S,3),q=D[1],G=D[2];if(q){for(var ue=q.toLowerCase().split("::").reverse(),ge=d(ue,2),we=ge[0],ze=ge[1],he=ze?ze.split(":").map(oe):[],Ne=we.split(":").map(oe),Ue=x.IPV4ADDRESS.test(Ne[Ne.length-1]),je=Ue?7:8,ye=Ne.length-je,qe=Array(je),Se=0;Se1){var Pe=qe.slice(0,ua.index),da=qe.slice(ua.index+ua.length);ga=Pe.join(":")+"::"+da.join(":")}else ga=qe.join(":");return G&&(ga+="%"+G),ga}else return _}var de=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,me="".match(/(){0}/)[1]===void 0;function ne(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S={},D=x.iri!==!1?u:l;x.reference==="suffix"&&(_=(x.scheme?x.scheme+":":"")+"//"+_);var q=_.match(de);if(q){me?(S.scheme=q[1],S.userinfo=q[3],S.host=q[4],S.port=parseInt(q[5],10),S.path=q[6]||"",S.query=q[7],S.fragment=q[8],isNaN(S.port)&&(S.port=q[5])):(S.scheme=q[1]||void 0,S.userinfo=_.indexOf("@")!==-1?q[3]:void 0,S.host=_.indexOf("//")!==-1?q[4]:void 0,S.port=parseInt(q[5],10),S.path=q[6]||"",S.query=_.indexOf("?")!==-1?q[7]:void 0,S.fragment=_.indexOf("#")!==-1?q[8]:void 0,isNaN(S.port)&&(S.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?q[4]:void 0)),S.host&&(S.host=H(z(S.host,D),D)),S.scheme===void 0&&S.userinfo===void 0&&S.host===void 0&&S.port===void 0&&!S.path&&S.query===void 0?S.reference="same-document":S.scheme===void 0?S.reference="relative":S.fragment===void 0?S.reference="absolute":S.reference="uri",x.reference&&x.reference!=="suffix"&&x.reference!==S.reference&&(S.error=S.error||"URI is not a "+x.reference+" reference.");var G=De[(x.scheme||S.scheme||"").toLowerCase()];if(!x.unicodeSupport&&(!G||!G.unicodeSupport)){if(S.host&&(x.domainHost||G&&G.domainHost))try{S.host=Re.toASCII(S.host.replace(D.PCT_ENCODED,M).toLowerCase())}catch(ue){S.error=S.error||"Host's domain name can not be converted to ASCII via punycode: "+ue}X(S,l)}else X(S,D);G&&G.parse&&G.parse(S,x)}else S.error=S.error||"URI can not be parsed.";return S}function Ce(_,x){var S=x.iri!==!1?u:l,D=[];return _.userinfo!==void 0&&(D.push(_.userinfo),D.push("@")),_.host!==void 0&&D.push(H(z(String(_.host),S),S).replace(S.IPV6ADDRESS,function(q,G,ue){return"["+G+(ue?"%25"+ue:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(D.push(":"),D.push(String(_.port))),D.length?D.join(""):void 0}var Ae=/^\.\.?\//,xe=/^\/\.(\/|$)/,Ke=/^\/\.\.(\/|$)/,Le=/^\/?(?:.|\n)*?(?=\/|$)/;function Ye(_){for(var x=[];_.length;)if(_.match(Ae))_=_.replace(Ae,"");else if(_.match(xe))_=_.replace(xe,"/");else if(_.match(Ke))_=_.replace(Ke,"/"),x.pop();else if(_==="."||_==="..")_="";else{var S=_.match(Le);if(S){var D=S[0];_=_.slice(D.length),x.push(D)}else throw new Error("Unexpected dot segment condition")}return x.join("")}function Ie(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=x.iri?u:l,D=[],q=De[(x.scheme||_.scheme||"").toLowerCase()];if(q&&q.serialize&&q.serialize(_,x),_.host&&!S.IPV6ADDRESS.test(_.host)){if(x.domainHost||q&&q.domainHost)try{_.host=x.iri?Re.toUnicode(_.host):Re.toASCII(_.host.replace(S.PCT_ENCODED,M).toLowerCase())}catch(ge){_.error=_.error||"Host's domain name can not be converted to "+(x.iri?"Unicode":"ASCII")+" via punycode: "+ge}}X(_,S),x.reference!=="suffix"&&_.scheme&&(D.push(_.scheme),D.push(":"));var G=Ce(_,x);if(G!==void 0&&(x.reference!=="suffix"&&D.push("//"),D.push(G),_.path&&_.path.charAt(0)!=="/"&&D.push("/")),_.path!==void 0){var ue=_.path;!x.absolutePath&&(!q||!q.absolutePath)&&(ue=Ye(ue)),G===void 0&&(ue=ue.replace(/^\/\//,"/%2F")),D.push(ue)}return _.query!==void 0&&(D.push("?"),D.push(_.query)),_.fragment!==void 0&&(D.push("#"),D.push(_.fragment)),D.join("")}function Ve(_,x){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=arguments[3],q={};return D||(_=ne(Ie(_,S),S),x=ne(Ie(x,S),S)),S=S||{},!S.tolerant&&x.scheme?(q.scheme=x.scheme,q.userinfo=x.userinfo,q.host=x.host,q.port=x.port,q.path=Ye(x.path||""),q.query=x.query):(x.userinfo!==void 0||x.host!==void 0||x.port!==void 0?(q.userinfo=x.userinfo,q.host=x.host,q.port=x.port,q.path=Ye(x.path||""),q.query=x.query):(x.path?(x.path.charAt(0)==="/"?q.path=Ye(x.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?q.path="/"+x.path:_.path?q.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+x.path:q.path=x.path,q.path=Ye(q.path)),q.query=x.query):(q.path=_.path,x.query!==void 0?q.query=x.query:q.query=_.query),q.userinfo=_.userinfo,q.host=_.host,q.port=_.port),q.scheme=_.scheme),q.fragment=x.fragment,q}function va(_,x,S){var D=p({scheme:"null"},S);return Ie(Ve(ne(_,D),ne(x,D),D,!0),D)}function la(_,x){return typeof _=="string"?_=Ie(ne(_,x),x):s(_)==="object"&&(_=ne(Ie(_,x),x)),_}function Fn(_,x,S){return typeof _=="string"?_=Ie(ne(_,S),S):s(_)==="object"&&(_=Ie(_,S)),typeof x=="string"?x=Ie(ne(x,S),S):s(x)==="object"&&(x=Ie(x,S)),_===x}function ds(_,x){return _&&_.toString().replace(!x||!x.iri?l.ESCAPE:u.ESCAPE,R)}function Ta(_,x){return _&&_.toString().replace(!x||!x.iri?l.PCT_ENCODED:u.PCT_ENCODED,M)}var Br={scheme:"http",domainHost:!0,parse:function(x,S){return x.host||(x.error=x.error||"HTTP URIs must have a host."),x},serialize:function(x,S){var D=String(x.scheme).toLowerCase()==="https";return(x.port===(D?443:80)||x.port==="")&&(x.port=void 0),x.path||(x.path="/"),x}},Zc={scheme:"https",domainHost:Br.domainHost,parse:Br.parse,serialize:Br.serialize};function Gc(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Hr={scheme:"ws",domainHost:!0,parse:function(x,S){var D=x;return D.secure=Gc(D),D.resourceName=(D.path||"/")+(D.query?"?"+D.query:""),D.path=void 0,D.query=void 0,D},serialize:function(x,S){if((x.port===(Gc(x)?443:80)||x.port==="")&&(x.port=void 0),typeof x.secure=="boolean"&&(x.scheme=x.secure?"wss":"ws",x.secure=void 0),x.resourceName){var D=x.resourceName.split("?"),q=d(D,2),G=q[0],ue=q[1];x.path=G&&G!=="/"?G:void 0,x.query=ue,x.resourceName=void 0}return x.fragment=void 0,x}},Wc={scheme:"wss",domainHost:Hr.domainHost,parse:Hr.parse,serialize:Hr.serialize},bg={},wg=!0,Xc="[A-Za-z0-9\\-\\.\\_\\~"+(wg?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ja="[0-9A-Fa-f]",_g=i(i("%[EFef]"+ja+"%"+ja+ja+"%"+ja+ja)+"|"+i("%[89A-Fa-f]"+ja+"%"+ja+ja)+"|"+i("%"+ja+ja)),Eg="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Sg="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",kg=a(Sg,'[\\"\\\\]'),Pg="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Tg=new RegExp(Xc,"g"),Qt=new RegExp(_g,"g"),Rg=new RegExp(a("[^]",Eg,"[\\.]",'[\\"]',kg),"g"),Kc=new RegExp(a("[^]",Xc,Pg),"g"),Og=Kc;function fs(_){var x=M(_);return x.match(Tg)?x:_}var Qc={scheme:"mailto",parse:function(x,S){var D=x,q=D.to=D.path?D.path.split(","):[];if(D.path=void 0,D.query){for(var G=!1,ue={},ge=D.query.split("&"),we=0,ze=ge.length;we{e.exports=function r(a,i){if(a===i)return!0;if(a&&i&&typeof a=="object"&&typeof i=="object"){if(a.constructor!==i.constructor)return!1;var s,n,o;if(Array.isArray(a)){if(s=a.length,s!=i.length)return!1;for(n=s;n--!==0;)if(!r(a[n],i[n]))return!1;return!0}if(a.constructor===RegExp)return a.source===i.source&&a.flags===i.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===i.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===i.toString();if(o=Object.keys(a),s=o.length,s!==Object.keys(i).length)return!1;for(n=s;n--!==0;)if(!Object.prototype.hasOwnProperty.call(i,o[n]))return!1;for(n=s;n--!==0;){var p=o[n];if(!r(a[p],i[p]))return!1}return!0}return a!==a&&i!==i}}),K4=ie((t,e)=>{e.exports=function(a){for(var i=0,s=a.length,n=0,o;n=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:a,checkDataTypes:i,coerceToTypes:n,toHash:o,getProperty:l,escapeQuotes:u,equal:Ac(),ucs2length:K4(),varOccurences:d,varReplace:h,schemaHasRules:v,schemaHasRulesExcept:f,schemaUnknownRules:g,toQuotedString:b,getPathExpr:y,getPath:w,getData:E,unescapeFragment:j,unescapeJsonPointer:O,escapeFragment:N,escapeJsonPointer:L};function r(k,T){T=T||{};for(var $ in k)T[$]=k[$];return T}function a(k,T,$,F){var B=F?" !== ":" === ",V=F?" || ":" && ",J=F?"!":"",K=F?"":"!";switch(k){case"null":return T+B+"null";case"array":return J+"Array.isArray("+T+")";case"object":return"("+J+T+V+"typeof "+T+B+'"object"'+V+K+"Array.isArray("+T+"))";case"integer":return"(typeof "+T+B+'"number"'+V+K+"("+T+" % 1)"+V+T+B+T+($?V+J+"isFinite("+T+")":"")+")";case"number":return"(typeof "+T+B+'"'+k+'"'+($?V+J+"isFinite("+T+")":"")+")";default:return"typeof "+T+B+'"'+k+'"'}}function i(k,T,$){switch(k.length){case 1:return a(k[0],T,$,!0);default:var F="",B=o(k);B.array&&B.object&&(F=B.null?"(":"(!"+T+" || ",F+="typeof "+T+' !== "object")',delete B.null,delete B.array,delete B.object),B.number&&delete B.integer;for(var V in B)F+=(F?" && ":"")+a(V,T,$,!0);return F}}var s=o(["string","number","integer","boolean","null"]);function n(k,T){if(Array.isArray(T)){for(var $=[],F=0;F=T)throw new Error("Cannot access property/index "+F+" levels up, current level is "+T);return $[T-F]}if(F>T)throw new Error("Cannot access data "+F+" levels up, current level is "+T);if(V="data"+(T-F||""),!B)return V}for(var K=V,Y=B.split("/"),ee=0;ee{var r=Fr();e.exports=a;function a(i){r.copy(i,this)}}),Q4=ie((t,e)=>{var r=e.exports=function(s,n,o){typeof n=="function"&&(o=n,n={}),o=n.cb||o;var p=typeof o=="function"?o:o.pre||function(){},c=o.post||function(){};a(n,p,c,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function a(s,n,o,p,c,l,u,d,h,v){if(p&&typeof p=="object"&&!Array.isArray(p)){n(p,c,l,u,d,h,v);for(var f in p){var g=p[f];if(Array.isArray(g)){if(f in r.arrayKeywords)for(var b=0;b{var r=X4(),a=Ac(),i=Fr(),s=_v(),n=Q4();e.exports=o,o.normalizeId=w,o.fullPath=g,o.url=A,o.ids=C,o.inlineRef=h,o.schema=p;function o(E,P,j){var N=this._refs[j];if(typeof N=="string")if(this._refs[N])N=this._refs[N];else return o.call(this,E,P,N);if(N=N||this._schemas[j],N instanceof s)return h(N.schema,this._opts.inlineRefs)?N.schema:N.validate||this._compile(N);var L=p.call(this,P,j),O,k,T;return L&&(O=L.schema,P=L.root,T=L.baseId),O instanceof s?k=O.validate||E.call(this,O.schema,P,void 0,T):O!==void 0&&(k=h(O,this._opts.inlineRefs)?O:E.call(this,O,P,void 0,T)),k}function p(E,P){var j=r.parse(P),N=b(j),L=g(this._getId(E.schema));if(Object.keys(E.schema).length===0||N!==L){var O=w(N),k=this._refs[O];if(typeof k=="string")return c.call(this,E,k,j);if(k instanceof s)k.validate||this._compile(k),E=k;else if(k=this._schemas[O],k instanceof s){if(k.validate||this._compile(k),O==w(P))return{schema:k,root:E,baseId:L};E=k}else return;if(!E.schema)return;L=g(this._getId(E.schema))}return u.call(this,j,L,E.schema,E)}function c(E,P,j){var N=p.call(this,E,P);if(N){var L=N.schema,O=N.baseId;E=N.root;var k=this._getId(L);return k&&(O=A(O,k)),u.call(this,j,O,L,E)}}var l=i.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function u(E,P,j,N){if(E.fragment=E.fragment||"",E.fragment.slice(0,1)=="/"){for(var L=E.fragment.split("/"),O=1;O{var r=Ic();e.exports={Validation:s(a),MissingRef:s(i)};function a(n){this.message="validation failed",this.errors=n,this.ajv=this.validation=!0}i.message=function(n,o){return"can't resolve reference "+o+" from id "+n};function i(n,o,p){this.message=p||i.message(n,o),this.missingRef=r.url(n,o),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function s(n){return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}}),Ev=ie((t,e)=>{e.exports=function(r,a){a||(a={}),typeof a=="function"&&(a={cmp:a});var i=typeof a.cycles=="boolean"?a.cycles:!1,s=a.cmp&&function(o){return function(p){return function(c,l){var u={key:c,value:p[c]},d={key:l,value:p[l]};return o(u,d)}}}(a.cmp),n=[];return function o(p){if(p&&p.toJSON&&typeof p.toJSON=="function"&&(p=p.toJSON()),p!==void 0){if(typeof p=="number")return isFinite(p)?""+p:"null";if(typeof p!="object")return JSON.stringify(p);var c,l;if(Array.isArray(p)){for(l="[",c=0;c{e.exports=function(a,i,s){var n="",o=a.schema.$async===!0,p=a.util.schemaHasRulesExcept(a.schema,a.RULES.all,"$ref"),c=a.self._getId(a.schema);if(a.opts.strictKeywords){var l=a.util.schemaUnknownRules(a.schema,a.RULES.keywords);if(l){var u="unknown keyword: "+l;if(a.opts.strictKeywords==="log")a.logger.warn(u);else throw new Error(u)}}if(a.isTop&&(n+=" var validate = ",o&&(a.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(a.opts.sourceCode||a.opts.processCode)&&(n+=" "+("/*# sourceURL="+c+" */")+" ")),typeof a.schema=="boolean"||!(p||a.schema.$ref)){var i="false schema",d=a.level,h=a.dataLevel,v=a.schema[i],f=a.schemaPath+a.util.getProperty(i),g=a.errSchemaPath+"/"+i,P=!a.opts.allErrors,L,b="data"+(h||""),E="valid"+d;if(a.schema===!1){a.isTop?P=!0:n+=" var "+E+" = false; ";var y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(L||"false schema")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(g)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),a.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+b+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!a.compositeRule&&P?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else a.isTop?o?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+E+" = true; ";return a.isTop&&(n+=" }; return validate; "),n}if(a.isTop){var A=a.isTop,d=a.level=0,h=a.dataLevel=0,b="data";if(a.rootId=a.resolve.fullPath(a.self._getId(a.root.schema)),a.baseId=a.baseId||a.rootId,delete a.isTop,a.dataPathArr=[""],a.schema.default!==void 0&&a.opts.useDefaults&&a.opts.strictDefaults){var C="default is ignored in the schema root";if(a.opts.strictDefaults==="log")a.logger.warn(C);else throw new Error(C)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var{level:d,dataLevel:h}=a,b="data"+(h||"");if(c&&(a.baseId=a.resolve.url(a.baseId,c)),o&&!a.async)throw new Error("async schema in sync schema");n+=" var errs_"+d+" = errors;"}var E="valid"+d,P=!a.opts.allErrors,j="",N="",L,O=a.schema.type,k=Array.isArray(O);if(O&&a.opts.nullable&&a.schema.nullable===!0&&(k?O.indexOf("null")==-1&&(O=O.concat("null")):O!="null"&&(O=[O,"null"],k=!0)),k&&O.length==1&&(O=O[0],k=!1),a.schema.$ref&&p){if(a.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+a.errSchemaPath+'" (see option extendRefs)');a.opts.extendRefs!==!0&&(p=!1,a.logger.warn('$ref: keywords ignored in schema at path "'+a.errSchemaPath+'"'))}if(a.schema.$comment&&a.opts.$comment&&(n+=" "+a.RULES.all.$comment.code(a,"$comment")),O){if(a.opts.coerceTypes)var T=a.util.coerceToTypes(a.opts.coerceTypes,O);var $=a.RULES.types[O];if(T||k||$===!0||$&&!Le($)){var f=a.schemaPath+".type",g=a.errSchemaPath+"/type",f=a.schemaPath+".type",g=a.errSchemaPath+"/type",F=k?"checkDataTypes":"checkDataType";if(n+=" if ("+a.util[F](O,b,a.opts.strictNumbers,!0)+") { ",T){var B="dataType"+d,V="coerced"+d;n+=" var "+B+" = typeof "+b+"; var "+V+" = undefined; ",a.opts.coerceTypes=="array"&&(n+=" if ("+B+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+B+" = typeof "+b+"; if ("+a.util.checkDataType(a.schema.type,b,a.opts.strictNumbers)+") "+V+" = "+b+"; } "),n+=" if ("+V+" !== undefined) ; ";var J=T;if(J)for(var K,Y=-1,ee=J.length-1;Y{var r=Ic(),a=Fr(),i=jc(),s=Ev(),n=Sv(),o=a.ucs2length,p=Ac(),c=i.Validation;e.exports=l;function l(w,A,C,E){var P=this,j=this._opts,N=[void 0],L={},O=[],k={},T=[],$={},F=[];A=A||{schema:w,refVal:N,refs:L};var B=u.call(this,w,A,E),V=this._compilations[B.index];if(B.compiling)return V.callValidate=se;var J=this._formats,K=this.RULES;try{var Y=We(w,A,C,E);V.validate=Y;var ee=V.callValidate;return ee&&(ee.schema=Y.schema,ee.errors=null,ee.refs=Y.refs,ee.refVal=Y.refVal,ee.root=Y.root,ee.$async=Y.$async,j.sourceCode&&(ee.source=Y.source)),Y}finally{d.call(this,w,A,E)}function se(){var z=V.validate,H=z.apply(this,arguments);return se.errors=z.errors,H}function We(z,H,de,me){var ne=!H||H&&H.schema==z;if(H.schema!=A.schema)return l.call(P,z,H,de,me);var Ce=z.$async===!0,Ae=n({isTop:!0,schema:z,isRoot:ne,baseId:me,root:H,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:i.MissingRef,RULES:K,validate:n,util:a,resolve:r,resolveRef:Qe,usePattern:M,useDefault:X,useCustomRule:oe,opts:j,formats:J,logger:P.logger,self:P});Ae=y(N,g)+y(O,v)+y(T,f)+y(F,b)+Ae,j.processCode&&(Ae=j.processCode(Ae,z));var xe;try{var Ke=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ae);xe=Ke(P,K,J,A,N,T,F,p,o,c),N[0]=xe}catch(Le){throw P.logger.error("Error compiling schema, function code:",Ae),Le}return xe.schema=z,xe.errors=null,xe.refs=L,xe.refVal=N,xe.root=ne?xe:H,Ce&&(xe.$async=!0),j.sourceCode===!0&&(xe.source={code:Ae,patterns:O,defaults:T}),xe}function Qe(z,H,de){H=r.url(z,H);var me=L[H],ne,Ce;if(me!==void 0)return ne=N[me],Ce="refVal["+me+"]",R(ne,Ce);if(!de&&A.refs){var Ae=A.refs[H];if(Ae!==void 0)return ne=A.refVal[Ae],Ce=Xe(H,ne),R(ne,Ce)}Ce=Xe(H);var xe=r.call(P,We,A,H);if(xe===void 0){var Ke=C&&C[H];Ke&&(xe=r.inlineRef(Ke,j.inlineRefs)?Ke:l.call(P,Ke,A,C,z))}if(xe===void 0)Re(H);else return De(H,xe),R(xe,Ce)}function Xe(z,H){var de=N.length;return N[de]=H,L[z]=de,"refVal"+de}function Re(z){delete L[z]}function De(z,H){var de=L[z];N[de]=H}function R(z,H){return typeof z=="object"||typeof z=="boolean"?{code:H,schema:z,inline:!0}:{code:H,$async:z&&!!z.$async}}function M(z){var H=k[z];return H===void 0&&(H=k[z]=O.length,O[H]=z),"pattern"+H}function X(z){switch(typeof z){case"boolean":case"number":return""+z;case"string":return a.toQuotedString(z);case"object":if(z===null)return"null";var H=s(z),de=$[H];return de===void 0&&(de=$[H]=T.length,T[de]=z),"default"+de}}function oe(z,H,de,me){if(P._opts.validateSchema!==!1){var ne=z.definition.dependencies;if(ne&&!ne.every(function(va){return Object.prototype.hasOwnProperty.call(de,va)}))throw new Error("parent schema must have all required keywords: "+ne.join(","));var Ce=z.definition.validateSchema;if(Ce){var Ae=Ce(H);if(!Ae){var xe="keyword schema is invalid: "+P.errorsText(Ce.errors);if(P._opts.validateSchema=="log")P.logger.error(xe);else throw new Error(xe)}}}var Ke=z.definition.compile,Le=z.definition.inline,Ye=z.definition.macro,Ie;if(Ke)Ie=Ke.call(P,H,de,me);else if(Ye)Ie=Ye.call(P,H,de,me),j.validateSchema!==!1&&P.validateSchema(Ie,!0);else if(Le)Ie=Le.call(P,me,z.keyword,H,de);else if(Ie=z.definition.validate,!Ie)return;if(Ie===void 0)throw new Error('custom keyword "'+z.keyword+'"failed to compile');var Ve=F.length;return F[Ve]=Ie,{code:"customRule"+Ve,validate:Ie}}}function u(w,A,C){var E=h.call(this,w,A,C);return E>=0?{index:E,compiling:!0}:(E=this._compilations.length,this._compilations[E]={schema:w,root:A,baseId:C},{index:E,compiling:!1})}function d(w,A,C){var E=h.call(this,w,A,C);E>=0&&this._compilations.splice(E,1)}function h(w,A,C){for(var E=0;E{var r=e.exports=function(){this._cache={}};r.prototype.put=function(i,s){this._cache[i]=s},r.prototype.get=function(i){return this._cache[i]},r.prototype.del=function(i){delete this._cache[i]},r.prototype.clear=function(){this._cache={}}}),e8=ie((t,e)=>{var r=Fr(),a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31],s=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,n=/^(?=.{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,o=/^(?:[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,p=/^(?:[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,c=/^(?:(?:[^\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,l=/^(?:(?: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,u=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,d=/^(?:\/(?:[^~/]|~0|~1)*)*$/,h=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;e.exports=f;function f(N){return N=N=="full"?"full":"fast",r.copy(f[N])}f.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":c,url:l,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:n,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:j,uuid:u,"json-pointer":d,"json-pointer-uri-fragment":h,"relative-json-pointer":v},f.full={date:b,time:y,"date-time":A,uri:E,"uri-reference":p,"uri-template":c,url:l,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:n,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:j,uuid:u,"json-pointer":d,"json-pointer-uri-fragment":h,"relative-json-pointer":v};function g(N){return N%4===0&&(N%100!==0||N%400===0)}function b(N){var L=N.match(a);if(!L)return!1;var O=+L[1],k=+L[2],T=+L[3];return k>=1&&k<=12&&T>=1&&T<=(k==2&&g(O)?29:i[k])}function y(N,L){var O=N.match(s);if(!O)return!1;var k=O[1],T=O[2],$=O[3],F=O[5];return(k<=23&&T<=59&&$<=59||k==23&&T==59&&$==60)&&(!L||F)}var w=/t|\s/i;function A(N){var L=N.split(w);return L.length==2&&b(L[0])&&y(L[1],!0)}var C=/\/|:/;function E(N){return C.test(N)&&o.test(N)}var P=/[^\\]\\Z/;function j(N){if(P.test(N))return!1;try{return new RegExp(N),!0}catch{return!1}}}),a8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.errSchemaPath+"/"+i,u=!a.opts.allErrors,d="data"+(p||""),h="valid"+o,v,f;if(c=="#"||c=="#/")a.isRoot?(v=a.async,f="validate"):(v=a.root.schema.$async===!0,f="root.refVal[0]");else{var g=a.resolveRef(a.baseId,c,a.isRoot);if(g===void 0){var b=a.MissingRefError.message(a.baseId,c);if(a.opts.missingRefs=="fail"){a.logger.error(b);var y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(l)+" , params: { ref: '"+a.util.escapeQuotes(c)+"' } ",a.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+a.util.escapeQuotes(c)+"' "),a.opts.verbose&&(n+=" , schema: "+a.util.toQuotedString(c)+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!a.compositeRule&&u?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ")}else if(a.opts.missingRefs=="ignore")a.logger.warn(b),u&&(n+=" if (true) { ");else throw new a.MissingRefError(a.baseId,c,b)}else if(g.inline){var A=a.util.copy(a);A.level++;var C="valid"+A.level;A.schema=g.schema,A.schemaPath="",A.errSchemaPath=c;var E=a.validate(A).replace(/validate\.schema/g,g.code);n+=" "+E+" ",u&&(n+=" if ("+C+") { ")}else v=g.$async===!0||a.async&&g.$async!==!1,f=g.code}if(f){var y=y||[];y.push(n),n="",a.opts.passContext?n+=" "+f+".call(this, ":n+=" "+f+"( ",n+=" "+d+", (dataPath || '')",a.errorPath!='""'&&(n+=" + "+a.errorPath);var P=p?"data"+(p-1||""):"parentData",j=p?a.dataPathArr[p]:"parentDataProperty";n+=" , "+P+" , "+j+", rootData) ";var N=n;if(n=y.pop(),v){if(!a.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+h+"; "),n+=" try { await "+N+"; ",u&&(n+=" "+h+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(n+=" "+h+" = false; "),n+=" } ",u&&(n+=" if ("+h+") { ")}else n+=" if (!"+N+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n}}),t8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.schema[i],p=a.schemaPath+a.util.getProperty(i),c=a.errSchemaPath+"/"+i,l=!a.opts.allErrors,u=a.util.copy(a),d="";u.level++;var h="valid"+u.level,v=u.baseId,f=!0,g=o;if(g)for(var b,y=-1,w=g.length-1;y0||b===!1:a.util.schemaHasRules(b,a.RULES.all))&&(f=!1,u.schema=b,u.schemaPath=p+"["+y+"]",u.errSchemaPath=c+"/"+y,n+=" "+a.validate(u)+" ",u.baseId=v,l&&(n+=" if ("+h+") { ",d+="}"));return l&&(f?n+=" if (true) { ":n+=" "+d.slice(0,-1)+" "),n}}),r8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a),b="";g.level++;var y="valid"+g.level,w=c.every(function(L){return a.opts.strictKeywords?typeof L=="object"&&Object.keys(L).length>0||L===!1:a.util.schemaHasRules(L,a.RULES.all)});if(w){var A=g.baseId;n+=" var "+f+" = errors; var "+v+" = false; ";var C=a.compositeRule;a.compositeRule=g.compositeRule=!0;var E=c;if(E)for(var P,j=-1,N=E.length-1;j{e.exports=function(a,i,s){var n=" ",o=a.schema[i],p=a.errSchemaPath+"/"+i,c=!a.opts.allErrors,l=a.util.toQuotedString(o);return a.opts.$comment===!0?n+=" console.log("+l+");":typeof a.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+a.util.toQuotedString(p)+", validate.root.schema);"),n}}),i8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f=a.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",g="schema"+o):g=c,f||(n+=" var schema"+o+" = validate.schema"+l+";"),n+="var "+v+" = equal("+h+", schema"+o+"); if (!"+v+") { ";var b=b||[];b.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",a.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=b.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n}}),s8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a),b="";g.level++;var y="valid"+g.level,w="i"+o,A=g.dataLevel=a.dataLevel+1,C="data"+A,E=a.baseId,P=a.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:a.util.schemaHasRules(c,a.RULES.all);if(n+="var "+f+" = errors;var "+v+";",P){var j=a.compositeRule;a.compositeRule=g.compositeRule=!0,g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" var "+y+" = false; for (var "+w+" = 0; "+w+" < "+h+".length; "+w+"++) { ",g.errorPath=a.util.getPathExpr(a.errorPath,w,a.opts.jsonPointers,!0);var N=h+"["+w+"]";g.dataPathArr[A]=w;var L=a.validate(g);g.baseId=E,a.util.varOccurences(L,C)<2?n+=" "+a.util.varReplace(L,C,N)+" ":n+=" var "+C+" = "+N+"; "+L+" ",n+=" if ("+y+") break; } ",a.compositeRule=g.compositeRule=j,n+=" "+b+" if (!"+y+") {"}else n+=" if ("+h+".length == 0) {";var O=O||[];O.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var k=n;return n=O.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+k+"]); ":n+=" validate.errors = ["+k+"]; return false; ":n+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",P&&(n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),a.opts.allErrors&&(n+=" } "),n}}),o8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="errs__"+o,f=a.util.copy(a),g="";f.level++;var b="valid"+f.level,y={},w={},A=a.opts.ownProperties;for(j in c)if(j!="__proto__"){var C=c[j],E=Array.isArray(C)?w:y;E[j]=C}n+="var "+v+" = errors;";var P=a.errorPath;n+="var missing"+o+";";for(var j in w)if(E=w[j],E.length){if(n+=" if ( "+h+a.util.getProperty(j)+" !== undefined ",A&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(j)+"') "),d){n+=" && ( ";var N=E;if(N)for(var L,O=-1,k=N.length-1;O0||C===!1:a.util.schemaHasRules(C,a.RULES.all))&&(n+=" "+b+" = true; if ( "+h+a.util.getProperty(j)+" !== undefined ",A&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(j)+"') "),n+=") { ",f.schema=C,f.schemaPath=l+a.util.getProperty(j),f.errSchemaPath=u+"/"+a.util.escapeFragment(j),n+=" "+a.validate(f)+" ",f.baseId=se,n+=" } ",d&&(n+=" if ("+b+") { ",g+="}"))}return d&&(n+=" "+g+" if ("+v+" == errors) {"),n}}),c8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f=a.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",g="schema"+o):g=c;var b="i"+o,y="schema"+o;f||(n+=" var "+y+" = validate.schema"+l+";"),n+="var "+v+";",f&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=""+v+" = false;for (var "+b+"=0; "+b+"<"+y+".length; "+b+"++) if (equal("+h+", "+y+"["+b+"])) { "+v+" = true; break; }",f&&(n+=" } "),n+=" if (!"+v+") { ";var w=w||[];w.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",a.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var A=n;return n=w.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n}}),p8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||"");if(a.opts.format===!1)return d&&(n+=" if (true) { "),n;var v=a.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c;var g=a.opts.unknownFormats,b=Array.isArray(g);if(v){var y="format"+o,w="isObject"+o,A="formatType"+o;n+=" var "+y+" = formats["+f+"]; var "+w+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+A+" = "+w+" && "+y+".type || 'string'; if ("+w+") { ",a.async&&(n+=" var async"+o+" = "+y+".async; "),n+=" "+y+" = "+y+".validate; } if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" (",g!="ignore"&&(n+=" ("+f+" && !"+y+" ",b&&(n+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),n+=") || "),n+=" ("+y+" && "+A+" == '"+s+"' && !(typeof "+y+" == 'function' ? ",a.async?n+=" (async"+o+" ? await "+y+"("+h+") : "+y+"("+h+")) ":n+=" "+y+"("+h+") ",n+=" : "+y+".test("+h+"))))) {"}else{var y=a.formats[c];if(!y){if(g=="ignore")return a.logger.warn('unknown format "'+c+'" ignored in schema at path "'+a.errSchemaPath+'"'),d&&(n+=" if (true) { "),n;if(b&&g.indexOf(c)>=0)return d&&(n+=" if (true) { "),n;throw new Error('unknown format "'+c+'" is used in schema at path "'+a.errSchemaPath+'"')}var w=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,A=w&&y.type||"string";if(w){var C=y.async===!0;y=y.validate}if(A!=s)return d&&(n+=" if (true) { "),n;if(C){if(!a.async)throw new Error("async format in sync schema");var E="formats"+a.util.getProperty(c)+".validate";n+=" if (!(await "+E+"("+h+"))) { "}else{n+=" if (! ";var E="formats"+a.util.getProperty(c);w&&(E+=".validate"),typeof y=="function"?n+=" "+E+"("+h+") ":n+=" "+E+".test("+h+") ",n+=") { "}}var P=P||[];P.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { format: ",v?n+=""+f:n+=""+a.util.toQuotedString(c),n+=" } ",a.opts.messages!==!1&&(n+=` , message: 'should match format "`,v?n+="' + "+f+" + '":n+=""+a.util.escapeQuotes(c),n+=`"' `),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+a.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var j=n;return n=P.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n}}),l8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a);g.level++;var b="valid"+g.level,y=a.schema.then,w=a.schema.else,A=y!==void 0&&(a.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:a.util.schemaHasRules(y,a.RULES.all)),C=w!==void 0&&(a.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:a.util.schemaHasRules(w,a.RULES.all)),E=g.baseId;if(A||C){var P;g.createErrors=!1,g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" var "+f+" = errors; var "+v+" = true; ";var j=a.compositeRule;a.compositeRule=g.compositeRule=!0,n+=" "+a.validate(g)+" ",g.baseId=E,g.createErrors=!0,n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",a.compositeRule=g.compositeRule=j,A?(n+=" if ("+b+") { ",g.schema=a.schema.then,g.schemaPath=a.schemaPath+".then",g.errSchemaPath=a.errSchemaPath+"/then",n+=" "+a.validate(g)+" ",g.baseId=E,n+=" "+v+" = "+b+"; ",A&&C?(P="ifClause"+o,n+=" var "+P+" = 'then'; "):P="'then'",n+=" } ",C&&(n+=" else { ")):n+=" if (!"+b+") { ",C&&(g.schema=a.schema.else,g.schemaPath=a.schemaPath+".else",g.errSchemaPath=a.errSchemaPath+"/else",n+=" "+a.validate(g)+" ",g.baseId=E,n+=" "+v+" = "+b+"; ",A&&C?(P="ifClause"+o,n+=" var "+P+" = 'else'; "):P="'else'",n+=" } "),n+=" if (!"+v+") { var err = ",a.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { failingKeyword: "+P+" } ",a.opts.messages!==!1&&(n+=` , message: 'should match "' + `+P+` + '" schema' `),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!a.compositeRule&&d&&(a.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n}}),u8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a),b="";g.level++;var y="valid"+g.level,w="i"+o,A=g.dataLevel=a.dataLevel+1,C="data"+A,E=a.baseId;if(n+="var "+f+" = errors;var "+v+";",Array.isArray(c)){var P=a.schema.additionalItems;if(P===!1){n+=" "+v+" = "+h+".length <= "+c.length+"; ";var j=u;u=a.errSchemaPath+"/additionalItems",n+=" if (!"+v+") { ";var N=N||[];N.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { limit: "+c.length+" } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+c.length+" items' "),a.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var L=n;n=N.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+L+"]); ":n+=" validate.errors = ["+L+"]; return false; ":n+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u=j,d&&(b+="}",n+=" else { ")}var O=c;if(O){for(var k,T=-1,$=O.length-1;T<$;)if(k=O[T+=1],a.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:a.util.schemaHasRules(k,a.RULES.all)){n+=" "+y+" = true; if ("+h+".length > "+T+") { ";var F=h+"["+T+"]";g.schema=k,g.schemaPath=l+"["+T+"]",g.errSchemaPath=u+"/"+T,g.errorPath=a.util.getPathExpr(a.errorPath,T,a.opts.jsonPointers,!0),g.dataPathArr[A]=T;var B=a.validate(g);g.baseId=E,a.util.varOccurences(B,C)<2?n+=" "+a.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",n+=" } ",d&&(n+=" if ("+y+") { ",b+="}")}}if(typeof P=="object"&&(a.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:a.util.schemaHasRules(P,a.RULES.all))){g.schema=P,g.schemaPath=a.schemaPath+".additionalItems",g.errSchemaPath=a.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+h+".length > "+c.length+") { for (var "+w+" = "+c.length+"; "+w+" < "+h+".length; "+w+"++) { ",g.errorPath=a.util.getPathExpr(a.errorPath,w,a.opts.jsonPointers,!0);var F=h+"["+w+"]";g.dataPathArr[A]=w;var B=a.validate(g);g.baseId=E,a.util.varOccurences(B,C)<2?n+=" "+a.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",d&&(n+=" if (!"+y+") break; "),n+=" } } ",d&&(n+=" if ("+y+") { ",b+="}")}}else if(a.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:a.util.schemaHasRules(c,a.RULES.all)){g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" for (var "+w+" = 0; "+w+" < "+h+".length; "+w+"++) { ",g.errorPath=a.util.getPathExpr(a.errorPath,w,a.opts.jsonPointers,!0);var F=h+"["+w+"]";g.dataPathArr[A]=w;var B=a.validate(g);g.baseId=E,a.util.varOccurences(B,C)<2?n+=" "+a.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",d&&(n+=" if (!"+y+") break; "),n+=" }"}return d&&(n+=" "+b+" if ("+f+" == errors) {"),n}}),cv=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,E,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c;var g=i=="maximum",b=g?"exclusiveMaximum":"exclusiveMinimum",y=a.schema[b],w=a.opts.$data&&y&&y.$data,A=g?"<":">",C=g?">":"<",E=void 0;if(!(v||typeof c=="number"||c===void 0))throw new Error(i+" must be number");if(!(w||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(b+" must be number or boolean");if(w){var P=a.util.getData(y.$data,p,a.dataPathArr),j="exclusive"+o,N="exclType"+o,L="exclIsNumber"+o,O="op"+o,k="' + "+O+" + '";n+=" var schemaExcl"+o+" = "+P+"; ",P="schemaExcl"+o,n+=" var "+j+"; var "+N+" = typeof "+P+"; if ("+N+" != 'boolean' && "+N+" != 'undefined' && "+N+" != 'number') { ";var E=b,T=T||[];T.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(E||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: '"+b+" should be boolean' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var $=n;n=T.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+N+" == 'number' ? ( ("+j+" = "+f+" === undefined || "+P+" "+A+"= "+f+") ? "+h+" "+C+"= "+P+" : "+h+" "+C+" "+f+" ) : ( ("+j+" = "+P+" === true) ? "+h+" "+C+"= "+f+" : "+h+" "+C+" "+f+" ) || "+h+" !== "+h+") { var op"+o+" = "+j+" ? '"+A+"' : '"+A+"='; ",c===void 0&&(E=b,u=a.errSchemaPath+"/"+b,f=P,v=w)}else{var L=typeof y=="number",k=A;if(L&&v){var O="'"+k+"'";n+=" if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" ( "+f+" === undefined || "+y+" "+A+"= "+f+" ? "+h+" "+C+"= "+y+" : "+h+" "+C+" "+f+" ) || "+h+" !== "+h+") { "}else{L&&c===void 0?(j=!0,E=b,u=a.errSchemaPath+"/"+b,f=y,C+="="):(L&&(f=Math[g?"min":"max"](y,c)),y===(L?f:!0)?(j=!0,E=b,u=a.errSchemaPath+"/"+b,C+="="):(j=!1,k+="="));var O="'"+k+"'";n+=" if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+h+" "+C+" "+f+" || "+h+" !== "+h+") { "}}E=E||i;var T=T||[];T.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(E||"_limit")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { comparison: "+O+", limit: "+f+", exclusive: "+j+" } ",a.opts.messages!==!1&&(n+=" , message: 'should be "+k+" ",v?n+="' + "+f:n+=""+f+"'"),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var $=n;return n=T.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n}}),pv=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,b,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c,!(v||typeof c=="number"))throw new Error(i+" must be number");var g=i=="maxItems"?">":"<";n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+h+".length "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { limit: "+f+" } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT have ",i=="maxItems"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" items' "),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),lv=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,b,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c,!(v||typeof c=="number"))throw new Error(i+" must be number");var g=i=="maxLength"?">":"<";n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),a.opts.unicode===!1?n+=" "+h+".length ":n+=" ucs2length("+h+") ",n+=" "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { limit: "+f+" } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT be ",i=="maxLength"?n+="longer":n+="shorter",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" characters' "),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),uv=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,b,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c,!(v||typeof c=="number"))throw new Error(i+" must be number");var g=i=="maxProperties"?">":"<";n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" Object.keys("+h+").length "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { limit: "+f+" } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT have ",i=="maxProperties"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" properties' "),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),d8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c,!(v||typeof c=="number"))throw new Error(i+" must be number");n+="var division"+o+";if (",v&&(n+=" "+f+" !== undefined && ( typeof "+f+" != 'number' || "),n+=" (division"+o+" = "+h+" / "+f+", ",a.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+a.opts.multipleOfPrecision+" ":n+=" division"+o+" !== parseInt(division"+o+") ",n+=" ) ",v&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { multipleOf: "+f+" } ",a.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",v?n+="' + "+f:n+=""+f+"'"),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),f8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="errs__"+o,f=a.util.copy(a);f.level++;var g="valid"+f.level;if(a.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:a.util.schemaHasRules(c,a.RULES.all)){f.schema=c,f.schemaPath=l,f.errSchemaPath=u,n+=" var "+v+" = errors; ";var b=a.compositeRule;a.compositeRule=f.compositeRule=!0,f.createErrors=!1;var y;f.opts.allErrors&&(y=f.opts.allErrors,f.opts.allErrors=!1),n+=" "+a.validate(f)+" ",f.createErrors=!0,y&&(f.opts.allErrors=y),a.compositeRule=f.compositeRule=b,n+=" if ("+g+") { ";var w=w||[];w.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var A=n;n=w.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",a.opts.allErrors&&(n+=" } ")}else n+=" var err = ",a.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(n+=" if (false) { ");return n}}),m8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a),b="";g.level++;var y="valid"+g.level,w=g.baseId,A="prevValid"+o,C="passingSchemas"+o;n+="var "+f+" = errors , "+A+" = false , "+v+" = false , "+C+" = null; ";var E=a.compositeRule;a.compositeRule=g.compositeRule=!0;var P=c;if(P)for(var j,N=-1,L=P.length-1;N0||j===!1:a.util.schemaHasRules(j,a.RULES.all))?(g.schema=j,g.schemaPath=l+"["+N+"]",g.errSchemaPath=u+"/"+N,n+=" "+a.validate(g)+" ",g.baseId=w):n+=" var "+y+" = true; ",N&&(n+=" if ("+y+" && "+A+") { "+v+" = false; "+C+" = ["+C+", "+N+"]; } else { ",b+="}"),n+=" if ("+y+") { "+v+" = "+A+" = true; "+C+" = "+N+"; }";return a.compositeRule=g.compositeRule=E,n+=""+b+"if (!"+v+") { var err = ",a.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { passingSchemas: "+C+" } ",a.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!a.compositeRule&&d&&(a.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; }",a.opts.allErrors&&(n+=" } "),n}}),h8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c;var g=v?"(new RegExp("+f+"))":a.usePattern(c);n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" !"+g+".test("+h+") ) { ";var b=b||[];b.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { pattern: ",v?n+=""+f:n+=""+a.util.toQuotedString(c),n+=" } ",a.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,v?n+="' + "+f+" + '":n+=""+a.util.escapeQuotes(c),n+=`"' `),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+a.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=b.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),v8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="errs__"+o,f=a.util.copy(a),g="";f.level++;var b="valid"+f.level,y="key"+o,w="idx"+o,A=f.dataLevel=a.dataLevel+1,C="data"+A,E="dataProperties"+o,P=Object.keys(c||{}).filter(Y),j=a.schema.patternProperties||{},N=Object.keys(j).filter(Y),L=a.schema.additionalProperties,O=P.length||N.length,k=L===!1,T=typeof L=="object"&&Object.keys(L).length,$=a.opts.removeAdditional,F=k||T||$,B=a.opts.ownProperties,V=a.baseId,J=a.schema.required;if(J&&!(a.opts.$data&&J.$data)&&J.length8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var ee=P;if(ee)for(var se,We=-1,Qe=ee.length-1;We0||Le===!1:a.util.schemaHasRules(Le,a.RULES.all)){var Ye=a.util.getProperty(se),me=h+Ye,Ie=Ce&&Le.default!==void 0;f.schema=Le,f.schemaPath=l+Ye,f.errSchemaPath=u+"/"+a.util.escapeFragment(se),f.errorPath=a.util.getPath(a.errorPath,se,a.opts.jsonPointers),f.dataPathArr[A]=a.util.toQuotedString(se);var ne=a.validate(f);if(f.baseId=V,a.util.varOccurences(ne,C)<2){ne=a.util.varReplace(ne,C,me);var Ve=me}else{var Ve=C;n+=" var "+C+" = "+me+"; "}if(Ie)n+=" "+ne+" ";else{if(K&&K[se]){n+=" if ( "+Ve+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(se)+"') "),n+=") { "+b+" = false; ";var M=a.errorPath,oe=u,va=a.util.escapeQuotes(se);a.opts._errorDataPathProperty&&(a.errorPath=a.util.getPath(M,se,a.opts.jsonPointers)),u=a.errSchemaPath+"/required";var z=z||[];z.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { missingProperty: '"+va+"' } ",a.opts.messages!==!1&&(n+=" , message: '",a.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+va+"\\'",n+="' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var H=n;n=z.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+H+"]); ":n+=" validate.errors = ["+H+"]; return false; ":n+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=oe,a.errorPath=M,n+=" } else { "}else d?(n+=" if ( "+Ve+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(se)+"') "),n+=") { "+b+" = true; } else { "):(n+=" if ("+Ve+" !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(se)+"') "),n+=" ) { ");n+=" "+ne+" } "}}d&&(n+=" if ("+b+") { ",g+="}")}}if(N.length){var la=N;if(la)for(var Re,Fn=-1,ds=la.length-1;Fn0||Le===!1:a.util.schemaHasRules(Le,a.RULES.all)){f.schema=Le,f.schemaPath=a.schemaPath+".patternProperties"+a.util.getProperty(Re),f.errSchemaPath=a.errSchemaPath+"/patternProperties/"+a.util.escapeFragment(Re),B?n+=" "+E+" = "+E+" || Object.keys("+h+"); for (var "+w+"=0; "+w+"<"+E+".length; "+w+"++) { var "+y+" = "+E+"["+w+"]; ":n+=" for (var "+y+" in "+h+") { ",n+=" if ("+a.usePattern(Re)+".test("+y+")) { ",f.errorPath=a.util.getPathExpr(a.errorPath,y,a.opts.jsonPointers);var me=h+"["+y+"]";f.dataPathArr[A]=y;var ne=a.validate(f);f.baseId=V,a.util.varOccurences(ne,C)<2?n+=" "+a.util.varReplace(ne,C,me)+" ":n+=" var "+C+" = "+me+"; "+ne+" ",d&&(n+=" if (!"+b+") break; "),n+=" } ",d&&(n+=" else "+b+" = true; "),n+=" } ",d&&(n+=" if ("+b+") { ",g+="}")}}}return d&&(n+=" "+g+" if ("+v+" == errors) {"),n}}),g8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="errs__"+o,f=a.util.copy(a),g="";f.level++;var b="valid"+f.level;if(n+="var "+v+" = errors;",a.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:a.util.schemaHasRules(c,a.RULES.all)){f.schema=c,f.schemaPath=l,f.errSchemaPath=u;var y="key"+o,w="idx"+o,A="i"+o,C="' + "+y+" + '",E=f.dataLevel=a.dataLevel+1,P="data"+E,j="dataProperties"+o,N=a.opts.ownProperties,L=a.baseId;N&&(n+=" var "+j+" = undefined; "),N?n+=" "+j+" = "+j+" || Object.keys("+h+"); for (var "+w+"=0; "+w+"<"+j+".length; "+w+"++) { var "+y+" = "+j+"["+w+"]; ":n+=" for (var "+y+" in "+h+") { ",n+=" var startErrs"+o+" = errors; ";var O=y,k=a.compositeRule;a.compositeRule=f.compositeRule=!0;var T=a.validate(f);f.baseId=L,a.util.varOccurences(T,P)<2?n+=" "+a.util.varReplace(T,P,O)+" ":n+=" var "+P+" = "+O+"; "+T+" ",a.compositeRule=f.compositeRule=k,n+=" if (!"+b+") { for (var "+A+"=startErrs"+o+"; "+A+"{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f=a.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",g="schema"+o):g=c;var b="schema"+o;if(!f)if(c.length0||P===!1:a.util.schemaHasRules(P,a.RULES.all))||(y[y.length]=A)}}else var y=c;if(f||y.length){var j=a.errorPath,N=f||y.length>=a.opts.loopRequired,L=a.opts.ownProperties;if(d)if(n+=" var missing"+o+"; ",N){f||(n+=" var "+b+" = validate.schema"+l+"; ");var O="i"+o,k="schema"+o+"["+O+"]",T="' + "+k+" + '";a.opts._errorDataPathProperty&&(a.errorPath=a.util.getPathExpr(j,k,a.opts.jsonPointers)),n+=" var "+v+" = true; ",f&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=" for (var "+O+" = 0; "+O+" < "+b+".length; "+O+"++) { "+v+" = "+h+"["+b+"["+O+"]] !== undefined ",L&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", "+b+"["+O+"]) "),n+="; if (!"+v+") break; } ",f&&(n+=" } "),n+=" if (!"+v+") { ";var $=$||[];$.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { missingProperty: '"+T+"' } ",a.opts.messages!==!1&&(n+=" , message: '",a.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+T+"\\'",n+="' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var F=n;n=$.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+F+"]); ":n+=" validate.errors = ["+F+"]; return false; ":n+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var B=y;if(B)for(var V,O=-1,J=B.length-1;O{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f=a.opts.$data&&c&&c.$data,g;if(f?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",g="schema"+o):g=c,(c||f)&&a.opts.uniqueItems!==!1){f&&(n+=" var "+v+"; if ("+g+" === false || "+g+" === undefined) "+v+" = true; else if (typeof "+g+" != 'boolean') "+v+" = false; else { "),n+=" var i = "+h+".length , "+v+" = true , j; if (i > 1) { ";var b=a.schema.items&&a.schema.items.type,y=Array.isArray(b);if(!b||b=="object"||b=="array"||y&&(b.indexOf("object")>=0||b.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+v+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+h+"[i]; ";var w="checkDataType"+(y?"s":"");n+=" if ("+a.util[w](b,"item",a.opts.strictNumbers,!0)+") continue; ",y&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",f&&(n+=" } "),n+=" if (!"+v+") { ";var A=A||[];A.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { i: i, j: j } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),a.opts.verbose&&(n+=" , schema: ",f?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var C=n;n=A.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n}}),b8=ie((t,e)=>{e.exports={$ref:a8(),allOf:t8(),anyOf:r8(),$comment:n8(),const:i8(),contains:s8(),dependencies:o8(),enum:c8(),format:p8(),if:l8(),items:u8(),maximum:cv(),minimum:cv(),maxItems:pv(),minItems:pv(),maxLength:lv(),minLength:lv(),maxProperties:uv(),minProperties:uv(),multipleOf:d8(),not:f8(),oneOf:m8(),pattern:h8(),properties:v8(),propertyNames:g8(),required:x8(),uniqueItems:y8(),validate:Sv()}}),w8=ie((t,e)=>{var r=b8(),a=Fr().toHash;e.exports=function(){var s=[{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"]}],n=["type","$comment"],o=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],p=["number","integer","string","array","object","boolean","null"];return s.all=a(n),s.types=a(p),s.forEach(function(c){c.rules=c.rules.map(function(l){var u;if(typeof l=="object"){var d=Object.keys(l)[0];u=l[d],l=d,u.forEach(function(v){n.push(v),s.all[v]=!0})}n.push(l);var h=s.all[l]={keyword:l,code:r[l],implements:u};return h}),s.all.$comment={keyword:"$comment",code:r.$comment},c.type&&(s.types[c.type]=c)}),s.keywords=a(n.concat(o)),s.custom={},s}}),_8=ie((t,e)=>{var r=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];e.exports=function(a,i){for(var s=0;s{var r=jc().MissingRef;e.exports=a;function a(i,s,n){var o=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof s=="function"&&(n=s,s=void 0);var p=c(i).then(function(){var u=o._addSchema(i,void 0,s);return u.validate||l(u)});return n&&p.then(function(u){n(null,u)},n),p;function c(u){var d=u.$schema;return d&&!o.getSchema(d)?a.call(o,{$ref:d},!0):Promise.resolve()}function l(u){try{return o._compile(u)}catch(h){if(h instanceof r)return d(h);throw h}function d(h){var v=h.missingSchema;if(b(v))throw new Error("Schema "+v+" is loaded but "+h.missingRef+" cannot be resolved");var f=o._loadingSchemas[v];return f||(f=o._loadingSchemas[v]=o._opts.loadSchema(v),f.then(g,g)),f.then(function(y){if(!b(v))return c(y).then(function(){b(v)||o.addSchema(y,v,void 0,s)})}).then(function(){return l(u)});function g(){delete o._loadingSchemas[v]}function b(y){return o._refs[y]||o._schemas[y]}}}}}),S8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h,v="data"+(p||""),f="valid"+o,g="errs__"+o,b=a.opts.$data&&c&&c.$data,y;b?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",y="schema"+o):y=c;var w=this,A="definition"+o,C=w.definition,E="",P,j,N,L,O;if(b&&C.$data){O="keywordValidate"+o;var k=C.validateSchema;n+=" var "+A+" = RULES.custom['"+i+"'].definition; var "+O+" = "+A+".validate;"}else{if(L=a.useCustomRule(w,c,a.schema,a),!L)return;y="validate.schema"+l,O=L.code,P=C.compile,j=C.inline,N=C.macro}var T=O+".errors",$="i"+o,F="ruleErr"+o,B=C.async;if(B&&!a.async)throw new Error("async keyword in sync schema");if(j||N||(n+=""+T+" = null;"),n+="var "+g+" = errors;var "+f+";",b&&C.$data&&(E+="}",n+=" if ("+y+" === undefined) { "+f+" = true; } else { ",k&&(E+="}",n+=" "+f+" = "+A+".validateSchema("+y+"); if ("+f+") { ")),j)C.statements?n+=" "+L.validate+" ":n+=" "+f+" = "+L.validate+"; ";else if(N){var V=a.util.copy(a),E="";V.level++;var J="valid"+V.level;V.schema=L.validate,V.schemaPath="";var K=a.compositeRule;a.compositeRule=V.compositeRule=!0;var Y=a.validate(V).replace(/validate\.schema/g,O);a.compositeRule=V.compositeRule=K,n+=" "+Y}else{var ee=ee||[];ee.push(n),n="",n+=" "+O+".call( ",a.opts.passContext?n+="this":n+="self",P||C.schema===!1?n+=" , "+v+" ":n+=" , "+y+" , "+v+" , validate.schema"+a.schemaPath+" ",n+=" , (dataPath || '')",a.errorPath!='""'&&(n+=" + "+a.errorPath);var se=p?"data"+(p-1||""):"parentData",We=p?a.dataPathArr[p]:"parentDataProperty";n+=" , "+se+" , "+We+" , rootData ) ";var Qe=n;n=ee.pop(),C.errors===!1?(n+=" "+f+" = ",B&&(n+="await "),n+=""+Qe+"; "):B?(T="customErrors"+o,n+=" var "+T+" = null; try { "+f+" = await "+Qe+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+T+" = e.errors; else throw e; } "):n+=" "+T+" = null; "+f+" = "+Qe+"; "}if(C.modifying&&(n+=" if ("+se+") "+v+" = "+se+"["+We+"];"),n+=""+E,C.valid)d&&(n+=" if (true) { ");else{n+=" if ( ",C.valid===void 0?(n+=" !",N?n+=""+J:n+=""+f):n+=" "+!C.valid+" ",n+=") { ",h=w.keyword;var ee=ee||[];ee.push(n),n="";var ee=ee||[];ee.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { keyword: '"+w.keyword+"' } ",a.opts.messages!==!1&&(n+=` , message: 'should pass "`+w.keyword+`" keyword validation' `),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+v+" "),n+=" } "):n+=" {} ";var Xe=n;n=ee.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+Xe+"]); ":n+=" validate.errors = ["+Xe+"]; return false; ":n+=" var err = "+Xe+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Re=n;n=ee.pop(),j?C.errors?C.errors!="full"&&(n+=" for (var "+$+"="+g+"; "+$+"{e.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}}),k8=ie((t,e)=>{var r=kv();e.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:r.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:r.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"}]}}}}),P8=ie((t,e)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,a=S8(),i=k8();e.exports={add:s,get:n,remove:o,validate:p};function s(c,l){var u=this.RULES;if(u.keywords[c])throw new Error("Keyword "+c+" is already defined");if(!r.test(c))throw new Error("Keyword "+c+" is not a valid identifier");if(l){this.validateKeyword(l,!0);var d=l.type;if(Array.isArray(d))for(var h=0;h{e.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}}),R8=ie((t,e)=>{var r=J4(),a=Ic(),i=Y4(),s=_v(),n=Ev(),o=e8(),p=w8(),c=_8(),l=Fr();e.exports=g,g.prototype.validate=b,g.prototype.compile=y,g.prototype.addSchema=w,g.prototype.addMetaSchema=A,g.prototype.validateSchema=C,g.prototype.getSchema=P,g.prototype.removeSchema=L,g.prototype.addFormat=K,g.prototype.errorsText=J,g.prototype._addSchema=k,g.prototype._compile=T,g.prototype.compileAsync=E8();var u=P8();g.prototype.addKeyword=u.add,g.prototype.getKeyword=u.get,g.prototype.removeKeyword=u.remove,g.prototype.validateKeyword=u.validate;var d=jc();g.ValidationError=d.Validation,g.MissingRefError=d.MissingRef,g.$dataMetaSchema=c;var h="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],f=["/properties"];function g(R){if(!(this instanceof g))return new g(R);R=this._opts=l.copy(R)||{},Re(this),this._schemas={},this._refs={},this._fragments={},this._formats=o(R.format),this._cache=R.cache||new i,this._loadingSchemas={},this._compilations=[],this.RULES=p(),this._getId=$(R),R.loopRequired=R.loopRequired||1/0,R.errorDataPath=="property"&&(R._errorDataPathProperty=!0),R.serialize===void 0&&(R.serialize=n),this._metaOpts=Xe(this),R.formats&&se(this),R.keywords&&We(this),Y(this),typeof R.meta=="object"&&this.addMetaSchema(R.meta),R.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),ee(this)}function b(R,M){var X;if(typeof R=="string"){if(X=this.getSchema(R),!X)throw new Error('no schema with key or ref "'+R+'"')}else{var oe=this._addSchema(R);X=oe.validate||this._compile(oe)}var z=X(M);return X.$async!==!0&&(this.errors=X.errors),z}function y(R,M){var X=this._addSchema(R,void 0,M);return X.validate||this._compile(X)}function w(R,M,X,oe){if(Array.isArray(R)){for(var z=0;z0&&O.push("--allowedTools",C.join(",")),E.length>0&&O.push("--disallowedTools",E.join(",")),P&&Object.keys(P).length>0&&O.push("--mcp-config",JSON.stringify({mcpServers:P})),r&&Object.keys(r).length>0&&O.push("--agents",JSON.stringify(r)),A&&O.push("--setting-sources",A.join(",")),j&&O.push("--strict-mcp-config"),g&&O.push("--permission-mode",g),f){if(v&&f===v)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");O.push("--fallback-model",f)}L&&O.push("--include-partial-messages");for(let J of e)O.push("--add-dir",J);this.options.forkSession&&O.push("--fork-session"),this.options.resumeSessionAt&&O.push("--resume-session-at",this.options.resumeSessionAt);for(let[J,K]of Object.entries(n))K===null?O.push(`--${J}`):O.push(`--${J}`,K);if(p.CLAUDE_CODE_ENTRYPOINT||(p.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),!et().existsSync(o)){let J=dv(o)?`Claude Code native binary not found at ${o}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${o}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(J)}let T=dv(o),$=T?o:i,F=T?[...s,...O]:[...s,o,...O];this.logForDebugging(T?`Spawning Claude Code native binary: ${$} ${F.join(" ")}`:`Spawning Claude Code process: ${$} ${F.join(" ")}`);let B=p.DEBUG||c?"pipe":"ignore";this.child=(0,Ov.spawn)($,F,{cwd:a,stdio:["pipe","pipe",B],signal:this.abortController.signal,env:p}),this.childStdin=this.child.stdin,this.childStdout=this.child.stdout,(p.DEBUG||c)&&this.child.stderr.on("data",J=>{this.logForDebugging(J.toString())});let V=()=>{this.child&&!this.child.killed&&this.child.kill("SIGTERM")};this.processExitHandler=V,this.abortHandler=V,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.child.on("error",J=>{this.ready=!1,this.abortController.signal.aborted?this.exitError=new jt("Claude Code process aborted by user"):(this.exitError=new Error(`Failed to spawn Claude Code process: ${J.message}`),this.logForDebugging(this.exitError.message))}),this.child.on("close",(J,K)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new jt("Claude Code process aborted by user");else{let Y=this.getProcessExitError(J,K);Y&&(this.exitError=Y,this.logForDebugging(Y.message))}}),this.ready=!0}catch(e){throw this.ready=!1,e}}getProcessExitError(e,r){if(e!==0&&e!==null)return new Error(`Claude Code process exited with code ${e}`);if(r)return new Error(`Claude Code process terminated by signal ${r}`)}logForDebugging(e){process.env.DEBUG&&process.stderr.write(`${e} +`}function q4(){return function(){this.error(404)}}function $4(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=hc.original(this.req);r.path=null,r.pathname=D4(r.pathname+"/");var a=O4(I4.format(r)),i=N4("Redirecting","Redirecting to "+C4(a));e.statusCode=301,e.setHeader("Content-Type","text/html; charset=UTF-8"),e.setHeader("Content-Length",Buffer.byteLength(i)),e.setHeader("Content-Security-Policy","default-src 'none'"),e.setHeader("X-Content-Type-Options","nosniff"),e.setHeader("Location",a),e.end(i)}}});var iv=I((oa,nv)=>{"use strict";var Wi=Pf(),L4=require("events").EventEmitter,ev=Rf(),av=ch(),F4=Mo(),M4=Uo(),tv=Dh(),rv=Qh();oa=nv.exports=z4;function z4(){var t=function(e,r,a){t.handle(e,r,a)};return ev(t,L4.prototype,!1),ev(t,av,!1),t.request=Object.create(tv,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.response=Object.create(rv,{app:{configurable:!0,enumerable:!0,writable:!0,value:t}}),t.init(),t}oa.application=av;oa.request=tv;oa.response=rv;oa.Route=F4;oa.Router=M4;oa.json=Wi.json;oa.query=Bo();oa.raw=Wi.raw;oa.static=Yh();oa.text=Wi.text;oa.urlencoded=Wi.urlencoded;var U4=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];U4.forEach(function(t){Object.defineProperty(oa,t,{get:function(){throw new Error("Most middleware (like "+t+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var ov=I((N6,sv)=>{"use strict";sv.exports=iv()});var e9={};Hg(e9,{WorkerService:()=>us});module.exports=Vg(e9);var Vc=vs(ov(),1);var bc=require("path"),Pv=require("url"),Tv=require("events"),Ov=require("child_process"),Cv=require("readline"),re=vs(require("fs"),1),Av=require("fs/promises"),$v=require("path"),Lv=require("os"),Dt=require("path"),Sc=require("process"),Fv=require("crypto"),W2={},B4=Object.create,H4=Object.getPrototypeOf,yc=Object.defineProperty,V4=Object.getOwnPropertyNames,Z4=Object.prototype.hasOwnProperty,G4=(t,e,r)=>{r=t!=null?B4(H4(t)):{};let a=e||!t||!t.__esModule?yc(r,"default",{value:t,enumerable:!0}):r;for(let i of V4(t))Z4.call(a,i)||yc(a,i,{get:()=>t[i],enumerable:!0});return a},ie=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),W4=(t,e)=>{for(var r in e)yc(t,r,{get:e[r],enumerable:!0,configurable:!0,set:a=>e[r]=()=>a})},X4=ie((t,e)=>{(function(r,a){typeof t=="object"&&typeof e<"u"?a(t):typeof define=="function"&&define.amd?define(["exports"],a):a(r.URI=r.URI||{})})(t,function(r){function a(){for(var _=arguments.length,x=Array(_),S=0;S<_;S++)x[S]=arguments[S];if(x.length>1){x[0]=x[0].slice(0,-1);for(var D=x.length-1,q=1;q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=f-g,k=Math.floor,T=String.fromCharCode;function $(_){throw new RangeError(L[_])}function F(_,x){for(var S=[],D=_.length;D--;)S[D]=x(_[D]);return S}function B(_,x){var S=_.split("@"),D="";S.length>1&&(D=S[0]+"@",_=S[1]),_=_.replace(N,".");var q=_.split("."),G=F(q,x).join(".");return D+G}function V(_){for(var x=[],S=0,D=_.length;S=55296&&q<=56319&&S>1,x+=k(x/S);x>O*b>>1;q+=f)x=k(x/O);return k(q+(O+1)*x/(x+y))},se=function(x){var S=[],D=x.length,q=0,G=C,ue=A,ge=x.lastIndexOf(E);ge<0&&(ge=0);for(var we=0;we=128&&$("not-basic"),S.push(x.charCodeAt(we));for(var ze=ge>0?ge+1:0;ze=D&&$("invalid-input");var je=K(x.charCodeAt(ze++));(je>=f||je>k((v-q)/Ne))&&$("overflow"),q+=je*Ne;var ye=Ue<=ue?g:Ue>=ue+b?b:Ue-ue;if(jek(v/qe)&&$("overflow"),Ne*=qe}var Se=S.length+1;ue=ee(q-he,Se,he==0),k(q/Se)>v-G&&$("overflow"),G+=k(q/Se),q%=Se,S.splice(q++,0,G)}return String.fromCodePoint.apply(String,S)},We=function(x){var S=[];x=V(x);var D=x.length,q=C,G=0,ue=A,ge=!0,we=!1,ze=void 0;try{for(var he=x[Symbol.iterator](),Ne;!(ge=(Ne=he.next()).done);ge=!0){var Ue=Ne.value;Ue<128&&S.push(T(Ue))}}catch(gt){we=!0,ze=gt}finally{try{!ge&&he.return&&he.return()}finally{if(we)throw ze}}var je=S.length,ye=je;for(je&&S.push(E);ye=q&&dak((v-G)/xa)&&$("overflow"),G+=(qe-q)*xa,q=qe;var Da=!0,vt=!1,Za=void 0;try{for(var Vr=x[Symbol.iterator](),Mn;!(Da=(Mn=Vr.next()).done);Da=!0){var zn=Mn.value;if(znv&&$("overflow"),zn==q){for(var Jt=G,Yt=f;;Yt+=f){var Ga=Yt<=ue?g:Yt>=ue+b?b:Yt-ue;if(Jt>6|192).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase():S="%"+(x>>12|224).toString(16).toUpperCase()+"%"+(x>>6&63|128).toString(16).toUpperCase()+"%"+(x&63|128).toString(16).toUpperCase(),S}function M(_){for(var x="",S=0,D=_.length;S=194&&q<224){if(D-S>=6){var G=parseInt(_.substr(S+4,2),16);x+=String.fromCharCode((q&31)<<6|G&63)}else x+=_.substr(S,6);S+=6}else if(q>=224){if(D-S>=9){var ue=parseInt(_.substr(S+4,2),16),ge=parseInt(_.substr(S+7,2),16);x+=String.fromCharCode((q&15)<<12|(ue&63)<<6|ge&63)}else x+=_.substr(S,9);S+=9}else x+=_.substr(S,3),S+=3}return x}function X(_,x){function S(D){var q=M(D);return q.match(x.UNRESERVED)?q:D}return _.scheme&&(_.scheme=String(_.scheme).replace(x.PCT_ENCODED,S).toLowerCase().replace(x.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(x.PCT_ENCODED,S).replace(x.NOT_USERINFO,R).replace(x.PCT_ENCODED,n)),_.host!==void 0&&(_.host=String(_.host).replace(x.PCT_ENCODED,S).toLowerCase().replace(x.NOT_HOST,R).replace(x.PCT_ENCODED,n)),_.path!==void 0&&(_.path=String(_.path).replace(x.PCT_ENCODED,S).replace(_.scheme?x.NOT_PATH:x.NOT_PATH_NOSCHEME,R).replace(x.PCT_ENCODED,n)),_.query!==void 0&&(_.query=String(_.query).replace(x.PCT_ENCODED,S).replace(x.NOT_QUERY,R).replace(x.PCT_ENCODED,n)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(x.PCT_ENCODED,S).replace(x.NOT_FRAGMENT,R).replace(x.PCT_ENCODED,n)),_}function ce(_){return _.replace(/^0*(.*)/,"$1")||"0"}function z(_,x){var S=_.match(x.IPV4ADDRESS)||[],D=d(S,2),q=D[1];return q?q.split(".").map(ce).join("."):_}function H(_,x){var S=_.match(x.IPV6ADDRESS)||[],D=d(S,3),q=D[1],G=D[2];if(q){for(var ue=q.toLowerCase().split("::").reverse(),ge=d(ue,2),we=ge[0],ze=ge[1],he=ze?ze.split(":").map(ce):[],Ne=we.split(":").map(ce),Ue=x.IPV4ADDRESS.test(Ne[Ne.length-1]),je=Ue?7:8,ye=Ne.length-je,qe=Array(je),Se=0;Se1){var Pe=qe.slice(0,ua.index),da=qe.slice(ua.index+ua.length);ga=Pe.join(":")+"::"+da.join(":")}else ga=qe.join(":");return G&&(ga+="%"+G),ga}else return _}var de=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,me="".match(/(){0}/)[1]===void 0;function ne(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S={},D=x.iri!==!1?u:l;x.reference==="suffix"&&(_=(x.scheme?x.scheme+":":"")+"//"+_);var q=_.match(de);if(q){me?(S.scheme=q[1],S.userinfo=q[3],S.host=q[4],S.port=parseInt(q[5],10),S.path=q[6]||"",S.query=q[7],S.fragment=q[8],isNaN(S.port)&&(S.port=q[5])):(S.scheme=q[1]||void 0,S.userinfo=_.indexOf("@")!==-1?q[3]:void 0,S.host=_.indexOf("//")!==-1?q[4]:void 0,S.port=parseInt(q[5],10),S.path=q[6]||"",S.query=_.indexOf("?")!==-1?q[7]:void 0,S.fragment=_.indexOf("#")!==-1?q[8]:void 0,isNaN(S.port)&&(S.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?q[4]:void 0)),S.host&&(S.host=H(z(S.host,D),D)),S.scheme===void 0&&S.userinfo===void 0&&S.host===void 0&&S.port===void 0&&!S.path&&S.query===void 0?S.reference="same-document":S.scheme===void 0?S.reference="relative":S.fragment===void 0?S.reference="absolute":S.reference="uri",x.reference&&x.reference!=="suffix"&&x.reference!==S.reference&&(S.error=S.error||"URI is not a "+x.reference+" reference.");var G=De[(x.scheme||S.scheme||"").toLowerCase()];if(!x.unicodeSupport&&(!G||!G.unicodeSupport)){if(S.host&&(x.domainHost||G&&G.domainHost))try{S.host=Re.toASCII(S.host.replace(D.PCT_ENCODED,M).toLowerCase())}catch(ue){S.error=S.error||"Host's domain name can not be converted to ASCII via punycode: "+ue}X(S,l)}else X(S,D);G&&G.parse&&G.parse(S,x)}else S.error=S.error||"URI can not be parsed.";return S}function Ce(_,x){var S=x.iri!==!1?u:l,D=[];return _.userinfo!==void 0&&(D.push(_.userinfo),D.push("@")),_.host!==void 0&&D.push(H(z(String(_.host),S),S).replace(S.IPV6ADDRESS,function(q,G,ue){return"["+G+(ue?"%25"+ue:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(D.push(":"),D.push(String(_.port))),D.length?D.join(""):void 0}var Ae=/^\.\.?\//,xe=/^\/\.(\/|$)/,Ke=/^\/\.\.(\/|$)/,Le=/^\/?(?:.|\n)*?(?=\/|$)/;function Ye(_){for(var x=[];_.length;)if(_.match(Ae))_=_.replace(Ae,"");else if(_.match(xe))_=_.replace(xe,"/");else if(_.match(Ke))_=_.replace(Ke,"/"),x.pop();else if(_==="."||_==="..")_="";else{var S=_.match(Le);if(S){var D=S[0];_=_.slice(D.length),x.push(D)}else throw new Error("Unexpected dot segment condition")}return x.join("")}function Ie(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=x.iri?u:l,D=[],q=De[(x.scheme||_.scheme||"").toLowerCase()];if(q&&q.serialize&&q.serialize(_,x),_.host&&!S.IPV6ADDRESS.test(_.host)){if(x.domainHost||q&&q.domainHost)try{_.host=x.iri?Re.toUnicode(_.host):Re.toASCII(_.host.replace(S.PCT_ENCODED,M).toLowerCase())}catch(ge){_.error=_.error||"Host's domain name can not be converted to "+(x.iri?"Unicode":"ASCII")+" via punycode: "+ge}}X(_,S),x.reference!=="suffix"&&_.scheme&&(D.push(_.scheme),D.push(":"));var G=Ce(_,x);if(G!==void 0&&(x.reference!=="suffix"&&D.push("//"),D.push(G),_.path&&_.path.charAt(0)!=="/"&&D.push("/")),_.path!==void 0){var ue=_.path;!x.absolutePath&&(!q||!q.absolutePath)&&(ue=Ye(ue)),G===void 0&&(ue=ue.replace(/^\/\//,"/%2F")),D.push(ue)}return _.query!==void 0&&(D.push("?"),D.push(_.query)),_.fragment!==void 0&&(D.push("#"),D.push(_.fragment)),D.join("")}function Ve(_,x){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=arguments[3],q={};return D||(_=ne(Ie(_,S),S),x=ne(Ie(x,S),S)),S=S||{},!S.tolerant&&x.scheme?(q.scheme=x.scheme,q.userinfo=x.userinfo,q.host=x.host,q.port=x.port,q.path=Ye(x.path||""),q.query=x.query):(x.userinfo!==void 0||x.host!==void 0||x.port!==void 0?(q.userinfo=x.userinfo,q.host=x.host,q.port=x.port,q.path=Ye(x.path||""),q.query=x.query):(x.path?(x.path.charAt(0)==="/"?q.path=Ye(x.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?q.path="/"+x.path:_.path?q.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+x.path:q.path=x.path,q.path=Ye(q.path)),q.query=x.query):(q.path=_.path,x.query!==void 0?q.query=x.query:q.query=_.query),q.userinfo=_.userinfo,q.host=_.host,q.port=_.port),q.scheme=_.scheme),q.fragment=x.fragment,q}function va(_,x,S){var D=p({scheme:"null"},S);return Ie(Ve(ne(_,D),ne(x,D),D,!0),D)}function la(_,x){return typeof _=="string"?_=Ie(ne(_,x),x):s(_)==="object"&&(_=ne(Ie(_,x),x)),_}function Fn(_,x,S){return typeof _=="string"?_=Ie(ne(_,S),S):s(_)==="object"&&(_=Ie(_,S)),typeof x=="string"?x=Ie(ne(x,S),S):s(x)==="object"&&(x=Ie(x,S)),_===x}function ds(_,x){return _&&_.toString().replace(!x||!x.iri?l.ESCAPE:u.ESCAPE,R)}function Ta(_,x){return _&&_.toString().replace(!x||!x.iri?l.PCT_ENCODED:u.PCT_ENCODED,M)}var Br={scheme:"http",domainHost:!0,parse:function(x,S){return x.host||(x.error=x.error||"HTTP URIs must have a host."),x},serialize:function(x,S){var D=String(x.scheme).toLowerCase()==="https";return(x.port===(D?443:80)||x.port==="")&&(x.port=void 0),x.path||(x.path="/"),x}},Zc={scheme:"https",domainHost:Br.domainHost,parse:Br.parse,serialize:Br.serialize};function Gc(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Hr={scheme:"ws",domainHost:!0,parse:function(x,S){var D=x;return D.secure=Gc(D),D.resourceName=(D.path||"/")+(D.query?"?"+D.query:""),D.path=void 0,D.query=void 0,D},serialize:function(x,S){if((x.port===(Gc(x)?443:80)||x.port==="")&&(x.port=void 0),typeof x.secure=="boolean"&&(x.scheme=x.secure?"wss":"ws",x.secure=void 0),x.resourceName){var D=x.resourceName.split("?"),q=d(D,2),G=q[0],ue=q[1];x.path=G&&G!=="/"?G:void 0,x.query=ue,x.resourceName=void 0}return x.fragment=void 0,x}},Wc={scheme:"wss",domainHost:Hr.domainHost,parse:Hr.parse,serialize:Hr.serialize},bg={},wg=!0,Xc="[A-Za-z0-9\\-\\.\\_\\~"+(wg?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ja="[0-9A-Fa-f]",_g=i(i("%[EFef]"+ja+"%"+ja+ja+"%"+ja+ja)+"|"+i("%[89A-Fa-f]"+ja+"%"+ja+ja)+"|"+i("%"+ja+ja)),Eg="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Sg="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",kg=a(Sg,'[\\"\\\\]'),Pg="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Tg=new RegExp(Xc,"g"),Qt=new RegExp(_g,"g"),Rg=new RegExp(a("[^]",Eg,"[\\.]",'[\\"]',kg),"g"),Kc=new RegExp(a("[^]",Xc,Pg),"g"),Og=Kc;function fs(_){var x=M(_);return x.match(Tg)?x:_}var Qc={scheme:"mailto",parse:function(x,S){var D=x,q=D.to=D.path?D.path.split(","):[];if(D.path=void 0,D.query){for(var G=!1,ue={},ge=D.query.split("&"),we=0,ze=ge.length;we{e.exports=function r(a,i){if(a===i)return!0;if(a&&i&&typeof a=="object"&&typeof i=="object"){if(a.constructor!==i.constructor)return!1;var s,n,o;if(Array.isArray(a)){if(s=a.length,s!=i.length)return!1;for(n=s;n--!==0;)if(!r(a[n],i[n]))return!1;return!0}if(a.constructor===RegExp)return a.source===i.source&&a.flags===i.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===i.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===i.toString();if(o=Object.keys(a),s=o.length,s!==Object.keys(i).length)return!1;for(n=s;n--!==0;)if(!Object.prototype.hasOwnProperty.call(i,o[n]))return!1;for(n=s;n--!==0;){var p=o[n];if(!r(a[p],i[p]))return!1}return!0}return a!==a&&i!==i}}),K4=ie((t,e)=>{e.exports=function(a){for(var i=0,s=a.length,n=0,o;n=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:a,checkDataTypes:i,coerceToTypes:n,toHash:o,getProperty:l,escapeQuotes:u,equal:Ac(),ucs2length:K4(),varOccurences:d,varReplace:h,schemaHasRules:v,schemaHasRulesExcept:f,schemaUnknownRules:g,toQuotedString:b,getPathExpr:y,getPath:w,getData:E,unescapeFragment:j,unescapeJsonPointer:O,escapeFragment:N,escapeJsonPointer:L};function r(k,T){T=T||{};for(var $ in k)T[$]=k[$];return T}function a(k,T,$,F){var B=F?" !== ":" === ",V=F?" || ":" && ",J=F?"!":"",K=F?"":"!";switch(k){case"null":return T+B+"null";case"array":return J+"Array.isArray("+T+")";case"object":return"("+J+T+V+"typeof "+T+B+'"object"'+V+K+"Array.isArray("+T+"))";case"integer":return"(typeof "+T+B+'"number"'+V+K+"("+T+" % 1)"+V+T+B+T+($?V+J+"isFinite("+T+")":"")+")";case"number":return"(typeof "+T+B+'"'+k+'"'+($?V+J+"isFinite("+T+")":"")+")";default:return"typeof "+T+B+'"'+k+'"'}}function i(k,T,$){switch(k.length){case 1:return a(k[0],T,$,!0);default:var F="",B=o(k);B.array&&B.object&&(F=B.null?"(":"(!"+T+" || ",F+="typeof "+T+' !== "object")',delete B.null,delete B.array,delete B.object),B.number&&delete B.integer;for(var V in B)F+=(F?" && ":"")+a(V,T,$,!0);return F}}var s=o(["string","number","integer","boolean","null"]);function n(k,T){if(Array.isArray(T)){for(var $=[],F=0;F=T)throw new Error("Cannot access property/index "+F+" levels up, current level is "+T);return $[T-F]}if(F>T)throw new Error("Cannot access data "+F+" levels up, current level is "+T);if(V="data"+(T-F||""),!B)return V}for(var K=V,Y=B.split("/"),ee=0;ee{var r=Fr();e.exports=a;function a(i){r.copy(i,this)}}),Q4=ie((t,e)=>{var r=e.exports=function(s,n,o){typeof n=="function"&&(o=n,n={}),o=n.cb||o;var p=typeof o=="function"?o:o.pre||function(){},c=o.post||function(){};a(n,p,c,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function a(s,n,o,p,c,l,u,d,h,v){if(p&&typeof p=="object"&&!Array.isArray(p)){n(p,c,l,u,d,h,v);for(var f in p){var g=p[f];if(Array.isArray(g)){if(f in r.arrayKeywords)for(var b=0;b{var r=X4(),a=Ac(),i=Fr(),s=_v(),n=Q4();e.exports=o,o.normalizeId=w,o.fullPath=g,o.url=A,o.ids=C,o.inlineRef=h,o.schema=p;function o(E,P,j){var N=this._refs[j];if(typeof N=="string")if(this._refs[N])N=this._refs[N];else return o.call(this,E,P,N);if(N=N||this._schemas[j],N instanceof s)return h(N.schema,this._opts.inlineRefs)?N.schema:N.validate||this._compile(N);var L=p.call(this,P,j),O,k,T;return L&&(O=L.schema,P=L.root,T=L.baseId),O instanceof s?k=O.validate||E.call(this,O.schema,P,void 0,T):O!==void 0&&(k=h(O,this._opts.inlineRefs)?O:E.call(this,O,P,void 0,T)),k}function p(E,P){var j=r.parse(P),N=b(j),L=g(this._getId(E.schema));if(Object.keys(E.schema).length===0||N!==L){var O=w(N),k=this._refs[O];if(typeof k=="string")return c.call(this,E,k,j);if(k instanceof s)k.validate||this._compile(k),E=k;else if(k=this._schemas[O],k instanceof s){if(k.validate||this._compile(k),O==w(P))return{schema:k,root:E,baseId:L};E=k}else return;if(!E.schema)return;L=g(this._getId(E.schema))}return u.call(this,j,L,E.schema,E)}function c(E,P,j){var N=p.call(this,E,P);if(N){var L=N.schema,O=N.baseId;E=N.root;var k=this._getId(L);return k&&(O=A(O,k)),u.call(this,j,O,L,E)}}var l=i.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function u(E,P,j,N){if(E.fragment=E.fragment||"",E.fragment.slice(0,1)=="/"){for(var L=E.fragment.split("/"),O=1;O{var r=Ic();e.exports={Validation:s(a),MissingRef:s(i)};function a(n){this.message="validation failed",this.errors=n,this.ajv=this.validation=!0}i.message=function(n,o){return"can't resolve reference "+o+" from id "+n};function i(n,o,p){this.message=p||i.message(n,o),this.missingRef=r.url(n,o),this.missingSchema=r.normalizeId(r.fullPath(this.missingRef))}function s(n){return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}}),Ev=ie((t,e)=>{e.exports=function(r,a){a||(a={}),typeof a=="function"&&(a={cmp:a});var i=typeof a.cycles=="boolean"?a.cycles:!1,s=a.cmp&&function(o){return function(p){return function(c,l){var u={key:c,value:p[c]},d={key:l,value:p[l]};return o(u,d)}}}(a.cmp),n=[];return function o(p){if(p&&p.toJSON&&typeof p.toJSON=="function"&&(p=p.toJSON()),p!==void 0){if(typeof p=="number")return isFinite(p)?""+p:"null";if(typeof p!="object")return JSON.stringify(p);var c,l;if(Array.isArray(p)){for(l="[",c=0;c{e.exports=function(a,i,s){var n="",o=a.schema.$async===!0,p=a.util.schemaHasRulesExcept(a.schema,a.RULES.all,"$ref"),c=a.self._getId(a.schema);if(a.opts.strictKeywords){var l=a.util.schemaUnknownRules(a.schema,a.RULES.keywords);if(l){var u="unknown keyword: "+l;if(a.opts.strictKeywords==="log")a.logger.warn(u);else throw new Error(u)}}if(a.isTop&&(n+=" var validate = ",o&&(a.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(a.opts.sourceCode||a.opts.processCode)&&(n+=" "+("/*# sourceURL="+c+" */")+" ")),typeof a.schema=="boolean"||!(p||a.schema.$ref)){var i="false schema",d=a.level,h=a.dataLevel,v=a.schema[i],f=a.schemaPath+a.util.getProperty(i),g=a.errSchemaPath+"/"+i,P=!a.opts.allErrors,L,b="data"+(h||""),E="valid"+d;if(a.schema===!1){a.isTop?P=!0:n+=" var "+E+" = false; ";var y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(L||"false schema")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(g)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),a.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+b+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!a.compositeRule&&P?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else a.isTop?o?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+E+" = true; ";return a.isTop&&(n+=" }; return validate; "),n}if(a.isTop){var A=a.isTop,d=a.level=0,h=a.dataLevel=0,b="data";if(a.rootId=a.resolve.fullPath(a.self._getId(a.root.schema)),a.baseId=a.baseId||a.rootId,delete a.isTop,a.dataPathArr=[""],a.schema.default!==void 0&&a.opts.useDefaults&&a.opts.strictDefaults){var C="default is ignored in the schema root";if(a.opts.strictDefaults==="log")a.logger.warn(C);else throw new Error(C)}n+=" var vErrors = null; ",n+=" var errors = 0; ",n+=" if (rootData === undefined) rootData = data; "}else{var{level:d,dataLevel:h}=a,b="data"+(h||"");if(c&&(a.baseId=a.resolve.url(a.baseId,c)),o&&!a.async)throw new Error("async schema in sync schema");n+=" var errs_"+d+" = errors;"}var E="valid"+d,P=!a.opts.allErrors,j="",N="",L,O=a.schema.type,k=Array.isArray(O);if(O&&a.opts.nullable&&a.schema.nullable===!0&&(k?O.indexOf("null")==-1&&(O=O.concat("null")):O!="null"&&(O=[O,"null"],k=!0)),k&&O.length==1&&(O=O[0],k=!1),a.schema.$ref&&p){if(a.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+a.errSchemaPath+'" (see option extendRefs)');a.opts.extendRefs!==!0&&(p=!1,a.logger.warn('$ref: keywords ignored in schema at path "'+a.errSchemaPath+'"'))}if(a.schema.$comment&&a.opts.$comment&&(n+=" "+a.RULES.all.$comment.code(a,"$comment")),O){if(a.opts.coerceTypes)var T=a.util.coerceToTypes(a.opts.coerceTypes,O);var $=a.RULES.types[O];if(T||k||$===!0||$&&!Le($)){var f=a.schemaPath+".type",g=a.errSchemaPath+"/type",f=a.schemaPath+".type",g=a.errSchemaPath+"/type",F=k?"checkDataTypes":"checkDataType";if(n+=" if ("+a.util[F](O,b,a.opts.strictNumbers,!0)+") { ",T){var B="dataType"+d,V="coerced"+d;n+=" var "+B+" = typeof "+b+"; var "+V+" = undefined; ",a.opts.coerceTypes=="array"&&(n+=" if ("+B+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+B+" = typeof "+b+"; if ("+a.util.checkDataType(a.schema.type,b,a.opts.strictNumbers)+") "+V+" = "+b+"; } "),n+=" if ("+V+" !== undefined) ; ";var J=T;if(J)for(var K,Y=-1,ee=J.length-1;Y{var r=Ic(),a=Fr(),i=jc(),s=Ev(),n=Sv(),o=a.ucs2length,p=Ac(),c=i.Validation;e.exports=l;function l(w,A,C,E){var P=this,j=this._opts,N=[void 0],L={},O=[],k={},T=[],$={},F=[];A=A||{schema:w,refVal:N,refs:L};var B=u.call(this,w,A,E),V=this._compilations[B.index];if(B.compiling)return V.callValidate=se;var J=this._formats,K=this.RULES;try{var Y=We(w,A,C,E);V.validate=Y;var ee=V.callValidate;return ee&&(ee.schema=Y.schema,ee.errors=null,ee.refs=Y.refs,ee.refVal=Y.refVal,ee.root=Y.root,ee.$async=Y.$async,j.sourceCode&&(ee.source=Y.source)),Y}finally{d.call(this,w,A,E)}function se(){var z=V.validate,H=z.apply(this,arguments);return se.errors=z.errors,H}function We(z,H,de,me){var ne=!H||H&&H.schema==z;if(H.schema!=A.schema)return l.call(P,z,H,de,me);var Ce=z.$async===!0,Ae=n({isTop:!0,schema:z,isRoot:ne,baseId:me,root:H,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:i.MissingRef,RULES:K,validate:n,util:a,resolve:r,resolveRef:Qe,usePattern:M,useDefault:X,useCustomRule:ce,opts:j,formats:J,logger:P.logger,self:P});Ae=y(N,g)+y(O,v)+y(T,f)+y(F,b)+Ae,j.processCode&&(Ae=j.processCode(Ae,z));var xe;try{var Ke=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ae);xe=Ke(P,K,J,A,N,T,F,p,o,c),N[0]=xe}catch(Le){throw P.logger.error("Error compiling schema, function code:",Ae),Le}return xe.schema=z,xe.errors=null,xe.refs=L,xe.refVal=N,xe.root=ne?xe:H,Ce&&(xe.$async=!0),j.sourceCode===!0&&(xe.source={code:Ae,patterns:O,defaults:T}),xe}function Qe(z,H,de){H=r.url(z,H);var me=L[H],ne,Ce;if(me!==void 0)return ne=N[me],Ce="refVal["+me+"]",R(ne,Ce);if(!de&&A.refs){var Ae=A.refs[H];if(Ae!==void 0)return ne=A.refVal[Ae],Ce=Xe(H,ne),R(ne,Ce)}Ce=Xe(H);var xe=r.call(P,We,A,H);if(xe===void 0){var Ke=C&&C[H];Ke&&(xe=r.inlineRef(Ke,j.inlineRefs)?Ke:l.call(P,Ke,A,C,z))}if(xe===void 0)Re(H);else return De(H,xe),R(xe,Ce)}function Xe(z,H){var de=N.length;return N[de]=H,L[z]=de,"refVal"+de}function Re(z){delete L[z]}function De(z,H){var de=L[z];N[de]=H}function R(z,H){return typeof z=="object"||typeof z=="boolean"?{code:H,schema:z,inline:!0}:{code:H,$async:z&&!!z.$async}}function M(z){var H=k[z];return H===void 0&&(H=k[z]=O.length,O[H]=z),"pattern"+H}function X(z){switch(typeof z){case"boolean":case"number":return""+z;case"string":return a.toQuotedString(z);case"object":if(z===null)return"null";var H=s(z),de=$[H];return de===void 0&&(de=$[H]=T.length,T[de]=z),"default"+de}}function ce(z,H,de,me){if(P._opts.validateSchema!==!1){var ne=z.definition.dependencies;if(ne&&!ne.every(function(va){return Object.prototype.hasOwnProperty.call(de,va)}))throw new Error("parent schema must have all required keywords: "+ne.join(","));var Ce=z.definition.validateSchema;if(Ce){var Ae=Ce(H);if(!Ae){var xe="keyword schema is invalid: "+P.errorsText(Ce.errors);if(P._opts.validateSchema=="log")P.logger.error(xe);else throw new Error(xe)}}}var Ke=z.definition.compile,Le=z.definition.inline,Ye=z.definition.macro,Ie;if(Ke)Ie=Ke.call(P,H,de,me);else if(Ye)Ie=Ye.call(P,H,de,me),j.validateSchema!==!1&&P.validateSchema(Ie,!0);else if(Le)Ie=Le.call(P,me,z.keyword,H,de);else if(Ie=z.definition.validate,!Ie)return;if(Ie===void 0)throw new Error('custom keyword "'+z.keyword+'"failed to compile');var Ve=F.length;return F[Ve]=Ie,{code:"customRule"+Ve,validate:Ie}}}function u(w,A,C){var E=h.call(this,w,A,C);return E>=0?{index:E,compiling:!0}:(E=this._compilations.length,this._compilations[E]={schema:w,root:A,baseId:C},{index:E,compiling:!1})}function d(w,A,C){var E=h.call(this,w,A,C);E>=0&&this._compilations.splice(E,1)}function h(w,A,C){for(var E=0;E{var r=e.exports=function(){this._cache={}};r.prototype.put=function(i,s){this._cache[i]=s},r.prototype.get=function(i){return this._cache[i]},r.prototype.del=function(i){delete this._cache[i]},r.prototype.clear=function(){this._cache={}}}),e8=ie((t,e)=>{var r=Fr(),a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31],s=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,n=/^(?=.{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,o=/^(?:[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,p=/^(?:[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,c=/^(?:(?:[^\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,l=/^(?:(?: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,u=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,d=/^(?:\/(?:[^~/]|~0|~1)*)*$/,h=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;e.exports=f;function f(N){return N=N=="full"?"full":"fast",r.copy(f[N])}f.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":c,url:l,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:n,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:j,uuid:u,"json-pointer":d,"json-pointer-uri-fragment":h,"relative-json-pointer":v},f.full={date:b,time:y,"date-time":A,uri:E,"uri-reference":p,"uri-template":c,url:l,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:n,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:j,uuid:u,"json-pointer":d,"json-pointer-uri-fragment":h,"relative-json-pointer":v};function g(N){return N%4===0&&(N%100!==0||N%400===0)}function b(N){var L=N.match(a);if(!L)return!1;var O=+L[1],k=+L[2],T=+L[3];return k>=1&&k<=12&&T>=1&&T<=(k==2&&g(O)?29:i[k])}function y(N,L){var O=N.match(s);if(!O)return!1;var k=O[1],T=O[2],$=O[3],F=O[5];return(k<=23&&T<=59&&$<=59||k==23&&T==59&&$==60)&&(!L||F)}var w=/t|\s/i;function A(N){var L=N.split(w);return L.length==2&&b(L[0])&&y(L[1],!0)}var C=/\/|:/;function E(N){return C.test(N)&&o.test(N)}var P=/[^\\]\\Z/;function j(N){if(P.test(N))return!1;try{return new RegExp(N),!0}catch{return!1}}}),a8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.errSchemaPath+"/"+i,u=!a.opts.allErrors,d="data"+(p||""),h="valid"+o,v,f;if(c=="#"||c=="#/")a.isRoot?(v=a.async,f="validate"):(v=a.root.schema.$async===!0,f="root.refVal[0]");else{var g=a.resolveRef(a.baseId,c,a.isRoot);if(g===void 0){var b=a.MissingRefError.message(a.baseId,c);if(a.opts.missingRefs=="fail"){a.logger.error(b);var y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(l)+" , params: { ref: '"+a.util.escapeQuotes(c)+"' } ",a.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+a.util.escapeQuotes(c)+"' "),a.opts.verbose&&(n+=" , schema: "+a.util.toQuotedString(c)+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!a.compositeRule&&u?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(n+=" if (false) { ")}else if(a.opts.missingRefs=="ignore")a.logger.warn(b),u&&(n+=" if (true) { ");else throw new a.MissingRefError(a.baseId,c,b)}else if(g.inline){var A=a.util.copy(a);A.level++;var C="valid"+A.level;A.schema=g.schema,A.schemaPath="",A.errSchemaPath=c;var E=a.validate(A).replace(/validate\.schema/g,g.code);n+=" "+E+" ",u&&(n+=" if ("+C+") { ")}else v=g.$async===!0||a.async&&g.$async!==!1,f=g.code}if(f){var y=y||[];y.push(n),n="",a.opts.passContext?n+=" "+f+".call(this, ":n+=" "+f+"( ",n+=" "+d+", (dataPath || '')",a.errorPath!='""'&&(n+=" + "+a.errorPath);var P=p?"data"+(p-1||""):"parentData",j=p?a.dataPathArr[p]:"parentDataProperty";n+=" , "+P+" , "+j+", rootData) ";var N=n;if(n=y.pop(),v){if(!a.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+h+"; "),n+=" try { await "+N+"; ",u&&(n+=" "+h+" = true; "),n+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(n+=" "+h+" = false; "),n+=" } ",u&&(n+=" if ("+h+") { ")}else n+=" if (!"+N+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n}}),t8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.schema[i],p=a.schemaPath+a.util.getProperty(i),c=a.errSchemaPath+"/"+i,l=!a.opts.allErrors,u=a.util.copy(a),d="";u.level++;var h="valid"+u.level,v=u.baseId,f=!0,g=o;if(g)for(var b,y=-1,w=g.length-1;y0||b===!1:a.util.schemaHasRules(b,a.RULES.all))&&(f=!1,u.schema=b,u.schemaPath=p+"["+y+"]",u.errSchemaPath=c+"/"+y,n+=" "+a.validate(u)+" ",u.baseId=v,l&&(n+=" if ("+h+") { ",d+="}"));return l&&(f?n+=" if (true) { ":n+=" "+d.slice(0,-1)+" "),n}}),r8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a),b="";g.level++;var y="valid"+g.level,w=c.every(function(L){return a.opts.strictKeywords?typeof L=="object"&&Object.keys(L).length>0||L===!1:a.util.schemaHasRules(L,a.RULES.all)});if(w){var A=g.baseId;n+=" var "+f+" = errors; var "+v+" = false; ";var C=a.compositeRule;a.compositeRule=g.compositeRule=!0;var E=c;if(E)for(var P,j=-1,N=E.length-1;j{e.exports=function(a,i,s){var n=" ",o=a.schema[i],p=a.errSchemaPath+"/"+i,c=!a.opts.allErrors,l=a.util.toQuotedString(o);return a.opts.$comment===!0?n+=" console.log("+l+");":typeof a.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+a.util.toQuotedString(p)+", validate.root.schema);"),n}}),i8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f=a.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",g="schema"+o):g=c,f||(n+=" var schema"+o+" = validate.schema"+l+";"),n+="var "+v+" = equal("+h+", schema"+o+"); if (!"+v+") { ";var b=b||[];b.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",a.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=b.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n}}),s8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a),b="";g.level++;var y="valid"+g.level,w="i"+o,A=g.dataLevel=a.dataLevel+1,C="data"+A,E=a.baseId,P=a.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:a.util.schemaHasRules(c,a.RULES.all);if(n+="var "+f+" = errors;var "+v+";",P){var j=a.compositeRule;a.compositeRule=g.compositeRule=!0,g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" var "+y+" = false; for (var "+w+" = 0; "+w+" < "+h+".length; "+w+"++) { ",g.errorPath=a.util.getPathExpr(a.errorPath,w,a.opts.jsonPointers,!0);var N=h+"["+w+"]";g.dataPathArr[A]=w;var L=a.validate(g);g.baseId=E,a.util.varOccurences(L,C)<2?n+=" "+a.util.varReplace(L,C,N)+" ":n+=" var "+C+" = "+N+"; "+L+" ",n+=" if ("+y+") break; } ",a.compositeRule=g.compositeRule=j,n+=" "+b+" if (!"+y+") {"}else n+=" if ("+h+".length == 0) {";var O=O||[];O.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var k=n;return n=O.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+k+"]); ":n+=" validate.errors = ["+k+"]; return false; ":n+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { ",P&&(n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),a.opts.allErrors&&(n+=" } "),n}}),o8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="errs__"+o,f=a.util.copy(a),g="";f.level++;var b="valid"+f.level,y={},w={},A=a.opts.ownProperties;for(j in c)if(j!="__proto__"){var C=c[j],E=Array.isArray(C)?w:y;E[j]=C}n+="var "+v+" = errors;";var P=a.errorPath;n+="var missing"+o+";";for(var j in w)if(E=w[j],E.length){if(n+=" if ( "+h+a.util.getProperty(j)+" !== undefined ",A&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(j)+"') "),d){n+=" && ( ";var N=E;if(N)for(var L,O=-1,k=N.length-1;O0||C===!1:a.util.schemaHasRules(C,a.RULES.all))&&(n+=" "+b+" = true; if ( "+h+a.util.getProperty(j)+" !== undefined ",A&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(j)+"') "),n+=") { ",f.schema=C,f.schemaPath=l+a.util.getProperty(j),f.errSchemaPath=u+"/"+a.util.escapeFragment(j),n+=" "+a.validate(f)+" ",f.baseId=se,n+=" } ",d&&(n+=" if ("+b+") { ",g+="}"))}return d&&(n+=" "+g+" if ("+v+" == errors) {"),n}}),c8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f=a.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",g="schema"+o):g=c;var b="i"+o,y="schema"+o;f||(n+=" var "+y+" = validate.schema"+l+";"),n+="var "+v+";",f&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=""+v+" = false;for (var "+b+"=0; "+b+"<"+y+".length; "+b+"++) if (equal("+h+", "+y+"["+b+"])) { "+v+" = true; break; }",f&&(n+=" } "),n+=" if (!"+v+") { ";var w=w||[];w.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",a.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var A=n;return n=w.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n}}),p8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||"");if(a.opts.format===!1)return d&&(n+=" if (true) { "),n;var v=a.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c;var g=a.opts.unknownFormats,b=Array.isArray(g);if(v){var y="format"+o,w="isObject"+o,A="formatType"+o;n+=" var "+y+" = formats["+f+"]; var "+w+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+A+" = "+w+" && "+y+".type || 'string'; if ("+w+") { ",a.async&&(n+=" var async"+o+" = "+y+".async; "),n+=" "+y+" = "+y+".validate; } if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" (",g!="ignore"&&(n+=" ("+f+" && !"+y+" ",b&&(n+=" && self._opts.unknownFormats.indexOf("+f+") == -1 "),n+=") || "),n+=" ("+y+" && "+A+" == '"+s+"' && !(typeof "+y+" == 'function' ? ",a.async?n+=" (async"+o+" ? await "+y+"("+h+") : "+y+"("+h+")) ":n+=" "+y+"("+h+") ",n+=" : "+y+".test("+h+"))))) {"}else{var y=a.formats[c];if(!y){if(g=="ignore")return a.logger.warn('unknown format "'+c+'" ignored in schema at path "'+a.errSchemaPath+'"'),d&&(n+=" if (true) { "),n;if(b&&g.indexOf(c)>=0)return d&&(n+=" if (true) { "),n;throw new Error('unknown format "'+c+'" is used in schema at path "'+a.errSchemaPath+'"')}var w=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,A=w&&y.type||"string";if(w){var C=y.async===!0;y=y.validate}if(A!=s)return d&&(n+=" if (true) { "),n;if(C){if(!a.async)throw new Error("async format in sync schema");var E="formats"+a.util.getProperty(c)+".validate";n+=" if (!(await "+E+"("+h+"))) { "}else{n+=" if (! ";var E="formats"+a.util.getProperty(c);w&&(E+=".validate"),typeof y=="function"?n+=" "+E+"("+h+") ":n+=" "+E+".test("+h+") ",n+=") { "}}var P=P||[];P.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { format: ",v?n+=""+f:n+=""+a.util.toQuotedString(c),n+=" } ",a.opts.messages!==!1&&(n+=` , message: 'should match format "`,v?n+="' + "+f+" + '":n+=""+a.util.escapeQuotes(c),n+=`"' `),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+a.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var j=n;return n=P.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+j+"]); ":n+=" validate.errors = ["+j+"]; return false; ":n+=" var err = "+j+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n}}),l8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a);g.level++;var b="valid"+g.level,y=a.schema.then,w=a.schema.else,A=y!==void 0&&(a.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:a.util.schemaHasRules(y,a.RULES.all)),C=w!==void 0&&(a.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:a.util.schemaHasRules(w,a.RULES.all)),E=g.baseId;if(A||C){var P;g.createErrors=!1,g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" var "+f+" = errors; var "+v+" = true; ";var j=a.compositeRule;a.compositeRule=g.compositeRule=!0,n+=" "+a.validate(g)+" ",g.baseId=E,g.createErrors=!0,n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",a.compositeRule=g.compositeRule=j,A?(n+=" if ("+b+") { ",g.schema=a.schema.then,g.schemaPath=a.schemaPath+".then",g.errSchemaPath=a.errSchemaPath+"/then",n+=" "+a.validate(g)+" ",g.baseId=E,n+=" "+v+" = "+b+"; ",A&&C?(P="ifClause"+o,n+=" var "+P+" = 'then'; "):P="'then'",n+=" } ",C&&(n+=" else { ")):n+=" if (!"+b+") { ",C&&(g.schema=a.schema.else,g.schemaPath=a.schemaPath+".else",g.errSchemaPath=a.errSchemaPath+"/else",n+=" "+a.validate(g)+" ",g.baseId=E,n+=" "+v+" = "+b+"; ",A&&C?(P="ifClause"+o,n+=" var "+P+" = 'else'; "):P="'else'",n+=" } "),n+=" if (!"+v+") { var err = ",a.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { failingKeyword: "+P+" } ",a.opts.messages!==!1&&(n+=` , message: 'should match "' + `+P+` + '" schema' `),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!a.compositeRule&&d&&(a.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n}}),u8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a),b="";g.level++;var y="valid"+g.level,w="i"+o,A=g.dataLevel=a.dataLevel+1,C="data"+A,E=a.baseId;if(n+="var "+f+" = errors;var "+v+";",Array.isArray(c)){var P=a.schema.additionalItems;if(P===!1){n+=" "+v+" = "+h+".length <= "+c.length+"; ";var j=u;u=a.errSchemaPath+"/additionalItems",n+=" if (!"+v+") { ";var N=N||[];N.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { limit: "+c.length+" } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+c.length+" items' "),a.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var L=n;n=N.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+L+"]); ":n+=" validate.errors = ["+L+"]; return false; ":n+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",u=j,d&&(b+="}",n+=" else { ")}var O=c;if(O){for(var k,T=-1,$=O.length-1;T<$;)if(k=O[T+=1],a.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:a.util.schemaHasRules(k,a.RULES.all)){n+=" "+y+" = true; if ("+h+".length > "+T+") { ";var F=h+"["+T+"]";g.schema=k,g.schemaPath=l+"["+T+"]",g.errSchemaPath=u+"/"+T,g.errorPath=a.util.getPathExpr(a.errorPath,T,a.opts.jsonPointers,!0),g.dataPathArr[A]=T;var B=a.validate(g);g.baseId=E,a.util.varOccurences(B,C)<2?n+=" "+a.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",n+=" } ",d&&(n+=" if ("+y+") { ",b+="}")}}if(typeof P=="object"&&(a.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:a.util.schemaHasRules(P,a.RULES.all))){g.schema=P,g.schemaPath=a.schemaPath+".additionalItems",g.errSchemaPath=a.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+h+".length > "+c.length+") { for (var "+w+" = "+c.length+"; "+w+" < "+h+".length; "+w+"++) { ",g.errorPath=a.util.getPathExpr(a.errorPath,w,a.opts.jsonPointers,!0);var F=h+"["+w+"]";g.dataPathArr[A]=w;var B=a.validate(g);g.baseId=E,a.util.varOccurences(B,C)<2?n+=" "+a.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",d&&(n+=" if (!"+y+") break; "),n+=" } } ",d&&(n+=" if ("+y+") { ",b+="}")}}else if(a.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:a.util.schemaHasRules(c,a.RULES.all)){g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" for (var "+w+" = 0; "+w+" < "+h+".length; "+w+"++) { ",g.errorPath=a.util.getPathExpr(a.errorPath,w,a.opts.jsonPointers,!0);var F=h+"["+w+"]";g.dataPathArr[A]=w;var B=a.validate(g);g.baseId=E,a.util.varOccurences(B,C)<2?n+=" "+a.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",d&&(n+=" if (!"+y+") break; "),n+=" }"}return d&&(n+=" "+b+" if ("+f+" == errors) {"),n}}),cv=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,E,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c;var g=i=="maximum",b=g?"exclusiveMaximum":"exclusiveMinimum",y=a.schema[b],w=a.opts.$data&&y&&y.$data,A=g?"<":">",C=g?">":"<",E=void 0;if(!(v||typeof c=="number"||c===void 0))throw new Error(i+" must be number");if(!(w||y===void 0||typeof y=="number"||typeof y=="boolean"))throw new Error(b+" must be number or boolean");if(w){var P=a.util.getData(y.$data,p,a.dataPathArr),j="exclusive"+o,N="exclType"+o,L="exclIsNumber"+o,O="op"+o,k="' + "+O+" + '";n+=" var schemaExcl"+o+" = "+P+"; ",P="schemaExcl"+o,n+=" var "+j+"; var "+N+" = typeof "+P+"; if ("+N+" != 'boolean' && "+N+" != 'undefined' && "+N+" != 'number') { ";var E=b,T=T||[];T.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(E||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: '"+b+" should be boolean' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var $=n;n=T.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+N+" == 'number' ? ( ("+j+" = "+f+" === undefined || "+P+" "+A+"= "+f+") ? "+h+" "+C+"= "+P+" : "+h+" "+C+" "+f+" ) : ( ("+j+" = "+P+" === true) ? "+h+" "+C+"= "+f+" : "+h+" "+C+" "+f+" ) || "+h+" !== "+h+") { var op"+o+" = "+j+" ? '"+A+"' : '"+A+"='; ",c===void 0&&(E=b,u=a.errSchemaPath+"/"+b,f=P,v=w)}else{var L=typeof y=="number",k=A;if(L&&v){var O="'"+k+"'";n+=" if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" ( "+f+" === undefined || "+y+" "+A+"= "+f+" ? "+h+" "+C+"= "+y+" : "+h+" "+C+" "+f+" ) || "+h+" !== "+h+") { "}else{L&&c===void 0?(j=!0,E=b,u=a.errSchemaPath+"/"+b,f=y,C+="="):(L&&(f=Math[g?"min":"max"](y,c)),y===(L?f:!0)?(j=!0,E=b,u=a.errSchemaPath+"/"+b,C+="="):(j=!1,k+="="));var O="'"+k+"'";n+=" if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+h+" "+C+" "+f+" || "+h+" !== "+h+") { "}}E=E||i;var T=T||[];T.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(E||"_limit")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { comparison: "+O+", limit: "+f+", exclusive: "+j+" } ",a.opts.messages!==!1&&(n+=" , message: 'should be "+k+" ",v?n+="' + "+f:n+=""+f+"'"),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var $=n;return n=T.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { "),n}}),pv=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,b,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c,!(v||typeof c=="number"))throw new Error(i+" must be number");var g=i=="maxItems"?">":"<";n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+h+".length "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { limit: "+f+" } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT have ",i=="maxItems"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" items' "),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),lv=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,b,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c,!(v||typeof c=="number"))throw new Error(i+" must be number");var g=i=="maxLength"?">":"<";n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),a.opts.unicode===!1?n+=" "+h+".length ":n+=" ucs2length("+h+") ",n+=" "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { limit: "+f+" } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT be ",i=="maxLength"?n+="longer":n+="shorter",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" characters' "),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),uv=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,b,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c,!(v||typeof c=="number"))throw new Error(i+" must be number");var g=i=="maxProperties"?">":"<";n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" Object.keys("+h+").length "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { limit: "+f+" } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT have ",i=="maxProperties"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" properties' "),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+w+"]); ":n+=" validate.errors = ["+w+"]; return false; ":n+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),d8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c,!(v||typeof c=="number"))throw new Error(i+" must be number");n+="var division"+o+";if (",v&&(n+=" "+f+" !== undefined && ( typeof "+f+" != 'number' || "),n+=" (division"+o+" = "+h+" / "+f+", ",a.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+a.opts.multipleOfPrecision+" ":n+=" division"+o+" !== parseInt(division"+o+") ",n+=" ) ",v&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { multipleOf: "+f+" } ",a.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",v?n+="' + "+f:n+=""+f+"'"),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+b+"]); ":n+=" validate.errors = ["+b+"]; return false; ":n+=" var err = "+b+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),f8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="errs__"+o,f=a.util.copy(a);f.level++;var g="valid"+f.level;if(a.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:a.util.schemaHasRules(c,a.RULES.all)){f.schema=c,f.schemaPath=l,f.errSchemaPath=u,n+=" var "+v+" = errors; ";var b=a.compositeRule;a.compositeRule=f.compositeRule=!0,f.createErrors=!1;var y;f.opts.allErrors&&(y=f.opts.allErrors,f.opts.allErrors=!1),n+=" "+a.validate(f)+" ",f.createErrors=!0,y&&(f.opts.allErrors=y),a.compositeRule=f.compositeRule=b,n+=" if ("+g+") { ";var w=w||[];w.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var A=n;n=w.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+A+"]); ":n+=" validate.errors = ["+A+"]; return false; ":n+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { errors = "+v+"; if (vErrors !== null) { if ("+v+") vErrors.length = "+v+"; else vErrors = null; } ",a.opts.allErrors&&(n+=" } ")}else n+=" var err = ",a.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: {} ",a.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(n+=" if (false) { ");return n}}),m8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f="errs__"+o,g=a.util.copy(a),b="";g.level++;var y="valid"+g.level,w=g.baseId,A="prevValid"+o,C="passingSchemas"+o;n+="var "+f+" = errors , "+A+" = false , "+v+" = false , "+C+" = null; ";var E=a.compositeRule;a.compositeRule=g.compositeRule=!0;var P=c;if(P)for(var j,N=-1,L=P.length-1;N0||j===!1:a.util.schemaHasRules(j,a.RULES.all))?(g.schema=j,g.schemaPath=l+"["+N+"]",g.errSchemaPath=u+"/"+N,n+=" "+a.validate(g)+" ",g.baseId=w):n+=" var "+y+" = true; ",N&&(n+=" if ("+y+" && "+A+") { "+v+" = false; "+C+" = ["+C+", "+N+"]; } else { ",b+="}"),n+=" if ("+y+") { "+v+" = "+A+" = true; "+C+" = "+N+"; }";return a.compositeRule=g.compositeRule=E,n+=""+b+"if (!"+v+") { var err = ",a.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { passingSchemas: "+C+" } ",a.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!a.compositeRule&&d&&(a.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+="} else { errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; }",a.opts.allErrors&&(n+=" } "),n}}),h8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v=a.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",f="schema"+o):f=c;var g=v?"(new RegExp("+f+"))":a.usePattern(c);n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" !"+g+".test("+h+") ) { ";var b=b||[];b.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { pattern: ",v?n+=""+f:n+=""+a.util.toQuotedString(c),n+=" } ",a.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,v?n+="' + "+f+" + '":n+=""+a.util.escapeQuotes(c),n+=`"' `),a.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+a.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var y=n;return n=b.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+y+"]); ":n+=" validate.errors = ["+y+"]; return false; ":n+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+="} ",d&&(n+=" else { "),n}}),v8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="errs__"+o,f=a.util.copy(a),g="";f.level++;var b="valid"+f.level,y="key"+o,w="idx"+o,A=f.dataLevel=a.dataLevel+1,C="data"+A,E="dataProperties"+o,P=Object.keys(c||{}).filter(Y),j=a.schema.patternProperties||{},N=Object.keys(j).filter(Y),L=a.schema.additionalProperties,O=P.length||N.length,k=L===!1,T=typeof L=="object"&&Object.keys(L).length,$=a.opts.removeAdditional,F=k||T||$,B=a.opts.ownProperties,V=a.baseId,J=a.schema.required;if(J&&!(a.opts.$data&&J.$data)&&J.length8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var ee=P;if(ee)for(var se,We=-1,Qe=ee.length-1;We0||Le===!1:a.util.schemaHasRules(Le,a.RULES.all)){var Ye=a.util.getProperty(se),me=h+Ye,Ie=Ce&&Le.default!==void 0;f.schema=Le,f.schemaPath=l+Ye,f.errSchemaPath=u+"/"+a.util.escapeFragment(se),f.errorPath=a.util.getPath(a.errorPath,se,a.opts.jsonPointers),f.dataPathArr[A]=a.util.toQuotedString(se);var ne=a.validate(f);if(f.baseId=V,a.util.varOccurences(ne,C)<2){ne=a.util.varReplace(ne,C,me);var Ve=me}else{var Ve=C;n+=" var "+C+" = "+me+"; "}if(Ie)n+=" "+ne+" ";else{if(K&&K[se]){n+=" if ( "+Ve+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(se)+"') "),n+=") { "+b+" = false; ";var M=a.errorPath,ce=u,va=a.util.escapeQuotes(se);a.opts._errorDataPathProperty&&(a.errorPath=a.util.getPath(M,se,a.opts.jsonPointers)),u=a.errSchemaPath+"/required";var z=z||[];z.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { missingProperty: '"+va+"' } ",a.opts.messages!==!1&&(n+=" , message: '",a.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+va+"\\'",n+="' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var H=n;n=z.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+H+"]); ":n+=" validate.errors = ["+H+"]; return false; ":n+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u=ce,a.errorPath=M,n+=" } else { "}else d?(n+=" if ( "+Ve+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(se)+"') "),n+=") { "+b+" = true; } else { "):(n+=" if ("+Ve+" !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", '"+a.util.escapeQuotes(se)+"') "),n+=" ) { ");n+=" "+ne+" } "}}d&&(n+=" if ("+b+") { ",g+="}")}}if(N.length){var la=N;if(la)for(var Re,Fn=-1,ds=la.length-1;Fn0||Le===!1:a.util.schemaHasRules(Le,a.RULES.all)){f.schema=Le,f.schemaPath=a.schemaPath+".patternProperties"+a.util.getProperty(Re),f.errSchemaPath=a.errSchemaPath+"/patternProperties/"+a.util.escapeFragment(Re),B?n+=" "+E+" = "+E+" || Object.keys("+h+"); for (var "+w+"=0; "+w+"<"+E+".length; "+w+"++) { var "+y+" = "+E+"["+w+"]; ":n+=" for (var "+y+" in "+h+") { ",n+=" if ("+a.usePattern(Re)+".test("+y+")) { ",f.errorPath=a.util.getPathExpr(a.errorPath,y,a.opts.jsonPointers);var me=h+"["+y+"]";f.dataPathArr[A]=y;var ne=a.validate(f);f.baseId=V,a.util.varOccurences(ne,C)<2?n+=" "+a.util.varReplace(ne,C,me)+" ":n+=" var "+C+" = "+me+"; "+ne+" ",d&&(n+=" if (!"+b+") break; "),n+=" } ",d&&(n+=" else "+b+" = true; "),n+=" } ",d&&(n+=" if ("+b+") { ",g+="}")}}}return d&&(n+=" "+g+" if ("+v+" == errors) {"),n}}),g8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="errs__"+o,f=a.util.copy(a),g="";f.level++;var b="valid"+f.level;if(n+="var "+v+" = errors;",a.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:a.util.schemaHasRules(c,a.RULES.all)){f.schema=c,f.schemaPath=l,f.errSchemaPath=u;var y="key"+o,w="idx"+o,A="i"+o,C="' + "+y+" + '",E=f.dataLevel=a.dataLevel+1,P="data"+E,j="dataProperties"+o,N=a.opts.ownProperties,L=a.baseId;N&&(n+=" var "+j+" = undefined; "),N?n+=" "+j+" = "+j+" || Object.keys("+h+"); for (var "+w+"=0; "+w+"<"+j+".length; "+w+"++) { var "+y+" = "+j+"["+w+"]; ":n+=" for (var "+y+" in "+h+") { ",n+=" var startErrs"+o+" = errors; ";var O=y,k=a.compositeRule;a.compositeRule=f.compositeRule=!0;var T=a.validate(f);f.baseId=L,a.util.varOccurences(T,P)<2?n+=" "+a.util.varReplace(T,P,O)+" ":n+=" var "+P+" = "+O+"; "+T+" ",a.compositeRule=f.compositeRule=k,n+=" if (!"+b+") { for (var "+A+"=startErrs"+o+"; "+A+"{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f=a.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",g="schema"+o):g=c;var b="schema"+o;if(!f)if(c.length0||P===!1:a.util.schemaHasRules(P,a.RULES.all))||(y[y.length]=A)}}else var y=c;if(f||y.length){var j=a.errorPath,N=f||y.length>=a.opts.loopRequired,L=a.opts.ownProperties;if(d)if(n+=" var missing"+o+"; ",N){f||(n+=" var "+b+" = validate.schema"+l+"; ");var O="i"+o,k="schema"+o+"["+O+"]",T="' + "+k+" + '";a.opts._errorDataPathProperty&&(a.errorPath=a.util.getPathExpr(j,k,a.opts.jsonPointers)),n+=" var "+v+" = true; ",f&&(n+=" if (schema"+o+" === undefined) "+v+" = true; else if (!Array.isArray(schema"+o+")) "+v+" = false; else {"),n+=" for (var "+O+" = 0; "+O+" < "+b+".length; "+O+"++) { "+v+" = "+h+"["+b+"["+O+"]] !== undefined ",L&&(n+=" && Object.prototype.hasOwnProperty.call("+h+", "+b+"["+O+"]) "),n+="; if (!"+v+") break; } ",f&&(n+=" } "),n+=" if (!"+v+") { ";var $=$||[];$.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { missingProperty: '"+T+"' } ",a.opts.messages!==!1&&(n+=" , message: '",a.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+T+"\\'",n+="' "),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var F=n;n=$.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+F+"]); ":n+=" validate.errors = ["+F+"]; return false; ":n+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } else { "}else{n+=" if ( ";var B=y;if(B)for(var V,O=-1,J=B.length-1;O{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h="data"+(p||""),v="valid"+o,f=a.opts.$data&&c&&c.$data,g;if(f?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",g="schema"+o):g=c,(c||f)&&a.opts.uniqueItems!==!1){f&&(n+=" var "+v+"; if ("+g+" === false || "+g+" === undefined) "+v+" = true; else if (typeof "+g+" != 'boolean') "+v+" = false; else { "),n+=" var i = "+h+".length , "+v+" = true , j; if (i > 1) { ";var b=a.schema.items&&a.schema.items.type,y=Array.isArray(b);if(!b||b=="object"||b=="array"||y&&(b.indexOf("object")>=0||b.indexOf("array")>=0))n+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+h+"[i], "+h+"[j])) { "+v+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+h+"[i]; ";var w="checkDataType"+(y?"s":"");n+=" if ("+a.util[w](b,"item",a.opts.strictNumbers,!0)+") continue; ",y&&(n+=` if (typeof item == 'string') item = '"' + item; `),n+=" if (typeof itemIndices[item] == 'number') { "+v+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}n+=" } ",f&&(n+=" } "),n+=" if (!"+v+") { ";var A=A||[];A.push(n),n="",a.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { i: i, j: j } ",a.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),a.opts.verbose&&(n+=" , schema: ",f?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+a.schemaPath+" , data: "+h+" "),n+=" } "):n+=" {} ";var C=n;n=A.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+C+"]); ":n+=" validate.errors = ["+C+"]; return false; ":n+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n}}),b8=ie((t,e)=>{e.exports={$ref:a8(),allOf:t8(),anyOf:r8(),$comment:n8(),const:i8(),contains:s8(),dependencies:o8(),enum:c8(),format:p8(),if:l8(),items:u8(),maximum:cv(),minimum:cv(),maxItems:pv(),minItems:pv(),maxLength:lv(),minLength:lv(),maxProperties:uv(),minProperties:uv(),multipleOf:d8(),not:f8(),oneOf:m8(),pattern:h8(),properties:v8(),propertyNames:g8(),required:x8(),uniqueItems:y8(),validate:Sv()}}),w8=ie((t,e)=>{var r=b8(),a=Fr().toHash;e.exports=function(){var s=[{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"]}],n=["type","$comment"],o=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],p=["number","integer","string","array","object","boolean","null"];return s.all=a(n),s.types=a(p),s.forEach(function(c){c.rules=c.rules.map(function(l){var u;if(typeof l=="object"){var d=Object.keys(l)[0];u=l[d],l=d,u.forEach(function(v){n.push(v),s.all[v]=!0})}n.push(l);var h=s.all[l]={keyword:l,code:r[l],implements:u};return h}),s.all.$comment={keyword:"$comment",code:r.$comment},c.type&&(s.types[c.type]=c)}),s.keywords=a(n.concat(o)),s.custom={},s}}),_8=ie((t,e)=>{var r=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];e.exports=function(a,i){for(var s=0;s{var r=jc().MissingRef;e.exports=a;function a(i,s,n){var o=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof s=="function"&&(n=s,s=void 0);var p=c(i).then(function(){var u=o._addSchema(i,void 0,s);return u.validate||l(u)});return n&&p.then(function(u){n(null,u)},n),p;function c(u){var d=u.$schema;return d&&!o.getSchema(d)?a.call(o,{$ref:d},!0):Promise.resolve()}function l(u){try{return o._compile(u)}catch(h){if(h instanceof r)return d(h);throw h}function d(h){var v=h.missingSchema;if(b(v))throw new Error("Schema "+v+" is loaded but "+h.missingRef+" cannot be resolved");var f=o._loadingSchemas[v];return f||(f=o._loadingSchemas[v]=o._opts.loadSchema(v),f.then(g,g)),f.then(function(y){if(!b(v))return c(y).then(function(){b(v)||o.addSchema(y,v,void 0,s)})}).then(function(){return l(u)});function g(){delete o._loadingSchemas[v]}function b(y){return o._refs[y]||o._schemas[y]}}}}}),S8=ie((t,e)=>{e.exports=function(a,i,s){var n=" ",o=a.level,p=a.dataLevel,c=a.schema[i],l=a.schemaPath+a.util.getProperty(i),u=a.errSchemaPath+"/"+i,d=!a.opts.allErrors,h,v="data"+(p||""),f="valid"+o,g="errs__"+o,b=a.opts.$data&&c&&c.$data,y;b?(n+=" var schema"+o+" = "+a.util.getData(c.$data,p,a.dataPathArr)+"; ",y="schema"+o):y=c;var w=this,A="definition"+o,C=w.definition,E="",P,j,N,L,O;if(b&&C.$data){O="keywordValidate"+o;var k=C.validateSchema;n+=" var "+A+" = RULES.custom['"+i+"'].definition; var "+O+" = "+A+".validate;"}else{if(L=a.useCustomRule(w,c,a.schema,a),!L)return;y="validate.schema"+l,O=L.code,P=C.compile,j=C.inline,N=C.macro}var T=O+".errors",$="i"+o,F="ruleErr"+o,B=C.async;if(B&&!a.async)throw new Error("async keyword in sync schema");if(j||N||(n+=""+T+" = null;"),n+="var "+g+" = errors;var "+f+";",b&&C.$data&&(E+="}",n+=" if ("+y+" === undefined) { "+f+" = true; } else { ",k&&(E+="}",n+=" "+f+" = "+A+".validateSchema("+y+"); if ("+f+") { ")),j)C.statements?n+=" "+L.validate+" ":n+=" "+f+" = "+L.validate+"; ";else if(N){var V=a.util.copy(a),E="";V.level++;var J="valid"+V.level;V.schema=L.validate,V.schemaPath="";var K=a.compositeRule;a.compositeRule=V.compositeRule=!0;var Y=a.validate(V).replace(/validate\.schema/g,O);a.compositeRule=V.compositeRule=K,n+=" "+Y}else{var ee=ee||[];ee.push(n),n="",n+=" "+O+".call( ",a.opts.passContext?n+="this":n+="self",P||C.schema===!1?n+=" , "+v+" ":n+=" , "+y+" , "+v+" , validate.schema"+a.schemaPath+" ",n+=" , (dataPath || '')",a.errorPath!='""'&&(n+=" + "+a.errorPath);var se=p?"data"+(p-1||""):"parentData",We=p?a.dataPathArr[p]:"parentDataProperty";n+=" , "+se+" , "+We+" , rootData ) ";var Qe=n;n=ee.pop(),C.errors===!1?(n+=" "+f+" = ",B&&(n+="await "),n+=""+Qe+"; "):B?(T="customErrors"+o,n+=" var "+T+" = null; try { "+f+" = await "+Qe+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+T+" = e.errors; else throw e; } "):n+=" "+T+" = null; "+f+" = "+Qe+"; "}if(C.modifying&&(n+=" if ("+se+") "+v+" = "+se+"["+We+"];"),n+=""+E,C.valid)d&&(n+=" if (true) { ");else{n+=" if ( ",C.valid===void 0?(n+=" !",N?n+=""+J:n+=""+f):n+=" "+!C.valid+" ",n+=") { ",h=w.keyword;var ee=ee||[];ee.push(n),n="";var ee=ee||[];ee.push(n),n="",a.createErrors!==!1?(n+=" { keyword: '"+(h||"custom")+"' , dataPath: (dataPath || '') + "+a.errorPath+" , schemaPath: "+a.util.toQuotedString(u)+" , params: { keyword: '"+w.keyword+"' } ",a.opts.messages!==!1&&(n+=` , message: 'should pass "`+w.keyword+`" keyword validation' `),a.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+a.schemaPath+" , data: "+v+" "),n+=" } "):n+=" {} ";var Xe=n;n=ee.pop(),!a.compositeRule&&d?a.async?n+=" throw new ValidationError(["+Xe+"]); ":n+=" validate.errors = ["+Xe+"]; return false; ":n+=" var err = "+Xe+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Re=n;n=ee.pop(),j?C.errors?C.errors!="full"&&(n+=" for (var "+$+"="+g+"; "+$+"{e.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}}),k8=ie((t,e)=>{var r=kv();e.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:r.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:r.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"}]}}}}),P8=ie((t,e)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,a=S8(),i=k8();e.exports={add:s,get:n,remove:o,validate:p};function s(c,l){var u=this.RULES;if(u.keywords[c])throw new Error("Keyword "+c+" is already defined");if(!r.test(c))throw new Error("Keyword "+c+" is not a valid identifier");if(l){this.validateKeyword(l,!0);var d=l.type;if(Array.isArray(d))for(var h=0;h{e.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}}),R8=ie((t,e)=>{var r=J4(),a=Ic(),i=Y4(),s=_v(),n=Ev(),o=e8(),p=w8(),c=_8(),l=Fr();e.exports=g,g.prototype.validate=b,g.prototype.compile=y,g.prototype.addSchema=w,g.prototype.addMetaSchema=A,g.prototype.validateSchema=C,g.prototype.getSchema=P,g.prototype.removeSchema=L,g.prototype.addFormat=K,g.prototype.errorsText=J,g.prototype._addSchema=k,g.prototype._compile=T,g.prototype.compileAsync=E8();var u=P8();g.prototype.addKeyword=u.add,g.prototype.getKeyword=u.get,g.prototype.removeKeyword=u.remove,g.prototype.validateKeyword=u.validate;var d=jc();g.ValidationError=d.Validation,g.MissingRefError=d.MissingRef,g.$dataMetaSchema=c;var h="http://json-schema.org/draft-07/schema",v=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],f=["/properties"];function g(R){if(!(this instanceof g))return new g(R);R=this._opts=l.copy(R)||{},Re(this),this._schemas={},this._refs={},this._fragments={},this._formats=o(R.format),this._cache=R.cache||new i,this._loadingSchemas={},this._compilations=[],this.RULES=p(),this._getId=$(R),R.loopRequired=R.loopRequired||1/0,R.errorDataPath=="property"&&(R._errorDataPathProperty=!0),R.serialize===void 0&&(R.serialize=n),this._metaOpts=Xe(this),R.formats&&se(this),R.keywords&&We(this),Y(this),typeof R.meta=="object"&&this.addMetaSchema(R.meta),R.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),ee(this)}function b(R,M){var X;if(typeof R=="string"){if(X=this.getSchema(R),!X)throw new Error('no schema with key or ref "'+R+'"')}else{var ce=this._addSchema(R);X=ce.validate||this._compile(ce)}var z=X(M);return X.$async!==!0&&(this.errors=X.errors),z}function y(R,M){var X=this._addSchema(R,void 0,M);return X.validate||this._compile(X)}function w(R,M,X,ce){if(Array.isArray(R)){for(var z=0;z0&&O.push("--allowedTools",C.join(",")),E.length>0&&O.push("--disallowedTools",E.join(",")),P&&Object.keys(P).length>0&&O.push("--mcp-config",JSON.stringify({mcpServers:P})),r&&Object.keys(r).length>0&&O.push("--agents",JSON.stringify(r)),A&&O.push("--setting-sources",A.join(",")),j&&O.push("--strict-mcp-config"),g&&O.push("--permission-mode",g),f){if(v&&f===v)throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");O.push("--fallback-model",f)}L&&O.push("--include-partial-messages");for(let J of e)O.push("--add-dir",J);this.options.forkSession&&O.push("--fork-session"),this.options.resumeSessionAt&&O.push("--resume-session-at",this.options.resumeSessionAt);for(let[J,K]of Object.entries(n))K===null?O.push(`--${J}`):O.push(`--${J}`,K);if(p.CLAUDE_CODE_ENTRYPOINT||(p.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),!et().existsSync(o)){let J=dv(o)?`Claude Code native binary not found at ${o}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${o}. Is options.pathToClaudeCodeExecutable set?`;throw new ReferenceError(J)}let T=dv(o),$=T?o:i,F=T?[...s,...O]:[...s,o,...O];this.logForDebugging(T?`Spawning Claude Code native binary: ${$} ${F.join(" ")}`:`Spawning Claude Code process: ${$} ${F.join(" ")}`);let B=p.DEBUG||c?"pipe":"ignore";this.child=(0,Ov.spawn)($,F,{cwd:a,stdio:["pipe","pipe",B],signal:this.abortController.signal,env:p}),this.childStdin=this.child.stdin,this.childStdout=this.child.stdout,(p.DEBUG||c)&&this.child.stderr.on("data",J=>{this.logForDebugging(J.toString())});let V=()=>{this.child&&!this.child.killed&&this.child.kill("SIGTERM")};this.processExitHandler=V,this.abortHandler=V,process.on("exit",this.processExitHandler),this.abortController.signal.addEventListener("abort",this.abortHandler),this.child.on("error",J=>{this.ready=!1,this.abortController.signal.aborted?this.exitError=new jt("Claude Code process aborted by user"):(this.exitError=new Error(`Failed to spawn Claude Code process: ${J.message}`),this.logForDebugging(this.exitError.message))}),this.child.on("close",(J,K)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new jt("Claude Code process aborted by user");else{let Y=this.getProcessExitError(J,K);Y&&(this.exitError=Y,this.logForDebugging(Y.message))}}),this.ready=!0}catch(e){throw this.ready=!1,e}}getProcessExitError(e,r){if(e!==0&&e!==null)return new Error(`Claude Code process exited with code ${e}`);if(r)return new Error(`Claude Code process terminated by signal ${r}`)}logForDebugging(e){process.env.DEBUG&&process.stderr.write(`${e} `),this.options.stderr&&this.options.stderr(e)}write(e){if(this.abortController.signal.aborted)throw new jt("Operation aborted");if(!this.ready||!this.childStdin)throw new Error("ProcessTransport is not ready for writing");if(this.child?.killed||this.child?.exitCode!==null)throw new Error("Cannot write to terminated process");if(this.exitError)throw new Error(`Cannot write to process that exited with error: ${this.exitError.message}`);process.env.DEBUG_SDK&&process.stderr.write(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)} `);try{!this.childStdin.write(e)&&process.env.DEBUG_SDK&&console.warn("[ProcessTransport] Write buffer full, data queued")}catch(r){throw this.ready=!1,new Error(`Failed to write to process stdin: ${r.message}`)}}close(){this.childStdin&&(this.childStdin.end(),this.childStdin=void 0),this.processExitHandler&&(process.off("exit",this.processExitHandler),this.processExitHandler=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:e}of this.exitListeners)this.child?.off("exit",e);this.exitListeners=[],this.child&&!this.child.killed&&(this.child.kill("SIGTERM"),setTimeout(()=>{this.child&&!this.child.killed&&this.child.kill("SIGKILL")},5e3)),this.ready=!1}isReady(){return this.ready}async*readMessages(){if(!this.childStdout)throw new Error("ProcessTransport output stream not available");let e=(0,Cv.createInterface)({input:this.childStdout});try{for await(let r of e)r.trim()&&(yield JSON.parse(r));await this.waitForExit()}catch(r){throw r}finally{e.close()}}endInput(){this.childStdin&&this.childStdin.end()}getInputStream(){return this.childStdin}onExit(e){if(!this.child)return()=>{};let r=(a,i)=>{let s=this.getProcessExitError(a,i);e(s)};return this.child.on("exit",r),this.exitListeners.push({callback:e,handler:r}),()=>{this.child&&this.child.off("exit",r);let a=this.exitListeners.findIndex(i=>i.handler===r);a!==-1&&this.exitListeners.splice(a,1)}}async waitForExit(){if(!this.child){if(this.exitError)throw this.exitError;return}if(this.child.exitCode!==null||this.child.killed){if(this.exitError)throw this.exitError;return}return new Promise((e,r)=>{let a=(s,n)=>{if(this.abortController.signal.aborted){r(new jt("Operation aborted"));return}let o=this.getProcessExitError(s,n);o?r(o):e()};this.child.once("exit",a);let i=s=>{this.child.off("exit",a),r(s)};this.child.once("error",i),this.child.once("exit",()=>{this.child.off("error",i)})})}};function dv(t){return![".js",".mjs",".tsx",".ts",".jsx"].some(r=>t.endsWith(r))}var _c=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw new Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((e,r)=>{this.readResolve=e,this.readReject=r})}enqueue(e){if(this.readResolve){let r=this.readResolve;this.readResolve=void 0,this.readReject=void 0,r({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let r=this.readReject;this.readResolve=void 0,this.readReject=void 0,r(e)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}},Ec=class{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw new Error("Transport is closed");this.sendMcpMessage(e)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},I8=typeof global=="object"&&global&&global.Object===Object&&global,j8=I8,D8=typeof self=="object"&&self&&self.Object===Object&&self,N8=j8||D8||Function("return this")(),Dc=N8,q8=Dc.Symbol,Ki=q8,jv=Object.prototype,$8=jv.hasOwnProperty,L8=jv.toString,An=Ki?Ki.toStringTag:void 0;function F8(t){var e=$8.call(t,An),r=t[An];try{t[An]=void 0;var a=!0}catch{}var i=L8.call(t);return a&&(e?t[An]=r:delete t[An]),i}var M8=F8,z8=Object.prototype,U8=z8.toString;function B8(t){return U8.call(t)}var H8=B8,V8="[object Null]",Z8="[object Undefined]",fv=Ki?Ki.toStringTag:void 0;function G8(t){return t==null?t===void 0?Z8:V8:fv&&fv in Object(t)?M8(t):H8(t)}var W8=G8;function X8(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Dv=X8,K8="[object AsyncFunction]",Q8="[object Function]",J8="[object GeneratorFunction]",Y8="[object Proxy]";function ek(t){if(!Dv(t))return!1;var e=W8(t);return e==Q8||e==J8||e==K8||e==Y8}var ak=ek,tk=Dc["__core-js_shared__"],gc=tk,mv=function(){var t=/[^.]+$/.exec(gc&&gc.keys&&gc.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function rk(t){return!!mv&&mv in t}var nk=rk,ik=Function.prototype,sk=ik.toString;function ok(t){if(t!=null){try{return sk.call(t)}catch{}try{return t+""}catch{}}return""}var ck=ok,pk=/[\\^$.*+?()[\]{}|]/g,lk=/^\[object .+?Constructor\]$/,uk=Function.prototype,dk=Object.prototype,fk=uk.toString,mk=dk.hasOwnProperty,hk=RegExp("^"+fk.call(mk).replace(pk,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vk(t){if(!Dv(t)||nk(t))return!1;var e=ak(t)?hk:lk;return e.test(ck(t))}var gk=vk;function xk(t,e){return t?.[e]}var yk=xk;function bk(t,e){var r=yk(t,e);return gk(r)?r:void 0}var Nv=bk;function wk(t,e){return t===e||t!==t&&e!==e}var _k=wk,Ek=Nv(Object,"create"),In=Ek;function Sk(){this.__data__=In?In(null):{},this.size=0}var kk=Sk;function Pk(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Tk=Pk,Rk="__lodash_hash_undefined__",Ok=Object.prototype,Ck=Ok.hasOwnProperty;function Ak(t){var e=this.__data__;if(In){var r=e[t];return r===Rk?void 0:r}return Ck.call(e,t)?e[t]:void 0}var Ik=Ak,jk=Object.prototype,Dk=jk.hasOwnProperty;function Nk(t){var e=this.__data__;return In?e[t]!==void 0:Dk.call(e,t)}var qk=Nk,$k="__lodash_hash_undefined__";function Lk(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=In&&e===void 0?$k:e,this}var Fk=Lk;function Mr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e-1}var Kk=Xk;function Qk(t,e){var r=this.__data__,a=rs(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var Jk=Qk;function zr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e{if(!t||t.trim()==="")return null;let e=t.split(",").map(s=>s.trim()).filter(Boolean);if(e.length===0)return null;let r=e.some(s=>s.startsWith("!")),a=e.some(s=>!s.startsWith("!"));if(r&&a)return null;let i=e.map(s=>s.replace(/^!/,"").toLowerCase());return{include:r?[]:i,exclude:r?i:[],isExclusive:r}});function xP(t){let e=[],r=t.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])e.push("mcp"),e.push(r[1].toLowerCase());else{let s=t.match(/^([^:[]+):/);s&&s[1]&&e.push(s[1].trim().toLowerCase())}let a=t.match(/^\[([^\]]+)]/);a&&a[1]&&e.push(a[1].trim().toLowerCase()),t.toLowerCase().includes("statsig event:")&&e.push("statsig");let i=t.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i&&i[1]){let s=i[1].trim().toLowerCase();s.length<30&&!s.includes(" ")&&e.push(s)}return Array.from(new Set(e))}function yP(t,e){return e?t.length===0?!1:e.isExclusive?!t.some(r=>e.exclude.includes(r)):t.some(r=>e.include.includes(r)):!0}function bP(t,e){if(!e)return!0;let r=xP(t);return yP(r,e)}function wP(){return process.env.CLAUDE_CONFIG_DIR??(0,$v.join)((0,Lv.homedir)(),".claude")}function gv(t){if(!t)return!1;if(typeof t=="boolean")return t;let e=t.toLowerCase().trim();return["1","true","yes","on"].includes(e)}var _P={name:"BASH_MAX_OUTPUT_LENGTH",default:3e4,validate:t=>{if(!t)return{effective:3e4,status:"valid"};let a=parseInt(t,10);return isNaN(a)||a<=0?{effective:3e4,status:"invalid",message:`Invalid value "${t}" (using default: 30000)`}:a>15e4?{effective:15e4,status:"capped",message:`Capped from ${a} to 150000`}:{effective:a,status:"valid"}}},EP={name:"CLAUDE_CODE_MAX_OUTPUT_TOKENS",default:32e3,validate:t=>{if(!t)return{effective:32e3,status:"valid"};let e=parseInt(t,10);return isNaN(e)||e<=0?{effective:32e3,status:"invalid",message:`Invalid value "${t}" (using default: 32000)`}:e>32e3?{effective:32e3,status:"capped",message:`Capped from ${e} to 32000`}:{effective:e,status:"valid"}}};function SP(){return{originalCwd:(0,Sc.cwd)(),totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:(0,Sc.cwd)(),modelUsage:{},mainLoopModelOverride:void 0,maxRateLimitFallbackActive:!1,initialMainLoopModel:null,modelStrings:null,isNonInteractiveSession:!0,isInteractive:!1,clientType:"cli",sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,sessionId:(0,Fv.randomUUID)(),loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,envVarValidators:[_P,EP],lastAPIRequest:null,inMemoryErrorLog:[]}}var kP=SP();function PP(){return kP.sessionId}var $6=qn(()=>gv(process.env.DEBUG)||gv(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||Mv()||process.argv.some(t=>t.startsWith("--debug="))),TP=qn(()=>{let t=process.argv.find(r=>r.startsWith("--debug="));if(!t)return null;let e=t.substring(8);return gP(e)}),Mv=qn(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e"));function RP(t){if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let e=TP();return bP(t,e)}var OP=!1;function Qa(t,{level:e}={level:"debug"}){if(!RP(t))return;OP&&t.includes(` `)&&(t=JSON.stringify(t));let r=`[${e.toUpperCase()}] ${t.trim()} @@ -58,9 +58,9 @@ Please see the 3.x to 4.x migration guide for details on how to update your app. `))}finally{this.cancelControllers.delete(e.request_id)}}handleControlCancelRequest(e){let r=this.cancelControllers.get(e.request_id);r&&(r.abort(),this.cancelControllers.delete(e.request_id))}async processControlRequest(e,r){if(e.request.subtype==="can_use_tool"){if(!this.canUseTool)throw new Error("canUseTool callback is not provided.");return this.canUseTool(e.request.tool_name,e.request.input,{signal:r,suggestions:e.request.permission_suggestions})}else{if(e.request.subtype==="hook_callback")return await this.handleHookCallbacks(e.request.callback_id,e.request.input,e.request.tool_use_id,r);if(e.request.subtype==="mcp_message"){let a=e.request,i=this.sdkMcpTransports.get(a.server_name);if(!i)throw new Error(`SDK MCP server not found: ${a.server_name}`);return"method"in a.message&&"id"in a.message&&a.message.id!==null?{mcp_response:await this.handleMcpControlRequest(a.server_name,a,i)}:(i.onmessage&&i.onmessage(a.message),{mcp_response:{jsonrpc:"2.0",result:{},id:0}})}}throw new Error("Unsupported control request subtype: "+e.request.subtype)}async*readSdkMessages(){for await(let e of this.inputStream)yield e}async initialize(){let e;if(this.hooks){e={};for(let[s,n]of Object.entries(this.hooks))n.length>0&&(e[s]=n.map(o=>{let p=[];for(let c of o.hooks){let l=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(l,c),p.push(l)}return{matcher:o.matcher,hookCallbackIds:p}}))}let r=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,a={subtype:"initialize",hooks:e,sdkMcpServers:r};return(await this.request(a)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e})}request(e){let r=Math.random().toString(36).substring(2,15),a={request_id:r,type:"control_request",request:e};return new Promise((i,s)=>{this.pendingControlResponses.set(r,n=>{n.subtype==="success"?i(n):s(new Error(n.error))}),Promise.resolve(this.transport.write(JSON.stringify(a)+` `))})}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async accountInfo(){return(await this.initialization).account}async streamInput(e){Qa("[Query.streamInput] Starting to process input stream"),Qa(`[Query.streamInput] this.sdkMcpTransports.size = ${this.sdkMcpTransports.size}`);try{let r=0;for await(let a of e){if(r++,Qa(`[Query.streamInput] Processing message ${r}: ${a.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(JSON.stringify(a)+` `))}if(Qa(`[Query.streamInput] Finished processing ${r} messages from input stream`),Qa(`[Query.streamInput] About to check MCP servers. this.sdkMcpTransports.size = ${this.sdkMcpTransports.size}`),this.sdkMcpTransports.size>0&&this.firstResultReceivedPromise){Qa("[Query.streamInput] Entering Promise.race to wait for result");let a=1e4,i;await Promise.race([this.firstResultReceivedPromise.then(()=>{Qa("[Query.streamInput] Received first result, closing input stream"),i&&clearTimeout(i)}),new Promise(s=>{i=setTimeout(()=>{Qa("[Query.streamInput] Timed out waiting for first result, closing input stream"),s()},a)})]),i&&clearTimeout(i)}Qa("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(r){if(!(r instanceof jt))throw r}}handleHookCallbacks(e,r,a,i){let s=this.hookCallbacks.get(e);if(!s)throw new Error(`No hook callback found for ID: ${e}`);return s(r,a,{signal:i})}sendMcpServerMessageToCli(e,r){if("id"in r&&r.id!==null&&r.id!==void 0){let a=`${e}:${r.id}`,i=this.pendingMcpResponses.get(a);if(i){i.resolve(r),this.pendingMcpResponses.delete(a);return}}throw new Error("No pending request found")}handleMcpControlRequest(e,r,a){let i="id"in r.message?r.message.id:null,s=`${e}:${i}`;return new Promise((n,o)=>{let p=null,c=()=>{p&&clearTimeout(p),this.pendingMcpResponses.delete(s)},l=d=>{c(),n(d)},u=d=>{c(),o(d)};if(this.pendingMcpResponses.set(s,{resolve:l,reject:u}),a.onmessage)a.onmessage(r.message);else{c(),o(new Error("No message handler registered"));return}p=setTimeout(()=>{this.pendingMcpResponses.has(s)&&(c(),o(new Error("Request timeout")))},3e4)})}};function AP({prompt:t,options:{abortController:e=Rv(),additionalDirectories:r=[],agents:a,allowedTools:i=[],appendSystemPrompt:s,canUseTool:n,continue:o,customSystemPrompt:p,cwd:c,disallowedTools:l=[],env:u,executable:d=Iv()?"bun":"node",executableArgs:h=[],extraArgs:v={},fallbackModel:f,forkSession:g,hooks:b,includePartialMessages:y,maxThinkingTokens:w,maxTurns:A,mcpServers:C,model:E,pathToClaudeCodeExecutable:P,permissionMode:j="default",permissionPromptToolName:N,resume:L,resumeSessionAt:O,settingSources:k,stderr:T,strictMcpConfig:$}={}}){if(u||(u={...process.env}),u.CLAUDE_CODE_ENTRYPOINT||(u.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),!P)throw new Error("pathToClaudeCodeExecutable is required");let F={},B=new Map;if(C)for(let[Y,ee]of Object.entries(C))ee.type==="sdk"&&"instance"in ee?(B.set(Y,ee.instance),F[Y]={type:"sdk",name:Y}):F[Y]=ee;let V=typeof t=="string",J=new wc({abortController:e,additionalDirectories:r,agents:a,cwd:c,executable:d,executableArgs:h,extraArgs:v,pathToClaudeCodeExecutable:P,env:u,forkSession:g,stderr:T,customSystemPrompt:p,appendSystemPrompt:s,maxThinkingTokens:w,maxTurns:A,model:E,fallbackModel:f,permissionMode:j,permissionPromptToolName:N,continueConversation:o,resume:L,resumeSessionAt:O,settingSources:k,allowedTools:i,disallowedTools:l,mcpServers:F,strictMcpConfig:$,canUseTool:!!n,hooks:!!b,includePartialMessages:y}),K=new kc(J,V,n,b,e,B);return typeof t=="string"?J.write(JSON.stringify({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:t}]},parent_tool_use_id:null})+` -`):K.streamInput(t),K}var m={};W4(m,{void:()=>hT,util:()=>ve,unknown:()=>fT,union:()=>yT,undefined:()=>lT,tuple:()=>_T,transformer:()=>bv,symbol:()=>pT,string:()=>Gv,strictObject:()=>xT,setErrorMap:()=>DP,set:()=>kT,record:()=>ET,quotelessJson:()=>IP,promise:()=>AT,preprocess:()=>DT,pipeline:()=>NT,ostring:()=>qT,optional:()=>IT,onumber:()=>$T,oboolean:()=>LT,objectUtil:()=>Pc,object:()=>gT,number:()=>Wv,nullable:()=>jT,null:()=>uT,never:()=>mT,nativeEnum:()=>CT,nan:()=>sT,map:()=>ST,makeIssue:()=>Ji,literal:()=>RT,lazy:()=>TT,late:()=>nT,isValid:()=>Nt,isDirty:()=>Rc,isAsync:()=>jn,isAborted:()=>Tc,intersection:()=>wT,instanceof:()=>iT,getParsedType:()=>Ya,getErrorMap:()=>Qi,function:()=>PT,enum:()=>OT,effect:()=>bv,discriminatedUnion:()=>bT,defaultErrorMap:()=>jr,datetimeRegex:()=>Hv,date:()=>cT,custom:()=>Zv,coerce:()=>FT,boolean:()=>Xv,bigint:()=>oT,array:()=>vT,any:()=>dT,addIssueToContext:()=>Z,ZodVoid:()=>Nr,ZodUnknown:()=>at,ZodUnion:()=>Ut,ZodUndefined:()=>Mt,ZodType:()=>ce,ZodTuple:()=>Ua,ZodTransformer:()=>ha,ZodSymbol:()=>Dr,ZodString:()=>ut,ZodSet:()=>$r,ZodSchema:()=>ce,ZodRecord:()=>es,ZodReadonly:()=>Kt,ZodPromise:()=>ft,ZodPipeline:()=>Nn,ZodParsedType:()=>W,ZodOptional:()=>Ea,ZodObject:()=>ca,ZodNumber:()=>qt,ZodNullable:()=>Ba,ZodNull:()=>zt,ZodNever:()=>Aa,ZodNativeEnum:()=>Gt,ZodNaN:()=>Lr,ZodMap:()=>qr,ZodLiteral:()=>Vt,ZodLazy:()=>Ht,ZodIssueCode:()=>U,ZodIntersection:()=>Bt,ZodFunction:()=>as,ZodFirstPartyTypeKind:()=>te,ZodError:()=>ma,ZodEnum:()=>Zt,ZodEffects:()=>ha,ZodDiscriminatedUnion:()=>Yi,ZodDefault:()=>Wt,ZodDate:()=>Ft,ZodCatch:()=>Xt,ZodBranded:()=>Dn,ZodBoolean:()=>Lt,ZodBigInt:()=>$t,ZodArray:()=>tt,ZodAny:()=>dt,Schema:()=>ce,ParseStatus:()=>Je,OK:()=>ta,NEVER:()=>MT,INVALID:()=>ae,EMPTY_PATH:()=>NP,DIRTY:()=>Ir,BRAND:()=>rT});var ve;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let s={};for(let n of i)s[n]=n;return s},t.getValidEnumValues=i=>{let s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),n={};for(let o of s)n[o]=i[o];return t.objectValues(n)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&s.push(n);return s},t.find=(i,s)=>{for(let n of i)if(s(n))return n},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function a(i,s=" | "){return i.map(n=>typeof n=="string"?`'${n}'`:n).join(s)}t.joinValues=a,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ve||(ve={}));var Pc;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Pc||(Pc={}));var W=ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ya=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}},U=ve.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"]),IP=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ma=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},a={_errors:[]},i=s=>{for(let n of s.issues)if(n.code==="invalid_union")n.unionErrors.map(i);else if(n.code==="invalid_return_type")i(n.returnTypeError);else if(n.code==="invalid_arguments")i(n.argumentsError);else if(n.path.length===0)a._errors.push(r(n));else{let o=a,p=0;for(;pr.message){let r={},a=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];r[s]=r[s]||[],r[s].push(e(i))}else a.push(e(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};ma.create=t=>new ma(t);var jP=(t,e)=>{let r;switch(t.code){case U.invalid_type:t.received===W.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case U.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ve.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:r=`Unrecognized key(s) in object: ${ve.joinValues(t.keys,", ")}`;break;case U.invalid_union:r="Invalid input";break;case U.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ve.joinValues(t.options)}`;break;case U.invalid_enum_value:r=`Invalid enum value. Expected ${ve.joinValues(t.options)}, received '${t.received}'`;break;case U.invalid_arguments:r="Invalid function arguments";break;case U.invalid_return_type:r="Invalid function return type";break;case U.invalid_date:r="Invalid date";break;case U.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ve.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case U.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case U.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case U.custom:r="Invalid input";break;case U.invalid_intersection_types:r="Intersection results could not be merged";break;case U.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case U.not_finite:r="Number must be finite";break;default:r=e.defaultError,ve.assertNever(t)}return{message:r}},jr=jP,zv=jr;function DP(t){zv=t}function Qi(){return zv}var Ji=t=>{let{data:e,path:r,errorMaps:a,issueData:i}=t,s=[...r,...i.path||[]],n={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",p=a.filter(c=>!!c).slice().reverse();for(let c of p)o=c(n,{data:e,defaultError:o}).message;return{...i,path:s,message:o}},NP=[];function Z(t,e){let r=Qi(),a=Ji({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===jr?void 0:jr].filter(i=>!!i)});t.common.issues.push(a)}var Je=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let a=[];for(let i of r){if(i.status==="aborted")return ae;i.status==="dirty"&&e.dirty(),a.push(i.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let i of r){let s=await i.key,n=await i.value;a.push({key:s,value:n})}return t.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let i of r){let{key:s,value:n}=i;if(s.status==="aborted"||n.status==="aborted")return ae;s.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof n.value<"u"||i.alwaysSet)&&(a[s.value]=n.value)}return{status:e.value,value:a}}},ae=Object.freeze({status:"aborted"}),Ir=t=>({status:"dirty",value:t}),ta=t=>({status:"valid",value:t}),Tc=t=>t.status==="aborted",Rc=t=>t.status==="dirty",Nt=t=>t.status==="valid",jn=t=>typeof Promise<"u"&&t instanceof Promise,Q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var Sa=class{constructor(e,r,a,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,this._key=i}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}},xv=(t,e)=>{if(Nt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ma(t.common.issues);return this._error=r,this._error}}};function le(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:i}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(n,o)=>{let{message:p}=t;return n.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:p??a??o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:p??r??o.defaultError}},description:i}}var ce=class{get description(){return this._def.description}_getType(e){return Ya(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ya(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Je,ctx:{common:e.parent.common,data:e.data,parsedType:Ya(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(jn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let a=this.safeParse(e,r);if(a.success)return a.data;throw a.error}safeParse(e,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ya(e)},i=this._parseSync({data:e,path:a.path,parent:a});return xv(a,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ya(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:r});return Nt(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>Nt(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){let a=await this.safeParseAsync(e,r);if(a.success)return a.data;throw a.error}async safeParseAsync(e,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ya(e)},i=this._parse({data:e,path:a.path,parent:a}),s=await(jn(i)?i:Promise.resolve(i));return xv(a,s)}refine(e,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let n=e(i),o=()=>s.addIssue({code:U.custom,...a(i)});return typeof Promise<"u"&&n instanceof Promise?n.then(p=>p?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,r){return this._refinement((a,i)=>e(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(e){return new ha({schema:this,typeName:te.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:r=>this["~validate"](r)}}optional(){return Ea.create(this,this._def)}nullable(){return Ba.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tt.create(this)}promise(){return ft.create(this,this._def)}or(e){return Ut.create([this,e],this._def)}and(e){return Bt.create(this,e,this._def)}transform(e){return new ha({...le(this._def),schema:this,typeName:te.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Wt({...le(this._def),innerType:this,defaultValue:r,typeName:te.ZodDefault})}brand(){return new Dn({typeName:te.ZodBranded,type:this,...le(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Xt({...le(this._def),innerType:this,catchValue:r,typeName:te.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Nn.create(this,e)}readonly(){return Kt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qP=/^c[^\s-]{8,}$/i,$P=/^[0-9a-z]+$/,LP=/^[0-9A-HJKMNP-TV-Z]{26}$/i,FP=/^[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,MP=/^[a-z0-9_-]{21}$/i,zP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,UP=/^[-+]?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)?)??$/,BP=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,HP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xc,VP=/^(?:(?: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])$/,ZP=/^(?:(?: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])$/,GP=/^(([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]))$/,WP=/^(([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])$/,XP=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,KP=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Uv="((\\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])))",QP=new RegExp(`^${Uv}$`);function Bv(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function JP(t){return new RegExp(`^${Bv(t)}$`)}function Hv(t){let e=`${Uv}T${Bv(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function YP(t,e){return!!((e==="v4"||!e)&&VP.test(t)||(e==="v6"||!e)&&GP.test(t))}function eT(t,e){if(!zP.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function aT(t,e){return!!((e==="v4"||!e)&&ZP.test(t)||(e==="v6"||!e)&&WP.test(t))}var ut=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let s=this._getOrReturnCtx(e);return Z(s,{code:U.invalid_type,expected:W.string,received:s.parsedType}),ae}let a=new Je,i;for(let s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),Z(i,{code:U.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let n=e.data.length>s.value,o=e.data.lengthe.test(i),{validation:r,code:U.invalid_string,...Q.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.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,...Q.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,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Q.errToObj(r)})}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ut({checks:[],typeName:te.ZodString,coerce:t?.coerce??!1,...le(t)});function tT(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(t.toFixed(i).replace(".","")),n=Number.parseInt(e.toFixed(i).replace(".",""));return s%n/10**i}var qt=class t extends ce{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)!==W.number){let s=this._getOrReturnCtx(e);return Z(s,{code:U.invalid_type,expected:W.number,received:s.parsedType}),ae}let a,i=new Je;for(let s of this._def.checks)s.kind==="int"?ve.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:U.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),Z(a,{code:U.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?tT(e.data,s.value)!==0&&(a=this._getOrReturnCtx(e,a),Z(a,{code:U.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:U.not_finite,message:s.message}),i.dirty()):ve.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&ve.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.valuenew qt({checks:[],typeName:te.ZodNumber,coerce:t?.coerce||!1,...le(t)});var $t=class t extends ce{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)!==W.bigint)return this._getInvalidInput(e);let a,i=new Je;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),Z(a,{code:U.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),Z(a,{code:U.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ve.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Z(r,{code:U.invalid_type,expected:W.bigint,received:r.parsedType}),ae}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew $t({checks:[],typeName:te.ZodBigInt,coerce:t?.coerce??!1,...le(t)});var Lt=class extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.boolean,received:a.parsedType}),ae}return ta(e.data)}};Lt.create=t=>new Lt({typeName:te.ZodBoolean,coerce:t?.coerce||!1,...le(t)});var Ft=class t extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let s=this._getOrReturnCtx(e);return Z(s,{code:U.invalid_type,expected:W.date,received:s.parsedType}),ae}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return Z(s,{code:U.invalid_date}),ae}let a=new Je,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),Z(i,{code:U.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):ve.assertNever(s);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Q.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ft({checks:[],coerce:t?.coerce||!1,typeName:te.ZodDate,...le(t)});var Dr=class extends ce{_parse(e){if(this._getType(e)!==W.symbol){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.symbol,received:a.parsedType}),ae}return ta(e.data)}};Dr.create=t=>new Dr({typeName:te.ZodSymbol,...le(t)});var Mt=class extends ce{_parse(e){if(this._getType(e)!==W.undefined){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.undefined,received:a.parsedType}),ae}return ta(e.data)}};Mt.create=t=>new Mt({typeName:te.ZodUndefined,...le(t)});var zt=class extends ce{_parse(e){if(this._getType(e)!==W.null){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.null,received:a.parsedType}),ae}return ta(e.data)}};zt.create=t=>new zt({typeName:te.ZodNull,...le(t)});var dt=class extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return ta(e.data)}};dt.create=t=>new dt({typeName:te.ZodAny,...le(t)});var at=class extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ta(e.data)}};at.create=t=>new at({typeName:te.ZodUnknown,...le(t)});var Aa=class extends ce{_parse(e){let r=this._getOrReturnCtx(e);return Z(r,{code:U.invalid_type,expected:W.never,received:r.parsedType}),ae}};Aa.create=t=>new Aa({typeName:te.ZodNever,...le(t)});var Nr=class extends ce{_parse(e){if(this._getType(e)!==W.undefined){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.void,received:a.parsedType}),ae}return ta(e.data)}};Nr.create=t=>new Nr({typeName:te.ZodVoid,...le(t)});var tt=class t extends ce{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),i=this._def;if(r.parsedType!==W.array)return Z(r,{code:U.invalid_type,expected:W.array,received:r.parsedType}),ae;if(i.exactLength!==null){let n=r.data.length>i.exactLength.value,o=r.data.lengthi.maxLength.value&&(Z(r,{code:U.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>i.type._parseAsync(new Sa(r,n,r.path,o)))).then(n=>Je.mergeArray(a,n));let s=[...r.data].map((n,o)=>i.type._parseSync(new Sa(r,n,r.path,o)));return Je.mergeArray(a,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};tt.create=(t,e)=>new tt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:te.ZodArray,...le(e)});function Ar(t){if(t instanceof ca){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=Ea.create(Ar(a))}return new ca({...t._def,shape:()=>e})}else return t instanceof tt?new tt({...t._def,type:Ar(t.element)}):t instanceof Ea?Ea.create(Ar(t.unwrap())):t instanceof Ba?Ba.create(Ar(t.unwrap())):t instanceof Ua?Ua.create(t.items.map(e=>Ar(e))):t}var ca=class t extends ce{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(),r=ve.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==W.object){let c=this._getOrReturnCtx(e);return Z(c,{code:U.invalid_type,expected:W.object,received:c.parsedType}),ae}let{status:a,ctx:i}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof Aa&&this._def.unknownKeys==="strip"))for(let c in i.data)n.includes(c)||o.push(c);let p=[];for(let c of n){let l=s[c],u=i.data[c];p.push({key:{status:"valid",value:c},value:l._parse(new Sa(i,u,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Aa){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of o)p.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")o.length>0&&(Z(i,{code:U.unrecognized_keys,keys:o}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of o){let u=i.data[l];p.push({key:{status:"valid",value:l},value:c._parse(new Sa(i,u,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of p){let u=await l.key,d=await l.value;c.push({key:u,value:d,alwaysSet:l.alwaysSet})}return c}).then(c=>Je.mergeObjectSync(a,c)):Je.mergeObjectSync(a,p)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:te.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let a of ve.objectKeys(e))e[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let a of ve.objectKeys(this.shape))e[a]||(r[a]=this.shape[a]);return new t({...this._def,shape:()=>r})}deepPartial(){return Ar(this)}partial(e){let r={};for(let a of ve.objectKeys(this.shape)){let i=this.shape[a];e&&!e[a]?r[a]=i:r[a]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let a of ve.objectKeys(this.shape))if(e&&!e[a])r[a]=this.shape[a];else{let s=this.shape[a];for(;s instanceof Ea;)s=s._def.innerType;r[a]=s}return new t({...this._def,shape:()=>r})}keyof(){return Vv(ve.objectKeys(this.shape))}};ca.create=(t,e)=>new ca({shape:()=>t,unknownKeys:"strip",catchall:Aa.create(),typeName:te.ZodObject,...le(e)});ca.strictCreate=(t,e)=>new ca({shape:()=>t,unknownKeys:"strict",catchall:Aa.create(),typeName:te.ZodObject,...le(e)});ca.lazycreate=(t,e)=>new ca({shape:t,unknownKeys:"strip",catchall:Aa.create(),typeName:te.ZodObject,...le(e)});var Ut=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function i(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let n=s.map(o=>new ma(o.ctx.common.issues));return Z(r,{code:U.invalid_union,unionErrors:n}),ae}if(r.common.async)return Promise.all(a.map(async s=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(i);{let s,n=[];for(let p of a){let c={...r,common:{...r.common,issues:[]},parent:null},l=p._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:c}),c.common.issues.length&&n.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map(p=>new ma(p));return Z(r,{code:U.invalid_union,unionErrors:o}),ae}}get options(){return this._def.options}};Ut.create=(t,e)=>new Ut({options:t,typeName:te.ZodUnion,...le(e)});var Ja=t=>t instanceof Ht?Ja(t.schema):t instanceof ha?Ja(t.innerType()):t instanceof Vt?[t.value]:t instanceof Zt?t.options:t instanceof Gt?ve.objectValues(t.enum):t instanceof Wt?Ja(t._def.innerType):t instanceof Mt?[void 0]:t instanceof zt?[null]:t instanceof Ea?[void 0,...Ja(t.unwrap())]:t instanceof Ba?[null,...Ja(t.unwrap())]:t instanceof Dn||t instanceof Kt?Ja(t.unwrap()):t instanceof Xt?Ja(t._def.innerType):[],Yi=class t extends ce{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return Z(r,{code:U.invalid_type,expected:W.object,received:r.parsedType}),ae;let a=this.discriminator,i=r.data[a],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Z(r,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let i=new Map;for(let s of r){let n=Ja(s.shape[e]);if(!n.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of n){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new t({typeName:te.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...le(a)})}};function Oc(t,e){let r=Ya(t),a=Ya(e);if(t===e)return{valid:!0,data:t};if(r===W.object&&a===W.object){let i=ve.objectKeys(e),s=ve.objectKeys(t).filter(o=>i.indexOf(o)!==-1),n={...t,...e};for(let o of s){let p=Oc(t[o],e[o]);if(!p.valid)return{valid:!1};n[o]=p.data}return{valid:!0,data:n}}else if(r===W.array&&a===W.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let s=0;s{if(Tc(s)||Tc(n))return ae;let o=Oc(s.value,n.value);return o.valid?((Rc(s)||Rc(n))&&r.dirty(),{status:r.value,value:o.data}):(Z(a,{code:U.invalid_intersection_types}),ae)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,n])=>i(s,n)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Bt.create=(t,e,r)=>new Bt({left:t,right:e,typeName:te.ZodIntersection,...le(r)});var Ua=class t extends ce{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==W.array)return Z(a,{code:U.invalid_type,expected:W.array,received:a.parsedType}),ae;if(a.data.lengththis._def.items.length&&(Z(a,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...a.data].map((n,o)=>{let p=this._def.items[o]||this._def.rest;return p?p._parse(new Sa(a,n,a.path,o)):null}).filter(n=>!!n);return a.common.async?Promise.all(s).then(n=>Je.mergeArray(r,n)):Je.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ua.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ua({items:t,typeName:te.ZodTuple,rest:null,...le(e)})};var es=class t extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==W.object)return Z(a,{code:U.invalid_type,expected:W.object,received:a.parsedType}),ae;let i=[],s=this._def.keyType,n=this._def.valueType;for(let o in a.data)i.push({key:s._parse(new Sa(a,o,a.path,o)),value:n._parse(new Sa(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?Je.mergeObjectAsync(r,i):Je.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof ce?new t({keyType:e,valueType:r,typeName:te.ZodRecord,...le(a)}):new t({keyType:ut.create(),valueType:e,typeName:te.ZodRecord,...le(r)})}},qr=class extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==W.map)return Z(a,{code:U.invalid_type,expected:W.map,received:a.parsedType}),ae;let i=this._def.keyType,s=this._def.valueType,n=[...a.data.entries()].map(([o,p],c)=>({key:i._parse(new Sa(a,o,a.path,[c,"key"])),value:s._parse(new Sa(a,p,a.path,[c,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let p of n){let c=await p.key,l=await p.value;if(c.status==="aborted"||l.status==="aborted")return ae;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let p of n){let c=p.key,l=p.value;if(c.status==="aborted"||l.status==="aborted")return ae;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}}}};qr.create=(t,e,r)=>new qr({valueType:e,keyType:t,typeName:te.ZodMap,...le(r)});var $r=class t extends ce{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==W.set)return Z(a,{code:U.invalid_type,expected:W.set,received:a.parsedType}),ae;let i=this._def;i.minSize!==null&&a.data.sizei.maxSize.value&&(Z(a,{code:U.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function n(p){let c=new Set;for(let l of p){if(l.status==="aborted")return ae;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}let o=[...a.data.values()].map((p,c)=>s._parse(new Sa(a,p,a.path,c)));return a.common.async?Promise.all(o).then(p=>n(p)):n(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};$r.create=(t,e)=>new $r({valueType:t,minSize:null,maxSize:null,typeName:te.ZodSet,...le(e)});var as=class t extends ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return Z(r,{code:U.invalid_type,expected:W.function,received:r.parsedType}),ae;function a(o,p){return Ji({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qi(),jr].filter(c=>!!c),issueData:{code:U.invalid_arguments,argumentsError:p}})}function i(o,p){return Ji({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qi(),jr].filter(c=>!!c),issueData:{code:U.invalid_return_type,returnTypeError:p}})}let s={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof ft){let o=this;return ta(async function(...p){let c=new ma([]),l=await o._def.args.parseAsync(p,s).catch(h=>{throw c.addIssue(a(p,h)),c}),u=await Reflect.apply(n,this,l);return await o._def.returns._def.type.parseAsync(u,s).catch(h=>{throw c.addIssue(i(u,h)),c})})}else{let o=this;return ta(function(...p){let c=o._def.args.safeParse(p,s);if(!c.success)throw new ma([a(p,c.error)]);let l=Reflect.apply(n,this,c.data),u=o._def.returns.safeParse(l,s);if(!u.success)throw new ma([i(l,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ua.create(e).rest(at.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new t({args:e||Ua.create([]).rest(at.create()),returns:r||at.create(),typeName:te.ZodFunction,...le(a)})}},Ht=class extends ce{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ht.create=(t,e)=>new Ht({getter:t,typeName:te.ZodLazy,...le(e)});var Vt=class extends ce{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Z(r,{received:r.data,code:U.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:e.data}}get value(){return this._def.value}};Vt.create=(t,e)=>new Vt({value:t,typeName:te.ZodLiteral,...le(e)});function Vv(t,e){return new Zt({values:t,typeName:te.ZodEnum,...le(e)})}var Zt=class t extends ce{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return Z(r,{expected:ve.joinValues(a),received:r.parsedType,code:U.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),a=this._def.values;return Z(r,{received:r.data,code:U.invalid_enum_value,options:a}),ae}return ta(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Zt.create=Vv;var Gt=class extends ce{_parse(e){let r=ve.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==W.string&&a.parsedType!==W.number){let i=ve.objectValues(r);return Z(a,{expected:ve.joinValues(i),received:a.parsedType,code:U.invalid_type}),ae}if(this._cache||(this._cache=new Set(ve.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ve.objectValues(r);return Z(a,{received:a.data,code:U.invalid_enum_value,options:i}),ae}return ta(e.data)}get enum(){return this._def.values}};Gt.create=(t,e)=>new Gt({values:t,typeName:te.ZodNativeEnum,...le(e)});var ft=class extends ce{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.promise&&r.common.async===!1)return Z(r,{code:U.invalid_type,expected:W.promise,received:r.parsedType}),ae;let a=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return ta(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ft.create=(t,e)=>new ft({type:t,typeName:te.ZodPromise,...le(e)});var ha=class extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:n=>{Z(a,n),n.fatal?r.abort():r.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let n=i.transform(a.data,s);if(a.common.async)return Promise.resolve(n).then(async o=>{if(r.value==="aborted")return ae;let p=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return p.status==="aborted"?ae:p.status==="dirty"||r.value==="dirty"?Ir(p.value):p});{if(r.value==="aborted")return ae;let o=this._def.schema._parseSync({data:n,path:a.path,parent:a});return o.status==="aborted"?ae:o.status==="dirty"||r.value==="dirty"?Ir(o.value):o}}if(i.type==="refinement"){let n=o=>{let p=i.refinement(o,s);if(a.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?ae:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?ae:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(a.common.async===!1){let n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Nt(n))return ae;let o=i.transform(n.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(n=>Nt(n)?Promise.resolve(i.transform(n.value,s)).then(o=>({status:r.value,value:o})):ae);ve.assertNever(i)}};ha.create=(t,e,r)=>new ha({schema:t,typeName:te.ZodEffects,effect:e,...le(r)});ha.createWithPreprocess=(t,e,r)=>new ha({schema:e,effect:{type:"preprocess",transform:t},typeName:te.ZodEffects,...le(r)});var Ea=class extends ce{_parse(e){return this._getType(e)===W.undefined?ta(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ea.create=(t,e)=>new Ea({innerType:t,typeName:te.ZodOptional,...le(e)});var Ba=class extends ce{_parse(e){return this._getType(e)===W.null?ta(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:te.ZodNullable,...le(e)});var Wt=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===W.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Wt.create=(t,e)=>new Wt({innerType:t,typeName:te.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...le(e)});var Xt=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return jn(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ma(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ma(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Xt.create=(t,e)=>new Xt({innerType:t,typeName:te.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...le(e)});var Lr=class extends ce{_parse(e){if(this._getType(e)!==W.nan){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.nan,received:a.parsedType}),ae}return{status:"valid",value:e.data}}};Lr.create=t=>new Lr({typeName:te.ZodNaN,...le(t)});var rT=Symbol("zod_brand"),Dn=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Nn=class t extends ce{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ae:s.status==="dirty"?(r.dirty(),Ir(s.value)):this._def.out._parseAsync({data:s.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ae:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(e,r){return new t({in:e,out:r,typeName:te.ZodPipeline})}},Kt=class extends ce{_parse(e){let r=this._def.innerType._parse(e),a=i=>(Nt(i)&&(i.value=Object.freeze(i.value)),i);return jn(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};Kt.create=(t,e)=>new Kt({innerType:t,typeName:te.ZodReadonly,...le(e)});function yv(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Zv(t,e={},r){return t?dt.create().superRefine((a,i)=>{let s=t(a);if(s instanceof Promise)return s.then(n=>{if(!n){let o=yv(e,a),p=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:p})}});if(!s){let n=yv(e,a),o=n.fatal??r??!0;i.addIssue({code:"custom",...n,fatal:o})}}):dt.create()}var nT={object:ca.lazycreate},te;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(te||(te={}));var iT=(t,e={message:`Input not instance of ${t.name}`})=>Zv(r=>r instanceof t,e),Gv=ut.create,Wv=qt.create,sT=Lr.create,oT=$t.create,Xv=Lt.create,cT=Ft.create,pT=Dr.create,lT=Mt.create,uT=zt.create,dT=dt.create,fT=at.create,mT=Aa.create,hT=Nr.create,vT=tt.create,gT=ca.create,xT=ca.strictCreate,yT=Ut.create,bT=Yi.create,wT=Bt.create,_T=Ua.create,ET=es.create,ST=qr.create,kT=$r.create,PT=as.create,TT=Ht.create,RT=Vt.create,OT=Zt.create,CT=Gt.create,AT=ft.create,bv=ha.create,IT=Ea.create,jT=Ba.create,DT=ha.createWithPreprocess,NT=Nn.create,qT=()=>Gv().optional(),$T=()=>Wv().optional(),LT=()=>Xv().optional(),FT={string:t=>ut.create({...t,coerce:!0}),number:t=>qt.create({...t,coerce:!0}),boolean:t=>Lt.create({...t,coerce:!0}),bigint:t=>$t.create({...t,coerce:!0}),date:t=>Ft.create({...t,coerce:!0})},MT=ae;var is="2.0",Kv=m.union([m.string(),m.number().int()]),Qv=m.string(),zT=m.object({progressToken:m.optional(Kv)}).passthrough(),ka=m.object({_meta:m.optional(zT)}).passthrough(),pa=m.object({method:m.string(),params:m.optional(ka)}),$n=m.object({_meta:m.optional(m.object({}).passthrough())}).passthrough(),Ha=m.object({method:m.string(),params:m.optional($n)}),Pa=m.object({_meta:m.optional(m.object({}).passthrough())}).passthrough(),ss=m.union([m.string(),m.number().int()]),UT=m.object({jsonrpc:m.literal(is),id:ss}).merge(pa).strict();var BT=m.object({jsonrpc:m.literal(is)}).merge(Ha).strict();var HT=m.object({jsonrpc:m.literal(is),id:ss,result:Pa}).strict();var wv;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(wv||(wv={}));var VT=m.object({jsonrpc:m.literal(is),id:ss,error:m.object({code:m.number().int(),message:m.string(),data:m.optional(m.unknown())})}).strict();var L6=m.union([UT,BT,HT,VT]),Jv=Pa.strict(),Yv=Ha.extend({method:m.literal("notifications/cancelled"),params:$n.extend({requestId:ss,reason:m.string().optional()})}),Ln=m.object({name:m.string(),title:m.optional(m.string())}).passthrough(),eg=Ln.extend({version:m.string()}),ZT=m.object({experimental:m.optional(m.object({}).passthrough()),sampling:m.optional(m.object({}).passthrough()),elicitation:m.optional(m.object({}).passthrough()),roots:m.optional(m.object({listChanged:m.optional(m.boolean())}).passthrough())}).passthrough(),GT=pa.extend({method:m.literal("initialize"),params:ka.extend({protocolVersion:m.string(),capabilities:ZT,clientInfo:eg})}),WT=m.object({experimental:m.optional(m.object({}).passthrough()),logging:m.optional(m.object({}).passthrough()),completions:m.optional(m.object({}).passthrough()),prompts:m.optional(m.object({listChanged:m.optional(m.boolean())}).passthrough()),resources:m.optional(m.object({subscribe:m.optional(m.boolean()),listChanged:m.optional(m.boolean())}).passthrough()),tools:m.optional(m.object({listChanged:m.optional(m.boolean())}).passthrough())}).passthrough(),XT=Pa.extend({protocolVersion:m.string(),capabilities:WT,serverInfo:eg,instructions:m.optional(m.string())}),KT=Ha.extend({method:m.literal("notifications/initialized")}),ag=pa.extend({method:m.literal("ping")}),QT=m.object({progress:m.number(),total:m.optional(m.number()),message:m.optional(m.string())}).passthrough(),tg=Ha.extend({method:m.literal("notifications/progress"),params:$n.merge(QT).extend({progressToken:Kv})}),os=pa.extend({params:ka.extend({cursor:m.optional(Qv)}).optional()}),cs=Pa.extend({nextCursor:m.optional(Qv)}),rg=m.object({uri:m.string(),mimeType:m.optional(m.string()),_meta:m.optional(m.object({}).passthrough())}).passthrough(),ng=rg.extend({text:m.string()}),qc=m.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),ig=rg.extend({blob:qc}),sg=Ln.extend({uri:m.string(),description:m.optional(m.string()),mimeType:m.optional(m.string()),_meta:m.optional(m.object({}).passthrough())}),JT=Ln.extend({uriTemplate:m.string(),description:m.optional(m.string()),mimeType:m.optional(m.string()),_meta:m.optional(m.object({}).passthrough())}),YT=os.extend({method:m.literal("resources/list")}),e2=cs.extend({resources:m.array(sg)}),a2=os.extend({method:m.literal("resources/templates/list")}),t2=cs.extend({resourceTemplates:m.array(JT)}),r2=pa.extend({method:m.literal("resources/read"),params:ka.extend({uri:m.string()})}),n2=Pa.extend({contents:m.array(m.union([ng,ig]))}),i2=Ha.extend({method:m.literal("notifications/resources/list_changed")}),s2=pa.extend({method:m.literal("resources/subscribe"),params:ka.extend({uri:m.string()})}),o2=pa.extend({method:m.literal("resources/unsubscribe"),params:ka.extend({uri:m.string()})}),c2=Ha.extend({method:m.literal("notifications/resources/updated"),params:$n.extend({uri:m.string()})}),p2=m.object({name:m.string(),description:m.optional(m.string()),required:m.optional(m.boolean())}).passthrough(),l2=Ln.extend({description:m.optional(m.string()),arguments:m.optional(m.array(p2)),_meta:m.optional(m.object({}).passthrough())}),u2=os.extend({method:m.literal("prompts/list")}),d2=cs.extend({prompts:m.array(l2)}),f2=pa.extend({method:m.literal("prompts/get"),params:ka.extend({name:m.string(),arguments:m.optional(m.record(m.string()))})}),$c=m.object({type:m.literal("text"),text:m.string(),_meta:m.optional(m.object({}).passthrough())}).passthrough(),Lc=m.object({type:m.literal("image"),data:qc,mimeType:m.string(),_meta:m.optional(m.object({}).passthrough())}).passthrough(),Fc=m.object({type:m.literal("audio"),data:qc,mimeType:m.string(),_meta:m.optional(m.object({}).passthrough())}).passthrough(),m2=m.object({type:m.literal("resource"),resource:m.union([ng,ig]),_meta:m.optional(m.object({}).passthrough())}).passthrough(),h2=sg.extend({type:m.literal("resource_link")}),og=m.union([$c,Lc,Fc,h2,m2]),v2=m.object({role:m.enum(["user","assistant"]),content:og}).passthrough(),g2=Pa.extend({description:m.optional(m.string()),messages:m.array(v2)}),x2=Ha.extend({method:m.literal("notifications/prompts/list_changed")}),y2=m.object({title:m.optional(m.string()),readOnlyHint:m.optional(m.boolean()),destructiveHint:m.optional(m.boolean()),idempotentHint:m.optional(m.boolean()),openWorldHint:m.optional(m.boolean())}).passthrough(),b2=Ln.extend({description:m.optional(m.string()),inputSchema:m.object({type:m.literal("object"),properties:m.optional(m.object({}).passthrough()),required:m.optional(m.array(m.string()))}).passthrough(),outputSchema:m.optional(m.object({type:m.literal("object"),properties:m.optional(m.object({}).passthrough()),required:m.optional(m.array(m.string()))}).passthrough()),annotations:m.optional(y2),_meta:m.optional(m.object({}).passthrough())}),w2=os.extend({method:m.literal("tools/list")}),_2=cs.extend({tools:m.array(b2)}),cg=Pa.extend({content:m.array(og).default([]),structuredContent:m.object({}).passthrough().optional(),isError:m.optional(m.boolean())}),F6=cg.or(Pa.extend({toolResult:m.unknown()})),E2=pa.extend({method:m.literal("tools/call"),params:ka.extend({name:m.string(),arguments:m.optional(m.record(m.unknown()))})}),S2=Ha.extend({method:m.literal("notifications/tools/list_changed")}),pg=m.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),k2=pa.extend({method:m.literal("logging/setLevel"),params:ka.extend({level:pg})}),P2=Ha.extend({method:m.literal("notifications/message"),params:$n.extend({level:pg,logger:m.optional(m.string()),data:m.unknown()})}),T2=m.object({name:m.string().optional()}).passthrough(),R2=m.object({hints:m.optional(m.array(T2)),costPriority:m.optional(m.number().min(0).max(1)),speedPriority:m.optional(m.number().min(0).max(1)),intelligencePriority:m.optional(m.number().min(0).max(1))}).passthrough(),O2=m.object({role:m.enum(["user","assistant"]),content:m.union([$c,Lc,Fc])}).passthrough(),C2=pa.extend({method:m.literal("sampling/createMessage"),params:ka.extend({messages:m.array(O2),systemPrompt:m.optional(m.string()),includeContext:m.optional(m.enum(["none","thisServer","allServers"])),temperature:m.optional(m.number()),maxTokens:m.number().int(),stopSequences:m.optional(m.array(m.string())),metadata:m.optional(m.object({}).passthrough()),modelPreferences:m.optional(R2)})}),A2=Pa.extend({model:m.string(),stopReason:m.optional(m.enum(["endTurn","stopSequence","maxTokens"]).or(m.string())),role:m.enum(["user","assistant"]),content:m.discriminatedUnion("type",[$c,Lc,Fc])}),I2=m.object({type:m.literal("boolean"),title:m.optional(m.string()),description:m.optional(m.string()),default:m.optional(m.boolean())}).passthrough(),j2=m.object({type:m.literal("string"),title:m.optional(m.string()),description:m.optional(m.string()),minLength:m.optional(m.number()),maxLength:m.optional(m.number()),format:m.optional(m.enum(["email","uri","date","date-time"]))}).passthrough(),D2=m.object({type:m.enum(["number","integer"]),title:m.optional(m.string()),description:m.optional(m.string()),minimum:m.optional(m.number()),maximum:m.optional(m.number())}).passthrough(),N2=m.object({type:m.literal("string"),title:m.optional(m.string()),description:m.optional(m.string()),enum:m.array(m.string()),enumNames:m.optional(m.array(m.string()))}).passthrough(),q2=m.union([I2,j2,D2,N2]),$2=pa.extend({method:m.literal("elicitation/create"),params:ka.extend({message:m.string(),requestedSchema:m.object({type:m.literal("object"),properties:m.record(m.string(),q2),required:m.optional(m.array(m.string()))}).passthrough()})}),L2=Pa.extend({action:m.enum(["accept","decline","cancel"]),content:m.optional(m.record(m.string(),m.unknown()))}),F2=m.object({type:m.literal("ref/resource"),uri:m.string()}).passthrough(),M2=m.object({type:m.literal("ref/prompt"),name:m.string()}).passthrough(),z2=pa.extend({method:m.literal("completion/complete"),params:ka.extend({ref:m.union([M2,F2]),argument:m.object({name:m.string(),value:m.string()}).passthrough(),context:m.optional(m.object({arguments:m.optional(m.record(m.string(),m.string()))}))})}),U2=Pa.extend({completion:m.object({values:m.array(m.string()).max(100),total:m.optional(m.number().int()),hasMore:m.optional(m.boolean())}).passthrough()}),B2=m.object({uri:m.string().startsWith("file://"),name:m.optional(m.string()),_meta:m.optional(m.object({}).passthrough())}).passthrough(),H2=pa.extend({method:m.literal("roots/list")}),V2=Pa.extend({roots:m.array(B2)}),Z2=Ha.extend({method:m.literal("notifications/roots/list_changed")}),M6=m.union([ag,GT,z2,k2,f2,u2,YT,a2,r2,s2,o2,E2,w2]),z6=m.union([Yv,tg,KT,Z2]),U6=m.union([Jv,A2,L2,V2]),B6=m.union([ag,C2,$2,H2]),H6=m.union([Yv,tg,P2,c2,i2,S2,x2]),V6=m.union([Jv,XT,U2,g2,d2,e2,t2,n2,cg,_2]);var Z6=G4(R8(),1);var G6=Symbol("Let zodToJsonSchema decide on which parser to use");var W6=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Cc;(function(t){t.Completable="McpCompletable"})(Cc||(Cc={}));var ts=class extends ce{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}};ts.create=(t,e)=>new ts({type:t,typeName:Cc.Completable,complete:e.complete,...G2(e)});function G2(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:i}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(n,o)=>{var p,c;let{message:l}=t;return n.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:(p=l??a)!==null&&p!==void 0?p:o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:(c=l??r)!==null&&c!==void 0?c:o.defaultError}},description:i}}function lg({prompt:t,options:e}){let{systemPrompt:r,settingSources:a,...i}=e??{},s,n;r===void 0?s="":typeof r=="string"?s=r:r.type==="preset"&&(n=r.append);let o=i.pathToClaudeCodeExecutable;if(!o){let p=(0,Pv.fileURLToPath)(W2.url),c=(0,bc.join)(p,"..");o=(0,bc.join)(c,"cli.js")}return process.env.CLAUDE_AGENT_SDK_VERSION="0.1.23",AP({prompt:t,options:{...i,pathToClaudeCodeExecutable:o,customSystemPrompt:s,appendSystemPrompt:n,settingSources:a??[]}})}var mg=vs(require("better-sqlite3"),1);var ra=require("path"),Mc=require("os"),zc=require("fs");var ug=require("url"),K2={};function X2(){return typeof __dirname<"u"?__dirname:(0,ra.dirname)((0,ug.fileURLToPath)(K2.url))}var Q6=X2(),mt=process.env.CLAUDE_MEM_DATA_DIR||(0,ra.join)((0,Mc.homedir)(),".claude-mem"),Uc=process.env.CLAUDE_CONFIG_DIR||(0,ra.join)((0,Mc.homedir)(),".claude"),J6=(0,ra.join)(mt,"archives"),Y6=(0,ra.join)(mt,"logs"),eO=(0,ra.join)(mt,"trash"),aO=(0,ra.join)(mt,"backups"),tO=(0,ra.join)(mt,"settings.json"),dg=(0,ra.join)(mt,"claude-mem.db"),rO=(0,ra.join)(Uc,"settings.json"),nO=(0,ra.join)(Uc,"commands"),iO=(0,ra.join)(Uc,"CLAUDE.md");function fg(t){(0,zc.mkdirSync)(t,{recursive:!0})}var Bc=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.SILENT=4]="SILENT",s))(Bc||{}),Hc=class{level;useColor;constructor(){let e=process.env.CLAUDE_MEM_LOG_LEVEL?.toUpperCase()||"INFO";this.level=Bc[e]??1,this.useColor=process.stdout.isTTY??!1}correlationId(e,r){return`obs-${e}-${r}`}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.level===0?`${e.message} +`):K.streamInput(t),K}var m={};W4(m,{void:()=>hT,util:()=>ve,unknown:()=>fT,union:()=>yT,undefined:()=>lT,tuple:()=>_T,transformer:()=>bv,symbol:()=>pT,string:()=>Gv,strictObject:()=>xT,setErrorMap:()=>DP,set:()=>kT,record:()=>ET,quotelessJson:()=>IP,promise:()=>AT,preprocess:()=>DT,pipeline:()=>NT,ostring:()=>qT,optional:()=>IT,onumber:()=>$T,oboolean:()=>LT,objectUtil:()=>Pc,object:()=>gT,number:()=>Wv,nullable:()=>jT,null:()=>uT,never:()=>mT,nativeEnum:()=>CT,nan:()=>sT,map:()=>ST,makeIssue:()=>Ji,literal:()=>RT,lazy:()=>TT,late:()=>nT,isValid:()=>Nt,isDirty:()=>Rc,isAsync:()=>jn,isAborted:()=>Tc,intersection:()=>wT,instanceof:()=>iT,getParsedType:()=>Ya,getErrorMap:()=>Qi,function:()=>PT,enum:()=>OT,effect:()=>bv,discriminatedUnion:()=>bT,defaultErrorMap:()=>jr,datetimeRegex:()=>Hv,date:()=>cT,custom:()=>Zv,coerce:()=>FT,boolean:()=>Xv,bigint:()=>oT,array:()=>vT,any:()=>dT,addIssueToContext:()=>Z,ZodVoid:()=>Nr,ZodUnknown:()=>at,ZodUnion:()=>Ut,ZodUndefined:()=>Mt,ZodType:()=>pe,ZodTuple:()=>Ua,ZodTransformer:()=>ha,ZodSymbol:()=>Dr,ZodString:()=>ut,ZodSet:()=>$r,ZodSchema:()=>pe,ZodRecord:()=>es,ZodReadonly:()=>Kt,ZodPromise:()=>ft,ZodPipeline:()=>Nn,ZodParsedType:()=>W,ZodOptional:()=>Ea,ZodObject:()=>ca,ZodNumber:()=>qt,ZodNullable:()=>Ba,ZodNull:()=>zt,ZodNever:()=>Aa,ZodNativeEnum:()=>Gt,ZodNaN:()=>Lr,ZodMap:()=>qr,ZodLiteral:()=>Vt,ZodLazy:()=>Ht,ZodIssueCode:()=>U,ZodIntersection:()=>Bt,ZodFunction:()=>as,ZodFirstPartyTypeKind:()=>te,ZodError:()=>ma,ZodEnum:()=>Zt,ZodEffects:()=>ha,ZodDiscriminatedUnion:()=>Yi,ZodDefault:()=>Wt,ZodDate:()=>Ft,ZodCatch:()=>Xt,ZodBranded:()=>Dn,ZodBoolean:()=>Lt,ZodBigInt:()=>$t,ZodArray:()=>tt,ZodAny:()=>dt,Schema:()=>pe,ParseStatus:()=>Je,OK:()=>ta,NEVER:()=>MT,INVALID:()=>ae,EMPTY_PATH:()=>NP,DIRTY:()=>Ir,BRAND:()=>rT});var ve;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let s={};for(let n of i)s[n]=n;return s},t.getValidEnumValues=i=>{let s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),n={};for(let o of s)n[o]=i[o];return t.objectValues(n)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let n in i)Object.prototype.hasOwnProperty.call(i,n)&&s.push(n);return s},t.find=(i,s)=>{for(let n of i)if(s(n))return n},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function a(i,s=" | "){return i.map(n=>typeof n=="string"?`'${n}'`:n).join(s)}t.joinValues=a,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ve||(ve={}));var Pc;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Pc||(Pc={}));var W=ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ya=t=>{switch(typeof t){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(t)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(t)?W.array:t===null?W.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?W.promise:typeof Map<"u"&&t instanceof Map?W.map:typeof Set<"u"&&t instanceof Set?W.set:typeof Date<"u"&&t instanceof Date?W.date:W.object;default:return W.unknown}},U=ve.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"]),IP=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ma=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},a={_errors:[]},i=s=>{for(let n of s.issues)if(n.code==="invalid_union")n.unionErrors.map(i);else if(n.code==="invalid_return_type")i(n.returnTypeError);else if(n.code==="invalid_arguments")i(n.argumentsError);else if(n.path.length===0)a._errors.push(r(n));else{let o=a,p=0;for(;pr.message){let r={},a=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];r[s]=r[s]||[],r[s].push(e(i))}else a.push(e(i));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};ma.create=t=>new ma(t);var jP=(t,e)=>{let r;switch(t.code){case U.invalid_type:t.received===W.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case U.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ve.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:r=`Unrecognized key(s) in object: ${ve.joinValues(t.keys,", ")}`;break;case U.invalid_union:r="Invalid input";break;case U.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ve.joinValues(t.options)}`;break;case U.invalid_enum_value:r=`Invalid enum value. Expected ${ve.joinValues(t.options)}, received '${t.received}'`;break;case U.invalid_arguments:r="Invalid function arguments";break;case U.invalid_return_type:r="Invalid function return type";break;case U.invalid_date:r="Invalid date";break;case U.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ve.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case U.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case U.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case U.custom:r="Invalid input";break;case U.invalid_intersection_types:r="Intersection results could not be merged";break;case U.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case U.not_finite:r="Number must be finite";break;default:r=e.defaultError,ve.assertNever(t)}return{message:r}},jr=jP,zv=jr;function DP(t){zv=t}function Qi(){return zv}var Ji=t=>{let{data:e,path:r,errorMaps:a,issueData:i}=t,s=[...r,...i.path||[]],n={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",p=a.filter(c=>!!c).slice().reverse();for(let c of p)o=c(n,{data:e,defaultError:o}).message;return{...i,path:s,message:o}},NP=[];function Z(t,e){let r=Qi(),a=Ji({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===jr?void 0:jr].filter(i=>!!i)});t.common.issues.push(a)}var Je=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let a=[];for(let i of r){if(i.status==="aborted")return ae;i.status==="dirty"&&e.dirty(),a.push(i.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let i of r){let s=await i.key,n=await i.value;a.push({key:s,value:n})}return t.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let i of r){let{key:s,value:n}=i;if(s.status==="aborted"||n.status==="aborted")return ae;s.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof n.value<"u"||i.alwaysSet)&&(a[s.value]=n.value)}return{status:e.value,value:a}}},ae=Object.freeze({status:"aborted"}),Ir=t=>({status:"dirty",value:t}),ta=t=>({status:"valid",value:t}),Tc=t=>t.status==="aborted",Rc=t=>t.status==="dirty",Nt=t=>t.status==="valid",jn=t=>typeof Promise<"u"&&t instanceof Promise,Q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var Sa=class{constructor(e,r,a,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=a,this._key=i}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}},xv=(t,e)=>{if(Nt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ma(t.common.issues);return this._error=r,this._error}}};function le(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:i}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(n,o)=>{let{message:p}=t;return n.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:p??a??o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:p??r??o.defaultError}},description:i}}var pe=class{get description(){return this._def.description}_getType(e){return Ya(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ya(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Je,ctx:{common:e.parent.common,data:e.data,parsedType:Ya(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(jn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let a=this.safeParse(e,r);if(a.success)return a.data;throw a.error}safeParse(e,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ya(e)},i=this._parseSync({data:e,path:a.path,parent:a});return xv(a,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ya(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:r});return Nt(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>Nt(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(e,r){let a=await this.safeParseAsync(e,r);if(a.success)return a.data;throw a.error}async safeParseAsync(e,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ya(e)},i=this._parse({data:e,path:a.path,parent:a}),s=await(jn(i)?i:Promise.resolve(i));return xv(a,s)}refine(e,r){let a=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,s)=>{let n=e(i),o=()=>s.addIssue({code:U.custom,...a(i)});return typeof Promise<"u"&&n instanceof Promise?n.then(p=>p?!0:(o(),!1)):n?!0:(o(),!1)})}refinement(e,r){return this._refinement((a,i)=>e(a)?!0:(i.addIssue(typeof r=="function"?r(a,i):r),!1))}_refinement(e){return new ha({schema:this,typeName:te.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:r=>this["~validate"](r)}}optional(){return Ea.create(this,this._def)}nullable(){return Ba.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tt.create(this)}promise(){return ft.create(this,this._def)}or(e){return Ut.create([this,e],this._def)}and(e){return Bt.create(this,e,this._def)}transform(e){return new ha({...le(this._def),schema:this,typeName:te.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Wt({...le(this._def),innerType:this,defaultValue:r,typeName:te.ZodDefault})}brand(){return new Dn({typeName:te.ZodBranded,type:this,...le(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Xt({...le(this._def),innerType:this,catchValue:r,typeName:te.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Nn.create(this,e)}readonly(){return Kt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qP=/^c[^\s-]{8,}$/i,$P=/^[0-9a-z]+$/,LP=/^[0-9A-HJKMNP-TV-Z]{26}$/i,FP=/^[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,MP=/^[a-z0-9_-]{21}$/i,zP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,UP=/^[-+]?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)?)??$/,BP=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,HP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xc,VP=/^(?:(?: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])$/,ZP=/^(?:(?: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])$/,GP=/^(([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]))$/,WP=/^(([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])$/,XP=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,KP=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Uv="((\\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])))",QP=new RegExp(`^${Uv}$`);function Bv(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function JP(t){return new RegExp(`^${Bv(t)}$`)}function Hv(t){let e=`${Uv}T${Bv(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function YP(t,e){return!!((e==="v4"||!e)&&VP.test(t)||(e==="v6"||!e)&&GP.test(t))}function eT(t,e){if(!zP.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function aT(t,e){return!!((e==="v4"||!e)&&ZP.test(t)||(e==="v6"||!e)&&WP.test(t))}var ut=class t extends pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let s=this._getOrReturnCtx(e);return Z(s,{code:U.invalid_type,expected:W.string,received:s.parsedType}),ae}let a=new Je,i;for(let s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),Z(i,{code:U.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){let n=e.data.length>s.value,o=e.data.lengthe.test(i),{validation:r,code:U.invalid_string,...Q.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.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,...Q.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,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Q.errToObj(r)})}nonempty(e){return this.min(1,Q.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew ut({checks:[],typeName:te.ZodString,coerce:t?.coerce??!1,...le(t)});function tT(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,i=r>a?r:a,s=Number.parseInt(t.toFixed(i).replace(".","")),n=Number.parseInt(e.toFixed(i).replace(".",""));return s%n/10**i}var qt=class t extends pe{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)!==W.number){let s=this._getOrReturnCtx(e);return Z(s,{code:U.invalid_type,expected:W.number,received:s.parsedType}),ae}let a,i=new Je;for(let s of this._def.checks)s.kind==="int"?ve.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:U.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),Z(a,{code:U.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?tT(e.data,s.value)!==0&&(a=this._getOrReturnCtx(e,a),Z(a,{code:U.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:U.not_finite,message:s.message}),i.dirty()):ve.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuee.kind==="int"||e.kind==="multipleOf"&&ve.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.valuenew qt({checks:[],typeName:te.ZodNumber,coerce:t?.coerce||!1,...le(t)});var $t=class t extends pe{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)!==W.bigint)return this._getInvalidInput(e);let a,i=new Je;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),Z(a,{code:U.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),Z(a,{code:U.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):ve.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Z(r,{code:U.invalid_type,expected:W.bigint,received:r.parsedType}),ae}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,a,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew $t({checks:[],typeName:te.ZodBigInt,coerce:t?.coerce??!1,...le(t)});var Lt=class extends pe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.boolean,received:a.parsedType}),ae}return ta(e.data)}};Lt.create=t=>new Lt({typeName:te.ZodBoolean,coerce:t?.coerce||!1,...le(t)});var Ft=class t extends pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==W.date){let s=this._getOrReturnCtx(e);return Z(s,{code:U.invalid_type,expected:W.date,received:s.parsedType}),ae}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return Z(s,{code:U.invalid_date}),ae}let a=new Je,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),Z(i,{code:U.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):ve.assertNever(s);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Q.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.valuenew Ft({checks:[],coerce:t?.coerce||!1,typeName:te.ZodDate,...le(t)});var Dr=class extends pe{_parse(e){if(this._getType(e)!==W.symbol){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.symbol,received:a.parsedType}),ae}return ta(e.data)}};Dr.create=t=>new Dr({typeName:te.ZodSymbol,...le(t)});var Mt=class extends pe{_parse(e){if(this._getType(e)!==W.undefined){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.undefined,received:a.parsedType}),ae}return ta(e.data)}};Mt.create=t=>new Mt({typeName:te.ZodUndefined,...le(t)});var zt=class extends pe{_parse(e){if(this._getType(e)!==W.null){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.null,received:a.parsedType}),ae}return ta(e.data)}};zt.create=t=>new zt({typeName:te.ZodNull,...le(t)});var dt=class extends pe{constructor(){super(...arguments),this._any=!0}_parse(e){return ta(e.data)}};dt.create=t=>new dt({typeName:te.ZodAny,...le(t)});var at=class extends pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ta(e.data)}};at.create=t=>new at({typeName:te.ZodUnknown,...le(t)});var Aa=class extends pe{_parse(e){let r=this._getOrReturnCtx(e);return Z(r,{code:U.invalid_type,expected:W.never,received:r.parsedType}),ae}};Aa.create=t=>new Aa({typeName:te.ZodNever,...le(t)});var Nr=class extends pe{_parse(e){if(this._getType(e)!==W.undefined){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.void,received:a.parsedType}),ae}return ta(e.data)}};Nr.create=t=>new Nr({typeName:te.ZodVoid,...le(t)});var tt=class t extends pe{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),i=this._def;if(r.parsedType!==W.array)return Z(r,{code:U.invalid_type,expected:W.array,received:r.parsedType}),ae;if(i.exactLength!==null){let n=r.data.length>i.exactLength.value,o=r.data.lengthi.maxLength.value&&(Z(r,{code:U.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>i.type._parseAsync(new Sa(r,n,r.path,o)))).then(n=>Je.mergeArray(a,n));let s=[...r.data].map((n,o)=>i.type._parseSync(new Sa(r,n,r.path,o)));return Je.mergeArray(a,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};tt.create=(t,e)=>new tt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:te.ZodArray,...le(e)});function Ar(t){if(t instanceof ca){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=Ea.create(Ar(a))}return new ca({...t._def,shape:()=>e})}else return t instanceof tt?new tt({...t._def,type:Ar(t.element)}):t instanceof Ea?Ea.create(Ar(t.unwrap())):t instanceof Ba?Ba.create(Ar(t.unwrap())):t instanceof Ua?Ua.create(t.items.map(e=>Ar(e))):t}var ca=class t extends pe{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(),r=ve.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==W.object){let c=this._getOrReturnCtx(e);return Z(c,{code:U.invalid_type,expected:W.object,received:c.parsedType}),ae}let{status:a,ctx:i}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof Aa&&this._def.unknownKeys==="strip"))for(let c in i.data)n.includes(c)||o.push(c);let p=[];for(let c of n){let l=s[c],u=i.data[c];p.push({key:{status:"valid",value:c},value:l._parse(new Sa(i,u,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Aa){let c=this._def.unknownKeys;if(c==="passthrough")for(let l of o)p.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")o.length>0&&(Z(i,{code:U.unrecognized_keys,keys:o}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let l of o){let u=i.data[l];p.push({key:{status:"valid",value:l},value:c._parse(new Sa(i,u,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let l of p){let u=await l.key,d=await l.value;c.push({key:u,value:d,alwaysSet:l.alwaysSet})}return c}).then(c=>Je.mergeObjectSync(a,c)):Je.mergeObjectSync(a,p)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{let i=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:te.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let a of ve.objectKeys(e))e[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let a of ve.objectKeys(this.shape))e[a]||(r[a]=this.shape[a]);return new t({...this._def,shape:()=>r})}deepPartial(){return Ar(this)}partial(e){let r={};for(let a of ve.objectKeys(this.shape)){let i=this.shape[a];e&&!e[a]?r[a]=i:r[a]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let a of ve.objectKeys(this.shape))if(e&&!e[a])r[a]=this.shape[a];else{let s=this.shape[a];for(;s instanceof Ea;)s=s._def.innerType;r[a]=s}return new t({...this._def,shape:()=>r})}keyof(){return Vv(ve.objectKeys(this.shape))}};ca.create=(t,e)=>new ca({shape:()=>t,unknownKeys:"strip",catchall:Aa.create(),typeName:te.ZodObject,...le(e)});ca.strictCreate=(t,e)=>new ca({shape:()=>t,unknownKeys:"strict",catchall:Aa.create(),typeName:te.ZodObject,...le(e)});ca.lazycreate=(t,e)=>new ca({shape:t,unknownKeys:"strip",catchall:Aa.create(),typeName:te.ZodObject,...le(e)});var Ut=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),a=this._def.options;function i(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let n=s.map(o=>new ma(o.ctx.common.issues));return Z(r,{code:U.invalid_union,unionErrors:n}),ae}if(r.common.async)return Promise.all(a.map(async s=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(i);{let s,n=[];for(let p of a){let c={...r,common:{...r.common,issues:[]},parent:null},l=p._parseSync({data:r.data,path:r.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:c}),c.common.issues.length&&n.push(c.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map(p=>new ma(p));return Z(r,{code:U.invalid_union,unionErrors:o}),ae}}get options(){return this._def.options}};Ut.create=(t,e)=>new Ut({options:t,typeName:te.ZodUnion,...le(e)});var Ja=t=>t instanceof Ht?Ja(t.schema):t instanceof ha?Ja(t.innerType()):t instanceof Vt?[t.value]:t instanceof Zt?t.options:t instanceof Gt?ve.objectValues(t.enum):t instanceof Wt?Ja(t._def.innerType):t instanceof Mt?[void 0]:t instanceof zt?[null]:t instanceof Ea?[void 0,...Ja(t.unwrap())]:t instanceof Ba?[null,...Ja(t.unwrap())]:t instanceof Dn||t instanceof Kt?Ja(t.unwrap()):t instanceof Xt?Ja(t._def.innerType):[],Yi=class t extends pe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return Z(r,{code:U.invalid_type,expected:W.object,received:r.parsedType}),ae;let a=this.discriminator,i=r.data[a],s=this.optionsMap.get(i);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(Z(r,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let i=new Map;for(let s of r){let n=Ja(s.shape[e]);if(!n.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of n){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new t({typeName:te.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...le(a)})}};function Oc(t,e){let r=Ya(t),a=Ya(e);if(t===e)return{valid:!0,data:t};if(r===W.object&&a===W.object){let i=ve.objectKeys(e),s=ve.objectKeys(t).filter(o=>i.indexOf(o)!==-1),n={...t,...e};for(let o of s){let p=Oc(t[o],e[o]);if(!p.valid)return{valid:!1};n[o]=p.data}return{valid:!0,data:n}}else if(r===W.array&&a===W.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let s=0;s{if(Tc(s)||Tc(n))return ae;let o=Oc(s.value,n.value);return o.valid?((Rc(s)||Rc(n))&&r.dirty(),{status:r.value,value:o.data}):(Z(a,{code:U.invalid_intersection_types}),ae)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([s,n])=>i(s,n)):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Bt.create=(t,e,r)=>new Bt({left:t,right:e,typeName:te.ZodIntersection,...le(r)});var Ua=class t extends pe{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==W.array)return Z(a,{code:U.invalid_type,expected:W.array,received:a.parsedType}),ae;if(a.data.lengththis._def.items.length&&(Z(a,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...a.data].map((n,o)=>{let p=this._def.items[o]||this._def.rest;return p?p._parse(new Sa(a,n,a.path,o)):null}).filter(n=>!!n);return a.common.async?Promise.all(s).then(n=>Je.mergeArray(r,n)):Je.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ua.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ua({items:t,typeName:te.ZodTuple,rest:null,...le(e)})};var es=class t extends pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==W.object)return Z(a,{code:U.invalid_type,expected:W.object,received:a.parsedType}),ae;let i=[],s=this._def.keyType,n=this._def.valueType;for(let o in a.data)i.push({key:s._parse(new Sa(a,o,a.path,o)),value:n._parse(new Sa(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?Je.mergeObjectAsync(r,i):Je.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof pe?new t({keyType:e,valueType:r,typeName:te.ZodRecord,...le(a)}):new t({keyType:ut.create(),valueType:e,typeName:te.ZodRecord,...le(r)})}},qr=class extends pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==W.map)return Z(a,{code:U.invalid_type,expected:W.map,received:a.parsedType}),ae;let i=this._def.keyType,s=this._def.valueType,n=[...a.data.entries()].map(([o,p],c)=>({key:i._parse(new Sa(a,o,a.path,[c,"key"])),value:s._parse(new Sa(a,p,a.path,[c,"value"]))}));if(a.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let p of n){let c=await p.key,l=await p.value;if(c.status==="aborted"||l.status==="aborted")return ae;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let p of n){let c=p.key,l=p.value;if(c.status==="aborted"||l.status==="aborted")return ae;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}}}};qr.create=(t,e,r)=>new qr({valueType:e,keyType:t,typeName:te.ZodMap,...le(r)});var $r=class t extends pe{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==W.set)return Z(a,{code:U.invalid_type,expected:W.set,received:a.parsedType}),ae;let i=this._def;i.minSize!==null&&a.data.sizei.maxSize.value&&(Z(a,{code:U.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let s=this._def.valueType;function n(p){let c=new Set;for(let l of p){if(l.status==="aborted")return ae;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}let o=[...a.data.values()].map((p,c)=>s._parse(new Sa(a,p,a.path,c)));return a.common.async?Promise.all(o).then(p=>n(p)):n(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};$r.create=(t,e)=>new $r({valueType:t,minSize:null,maxSize:null,typeName:te.ZodSet,...le(e)});var as=class t extends pe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return Z(r,{code:U.invalid_type,expected:W.function,received:r.parsedType}),ae;function a(o,p){return Ji({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qi(),jr].filter(c=>!!c),issueData:{code:U.invalid_arguments,argumentsError:p}})}function i(o,p){return Ji({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qi(),jr].filter(c=>!!c),issueData:{code:U.invalid_return_type,returnTypeError:p}})}let s={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof ft){let o=this;return ta(async function(...p){let c=new ma([]),l=await o._def.args.parseAsync(p,s).catch(h=>{throw c.addIssue(a(p,h)),c}),u=await Reflect.apply(n,this,l);return await o._def.returns._def.type.parseAsync(u,s).catch(h=>{throw c.addIssue(i(u,h)),c})})}else{let o=this;return ta(function(...p){let c=o._def.args.safeParse(p,s);if(!c.success)throw new ma([a(p,c.error)]);let l=Reflect.apply(n,this,c.data),u=o._def.returns.safeParse(l,s);if(!u.success)throw new ma([i(l,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Ua.create(e).rest(at.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new t({args:e||Ua.create([]).rest(at.create()),returns:r||at.create(),typeName:te.ZodFunction,...le(a)})}},Ht=class extends pe{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ht.create=(t,e)=>new Ht({getter:t,typeName:te.ZodLazy,...le(e)});var Vt=class extends pe{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Z(r,{received:r.data,code:U.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:e.data}}get value(){return this._def.value}};Vt.create=(t,e)=>new Vt({value:t,typeName:te.ZodLiteral,...le(e)});function Vv(t,e){return new Zt({values:t,typeName:te.ZodEnum,...le(e)})}var Zt=class t extends pe{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return Z(r,{expected:ve.joinValues(a),received:r.parsedType,code:U.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),a=this._def.values;return Z(r,{received:r.data,code:U.invalid_enum_value,options:a}),ae}return ta(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};Zt.create=Vv;var Gt=class extends pe{_parse(e){let r=ve.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==W.string&&a.parsedType!==W.number){let i=ve.objectValues(r);return Z(a,{expected:ve.joinValues(i),received:a.parsedType,code:U.invalid_type}),ae}if(this._cache||(this._cache=new Set(ve.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ve.objectValues(r);return Z(a,{received:a.data,code:U.invalid_enum_value,options:i}),ae}return ta(e.data)}get enum(){return this._def.values}};Gt.create=(t,e)=>new Gt({values:t,typeName:te.ZodNativeEnum,...le(e)});var ft=class extends pe{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.promise&&r.common.async===!1)return Z(r,{code:U.invalid_type,expected:W.promise,received:r.parsedType}),ae;let a=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return ta(a.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ft.create=(t,e)=>new ft({type:t,typeName:te.ZodPromise,...le(e)});var ha=class extends pe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:a}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:n=>{Z(a,n),n.fatal?r.abort():r.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let n=i.transform(a.data,s);if(a.common.async)return Promise.resolve(n).then(async o=>{if(r.value==="aborted")return ae;let p=await this._def.schema._parseAsync({data:o,path:a.path,parent:a});return p.status==="aborted"?ae:p.status==="dirty"||r.value==="dirty"?Ir(p.value):p});{if(r.value==="aborted")return ae;let o=this._def.schema._parseSync({data:n,path:a.path,parent:a});return o.status==="aborted"?ae:o.status==="dirty"||r.value==="dirty"?Ir(o.value):o}}if(i.type==="refinement"){let n=o=>{let p=i.refinement(o,s);if(a.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return o.status==="aborted"?ae:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>o.status==="aborted"?ae:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(a.common.async===!1){let n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Nt(n))return ae;let o=i.transform(n.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(n=>Nt(n)?Promise.resolve(i.transform(n.value,s)).then(o=>({status:r.value,value:o})):ae);ve.assertNever(i)}};ha.create=(t,e,r)=>new ha({schema:t,typeName:te.ZodEffects,effect:e,...le(r)});ha.createWithPreprocess=(t,e,r)=>new ha({schema:e,effect:{type:"preprocess",transform:t},typeName:te.ZodEffects,...le(r)});var Ea=class extends pe{_parse(e){return this._getType(e)===W.undefined?ta(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ea.create=(t,e)=>new Ea({innerType:t,typeName:te.ZodOptional,...le(e)});var Ba=class extends pe{_parse(e){return this._getType(e)===W.null?ta(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:te.ZodNullable,...le(e)});var Wt=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return r.parsedType===W.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Wt.create=(t,e)=>new Wt({innerType:t,typeName:te.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...le(e)});var Xt=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),a={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return jn(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ma(a.common.issues)},input:a.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ma(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Xt.create=(t,e)=>new Xt({innerType:t,typeName:te.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...le(e)});var Lr=class extends pe{_parse(e){if(this._getType(e)!==W.nan){let a=this._getOrReturnCtx(e);return Z(a,{code:U.invalid_type,expected:W.nan,received:a.parsedType}),ae}return{status:"valid",value:e.data}}};Lr.create=t=>new Lr({typeName:te.ZodNaN,...le(t)});var rT=Symbol("zod_brand"),Dn=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},Nn=class t extends pe{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?ae:s.status==="dirty"?(r.dirty(),Ir(s.value)):this._def.out._parseAsync({data:s.value,path:a.path,parent:a})})();{let i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?ae:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}static create(e,r){return new t({in:e,out:r,typeName:te.ZodPipeline})}},Kt=class extends pe{_parse(e){let r=this._def.innerType._parse(e),a=i=>(Nt(i)&&(i.value=Object.freeze(i.value)),i);return jn(r)?r.then(i=>a(i)):a(r)}unwrap(){return this._def.innerType}};Kt.create=(t,e)=>new Kt({innerType:t,typeName:te.ZodReadonly,...le(e)});function yv(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Zv(t,e={},r){return t?dt.create().superRefine((a,i)=>{let s=t(a);if(s instanceof Promise)return s.then(n=>{if(!n){let o=yv(e,a),p=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:p})}});if(!s){let n=yv(e,a),o=n.fatal??r??!0;i.addIssue({code:"custom",...n,fatal:o})}}):dt.create()}var nT={object:ca.lazycreate},te;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(te||(te={}));var iT=(t,e={message:`Input not instance of ${t.name}`})=>Zv(r=>r instanceof t,e),Gv=ut.create,Wv=qt.create,sT=Lr.create,oT=$t.create,Xv=Lt.create,cT=Ft.create,pT=Dr.create,lT=Mt.create,uT=zt.create,dT=dt.create,fT=at.create,mT=Aa.create,hT=Nr.create,vT=tt.create,gT=ca.create,xT=ca.strictCreate,yT=Ut.create,bT=Yi.create,wT=Bt.create,_T=Ua.create,ET=es.create,ST=qr.create,kT=$r.create,PT=as.create,TT=Ht.create,RT=Vt.create,OT=Zt.create,CT=Gt.create,AT=ft.create,bv=ha.create,IT=Ea.create,jT=Ba.create,DT=ha.createWithPreprocess,NT=Nn.create,qT=()=>Gv().optional(),$T=()=>Wv().optional(),LT=()=>Xv().optional(),FT={string:t=>ut.create({...t,coerce:!0}),number:t=>qt.create({...t,coerce:!0}),boolean:t=>Lt.create({...t,coerce:!0}),bigint:t=>$t.create({...t,coerce:!0}),date:t=>Ft.create({...t,coerce:!0})},MT=ae;var is="2.0",Kv=m.union([m.string(),m.number().int()]),Qv=m.string(),zT=m.object({progressToken:m.optional(Kv)}).passthrough(),ka=m.object({_meta:m.optional(zT)}).passthrough(),pa=m.object({method:m.string(),params:m.optional(ka)}),$n=m.object({_meta:m.optional(m.object({}).passthrough())}).passthrough(),Ha=m.object({method:m.string(),params:m.optional($n)}),Pa=m.object({_meta:m.optional(m.object({}).passthrough())}).passthrough(),ss=m.union([m.string(),m.number().int()]),UT=m.object({jsonrpc:m.literal(is),id:ss}).merge(pa).strict();var BT=m.object({jsonrpc:m.literal(is)}).merge(Ha).strict();var HT=m.object({jsonrpc:m.literal(is),id:ss,result:Pa}).strict();var wv;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(wv||(wv={}));var VT=m.object({jsonrpc:m.literal(is),id:ss,error:m.object({code:m.number().int(),message:m.string(),data:m.optional(m.unknown())})}).strict();var L6=m.union([UT,BT,HT,VT]),Jv=Pa.strict(),Yv=Ha.extend({method:m.literal("notifications/cancelled"),params:$n.extend({requestId:ss,reason:m.string().optional()})}),Ln=m.object({name:m.string(),title:m.optional(m.string())}).passthrough(),eg=Ln.extend({version:m.string()}),ZT=m.object({experimental:m.optional(m.object({}).passthrough()),sampling:m.optional(m.object({}).passthrough()),elicitation:m.optional(m.object({}).passthrough()),roots:m.optional(m.object({listChanged:m.optional(m.boolean())}).passthrough())}).passthrough(),GT=pa.extend({method:m.literal("initialize"),params:ka.extend({protocolVersion:m.string(),capabilities:ZT,clientInfo:eg})}),WT=m.object({experimental:m.optional(m.object({}).passthrough()),logging:m.optional(m.object({}).passthrough()),completions:m.optional(m.object({}).passthrough()),prompts:m.optional(m.object({listChanged:m.optional(m.boolean())}).passthrough()),resources:m.optional(m.object({subscribe:m.optional(m.boolean()),listChanged:m.optional(m.boolean())}).passthrough()),tools:m.optional(m.object({listChanged:m.optional(m.boolean())}).passthrough())}).passthrough(),XT=Pa.extend({protocolVersion:m.string(),capabilities:WT,serverInfo:eg,instructions:m.optional(m.string())}),KT=Ha.extend({method:m.literal("notifications/initialized")}),ag=pa.extend({method:m.literal("ping")}),QT=m.object({progress:m.number(),total:m.optional(m.number()),message:m.optional(m.string())}).passthrough(),tg=Ha.extend({method:m.literal("notifications/progress"),params:$n.merge(QT).extend({progressToken:Kv})}),os=pa.extend({params:ka.extend({cursor:m.optional(Qv)}).optional()}),cs=Pa.extend({nextCursor:m.optional(Qv)}),rg=m.object({uri:m.string(),mimeType:m.optional(m.string()),_meta:m.optional(m.object({}).passthrough())}).passthrough(),ng=rg.extend({text:m.string()}),qc=m.string().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),ig=rg.extend({blob:qc}),sg=Ln.extend({uri:m.string(),description:m.optional(m.string()),mimeType:m.optional(m.string()),_meta:m.optional(m.object({}).passthrough())}),JT=Ln.extend({uriTemplate:m.string(),description:m.optional(m.string()),mimeType:m.optional(m.string()),_meta:m.optional(m.object({}).passthrough())}),YT=os.extend({method:m.literal("resources/list")}),e2=cs.extend({resources:m.array(sg)}),a2=os.extend({method:m.literal("resources/templates/list")}),t2=cs.extend({resourceTemplates:m.array(JT)}),r2=pa.extend({method:m.literal("resources/read"),params:ka.extend({uri:m.string()})}),n2=Pa.extend({contents:m.array(m.union([ng,ig]))}),i2=Ha.extend({method:m.literal("notifications/resources/list_changed")}),s2=pa.extend({method:m.literal("resources/subscribe"),params:ka.extend({uri:m.string()})}),o2=pa.extend({method:m.literal("resources/unsubscribe"),params:ka.extend({uri:m.string()})}),c2=Ha.extend({method:m.literal("notifications/resources/updated"),params:$n.extend({uri:m.string()})}),p2=m.object({name:m.string(),description:m.optional(m.string()),required:m.optional(m.boolean())}).passthrough(),l2=Ln.extend({description:m.optional(m.string()),arguments:m.optional(m.array(p2)),_meta:m.optional(m.object({}).passthrough())}),u2=os.extend({method:m.literal("prompts/list")}),d2=cs.extend({prompts:m.array(l2)}),f2=pa.extend({method:m.literal("prompts/get"),params:ka.extend({name:m.string(),arguments:m.optional(m.record(m.string()))})}),$c=m.object({type:m.literal("text"),text:m.string(),_meta:m.optional(m.object({}).passthrough())}).passthrough(),Lc=m.object({type:m.literal("image"),data:qc,mimeType:m.string(),_meta:m.optional(m.object({}).passthrough())}).passthrough(),Fc=m.object({type:m.literal("audio"),data:qc,mimeType:m.string(),_meta:m.optional(m.object({}).passthrough())}).passthrough(),m2=m.object({type:m.literal("resource"),resource:m.union([ng,ig]),_meta:m.optional(m.object({}).passthrough())}).passthrough(),h2=sg.extend({type:m.literal("resource_link")}),og=m.union([$c,Lc,Fc,h2,m2]),v2=m.object({role:m.enum(["user","assistant"]),content:og}).passthrough(),g2=Pa.extend({description:m.optional(m.string()),messages:m.array(v2)}),x2=Ha.extend({method:m.literal("notifications/prompts/list_changed")}),y2=m.object({title:m.optional(m.string()),readOnlyHint:m.optional(m.boolean()),destructiveHint:m.optional(m.boolean()),idempotentHint:m.optional(m.boolean()),openWorldHint:m.optional(m.boolean())}).passthrough(),b2=Ln.extend({description:m.optional(m.string()),inputSchema:m.object({type:m.literal("object"),properties:m.optional(m.object({}).passthrough()),required:m.optional(m.array(m.string()))}).passthrough(),outputSchema:m.optional(m.object({type:m.literal("object"),properties:m.optional(m.object({}).passthrough()),required:m.optional(m.array(m.string()))}).passthrough()),annotations:m.optional(y2),_meta:m.optional(m.object({}).passthrough())}),w2=os.extend({method:m.literal("tools/list")}),_2=cs.extend({tools:m.array(b2)}),cg=Pa.extend({content:m.array(og).default([]),structuredContent:m.object({}).passthrough().optional(),isError:m.optional(m.boolean())}),F6=cg.or(Pa.extend({toolResult:m.unknown()})),E2=pa.extend({method:m.literal("tools/call"),params:ka.extend({name:m.string(),arguments:m.optional(m.record(m.unknown()))})}),S2=Ha.extend({method:m.literal("notifications/tools/list_changed")}),pg=m.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),k2=pa.extend({method:m.literal("logging/setLevel"),params:ka.extend({level:pg})}),P2=Ha.extend({method:m.literal("notifications/message"),params:$n.extend({level:pg,logger:m.optional(m.string()),data:m.unknown()})}),T2=m.object({name:m.string().optional()}).passthrough(),R2=m.object({hints:m.optional(m.array(T2)),costPriority:m.optional(m.number().min(0).max(1)),speedPriority:m.optional(m.number().min(0).max(1)),intelligencePriority:m.optional(m.number().min(0).max(1))}).passthrough(),O2=m.object({role:m.enum(["user","assistant"]),content:m.union([$c,Lc,Fc])}).passthrough(),C2=pa.extend({method:m.literal("sampling/createMessage"),params:ka.extend({messages:m.array(O2),systemPrompt:m.optional(m.string()),includeContext:m.optional(m.enum(["none","thisServer","allServers"])),temperature:m.optional(m.number()),maxTokens:m.number().int(),stopSequences:m.optional(m.array(m.string())),metadata:m.optional(m.object({}).passthrough()),modelPreferences:m.optional(R2)})}),A2=Pa.extend({model:m.string(),stopReason:m.optional(m.enum(["endTurn","stopSequence","maxTokens"]).or(m.string())),role:m.enum(["user","assistant"]),content:m.discriminatedUnion("type",[$c,Lc,Fc])}),I2=m.object({type:m.literal("boolean"),title:m.optional(m.string()),description:m.optional(m.string()),default:m.optional(m.boolean())}).passthrough(),j2=m.object({type:m.literal("string"),title:m.optional(m.string()),description:m.optional(m.string()),minLength:m.optional(m.number()),maxLength:m.optional(m.number()),format:m.optional(m.enum(["email","uri","date","date-time"]))}).passthrough(),D2=m.object({type:m.enum(["number","integer"]),title:m.optional(m.string()),description:m.optional(m.string()),minimum:m.optional(m.number()),maximum:m.optional(m.number())}).passthrough(),N2=m.object({type:m.literal("string"),title:m.optional(m.string()),description:m.optional(m.string()),enum:m.array(m.string()),enumNames:m.optional(m.array(m.string()))}).passthrough(),q2=m.union([I2,j2,D2,N2]),$2=pa.extend({method:m.literal("elicitation/create"),params:ka.extend({message:m.string(),requestedSchema:m.object({type:m.literal("object"),properties:m.record(m.string(),q2),required:m.optional(m.array(m.string()))}).passthrough()})}),L2=Pa.extend({action:m.enum(["accept","decline","cancel"]),content:m.optional(m.record(m.string(),m.unknown()))}),F2=m.object({type:m.literal("ref/resource"),uri:m.string()}).passthrough(),M2=m.object({type:m.literal("ref/prompt"),name:m.string()}).passthrough(),z2=pa.extend({method:m.literal("completion/complete"),params:ka.extend({ref:m.union([M2,F2]),argument:m.object({name:m.string(),value:m.string()}).passthrough(),context:m.optional(m.object({arguments:m.optional(m.record(m.string(),m.string()))}))})}),U2=Pa.extend({completion:m.object({values:m.array(m.string()).max(100),total:m.optional(m.number().int()),hasMore:m.optional(m.boolean())}).passthrough()}),B2=m.object({uri:m.string().startsWith("file://"),name:m.optional(m.string()),_meta:m.optional(m.object({}).passthrough())}).passthrough(),H2=pa.extend({method:m.literal("roots/list")}),V2=Pa.extend({roots:m.array(B2)}),Z2=Ha.extend({method:m.literal("notifications/roots/list_changed")}),M6=m.union([ag,GT,z2,k2,f2,u2,YT,a2,r2,s2,o2,E2,w2]),z6=m.union([Yv,tg,KT,Z2]),U6=m.union([Jv,A2,L2,V2]),B6=m.union([ag,C2,$2,H2]),H6=m.union([Yv,tg,P2,c2,i2,S2,x2]),V6=m.union([Jv,XT,U2,g2,d2,e2,t2,n2,cg,_2]);var Z6=G4(R8(),1);var G6=Symbol("Let zodToJsonSchema decide on which parser to use");var W6=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Cc;(function(t){t.Completable="McpCompletable"})(Cc||(Cc={}));var ts=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}};ts.create=(t,e)=>new ts({type:t,typeName:Cc.Completable,complete:e.complete,...G2(e)});function G2(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:i}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(n,o)=>{var p,c;let{message:l}=t;return n.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:(p=l??a)!==null&&p!==void 0?p:o.defaultError}:n.code!=="invalid_type"?{message:o.defaultError}:{message:(c=l??r)!==null&&c!==void 0?c:o.defaultError}},description:i}}function lg({prompt:t,options:e}){let{systemPrompt:r,settingSources:a,...i}=e??{},s,n;r===void 0?s="":typeof r=="string"?s=r:r.type==="preset"&&(n=r.append);let o=i.pathToClaudeCodeExecutable;if(!o){let p=(0,Pv.fileURLToPath)(W2.url),c=(0,bc.join)(p,"..");o=(0,bc.join)(c,"cli.js")}return process.env.CLAUDE_AGENT_SDK_VERSION="0.1.23",AP({prompt:t,options:{...i,pathToClaudeCodeExecutable:o,customSystemPrompt:s,appendSystemPrompt:n,settingSources:a??[]}})}var mg=vs(require("better-sqlite3"),1);var ra=require("path"),Mc=require("os"),zc=require("fs");var ug=require("url"),K2={};function X2(){return typeof __dirname<"u"?__dirname:(0,ra.dirname)((0,ug.fileURLToPath)(K2.url))}var Q6=X2(),mt=process.env.CLAUDE_MEM_DATA_DIR||(0,ra.join)((0,Mc.homedir)(),".claude-mem"),Uc=process.env.CLAUDE_CONFIG_DIR||(0,ra.join)((0,Mc.homedir)(),".claude"),J6=(0,ra.join)(mt,"archives"),Y6=(0,ra.join)(mt,"logs"),eO=(0,ra.join)(mt,"trash"),aO=(0,ra.join)(mt,"backups"),tO=(0,ra.join)(mt,"settings.json"),dg=(0,ra.join)(mt,"claude-mem.db"),rO=(0,ra.join)(Uc,"settings.json"),nO=(0,ra.join)(Uc,"commands"),iO=(0,ra.join)(Uc,"CLAUDE.md");function fg(t){(0,zc.mkdirSync)(t,{recursive:!0})}var Bc=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.SILENT=4]="SILENT",s))(Bc||{}),Hc=class{level;useColor;constructor(){let e=process.env.CLAUDE_MEM_LOG_LEVEL?.toUpperCase()||"INFO";this.level=Bc[e]??1,this.useColor=process.stdout.isTTY??!1}correlationId(e,r){return`obs-${e}-${r}`}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.level===0?`${e.message} ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Object.keys(e);return r.length===0?"{}":r.length<=3?JSON.stringify(e):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,r){if(!r)return e;try{let a=typeof r=="string"?JSON.parse(r):r;if(e==="Bash"&&a.command){let i=a.command.length>50?a.command.substring(0,50)+"...":a.command;return`${e}(${i})`}if(e==="Read"&&a.file_path){let i=a.file_path.split("/").pop()||a.file_path;return`${e}(${i})`}if(e==="Edit"&&a.file_path){let i=a.file_path.split("/").pop()||a.file_path;return`${e}(${i})`}if(e==="Write"&&a.file_path){let i=a.file_path.split("/").pop()||a.file_path;return`${e}(${i})`}return e}catch{return e}}log(e,r,a,i,s){if(e0&&(u=` {${Object.entries(g).map(([y,w])=>`${y}=${w}`).join(", ")}}`)}let d=`[${n}] [${o}] [${p}] ${c}${a}${u}${l}`;e===3?console.error(d):console.log(d)}debug(e,r,a,i){this.log(0,e,r,a,i)}info(e,r,a,i){this.log(1,e,r,a,i)}warn(e,r,a,i){this.log(2,e,r,a,i)}error(e,r,a,i){this.log(3,e,r,a,i)}dataIn(e,r,a,i){this.info(e,`\u2192 ${r}`,a,i)}dataOut(e,r,a,i){this.info(e,`\u2190 ${r}`,a,i)}success(e,r,a,i){this.info(e,`\u2713 ${r}`,a,i)}failure(e,r,a,i){this.error(e,`\u2717 ${r}`,a,i)}timing(e,r,a,i){this.info(e,`\u23F1 ${r}`,i,{duration:`${a}ms`})}},pe=new Hc;var Ia=class{db;constructor(){fg(mt),this.db=new mg.default(dg),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable()}initializeSchema(){try{this.db.exec(` +`+JSON.stringify(s,null,2):l=" "+this.formatData(s));let u="";if(i){let{sessionId:h,sdkSessionId:v,correlationId:f,...g}=i;Object.keys(g).length>0&&(u=` {${Object.entries(g).map(([y,w])=>`${y}=${w}`).join(", ")}}`)}let d=`[${n}] [${o}] [${p}] ${c}${a}${u}${l}`;e===3?console.error(d):console.log(d)}debug(e,r,a,i){this.log(0,e,r,a,i)}info(e,r,a,i){this.log(1,e,r,a,i)}warn(e,r,a,i){this.log(2,e,r,a,i)}error(e,r,a,i){this.log(3,e,r,a,i)}dataIn(e,r,a,i){this.info(e,`\u2192 ${r}`,a,i)}dataOut(e,r,a,i){this.info(e,`\u2190 ${r}`,a,i)}success(e,r,a,i){this.info(e,`\u2713 ${r}`,a,i)}failure(e,r,a,i){this.error(e,`\u2717 ${r}`,a,i)}timing(e,r,a,i){this.info(e,`\u23F1 ${r}`,i,{duration:`${a}ms`})}},oe=new Hc;var Ia=class{db;constructor(){fg(mt),this.db=new mg.default(dg),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),this.initializeSchema(),this.ensureWorkerPortColumn(),this.ensurePromptTrackingColumns(),this.removeSessionSummariesUniqueConstraint(),this.addObservationHierarchicalFields(),this.makeObservationsTextNullable()}initializeSchema(){try{this.db.exec(` CREATE TABLE IF NOT EXISTS schema_versions ( id INTEGER PRIMARY KEY, version INTEGER UNIQUE NOT NULL, @@ -279,7 +279,7 @@ ${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Obje UPDATE sdk_sessions SET sdk_session_id = ? WHERE id = ? AND sdk_session_id IS NULL - `).run(r,e).changes===0?(pe.debug("DB","sdk_session_id already set, skipping update",{sessionId:e,sdkSessionId:r}),!1):!0}setWorkerPort(e,r){this.db.prepare(` + `).run(r,e).changes===0?(oe.debug("DB","sdk_session_id already set, skipping update",{sessionId:e,sdkSessionId:r}),!1):!0}setWorkerPort(e,r){this.db.prepare(` UPDATE sdk_sessions SET worker_port = ? WHERE id = ? @@ -343,7 +343,7 @@ Output observations using this XML structure: [ change | discovery | decision ] [path/to/file] @@ -416,8 +419,8 @@ Output this XML: **Required fields**: request, investigated, learned, completed, next_steps -**Optional fields**: notes`}function xg(t,e){let r=[],a=/([\s\S]*?)<\/observation>/g,i;for(;(i=a.exec(t))!==null;){let s=i[1],n=Va(s,"type"),o=Va(s,"title"),p=Va(s,"subtitle"),c=Va(s,"narrative"),l=ps(s,"facts","fact"),u=ps(s,"concepts","concept"),d=ps(s,"files_read","file"),h=ps(s,"files_modified","file");if(!n||!o||!p||!c){pe.warn("PARSER","Observation missing required fields, skipping",{correlationId:e,hasType:!!n,hasTitle:!!o,hasSubtitle:!!p,hasNarrative:!!c});continue}if(!["change","discovery","decision"].includes(n.trim())){pe.warn("PARSER",`Invalid observation type: ${n}, skipping`,{correlationId:e});continue}r.push({type:n.trim(),title:o,subtitle:p,facts:l,narrative:c,concepts:u,files_read:d,files_modified:h})}return r}function yg(t,e){let a=/([\s\S]*?)<\/summary>/.exec(t);if(!a)return null;let i=a[1],s=Va(i,"request"),n=Va(i,"investigated"),o=Va(i,"learned"),p=Va(i,"completed"),c=Va(i,"next_steps"),l=Va(i,"notes");return!s||!n||!o||!p||!c?(pe.warn("PARSER","Summary missing required fields",{sessionId:e,hasRequest:!!s,hasInvestigated:!!n,hasLearned:!!o,hasCompleted:!!p,hasNextSteps:!!c}),null):{request:s,investigated:n,learned:o,completed:p,next_steps:c,notes:l}}function Va(t,e){let a=new RegExp(`<${e}>([^<]*)`).exec(t);return a?a[1].trim():null}function ps(t,e,r){let a=[],s=new RegExp(`<${e}>(.*?)`,"s").exec(t);if(!s)return a;let n=s[1],o=new RegExp(`<${r}>([^<]+)`,"g"),p;for(;(p=o.exec(n))!==null;)a.push(p[1].trim());return a}var Q2=process.env.CLAUDE_MEM_MODEL||"claude-sonnet-4-5",J2=["Glob","Grep","ListMcpResourcesTool","WebSearch"],ls=parseInt(process.env.CLAUDE_MEM_WORKER_PORT||"37777",10),us=class{app;port=null;sessions=new Map;constructor(){this.app=(0,Vc.default)(),this.app.use(Vc.default.json({limit:"50mb"})),this.app.get("/health",this.handleHealth.bind(this)),this.app.post("/sessions/:sessionDbId/init",this.handleInit.bind(this)),this.app.post("/sessions/:sessionDbId/observations",this.handleObservation.bind(this)),this.app.post("/sessions/:sessionDbId/summarize",this.handleSummarize.bind(this)),this.app.get("/sessions/:sessionDbId/status",this.handleStatus.bind(this)),this.app.delete("/sessions/:sessionDbId",this.handleDelete.bind(this))}async start(){this.port=ls;let e=new Ia,r=e.cleanupOrphanedSessions();return e.close(),r>0&&pe.info("SYSTEM",`Cleaned up ${r} orphaned sessions`),new Promise((a,i)=>{this.app.listen(ls,"127.0.0.1",()=>{pe.info("SYSTEM","Worker started",{port:ls,pid:process.pid,activeSessions:this.sessions.size}),a()}).on("error",s=>{s.code==="EADDRINUSE"&&pe.error("SYSTEM",`Port ${ls} already in use - worker may already be running`),i(s)})})}handleHealth(e,r){r.json({status:"ok",port:this.port,pid:process.pid,activeSessions:this.sessions.size,uptime:process.uptime(),memory:process.memoryUsage()})}async handleInit(e,r){let a=parseInt(e.params.sessionDbId,10),{project:i,userPrompt:s}=e.body,n=pe.sessionId(a);if(pe.info("WORKER","Session init",{correlationId:n,project:i}),this.sessions.has(a)){r.status(409).json({error:"Session already exists"});return}let o={sessionDbId:a,sdkSessionId:null,project:i,userPrompt:s,pendingMessages:[],abortController:new AbortController,generatorPromise:null,lastPromptNumber:0,observationCounter:0,startTime:Date.now()};this.sessions.set(a,o);let p=new Ia;p.setWorkerPort(a,this.port),p.close(),o.generatorPromise=this.runSDKAgent(o).catch(c=>{pe.failure("WORKER","SDK agent error",{sessionId:a},c);let l=new Ia;l.markSessionFailed(a),l.close(),this.sessions.delete(a)}),pe.success("WORKER","Session initialized",{sessionId:a,port:this.port}),r.json({status:"initialized",sessionDbId:a,port:this.port})}handleObservation(e,r){let a=parseInt(e.params.sessionDbId,10),{tool_name:i,tool_input:s,tool_output:n,prompt_number:o}=e.body,p=this.sessions.get(a);if(!p){r.status(404).json({error:"Session not found"});return}p.observationCounter++;let c=pe.correlationId(a,p.observationCounter),l=pe.formatTool(i,s);pe.dataIn("WORKER",`Observation queued: ${l}`,{correlationId:c,queue:p.pendingMessages.length+1}),p.pendingMessages.push({type:"observation",tool_name:i,tool_input:s,tool_output:n,prompt_number:o}),r.json({status:"queued",queueLength:p.pendingMessages.length})}handleSummarize(e,r){let a=parseInt(e.params.sessionDbId,10),{prompt_number:i}=e.body,s=this.sessions.get(a);if(!s){r.status(404).json({error:"Session not found"});return}pe.dataIn("WORKER","Summary requested",{sessionId:a,promptNumber:i,queue:s.pendingMessages.length+1}),s.pendingMessages.push({type:"summarize",prompt_number:i}),r.json({status:"queued",queueLength:s.pendingMessages.length})}handleStatus(e,r){let a=parseInt(e.params.sessionDbId,10),i=this.sessions.get(a);if(!i){r.status(404).json({error:"Session not found"});return}r.json({sessionDbId:a,sdkSessionId:i.sdkSessionId,project:i.project,pendingMessages:i.pendingMessages.length})}async handleDelete(e,r){let a=parseInt(e.params.sessionDbId,10),i=this.sessions.get(a);if(!i){r.status(404).json({error:"Session not found"});return}pe.warn("WORKER","Session delete requested",{sessionId:a}),i.abortController.abort(),i.generatorPromise&&await Promise.race([i.generatorPromise,new Promise(n=>setTimeout(n,5e3))]);let s=new Ia;s.markSessionFailed(a),s.close(),this.sessions.delete(a),pe.info("WORKER","Session deleted",{sessionId:a}),r.json({status:"deleted"})}async runSDKAgent(e){pe.info("SDK","Agent starting",{sessionId:e.sessionDbId});let r=process.env.CLAUDE_CODE_PATH||"/Users/alexnewman/.nvm/versions/node/v24.5.0/bin/claude";try{let a=lg({prompt:this.createMessageGenerator(e),options:{model:Q2,disallowedTools:J2,abortController:e.abortController,pathToClaudeCodeExecutable:r}});for await(let n of a)if(n.type==="system"&&n.subtype==="init"){let o=n;if(o.session_id){let p=new Ia,c=p.updateSDKSessionId(e.sessionDbId,o.session_id);p.close(),c&&(pe.success("SDK","Session initialized",{sessionId:e.sessionDbId,sdkSessionId:o.session_id}),e.sdkSessionId=o.session_id)}}else if(n.type==="assistant"){let o=n.message.content,p=Array.isArray(o)?o.filter(l=>l.type==="text").map(l=>l.text).join(` -`):typeof o=="string"?o:"",c=p.length;pe.dataOut("SDK",`Response received (${c} chars)`,{sessionId:e.sessionDbId,promptNumber:e.lastPromptNumber}),pe.debug("SDK","Full response",{sessionId:e.sessionDbId},p),this.handleAgentMessage(e,p,e.lastPromptNumber)}let i=Date.now()-e.startTime;pe.success("SDK","Agent completed",{sessionId:e.sessionDbId,duration:`${(i/1e3).toFixed(1)}s`});let s=new Ia;s.markSessionCompleted(e.sessionDbId),s.close(),this.sessions.delete(e.sessionDbId)}catch(a){throw a.name==="AbortError"?pe.warn("SDK","Agent aborted",{sessionId:e.sessionDbId}):pe.failure("SDK","Agent error",{sessionId:e.sessionDbId},a),a}}async*createMessageGenerator(e){let r=`session-${e.sessionDbId}`,a=hg(e.project,r,e.userPrompt);for(pe.dataIn("SDK",`Init prompt sent (${a.length} chars)`,{sessionId:e.sessionDbId,project:e.project}),pe.debug("SDK","Full init prompt",{sessionId:e.sessionDbId},a),yield{type:"user",session_id:e.sdkSessionId||r,parent_tool_use_id:null,message:{role:"user",content:a}};!e.abortController.signal.aborted;){if(e.pendingMessages.length===0){await new Promise(i=>setTimeout(i,100));continue}for(;e.pendingMessages.length>0;){let i=e.pendingMessages.shift();if(i.type==="summarize"){e.lastPromptNumber=i.prompt_number;let s=new Ia,n=s.getSessionById(e.sessionDbId);if(s.close(),n){let o=gg(n);pe.dataIn("SDK",`Summary prompt sent (${o.length} chars)`,{sessionId:e.sessionDbId,promptNumber:i.prompt_number}),pe.debug("SDK","Full summary prompt",{sessionId:e.sessionDbId},o),yield{type:"user",session_id:e.sdkSessionId||r,parent_tool_use_id:null,message:{role:"user",content:o}}}}else if(i.type==="observation"){e.lastPromptNumber=i.prompt_number;let s=vg({id:0,tool_name:i.tool_name,tool_input:i.tool_input,tool_output:i.tool_output,created_at_epoch:Date.now()}),n=pe.formatTool(i.tool_name,i.tool_input),o=pe.correlationId(e.sessionDbId,e.observationCounter);pe.dataIn("SDK",`Observation prompt: ${n}`,{correlationId:o,promptNumber:i.prompt_number,size:`${s.length} chars`}),pe.debug("SDK","Full observation prompt",{correlationId:o},s),yield{type:"user",session_id:e.sdkSessionId||r,parent_tool_use_id:null,message:{role:"user",content:s}}}}}}handleAgentMessage(e,r,a){let i=pe.correlationId(e.sessionDbId,e.observationCounter),s=xg(r,i);s.length>0&&pe.info("PARSER",`Parsed ${s.length} observation(s)`,{correlationId:i,promptNumber:a,types:s.map(p=>p.type).join(", ")});let n=new Ia;for(let p of s)e.sdkSessionId&&(n.storeObservation(e.sdkSessionId,e.project,p,a),pe.success("DB","Observation stored",{correlationId:i,type:p.type,title:p.title}));let o=yg(r,e.sessionDbId);o&&e.sdkSessionId&&(pe.info("PARSER","Summary parsed",{sessionId:e.sessionDbId,promptNumber:a}),n.storeSummary(e.sdkSessionId,e.project,o,a),pe.success("DB","Summary stored",{sessionId:e.sessionDbId})),n.close()}};async function Y2(){await new us().start(),process.on("SIGINT",()=>{pe.warn("SYSTEM","Shutting down (SIGINT)"),process.exit(0)}),process.on("SIGTERM",()=>{pe.warn("SYSTEM","Shutting down (SIGTERM)"),process.exit(0)})}Y2().catch(t=>{pe.failure("SYSTEM","Fatal startup error",{},t),process.exit(1)});0&&(module.exports={WorkerService}); +**Optional fields**: notes`}function xg(t,e){let r=[],a=/([\s\S]*?)<\/observation>/g,i;for(;(i=a.exec(t))!==null;){let s=i[1],n=Va(s,"type"),o=Va(s,"title"),p=Va(s,"subtitle"),c=Va(s,"narrative"),l=ps(s,"facts","fact"),u=ps(s,"concepts","concept"),d=ps(s,"files_read","file"),h=ps(s,"files_modified","file");if(!n||!o||!p||!c){oe.warn("PARSER","Observation missing required fields, skipping",{correlationId:e,hasType:!!n,hasTitle:!!o,hasSubtitle:!!p,hasNarrative:!!c});continue}if(!["change","discovery","decision"].includes(n.trim())){oe.warn("PARSER",`Invalid observation type: ${n}, skipping`,{correlationId:e});continue}let f=u.filter(g=>g!==n.trim());f.length!==u.length&&oe.warn("PARSER","Removed observation type from concepts array",{correlationId:e,type:n.trim(),originalConcepts:u,cleanedConcepts:f}),r.push({type:n.trim(),title:o,subtitle:p,facts:l,narrative:c,concepts:f,files_read:d,files_modified:h})}return r}function yg(t,e){let a=/([\s\S]*?)<\/summary>/.exec(t);if(!a)return null;let i=a[1],s=Va(i,"request"),n=Va(i,"investigated"),o=Va(i,"learned"),p=Va(i,"completed"),c=Va(i,"next_steps"),l=Va(i,"notes");return!s||!n||!o||!p||!c?(oe.warn("PARSER","Summary missing required fields",{sessionId:e,hasRequest:!!s,hasInvestigated:!!n,hasLearned:!!o,hasCompleted:!!p,hasNextSteps:!!c}),null):{request:s,investigated:n,learned:o,completed:p,next_steps:c,notes:l}}function Va(t,e){let a=new RegExp(`<${e}>([^<]*)`).exec(t);return a?a[1].trim():null}function ps(t,e,r){let a=[],s=new RegExp(`<${e}>(.*?)`,"s").exec(t);if(!s)return a;let n=s[1],o=new RegExp(`<${r}>([^<]+)`,"g"),p;for(;(p=o.exec(n))!==null;)a.push(p[1].trim());return a}var Q2=process.env.CLAUDE_MEM_MODEL||"claude-sonnet-4-5",J2=["Glob","Grep","ListMcpResourcesTool","WebSearch"],ls=parseInt(process.env.CLAUDE_MEM_WORKER_PORT||"37777",10),us=class{app;port=null;sessions=new Map;constructor(){this.app=(0,Vc.default)(),this.app.use(Vc.default.json({limit:"50mb"})),this.app.get("/health",this.handleHealth.bind(this)),this.app.post("/sessions/:sessionDbId/init",this.handleInit.bind(this)),this.app.post("/sessions/:sessionDbId/observations",this.handleObservation.bind(this)),this.app.post("/sessions/:sessionDbId/summarize",this.handleSummarize.bind(this)),this.app.get("/sessions/:sessionDbId/status",this.handleStatus.bind(this)),this.app.delete("/sessions/:sessionDbId",this.handleDelete.bind(this))}async start(){this.port=ls;let e=new Ia,r=e.cleanupOrphanedSessions();return e.close(),r>0&&oe.info("SYSTEM",`Cleaned up ${r} orphaned sessions`),new Promise((a,i)=>{this.app.listen(ls,"127.0.0.1",()=>{oe.info("SYSTEM","Worker started",{port:ls,pid:process.pid,activeSessions:this.sessions.size}),a()}).on("error",s=>{s.code==="EADDRINUSE"&&oe.error("SYSTEM",`Port ${ls} already in use - worker may already be running`),i(s)})})}handleHealth(e,r){r.json({status:"ok",port:this.port,pid:process.pid,activeSessions:this.sessions.size,uptime:process.uptime(),memory:process.memoryUsage()})}async handleInit(e,r){let a=parseInt(e.params.sessionDbId,10),{project:i,userPrompt:s}=e.body,n=oe.sessionId(a);if(oe.info("WORKER","Session init",{correlationId:n,project:i}),this.sessions.has(a)){r.status(409).json({error:"Session already exists"});return}let o={sessionDbId:a,sdkSessionId:null,project:i,userPrompt:s,pendingMessages:[],abortController:new AbortController,generatorPromise:null,lastPromptNumber:0,observationCounter:0,startTime:Date.now()};this.sessions.set(a,o);let p=new Ia;p.setWorkerPort(a,this.port),p.close(),o.generatorPromise=this.runSDKAgent(o).catch(c=>{oe.failure("WORKER","SDK agent error",{sessionId:a},c);let l=new Ia;l.markSessionFailed(a),l.close(),this.sessions.delete(a)}),oe.success("WORKER","Session initialized",{sessionId:a,port:this.port}),r.json({status:"initialized",sessionDbId:a,port:this.port})}handleObservation(e,r){let a=parseInt(e.params.sessionDbId,10),{tool_name:i,tool_input:s,tool_output:n,prompt_number:o}=e.body,p=this.sessions.get(a);if(!p){r.status(404).json({error:"Session not found"});return}p.observationCounter++;let c=oe.correlationId(a,p.observationCounter),l=oe.formatTool(i,s);oe.dataIn("WORKER",`Observation queued: ${l}`,{correlationId:c,queue:p.pendingMessages.length+1}),p.pendingMessages.push({type:"observation",tool_name:i,tool_input:s,tool_output:n,prompt_number:o}),r.json({status:"queued",queueLength:p.pendingMessages.length})}handleSummarize(e,r){let a=parseInt(e.params.sessionDbId,10),{prompt_number:i}=e.body,s=this.sessions.get(a);if(!s){r.status(404).json({error:"Session not found"});return}oe.dataIn("WORKER","Summary requested",{sessionId:a,promptNumber:i,queue:s.pendingMessages.length+1}),s.pendingMessages.push({type:"summarize",prompt_number:i}),r.json({status:"queued",queueLength:s.pendingMessages.length})}handleStatus(e,r){let a=parseInt(e.params.sessionDbId,10),i=this.sessions.get(a);if(!i){r.status(404).json({error:"Session not found"});return}r.json({sessionDbId:a,sdkSessionId:i.sdkSessionId,project:i.project,pendingMessages:i.pendingMessages.length})}async handleDelete(e,r){let a=parseInt(e.params.sessionDbId,10),i=this.sessions.get(a);if(!i){r.status(404).json({error:"Session not found"});return}oe.warn("WORKER","Session delete requested",{sessionId:a}),i.abortController.abort(),i.generatorPromise&&await Promise.race([i.generatorPromise,new Promise(n=>setTimeout(n,5e3))]);let s=new Ia;s.markSessionFailed(a),s.close(),this.sessions.delete(a),oe.info("WORKER","Session deleted",{sessionId:a}),r.json({status:"deleted"})}async runSDKAgent(e){oe.info("SDK","Agent starting",{sessionId:e.sessionDbId});let r=process.env.CLAUDE_CODE_PATH||"/Users/alexnewman/.nvm/versions/node/v24.5.0/bin/claude";try{let a=lg({prompt:this.createMessageGenerator(e),options:{model:Q2,disallowedTools:J2,abortController:e.abortController,pathToClaudeCodeExecutable:r}});for await(let n of a)if(n.type==="system"&&n.subtype==="init"){let o=n;if(o.session_id){let p=new Ia,c=p.updateSDKSessionId(e.sessionDbId,o.session_id);p.close(),c&&(oe.success("SDK","Session initialized",{sessionId:e.sessionDbId,sdkSessionId:o.session_id}),e.sdkSessionId=o.session_id)}}else if(n.type==="assistant"){let o=n.message.content,p=Array.isArray(o)?o.filter(l=>l.type==="text").map(l=>l.text).join(` +`):typeof o=="string"?o:"",c=p.length;oe.dataOut("SDK",`Response received (${c} chars)`,{sessionId:e.sessionDbId,promptNumber:e.lastPromptNumber}),oe.debug("SDK","Full response",{sessionId:e.sessionDbId},p),this.handleAgentMessage(e,p,e.lastPromptNumber)}let i=Date.now()-e.startTime;oe.success("SDK","Agent completed",{sessionId:e.sessionDbId,duration:`${(i/1e3).toFixed(1)}s`});let s=new Ia;s.markSessionCompleted(e.sessionDbId),s.close(),this.sessions.delete(e.sessionDbId)}catch(a){throw a.name==="AbortError"?oe.warn("SDK","Agent aborted",{sessionId:e.sessionDbId}):oe.failure("SDK","Agent error",{sessionId:e.sessionDbId},a),a}}async*createMessageGenerator(e){let r=`session-${e.sessionDbId}`,a=hg(e.project,r,e.userPrompt);for(oe.dataIn("SDK",`Init prompt sent (${a.length} chars)`,{sessionId:e.sessionDbId,project:e.project}),oe.debug("SDK","Full init prompt",{sessionId:e.sessionDbId},a),yield{type:"user",session_id:e.sdkSessionId||r,parent_tool_use_id:null,message:{role:"user",content:a}};!e.abortController.signal.aborted;){if(e.pendingMessages.length===0){await new Promise(i=>setTimeout(i,100));continue}for(;e.pendingMessages.length>0;){let i=e.pendingMessages.shift();if(i.type==="summarize"){e.lastPromptNumber=i.prompt_number;let s=new Ia,n=s.getSessionById(e.sessionDbId);if(s.close(),n){let o=gg(n);oe.dataIn("SDK",`Summary prompt sent (${o.length} chars)`,{sessionId:e.sessionDbId,promptNumber:i.prompt_number}),oe.debug("SDK","Full summary prompt",{sessionId:e.sessionDbId},o),yield{type:"user",session_id:e.sdkSessionId||r,parent_tool_use_id:null,message:{role:"user",content:o}}}}else if(i.type==="observation"){e.lastPromptNumber=i.prompt_number;let s=vg({id:0,tool_name:i.tool_name,tool_input:i.tool_input,tool_output:i.tool_output,created_at_epoch:Date.now()}),n=oe.formatTool(i.tool_name,i.tool_input),o=oe.correlationId(e.sessionDbId,e.observationCounter);oe.dataIn("SDK",`Observation prompt: ${n}`,{correlationId:o,promptNumber:i.prompt_number,size:`${s.length} chars`}),oe.debug("SDK","Full observation prompt",{correlationId:o},s),yield{type:"user",session_id:e.sdkSessionId||r,parent_tool_use_id:null,message:{role:"user",content:s}}}}}}handleAgentMessage(e,r,a){let i=oe.correlationId(e.sessionDbId,e.observationCounter),s=xg(r,i);s.length>0&&oe.info("PARSER",`Parsed ${s.length} observation(s)`,{correlationId:i,promptNumber:a,types:s.map(p=>p.type).join(", ")});let n=new Ia;for(let p of s)e.sdkSessionId&&(n.storeObservation(e.sdkSessionId,e.project,p,a),oe.success("DB","Observation stored",{correlationId:i,type:p.type,title:p.title}));let o=yg(r,e.sessionDbId);o&&e.sdkSessionId&&(oe.info("PARSER","Summary parsed",{sessionId:e.sessionDbId,promptNumber:a}),n.storeSummary(e.sdkSessionId,e.project,o,a),oe.success("DB","Summary stored",{sessionId:e.sessionDbId})),n.close()}};async function Y2(){await new us().start(),process.on("SIGINT",()=>{oe.warn("SYSTEM","Shutting down (SIGINT)"),process.exit(0)}),process.on("SIGTERM",()=>{oe.warn("SYSTEM","Shutting down (SIGTERM)"),process.exit(0)})}Y2().catch(t=>{oe.failure("SYSTEM","Fatal startup error",{},t),process.exit(1)});0&&(module.exports={WorkerService}); /*! Bundled license information: depd/index.js: diff --git a/src/sdk/parser.ts b/src/sdk/parser.ts index 45e75d9c..7b3abb2d 100644 --- a/src/sdk/parser.ts +++ b/src/sdk/parser.ts @@ -68,13 +68,25 @@ export function parseObservations(text: string, correlationId?: string): ParsedO continue; } + // Filter out type from concepts array (types and concepts are separate dimensions) + const cleanedConcepts = concepts.filter(c => c !== type.trim()); + + if (cleanedConcepts.length !== concepts.length) { + logger.warn('PARSER', 'Removed observation type from concepts array', { + correlationId, + type: type.trim(), + originalConcepts: concepts, + cleanedConcepts + }); + } + observations.push({ type: type.trim(), title, subtitle, facts, narrative, - concepts, + concepts: cleanedConcepts, files_read, files_modified }); diff --git a/src/sdk/prompts.ts b/src/sdk/prompts.ts index 6c0c9dbe..f7b54d98 100644 --- a/src/sdk/prompts.ts +++ b/src/sdk/prompts.ts @@ -55,7 +55,7 @@ Output observations using this XML structure: [ change | discovery | decision ] [path/to/file] diff --git a/src/servers/search-server.ts b/src/servers/search-server.ts index be9fbf68..a938e042 100644 --- a/src/servers/search-server.ts +++ b/src/servers/search-server.ts @@ -361,7 +361,7 @@ const tools = [ start: z.union([z.string(), z.number()]).optional(), end: z.union([z.string(), z.number()]).optional() }).optional().describe('Filter by date range'), - limit: z.number().min(1).max(100).default(20).describe('Maximum number of results'), + limit: z.number().min(1).max(100).default(20).describe('Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode.'), offset: z.number().min(0).default(0).describe('Number of results to skip'), orderBy: z.enum(['relevance', 'date_desc', 'date_asc']).default('date_desc').describe('Sort order') }), @@ -418,7 +418,7 @@ const tools = [ start: z.union([z.string(), z.number()]).optional(), end: z.union([z.string(), z.number()]).optional() }).optional().describe('Filter by date range'), - limit: z.number().min(1).max(100).default(20).describe('Maximum number of results'), + limit: z.number().min(1).max(100).default(20).describe('Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode.'), offset: z.number().min(0).default(0).describe('Number of results to skip'), orderBy: z.enum(['relevance', 'date_desc', 'date_asc']).default('date_desc').describe('Sort order') }), @@ -501,7 +501,7 @@ const tools = [ start: z.union([z.string(), z.number()]).optional(), end: z.union([z.string(), z.number()]).optional() }).optional().describe('Filter by date range'), - limit: z.number().min(1).max(100).default(20).describe('Maximum number of results'), + limit: z.number().min(1).max(100).default(20).describe('Maximum results. IMPORTANT: Start with 3-5 to avoid exceeding MCP token limits, even in index mode.'), offset: z.number().min(0).default(0).describe('Number of results to skip'), orderBy: z.enum(['relevance', 'date_desc', 'date_asc']).default('date_desc').describe('Sort order') }), diff --git a/src/services/sqlite/SessionSearch.ts b/src/services/sqlite/SessionSearch.ts index b0513377..4cc84dee 100644 --- a/src/services/sqlite/SessionSearch.ts +++ b/src/services/sqlite/SessionSearch.ts @@ -349,43 +349,53 @@ export class SessionSearch { /** * Find observations by concept tag */ - findByConcept(concept: string, filters: SearchFilters = {}): ObservationSearchResult[] { + findByConcept(concept: string, options: SearchOptions = {}): ObservationSearchResult[] { const params: any[] = []; + const { limit = 50, offset = 0, orderBy = 'date_desc', ...filters } = options; // Add concept to filters const conceptFilters = { ...filters, concepts: concept }; const filterClause = this.buildFilterClause(conceptFilters, params, 'o'); + const orderClause = this.buildOrderClause(orderBy, false); const sql = ` SELECT o.* FROM observations o WHERE ${filterClause} - ORDER BY o.created_at_epoch DESC + ${orderClause} + LIMIT ? OFFSET ? `; + params.push(limit, offset); + return this.db.prepare(sql).all(...params) as ObservationSearchResult[]; } /** * Find observations and summaries by file path */ - findByFile(filePath: string, filters: SearchFilters = {}): { + findByFile(filePath: string, options: SearchOptions = {}): { observations: ObservationSearchResult[]; sessions: SessionSummarySearchResult[]; } { const params: any[] = []; + const { limit = 50, offset = 0, orderBy = 'date_desc', ...filters } = options; // Add file to filters const fileFilters = { ...filters, files: filePath }; const filterClause = this.buildFilterClause(fileFilters, params, 'o'); + const orderClause = this.buildOrderClause(orderBy, false); const observationsSql = ` SELECT o.* FROM observations o WHERE ${filterClause} - ORDER BY o.created_at_epoch DESC + ${orderClause} + LIMIT ? OFFSET ? `; + params.push(limit, offset); + const observations = this.db.prepare(observationsSql).all(...params) as ObservationSearchResult[]; // For session summaries, search files_read and files_edited @@ -425,8 +435,11 @@ export class SessionSearch { FROM session_summaries s WHERE ${baseConditions.join(' AND ')} ORDER BY s.created_at_epoch DESC + LIMIT ? OFFSET ? `; + sessionParams.push(limit, offset); + const sessions = this.db.prepare(sessionsSql).all(...sessionParams) as SessionSummarySearchResult[]; return { observations, sessions }; @@ -437,21 +450,26 @@ export class SessionSearch { */ findByType( type: ObservationRow['type'] | ObservationRow['type'][], - filters: SearchFilters = {} + options: SearchOptions = {} ): ObservationSearchResult[] { const params: any[] = []; + const { limit = 50, offset = 0, orderBy = 'date_desc', ...filters } = options; // Add type to filters const typeFilters = { ...filters, type }; const filterClause = this.buildFilterClause(typeFilters, params, 'o'); + const orderClause = this.buildOrderClause(orderBy, false); const sql = ` SELECT o.* FROM observations o WHERE ${filterClause} - ORDER BY o.created_at_epoch DESC + ${orderClause} + LIMIT ? OFFSET ? `; + params.push(limit, offset); + return this.db.prepare(sql).all(...params) as ObservationSearchResult[]; }