diff --git a/plugin/scripts/worker-service.cjs b/plugin/scripts/worker-service.cjs index 3a91759d..9c135bce 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 L4(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=hc.original(this.req);r.path=null,r.pathname=N4(r.pathname+"/");var t=O4(A4.format(r)),i=D4("Redirecting","Redirecting to "+C4(t));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",t),e.end(i)}}});var iv=A((ct,nv)=>{"use strict";var Wi=Tf(),$4=require("events").EventEmitter,ev=Rf(),tv=ch(),F4=Mo(),M4=zo(),av=Nh(),rv=Qh();ct=nv.exports=U4;function U4(){var a=function(e,r,t){a.handle(e,r,t)};return ev(a,$4.prototype,!1),ev(a,tv,!1),a.request=Object.create(av,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.response=Object.create(rv,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.init(),a}ct.application=tv;ct.request=av;ct.response=rv;ct.Route=F4;ct.Router=M4;ct.json=Wi.json;ct.query=Bo();ct.raw=Wi.raw;ct.static=Yh();ct.text=Wi.text;ct.urlencoded=Wi.urlencoded;var z4=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];z4.forEach(function(a){Object.defineProperty(ct,a,{get:function(){throw new Error("Most middleware (like "+a+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var ov=A((D6,sv)=>{"use strict";sv.exports=iv()});var eR={};Hg(eR,{WorkerService:()=>us});module.exports=Vg(eR);var Vc=vs(ov(),1);var bc=require("path"),Tv=require("url"),Pv=require("events"),Ov=require("child_process"),Cv=require("readline"),re=vs(require("fs"),1),Iv=require("fs/promises"),Lv=require("path"),$v=require("os"),Na=require("path"),Sc=require("process"),Fv=require("crypto"),W2={},B4=Object.create,H4=Object.getPrototypeOf,yc=Object.defineProperty,V4=Object.getOwnPropertyNames,G4=Object.prototype.hasOwnProperty,Z4=(a,e,r)=>{r=a!=null?B4(H4(a)):{};let t=e||!a||!a.__esModule?yc(r,"default",{value:a,enumerable:!0}):r;for(let i of V4(a))G4.call(t,i)||yc(t,i,{get:()=>a[i],enumerable:!0});return t},ie=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),W4=(a,e)=>{for(var r in e)yc(a,r,{get:e[r],enumerable:!0,configurable:!0,set:t=>e[r]=()=>t})},X4=ie((a,e)=>{(function(r,t){typeof a=="object"&&typeof e<"u"?t(a):typeof define=="function"&&define.amd?define(["exports"],t):t(r.URI=r.URI||{})})(a,function(r){function t(){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 N=x.length-1,q=1;q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=f-g,k=Math.floor,P=String.fromCharCode;function L(_){throw new RangeError($[_])}function F(_,x){for(var S=[],N=_.length;N--;)S[N]=x(_[N]);return S}function B(_,x){var S=_.split("@"),N="";S.length>1&&(N=S[0]+"@",_=S[1]),_=_.replace(D,".");var q=_.split("."),Z=F(q,x).join(".");return N+Z}function V(_){for(var x=[],S=0,N=_.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))},oe=function(x){var S=[],N=x.length,q=0,Z=C,ue=I,ge=x.lastIndexOf(E);ge<0&&(ge=0);for(var we=0;we=128&&L("not-basic"),S.push(x.charCodeAt(we));for(var Ue=ge>0?ge+1:0;Ue=N&&L("invalid-input");var je=K(x.charCodeAt(Ue++));(je>=f||je>k((v-q)/De))&&L("overflow"),q+=je*De;var ye=ze<=ue?g:ze>=ue+b?b:ze-ue;if(jek(v/qe)&&L("overflow"),De*=qe}var Se=S.length+1;ue=ee(q-he,Se,he==0),k(q/Se)>v-Z&&L("overflow"),Z+=k(q/Se),q%=Se,S.splice(q++,0,Z)}return String.fromCodePoint.apply(String,S)},We=function(x){var S=[];x=V(x);var N=x.length,q=C,Z=0,ue=I,ge=!0,we=!1,Ue=void 0;try{for(var he=x[Symbol.iterator](),De;!(ge=(De=he.next()).done);ge=!0){var ze=De.value;ze<128&&S.push(P(ze))}}catch(ga){we=!0,Ue=ga}finally{try{!ge&&he.return&&he.return()}finally{if(we)throw Ue}}var je=S.length,ye=je;for(je&&S.push(E);ye=q&&ftk((v-Z)/yt)&&L("overflow"),Z+=(qe-q)*yt,q=qe;var Nt=!0,va=!1,Gt=void 0;try{for(var Vr=x[Symbol.iterator](),Mn;!(Nt=(Mn=Vr.next()).done);Nt=!0){var Un=Mn.value;if(Unv&&L("overflow"),Un==q){for(var Ja=Z,Ya=f;;Ya+=f){var Zt=Ya<=ue?g:Ya>=ue+b?b:Ya-ue;if(Ja>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,N=_.length;S=194&&q<224){if(N-S>=6){var Z=parseInt(_.substr(S+4,2),16);x+=String.fromCharCode((q&31)<<6|Z&63)}else x+=_.substr(S,6);S+=6}else if(q>=224){if(N-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(N){var q=M(N);return q.match(x.UNRESERVED)?q:N}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 U(_,x){var S=_.match(x.IPV4ADDRESS)||[],N=d(S,2),q=N[1];return q?q.split(".").map(ce).join("."):_}function H(_,x){var S=_.match(x.IPV6ADDRESS)||[],N=d(S,3),q=N[1],Z=N[2];if(q){for(var ue=q.toLowerCase().split("::").reverse(),ge=d(ue,2),we=ge[0],Ue=ge[1],he=Ue?Ue.split(":").map(ce):[],De=we.split(":").map(ce),ze=x.IPV4ADDRESS.test(De[De.length-1]),je=ze?7:8,ye=De.length-je,qe=Array(je),Se=0;Se1){var Te=qe.slice(0,dt.index),ft=qe.slice(dt.index+dt.length);xt=Te.join(":")+"::"+ft.join(":")}else xt=qe.join(":");return Z&&(xt+="%"+Z),xt}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={},N=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(U(S.host,N),N)),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 Z=Ne[(x.scheme||S.scheme||"").toLowerCase()];if(!x.unicodeSupport&&(!Z||!Z.unicodeSupport)){if(S.host&&(x.domainHost||Z&&Z.domainHost))try{S.host=Re.toASCII(S.host.replace(N.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,N);Z&&Z.parse&&Z.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,N=[];return _.userinfo!==void 0&&(N.push(_.userinfo),N.push("@")),_.host!==void 0&&N.push(H(U(String(_.host),S),S).replace(S.IPV6ADDRESS,function(q,Z,ue){return"["+Z+(ue?"%25"+ue:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(N.push(":"),N.push(String(_.port))),N.length?N.join(""):void 0}var Ie=/^\.\.?\//,xe=/^\/\.(\/|$)/,Ke=/^\/\.\.(\/|$)/,$e=/^\/?(?:.|\n)*?(?=\/|$)/;function Ye(_){for(var x=[];_.length;)if(_.match(Ie))_=_.replace(Ie,"");else if(_.match(xe))_=_.replace(xe,"/");else if(_.match(Ke))_=_.replace(Ke,"/"),x.pop();else if(_==="."||_==="..")_="";else{var S=_.match($e);if(S){var N=S[0];_=_.slice(N.length),x.push(N)}else throw new Error("Unexpected dot segment condition")}return x.join("")}function Ae(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=x.iri?u:l,N=[],q=Ne[(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&&(N.push(_.scheme),N.push(":"));var Z=Ce(_,x);if(Z!==void 0&&(x.reference!=="suffix"&&N.push("//"),N.push(Z),_.path&&_.path.charAt(0)!=="/"&&N.push("/")),_.path!==void 0){var ue=_.path;!x.absolutePath&&(!q||!q.absolutePath)&&(ue=Ye(ue)),Z===void 0&&(ue=ue.replace(/^\/\//,"/%2F")),N.push(ue)}return _.query!==void 0&&(N.push("?"),N.push(_.query)),_.fragment!==void 0&&(N.push("#"),N.push(_.fragment)),N.join("")}function Ve(_,x){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},N=arguments[3],q={};return N||(_=ne(Ae(_,S),S),x=ne(Ae(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 gt(_,x,S){var N=p({scheme:"null"},S);return Ae(Ve(ne(_,N),ne(x,N),N,!0),N)}function ut(_,x){return typeof _=="string"?_=Ae(ne(_,x),x):s(_)==="object"&&(_=ne(Ae(_,x),x)),_}function Fn(_,x,S){return typeof _=="string"?_=Ae(ne(_,S),S):s(_)==="object"&&(_=Ae(_,S)),typeof x=="string"?x=Ae(ne(x,S),S):s(x)==="object"&&(x=Ae(x,S)),_===x}function ds(_,x){return _&&_.toString().replace(!x||!x.iri?l.ESCAPE:u.ESCAPE,R)}function Rt(_,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 N=String(x.scheme).toLowerCase()==="https";return(x.port===(N?443:80)||x.port==="")&&(x.port=void 0),x.path||(x.path="/"),x}},Gc={scheme:"https",domainHost:Br.domainHost,parse:Br.parse,serialize:Br.serialize};function Zc(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Hr={scheme:"ws",domainHost:!0,parse:function(x,S){var N=x;return N.secure=Zc(N),N.resourceName=(N.path||"/")+(N.query?"?"+N.query:""),N.path=void 0,N.query=void 0,N},serialize:function(x,S){if((x.port===(Zc(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 N=x.resourceName.split("?"),q=d(N,2),Z=q[0],ue=q[1];x.path=Z&&Z!=="/"?Z: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":"")+"]",jt="[0-9A-Fa-f]",_g=i(i("%[EFef]"+jt+"%"+jt+jt+"%"+jt+jt)+"|"+i("%[89A-Fa-f]"+jt+"%"+jt+jt)+"|"+i("%"+jt+jt)),Eg="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Sg="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",kg=t(Sg,'[\\"\\\\]'),Tg="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Pg=new RegExp(Xc,"g"),Qa=new RegExp(_g,"g"),Rg=new RegExp(t("[^]",Eg,"[\\.]",'[\\"]',kg),"g"),Kc=new RegExp(t("[^]",Xc,Tg),"g"),Og=Kc;function fs(_){var x=M(_);return x.match(Pg)?x:_}var Qc={scheme:"mailto",parse:function(x,S){var N=x,q=N.to=N.path?N.path.split(","):[];if(N.path=void 0,N.query){for(var Z=!1,ue={},ge=N.query.split("&"),we=0,Ue=ge.length;we{e.exports=function r(t,i){if(t===i)return!0;if(t&&i&&typeof t=="object"&&typeof i=="object"){if(t.constructor!==i.constructor)return!1;var s,n,o;if(Array.isArray(t)){if(s=t.length,s!=i.length)return!1;for(n=s;n--!==0;)if(!r(t[n],i[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if(o=Object.keys(t),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(t[p],i[p]))return!1}return!0}return t!==t&&i!==i}}),K4=ie((a,e)=>{e.exports=function(t){for(var i=0,s=t.length,n=0,o;n=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:t,checkDataTypes:i,coerceToTypes:n,toHash:o,getProperty:l,escapeQuotes:u,equal:Ic(),ucs2length:K4(),varOccurences:d,varReplace:m,schemaHasRules:v,schemaHasRulesExcept:f,schemaUnknownRules:g,toQuotedString:b,getPathExpr:y,getPath:w,getData:E,unescapeFragment:j,unescapeJsonPointer:O,escapeFragment:D,escapeJsonPointer:$};function r(k,P){P=P||{};for(var L in k)P[L]=k[L];return P}function t(k,P,L,F){var B=F?" !== ":" === ",V=F?" || ":" && ",J=F?"!":"",K=F?"":"!";switch(k){case"null":return P+B+"null";case"array":return J+"Array.isArray("+P+")";case"object":return"("+J+P+V+"typeof "+P+B+'"object"'+V+K+"Array.isArray("+P+"))";case"integer":return"(typeof "+P+B+'"number"'+V+K+"("+P+" % 1)"+V+P+B+P+(L?V+J+"isFinite("+P+")":"")+")";case"number":return"(typeof "+P+B+'"'+k+'"'+(L?V+J+"isFinite("+P+")":"")+")";default:return"typeof "+P+B+'"'+k+'"'}}function i(k,P,L){switch(k.length){case 1:return t(k[0],P,L,!0);default:var F="",B=o(k);B.array&&B.object&&(F=B.null?"(":"(!"+P+" || ",F+="typeof "+P+' !== "object")',delete B.null,delete B.array,delete B.object),B.number&&delete B.integer;for(var V in B)F+=(F?" && ":"")+t(V,P,L,!0);return F}}var s=o(["string","number","integer","boolean","null"]);function n(k,P){if(Array.isArray(P)){for(var L=[],F=0;F=P)throw new Error("Cannot access property/index "+F+" levels up, current level is "+P);return L[P-F]}if(F>P)throw new Error("Cannot access data "+F+" levels up, current level is "+P);if(V="data"+(P-F||""),!B)return V}for(var K=V,Y=B.split("/"),ee=0;ee{var r=Fr();e.exports=t;function t(i){r.copy(i,this)}}),Q4=ie((a,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(){};t(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 t(s,n,o,p,c,l,u,d,m,v){if(p&&typeof p=="object"&&!Array.isArray(p)){n(p,c,l,u,d,m,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(),t=Ic(),i=Fr(),s=_v(),n=Q4();e.exports=o,o.normalizeId=w,o.fullPath=g,o.url=I,o.ids=C,o.inlineRef=m,o.schema=p;function o(E,T,j){var D=this._refs[j];if(typeof D=="string")if(this._refs[D])D=this._refs[D];else return o.call(this,E,T,D);if(D=D||this._schemas[j],D instanceof s)return m(D.schema,this._opts.inlineRefs)?D.schema:D.validate||this._compile(D);var $=p.call(this,T,j),O,k,P;return $&&(O=$.schema,T=$.root,P=$.baseId),O instanceof s?k=O.validate||E.call(this,O.schema,T,void 0,P):O!==void 0&&(k=m(O,this._opts.inlineRefs)?O:E.call(this,O,T,void 0,P)),k}function p(E,T){var j=r.parse(T),D=b(j),$=g(this._getId(E.schema));if(Object.keys(E.schema).length===0||D!==$){var O=w(D),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(T))return{schema:k,root:E,baseId:$};E=k}else return;if(!E.schema)return;$=g(this._getId(E.schema))}return u.call(this,j,$,E.schema,E)}function c(E,T,j){var D=p.call(this,E,T);if(D){var $=D.schema,O=D.baseId;E=D.root;var k=this._getId($);return k&&(O=I(O,k)),u.call(this,j,O,$,E)}}var l=i.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function u(E,T,j,D){if(E.fragment=E.fragment||"",E.fragment.slice(0,1)=="/"){for(var $=E.fragment.split("/"),O=1;O<$.length;O++){var k=$[O];if(k){if(k=i.unescapeFragment(k),j=j[k],j===void 0)break;var P;if(!l[k]&&(P=this._getId(j),P&&(T=I(T,P)),j.$ref)){var L=I(T,j.$ref),F=p.call(this,D,L);F&&(j=F.schema,D=F.root,T=F.baseId)}}}if(j!==void 0&&j!==D.schema)return{schema:j,root:D,baseId:T}}}var d=i.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function m(E,T){if(T===!1)return!1;if(T===void 0||T===!0)return v(E);if(T)return f(E)<=T}function v(E){var T;if(Array.isArray(E)){for(var j=0;j{var r=Ac();e.exports={Validation:s(t),MissingRef:s(i)};function t(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((a,e)=>{e.exports=function(r,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var i=typeof t.cycles=="boolean"?t.cycles:!1,s=t.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)}}}(t.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(t,i,s){var n="",o=t.schema.$async===!0,p=t.util.schemaHasRulesExcept(t.schema,t.RULES.all,"$ref"),c=t.self._getId(t.schema);if(t.opts.strictKeywords){var l=t.util.schemaUnknownRules(t.schema,t.RULES.keywords);if(l){var u="unknown keyword: "+l;if(t.opts.strictKeywords==="log")t.logger.warn(u);else throw new Error(u)}}if(t.isTop&&(n+=" var validate = ",o&&(t.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(t.opts.sourceCode||t.opts.processCode)&&(n+=" "+("/*# sourceURL="+c+" */")+" ")),typeof t.schema=="boolean"||!(p||t.schema.$ref)){var i="false schema",d=t.level,m=t.dataLevel,v=t.schema[i],f=t.schemaPath+t.util.getProperty(i),g=t.errSchemaPath+"/"+i,T=!t.opts.allErrors,$,b="data"+(m||""),E="valid"+d;if(t.schema===!1){t.isTop?T=!0:n+=" var "+E+" = false; ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+($||"false schema")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(g)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+b+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!t.compositeRule&&T?t.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 t.isTop?o?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+E+" = true; ";return t.isTop&&(n+=" }; return validate; "),n}if(t.isTop){var I=t.isTop,d=t.level=0,m=t.dataLevel=0,b="data";if(t.rootId=t.resolve.fullPath(t.self._getId(t.root.schema)),t.baseId=t.baseId||t.rootId,delete t.isTop,t.dataPathArr=[""],t.schema.default!==void 0&&t.opts.useDefaults&&t.opts.strictDefaults){var C="default is ignored in the schema root";if(t.opts.strictDefaults==="log")t.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:m}=t,b="data"+(m||"");if(c&&(t.baseId=t.resolve.url(t.baseId,c)),o&&!t.async)throw new Error("async schema in sync schema");n+=" var errs_"+d+" = errors;"}var E="valid"+d,T=!t.opts.allErrors,j="",D="",$,O=t.schema.type,k=Array.isArray(O);if(O&&t.opts.nullable&&t.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),t.schema.$ref&&p){if(t.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+t.errSchemaPath+'" (see option extendRefs)');t.opts.extendRefs!==!0&&(p=!1,t.logger.warn('$ref: keywords ignored in schema at path "'+t.errSchemaPath+'"'))}if(t.schema.$comment&&t.opts.$comment&&(n+=" "+t.RULES.all.$comment.code(t,"$comment")),O){if(t.opts.coerceTypes)var P=t.util.coerceToTypes(t.opts.coerceTypes,O);var L=t.RULES.types[O];if(P||k||L===!0||L&&!$e(L)){var f=t.schemaPath+".type",g=t.errSchemaPath+"/type",f=t.schemaPath+".type",g=t.errSchemaPath+"/type",F=k?"checkDataTypes":"checkDataType";if(n+=" if ("+t.util[F](O,b,t.opts.strictNumbers,!0)+") { ",P){var B="dataType"+d,V="coerced"+d;n+=" var "+B+" = typeof "+b+"; var "+V+" = undefined; ",t.opts.coerceTypes=="array"&&(n+=" if ("+B+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+B+" = typeof "+b+"; if ("+t.util.checkDataType(t.schema.type,b,t.opts.strictNumbers)+") "+V+" = "+b+"; } "),n+=" if ("+V+" !== undefined) ; ";var J=P;if(J)for(var K,Y=-1,ee=J.length-1;Y{var r=Ac(),t=Fr(),i=jc(),s=Ev(),n=Sv(),o=t.ucs2length,p=Ic(),c=i.Validation;e.exports=l;function l(w,I,C,E){var T=this,j=this._opts,D=[void 0],$={},O=[],k={},P=[],L={},F=[];I=I||{schema:w,refVal:D,refs:$};var B=u.call(this,w,I,E),V=this._compilations[B.index];if(B.compiling)return V.callValidate=oe;var J=this._formats,K=this.RULES;try{var Y=We(w,I,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,I,E)}function oe(){var U=V.validate,H=U.apply(this,arguments);return oe.errors=U.errors,H}function We(U,H,de,me){var ne=!H||H&&H.schema==U;if(H.schema!=I.schema)return l.call(T,U,H,de,me);var Ce=U.$async===!0,Ie=n({isTop:!0,schema:U,isRoot:ne,baseId:me,root:H,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:i.MissingRef,RULES:K,validate:n,util:t,resolve:r,resolveRef:Qe,usePattern:M,useDefault:X,useCustomRule:ce,opts:j,formats:J,logger:T.logger,self:T});Ie=y(D,g)+y(O,v)+y(P,f)+y(F,b)+Ie,j.processCode&&(Ie=j.processCode(Ie,U));var xe;try{var Ke=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ie);xe=Ke(T,K,J,I,D,P,F,p,o,c),D[0]=xe}catch($e){throw T.logger.error("Error compiling schema, function code:",Ie),$e}return xe.schema=U,xe.errors=null,xe.refs=$,xe.refVal=D,xe.root=ne?xe:H,Ce&&(xe.$async=!0),j.sourceCode===!0&&(xe.source={code:Ie,patterns:O,defaults:P}),xe}function Qe(U,H,de){H=r.url(U,H);var me=$[H],ne,Ce;if(me!==void 0)return ne=D[me],Ce="refVal["+me+"]",R(ne,Ce);if(!de&&I.refs){var Ie=I.refs[H];if(Ie!==void 0)return ne=I.refVal[Ie],Ce=Xe(H,ne),R(ne,Ce)}Ce=Xe(H);var xe=r.call(T,We,I,H);if(xe===void 0){var Ke=C&&C[H];Ke&&(xe=r.inlineRef(Ke,j.inlineRefs)?Ke:l.call(T,Ke,I,C,U))}if(xe===void 0)Re(H);else return Ne(H,xe),R(xe,Ce)}function Xe(U,H){var de=D.length;return D[de]=H,$[U]=de,"refVal"+de}function Re(U){delete $[U]}function Ne(U,H){var de=$[U];D[de]=H}function R(U,H){return typeof U=="object"||typeof U=="boolean"?{code:H,schema:U,inline:!0}:{code:H,$async:U&&!!U.$async}}function M(U){var H=k[U];return H===void 0&&(H=k[U]=O.length,O[H]=U),"pattern"+H}function X(U){switch(typeof U){case"boolean":case"number":return""+U;case"string":return t.toQuotedString(U);case"object":if(U===null)return"null";var H=s(U),de=L[H];return de===void 0&&(de=L[H]=P.length,P[de]=U),"default"+de}}function ce(U,H,de,me){if(T._opts.validateSchema!==!1){var ne=U.definition.dependencies;if(ne&&!ne.every(function(gt){return Object.prototype.hasOwnProperty.call(de,gt)}))throw new Error("parent schema must have all required keywords: "+ne.join(","));var Ce=U.definition.validateSchema;if(Ce){var Ie=Ce(H);if(!Ie){var xe="keyword schema is invalid: "+T.errorsText(Ce.errors);if(T._opts.validateSchema=="log")T.logger.error(xe);else throw new Error(xe)}}}var Ke=U.definition.compile,$e=U.definition.inline,Ye=U.definition.macro,Ae;if(Ke)Ae=Ke.call(T,H,de,me);else if(Ye)Ae=Ye.call(T,H,de,me),j.validateSchema!==!1&&T.validateSchema(Ae,!0);else if($e)Ae=$e.call(T,me,U.keyword,H,de);else if(Ae=U.definition.validate,!Ae)return;if(Ae===void 0)throw new Error('custom keyword "'+U.keyword+'"failed to compile');var Ve=F.length;return F[Ve]=Ae,{code:"customRule"+Ve,validate:Ae}}}function u(w,I,C){var E=m.call(this,w,I,C);return E>=0?{index:E,compiling:!0}:(E=this._compilations.length,this._compilations[E]={schema:w,root:I,baseId:C},{index:E,compiling:!1})}function d(w,I,C){var E=m.call(this,w,I,C);E>=0&&this._compilations.splice(E,1)}function m(w,I,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((a,e)=>{var r=Fr(),t=/^(\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)*)*$/,m=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;e.exports=f;function f(D){return D=D=="full"?"full":"fast",r.copy(f[D])}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":m,"relative-json-pointer":v},f.full={date:b,time:y,"date-time":I,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":m,"relative-json-pointer":v};function g(D){return D%4===0&&(D%100!==0||D%400===0)}function b(D){var $=D.match(t);if(!$)return!1;var O=+$[1],k=+$[2],P=+$[3];return k>=1&&k<=12&&P>=1&&P<=(k==2&&g(O)?29:i[k])}function y(D,$){var O=D.match(s);if(!O)return!1;var k=O[1],P=O[2],L=O[3],F=O[5];return(k<=23&&P<=59&&L<=59||k==23&&P==59&&L==60)&&(!$||F)}var w=/t|\s/i;function I(D){var $=D.split(w);return $.length==2&&b($[0])&&y($[1],!0)}var C=/\/|:/;function E(D){return C.test(D)&&o.test(D)}var T=/[^\\]\\Z/;function j(D){if(T.test(D))return!1;try{return new RegExp(D),!0}catch{return!1}}}),t8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.errSchemaPath+"/"+i,u=!t.opts.allErrors,d="data"+(p||""),m="valid"+o,v,f;if(c=="#"||c=="#/")t.isRoot?(v=t.async,f="validate"):(v=t.root.schema.$async===!0,f="root.refVal[0]");else{var g=t.resolveRef(t.baseId,c,t.isRoot);if(g===void 0){var b=t.MissingRefError.message(t.baseId,c);if(t.opts.missingRefs=="fail"){t.logger.error(b);var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { ref: '"+t.util.escapeQuotes(c)+"' } ",t.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+t.util.escapeQuotes(c)+"' "),t.opts.verbose&&(n+=" , schema: "+t.util.toQuotedString(c)+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!t.compositeRule&&u?t.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(t.opts.missingRefs=="ignore")t.logger.warn(b),u&&(n+=" if (true) { ");else throw new t.MissingRefError(t.baseId,c,b)}else if(g.inline){var I=t.util.copy(t);I.level++;var C="valid"+I.level;I.schema=g.schema,I.schemaPath="",I.errSchemaPath=c;var E=t.validate(I).replace(/validate\.schema/g,g.code);n+=" "+E+" ",u&&(n+=" if ("+C+") { ")}else v=g.$async===!0||t.async&&g.$async!==!1,f=g.code}if(f){var y=y||[];y.push(n),n="",t.opts.passContext?n+=" "+f+".call(this, ":n+=" "+f+"( ",n+=" "+d+", (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var T=p?"data"+(p-1||""):"parentData",j=p?t.dataPathArr[p]:"parentDataProperty";n+=" , "+T+" , "+j+", rootData) ";var D=n;if(n=y.pop(),v){if(!t.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+m+"; "),n+=" try { await "+D+"; ",u&&(n+=" "+m+" = 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+=" "+m+" = false; "),n+=" } ",u&&(n+=" if ("+m+") { ")}else n+=" if (!"+D+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n}}),a8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.schema[i],p=t.schemaPath+t.util.getProperty(i),c=t.errSchemaPath+"/"+i,l=!t.opts.allErrors,u=t.util.copy(t),d="";u.level++;var m="valid"+u.level,v=u.baseId,f=!0,g=o;if(g)for(var b,y=-1,w=g.length-1;y0||b===!1:t.util.schemaHasRules(b,t.RULES.all))&&(f=!1,u.schema=b,u.schemaPath=p+"["+y+"]",u.errSchemaPath=c+"/"+y,n+=" "+t.validate(u)+" ",u.baseId=v,l&&(n+=" if ("+m+") { ",d+="}"));return l&&(f?n+=" if (true) { ":n+=" "+d.slice(0,-1)+" "),n}}),r8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t),b="";g.level++;var y="valid"+g.level,w=c.every(function($){return t.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:t.util.schemaHasRules($,t.RULES.all)});if(w){var I=g.baseId;n+=" var "+f+" = errors; var "+v+" = false; ";var C=t.compositeRule;t.compositeRule=g.compositeRule=!0;var E=c;if(E)for(var T,j=-1,D=E.length-1;j{e.exports=function(t,i,s){var n=" ",o=t.schema[i],p=t.errSchemaPath+"/"+i,c=!t.opts.allErrors,l=t.util.toQuotedString(o);return t.opts.$comment===!0?n+=" console.log("+l+");":typeof t.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+t.util.toQuotedString(p)+", validate.root.schema);"),n}}),i8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f=t.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",g="schema"+o):g=c,f||(n+=" var schema"+o+" = validate.schema"+l+";"),n+="var "+v+" = equal("+m+", schema"+o+"); if (!"+v+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var y=n;return n=b.pop(),!t.compositeRule&&d?t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t),b="";g.level++;var y="valid"+g.level,w="i"+o,I=g.dataLevel=t.dataLevel+1,C="data"+I,E=t.baseId,T=t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all);if(n+="var "+f+" = errors;var "+v+";",T){var j=t.compositeRule;t.compositeRule=g.compositeRule=!0,g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" var "+y+" = false; for (var "+w+" = 0; "+w+" < "+m+".length; "+w+"++) { ",g.errorPath=t.util.getPathExpr(t.errorPath,w,t.opts.jsonPointers,!0);var D=m+"["+w+"]";g.dataPathArr[I]=w;var $=t.validate(g);g.baseId=E,t.util.varOccurences($,C)<2?n+=" "+t.util.varReplace($,C,D)+" ":n+=" var "+C+" = "+D+"; "+$+" ",n+=" if ("+y+") break; } ",t.compositeRule=g.compositeRule=j,n+=" "+b+" if (!"+y+") {"}else n+=" if ("+m+".length == 0) {";var O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var k=n;return n=O.pop(),!t.compositeRule&&d?t.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 { ",T&&(n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),t.opts.allErrors&&(n+=" } "),n}}),o8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="errs__"+o,f=t.util.copy(t),g="";f.level++;var b="valid"+f.level,y={},w={},I=t.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 T=t.errorPath;n+="var missing"+o+";";for(var j in w)if(E=w[j],E.length){if(n+=" if ( "+m+t.util.getProperty(j)+" !== undefined ",I&&(n+=" && Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(j)+"') "),d){n+=" && ( ";var D=E;if(D)for(var $,O=-1,k=D.length-1;O0||C===!1:t.util.schemaHasRules(C,t.RULES.all))&&(n+=" "+b+" = true; if ( "+m+t.util.getProperty(j)+" !== undefined ",I&&(n+=" && Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(j)+"') "),n+=") { ",f.schema=C,f.schemaPath=l+t.util.getProperty(j),f.errSchemaPath=u+"/"+t.util.escapeFragment(j),n+=" "+t.validate(f)+" ",f.baseId=oe,n+=" } ",d&&(n+=" if ("+b+") { ",g+="}"))}return d&&(n+=" "+g+" if ("+v+" == errors) {"),n}}),c8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f=t.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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("+m+", "+y+"["+b+"])) { "+v+" = true; break; }",f&&(n+=" } "),n+=" if (!"+v+") { ";var w=w||[];w.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var I=n;return n=w.pop(),!t.compositeRule&&d?t.async?n+=" throw new ValidationError(["+I+"]); ":n+=" validate.errors = ["+I+"]; return false; ":n+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n}}),p8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||"");if(t.opts.format===!1)return d&&(n+=" if (true) { "),n;var v=t.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",f="schema"+o):f=c;var g=t.opts.unknownFormats,b=Array.isArray(g);if(v){var y="format"+o,w="isObject"+o,I="formatType"+o;n+=" var "+y+" = formats["+f+"]; var "+w+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+I+" = "+w+" && "+y+".type || 'string'; if ("+w+") { ",t.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+" && "+I+" == '"+s+"' && !(typeof "+y+" == 'function' ? ",t.async?n+=" (async"+o+" ? await "+y+"("+m+") : "+y+"("+m+")) ":n+=" "+y+"("+m+") ",n+=" : "+y+".test("+m+"))))) {"}else{var y=t.formats[c];if(!y){if(g=="ignore")return t.logger.warn('unknown format "'+c+'" ignored in schema at path "'+t.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 "'+t.errSchemaPath+'"')}var w=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,I=w&&y.type||"string";if(w){var C=y.async===!0;y=y.validate}if(I!=s)return d&&(n+=" if (true) { "),n;if(C){if(!t.async)throw new Error("async format in sync schema");var E="formats"+t.util.getProperty(c)+".validate";n+=" if (!(await "+E+"("+m+"))) { "}else{n+=" if (! ";var E="formats"+t.util.getProperty(c);w&&(E+=".validate"),typeof y=="function"?n+=" "+E+"("+m+") ":n+=" "+E+".test("+m+") ",n+=") { "}}var T=T||[];T.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { format: ",v?n+=""+f:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match format "`,v?n+="' + "+f+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var j=n;return n=T.pop(),!t.compositeRule&&d?t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t);g.level++;var b="valid"+g.level,y=t.schema.then,w=t.schema.else,I=y!==void 0&&(t.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:t.util.schemaHasRules(y,t.RULES.all)),C=w!==void 0&&(t.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:t.util.schemaHasRules(w,t.RULES.all)),E=g.baseId;if(I||C){var T;g.createErrors=!1,g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" var "+f+" = errors; var "+v+" = true; ";var j=t.compositeRule;t.compositeRule=g.compositeRule=!0,n+=" "+t.validate(g)+" ",g.baseId=E,g.createErrors=!0,n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",t.compositeRule=g.compositeRule=j,I?(n+=" if ("+b+") { ",g.schema=t.schema.then,g.schemaPath=t.schemaPath+".then",g.errSchemaPath=t.errSchemaPath+"/then",n+=" "+t.validate(g)+" ",g.baseId=E,n+=" "+v+" = "+b+"; ",I&&C?(T="ifClause"+o,n+=" var "+T+" = 'then'; "):T="'then'",n+=" } ",C&&(n+=" else { ")):n+=" if (!"+b+") { ",C&&(g.schema=t.schema.else,g.schemaPath=t.schemaPath+".else",g.errSchemaPath=t.errSchemaPath+"/else",n+=" "+t.validate(g)+" ",g.baseId=E,n+=" "+v+" = "+b+"; ",I&&C?(T="ifClause"+o,n+=" var "+T+" = 'else'; "):T="'else'",n+=" } "),n+=" if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { failingKeyword: "+T+" } ",t.opts.messages!==!1&&(n+=` , message: 'should match "' + `+T+` + '" schema' `),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&d&&(t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t),b="";g.level++;var y="valid"+g.level,w="i"+o,I=g.dataLevel=t.dataLevel+1,C="data"+I,E=t.baseId;if(n+="var "+f+" = errors;var "+v+";",Array.isArray(c)){var T=t.schema.additionalItems;if(T===!1){n+=" "+v+" = "+m+".length <= "+c.length+"; ";var j=u;u=t.errSchemaPath+"/additionalItems",n+=" if (!"+v+") { ";var D=D||[];D.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+c.length+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+c.length+" items' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var $=n;n=D.pop(),!t.compositeRule&&d?t.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; 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,P=-1,L=O.length-1;P0||k===!1:t.util.schemaHasRules(k,t.RULES.all)){n+=" "+y+" = true; if ("+m+".length > "+P+") { ";var F=m+"["+P+"]";g.schema=k,g.schemaPath=l+"["+P+"]",g.errSchemaPath=u+"/"+P,g.errorPath=t.util.getPathExpr(t.errorPath,P,t.opts.jsonPointers,!0),g.dataPathArr[I]=P;var B=t.validate(g);g.baseId=E,t.util.varOccurences(B,C)<2?n+=" "+t.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",n+=" } ",d&&(n+=" if ("+y+") { ",b+="}")}}if(typeof T=="object"&&(t.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:t.util.schemaHasRules(T,t.RULES.all))){g.schema=T,g.schemaPath=t.schemaPath+".additionalItems",g.errSchemaPath=t.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+m+".length > "+c.length+") { for (var "+w+" = "+c.length+"; "+w+" < "+m+".length; "+w+"++) { ",g.errorPath=t.util.getPathExpr(t.errorPath,w,t.opts.jsonPointers,!0);var F=m+"["+w+"]";g.dataPathArr[I]=w;var B=t.validate(g);g.baseId=E,t.util.varOccurences(B,C)<2?n+=" "+t.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",d&&(n+=" if (!"+y+") break; "),n+=" } } ",d&&(n+=" if ("+y+") { ",b+="}")}}else if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" for (var "+w+" = 0; "+w+" < "+m+".length; "+w+"++) { ",g.errorPath=t.util.getPathExpr(t.errorPath,w,t.opts.jsonPointers,!0);var F=m+"["+w+"]";g.dataPathArr[I]=w;var B=t.validate(g);g.baseId=E,t.util.varOccurences(B,C)<2?n+=" "+t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,E,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",f="schema"+o):f=c;var g=i=="maximum",b=g?"exclusiveMaximum":"exclusiveMinimum",y=t.schema[b],w=t.opts.$data&&y&&y.$data,I=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 T=t.util.getData(y.$data,p,t.dataPathArr),j="exclusive"+o,D="exclType"+o,$="exclIsNumber"+o,O="op"+o,k="' + "+O+" + '";n+=" var schemaExcl"+o+" = "+T+"; ",T="schemaExcl"+o,n+=" var "+j+"; var "+D+" = typeof "+T+"; if ("+D+" != 'boolean' && "+D+" != 'undefined' && "+D+" != 'number') { ";var E=b,P=P||[];P.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(E||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: '"+b+" should be boolean' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var L=n;n=P.pop(),!t.compositeRule&&d?t.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+=" } else if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+D+" == 'number' ? ( ("+j+" = "+f+" === undefined || "+T+" "+I+"= "+f+") ? "+m+" "+C+"= "+T+" : "+m+" "+C+" "+f+" ) : ( ("+j+" = "+T+" === true) ? "+m+" "+C+"= "+f+" : "+m+" "+C+" "+f+" ) || "+m+" !== "+m+") { var op"+o+" = "+j+" ? '"+I+"' : '"+I+"='; ",c===void 0&&(E=b,u=t.errSchemaPath+"/"+b,f=T,v=w)}else{var $=typeof y=="number",k=I;if($&&v){var O="'"+k+"'";n+=" if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" ( "+f+" === undefined || "+y+" "+I+"= "+f+" ? "+m+" "+C+"= "+y+" : "+m+" "+C+" "+f+" ) || "+m+" !== "+m+") { "}else{$&&c===void 0?(j=!0,E=b,u=t.errSchemaPath+"/"+b,f=y,C+="="):($&&(f=Math[g?"min":"max"](y,c)),y===($?f:!0)?(j=!0,E=b,u=t.errSchemaPath+"/"+b,C+="="):(j=!1,k+="="));var O="'"+k+"'";n+=" if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+m+" "+C+" "+f+" || "+m+" !== "+m+") { "}}E=E||i;var P=P||[];P.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(E||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { comparison: "+O+", limit: "+f+", exclusive: "+j+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be "+k+" ",v?n+="' + "+f:n+=""+f+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var L=n;return n=P.pop(),!t.compositeRule&&d?t.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+=" } ",d&&(n+=" else { "),n}}),pv=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,b,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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+=" "+m+".length "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+f+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",i=="maxItems"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" items' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!t.compositeRule&&d?t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,b,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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') || "),t.opts.unicode===!1?n+=" "+m+".length ":n+=" ucs2length("+m+") ",n+=" "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+f+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be ",i=="maxLength"?n+="longer":n+="shorter",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" characters' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!t.compositeRule&&d?t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,b,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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("+m+").length "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+f+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",i=="maxProperties"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" properties' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!t.compositeRule&&d?t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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+" = "+m+" / "+f+", ",t.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+t.opts.multipleOfPrecision+" ":n+=" division"+o+" !== parseInt(division"+o+") ",n+=" ) ",v&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { multipleOf: "+f+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",v?n+="' + "+f:n+=""+f+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&d?t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="errs__"+o,f=t.util.copy(t);f.level++;var g="valid"+f.level;if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){f.schema=c,f.schemaPath=l,f.errSchemaPath=u,n+=" var "+v+" = errors; ";var b=t.compositeRule;t.compositeRule=f.compositeRule=!0,f.createErrors=!1;var y;f.opts.allErrors&&(y=f.opts.allErrors,f.opts.allErrors=!1),n+=" "+t.validate(f)+" ",f.createErrors=!0,y&&(f.opts.allErrors=y),t.compositeRule=f.compositeRule=b,n+=" if ("+g+") { ";var w=w||[];w.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var I=n;n=w.pop(),!t.compositeRule&&d?t.async?n+=" throw new ValidationError(["+I+"]); ":n+=" validate.errors = ["+I+"]; return false; ":n+=" var err = "+I+"; 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; } ",t.opts.allErrors&&(n+=" } ")}else n+=" var err = ",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(n+=" if (false) { ");return n}}),m8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t),b="";g.level++;var y="valid"+g.level,w=g.baseId,I="prevValid"+o,C="passingSchemas"+o;n+="var "+f+" = errors , "+I+" = false , "+v+" = false , "+C+" = null; ";var E=t.compositeRule;t.compositeRule=g.compositeRule=!0;var T=c;if(T)for(var j,D=-1,$=T.length-1;D<$;)j=T[D+=1],(t.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:t.util.schemaHasRules(j,t.RULES.all))?(g.schema=j,g.schemaPath=l+"["+D+"]",g.errSchemaPath=u+"/"+D,n+=" "+t.validate(g)+" ",g.baseId=w):n+=" var "+y+" = true; ",D&&(n+=" if ("+y+" && "+I+") { "+v+" = false; "+C+" = ["+C+", "+D+"]; } else { ",b+="}"),n+=" if ("+y+") { "+v+" = "+I+" = true; "+C+" = "+D+"; }";return t.compositeRule=g.compositeRule=E,n+=""+b+"if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { passingSchemas: "+C+" } ",t.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&d&&(t.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; }",t.opts.allErrors&&(n+=" } "),n}}),h8=ie((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",f="schema"+o):f=c;var g=v?"(new RegExp("+f+"))":t.usePattern(c);n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" !"+g+".test("+m+") ) { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { pattern: ",v?n+=""+f:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,v?n+="' + "+f+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var y=n;return n=b.pop(),!t.compositeRule&&d?t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="errs__"+o,f=t.util.copy(t),g="";f.level++;var b="valid"+f.level,y="key"+o,w="idx"+o,I=f.dataLevel=t.dataLevel+1,C="data"+I,E="dataProperties"+o,T=Object.keys(c||{}).filter(Y),j=t.schema.patternProperties||{},D=Object.keys(j).filter(Y),$=t.schema.additionalProperties,O=T.length||D.length,k=$===!1,P=typeof $=="object"&&Object.keys($).length,L=t.opts.removeAdditional,F=k||P||L,B=t.opts.ownProperties,V=t.baseId,J=t.schema.required;if(J&&!(t.opts.$data&&J.$data)&&J.length8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var ee=T;if(ee)for(var oe,We=-1,Qe=ee.length-1;We0||$e===!1:t.util.schemaHasRules($e,t.RULES.all)){var Ye=t.util.getProperty(oe),me=m+Ye,Ae=Ce&&$e.default!==void 0;f.schema=$e,f.schemaPath=l+Ye,f.errSchemaPath=u+"/"+t.util.escapeFragment(oe),f.errorPath=t.util.getPath(t.errorPath,oe,t.opts.jsonPointers),f.dataPathArr[I]=t.util.toQuotedString(oe);var ne=t.validate(f);if(f.baseId=V,t.util.varOccurences(ne,C)<2){ne=t.util.varReplace(ne,C,me);var Ve=me}else{var Ve=C;n+=" var "+C+" = "+me+"; "}if(Ae)n+=" "+ne+" ";else{if(K&&K[oe]){n+=" if ( "+Ve+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(oe)+"') "),n+=") { "+b+" = false; ";var M=t.errorPath,ce=u,gt=t.util.escapeQuotes(oe);t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPath(M,oe,t.opts.jsonPointers)),u=t.errSchemaPath+"/required";var U=U||[];U.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { missingProperty: '"+gt+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+gt+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var H=n;n=U.pop(),!t.compositeRule&&d?t.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,t.errorPath=M,n+=" } else { "}else d?(n+=" if ( "+Ve+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(oe)+"') "),n+=") { "+b+" = true; } else { "):(n+=" if ("+Ve+" !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(oe)+"') "),n+=" ) { ");n+=" "+ne+" } "}}d&&(n+=" if ("+b+") { ",g+="}")}}if(D.length){var ut=D;if(ut)for(var Re,Fn=-1,ds=ut.length-1;Fn0||$e===!1:t.util.schemaHasRules($e,t.RULES.all)){f.schema=$e,f.schemaPath=t.schemaPath+".patternProperties"+t.util.getProperty(Re),f.errSchemaPath=t.errSchemaPath+"/patternProperties/"+t.util.escapeFragment(Re),B?n+=" "+E+" = "+E+" || Object.keys("+m+"); for (var "+w+"=0; "+w+"<"+E+".length; "+w+"++) { var "+y+" = "+E+"["+w+"]; ":n+=" for (var "+y+" in "+m+") { ",n+=" if ("+t.usePattern(Re)+".test("+y+")) { ",f.errorPath=t.util.getPathExpr(t.errorPath,y,t.opts.jsonPointers);var me=m+"["+y+"]";f.dataPathArr[I]=y;var ne=t.validate(f);f.baseId=V,t.util.varOccurences(ne,C)<2?n+=" "+t.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="errs__"+o,f=t.util.copy(t),g="";f.level++;var b="valid"+f.level;if(n+="var "+v+" = errors;",t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){f.schema=c,f.schemaPath=l,f.errSchemaPath=u;var y="key"+o,w="idx"+o,I="i"+o,C="' + "+y+" + '",E=f.dataLevel=t.dataLevel+1,T="data"+E,j="dataProperties"+o,D=t.opts.ownProperties,$=t.baseId;D&&(n+=" var "+j+" = undefined; "),D?n+=" "+j+" = "+j+" || Object.keys("+m+"); for (var "+w+"=0; "+w+"<"+j+".length; "+w+"++) { var "+y+" = "+j+"["+w+"]; ":n+=" for (var "+y+" in "+m+") { ",n+=" var startErrs"+o+" = errors; ";var O=y,k=t.compositeRule;t.compositeRule=f.compositeRule=!0;var P=t.validate(f);f.baseId=$,t.util.varOccurences(P,T)<2?n+=" "+t.util.varReplace(P,T,O)+" ":n+=" var "+T+" = "+O+"; "+P+" ",t.compositeRule=f.compositeRule=k,n+=" if (!"+b+") { for (var "+I+"=startErrs"+o+"; "+I+"{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f=t.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",g="schema"+o):g=c;var b="schema"+o;if(!f)if(c.length0||T===!1:t.util.schemaHasRules(T,t.RULES.all))||(y[y.length]=I)}}else var y=c;if(f||y.length){var j=t.errorPath,D=f||y.length>=t.opts.loopRequired,$=t.opts.ownProperties;if(d)if(n+=" var missing"+o+"; ",D){f||(n+=" var "+b+" = validate.schema"+l+"; ");var O="i"+o,k="schema"+o+"["+O+"]",P="' + "+k+" + '";t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPathExpr(j,k,t.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+" = "+m+"["+b+"["+O+"]] !== undefined ",$&&(n+=" && Object.prototype.hasOwnProperty.call("+m+", "+b+"["+O+"]) "),n+="; if (!"+v+") break; } ",f&&(n+=" } "),n+=" if (!"+v+") { ";var L=L||[];L.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { missingProperty: '"+P+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+P+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var F=n;n=L.pop(),!t.compositeRule&&d?t.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(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f=t.opts.$data&&c&&c.$data,g;if(f?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",g="schema"+o):g=c,(c||f)&&t.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 = "+m+".length , "+v+" = true , j; if (i > 1) { ";var b=t.schema.items&&t.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("+m+"[i], "+m+"[j])) { "+v+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var w="checkDataType"+(y?"s":"");n+=" if ("+t.util[w](b,"item",t.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 I=I||[];I.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { i: i, j: j } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),t.opts.verbose&&(n+=" , schema: ",f?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var C=n;n=I.pop(),!t.compositeRule&&d?t.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((a,e)=>{e.exports={$ref:t8(),allOf:a8(),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((a,e)=>{var r=b8(),t=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=t(n),s.types=t(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 m=s.all[l]={keyword:l,code:r[l],implements:u};return m}),s.all.$comment={keyword:"$comment",code:r.$comment},c.type&&(s.types[c.type]=c)}),s.keywords=t(n.concat(o)),s.custom={},s}}),_8=ie((a,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(t,i){for(var s=0;s{var r=jc().MissingRef;e.exports=t;function t(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)?t.call(o,{$ref:d},!0):Promise.resolve()}function l(u){try{return o._compile(u)}catch(m){if(m instanceof r)return d(m);throw m}function d(m){var v=m.missingSchema;if(b(v))throw new Error("Schema "+v+" is loaded but "+m.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((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m,v="data"+(p||""),f="valid"+o,g="errs__"+o,b=t.opts.$data&&c&&c.$data,y;b?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",y="schema"+o):y=c;var w=this,I="definition"+o,C=w.definition,E="",T,j,D,$,O;if(b&&C.$data){O="keywordValidate"+o;var k=C.validateSchema;n+=" var "+I+" = RULES.custom['"+i+"'].definition; var "+O+" = "+I+".validate;"}else{if($=t.useCustomRule(w,c,t.schema,t),!$)return;y="validate.schema"+l,O=$.code,T=C.compile,j=C.inline,D=C.macro}var P=O+".errors",L="i"+o,F="ruleErr"+o,B=C.async;if(B&&!t.async)throw new Error("async keyword in sync schema");if(j||D||(n+=""+P+" = null;"),n+="var "+g+" = errors;var "+f+";",b&&C.$data&&(E+="}",n+=" if ("+y+" === undefined) { "+f+" = true; } else { ",k&&(E+="}",n+=" "+f+" = "+I+".validateSchema("+y+"); if ("+f+") { ")),j)C.statements?n+=" "+$.validate+" ":n+=" "+f+" = "+$.validate+"; ";else if(D){var V=t.util.copy(t),E="";V.level++;var J="valid"+V.level;V.schema=$.validate,V.schemaPath="";var K=t.compositeRule;t.compositeRule=V.compositeRule=!0;var Y=t.validate(V).replace(/validate\.schema/g,O);t.compositeRule=V.compositeRule=K,n+=" "+Y}else{var ee=ee||[];ee.push(n),n="",n+=" "+O+".call( ",t.opts.passContext?n+="this":n+="self",T||C.schema===!1?n+=" , "+v+" ":n+=" , "+y+" , "+v+" , validate.schema"+t.schemaPath+" ",n+=" , (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var oe=p?"data"+(p-1||""):"parentData",We=p?t.dataPathArr[p]:"parentDataProperty";n+=" , "+oe+" , "+We+" , rootData ) ";var Qe=n;n=ee.pop(),C.errors===!1?(n+=" "+f+" = ",B&&(n+="await "),n+=""+Qe+"; "):B?(P="customErrors"+o,n+=" var "+P+" = null; try { "+f+" = await "+Qe+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+P+" = e.errors; else throw e; } "):n+=" "+P+" = null; "+f+" = "+Qe+"; "}if(C.modifying&&(n+=" if ("+oe+") "+v+" = "+oe+"["+We+"];"),n+=""+E,C.valid)d&&(n+=" if (true) { ");else{n+=" if ( ",C.valid===void 0?(n+=" !",D?n+=""+J:n+=""+f):n+=" "+!C.valid+" ",n+=") { ",m=w.keyword;var ee=ee||[];ee.push(n),n="";var ee=ee||[];ee.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { keyword: '"+w.keyword+"' } ",t.opts.messages!==!1&&(n+=` , message: 'should pass "`+w.keyword+`" keyword validation' `),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+v+" "),n+=" } "):n+=" {} ";var Xe=n;n=ee.pop(),!t.compositeRule&&d?t.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 "+L+"="+g+"; "+L+"{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((a,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"}]}}}}),T8=ie((a,e)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,t=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 m=0;m{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((a,e)=>{var r=J4(),t=Ac(),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=I,g.prototype.validateSchema=C,g.prototype.getSchema=T,g.prototype.removeSchema=$,g.prototype.addFormat=K,g.prototype.errorsText=J,g.prototype._addSchema=k,g.prototype._compile=P,g.prototype.compileAsync=E8();var u=T8();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 m="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=L(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&&oe(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 U=X(M);return X.$async!==!0&&(this.errors=X.errors),U}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 U=0;U0&&O.push("--allowedTools",C.join(",")),E.length>0&&O.push("--disallowedTools",E.join(",")),T&&Object.keys(T).length>0&&O.push("--mcp-config",JSON.stringify({mcpServers:T})),r&&Object.keys(r).length>0&&O.push("--agents",JSON.stringify(r)),I&&O.push("--setting-sources",I.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)}$&&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"),!ea().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 P=dv(o),L=P?o:i,F=P?[...s,...O]:[...s,o,...O];this.logForDebugging(P?`Spawning Claude Code native binary: ${L} ${F.join(" ")}`:`Spawning Claude Code process: ${L} ${F.join(" ")}`);let B=p.DEBUG||c?"pipe":"ignore";this.child=(0,Ov.spawn)(L,F,{cwd:t,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 ja("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 ja("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 L4(){return function(e){if(this.hasTrailingSlash()){this.error(404);return}var r=hc.original(this.req);r.path=null,r.pathname=N4(r.pathname+"/");var t=O4(A4.format(r)),i=D4("Redirecting","Redirecting to "+C4(t));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",t),e.end(i)}}});var iv=A((ct,nv)=>{"use strict";var Wi=Tf(),$4=require("events").EventEmitter,ev=Rf(),tv=ch(),F4=Mo(),M4=zo(),av=Nh(),rv=Qh();ct=nv.exports=U4;function U4(){var a=function(e,r,t){a.handle(e,r,t)};return ev(a,$4.prototype,!1),ev(a,tv,!1),a.request=Object.create(av,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.response=Object.create(rv,{app:{configurable:!0,enumerable:!0,writable:!0,value:a}}),a.init(),a}ct.application=tv;ct.request=av;ct.response=rv;ct.Route=F4;ct.Router=M4;ct.json=Wi.json;ct.query=Bo();ct.raw=Wi.raw;ct.static=Yh();ct.text=Wi.text;ct.urlencoded=Wi.urlencoded;var z4=["bodyParser","compress","cookieSession","session","logger","cookieParser","favicon","responseTime","errorHandler","timeout","methodOverride","vhost","csrf","directory","limit","multipart","staticCache"];z4.forEach(function(a){Object.defineProperty(ct,a,{get:function(){throw new Error("Most middleware (like "+a+") is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.")},configurable:!0})})});var ov=A((D6,sv)=>{"use strict";sv.exports=iv()});var eR={};Hg(eR,{WorkerService:()=>us});module.exports=Vg(eR);var Vc=vs(ov(),1);var bc=require("path"),Tv=require("url"),Pv=require("events"),Ov=require("child_process"),Cv=require("readline"),re=vs(require("fs"),1),Iv=require("fs/promises"),Lv=require("path"),$v=require("os"),Na=require("path"),Sc=require("process"),Fv=require("crypto"),W2={},B4=Object.create,H4=Object.getPrototypeOf,yc=Object.defineProperty,V4=Object.getOwnPropertyNames,G4=Object.prototype.hasOwnProperty,Z4=(a,e,r)=>{r=a!=null?B4(H4(a)):{};let t=e||!a||!a.__esModule?yc(r,"default",{value:a,enumerable:!0}):r;for(let i of V4(a))G4.call(t,i)||yc(t,i,{get:()=>a[i],enumerable:!0});return t},se=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),W4=(a,e)=>{for(var r in e)yc(a,r,{get:e[r],enumerable:!0,configurable:!0,set:t=>e[r]=()=>t})},X4=se((a,e)=>{(function(r,t){typeof a=="object"&&typeof e<"u"?t(a):typeof define=="function"&&define.amd?define(["exports"],t):t(r.URI=r.URI||{})})(a,function(r){function t(){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 N=x.length-1,q=1;q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=f-g,k=Math.floor,P=String.fromCharCode;function L(_){throw new RangeError($[_])}function F(_,x){for(var S=[],N=_.length;N--;)S[N]=x(_[N]);return S}function B(_,x){var S=_.split("@"),N="";S.length>1&&(N=S[0]+"@",_=S[1]),_=_.replace(D,".");var q=_.split("."),Z=F(q,x).join(".");return N+Z}function V(_){for(var x=[],S=0,N=_.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))},oe=function(x){var S=[],N=x.length,q=0,Z=C,ue=I,ge=x.lastIndexOf(E);ge<0&&(ge=0);for(var we=0;we=128&&L("not-basic"),S.push(x.charCodeAt(we));for(var Ue=ge>0?ge+1:0;Ue=N&&L("invalid-input");var je=K(x.charCodeAt(Ue++));(je>=f||je>k((v-q)/De))&&L("overflow"),q+=je*De;var ye=ze<=ue?g:ze>=ue+b?b:ze-ue;if(jek(v/qe)&&L("overflow"),De*=qe}var Se=S.length+1;ue=ee(q-he,Se,he==0),k(q/Se)>v-Z&&L("overflow"),Z+=k(q/Se),q%=Se,S.splice(q++,0,Z)}return String.fromCodePoint.apply(String,S)},We=function(x){var S=[];x=V(x);var N=x.length,q=C,Z=0,ue=I,ge=!0,we=!1,Ue=void 0;try{for(var he=x[Symbol.iterator](),De;!(ge=(De=he.next()).done);ge=!0){var ze=De.value;ze<128&&S.push(P(ze))}}catch(ga){we=!0,Ue=ga}finally{try{!ge&&he.return&&he.return()}finally{if(we)throw Ue}}var je=S.length,ye=je;for(je&&S.push(E);ye=q&&ftk((v-Z)/yt)&&L("overflow"),Z+=(qe-q)*yt,q=qe;var Nt=!0,va=!1,Gt=void 0;try{for(var Vr=x[Symbol.iterator](),Mn;!(Nt=(Mn=Vr.next()).done);Nt=!0){var Un=Mn.value;if(Unv&&L("overflow"),Un==q){for(var Ja=Z,Ya=f;;Ya+=f){var Zt=Ya<=ue?g:Ya>=ue+b?b:Ya-ue;if(Ja>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,N=_.length;S=194&&q<224){if(N-S>=6){var Z=parseInt(_.substr(S+4,2),16);x+=String.fromCharCode((q&31)<<6|Z&63)}else x+=_.substr(S,6);S+=6}else if(q>=224){if(N-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(N){var q=M(N);return q.match(x.UNRESERVED)?q:N}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 U(_,x){var S=_.match(x.IPV4ADDRESS)||[],N=d(S,2),q=N[1];return q?q.split(".").map(ce).join("."):_}function H(_,x){var S=_.match(x.IPV6ADDRESS)||[],N=d(S,3),q=N[1],Z=N[2];if(q){for(var ue=q.toLowerCase().split("::").reverse(),ge=d(ue,2),we=ge[0],Ue=ge[1],he=Ue?Ue.split(":").map(ce):[],De=we.split(":").map(ce),ze=x.IPV4ADDRESS.test(De[De.length-1]),je=ze?7:8,ye=De.length-je,qe=Array(je),Se=0;Se1){var Te=qe.slice(0,dt.index),ft=qe.slice(dt.index+dt.length);xt=Te.join(":")+"::"+ft.join(":")}else xt=qe.join(":");return Z&&(xt+="%"+Z),xt}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={},N=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(U(S.host,N),N)),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 Z=Ne[(x.scheme||S.scheme||"").toLowerCase()];if(!x.unicodeSupport&&(!Z||!Z.unicodeSupport)){if(S.host&&(x.domainHost||Z&&Z.domainHost))try{S.host=Re.toASCII(S.host.replace(N.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,N);Z&&Z.parse&&Z.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,N=[];return _.userinfo!==void 0&&(N.push(_.userinfo),N.push("@")),_.host!==void 0&&N.push(H(U(String(_.host),S),S).replace(S.IPV6ADDRESS,function(q,Z,ue){return"["+Z+(ue?"%25"+ue:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(N.push(":"),N.push(String(_.port))),N.length?N.join(""):void 0}var Ie=/^\.\.?\//,xe=/^\/\.(\/|$)/,Ke=/^\/\.\.(\/|$)/,$e=/^\/?(?:.|\n)*?(?=\/|$)/;function Ye(_){for(var x=[];_.length;)if(_.match(Ie))_=_.replace(Ie,"");else if(_.match(xe))_=_.replace(xe,"/");else if(_.match(Ke))_=_.replace(Ke,"/"),x.pop();else if(_==="."||_==="..")_="";else{var S=_.match($e);if(S){var N=S[0];_=_.slice(N.length),x.push(N)}else throw new Error("Unexpected dot segment condition")}return x.join("")}function Ae(_){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=x.iri?u:l,N=[],q=Ne[(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&&(N.push(_.scheme),N.push(":"));var Z=Ce(_,x);if(Z!==void 0&&(x.reference!=="suffix"&&N.push("//"),N.push(Z),_.path&&_.path.charAt(0)!=="/"&&N.push("/")),_.path!==void 0){var ue=_.path;!x.absolutePath&&(!q||!q.absolutePath)&&(ue=Ye(ue)),Z===void 0&&(ue=ue.replace(/^\/\//,"/%2F")),N.push(ue)}return _.query!==void 0&&(N.push("?"),N.push(_.query)),_.fragment!==void 0&&(N.push("#"),N.push(_.fragment)),N.join("")}function Ve(_,x){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},N=arguments[3],q={};return N||(_=ne(Ae(_,S),S),x=ne(Ae(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 gt(_,x,S){var N=p({scheme:"null"},S);return Ae(Ve(ne(_,N),ne(x,N),N,!0),N)}function ut(_,x){return typeof _=="string"?_=Ae(ne(_,x),x):s(_)==="object"&&(_=ne(Ae(_,x),x)),_}function Fn(_,x,S){return typeof _=="string"?_=Ae(ne(_,S),S):s(_)==="object"&&(_=Ae(_,S)),typeof x=="string"?x=Ae(ne(x,S),S):s(x)==="object"&&(x=Ae(x,S)),_===x}function ds(_,x){return _&&_.toString().replace(!x||!x.iri?l.ESCAPE:u.ESCAPE,R)}function Rt(_,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 N=String(x.scheme).toLowerCase()==="https";return(x.port===(N?443:80)||x.port==="")&&(x.port=void 0),x.path||(x.path="/"),x}},Gc={scheme:"https",domainHost:Br.domainHost,parse:Br.parse,serialize:Br.serialize};function Zc(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Hr={scheme:"ws",domainHost:!0,parse:function(x,S){var N=x;return N.secure=Zc(N),N.resourceName=(N.path||"/")+(N.query?"?"+N.query:""),N.path=void 0,N.query=void 0,N},serialize:function(x,S){if((x.port===(Zc(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 N=x.resourceName.split("?"),q=d(N,2),Z=q[0],ue=q[1];x.path=Z&&Z!=="/"?Z: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":"")+"]",jt="[0-9A-Fa-f]",_g=i(i("%[EFef]"+jt+"%"+jt+jt+"%"+jt+jt)+"|"+i("%[89A-Fa-f]"+jt+"%"+jt+jt)+"|"+i("%"+jt+jt)),Eg="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Sg="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",kg=t(Sg,'[\\"\\\\]'),Tg="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Pg=new RegExp(Xc,"g"),Qa=new RegExp(_g,"g"),Rg=new RegExp(t("[^]",Eg,"[\\.]",'[\\"]',kg),"g"),Kc=new RegExp(t("[^]",Xc,Tg),"g"),Og=Kc;function fs(_){var x=M(_);return x.match(Pg)?x:_}var Qc={scheme:"mailto",parse:function(x,S){var N=x,q=N.to=N.path?N.path.split(","):[];if(N.path=void 0,N.query){for(var Z=!1,ue={},ge=N.query.split("&"),we=0,Ue=ge.length;we{e.exports=function r(t,i){if(t===i)return!0;if(t&&i&&typeof t=="object"&&typeof i=="object"){if(t.constructor!==i.constructor)return!1;var s,n,o;if(Array.isArray(t)){if(s=t.length,s!=i.length)return!1;for(n=s;n--!==0;)if(!r(t[n],i[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===i.source&&t.flags===i.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===i.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===i.toString();if(o=Object.keys(t),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(t[p],i[p]))return!1}return!0}return t!==t&&i!==i}}),K4=se((a,e)=>{e.exports=function(t){for(var i=0,s=t.length,n=0,o;n=55296&&o<=56319&&n{e.exports={copy:r,checkDataType:t,checkDataTypes:i,coerceToTypes:n,toHash:o,getProperty:l,escapeQuotes:u,equal:Ic(),ucs2length:K4(),varOccurences:d,varReplace:m,schemaHasRules:v,schemaHasRulesExcept:f,schemaUnknownRules:g,toQuotedString:b,getPathExpr:y,getPath:w,getData:E,unescapeFragment:j,unescapeJsonPointer:O,escapeFragment:D,escapeJsonPointer:$};function r(k,P){P=P||{};for(var L in k)P[L]=k[L];return P}function t(k,P,L,F){var B=F?" !== ":" === ",V=F?" || ":" && ",J=F?"!":"",K=F?"":"!";switch(k){case"null":return P+B+"null";case"array":return J+"Array.isArray("+P+")";case"object":return"("+J+P+V+"typeof "+P+B+'"object"'+V+K+"Array.isArray("+P+"))";case"integer":return"(typeof "+P+B+'"number"'+V+K+"("+P+" % 1)"+V+P+B+P+(L?V+J+"isFinite("+P+")":"")+")";case"number":return"(typeof "+P+B+'"'+k+'"'+(L?V+J+"isFinite("+P+")":"")+")";default:return"typeof "+P+B+'"'+k+'"'}}function i(k,P,L){switch(k.length){case 1:return t(k[0],P,L,!0);default:var F="",B=o(k);B.array&&B.object&&(F=B.null?"(":"(!"+P+" || ",F+="typeof "+P+' !== "object")',delete B.null,delete B.array,delete B.object),B.number&&delete B.integer;for(var V in B)F+=(F?" && ":"")+t(V,P,L,!0);return F}}var s=o(["string","number","integer","boolean","null"]);function n(k,P){if(Array.isArray(P)){for(var L=[],F=0;F=P)throw new Error("Cannot access property/index "+F+" levels up, current level is "+P);return L[P-F]}if(F>P)throw new Error("Cannot access data "+F+" levels up, current level is "+P);if(V="data"+(P-F||""),!B)return V}for(var K=V,Y=B.split("/"),ee=0;ee{var r=Fr();e.exports=t;function t(i){r.copy(i,this)}}),Q4=se((a,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(){};t(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 t(s,n,o,p,c,l,u,d,m,v){if(p&&typeof p=="object"&&!Array.isArray(p)){n(p,c,l,u,d,m,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(),t=Ic(),i=Fr(),s=_v(),n=Q4();e.exports=o,o.normalizeId=w,o.fullPath=g,o.url=I,o.ids=C,o.inlineRef=m,o.schema=p;function o(E,T,j){var D=this._refs[j];if(typeof D=="string")if(this._refs[D])D=this._refs[D];else return o.call(this,E,T,D);if(D=D||this._schemas[j],D instanceof s)return m(D.schema,this._opts.inlineRefs)?D.schema:D.validate||this._compile(D);var $=p.call(this,T,j),O,k,P;return $&&(O=$.schema,T=$.root,P=$.baseId),O instanceof s?k=O.validate||E.call(this,O.schema,T,void 0,P):O!==void 0&&(k=m(O,this._opts.inlineRefs)?O:E.call(this,O,T,void 0,P)),k}function p(E,T){var j=r.parse(T),D=b(j),$=g(this._getId(E.schema));if(Object.keys(E.schema).length===0||D!==$){var O=w(D),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(T))return{schema:k,root:E,baseId:$};E=k}else return;if(!E.schema)return;$=g(this._getId(E.schema))}return u.call(this,j,$,E.schema,E)}function c(E,T,j){var D=p.call(this,E,T);if(D){var $=D.schema,O=D.baseId;E=D.root;var k=this._getId($);return k&&(O=I(O,k)),u.call(this,j,O,$,E)}}var l=i.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function u(E,T,j,D){if(E.fragment=E.fragment||"",E.fragment.slice(0,1)=="/"){for(var $=E.fragment.split("/"),O=1;O<$.length;O++){var k=$[O];if(k){if(k=i.unescapeFragment(k),j=j[k],j===void 0)break;var P;if(!l[k]&&(P=this._getId(j),P&&(T=I(T,P)),j.$ref)){var L=I(T,j.$ref),F=p.call(this,D,L);F&&(j=F.schema,D=F.root,T=F.baseId)}}}if(j!==void 0&&j!==D.schema)return{schema:j,root:D,baseId:T}}}var d=i.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function m(E,T){if(T===!1)return!1;if(T===void 0||T===!0)return v(E);if(T)return f(E)<=T}function v(E){var T;if(Array.isArray(E)){for(var j=0;j{var r=Ac();e.exports={Validation:s(t),MissingRef:s(i)};function t(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=se((a,e)=>{e.exports=function(r,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var i=typeof t.cycles=="boolean"?t.cycles:!1,s=t.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)}}}(t.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(t,i,s){var n="",o=t.schema.$async===!0,p=t.util.schemaHasRulesExcept(t.schema,t.RULES.all,"$ref"),c=t.self._getId(t.schema);if(t.opts.strictKeywords){var l=t.util.schemaUnknownRules(t.schema,t.RULES.keywords);if(l){var u="unknown keyword: "+l;if(t.opts.strictKeywords==="log")t.logger.warn(u);else throw new Error(u)}}if(t.isTop&&(n+=" var validate = ",o&&(t.async=!0,n+="async "),n+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",c&&(t.opts.sourceCode||t.opts.processCode)&&(n+=" "+("/*# sourceURL="+c+" */")+" ")),typeof t.schema=="boolean"||!(p||t.schema.$ref)){var i="false schema",d=t.level,m=t.dataLevel,v=t.schema[i],f=t.schemaPath+t.util.getProperty(i),g=t.errSchemaPath+"/"+i,T=!t.opts.allErrors,$,b="data"+(m||""),E="valid"+d;if(t.schema===!1){t.isTop?T=!0:n+=" var "+E+" = false; ";var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+($||"false schema")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(g)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'boolean schema is false' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+b+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!t.compositeRule&&T?t.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 t.isTop?o?n+=" return data; ":n+=" validate.errors = null; return true; ":n+=" var "+E+" = true; ";return t.isTop&&(n+=" }; return validate; "),n}if(t.isTop){var I=t.isTop,d=t.level=0,m=t.dataLevel=0,b="data";if(t.rootId=t.resolve.fullPath(t.self._getId(t.root.schema)),t.baseId=t.baseId||t.rootId,delete t.isTop,t.dataPathArr=[""],t.schema.default!==void 0&&t.opts.useDefaults&&t.opts.strictDefaults){var C="default is ignored in the schema root";if(t.opts.strictDefaults==="log")t.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:m}=t,b="data"+(m||"");if(c&&(t.baseId=t.resolve.url(t.baseId,c)),o&&!t.async)throw new Error("async schema in sync schema");n+=" var errs_"+d+" = errors;"}var E="valid"+d,T=!t.opts.allErrors,j="",D="",$,O=t.schema.type,k=Array.isArray(O);if(O&&t.opts.nullable&&t.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),t.schema.$ref&&p){if(t.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+t.errSchemaPath+'" (see option extendRefs)');t.opts.extendRefs!==!0&&(p=!1,t.logger.warn('$ref: keywords ignored in schema at path "'+t.errSchemaPath+'"'))}if(t.schema.$comment&&t.opts.$comment&&(n+=" "+t.RULES.all.$comment.code(t,"$comment")),O){if(t.opts.coerceTypes)var P=t.util.coerceToTypes(t.opts.coerceTypes,O);var L=t.RULES.types[O];if(P||k||L===!0||L&&!$e(L)){var f=t.schemaPath+".type",g=t.errSchemaPath+"/type",f=t.schemaPath+".type",g=t.errSchemaPath+"/type",F=k?"checkDataTypes":"checkDataType";if(n+=" if ("+t.util[F](O,b,t.opts.strictNumbers,!0)+") { ",P){var B="dataType"+d,V="coerced"+d;n+=" var "+B+" = typeof "+b+"; var "+V+" = undefined; ",t.opts.coerceTypes=="array"&&(n+=" if ("+B+" == 'object' && Array.isArray("+b+") && "+b+".length == 1) { "+b+" = "+b+"[0]; "+B+" = typeof "+b+"; if ("+t.util.checkDataType(t.schema.type,b,t.opts.strictNumbers)+") "+V+" = "+b+"; } "),n+=" if ("+V+" !== undefined) ; ";var J=P;if(J)for(var K,Y=-1,ee=J.length-1;Y{var r=Ac(),t=Fr(),i=jc(),s=Ev(),n=Sv(),o=t.ucs2length,p=Ic(),c=i.Validation;e.exports=l;function l(w,I,C,E){var T=this,j=this._opts,D=[void 0],$={},O=[],k={},P=[],L={},F=[];I=I||{schema:w,refVal:D,refs:$};var B=u.call(this,w,I,E),V=this._compilations[B.index];if(B.compiling)return V.callValidate=oe;var J=this._formats,K=this.RULES;try{var Y=We(w,I,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,I,E)}function oe(){var U=V.validate,H=U.apply(this,arguments);return oe.errors=U.errors,H}function We(U,H,de,me){var ne=!H||H&&H.schema==U;if(H.schema!=I.schema)return l.call(T,U,H,de,me);var Ce=U.$async===!0,Ie=n({isTop:!0,schema:U,isRoot:ne,baseId:me,root:H,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:i.MissingRef,RULES:K,validate:n,util:t,resolve:r,resolveRef:Qe,usePattern:M,useDefault:X,useCustomRule:ce,opts:j,formats:J,logger:T.logger,self:T});Ie=y(D,g)+y(O,v)+y(P,f)+y(F,b)+Ie,j.processCode&&(Ie=j.processCode(Ie,U));var xe;try{var Ke=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Ie);xe=Ke(T,K,J,I,D,P,F,p,o,c),D[0]=xe}catch($e){throw T.logger.error("Error compiling schema, function code:",Ie),$e}return xe.schema=U,xe.errors=null,xe.refs=$,xe.refVal=D,xe.root=ne?xe:H,Ce&&(xe.$async=!0),j.sourceCode===!0&&(xe.source={code:Ie,patterns:O,defaults:P}),xe}function Qe(U,H,de){H=r.url(U,H);var me=$[H],ne,Ce;if(me!==void 0)return ne=D[me],Ce="refVal["+me+"]",R(ne,Ce);if(!de&&I.refs){var Ie=I.refs[H];if(Ie!==void 0)return ne=I.refVal[Ie],Ce=Xe(H,ne),R(ne,Ce)}Ce=Xe(H);var xe=r.call(T,We,I,H);if(xe===void 0){var Ke=C&&C[H];Ke&&(xe=r.inlineRef(Ke,j.inlineRefs)?Ke:l.call(T,Ke,I,C,U))}if(xe===void 0)Re(H);else return Ne(H,xe),R(xe,Ce)}function Xe(U,H){var de=D.length;return D[de]=H,$[U]=de,"refVal"+de}function Re(U){delete $[U]}function Ne(U,H){var de=$[U];D[de]=H}function R(U,H){return typeof U=="object"||typeof U=="boolean"?{code:H,schema:U,inline:!0}:{code:H,$async:U&&!!U.$async}}function M(U){var H=k[U];return H===void 0&&(H=k[U]=O.length,O[H]=U),"pattern"+H}function X(U){switch(typeof U){case"boolean":case"number":return""+U;case"string":return t.toQuotedString(U);case"object":if(U===null)return"null";var H=s(U),de=L[H];return de===void 0&&(de=L[H]=P.length,P[de]=U),"default"+de}}function ce(U,H,de,me){if(T._opts.validateSchema!==!1){var ne=U.definition.dependencies;if(ne&&!ne.every(function(gt){return Object.prototype.hasOwnProperty.call(de,gt)}))throw new Error("parent schema must have all required keywords: "+ne.join(","));var Ce=U.definition.validateSchema;if(Ce){var Ie=Ce(H);if(!Ie){var xe="keyword schema is invalid: "+T.errorsText(Ce.errors);if(T._opts.validateSchema=="log")T.logger.error(xe);else throw new Error(xe)}}}var Ke=U.definition.compile,$e=U.definition.inline,Ye=U.definition.macro,Ae;if(Ke)Ae=Ke.call(T,H,de,me);else if(Ye)Ae=Ye.call(T,H,de,me),j.validateSchema!==!1&&T.validateSchema(Ae,!0);else if($e)Ae=$e.call(T,me,U.keyword,H,de);else if(Ae=U.definition.validate,!Ae)return;if(Ae===void 0)throw new Error('custom keyword "'+U.keyword+'"failed to compile');var Ve=F.length;return F[Ve]=Ae,{code:"customRule"+Ve,validate:Ae}}}function u(w,I,C){var E=m.call(this,w,I,C);return E>=0?{index:E,compiling:!0}:(E=this._compilations.length,this._compilations[E]={schema:w,root:I,baseId:C},{index:E,compiling:!1})}function d(w,I,C){var E=m.call(this,w,I,C);E>=0&&this._compilations.splice(E,1)}function m(w,I,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=se((a,e)=>{var r=Fr(),t=/^(\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)*)*$/,m=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,v=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;e.exports=f;function f(D){return D=D=="full"?"full":"fast",r.copy(f[D])}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":m,"relative-json-pointer":v},f.full={date:b,time:y,"date-time":I,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":m,"relative-json-pointer":v};function g(D){return D%4===0&&(D%100!==0||D%400===0)}function b(D){var $=D.match(t);if(!$)return!1;var O=+$[1],k=+$[2],P=+$[3];return k>=1&&k<=12&&P>=1&&P<=(k==2&&g(O)?29:i[k])}function y(D,$){var O=D.match(s);if(!O)return!1;var k=O[1],P=O[2],L=O[3],F=O[5];return(k<=23&&P<=59&&L<=59||k==23&&P==59&&L==60)&&(!$||F)}var w=/t|\s/i;function I(D){var $=D.split(w);return $.length==2&&b($[0])&&y($[1],!0)}var C=/\/|:/;function E(D){return C.test(D)&&o.test(D)}var T=/[^\\]\\Z/;function j(D){if(T.test(D))return!1;try{return new RegExp(D),!0}catch{return!1}}}),t8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.errSchemaPath+"/"+i,u=!t.opts.allErrors,d="data"+(p||""),m="valid"+o,v,f;if(c=="#"||c=="#/")t.isRoot?(v=t.async,f="validate"):(v=t.root.schema.$async===!0,f="root.refVal[0]");else{var g=t.resolveRef(t.baseId,c,t.isRoot);if(g===void 0){var b=t.MissingRefError.message(t.baseId,c);if(t.opts.missingRefs=="fail"){t.logger.error(b);var y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(l)+" , params: { ref: '"+t.util.escapeQuotes(c)+"' } ",t.opts.messages!==!1&&(n+=" , message: 'can\\'t resolve reference "+t.util.escapeQuotes(c)+"' "),t.opts.verbose&&(n+=" , schema: "+t.util.toQuotedString(c)+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+d+" "),n+=" } "):n+=" {} ";var w=n;n=y.pop(),!t.compositeRule&&u?t.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(t.opts.missingRefs=="ignore")t.logger.warn(b),u&&(n+=" if (true) { ");else throw new t.MissingRefError(t.baseId,c,b)}else if(g.inline){var I=t.util.copy(t);I.level++;var C="valid"+I.level;I.schema=g.schema,I.schemaPath="",I.errSchemaPath=c;var E=t.validate(I).replace(/validate\.schema/g,g.code);n+=" "+E+" ",u&&(n+=" if ("+C+") { ")}else v=g.$async===!0||t.async&&g.$async!==!1,f=g.code}if(f){var y=y||[];y.push(n),n="",t.opts.passContext?n+=" "+f+".call(this, ":n+=" "+f+"( ",n+=" "+d+", (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var T=p?"data"+(p-1||""):"parentData",j=p?t.dataPathArr[p]:"parentDataProperty";n+=" , "+T+" , "+j+", rootData) ";var D=n;if(n=y.pop(),v){if(!t.async)throw new Error("async schema referenced by sync schema");u&&(n+=" var "+m+"; "),n+=" try { await "+D+"; ",u&&(n+=" "+m+" = 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+=" "+m+" = false; "),n+=" } ",u&&(n+=" if ("+m+") { ")}else n+=" if (!"+D+") { if (vErrors === null) vErrors = "+f+".errors; else vErrors = vErrors.concat("+f+".errors); errors = vErrors.length; } ",u&&(n+=" else { ")}return n}}),a8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.schema[i],p=t.schemaPath+t.util.getProperty(i),c=t.errSchemaPath+"/"+i,l=!t.opts.allErrors,u=t.util.copy(t),d="";u.level++;var m="valid"+u.level,v=u.baseId,f=!0,g=o;if(g)for(var b,y=-1,w=g.length-1;y0||b===!1:t.util.schemaHasRules(b,t.RULES.all))&&(f=!1,u.schema=b,u.schemaPath=p+"["+y+"]",u.errSchemaPath=c+"/"+y,n+=" "+t.validate(u)+" ",u.baseId=v,l&&(n+=" if ("+m+") { ",d+="}"));return l&&(f?n+=" if (true) { ":n+=" "+d.slice(0,-1)+" "),n}}),r8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t),b="";g.level++;var y="valid"+g.level,w=c.every(function($){return t.opts.strictKeywords?typeof $=="object"&&Object.keys($).length>0||$===!1:t.util.schemaHasRules($,t.RULES.all)});if(w){var I=g.baseId;n+=" var "+f+" = errors; var "+v+" = false; ";var C=t.compositeRule;t.compositeRule=g.compositeRule=!0;var E=c;if(E)for(var T,j=-1,D=E.length-1;j{e.exports=function(t,i,s){var n=" ",o=t.schema[i],p=t.errSchemaPath+"/"+i,c=!t.opts.allErrors,l=t.util.toQuotedString(o);return t.opts.$comment===!0?n+=" console.log("+l+");":typeof t.opts.$comment=="function"&&(n+=" self._opts.$comment("+l+", "+t.util.toQuotedString(p)+", validate.root.schema);"),n}}),i8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f=t.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",g="schema"+o):g=c,f||(n+=" var schema"+o+" = validate.schema"+l+";"),n+="var "+v+" = equal("+m+", schema"+o+"); if (!"+v+") { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'const' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { allowedValue: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to constant' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var y=n;return n=b.pop(),!t.compositeRule&&d?t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t),b="";g.level++;var y="valid"+g.level,w="i"+o,I=g.dataLevel=t.dataLevel+1,C="data"+I,E=t.baseId,T=t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all);if(n+="var "+f+" = errors;var "+v+";",T){var j=t.compositeRule;t.compositeRule=g.compositeRule=!0,g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" var "+y+" = false; for (var "+w+" = 0; "+w+" < "+m+".length; "+w+"++) { ",g.errorPath=t.util.getPathExpr(t.errorPath,w,t.opts.jsonPointers,!0);var D=m+"["+w+"]";g.dataPathArr[I]=w;var $=t.validate(g);g.baseId=E,t.util.varOccurences($,C)<2?n+=" "+t.util.varReplace($,C,D)+" ":n+=" var "+C+" = "+D+"; "+$+" ",n+=" if ("+y+") break; } ",t.compositeRule=g.compositeRule=j,n+=" "+b+" if (!"+y+") {"}else n+=" if ("+m+".length == 0) {";var O=O||[];O.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should contain a valid item' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var k=n;return n=O.pop(),!t.compositeRule&&d?t.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 { ",T&&(n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } "),t.opts.allErrors&&(n+=" } "),n}}),o8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="errs__"+o,f=t.util.copy(t),g="";f.level++;var b="valid"+f.level,y={},w={},I=t.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 T=t.errorPath;n+="var missing"+o+";";for(var j in w)if(E=w[j],E.length){if(n+=" if ( "+m+t.util.getProperty(j)+" !== undefined ",I&&(n+=" && Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(j)+"') "),d){n+=" && ( ";var D=E;if(D)for(var $,O=-1,k=D.length-1;O0||C===!1:t.util.schemaHasRules(C,t.RULES.all))&&(n+=" "+b+" = true; if ( "+m+t.util.getProperty(j)+" !== undefined ",I&&(n+=" && Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(j)+"') "),n+=") { ",f.schema=C,f.schemaPath=l+t.util.getProperty(j),f.errSchemaPath=u+"/"+t.util.escapeFragment(j),n+=" "+t.validate(f)+" ",f.baseId=oe,n+=" } ",d&&(n+=" if ("+b+") { ",g+="}"))}return d&&(n+=" "+g+" if ("+v+" == errors) {"),n}}),c8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f=t.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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("+m+", "+y+"["+b+"])) { "+v+" = true; break; }",f&&(n+=" } "),n+=" if (!"+v+") { ";var w=w||[];w.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { allowedValues: schema"+o+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be equal to one of the allowed values' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var I=n;return n=w.pop(),!t.compositeRule&&d?t.async?n+=" throw new ValidationError(["+I+"]); ":n+=" validate.errors = ["+I+"]; return false; ":n+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",n+=" }",d&&(n+=" else { "),n}}),p8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||"");if(t.opts.format===!1)return d&&(n+=" if (true) { "),n;var v=t.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",f="schema"+o):f=c;var g=t.opts.unknownFormats,b=Array.isArray(g);if(v){var y="format"+o,w="isObject"+o,I="formatType"+o;n+=" var "+y+" = formats["+f+"]; var "+w+" = typeof "+y+" == 'object' && !("+y+" instanceof RegExp) && "+y+".validate; var "+I+" = "+w+" && "+y+".type || 'string'; if ("+w+") { ",t.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+" && "+I+" == '"+s+"' && !(typeof "+y+" == 'function' ? ",t.async?n+=" (async"+o+" ? await "+y+"("+m+") : "+y+"("+m+")) ":n+=" "+y+"("+m+") ",n+=" : "+y+".test("+m+"))))) {"}else{var y=t.formats[c];if(!y){if(g=="ignore")return t.logger.warn('unknown format "'+c+'" ignored in schema at path "'+t.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 "'+t.errSchemaPath+'"')}var w=typeof y=="object"&&!(y instanceof RegExp)&&y.validate,I=w&&y.type||"string";if(w){var C=y.async===!0;y=y.validate}if(I!=s)return d&&(n+=" if (true) { "),n;if(C){if(!t.async)throw new Error("async format in sync schema");var E="formats"+t.util.getProperty(c)+".validate";n+=" if (!(await "+E+"("+m+"))) { "}else{n+=" if (! ";var E="formats"+t.util.getProperty(c);w&&(E+=".validate"),typeof y=="function"?n+=" "+E+"("+m+") ":n+=" "+E+".test("+m+") ",n+=") { "}}var T=T||[];T.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'format' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { format: ",v?n+=""+f:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match format "`,v?n+="' + "+f+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var j=n;return n=T.pop(),!t.compositeRule&&d?t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t);g.level++;var b="valid"+g.level,y=t.schema.then,w=t.schema.else,I=y!==void 0&&(t.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:t.util.schemaHasRules(y,t.RULES.all)),C=w!==void 0&&(t.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:t.util.schemaHasRules(w,t.RULES.all)),E=g.baseId;if(I||C){var T;g.createErrors=!1,g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" var "+f+" = errors; var "+v+" = true; ";var j=t.compositeRule;t.compositeRule=g.compositeRule=!0,n+=" "+t.validate(g)+" ",g.baseId=E,g.createErrors=!0,n+=" errors = "+f+"; if (vErrors !== null) { if ("+f+") vErrors.length = "+f+"; else vErrors = null; } ",t.compositeRule=g.compositeRule=j,I?(n+=" if ("+b+") { ",g.schema=t.schema.then,g.schemaPath=t.schemaPath+".then",g.errSchemaPath=t.errSchemaPath+"/then",n+=" "+t.validate(g)+" ",g.baseId=E,n+=" "+v+" = "+b+"; ",I&&C?(T="ifClause"+o,n+=" var "+T+" = 'then'; "):T="'then'",n+=" } ",C&&(n+=" else { ")):n+=" if (!"+b+") { ",C&&(g.schema=t.schema.else,g.schemaPath=t.schemaPath+".else",g.errSchemaPath=t.errSchemaPath+"/else",n+=" "+t.validate(g)+" ",g.baseId=E,n+=" "+v+" = "+b+"; ",I&&C?(T="ifClause"+o,n+=" var "+T+" = 'else'; "):T="'else'",n+=" } "),n+=" if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'if' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { failingKeyword: "+T+" } ",t.opts.messages!==!1&&(n+=` , message: 'should match "' + `+T+` + '" schema' `),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&d&&(t.async?n+=" throw new ValidationError(vErrors); ":n+=" validate.errors = vErrors; return false; "),n+=" } ",d&&(n+=" else { ")}else d&&(n+=" if (true) { ");return n}}),u8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t),b="";g.level++;var y="valid"+g.level,w="i"+o,I=g.dataLevel=t.dataLevel+1,C="data"+I,E=t.baseId;if(n+="var "+f+" = errors;var "+v+";",Array.isArray(c)){var T=t.schema.additionalItems;if(T===!1){n+=" "+v+" = "+m+".length <= "+c.length+"; ";var j=u;u=t.errSchemaPath+"/additionalItems",n+=" if (!"+v+") { ";var D=D||[];D.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+c.length+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have more than "+c.length+" items' "),t.opts.verbose&&(n+=" , schema: false , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var $=n;n=D.pop(),!t.compositeRule&&d?t.async?n+=" throw new ValidationError(["+$+"]); ":n+=" validate.errors = ["+$+"]; return false; ":n+=" var err = "+$+"; 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,P=-1,L=O.length-1;P0||k===!1:t.util.schemaHasRules(k,t.RULES.all)){n+=" "+y+" = true; if ("+m+".length > "+P+") { ";var F=m+"["+P+"]";g.schema=k,g.schemaPath=l+"["+P+"]",g.errSchemaPath=u+"/"+P,g.errorPath=t.util.getPathExpr(t.errorPath,P,t.opts.jsonPointers,!0),g.dataPathArr[I]=P;var B=t.validate(g);g.baseId=E,t.util.varOccurences(B,C)<2?n+=" "+t.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",n+=" } ",d&&(n+=" if ("+y+") { ",b+="}")}}if(typeof T=="object"&&(t.opts.strictKeywords?typeof T=="object"&&Object.keys(T).length>0||T===!1:t.util.schemaHasRules(T,t.RULES.all))){g.schema=T,g.schemaPath=t.schemaPath+".additionalItems",g.errSchemaPath=t.errSchemaPath+"/additionalItems",n+=" "+y+" = true; if ("+m+".length > "+c.length+") { for (var "+w+" = "+c.length+"; "+w+" < "+m+".length; "+w+"++) { ",g.errorPath=t.util.getPathExpr(t.errorPath,w,t.opts.jsonPointers,!0);var F=m+"["+w+"]";g.dataPathArr[I]=w;var B=t.validate(g);g.baseId=E,t.util.varOccurences(B,C)<2?n+=" "+t.util.varReplace(B,C,F)+" ":n+=" var "+C+" = "+F+"; "+B+" ",d&&(n+=" if (!"+y+") break; "),n+=" } } ",d&&(n+=" if ("+y+") { ",b+="}")}}else if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){g.schema=c,g.schemaPath=l,g.errSchemaPath=u,n+=" for (var "+w+" = 0; "+w+" < "+m+".length; "+w+"++) { ",g.errorPath=t.util.getPathExpr(t.errorPath,w,t.opts.jsonPointers,!0);var F=m+"["+w+"]";g.dataPathArr[I]=w;var B=t.validate(g);g.baseId=E,t.util.varOccurences(B,C)<2?n+=" "+t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,E,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",f="schema"+o):f=c;var g=i=="maximum",b=g?"exclusiveMaximum":"exclusiveMinimum",y=t.schema[b],w=t.opts.$data&&y&&y.$data,I=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 T=t.util.getData(y.$data,p,t.dataPathArr),j="exclusive"+o,D="exclType"+o,$="exclIsNumber"+o,O="op"+o,k="' + "+O+" + '";n+=" var schemaExcl"+o+" = "+T+"; ",T="schemaExcl"+o,n+=" var "+j+"; var "+D+" = typeof "+T+"; if ("+D+" != 'boolean' && "+D+" != 'undefined' && "+D+" != 'number') { ";var E=b,P=P||[];P.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(E||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: '"+b+" should be boolean' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var L=n;n=P.pop(),!t.compositeRule&&d?t.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+=" } else if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+D+" == 'number' ? ( ("+j+" = "+f+" === undefined || "+T+" "+I+"= "+f+") ? "+m+" "+C+"= "+T+" : "+m+" "+C+" "+f+" ) : ( ("+j+" = "+T+" === true) ? "+m+" "+C+"= "+f+" : "+m+" "+C+" "+f+" ) || "+m+" !== "+m+") { var op"+o+" = "+j+" ? '"+I+"' : '"+I+"='; ",c===void 0&&(E=b,u=t.errSchemaPath+"/"+b,f=T,v=w)}else{var $=typeof y=="number",k=I;if($&&v){var O="'"+k+"'";n+=" if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" ( "+f+" === undefined || "+y+" "+I+"= "+f+" ? "+m+" "+C+"= "+y+" : "+m+" "+C+" "+f+" ) || "+m+" !== "+m+") { "}else{$&&c===void 0?(j=!0,E=b,u=t.errSchemaPath+"/"+b,f=y,C+="="):($&&(f=Math[g?"min":"max"](y,c)),y===($?f:!0)?(j=!0,E=b,u=t.errSchemaPath+"/"+b,C+="="):(j=!1,k+="="));var O="'"+k+"'";n+=" if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'number') || "),n+=" "+m+" "+C+" "+f+" || "+m+" !== "+m+") { "}}E=E||i;var P=P||[];P.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(E||"_limit")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { comparison: "+O+", limit: "+f+", exclusive: "+j+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be "+k+" ",v?n+="' + "+f:n+=""+f+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var L=n;return n=P.pop(),!t.compositeRule&&d?t.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+=" } ",d&&(n+=" else { "),n}}),pv=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,b,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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+=" "+m+".length "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitItems")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+f+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",i=="maxItems"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" items' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!t.compositeRule&&d?t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,b,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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') || "),t.opts.unicode===!1?n+=" "+m+".length ":n+=" ucs2length("+m+") ",n+=" "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitLength")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+f+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be ",i=="maxLength"?n+="longer":n+="shorter",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" characters' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!t.compositeRule&&d?t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,b,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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("+m+").length "+g+" "+f+") { ";var b=i,y=y||[];y.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(b||"_limitProperties")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { limit: "+f+" } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have ",i=="maxProperties"?n+="more":n+="fewer",n+=" than ",v?n+="' + "+f+" + '":n+=""+c,n+=" properties' "),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var w=n;return n=y.pop(),!t.compositeRule&&d?t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;if(v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.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+" = "+m+" / "+f+", ",t.opts.multipleOfPrecision?n+=" Math.abs(Math.round(division"+o+") - division"+o+") > 1e-"+t.opts.multipleOfPrecision+" ":n+=" division"+o+" !== parseInt(division"+o+") ",n+=" ) ",v&&(n+=" ) "),n+=" ) { ";var g=g||[];g.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { multipleOf: "+f+" } ",t.opts.messages!==!1&&(n+=" , message: 'should be multiple of ",v?n+="' + "+f:n+=""+f+"'"),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var b=n;return n=g.pop(),!t.compositeRule&&d?t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="errs__"+o,f=t.util.copy(t);f.level++;var g="valid"+f.level;if(t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){f.schema=c,f.schemaPath=l,f.errSchemaPath=u,n+=" var "+v+" = errors; ";var b=t.compositeRule;t.compositeRule=f.compositeRule=!0,f.createErrors=!1;var y;f.opts.allErrors&&(y=f.opts.allErrors,f.opts.allErrors=!1),n+=" "+t.validate(f)+" ",f.createErrors=!0,y&&(f.opts.allErrors=y),t.compositeRule=f.compositeRule=b,n+=" if ("+g+") { ";var w=w||[];w.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var I=n;n=w.pop(),!t.compositeRule&&d?t.async?n+=" throw new ValidationError(["+I+"]); ":n+=" validate.errors = ["+I+"]; return false; ":n+=" var err = "+I+"; 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; } ",t.opts.allErrors&&(n+=" } ")}else n+=" var err = ",t.createErrors!==!1?(n+=" { keyword: 'not' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: {} ",t.opts.messages!==!1&&(n+=" , message: 'should NOT be valid' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d&&(n+=" if (false) { ");return n}}),m8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f="errs__"+o,g=t.util.copy(t),b="";g.level++;var y="valid"+g.level,w=g.baseId,I="prevValid"+o,C="passingSchemas"+o;n+="var "+f+" = errors , "+I+" = false , "+v+" = false , "+C+" = null; ";var E=t.compositeRule;t.compositeRule=g.compositeRule=!0;var T=c;if(T)for(var j,D=-1,$=T.length-1;D<$;)j=T[D+=1],(t.opts.strictKeywords?typeof j=="object"&&Object.keys(j).length>0||j===!1:t.util.schemaHasRules(j,t.RULES.all))?(g.schema=j,g.schemaPath=l+"["+D+"]",g.errSchemaPath=u+"/"+D,n+=" "+t.validate(g)+" ",g.baseId=w):n+=" var "+y+" = true; ",D&&(n+=" if ("+y+" && "+I+") { "+v+" = false; "+C+" = ["+C+", "+D+"]; } else { ",b+="}"),n+=" if ("+y+") { "+v+" = "+I+" = true; "+C+" = "+D+"; }";return t.compositeRule=g.compositeRule=E,n+=""+b+"if (!"+v+") { var err = ",t.createErrors!==!1?(n+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { passingSchemas: "+C+" } ",t.opts.messages!==!1&&(n+=" , message: 'should match exactly one schema in oneOf' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ",n+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!t.compositeRule&&d&&(t.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; }",t.opts.allErrors&&(n+=" } "),n}}),h8=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v=t.opts.$data&&c&&c.$data,f;v?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",f="schema"+o):f=c;var g=v?"(new RegExp("+f+"))":t.usePattern(c);n+="if ( ",v&&(n+=" ("+f+" !== undefined && typeof "+f+" != 'string') || "),n+=" !"+g+".test("+m+") ) { ";var b=b||[];b.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { pattern: ",v?n+=""+f:n+=""+t.util.toQuotedString(c),n+=" } ",t.opts.messages!==!1&&(n+=` , message: 'should match pattern "`,v?n+="' + "+f+" + '":n+=""+t.util.escapeQuotes(c),n+=`"' `),t.opts.verbose&&(n+=" , schema: ",v?n+="validate.schema"+l:n+=""+t.util.toQuotedString(c),n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var y=n;return n=b.pop(),!t.compositeRule&&d?t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="errs__"+o,f=t.util.copy(t),g="";f.level++;var b="valid"+f.level,y="key"+o,w="idx"+o,I=f.dataLevel=t.dataLevel+1,C="data"+I,E="dataProperties"+o,T=Object.keys(c||{}).filter(Y),j=t.schema.patternProperties||{},D=Object.keys(j).filter(Y),$=t.schema.additionalProperties,O=T.length||D.length,k=$===!1,P=typeof $=="object"&&Object.keys($).length,L=t.opts.removeAdditional,F=k||P||L,B=t.opts.ownProperties,V=t.baseId,J=t.schema.required;if(J&&!(t.opts.$data&&J.$data)&&J.length8)n+=" || validate.schema"+l+".hasOwnProperty("+y+") ";else{var ee=T;if(ee)for(var oe,We=-1,Qe=ee.length-1;We0||$e===!1:t.util.schemaHasRules($e,t.RULES.all)){var Ye=t.util.getProperty(oe),me=m+Ye,Ae=Ce&&$e.default!==void 0;f.schema=$e,f.schemaPath=l+Ye,f.errSchemaPath=u+"/"+t.util.escapeFragment(oe),f.errorPath=t.util.getPath(t.errorPath,oe,t.opts.jsonPointers),f.dataPathArr[I]=t.util.toQuotedString(oe);var ne=t.validate(f);if(f.baseId=V,t.util.varOccurences(ne,C)<2){ne=t.util.varReplace(ne,C,me);var Ve=me}else{var Ve=C;n+=" var "+C+" = "+me+"; "}if(Ae)n+=" "+ne+" ";else{if(K&&K[oe]){n+=" if ( "+Ve+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(oe)+"') "),n+=") { "+b+" = false; ";var M=t.errorPath,ce=u,gt=t.util.escapeQuotes(oe);t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPath(M,oe,t.opts.jsonPointers)),u=t.errSchemaPath+"/required";var U=U||[];U.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { missingProperty: '"+gt+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+gt+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var H=n;n=U.pop(),!t.compositeRule&&d?t.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,t.errorPath=M,n+=" } else { "}else d?(n+=" if ( "+Ve+" === undefined ",B&&(n+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(oe)+"') "),n+=") { "+b+" = true; } else { "):(n+=" if ("+Ve+" !== undefined ",B&&(n+=" && Object.prototype.hasOwnProperty.call("+m+", '"+t.util.escapeQuotes(oe)+"') "),n+=" ) { ");n+=" "+ne+" } "}}d&&(n+=" if ("+b+") { ",g+="}")}}if(D.length){var ut=D;if(ut)for(var Re,Fn=-1,ds=ut.length-1;Fn0||$e===!1:t.util.schemaHasRules($e,t.RULES.all)){f.schema=$e,f.schemaPath=t.schemaPath+".patternProperties"+t.util.getProperty(Re),f.errSchemaPath=t.errSchemaPath+"/patternProperties/"+t.util.escapeFragment(Re),B?n+=" "+E+" = "+E+" || Object.keys("+m+"); for (var "+w+"=0; "+w+"<"+E+".length; "+w+"++) { var "+y+" = "+E+"["+w+"]; ":n+=" for (var "+y+" in "+m+") { ",n+=" if ("+t.usePattern(Re)+".test("+y+")) { ",f.errorPath=t.util.getPathExpr(t.errorPath,y,t.opts.jsonPointers);var me=m+"["+y+"]";f.dataPathArr[I]=y;var ne=t.validate(f);f.baseId=V,t.util.varOccurences(ne,C)<2?n+=" "+t.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="errs__"+o,f=t.util.copy(t),g="";f.level++;var b="valid"+f.level;if(n+="var "+v+" = errors;",t.opts.strictKeywords?typeof c=="object"&&Object.keys(c).length>0||c===!1:t.util.schemaHasRules(c,t.RULES.all)){f.schema=c,f.schemaPath=l,f.errSchemaPath=u;var y="key"+o,w="idx"+o,I="i"+o,C="' + "+y+" + '",E=f.dataLevel=t.dataLevel+1,T="data"+E,j="dataProperties"+o,D=t.opts.ownProperties,$=t.baseId;D&&(n+=" var "+j+" = undefined; "),D?n+=" "+j+" = "+j+" || Object.keys("+m+"); for (var "+w+"=0; "+w+"<"+j+".length; "+w+"++) { var "+y+" = "+j+"["+w+"]; ":n+=" for (var "+y+" in "+m+") { ",n+=" var startErrs"+o+" = errors; ";var O=y,k=t.compositeRule;t.compositeRule=f.compositeRule=!0;var P=t.validate(f);f.baseId=$,t.util.varOccurences(P,T)<2?n+=" "+t.util.varReplace(P,T,O)+" ":n+=" var "+T+" = "+O+"; "+P+" ",t.compositeRule=f.compositeRule=k,n+=" if (!"+b+") { for (var "+I+"=startErrs"+o+"; "+I+"{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f=t.opts.$data&&c&&c.$data,g;f?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",g="schema"+o):g=c;var b="schema"+o;if(!f)if(c.length0||T===!1:t.util.schemaHasRules(T,t.RULES.all))||(y[y.length]=I)}}else var y=c;if(f||y.length){var j=t.errorPath,D=f||y.length>=t.opts.loopRequired,$=t.opts.ownProperties;if(d)if(n+=" var missing"+o+"; ",D){f||(n+=" var "+b+" = validate.schema"+l+"; ");var O="i"+o,k="schema"+o+"["+O+"]",P="' + "+k+" + '";t.opts._errorDataPathProperty&&(t.errorPath=t.util.getPathExpr(j,k,t.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+" = "+m+"["+b+"["+O+"]] !== undefined ",$&&(n+=" && Object.prototype.hasOwnProperty.call("+m+", "+b+"["+O+"]) "),n+="; if (!"+v+") break; } ",f&&(n+=" } "),n+=" if (!"+v+") { ";var L=L||[];L.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'required' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { missingProperty: '"+P+"' } ",t.opts.messages!==!1&&(n+=" , message: '",t.opts._errorDataPathProperty?n+="is a required property":n+="should have required property \\'"+P+"\\'",n+="' "),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var F=n;n=L.pop(),!t.compositeRule&&d?t.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(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m="data"+(p||""),v="valid"+o,f=t.opts.$data&&c&&c.$data,g;if(f?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",g="schema"+o):g=c,(c||f)&&t.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 = "+m+".length , "+v+" = true , j; if (i > 1) { ";var b=t.schema.items&&t.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("+m+"[i], "+m+"[j])) { "+v+" = false; break outer; } } } ";else{n+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var w="checkDataType"+(y?"s":"");n+=" if ("+t.util[w](b,"item",t.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 I=I||[];I.push(n),n="",t.createErrors!==!1?(n+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { i: i, j: j } ",t.opts.messages!==!1&&(n+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),t.opts.verbose&&(n+=" , schema: ",f?n+="validate.schema"+l:n+=""+c,n+=" , parentSchema: validate.schema"+t.schemaPath+" , data: "+m+" "),n+=" } "):n+=" {} ";var C=n;n=I.pop(),!t.compositeRule&&d?t.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=se((a,e)=>{e.exports={$ref:t8(),allOf:a8(),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=se((a,e)=>{var r=b8(),t=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=t(n),s.types=t(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 m=s.all[l]={keyword:l,code:r[l],implements:u};return m}),s.all.$comment={keyword:"$comment",code:r.$comment},c.type&&(s.types[c.type]=c)}),s.keywords=t(n.concat(o)),s.custom={},s}}),_8=se((a,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(t,i){for(var s=0;s{var r=jc().MissingRef;e.exports=t;function t(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)?t.call(o,{$ref:d},!0):Promise.resolve()}function l(u){try{return o._compile(u)}catch(m){if(m instanceof r)return d(m);throw m}function d(m){var v=m.missingSchema;if(b(v))throw new Error("Schema "+v+" is loaded but "+m.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=se((a,e)=>{e.exports=function(t,i,s){var n=" ",o=t.level,p=t.dataLevel,c=t.schema[i],l=t.schemaPath+t.util.getProperty(i),u=t.errSchemaPath+"/"+i,d=!t.opts.allErrors,m,v="data"+(p||""),f="valid"+o,g="errs__"+o,b=t.opts.$data&&c&&c.$data,y;b?(n+=" var schema"+o+" = "+t.util.getData(c.$data,p,t.dataPathArr)+"; ",y="schema"+o):y=c;var w=this,I="definition"+o,C=w.definition,E="",T,j,D,$,O;if(b&&C.$data){O="keywordValidate"+o;var k=C.validateSchema;n+=" var "+I+" = RULES.custom['"+i+"'].definition; var "+O+" = "+I+".validate;"}else{if($=t.useCustomRule(w,c,t.schema,t),!$)return;y="validate.schema"+l,O=$.code,T=C.compile,j=C.inline,D=C.macro}var P=O+".errors",L="i"+o,F="ruleErr"+o,B=C.async;if(B&&!t.async)throw new Error("async keyword in sync schema");if(j||D||(n+=""+P+" = null;"),n+="var "+g+" = errors;var "+f+";",b&&C.$data&&(E+="}",n+=" if ("+y+" === undefined) { "+f+" = true; } else { ",k&&(E+="}",n+=" "+f+" = "+I+".validateSchema("+y+"); if ("+f+") { ")),j)C.statements?n+=" "+$.validate+" ":n+=" "+f+" = "+$.validate+"; ";else if(D){var V=t.util.copy(t),E="";V.level++;var J="valid"+V.level;V.schema=$.validate,V.schemaPath="";var K=t.compositeRule;t.compositeRule=V.compositeRule=!0;var Y=t.validate(V).replace(/validate\.schema/g,O);t.compositeRule=V.compositeRule=K,n+=" "+Y}else{var ee=ee||[];ee.push(n),n="",n+=" "+O+".call( ",t.opts.passContext?n+="this":n+="self",T||C.schema===!1?n+=" , "+v+" ":n+=" , "+y+" , "+v+" , validate.schema"+t.schemaPath+" ",n+=" , (dataPath || '')",t.errorPath!='""'&&(n+=" + "+t.errorPath);var oe=p?"data"+(p-1||""):"parentData",We=p?t.dataPathArr[p]:"parentDataProperty";n+=" , "+oe+" , "+We+" , rootData ) ";var Qe=n;n=ee.pop(),C.errors===!1?(n+=" "+f+" = ",B&&(n+="await "),n+=""+Qe+"; "):B?(P="customErrors"+o,n+=" var "+P+" = null; try { "+f+" = await "+Qe+"; } catch (e) { "+f+" = false; if (e instanceof ValidationError) "+P+" = e.errors; else throw e; } "):n+=" "+P+" = null; "+f+" = "+Qe+"; "}if(C.modifying&&(n+=" if ("+oe+") "+v+" = "+oe+"["+We+"];"),n+=""+E,C.valid)d&&(n+=" if (true) { ");else{n+=" if ( ",C.valid===void 0?(n+=" !",D?n+=""+J:n+=""+f):n+=" "+!C.valid+" ",n+=") { ",m=w.keyword;var ee=ee||[];ee.push(n),n="";var ee=ee||[];ee.push(n),n="",t.createErrors!==!1?(n+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+t.errorPath+" , schemaPath: "+t.util.toQuotedString(u)+" , params: { keyword: '"+w.keyword+"' } ",t.opts.messages!==!1&&(n+=` , message: 'should pass "`+w.keyword+`" keyword validation' `),t.opts.verbose&&(n+=" , schema: validate.schema"+l+" , parentSchema: validate.schema"+t.schemaPath+" , data: "+v+" "),n+=" } "):n+=" {} ";var Xe=n;n=ee.pop(),!t.compositeRule&&d?t.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 "+L+"="+g+"; "+L+"{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=se((a,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"}]}}}}),T8=se((a,e)=>{var r=/^[a-z_$][a-z0-9_$-]*$/i,t=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 m=0;m{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=se((a,e)=>{var r=J4(),t=Ac(),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=I,g.prototype.validateSchema=C,g.prototype.getSchema=T,g.prototype.removeSchema=$,g.prototype.addFormat=K,g.prototype.errorsText=J,g.prototype._addSchema=k,g.prototype._compile=P,g.prototype.compileAsync=E8();var u=T8();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 m="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=L(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&&oe(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 U=X(M);return X.$async!==!0&&(this.errors=X.errors),U}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 U=0;U0&&O.push("--allowedTools",C.join(",")),E.length>0&&O.push("--disallowedTools",E.join(",")),T&&Object.keys(T).length>0&&O.push("--mcp-config",JSON.stringify({mcpServers:T})),r&&Object.keys(r).length>0&&O.push("--agents",JSON.stringify(r)),I&&O.push("--setting-sources",I.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)}$&&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"),!ea().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 P=dv(o),L=P?o:i,F=P?[...s,...O]:[...s,o,...O];this.logForDebugging(P?`Spawning Claude Code native binary: ${L} ${F.join(" ")}`:`Spawning Claude Code process: ${L} ${F.join(" ")}`);let B=p.DEBUG||c?"pipe":"ignore";this.child=(0,Ov.spawn)(L,F,{cwd:t,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 ja("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 ja("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 ja("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=(t,i)=>{let s=this.getProcessExitError(t,i);e(s)};return this.child.on("exit",r),this.exitListeners.push({callback:e,handler:r}),()=>{this.child&&this.child.off("exit",r);let t=this.exitListeners.findIndex(i=>i.handler===r);t!==-1&&this.exitListeners.splice(t,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 t=(s,n)=>{if(this.abortController.signal.aborted){r(new ja("Operation aborted"));return}let o=this.getProcessExitError(s,n);o?r(o):e()};this.child.once("exit",t);let i=s=>{this.child.off("exit",t),r(s)};this.child.once("error",i),this.child.once("exit",()=>{this.child.off("error",i)})})}};function dv(a){return![".js",".mjs",".tsx",".ts",".jsx"].some(r=>a.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?.())}},A8=typeof global=="object"&&global&&global.Object===Object&&global,j8=A8,N8=typeof self=="object"&&self&&self.Object===Object&&self,D8=j8||N8||Function("return this")(),Nc=D8,q8=Nc.Symbol,Ki=q8,jv=Object.prototype,L8=jv.hasOwnProperty,$8=jv.toString,In=Ki?Ki.toStringTag:void 0;function F8(a){var e=L8.call(a,In),r=a[In];try{a[In]=void 0;var t=!0}catch{}var i=$8.call(a);return t&&(e?a[In]=r:delete a[In]),i}var M8=F8,U8=Object.prototype,z8=U8.toString;function B8(a){return z8.call(a)}var H8=B8,V8="[object Null]",G8="[object Undefined]",fv=Ki?Ki.toStringTag:void 0;function Z8(a){return a==null?a===void 0?G8:V8:fv&&fv in Object(a)?M8(a):H8(a)}var W8=Z8;function X8(a){var e=typeof a;return a!=null&&(e=="object"||e=="function")}var Nv=X8,K8="[object AsyncFunction]",Q8="[object Function]",J8="[object GeneratorFunction]",Y8="[object Proxy]";function ek(a){if(!Nv(a))return!1;var e=W8(a);return e==Q8||e==J8||e==K8||e==Y8}var tk=ek,ak=Nc["__core-js_shared__"],gc=ak,mv=function(){var a=/[^.]+$/.exec(gc&&gc.keys&&gc.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}();function rk(a){return!!mv&&mv in a}var nk=rk,ik=Function.prototype,sk=ik.toString;function ok(a){if(a!=null){try{return sk.call(a)}catch{}try{return a+""}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(a){if(!Nv(a)||nk(a))return!1;var e=tk(a)?hk:lk;return e.test(ck(a))}var gk=vk;function xk(a,e){return a?.[e]}var yk=xk;function bk(a,e){var r=yk(a,e);return gk(r)?r:void 0}var Dv=bk;function wk(a,e){return a===e||a!==a&&e!==e}var _k=wk,Ek=Dv(Object,"create"),An=Ek;function Sk(){this.__data__=An?An(null):{},this.size=0}var kk=Sk;function Tk(a){var e=this.has(a)&&delete this.__data__[a];return this.size-=e?1:0,e}var Pk=Tk,Rk="__lodash_hash_undefined__",Ok=Object.prototype,Ck=Ok.hasOwnProperty;function Ik(a){var e=this.__data__;if(An){var r=e[a];return r===Rk?void 0:r}return Ck.call(e,a)?e[a]:void 0}var Ak=Ik,jk=Object.prototype,Nk=jk.hasOwnProperty;function Dk(a){var e=this.__data__;return An?e[a]!==void 0:Nk.call(e,a)}var qk=Dk,Lk="__lodash_hash_undefined__";function $k(a,e){var r=this.__data__;return this.size+=this.has(a)?0:1,r[a]=An&&e===void 0?Lk:e,this}var Fk=$k;function Mr(a){var e=-1,r=a==null?0:a.length;for(this.clear();++e-1}var Kk=Xk;function Qk(a,e){var r=this.__data__,t=rs(r,a);return t<0?(++this.size,r.push([a,e])):r[t][1]=e,this}var Jk=Qk;function Ur(a){var e=-1,r=a==null?0:a.length;for(this.clear();++e{if(!a||a.trim()==="")return null;let e=a.split(",").map(s=>s.trim()).filter(Boolean);if(e.length===0)return null;let r=e.some(s=>s.startsWith("!")),t=e.some(s=>!s.startsWith("!"));if(r&&t)return null;let i=e.map(s=>s.replace(/^!/,"").toLowerCase());return{include:r?[]:i,exclude:r?i:[],isExclusive:r}});function xT(a){let e=[],r=a.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])e.push("mcp"),e.push(r[1].toLowerCase());else{let s=a.match(/^([^:[]+):/);s&&s[1]&&e.push(s[1].trim().toLowerCase())}let t=a.match(/^\[([^\]]+)]/);t&&t[1]&&e.push(t[1].trim().toLowerCase()),a.toLowerCase().includes("statsig event:")&&e.push("statsig");let i=a.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 yT(a,e){return e?a.length===0?!1:e.isExclusive?!a.some(r=>e.exclude.includes(r)):a.some(r=>e.include.includes(r)):!0}function bT(a,e){if(!e)return!0;let r=xT(a);return yT(r,e)}function wT(){return process.env.CLAUDE_CONFIG_DIR??(0,Lv.join)((0,$v.homedir)(),".claude")}function gv(a){if(!a)return!1;if(typeof a=="boolean")return a;let e=a.toLowerCase().trim();return["1","true","yes","on"].includes(e)}var _T={name:"BASH_MAX_OUTPUT_LENGTH",default:3e4,validate:a=>{if(!a)return{effective:3e4,status:"valid"};let t=parseInt(a,10);return isNaN(t)||t<=0?{effective:3e4,status:"invalid",message:`Invalid value "${a}" (using default: 30000)`}:t>15e4?{effective:15e4,status:"capped",message:`Capped from ${t} to 150000`}:{effective:t,status:"valid"}}},ET={name:"CLAUDE_CODE_MAX_OUTPUT_TOKENS",default:32e3,validate:a=>{if(!a)return{effective:32e3,status:"valid"};let e=parseInt(a,10);return isNaN(e)||e<=0?{effective:32e3,status:"invalid",message:`Invalid value "${a}" (using default: 32000)`}:e>32e3?{effective:32e3,status:"capped",message:`Capped from ${e} to 32000`}:{effective:e,status:"valid"}}};function ST(){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:[_T,ET],lastAPIRequest:null,inMemoryErrorLog:[]}}var kT=ST();function TT(){return kT.sessionId}var L6=qn(()=>gv(process.env.DEBUG)||gv(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||Mv()||process.argv.some(a=>a.startsWith("--debug="))),PT=qn(()=>{let a=process.argv.find(r=>r.startsWith("--debug="));if(!a)return null;let e=a.substring(8);return gT(e)}),Mv=qn(()=>process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e"));function RT(a){if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let e=PT();return bT(a,e)}var OT=!1;function Qt(a,{level:e}={level:"debug"}){if(!RT(a))return;OT&&a.includes(` `)&&(a=JSON.stringify(a));let r=`[${e.toUpperCase()}] ${a.trim()} @@ -60,7 +60,7 @@ Please see the 3.x to 4.x migration guide for details on how to update your app. `))}if(Qt(`[Query.streamInput] Finished processing ${r} messages from input stream`),Qt(`[Query.streamInput] About to check MCP servers. this.sdkMcpTransports.size = ${this.sdkMcpTransports.size}`),this.sdkMcpTransports.size>0&&this.firstResultReceivedPromise){Qt("[Query.streamInput] Entering Promise.race to wait for result");let t=1e4,i;await Promise.race([this.firstResultReceivedPromise.then(()=>{Qt("[Query.streamInput] Received first result, closing input stream"),i&&clearTimeout(i)}),new Promise(s=>{i=setTimeout(()=>{Qt("[Query.streamInput] Timed out waiting for first result, closing input stream"),s()},t)})]),i&&clearTimeout(i)}Qt("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(r){if(!(r instanceof ja))throw r}}handleHookCallbacks(e,r,t,i){let s=this.hookCallbacks.get(e);if(!s)throw new Error(`No hook callback found for ID: ${e}`);return s(r,t,{signal:i})}sendMcpServerMessageToCli(e,r){if("id"in r&&r.id!==null&&r.id!==void 0){let t=`${e}:${r.id}`,i=this.pendingMcpResponses.get(t);if(i){i.resolve(r),this.pendingMcpResponses.delete(t);return}}throw new Error("No pending request found")}handleMcpControlRequest(e,r,t){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}),t.onmessage)t.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 IT({prompt:a,options:{abortController:e=Rv(),additionalDirectories:r=[],agents:t,allowedTools:i=[],appendSystemPrompt:s,canUseTool:n,continue:o,customSystemPrompt:p,cwd:c,disallowedTools:l=[],env:u,executable:d=Av()?"bun":"node",executableArgs:m=[],extraArgs:v={},fallbackModel:f,forkSession:g,hooks:b,includePartialMessages:y,maxThinkingTokens:w,maxTurns:I,mcpServers:C,model:E,pathToClaudeCodeExecutable:T,permissionMode:j="default",permissionPromptToolName:D,resume:$,resumeSessionAt:O,settingSources:k,stderr:P,strictMcpConfig:L}={}}){if(u||(u={...process.env}),u.CLAUDE_CODE_ENTRYPOINT||(u.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),!T)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 a=="string",J=new wc({abortController:e,additionalDirectories:r,agents:t,cwd:c,executable:d,executableArgs:m,extraArgs:v,pathToClaudeCodeExecutable:T,env:u,forkSession:g,stderr:P,customSystemPrompt:p,appendSystemPrompt:s,maxThinkingTokens:w,maxTurns:I,model:E,fallbackModel:f,permissionMode:j,permissionPromptToolName:D,continueConversation:o,resume:$,resumeSessionAt:O,settingSources:k,allowedTools:i,disallowedTools:l,mcpServers:F,strictMcpConfig:L,canUseTool:!!n,hooks:!!b,includePartialMessages:y}),K=new kc(J,V,n,b,e,B);return typeof a=="string"?J.write(JSON.stringify({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:a}]},parent_tool_use_id:null})+` `):K.streamInput(a),K}var h={};W4(h,{void:()=>hP,util:()=>ve,unknown:()=>fP,union:()=>yP,undefined:()=>lP,tuple:()=>_P,transformer:()=>bv,symbol:()=>pP,string:()=>Zv,strictObject:()=>xP,setErrorMap:()=>NT,set:()=>kP,record:()=>EP,quotelessJson:()=>AT,promise:()=>IP,preprocess:()=>NP,pipeline:()=>DP,ostring:()=>qP,optional:()=>AP,onumber:()=>LP,oboolean:()=>$P,objectUtil:()=>Tc,object:()=>gP,number:()=>Wv,nullable:()=>jP,null:()=>uP,never:()=>mP,nativeEnum:()=>CP,nan:()=>sP,map:()=>SP,makeIssue:()=>Ji,literal:()=>RP,lazy:()=>PP,late:()=>nP,isValid:()=>Da,isDirty:()=>Rc,isAsync:()=>jn,isAborted:()=>Pc,intersection:()=>wP,instanceof:()=>iP,getParsedType:()=>Yt,getErrorMap:()=>Qi,function:()=>TP,enum:()=>OP,effect:()=>bv,discriminatedUnion:()=>bP,defaultErrorMap:()=>jr,datetimeRegex:()=>Hv,date:()=>cP,custom:()=>Gv,coerce:()=>FP,boolean:()=>Xv,bigint:()=>oP,array:()=>vP,any:()=>dP,addIssueToContext:()=>G,ZodVoid:()=>Dr,ZodUnknown:()=>ta,ZodUnion:()=>za,ZodUndefined:()=>Ma,ZodType:()=>pe,ZodTuple:()=>zt,ZodTransformer:()=>vt,ZodSymbol:()=>Nr,ZodString:()=>ua,ZodSet:()=>Lr,ZodSchema:()=>pe,ZodRecord:()=>es,ZodReadonly:()=>Ka,ZodPromise:()=>fa,ZodPipeline:()=>Dn,ZodParsedType:()=>W,ZodOptional:()=>St,ZodObject:()=>pt,ZodNumber:()=>qa,ZodNullable:()=>Bt,ZodNull:()=>Ua,ZodNever:()=>At,ZodNativeEnum:()=>Za,ZodNaN:()=>$r,ZodMap:()=>qr,ZodLiteral:()=>Va,ZodLazy:()=>Ha,ZodIssueCode:()=>z,ZodIntersection:()=>Ba,ZodFunction:()=>ts,ZodFirstPartyTypeKind:()=>ae,ZodError:()=>ht,ZodEnum:()=>Ga,ZodEffects:()=>vt,ZodDiscriminatedUnion:()=>Yi,ZodDefault:()=>Wa,ZodDate:()=>Fa,ZodCatch:()=>Xa,ZodBranded:()=>Nn,ZodBoolean:()=>$a,ZodBigInt:()=>La,ZodArray:()=>aa,ZodAny:()=>da,Schema:()=>pe,ParseStatus:()=>Je,OK:()=>at,NEVER:()=>MP,INVALID:()=>te,EMPTY_PATH:()=>DT,DIRTY:()=>Ar,BRAND:()=>rP});var ve;(function(a){a.assertEqual=i=>{};function e(i){}a.assertIs=e;function r(i){throw new Error}a.assertNever=r,a.arrayToEnum=i=>{let s={};for(let n of i)s[n]=n;return s},a.getValidEnumValues=i=>{let s=a.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),n={};for(let o of s)n[o]=i[o];return a.objectValues(n)},a.objectValues=i=>a.objectKeys(i).map(function(s){return i[s]}),a.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},a.find=(i,s)=>{for(let n of i)if(s(n))return n},a.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function t(i,s=" | "){return i.map(n=>typeof n=="string"?`'${n}'`:n).join(s)}a.joinValues=t,a.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(ve||(ve={}));var Tc;(function(a){a.mergeShapes=(e,r)=>({...e,...r})})(Tc||(Tc={}));var W=ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=a=>{switch(typeof a){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(a)?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(a)?W.array:a===null?W.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?W.promise:typeof Map<"u"&&a instanceof Map?W.map:typeof Set<"u"&&a instanceof Set?W.set:typeof Date<"u"&&a instanceof Date?W.date:W.object;default:return W.unknown}},z=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"]),AT=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),ht=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};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},t={_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)t._errors.push(r(n));else{let o=t,p=0;for(;pr.message){let r={},t=[];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 t.push(e(i));return{formErrors:t,fieldErrors:r}}get formErrors(){return this.flatten()}};ht.create=a=>new ht(a);var jT=(a,e)=>{let r;switch(a.code){case z.invalid_type:a.received===W.undefined?r="Required":r=`Expected ${a.expected}, received ${a.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(a.expected,ve.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${ve.joinValues(a.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ve.joinValues(a.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${ve.joinValues(a.options)}, received '${a.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(r=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?r=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?r=`Invalid input: must end with "${a.validation.endsWith}"`:ve.assertNever(a.validation):a.validation!=="regex"?r=`Invalid ${a.validation}`:r="Invalid";break;case z.too_small:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?r=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:r="Invalid input";break;case z.too_big:a.type==="array"?r=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?r=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?r=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?r=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?r=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${a.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=e.defaultError,ve.assertNever(a)}return{message:r}},jr=jT,Uv=jr;function NT(a){Uv=a}function Qi(){return Uv}var Ji=a=>{let{data:e,path:r,errorMaps:t,issueData:i}=a,s=[...r,...i.path||[]],n={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="",p=t.filter(c=>!!c).slice().reverse();for(let c of p)o=c(n,{data:e,defaultError:o}).message;return{...i,path:s,message:o}},DT=[];function G(a,e){let r=Qi(),t=Ji({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,r,r===jr?void 0:jr].filter(i=>!!i)});a.common.issues.push(t)}var Je=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let t=[];for(let i of r){if(i.status==="aborted")return te;i.status==="dirty"&&e.dirty(),t.push(i.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,r){let t=[];for(let i of r){let s=await i.key,n=await i.value;t.push({key:s,value:n})}return a.mergeObjectSync(e,t)}static mergeObjectSync(e,r){let t={};for(let i of r){let{key:s,value:n}=i;if(s.status==="aborted"||n.status==="aborted")return te;s.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof n.value<"u"||i.alwaysSet)&&(t[s.value]=n.value)}return{status:e.value,value:t}}},te=Object.freeze({status:"aborted"}),Ar=a=>({status:"dirty",value:a}),at=a=>({status:"valid",value:a}),Pc=a=>a.status==="aborted",Rc=a=>a.status==="dirty",Da=a=>a.status==="valid",jn=a=>typeof Promise<"u"&&a instanceof Promise,Q;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var kt=class{constructor(e,r,t,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=t,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=(a,e)=>{if(Da(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 r=new ht(a.common.issues);return this._error=r,this._error}}};function le(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:i}=a;if(e&&(r||t))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}=a;return n.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:p??t??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 Yt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Yt(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:Yt(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 t=this.safeParse(e,r);if(t.success)return t.data;throw t.error}safeParse(e,r){let t={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)},i=this._parseSync({data:e,path:t.path,parent:t});return xv(t,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:r});return Da(t)?{value:t.value}:{issues:r.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(t=>Da(t)?{value:t.value}:{issues:r.common.issues})}async parseAsync(e,r){let t=await this.safeParseAsync(e,r);if(t.success)return t.data;throw t.error}async safeParseAsync(e,r){let t={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yt(e)},i=this._parse({data:e,path:t.path,parent:t}),s=await(jn(i)?i:Promise.resolve(i));return xv(t,s)}refine(e,r){let t=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:z.custom,...t(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((t,i)=>e(t)?!0:(i.addIssue(typeof r=="function"?r(t,i):r),!1))}_refinement(e){return new vt({schema:this,typeName:ae.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 St.create(this,this._def)}nullable(){return Bt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return aa.create(this)}promise(){return fa.create(this,this._def)}or(e){return za.create([this,e],this._def)}and(e){return Ba.create(this,e,this._def)}transform(e){return new vt({...le(this._def),schema:this,typeName:ae.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Wa({...le(this._def),innerType:this,defaultValue:r,typeName:ae.ZodDefault})}brand(){return new Nn({typeName:ae.ZodBranded,type:this,...le(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Xa({...le(this._def),innerType:this,catchValue:r,typeName:ae.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Dn.create(this,e)}readonly(){return Ka.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},qT=/^c[^\s-]{8,}$/i,LT=/^[0-9a-z]+$/,$T=/^[0-9A-HJKMNP-TV-Z]{26}$/i,FT=/^[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,MT=/^[a-z0-9_-]{21}$/i,UT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zT=/^[-+]?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)?)??$/,BT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,HT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",xc,VT=/^(?:(?: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])$/,GT=/^(?:(?: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])$/,ZT=/^(([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]))$/,WT=/^(([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])$/,XT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,KT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zv="((\\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])))",QT=new RegExp(`^${zv}$`);function Bv(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let r=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function JT(a){return new RegExp(`^${Bv(a)}$`)}function Hv(a){let e=`${zv}T${Bv(a)}`,r=[];return r.push(a.local?"Z?":"Z"),a.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function YT(a,e){return!!((e==="v4"||!e)&&VT.test(a)||(e==="v6"||!e)&&ZT.test(a))}function eP(a,e){if(!UT.test(a))return!1;try{let[r]=a.split(".");if(!r)return!1;let t=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(t));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function tP(a,e){return!!((e==="v4"||!e)&>.test(a)||(e==="v6"||!e)&&WT.test(a))}var ua=class a extends pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==W.string){let s=this._getOrReturnCtx(e);return G(s,{code:z.invalid_type,expected:W.string,received:s.parsedType}),te}let t=new Je,i;for(let s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),G(i,{code:z.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){let n=e.data.length>s.value,o=e.data.lengthe.test(i),{validation:r,code:z.invalid_string,...Q.errToObj(t)})}_addCheck(e){return new a({...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 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 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 ua({checks:[],typeName:ae.ZodString,coerce:a?.coerce??!1,...le(a)});function aP(a,e){let r=(a.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,i=r>t?r:t,s=Number.parseInt(a.toFixed(i).replace(".","")),n=Number.parseInt(e.toFixed(i).replace(".",""));return s%n/10**i}var qa=class a 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 G(s,{code:z.invalid_type,expected:W.number,received:s.parsedType}),te}let t,i=new Je;for(let s of this._def.checks)s.kind==="int"?ve.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:z.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:z.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?aP(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),G(t,{code:z.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:z.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,t,i){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:Q.toString(i)}]})}_addCheck(e){return new a({...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 t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(r===null||t.value>r)&&(r=t.value):t.kind==="max"&&(e===null||t.valuenew qa({checks:[],typeName:ae.ZodNumber,coerce:a?.coerce||!1,...le(a)});var La=class a 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 t,i=new Je;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:z.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),G(t,{code:z.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 G(r,{code:z.invalid_type,expected:W.bigint,received:r.parsedType}),te}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,t,i){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:t,message:Q.toString(i)}]})}_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: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 La({checks:[],typeName:ae.ZodBigInt,coerce:a?.coerce??!1,...le(a)});var $a=class extends pe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==W.boolean){let t=this._getOrReturnCtx(e);return G(t,{code:z.invalid_type,expected:W.boolean,received:t.parsedType}),te}return at(e.data)}};$a.create=a=>new $a({typeName:ae.ZodBoolean,coerce:a?.coerce||!1,...le(a)});var Fa=class a 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 G(s,{code:z.invalid_type,expected:W.date,received:s.parsedType}),te}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return G(s,{code:z.invalid_date}),te}let t=new Je,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),G(i,{code:z.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):ve.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...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 Fa({checks:[],coerce:a?.coerce||!1,typeName:ae.ZodDate,...le(a)});var Nr=class extends pe{_parse(e){if(this._getType(e)!==W.symbol){let t=this._getOrReturnCtx(e);return G(t,{code:z.invalid_type,expected:W.symbol,received:t.parsedType}),te}return at(e.data)}};Nr.create=a=>new Nr({typeName:ae.ZodSymbol,...le(a)});var Ma=class extends pe{_parse(e){if(this._getType(e)!==W.undefined){let t=this._getOrReturnCtx(e);return G(t,{code:z.invalid_type,expected:W.undefined,received:t.parsedType}),te}return at(e.data)}};Ma.create=a=>new Ma({typeName:ae.ZodUndefined,...le(a)});var Ua=class extends pe{_parse(e){if(this._getType(e)!==W.null){let t=this._getOrReturnCtx(e);return G(t,{code:z.invalid_type,expected:W.null,received:t.parsedType}),te}return at(e.data)}};Ua.create=a=>new Ua({typeName:ae.ZodNull,...le(a)});var da=class extends pe{constructor(){super(...arguments),this._any=!0}_parse(e){return at(e.data)}};da.create=a=>new da({typeName:ae.ZodAny,...le(a)});var ta=class extends pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return at(e.data)}};ta.create=a=>new ta({typeName:ae.ZodUnknown,...le(a)});var At=class extends pe{_parse(e){let r=this._getOrReturnCtx(e);return G(r,{code:z.invalid_type,expected:W.never,received:r.parsedType}),te}};At.create=a=>new At({typeName:ae.ZodNever,...le(a)});var Dr=class extends pe{_parse(e){if(this._getType(e)!==W.undefined){let t=this._getOrReturnCtx(e);return G(t,{code:z.invalid_type,expected:W.void,received:t.parsedType}),te}return at(e.data)}};Dr.create=a=>new Dr({typeName:ae.ZodVoid,...le(a)});var aa=class a extends pe{_parse(e){let{ctx:r,status:t}=this._processInputParams(e),i=this._def;if(r.parsedType!==W.array)return G(r,{code:z.invalid_type,expected:W.array,received:r.parsedType}),te;if(i.exactLength!==null){let n=r.data.length>i.exactLength.value,o=r.data.lengthi.maxLength.value&&(G(r,{code:z.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),t.dirty()),r.common.async)return Promise.all([...r.data].map((n,o)=>i.type._parseAsync(new kt(r,n,r.path,o)))).then(n=>Je.mergeArray(t,n));let s=[...r.data].map((n,o)=>i.type._parseSync(new kt(r,n,r.path,o)));return Je.mergeArray(t,s)}get element(){return this._def.type}min(e,r){return new a({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new a({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new a({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};aa.create=(a,e)=>new aa({type:a,minLength:null,maxLength:null,exactLength:null,typeName:ae.ZodArray,...le(e)});function Ir(a){if(a instanceof pt){let e={};for(let r in a.shape){let t=a.shape[r];e[r]=St.create(Ir(t))}return new pt({...a._def,shape:()=>e})}else return a instanceof aa?new aa({...a._def,type:Ir(a.element)}):a instanceof St?St.create(Ir(a.unwrap())):a instanceof Bt?Bt.create(Ir(a.unwrap())):a instanceof zt?zt.create(a.items.map(e=>Ir(e))):a}var pt=class a 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 G(c,{code:z.invalid_type,expected:W.object,received:c.parsedType}),te}let{status:t,ctx:i}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof At&&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 kt(i,u,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof At){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&&(G(i,{code:z.unrecognized_keys,keys:o}),t.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 kt(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(t,c)):Je.mergeObjectSync(t,p)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,t)=>{let i=this._def.errorMap?.(r,t).message??t.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}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:ae.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let r={};for(let t of ve.objectKeys(e))e[t]&&this.shape[t]&&(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}omit(e){let r={};for(let t of ve.objectKeys(this.shape))e[t]||(r[t]=this.shape[t]);return new a({...this._def,shape:()=>r})}deepPartial(){return Ir(this)}partial(e){let r={};for(let t of ve.objectKeys(this.shape)){let i=this.shape[t];e&&!e[t]?r[t]=i:r[t]=i.optional()}return new a({...this._def,shape:()=>r})}required(e){let r={};for(let t of ve.objectKeys(this.shape))if(e&&!e[t])r[t]=this.shape[t];else{let s=this.shape[t];for(;s instanceof St;)s=s._def.innerType;r[t]=s}return new a({...this._def,shape:()=>r})}keyof(){return Vv(ve.objectKeys(this.shape))}};pt.create=(a,e)=>new pt({shape:()=>a,unknownKeys:"strip",catchall:At.create(),typeName:ae.ZodObject,...le(e)});pt.strictCreate=(a,e)=>new pt({shape:()=>a,unknownKeys:"strict",catchall:At.create(),typeName:ae.ZodObject,...le(e)});pt.lazycreate=(a,e)=>new pt({shape:a,unknownKeys:"strip",catchall:At.create(),typeName:ae.ZodObject,...le(e)});var za=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),t=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 ht(o.ctx.common.issues));return G(r,{code:z.invalid_union,unionErrors:n}),te}if(r.common.async)return Promise.all(t.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 t){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 ht(p));return G(r,{code:z.invalid_union,unionErrors:o}),te}}get options(){return this._def.options}};za.create=(a,e)=>new za({options:a,typeName:ae.ZodUnion,...le(e)});var Jt=a=>a instanceof Ha?Jt(a.schema):a instanceof vt?Jt(a.innerType()):a instanceof Va?[a.value]:a instanceof Ga?a.options:a instanceof Za?ve.objectValues(a.enum):a instanceof Wa?Jt(a._def.innerType):a instanceof Ma?[void 0]:a instanceof Ua?[null]:a instanceof St?[void 0,...Jt(a.unwrap())]:a instanceof Bt?[null,...Jt(a.unwrap())]:a instanceof Nn||a instanceof Ka?Jt(a.unwrap()):a instanceof Xa?Jt(a._def.innerType):[],Yi=class a extends pe{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.object)return G(r,{code:z.invalid_type,expected:W.object,received:r.parsedType}),te;let t=this.discriminator,i=r.data[t],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}):(G(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,t){let i=new Map;for(let s of r){let n=Jt(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 a({typeName:ae.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...le(t)})}};function Oc(a,e){let r=Yt(a),t=Yt(e);if(a===e)return{valid:!0,data:a};if(r===W.object&&t===W.object){let i=ve.objectKeys(e),s=ve.objectKeys(a).filter(o=>i.indexOf(o)!==-1),n={...a,...e};for(let o of s){let p=Oc(a[o],e[o]);if(!p.valid)return{valid:!1};n[o]=p.data}return{valid:!0,data:n}}else if(r===W.array&&t===W.array){if(a.length!==e.length)return{valid:!1};let i=[];for(let s=0;s{if(Pc(s)||Pc(n))return te;let o=Oc(s.value,n.value);return o.valid?((Rc(s)||Rc(n))&&r.dirty(),{status:r.value,value:o.data}):(G(t,{code:z.invalid_intersection_types}),te)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([s,n])=>i(s,n)):i(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}};Ba.create=(a,e,r)=>new Ba({left:a,right:e,typeName:ae.ZodIntersection,...le(r)});var zt=class a extends pe{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==W.array)return G(t,{code:z.invalid_type,expected:W.array,received:t.parsedType}),te;if(t.data.lengththis._def.items.length&&(G(t,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...t.data].map((n,o)=>{let p=this._def.items[o]||this._def.rest;return p?p._parse(new kt(t,n,t.path,o)):null}).filter(n=>!!n);return t.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 a({...this._def,rest:e})}};zt.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new zt({items:a,typeName:ae.ZodTuple,rest:null,...le(e)})};var es=class a extends pe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==W.object)return G(t,{code:z.invalid_type,expected:W.object,received:t.parsedType}),te;let i=[],s=this._def.keyType,n=this._def.valueType;for(let o in t.data)i.push({key:s._parse(new kt(t,o,t.path,o)),value:n._parse(new kt(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?Je.mergeObjectAsync(r,i):Je.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,t){return r instanceof pe?new a({keyType:e,valueType:r,typeName:ae.ZodRecord,...le(t)}):new a({keyType:ua.create(),valueType:e,typeName:ae.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:t}=this._processInputParams(e);if(t.parsedType!==W.map)return G(t,{code:z.invalid_type,expected:W.map,received:t.parsedType}),te;let i=this._def.keyType,s=this._def.valueType,n=[...t.data.entries()].map(([o,p],c)=>({key:i._parse(new kt(t,o,t.path,[c,"key"])),value:s._parse(new kt(t,p,t.path,[c,"value"]))}));if(t.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 te;(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 te;(c.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(c.value,l.value)}return{status:r.value,value:o}}}};qr.create=(a,e,r)=>new qr({valueType:e,keyType:a,typeName:ae.ZodMap,...le(r)});var Lr=class a extends pe{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.parsedType!==W.set)return G(t,{code:z.invalid_type,expected:W.set,received:t.parsedType}),te;let i=this._def;i.minSize!==null&&t.data.sizei.maxSize.value&&(G(t,{code:z.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 te;l.status==="dirty"&&r.dirty(),c.add(l.value)}return{status:r.value,value:c}}let o=[...t.data.values()].map((p,c)=>s._parse(new kt(t,p,t.path,c)));return t.common.async?Promise.all(o).then(p=>n(p)):n(o)}min(e,r){return new a({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new a({...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)}};Lr.create=(a,e)=>new Lr({valueType:a,minSize:null,maxSize:null,typeName:ae.ZodSet,...le(e)});var ts=class a extends pe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==W.function)return G(r,{code:z.invalid_type,expected:W.function,received:r.parsedType}),te;function t(o,p){return Ji({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qi(),jr].filter(c=>!!c),issueData:{code:z.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:z.invalid_return_type,returnTypeError:p}})}let s={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof fa){let o=this;return at(async function(...p){let c=new ht([]),l=await o._def.args.parseAsync(p,s).catch(m=>{throw c.addIssue(t(p,m)),c}),u=await Reflect.apply(n,this,l);return await o._def.returns._def.type.parseAsync(u,s).catch(m=>{throw c.addIssue(i(u,m)),c})})}else{let o=this;return at(function(...p){let c=o._def.args.safeParse(p,s);if(!c.success)throw new ht([t(p,c.error)]);let l=Reflect.apply(n,this,c.data),u=o._def.returns.safeParse(l,s);if(!u.success)throw new ht([i(l,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:zt.create(e).rest(ta.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,r,t){return new a({args:e||zt.create([]).rest(ta.create()),returns:r||ta.create(),typeName:ae.ZodFunction,...le(t)})}},Ha=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})}};Ha.create=(a,e)=>new Ha({getter:a,typeName:ae.ZodLazy,...le(e)});var Va=class extends pe{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return G(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),te}return{status:"valid",value:e.data}}get value(){return this._def.value}};Va.create=(a,e)=>new Va({value:a,typeName:ae.ZodLiteral,...le(e)});function Vv(a,e){return new Ga({values:a,typeName:ae.ZodEnum,...le(e)})}var Ga=class a extends pe{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),t=this._def.values;return G(r,{expected:ve.joinValues(t),received:r.parsedType,code:z.invalid_type}),te}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),t=this._def.values;return G(r,{received:r.data,code:z.invalid_enum_value,options:t}),te}return at(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 a.create(e,{...this._def,...r})}exclude(e,r=this._def){return a.create(this.options.filter(t=>!e.includes(t)),{...this._def,...r})}};Ga.create=Vv;var Za=class extends pe{_parse(e){let r=ve.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==W.string&&t.parsedType!==W.number){let i=ve.objectValues(r);return G(t,{expected:ve.joinValues(i),received:t.parsedType,code:z.invalid_type}),te}if(this._cache||(this._cache=new Set(ve.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ve.objectValues(r);return G(t,{received:t.data,code:z.invalid_enum_value,options:i}),te}return at(e.data)}get enum(){return this._def.values}};Za.create=(a,e)=>new Za({values:a,typeName:ae.ZodNativeEnum,...le(e)});var fa=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 G(r,{code:z.invalid_type,expected:W.promise,received:r.parsedType}),te;let t=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return at(t.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fa.create=(a,e)=>new fa({type:a,typeName:ae.ZodPromise,...le(e)});var vt=class extends pe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:t}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:n=>{G(t,n),n.fatal?r.abort():r.dirty()},get path(){return t.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let n=i.transform(t.data,s);if(t.common.async)return Promise.resolve(n).then(async o=>{if(r.value==="aborted")return te;let p=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return p.status==="aborted"?te:p.status==="dirty"||r.value==="dirty"?Ar(p.value):p});{if(r.value==="aborted")return te;let o=this._def.schema._parseSync({data:n,path:t.path,parent:t});return o.status==="aborted"?te:o.status==="dirty"||r.value==="dirty"?Ar(o.value):o}}if(i.type==="refinement"){let n=o=>{let p=i.refinement(o,s);if(t.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(t.common.async===!1){let o=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return o.status==="aborted"?te:(o.status==="dirty"&&r.dirty(),n(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?te:(o.status==="dirty"&&r.dirty(),n(o.value).then(()=>({status:r.value,value:o.value}))))}if(i.type==="transform")if(t.common.async===!1){let n=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!Da(n))return te;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:t.data,path:t.path,parent:t}).then(n=>Da(n)?Promise.resolve(i.transform(n.value,s)).then(o=>({status:r.value,value:o})):te);ve.assertNever(i)}};vt.create=(a,e,r)=>new vt({schema:a,typeName:ae.ZodEffects,effect:e,...le(r)});vt.createWithPreprocess=(a,e,r)=>new vt({schema:e,effect:{type:"preprocess",transform:a},typeName:ae.ZodEffects,...le(r)});var St=class extends pe{_parse(e){return this._getType(e)===W.undefined?at(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};St.create=(a,e)=>new St({innerType:a,typeName:ae.ZodOptional,...le(e)});var Bt=class extends pe{_parse(e){return this._getType(e)===W.null?at(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bt.create=(a,e)=>new Bt({innerType:a,typeName:ae.ZodNullable,...le(e)});var Wa=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return r.parsedType===W.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Wa.create=(a,e)=>new Wa({innerType:a,typeName:ae.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...le(e)});var Xa=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),t={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return jn(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ht(t.common.issues)},input:t.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ht(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};Xa.create=(a,e)=>new Xa({innerType:a,typeName:ae.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...le(e)});var $r=class extends pe{_parse(e){if(this._getType(e)!==W.nan){let t=this._getOrReturnCtx(e);return G(t,{code:z.invalid_type,expected:W.nan,received:t.parsedType}),te}return{status:"valid",value:e.data}}};$r.create=a=>new $r({typeName:ae.ZodNaN,...le(a)});var rP=Symbol("zod_brand"),Nn=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}},Dn=class a extends pe{_parse(e){let{status:r,ctx:t}=this._processInputParams(e);if(t.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:t.data,path:t.path,parent:t});return s.status==="aborted"?te:s.status==="dirty"?(r.dirty(),Ar(s.value)):this._def.out._parseAsync({data:s.value,path:t.path,parent:t})})();{let i=this._def.in._parseSync({data:t.data,path:t.path,parent:t});return i.status==="aborted"?te:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:t.path,parent:t})}}static create(e,r){return new a({in:e,out:r,typeName:ae.ZodPipeline})}},Ka=class extends pe{_parse(e){let r=this._def.innerType._parse(e),t=i=>(Da(i)&&(i.value=Object.freeze(i.value)),i);return jn(r)?r.then(i=>t(i)):t(r)}unwrap(){return this._def.innerType}};Ka.create=(a,e)=>new Ka({innerType:a,typeName:ae.ZodReadonly,...le(e)});function yv(a,e){let r=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof r=="string"?{message:r}:r}function Gv(a,e={},r){return a?da.create().superRefine((t,i)=>{let s=a(t);if(s instanceof Promise)return s.then(n=>{if(!n){let o=yv(e,t),p=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:p})}});if(!s){let n=yv(e,t),o=n.fatal??r??!0;i.addIssue({code:"custom",...n,fatal:o})}}):da.create()}var nP={object:pt.lazycreate},ae;(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"})(ae||(ae={}));var iP=(a,e={message:`Input not instance of ${a.name}`})=>Gv(r=>r instanceof a,e),Zv=ua.create,Wv=qa.create,sP=$r.create,oP=La.create,Xv=$a.create,cP=Fa.create,pP=Nr.create,lP=Ma.create,uP=Ua.create,dP=da.create,fP=ta.create,mP=At.create,hP=Dr.create,vP=aa.create,gP=pt.create,xP=pt.strictCreate,yP=za.create,bP=Yi.create,wP=Ba.create,_P=zt.create,EP=es.create,SP=qr.create,kP=Lr.create,TP=ts.create,PP=Ha.create,RP=Va.create,OP=Ga.create,CP=Za.create,IP=fa.create,bv=vt.create,AP=St.create,jP=Bt.create,NP=vt.createWithPreprocess,DP=Dn.create,qP=()=>Zv().optional(),LP=()=>Wv().optional(),$P=()=>Xv().optional(),FP={string:a=>ua.create({...a,coerce:!0}),number:a=>qa.create({...a,coerce:!0}),boolean:a=>$a.create({...a,coerce:!0}),bigint:a=>La.create({...a,coerce:!0}),date:a=>Fa.create({...a,coerce:!0})},MP=te;var is="2.0",Kv=h.union([h.string(),h.number().int()]),Qv=h.string(),UP=h.object({progressToken:h.optional(Kv)}).passthrough(),Tt=h.object({_meta:h.optional(UP)}).passthrough(),lt=h.object({method:h.string(),params:h.optional(Tt)}),Ln=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),Ht=h.object({method:h.string(),params:h.optional(Ln)}),Pt=h.object({_meta:h.optional(h.object({}).passthrough())}).passthrough(),ss=h.union([h.string(),h.number().int()]),zP=h.object({jsonrpc:h.literal(is),id:ss}).merge(lt).strict();var BP=h.object({jsonrpc:h.literal(is)}).merge(Ht).strict();var HP=h.object({jsonrpc:h.literal(is),id:ss,result:Pt}).strict();var wv;(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"})(wv||(wv={}));var VP=h.object({jsonrpc:h.literal(is),id:ss,error:h.object({code:h.number().int(),message:h.string(),data:h.optional(h.unknown())})}).strict();var $6=h.union([zP,BP,HP,VP]),Jv=Pt.strict(),Yv=Ht.extend({method:h.literal("notifications/cancelled"),params:Ln.extend({requestId:ss,reason:h.string().optional()})}),$n=h.object({name:h.string(),title:h.optional(h.string())}).passthrough(),eg=$n.extend({version:h.string()}),GP=h.object({experimental:h.optional(h.object({}).passthrough()),sampling:h.optional(h.object({}).passthrough()),elicitation:h.optional(h.object({}).passthrough()),roots:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),ZP=lt.extend({method:h.literal("initialize"),params:Tt.extend({protocolVersion:h.string(),capabilities:GP,clientInfo:eg})}),WP=h.object({experimental:h.optional(h.object({}).passthrough()),logging:h.optional(h.object({}).passthrough()),completions:h.optional(h.object({}).passthrough()),prompts:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough()),resources:h.optional(h.object({subscribe:h.optional(h.boolean()),listChanged:h.optional(h.boolean())}).passthrough()),tools:h.optional(h.object({listChanged:h.optional(h.boolean())}).passthrough())}).passthrough(),XP=Pt.extend({protocolVersion:h.string(),capabilities:WP,serverInfo:eg,instructions:h.optional(h.string())}),KP=Ht.extend({method:h.literal("notifications/initialized")}),tg=lt.extend({method:h.literal("ping")}),QP=h.object({progress:h.number(),total:h.optional(h.number()),message:h.optional(h.string())}).passthrough(),ag=Ht.extend({method:h.literal("notifications/progress"),params:Ln.merge(QP).extend({progressToken:Kv})}),os=lt.extend({params:Tt.extend({cursor:h.optional(Qv)}).optional()}),cs=Pt.extend({nextCursor:h.optional(Qv)}),rg=h.object({uri:h.string(),mimeType:h.optional(h.string()),_meta:h.optional(h.object({}).passthrough())}).passthrough(),ng=rg.extend({text:h.string()}),qc=h.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),ig=rg.extend({blob:qc}),sg=$n.extend({uri:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string()),_meta:h.optional(h.object({}).passthrough())}),JP=$n.extend({uriTemplate:h.string(),description:h.optional(h.string()),mimeType:h.optional(h.string()),_meta:h.optional(h.object({}).passthrough())}),YP=os.extend({method:h.literal("resources/list")}),e2=cs.extend({resources:h.array(sg)}),t2=os.extend({method:h.literal("resources/templates/list")}),a2=cs.extend({resourceTemplates:h.array(JP)}),r2=lt.extend({method:h.literal("resources/read"),params:Tt.extend({uri:h.string()})}),n2=Pt.extend({contents:h.array(h.union([ng,ig]))}),i2=Ht.extend({method:h.literal("notifications/resources/list_changed")}),s2=lt.extend({method:h.literal("resources/subscribe"),params:Tt.extend({uri:h.string()})}),o2=lt.extend({method:h.literal("resources/unsubscribe"),params:Tt.extend({uri:h.string()})}),c2=Ht.extend({method:h.literal("notifications/resources/updated"),params:Ln.extend({uri:h.string()})}),p2=h.object({name:h.string(),description:h.optional(h.string()),required:h.optional(h.boolean())}).passthrough(),l2=$n.extend({description:h.optional(h.string()),arguments:h.optional(h.array(p2)),_meta:h.optional(h.object({}).passthrough())}),u2=os.extend({method:h.literal("prompts/list")}),d2=cs.extend({prompts:h.array(l2)}),f2=lt.extend({method:h.literal("prompts/get"),params:Tt.extend({name:h.string(),arguments:h.optional(h.record(h.string()))})}),Lc=h.object({type:h.literal("text"),text:h.string(),_meta:h.optional(h.object({}).passthrough())}).passthrough(),$c=h.object({type:h.literal("image"),data:qc,mimeType:h.string(),_meta:h.optional(h.object({}).passthrough())}).passthrough(),Fc=h.object({type:h.literal("audio"),data:qc,mimeType:h.string(),_meta:h.optional(h.object({}).passthrough())}).passthrough(),m2=h.object({type:h.literal("resource"),resource:h.union([ng,ig]),_meta:h.optional(h.object({}).passthrough())}).passthrough(),h2=sg.extend({type:h.literal("resource_link")}),og=h.union([Lc,$c,Fc,h2,m2]),v2=h.object({role:h.enum(["user","assistant"]),content:og}).passthrough(),g2=Pt.extend({description:h.optional(h.string()),messages:h.array(v2)}),x2=Ht.extend({method:h.literal("notifications/prompts/list_changed")}),y2=h.object({title:h.optional(h.string()),readOnlyHint:h.optional(h.boolean()),destructiveHint:h.optional(h.boolean()),idempotentHint:h.optional(h.boolean()),openWorldHint:h.optional(h.boolean())}).passthrough(),b2=$n.extend({description:h.optional(h.string()),inputSchema:h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough(),outputSchema:h.optional(h.object({type:h.literal("object"),properties:h.optional(h.object({}).passthrough()),required:h.optional(h.array(h.string()))}).passthrough()),annotations:h.optional(y2),_meta:h.optional(h.object({}).passthrough())}),w2=os.extend({method:h.literal("tools/list")}),_2=cs.extend({tools:h.array(b2)}),cg=Pt.extend({content:h.array(og).default([]),structuredContent:h.object({}).passthrough().optional(),isError:h.optional(h.boolean())}),F6=cg.or(Pt.extend({toolResult:h.unknown()})),E2=lt.extend({method:h.literal("tools/call"),params:Tt.extend({name:h.string(),arguments:h.optional(h.record(h.unknown()))})}),S2=Ht.extend({method:h.literal("notifications/tools/list_changed")}),pg=h.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),k2=lt.extend({method:h.literal("logging/setLevel"),params:Tt.extend({level:pg})}),T2=Ht.extend({method:h.literal("notifications/message"),params:Ln.extend({level:pg,logger:h.optional(h.string()),data:h.unknown()})}),P2=h.object({name:h.string().optional()}).passthrough(),R2=h.object({hints:h.optional(h.array(P2)),costPriority:h.optional(h.number().min(0).max(1)),speedPriority:h.optional(h.number().min(0).max(1)),intelligencePriority:h.optional(h.number().min(0).max(1))}).passthrough(),O2=h.object({role:h.enum(["user","assistant"]),content:h.union([Lc,$c,Fc])}).passthrough(),C2=lt.extend({method:h.literal("sampling/createMessage"),params:Tt.extend({messages:h.array(O2),systemPrompt:h.optional(h.string()),includeContext:h.optional(h.enum(["none","thisServer","allServers"])),temperature:h.optional(h.number()),maxTokens:h.number().int(),stopSequences:h.optional(h.array(h.string())),metadata:h.optional(h.object({}).passthrough()),modelPreferences:h.optional(R2)})}),I2=Pt.extend({model:h.string(),stopReason:h.optional(h.enum(["endTurn","stopSequence","maxTokens"]).or(h.string())),role:h.enum(["user","assistant"]),content:h.discriminatedUnion("type",[Lc,$c,Fc])}),A2=h.object({type:h.literal("boolean"),title:h.optional(h.string()),description:h.optional(h.string()),default:h.optional(h.boolean())}).passthrough(),j2=h.object({type:h.literal("string"),title:h.optional(h.string()),description:h.optional(h.string()),minLength:h.optional(h.number()),maxLength:h.optional(h.number()),format:h.optional(h.enum(["email","uri","date","date-time"]))}).passthrough(),N2=h.object({type:h.enum(["number","integer"]),title:h.optional(h.string()),description:h.optional(h.string()),minimum:h.optional(h.number()),maximum:h.optional(h.number())}).passthrough(),D2=h.object({type:h.literal("string"),title:h.optional(h.string()),description:h.optional(h.string()),enum:h.array(h.string()),enumNames:h.optional(h.array(h.string()))}).passthrough(),q2=h.union([A2,j2,N2,D2]),L2=lt.extend({method:h.literal("elicitation/create"),params:Tt.extend({message:h.string(),requestedSchema:h.object({type:h.literal("object"),properties:h.record(h.string(),q2),required:h.optional(h.array(h.string()))}).passthrough()})}),$2=Pt.extend({action:h.enum(["accept","decline","cancel"]),content:h.optional(h.record(h.string(),h.unknown()))}),F2=h.object({type:h.literal("ref/resource"),uri:h.string()}).passthrough(),M2=h.object({type:h.literal("ref/prompt"),name:h.string()}).passthrough(),U2=lt.extend({method:h.literal("completion/complete"),params:Tt.extend({ref:h.union([M2,F2]),argument:h.object({name:h.string(),value:h.string()}).passthrough(),context:h.optional(h.object({arguments:h.optional(h.record(h.string(),h.string()))}))})}),z2=Pt.extend({completion:h.object({values:h.array(h.string()).max(100),total:h.optional(h.number().int()),hasMore:h.optional(h.boolean())}).passthrough()}),B2=h.object({uri:h.string().startsWith("file://"),name:h.optional(h.string()),_meta:h.optional(h.object({}).passthrough())}).passthrough(),H2=lt.extend({method:h.literal("roots/list")}),V2=Pt.extend({roots:h.array(B2)}),G2=Ht.extend({method:h.literal("notifications/roots/list_changed")}),M6=h.union([tg,ZP,U2,k2,f2,u2,YP,t2,r2,s2,o2,E2,w2]),U6=h.union([Yv,ag,KP,G2]),z6=h.union([Jv,I2,$2,V2]),B6=h.union([tg,C2,L2,H2]),H6=h.union([Yv,ag,T2,c2,i2,S2,x2]),V6=h.union([Jv,XP,z2,g2,d2,e2,a2,n2,cg,_2]);var G6=Z4(R8(),1);var Z6=Symbol("Let zodToJsonSchema decide on which parser to use");var W6=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Cc;(function(a){a.Completable="McpCompletable"})(Cc||(Cc={}));var as=class extends pe{_parse(e){let{ctx:r}=this._processInputParams(e),t=r.data;return this._def.type._parse({data:t,path:r.path,parent:r})}unwrap(){return this._def.type}};as.create=(a,e)=>new as({type:a,typeName:Cc.Completable,complete:e.complete,...Z2(e)});function Z2(a){if(!a)return{};let{errorMap:e,invalid_type_error:r,required_error:t,description:i}=a;if(e&&(r||t))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}=a;return n.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:(p=l??t)!==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:a,options:e}){let{systemPrompt:r,settingSources:t,...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,Tv.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",IT({prompt:a,options:{...i,pathToClaudeCodeExecutable:o,customSystemPrompt:s,appendSystemPrompt:n,settingSources:t??[]}})}var mg=vs(require("better-sqlite3"),1);var rt=require("path"),Mc=require("os"),Uc=require("fs");var ug=require("url"),K2={};function X2(){return typeof __dirname<"u"?__dirname:(0,rt.dirname)((0,ug.fileURLToPath)(K2.url))}var Q6=X2(),ma=process.env.CLAUDE_MEM_DATA_DIR||(0,rt.join)((0,Mc.homedir)(),".claude-mem"),zc=process.env.CLAUDE_CONFIG_DIR||(0,rt.join)((0,Mc.homedir)(),".claude"),J6=(0,rt.join)(ma,"archives"),Y6=(0,rt.join)(ma,"logs"),eO=(0,rt.join)(ma,"trash"),tO=(0,rt.join)(ma,"backups"),aO=(0,rt.join)(ma,"settings.json"),dg=(0,rt.join)(ma,"claude-mem.db"),rO=(0,rt.join)(zc,"settings.json"),nO=(0,rt.join)(zc,"commands"),iO=(0,rt.join)(zc,"CLAUDE.md");function fg(a){(0,Uc.mkdirSync)(a,{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 t=typeof r=="string"?JSON.parse(r):r;if(e==="Bash"&&t.command){let i=t.command.length>50?t.command.substring(0,50)+"...":t.command;return`${e}(${i})`}if(e==="Read"&&t.file_path){let i=t.file_path.split("/").pop()||t.file_path;return`${e}(${i})`}if(e==="Edit"&&t.file_path){let i=t.file_path.split("/").pop()||t.file_path;return`${e}(${i})`}if(e==="Write"&&t.file_path){let i=t.file_path.split("/").pop()||t.file_path;return`${e}(${i})`}return e}catch{return e}}log(e,r,t,i,s){if(e0&&(u=` {${Object.entries(g).map(([y,w])=>`${y}=${w}`).join(", ")}}`)}let d=`[${n}] [${o}] [${p}] ${c}${t}${u}${l}`;e===3?console.error(d):console.log(d)}debug(e,r,t,i){this.log(0,e,r,t,i)}info(e,r,t,i){this.log(1,e,r,t,i)}warn(e,r,t,i){this.log(2,e,r,t,i)}error(e,r,t,i){this.log(3,e,r,t,i)}dataIn(e,r,t,i){this.info(e,`\u2192 ${r}`,t,i)}dataOut(e,r,t,i){this.info(e,`\u2190 ${r}`,t,i)}success(e,r,t,i){this.info(e,`\u2713 ${r}`,t,i)}failure(e,r,t,i){this.error(e,`\u2717 ${r}`,t,i)}timing(e,r,t,i){this.info(e,`\u23F1 ${r}`,i,{duration:`${t}ms`})}},se=new Hc;var nt=class{db;constructor(){fg(ma),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(),this.createUserPromptsTable()}initializeSchema(){try{this.db.exec(` +`+JSON.stringify(s,null,2):l=" "+this.formatData(s));let u="";if(i){let{sessionId:m,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}${t}${u}${l}`;e===3?console.error(d):console.log(d)}debug(e,r,t,i){this.log(0,e,r,t,i)}info(e,r,t,i){this.log(1,e,r,t,i)}warn(e,r,t,i){this.log(2,e,r,t,i)}error(e,r,t,i){this.log(3,e,r,t,i)}dataIn(e,r,t,i){this.info(e,`\u2192 ${r}`,t,i)}dataOut(e,r,t,i){this.info(e,`\u2190 ${r}`,t,i)}success(e,r,t,i){this.info(e,`\u2713 ${r}`,t,i)}failure(e,r,t,i){this.error(e,`\u2717 ${r}`,t,i)}timing(e,r,t,i){this.info(e,`\u23F1 ${r}`,i,{duration:`${t}ms`})}},ie=new Hc;var nt=class{db;constructor(){fg(ma),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(),this.createUserPromptsTable()}initializeSchema(){try{this.db.exec(` CREATE TABLE IF NOT EXISTS schema_versions ( id INTEGER PRIMARY KEY, version INTEGER UNIQUE NOT NULL, @@ -318,7 +318,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?(se.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?(ie.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 = ? @@ -477,6 +477,17 @@ CRITICAL: Describe what was delivered to the project, NOT what the memory system User's Original Request: ${a.user_prompt} +WHEN NOT TO SUMMARIZE +---------------------- +Do NOT create a summary if: +- **Already summarized**: This work was covered in a previous prompt's summary (check if it's just continuation) +- **Conversational banter**: User is chatting, joking, or making casual comments with no deliverables +- **Trivial requests**: Simple questions, status checks, or explanations that don't result in shipped work +- **No meaningful observations**: All observations were skipped or there's nothing substantial to document +- **Meta-discussions about memory**: Talking about the memory system itself without shipping changes to it + +If any of these apply, **output only**: + \u2705 GOOD - Describes deliverables: Fix authentication timeout bug Add three-tier verbosity system to session summaries @@ -498,8 +509,8 @@ Output this XML: **Required fields**: request, investigated, learned, completed, next_steps -**Optional fields**: notes`}function xg(a,e){let r=[],t=/([\s\S]*?)<\/observation>/g,i;for(;(i=t.exec(a))!==null;){let s=i[1],n=Vt(s,"type"),o=Vt(s,"title"),p=Vt(s,"subtitle"),c=Vt(s,"narrative"),l=ps(s,"facts","fact"),u=ps(s,"concepts","concept"),d=ps(s,"files_read","file"),m=ps(s,"files_modified","file");if(!n||!o||!p||!c){se.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())){se.warn("PARSER",`Invalid observation type: ${n}, skipping`,{correlationId:e});continue}let f=u.filter(g=>g!==n.trim());f.length!==u.length&&se.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:m})}return r}function yg(a,e){let t=/([\s\S]*?)<\/summary>/.exec(a);if(!t)return null;let i=t[1],s=Vt(i,"request"),n=Vt(i,"investigated"),o=Vt(i,"learned"),p=Vt(i,"completed"),c=Vt(i,"next_steps"),l=Vt(i,"notes");return!s||!n||!o||!p||!c?(se.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 Vt(a,e){let t=new RegExp(`<${e}>([^<]*)`).exec(a);return t?t[1].trim():null}function ps(a,e,r){let t=[],s=new RegExp(`<${e}>(.*?)`,"s").exec(a);if(!s)return t;let n=s[1],o=new RegExp(`<${r}>([^<]+)`,"g"),p;for(;(p=o.exec(n))!==null;)t.push(p[1].trim());return t}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 nt,r=e.cleanupOrphanedSessions();return e.close(),r>0&&se.info("SYSTEM",`Cleaned up ${r} orphaned sessions`),new Promise((t,i)=>{this.app.listen(ls,"127.0.0.1",()=>{se.info("SYSTEM","Worker started",{port:ls,pid:process.pid,activeSessions:this.sessions.size}),t()}).on("error",s=>{s.code==="EADDRINUSE"&&se.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 t=parseInt(e.params.sessionDbId,10),{project:i,userPrompt:s}=e.body,n=se.sessionId(t);se.info("WORKER","Session init",{correlationId:n,project:i});let o=new nt,p=o.getSessionById(t);if(!p){o.close(),r.status(404).json({error:"Session not found in database"});return}let c=p.sdk_session_id||`session-${t}`,l={sessionDbId:t,claudeSessionId:c,sdkSessionId:p.sdk_session_id||null,project:i,userPrompt:s,pendingMessages:[],abortController:new AbortController,generatorPromise:null,lastPromptNumber:0,observationCounter:0,startTime:Date.now()};this.sessions.set(t,l),o.setWorkerPort(t,this.port),o.close(),l.generatorPromise=this.runSDKAgent(l).catch(u=>{se.failure("WORKER","SDK agent error",{sessionId:t},u);let d=new nt;d.markSessionFailed(t),d.close(),this.sessions.delete(t)}),se.success("WORKER","Session initialized",{sessionId:t,port:this.port}),r.json({status:"initialized",sessionDbId:t,port:this.port})}handleObservation(e,r){let t=parseInt(e.params.sessionDbId,10),{tool_name:i,tool_input:s,tool_output:n,prompt_number:o}=e.body,p=this.sessions.get(t);if(!p){let u=new nt,d=u.getSessionById(t);u.close();let m=d?.sdk_session_id||`session-${t}`;p={sessionDbId:t,claudeSessionId:m,sdkSessionId:null,project:d?.project||"",userPrompt:d?.user_prompt||"",pendingMessages:[],abortController:new AbortController,generatorPromise:null,lastPromptNumber:0,observationCounter:0,startTime:Date.now()},this.sessions.set(t,p),p.generatorPromise=this.runSDKAgent(p).catch(v=>{se.failure("WORKER","SDK agent error",{sessionId:t},v);let f=new nt;f.markSessionFailed(t),f.close(),this.sessions.delete(t)})}p.observationCounter++;let c=se.correlationId(t,p.observationCounter),l=se.formatTool(i,s);se.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 t=parseInt(e.params.sessionDbId,10),{prompt_number:i}=e.body,s=this.sessions.get(t);if(!s){let n=new nt,o=n.getSessionById(t);n.close();let p=o?.sdk_session_id||`session-${t}`;s={sessionDbId:t,claudeSessionId:p,sdkSessionId:null,project:o?.project||"",userPrompt:o?.user_prompt||"",pendingMessages:[],abortController:new AbortController,generatorPromise:null,lastPromptNumber:0,observationCounter:0,startTime:Date.now()},this.sessions.set(t,s),s.generatorPromise=this.runSDKAgent(s).catch(c=>{se.failure("WORKER","SDK agent error",{sessionId:t},c);let l=new nt;l.markSessionFailed(t),l.close(),this.sessions.delete(t)})}se.dataIn("WORKER","Summary requested",{sessionId:t,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 t=parseInt(e.params.sessionDbId,10),i=this.sessions.get(t);if(!i){r.status(404).json({error:"Session not found"});return}r.json({sessionDbId:t,sdkSessionId:i.sdkSessionId,project:i.project,pendingMessages:i.pendingMessages.length})}async handleDelete(e,r){let t=parseInt(e.params.sessionDbId,10),i=this.sessions.get(t);if(!i){r.status(404).json({error:"Session not found"});return}se.warn("WORKER","Session delete requested",{sessionId:t}),i.abortController.abort(),i.generatorPromise&&await Promise.race([i.generatorPromise,new Promise(n=>setTimeout(n,5e3))]);let s=new nt;s.markSessionFailed(t),s.close(),this.sessions.delete(t),se.info("WORKER","Session deleted",{sessionId:t}),r.json({status:"deleted"})}async runSDKAgent(e){se.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 t=lg({prompt:this.createMessageGenerator(e),options:{model:Q2,disallowedTools:J2,abortController:e.abortController,pathToClaudeCodeExecutable:r}});for await(let n of t)if(n.type==="system"&&n.subtype==="init"){let o=n;if(o.session_id){let p=new nt,c=p.updateSDKSessionId(e.sessionDbId,o.session_id);p.close(),c&&(se.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;se.dataOut("SDK",`Response received (${c} chars)`,{sessionId:e.sessionDbId,promptNumber:e.lastPromptNumber}),se.debug("SDK","Full response",{sessionId:e.sessionDbId},p),this.handleAgentMessage(e,p,e.lastPromptNumber)}let i=Date.now()-e.startTime;se.success("SDK","Agent completed",{sessionId:e.sessionDbId,duration:`${(i/1e3).toFixed(1)}s`});let s=new nt;s.markSessionCompleted(e.sessionDbId),s.close(),this.sessions.delete(e.sessionDbId)}catch(t){throw t.name==="AbortError"?se.warn("SDK","Agent aborted",{sessionId:e.sessionDbId}):se.failure("SDK","Agent error",{sessionId:e.sessionDbId},t),t}}async*createMessageGenerator(e){let r=hg(e.project,e.claudeSessionId,e.userPrompt);for(se.dataIn("SDK",`Init prompt sent (${r.length} chars)`,{sessionId:e.sessionDbId,claudeSessionId:e.claudeSessionId,project:e.project}),se.debug("SDK","Full init prompt",{sessionId:e.sessionDbId},r),yield{type:"user",session_id:e.claudeSessionId,parent_tool_use_id:null,message:{role:"user",content:r}};!e.abortController.signal.aborted;){if(e.pendingMessages.length===0){await new Promise(t=>setTimeout(t,100));continue}for(;e.pendingMessages.length>0;){let t=e.pendingMessages.shift();if(t.type==="summarize"){e.lastPromptNumber=t.prompt_number;let i=new nt,s=i.getSessionById(e.sessionDbId);if(i.close(),s){let n=gg(s);se.dataIn("SDK",`Summary prompt sent (${n.length} chars)`,{sessionId:e.sessionDbId,promptNumber:t.prompt_number}),se.debug("SDK","Full summary prompt",{sessionId:e.sessionDbId},n),yield{type:"user",session_id:e.claudeSessionId,parent_tool_use_id:null,message:{role:"user",content:n}}}}else if(t.type==="observation"){e.lastPromptNumber=t.prompt_number;let i=vg({id:0,tool_name:t.tool_name,tool_input:t.tool_input,tool_output:t.tool_output,created_at_epoch:Date.now()}),s=se.formatTool(t.tool_name,t.tool_input),n=se.correlationId(e.sessionDbId,e.observationCounter);se.dataIn("SDK",`Observation prompt: ${s}`,{correlationId:n,promptNumber:t.prompt_number,size:`${i.length} chars`}),se.debug("SDK","Full observation prompt",{correlationId:n},i),yield{type:"user",session_id:e.claudeSessionId,parent_tool_use_id:null,message:{role:"user",content:i}}}}}}handleAgentMessage(e,r,t){let i=se.correlationId(e.sessionDbId,e.observationCounter),s=xg(r,i);s.length>0&&se.info("PARSER",`Parsed ${s.length} observation(s)`,{correlationId:i,promptNumber:t,types:s.map(p=>p.type).join(", ")});let n=new nt;for(let p of s)e.sdkSessionId&&(n.storeObservation(e.sdkSessionId,e.project,p,t),se.success("DB","Observation stored",{correlationId:i,type:p.type,title:p.title}));let o=yg(r,e.sessionDbId);o&&e.sdkSessionId&&(se.info("PARSER","Summary parsed",{sessionId:e.sessionDbId,promptNumber:t}),n.storeSummary(e.sdkSessionId,e.project,o,t),se.success("DB","Summary stored",{sessionId:e.sessionDbId})),n.close()}};async function Y2(){await new us().start(),process.on("SIGINT",()=>{se.warn("SYSTEM","Shutting down (SIGINT)"),process.exit(0)}),process.on("SIGTERM",()=>{se.warn("SYSTEM","Shutting down (SIGTERM)"),process.exit(0)})}Y2().catch(a=>{se.failure("SYSTEM","Fatal startup error",{},a),process.exit(1)});0&&(module.exports={WorkerService}); +**Optional fields**: notes`}function xg(a,e){let r=[],t=/([\s\S]*?)<\/observation>/g,i;for(;(i=t.exec(a))!==null;){let s=i[1],n=Vt(s,"type"),o=Vt(s,"title"),p=Vt(s,"subtitle"),c=Vt(s,"narrative"),l=ps(s,"facts","fact"),u=ps(s,"concepts","concept"),d=ps(s,"files_read","file"),m=ps(s,"files_modified","file");if(!n||!o||!p||!c){ie.warn("PARSER","Observation missing required fields, skipping",{correlationId:e,hasType:!!n,hasTitle:!!o,hasSubtitle:!!p,hasNarrative:!!c});continue}if(!["bugfix","feature","refactor","change","discovery","decision"].includes(n.trim())){ie.warn("PARSER",`Invalid observation type: ${n}, skipping`,{correlationId:e});continue}let f=u.filter(g=>g!==n.trim());f.length!==u.length&&ie.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:m})}return r}function yg(a,e){let t=//.exec(a);if(t)return ie.info("PARSER","Summary skipped",{sessionId:e,reason:t[1]}),null;let s=/([\s\S]*?)<\/summary>/.exec(a);if(!s)return null;let n=s[1],o=Vt(n,"request"),p=Vt(n,"investigated"),c=Vt(n,"learned"),l=Vt(n,"completed"),u=Vt(n,"next_steps"),d=Vt(n,"notes");return!o||!p||!c||!l||!u?(ie.warn("PARSER","Summary missing required fields",{sessionId:e,hasRequest:!!o,hasInvestigated:!!p,hasLearned:!!c,hasCompleted:!!l,hasNextSteps:!!u}),null):{request:o,investigated:p,learned:c,completed:l,next_steps:u,notes:d}}function Vt(a,e){let t=new RegExp(`<${e}>([^<]*)`).exec(a);return t?t[1].trim():null}function ps(a,e,r){let t=[],s=new RegExp(`<${e}>(.*?)`,"s").exec(a);if(!s)return t;let n=s[1],o=new RegExp(`<${r}>([^<]+)`,"g"),p;for(;(p=o.exec(n))!==null;)t.push(p[1].trim());return t}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 nt,r=e.cleanupOrphanedSessions();return e.close(),r>0&&ie.info("SYSTEM",`Cleaned up ${r} orphaned sessions`),new Promise((t,i)=>{this.app.listen(ls,"127.0.0.1",()=>{ie.info("SYSTEM","Worker started",{port:ls,pid:process.pid,activeSessions:this.sessions.size}),t()}).on("error",s=>{s.code==="EADDRINUSE"&&ie.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 t=parseInt(e.params.sessionDbId,10),{project:i,userPrompt:s}=e.body,n=ie.sessionId(t);ie.info("WORKER","Session init",{correlationId:n,project:i});let o=new nt,p=o.getSessionById(t);if(!p){o.close(),r.status(404).json({error:"Session not found in database"});return}let c=p.sdk_session_id||`session-${t}`,l={sessionDbId:t,claudeSessionId:c,sdkSessionId:p.sdk_session_id||null,project:i,userPrompt:s,pendingMessages:[],abortController:new AbortController,generatorPromise:null,lastPromptNumber:0,observationCounter:0,startTime:Date.now()};this.sessions.set(t,l),o.setWorkerPort(t,this.port),o.close(),l.generatorPromise=this.runSDKAgent(l).catch(u=>{ie.failure("WORKER","SDK agent error",{sessionId:t},u);let d=new nt;d.markSessionFailed(t),d.close(),this.sessions.delete(t)}),ie.success("WORKER","Session initialized",{sessionId:t,port:this.port}),r.json({status:"initialized",sessionDbId:t,port:this.port})}handleObservation(e,r){let t=parseInt(e.params.sessionDbId,10),{tool_name:i,tool_input:s,tool_output:n,prompt_number:o}=e.body,p=this.sessions.get(t);if(!p){let u=new nt,d=u.getSessionById(t);u.close();let m=d?.sdk_session_id||`session-${t}`;p={sessionDbId:t,claudeSessionId:m,sdkSessionId:null,project:d?.project||"",userPrompt:d?.user_prompt||"",pendingMessages:[],abortController:new AbortController,generatorPromise:null,lastPromptNumber:0,observationCounter:0,startTime:Date.now()},this.sessions.set(t,p),p.generatorPromise=this.runSDKAgent(p).catch(v=>{ie.failure("WORKER","SDK agent error",{sessionId:t},v);let f=new nt;f.markSessionFailed(t),f.close(),this.sessions.delete(t)})}p.observationCounter++;let c=ie.correlationId(t,p.observationCounter),l=ie.formatTool(i,s);ie.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 t=parseInt(e.params.sessionDbId,10),{prompt_number:i}=e.body,s=this.sessions.get(t);if(!s){let n=new nt,o=n.getSessionById(t);n.close();let p=o?.sdk_session_id||`session-${t}`;s={sessionDbId:t,claudeSessionId:p,sdkSessionId:null,project:o?.project||"",userPrompt:o?.user_prompt||"",pendingMessages:[],abortController:new AbortController,generatorPromise:null,lastPromptNumber:0,observationCounter:0,startTime:Date.now()},this.sessions.set(t,s),s.generatorPromise=this.runSDKAgent(s).catch(c=>{ie.failure("WORKER","SDK agent error",{sessionId:t},c);let l=new nt;l.markSessionFailed(t),l.close(),this.sessions.delete(t)})}ie.dataIn("WORKER","Summary requested",{sessionId:t,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 t=parseInt(e.params.sessionDbId,10),i=this.sessions.get(t);if(!i){r.status(404).json({error:"Session not found"});return}r.json({sessionDbId:t,sdkSessionId:i.sdkSessionId,project:i.project,pendingMessages:i.pendingMessages.length})}async handleDelete(e,r){let t=parseInt(e.params.sessionDbId,10),i=this.sessions.get(t);if(!i){r.status(404).json({error:"Session not found"});return}ie.warn("WORKER","Session delete requested",{sessionId:t}),i.abortController.abort(),i.generatorPromise&&await Promise.race([i.generatorPromise,new Promise(n=>setTimeout(n,5e3))]);let s=new nt;s.markSessionFailed(t),s.close(),this.sessions.delete(t),ie.info("WORKER","Session deleted",{sessionId:t}),r.json({status:"deleted"})}async runSDKAgent(e){ie.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 t=lg({prompt:this.createMessageGenerator(e),options:{model:Q2,disallowedTools:J2,abortController:e.abortController,pathToClaudeCodeExecutable:r}});for await(let n of t)if(n.type==="system"&&n.subtype==="init"){let o=n;if(o.session_id){let p=new nt,c=p.updateSDKSessionId(e.sessionDbId,o.session_id);p.close(),c&&(ie.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;ie.dataOut("SDK",`Response received (${c} chars)`,{sessionId:e.sessionDbId,promptNumber:e.lastPromptNumber}),ie.debug("SDK","Full response",{sessionId:e.sessionDbId},p),this.handleAgentMessage(e,p,e.lastPromptNumber)}let i=Date.now()-e.startTime;ie.success("SDK","Agent completed",{sessionId:e.sessionDbId,duration:`${(i/1e3).toFixed(1)}s`});let s=new nt;s.markSessionCompleted(e.sessionDbId),s.close(),this.sessions.delete(e.sessionDbId)}catch(t){throw t.name==="AbortError"?ie.warn("SDK","Agent aborted",{sessionId:e.sessionDbId}):ie.failure("SDK","Agent error",{sessionId:e.sessionDbId},t),t}}async*createMessageGenerator(e){let r=hg(e.project,e.claudeSessionId,e.userPrompt);for(ie.dataIn("SDK",`Init prompt sent (${r.length} chars)`,{sessionId:e.sessionDbId,claudeSessionId:e.claudeSessionId,project:e.project}),ie.debug("SDK","Full init prompt",{sessionId:e.sessionDbId},r),yield{type:"user",session_id:e.claudeSessionId,parent_tool_use_id:null,message:{role:"user",content:r}};!e.abortController.signal.aborted;){if(e.pendingMessages.length===0){await new Promise(t=>setTimeout(t,100));continue}for(;e.pendingMessages.length>0;){let t=e.pendingMessages.shift();if(t.type==="summarize"){e.lastPromptNumber=t.prompt_number;let i=new nt,s=i.getSessionById(e.sessionDbId);if(i.close(),s){let n=gg(s);ie.dataIn("SDK",`Summary prompt sent (${n.length} chars)`,{sessionId:e.sessionDbId,promptNumber:t.prompt_number}),ie.debug("SDK","Full summary prompt",{sessionId:e.sessionDbId},n),yield{type:"user",session_id:e.claudeSessionId,parent_tool_use_id:null,message:{role:"user",content:n}}}}else if(t.type==="observation"){e.lastPromptNumber=t.prompt_number;let i=vg({id:0,tool_name:t.tool_name,tool_input:t.tool_input,tool_output:t.tool_output,created_at_epoch:Date.now()}),s=ie.formatTool(t.tool_name,t.tool_input),n=ie.correlationId(e.sessionDbId,e.observationCounter);ie.dataIn("SDK",`Observation prompt: ${s}`,{correlationId:n,promptNumber:t.prompt_number,size:`${i.length} chars`}),ie.debug("SDK","Full observation prompt",{correlationId:n},i),yield{type:"user",session_id:e.claudeSessionId,parent_tool_use_id:null,message:{role:"user",content:i}}}}}}handleAgentMessage(e,r,t){let i=ie.correlationId(e.sessionDbId,e.observationCounter),s=xg(r,i);s.length>0&&ie.info("PARSER",`Parsed ${s.length} observation(s)`,{correlationId:i,promptNumber:t,types:s.map(p=>p.type).join(", ")});let n=new nt;for(let p of s)e.sdkSessionId&&(n.storeObservation(e.sdkSessionId,e.project,p,t),ie.success("DB","Observation stored",{correlationId:i,type:p.type,title:p.title}));let o=yg(r,e.sessionDbId);o&&e.sdkSessionId&&(ie.info("PARSER","Summary parsed",{sessionId:e.sessionDbId,promptNumber:t}),n.storeSummary(e.sdkSessionId,e.project,o,t),ie.success("DB","Summary stored",{sessionId:e.sessionDbId})),n.close()}};async function Y2(){await new us().start(),process.on("SIGINT",()=>{ie.warn("SYSTEM","Shutting down (SIGINT)"),process.exit(0)}),process.on("SIGTERM",()=>{ie.warn("SYSTEM","Shutting down (SIGTERM)"),process.exit(0)})}Y2().catch(a=>{ie.failure("SYSTEM","Fatal startup error",{},a),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 7b3abb2d..8e8ebfbd 100644 --- a/src/sdk/parser.ts +++ b/src/sdk/parser.ts @@ -62,7 +62,7 @@ export function parseObservations(text: string, correlationId?: string): ParsedO } // Validate type - const validTypes = ['change', 'discovery', 'decision']; + const validTypes = ['bugfix', 'feature', 'refactor', 'change', 'discovery', 'decision']; if (!validTypes.includes(type.trim())) { logger.warn('PARSER', `Invalid observation type: ${type}, skipping`, { correlationId }); continue; @@ -97,9 +97,21 @@ export function parseObservations(text: string, correlationId?: string): ParsedO /** * Parse summary XML block from SDK response - * Returns null if no valid summary found + * Returns null if no valid summary found or if summary was skipped */ export function parseSummary(text: string, sessionId?: number): ParsedSummary | null { + // Check for skip_summary first + const skipRegex = //; + const skipMatch = skipRegex.exec(text); + + if (skipMatch) { + logger.info('PARSER', 'Summary skipped', { + sessionId, + reason: skipMatch[1] + }); + return null; + } + // Match ... block (non-greedy) const summaryRegex = /([\s\S]*?)<\/summary>/; const summaryMatch = summaryRegex.exec(text); diff --git a/src/sdk/prompts.ts b/src/sdk/prompts.ts index 4dd9c168..815c42fc 100644 --- a/src/sdk/prompts.ts +++ b/src/sdk/prompts.ts @@ -164,6 +164,17 @@ CRITICAL: Describe what was delivered to the project, NOT what the memory system User's Original Request: ${session.user_prompt} +WHEN NOT TO SUMMARIZE +---------------------- +Do NOT create a summary if: +- **Already summarized**: This work was covered in a previous prompt's summary (check if it's just continuation) +- **Conversational banter**: User is chatting, joking, or making casual comments with no deliverables +- **Trivial requests**: Simple questions, status checks, or explanations that don't result in shipped work +- **No meaningful observations**: All observations were skipped or there's nothing substantial to document +- **Meta-discussions about memory**: Talking about the memory system itself without shipping changes to it + +If any of these apply, **output only**: + ✅ GOOD - Describes deliverables: Fix authentication timeout bug Add three-tier verbosity system to session summaries