aieye 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +598 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +7 -0
- package/dist/meta.json +4207 -0
- package/package.json +66 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var Sm=Object.create;var Ro=Object.defineProperty;var zm=Object.getOwnPropertyDescriptor;var km=Object.getOwnPropertyNames;var Pm=Object.getPrototypeOf,Em=Object.prototype.hasOwnProperty;var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Aa=(t,e)=>{for(var r in e)Ro(t,r,{get:e[r],enumerable:!0})},Tm=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of km(e))!Em.call(t,o)&&o!==r&&Ro(t,o,{get:()=>e[o],enumerable:!(n=zm(e,o))||n.enumerable});return t};var Za=(t,e,r)=>(r=t!=null?Sm(Pm(t)):{},Tm(e||!t||!t.__esModule?Ro(r,"default",{value:t,enumerable:!0}):r,t));var Tr=$(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.regexpCode=F.getEsmExportName=F.getProperty=F.safeStringify=F.stringify=F.strConcat=F.addCodeArg=F.str=F._=F.nil=F._Code=F.Name=F.IDENTIFIER=F._CodeOrName=void 0;var Pr=class{};F._CodeOrName=Pr;F.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var $t=class extends Pr{constructor(e){if(super(),!F.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};F.Name=$t;var Oe=class extends Pr{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof $t&&(r[n.str]=(r[n.str]||0)+1),r),{})}};F._Code=Oe;F.nil=new Oe("");function ad(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Us(r,e[n]),r.push(t[++n]);return new Oe(r)}F._=ad;var Fs=new Oe("+");function cd(t,...e){let r=[Er(t[0])],n=0;for(;n<e.length;)r.push(Fs),Us(r,e[n]),r.push(Fs,Er(t[++n]));return Ay(r),new Oe(r)}F.str=cd;function Us(t,e){e instanceof Oe?t.push(...e._items):e instanceof $t?t.push(e):t.push(Ly(e))}F.addCodeArg=Us;function Ay(t){let e=1;for(;e<t.length-1;){if(t[e]===Fs){let r=Zy(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Zy(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof $t||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof $t))return`"${t}${e.slice(1)}`}function Dy(t,e){return e.emptyStr()?t:t.emptyStr()?e:cd`${t}${e}`}F.strConcat=Dy;function Ly(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Er(Array.isArray(t)?t.join(","):t)}function Fy(t){return new Oe(Er(t))}F.stringify=Fy;function Er(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}F.safeStringify=Er;function Uy(t){return typeof t=="string"&&F.IDENTIFIER.test(t)?new Oe(`.${t}`):ad`[${t}]`}F.getProperty=Uy;function Vy(t){if(typeof t=="string"&&F.IDENTIFIER.test(t))return new Oe(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}F.getEsmExportName=Vy;function By(t){return new Oe(t.toString())}F.regexpCode=By});var Hs=$(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.ValueScope=ze.ValueScopeName=ze.Scope=ze.varKinds=ze.UsedValueState=void 0;var Se=Tr(),Vs=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Dn;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Dn||(ze.UsedValueState=Dn={}));ze.varKinds={const:new Se.Name("const"),let:new Se.Name("let"),var:new Se.Name("var")};var Ln=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Se.Name?e:this.name(e)}name(e){return new Se.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ze.Scope=Ln;var Fn=class extends Se.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Se._)`.${new Se.Name(r)}[${n}]`}};ze.ValueScopeName=Fn;var Hy=(0,Se._)`\n`,Bs=class extends Ln{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Hy:Se.nil}}get(){return this._scope}name(e){return new Fn(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Se._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=Se.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Dn.Started);let l=r(u);if(l){let d=this.opts.es5?ze.varKinds.var:ze.varKinds.const;s=(0,Se._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Se._)`${s}${l}${this.opts._n}`;else throw new Vs(u);c.set(u,Dn.Completed)})}return s}};ze.ValueScope=Bs});var I=$(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.or=O.and=O.not=O.CodeGen=O.operators=O.varKinds=O.ValueScopeName=O.ValueScope=O.Scope=O.Name=O.regexpCode=O.stringify=O.getProperty=O.nil=O.strConcat=O.str=O._=void 0;var Z=Tr(),De=Hs(),dt=Tr();Object.defineProperty(O,"_",{enumerable:!0,get:function(){return dt._}});Object.defineProperty(O,"str",{enumerable:!0,get:function(){return dt.str}});Object.defineProperty(O,"strConcat",{enumerable:!0,get:function(){return dt.strConcat}});Object.defineProperty(O,"nil",{enumerable:!0,get:function(){return dt.nil}});Object.defineProperty(O,"getProperty",{enumerable:!0,get:function(){return dt.getProperty}});Object.defineProperty(O,"stringify",{enumerable:!0,get:function(){return dt.stringify}});Object.defineProperty(O,"regexpCode",{enumerable:!0,get:function(){return dt.regexpCode}});Object.defineProperty(O,"Name",{enumerable:!0,get:function(){return dt.Name}});var Hn=Hs();Object.defineProperty(O,"Scope",{enumerable:!0,get:function(){return Hn.Scope}});Object.defineProperty(O,"ValueScope",{enumerable:!0,get:function(){return Hn.ValueScope}});Object.defineProperty(O,"ValueScopeName",{enumerable:!0,get:function(){return Hn.ValueScopeName}});Object.defineProperty(O,"varKinds",{enumerable:!0,get:function(){return Hn.varKinds}});O.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var tt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Js=class extends tt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?De.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Dt(this.rhs,e,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},Un=class extends tt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Z.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Dt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return Bn(e,this.rhs)}},Ks=class extends Un{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Ws=class extends tt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Gs=class extends tt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Ys=class extends tt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Qs=class extends tt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Dt(this.code,e,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Cr=class extends tt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(Jy(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>zt(e,r.names),{})}},rt=class extends Cr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Xs=class extends Cr{},Zt=class extends rt{};Zt.kind="else";var xt=class t extends rt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Zt(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(ud(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Dt(this.condition,e,r),this}get names(){let e=super.names;return Bn(e,this.condition),this.else&&zt(e,this.else.names),e}};xt.kind="if";var St=class extends rt{};St.kind="for";var ei=class extends St{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Dt(this.iteration,e,r),this}get names(){return zt(super.names,this.iteration.names)}},ti=class extends St{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?De.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Bn(super.names,this.from);return Bn(e,this.to)}},Vn=class extends St{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Dt(this.iterable,e,r),this}get names(){return zt(super.names,this.iterable.names)}},Rr=class extends rt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Rr.kind="func";var Nr=class extends Cr{render(e){return"return "+super.render(e)}};Nr.kind="return";var ri=class extends rt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&zt(e,this.catch.names),this.finally&&zt(e,this.finally.names),e}},Ir=class extends rt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ir.kind="catch";var Or=class extends rt{render(e){return"finally"+super.render(e)}};Or.kind="finally";var ni=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new De.Scope({parent:e}),this._nodes=[new Xs]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Js(e,s,n)),s}const(e,r,n){return this._def(De.varKinds.const,e,r,n)}let(e,r,n){return this._def(De.varKinds.let,e,r,n)}var(e,r,n){return this._def(De.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Un(e,r,n))}add(e,r){return this._leafNode(new Ks(e,O.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Z.nil&&this._leafNode(new Qs(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,o));return r.push("}"),new Z._Code(r)}if(e,r,n){if(this._blockNode(new xt(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new xt(e))}else(){return this._elseNode(new Zt)}endIf(){return this._endBlockNode(xt,Zt)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new ei(e),r)}forRange(e,r,n,o,s=this.opts.es5?De.varKinds.var:De.varKinds.let){let i=this._scope.toName(e);return this._for(new ti(s,i,r,n),()=>o(i))}forOf(e,r,n,o=De.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),n(s)})}return this._for(new Vn("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?De.varKinds.var:De.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Z._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new Vn("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(St)}label(e){return this._leafNode(new Ws(e))}break(e){return this._leafNode(new Gs(e))}return(e){let r=new Nr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Nr)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new ri;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new Ir(s),r(s)}return n&&(this._currNode=o.finally=new Or,this.code(n)),this._endBlockNode(Ir,Or)}throw(e){return this._leafNode(new Ys(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Z.nil,n,o){return this._blockNode(new Rr(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Rr)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof xt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};O.CodeGen=ni;function zt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Bn(t,e){return e instanceof Z._CodeOrName?zt(t,e.names):t}function Dt(t,e,r){if(t instanceof Z.Name)return n(t);if(!o(t))return t;return new Z._Code(t._items.reduce((s,i)=>(i instanceof Z.Name&&(i=n(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Jy(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function ud(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Z._)`!${oi(t)}`}O.not=ud;var Ky=ld(O.operators.AND);function Wy(...t){return t.reduce(Ky)}O.and=Wy;var Gy=ld(O.operators.OR);function Yy(...t){return t.reduce(Gy)}O.or=Yy;function ld(t){return(e,r)=>e===Z.nil?r:r===Z.nil?e:(0,Z._)`${oi(e)} ${t} ${oi(r)}`}function oi(t){return t instanceof Z.Name?t:(0,Z._)`(${t})`}});var D=$(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.checkStrictMode=j.getErrorPath=j.Type=j.useFunc=j.setEvaluated=j.evaluatedPropsToName=j.mergeEvaluated=j.eachItem=j.unescapeJsonPointer=j.escapeJsonPointer=j.escapeFragment=j.unescapeFragment=j.schemaRefOrVal=j.schemaHasRulesButRef=j.schemaHasRules=j.checkUnknownRules=j.alwaysValidSchema=j.toHash=void 0;var K=I(),Qy=Tr();function Xy(t){let e={};for(let r of t)e[r]=!0;return e}j.toHash=Xy;function e_(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(fd(t,e),!md(e,t.self.RULES.all))}j.alwaysValidSchema=e_;function fd(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||yd(t,`unknown keyword: "${s}"`)}j.checkUnknownRules=fd;function md(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}j.schemaHasRules=md;function t_(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}j.schemaHasRulesButRef=t_;function r_({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,K._)`${r}`}return(0,K._)`${t}${e}${(0,K.getProperty)(n)}`}j.schemaRefOrVal=r_;function n_(t){return hd(decodeURIComponent(t))}j.unescapeFragment=n_;function o_(t){return encodeURIComponent(ii(t))}j.escapeFragment=o_;function ii(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}j.escapeJsonPointer=ii;function hd(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}j.unescapeJsonPointer=hd;function s_(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}j.eachItem=s_;function dd({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof K.Name?(s instanceof K.Name?t(o,s,i):e(o,s,i),i):s instanceof K.Name?(e(o,i,s),s):r(s,i);return a===K.Name&&!(c instanceof K.Name)?n(o,c):c}}j.mergeEvaluated={props:dd({mergeNames:(t,e,r)=>t.if((0,K._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,K._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,K._)`${r} || {}`).code((0,K._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,K._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,K._)`${r} || {}`),ai(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:gd}),items:dd({mergeNames:(t,e,r)=>t.if((0,K._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,K._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,K._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,K._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function gd(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,K._)`{}`);return e!==void 0&&ai(t,r,e),r}j.evaluatedPropsToName=gd;function ai(t,e,r){Object.keys(r).forEach(n=>t.assign((0,K._)`${e}${(0,K.getProperty)(n)}`,!0))}j.setEvaluated=ai;var pd={};function i_(t,e){return t.scopeValue("func",{ref:e,code:pd[e.code]||(pd[e.code]=new Qy._Code(e.code))})}j.useFunc=i_;var si;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(si||(j.Type=si={}));function a_(t,e,r){if(t instanceof K.Name){let n=e===si.Num;return r?n?(0,K._)`"[" + ${t} + "]"`:(0,K._)`"['" + ${t} + "']"`:n?(0,K._)`"/" + ${t}`:(0,K._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,K.getProperty)(t).toString():"/"+ii(t)}j.getErrorPath=a_;function yd(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}j.checkStrictMode=yd});var nt=$(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});var ge=I(),c_={data:new ge.Name("data"),valCxt:new ge.Name("valCxt"),instancePath:new ge.Name("instancePath"),parentData:new ge.Name("parentData"),parentDataProperty:new ge.Name("parentDataProperty"),rootData:new ge.Name("rootData"),dynamicAnchors:new ge.Name("dynamicAnchors"),vErrors:new ge.Name("vErrors"),errors:new ge.Name("errors"),this:new ge.Name("this"),self:new ge.Name("self"),scope:new ge.Name("scope"),json:new ge.Name("json"),jsonPos:new ge.Name("jsonPos"),jsonLen:new ge.Name("jsonLen"),jsonPart:new ge.Name("jsonPart")};ci.default=c_});var jr=$(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.extendErrors=ye.resetErrorsCount=ye.reportExtraError=ye.reportError=ye.keyword$DataError=ye.keywordError=void 0;var L=I(),Jn=D(),be=nt();ye.keywordError={message:({keyword:t})=>(0,L.str)`must pass "${t}" keyword validation`};ye.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,L.str)`"${t}" keyword must be ${e} ($data)`:(0,L.str)`"${t}" keyword is invalid ($data)`};function u_(t,e=ye.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=wd(t,e,r);n??(i||a)?_d(s,c):vd(o,(0,L._)`[${c}]`)}ye.reportError=u_;function l_(t,e=ye.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=wd(t,e,r);_d(o,a),s||i||vd(n,be.default.vErrors)}ye.reportExtraError=l_;function d_(t,e){t.assign(be.default.errors,e),t.if((0,L._)`${be.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,L._)`${be.default.vErrors}.length`,e),()=>t.assign(be.default.vErrors,null)))}ye.resetErrorsCount=d_;function p_({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,be.default.errors,a=>{t.const(i,(0,L._)`${be.default.vErrors}[${a}]`),t.if((0,L._)`${i}.instancePath === undefined`,()=>t.assign((0,L._)`${i}.instancePath`,(0,L.strConcat)(be.default.instancePath,s.errorPath))),t.assign((0,L._)`${i}.schemaPath`,(0,L.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,L._)`${i}.schema`,r),t.assign((0,L._)`${i}.data`,n))})}ye.extendErrors=p_;function _d(t,e){let r=t.const("err",e);t.if((0,L._)`${be.default.vErrors} === null`,()=>t.assign(be.default.vErrors,(0,L._)`[${r}]`),(0,L._)`${be.default.vErrors}.push(${r})`),t.code((0,L._)`${be.default.errors}++`)}function vd(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,L._)`new ${t.ValidationError}(${e})`):(r.assign((0,L._)`${n}.errors`,e),r.return(!1))}var kt={keyword:new L.Name("keyword"),schemaPath:new L.Name("schemaPath"),params:new L.Name("params"),propertyName:new L.Name("propertyName"),message:new L.Name("message"),schema:new L.Name("schema"),parentSchema:new L.Name("parentSchema")};function wd(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,L._)`{}`:f_(t,e,r)}function f_(t,e,r={}){let{gen:n,it:o}=t,s=[m_(o,r),h_(t,r)];return g_(t,e,s),n.object(...s)}function m_({errorPath:t},{instancePath:e}){let r=e?(0,L.str)`${t}${(0,Jn.getErrorPath)(e,Jn.Type.Str)}`:t;return[be.default.instancePath,(0,L.strConcat)(be.default.instancePath,r)]}function h_({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,L.str)`${e}/${t}`;return r&&(o=(0,L.str)`${o}${(0,Jn.getErrorPath)(r,Jn.Type.Str)}`),[kt.schemaPath,o]}function g_(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([kt.keyword,o],[kt.params,typeof e=="function"?e(t):e||(0,L._)`{}`]),c.messages&&n.push([kt.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([kt.schema,i],[kt.parentSchema,(0,L._)`${l}${d}`],[be.default.data,s]),u&&n.push([kt.propertyName,u])}});var $d=$(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.boolOrEmptySchema=Lt.topBoolOrEmptySchema=void 0;var y_=jr(),__=I(),v_=nt(),w_={message:"boolean schema is false"};function b_(t){let{gen:e,schema:r,validateName:n}=t;r===!1?bd(t,!1):typeof r=="object"&&r.$async===!0?e.return(v_.default.data):(e.assign((0,__._)`${n}.errors`,null),e.return(!0))}Lt.topBoolOrEmptySchema=b_;function $_(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),bd(t)):r.var(e,!0)}Lt.boolOrEmptySchema=$_;function bd(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,y_.reportError)(o,w_,void 0,e)}});var ui=$(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.getRules=Ft.isJSONType=void 0;var x_=["string","number","integer","boolean","null","object","array"],S_=new Set(x_);function z_(t){return typeof t=="string"&&S_.has(t)}Ft.isJSONType=z_;function k_(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ft.getRules=k_});var li=$(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.shouldUseRule=pt.shouldUseGroup=pt.schemaHasRulesForType=void 0;function P_({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&xd(t,n)}pt.schemaHasRulesForType=P_;function xd(t,e){return e.rules.some(r=>Sd(t,r))}pt.shouldUseGroup=xd;function Sd(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}pt.shouldUseRule=Sd});var Mr=$(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.reportTypeError=_e.checkDataTypes=_e.checkDataType=_e.coerceAndCheckDataType=_e.getJSONTypes=_e.getSchemaTypes=_e.DataType=void 0;var E_=ui(),T_=li(),C_=jr(),R=I(),zd=D(),Ut;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Ut||(_e.DataType=Ut={}));function R_(t){let e=kd(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}_e.getSchemaTypes=R_;function kd(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(E_.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}_e.getJSONTypes=kd;function N_(t,e){let{gen:r,data:n,opts:o}=t,s=I_(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,T_.schemaHasRulesForType)(t,e[0]));if(i){let a=pi(e,n,o.strictNumbers,Ut.Wrong);r.if(a,()=>{s.length?O_(t,e,s):fi(t)})}return i}_e.coerceAndCheckDataType=N_;var Pd=new Set(["string","number","integer","boolean","null"]);function I_(t,e){return e?t.filter(r=>Pd.has(r)||e==="array"&&r==="array"):[]}function O_(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,R._)`typeof ${o}`),a=n.let("coerced",(0,R._)`undefined`);s.coerceTypes==="array"&&n.if((0,R._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,R._)`${o}[0]`).assign(i,(0,R._)`typeof ${o}`).if(pi(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,R._)`${a} !== undefined`);for(let u of r)(Pd.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),fi(t),n.endIf(),n.if((0,R._)`${a} !== undefined`,()=>{n.assign(o,a),j_(t,a)});function c(u){switch(u){case"string":n.elseIf((0,R._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,R._)`"" + ${o}`).elseIf((0,R._)`${o} === null`).assign(a,(0,R._)`""`);return;case"number":n.elseIf((0,R._)`${i} == "boolean" || ${o} === null
|
|
4
|
+
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,R._)`+${o}`);return;case"integer":n.elseIf((0,R._)`${i} === "boolean" || ${o} === null
|
|
5
|
+
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,R._)`+${o}`);return;case"boolean":n.elseIf((0,R._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,R._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,R._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,R._)`${i} === "string" || ${i} === "number"
|
|
6
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,R._)`[${o}]`)}}}function j_({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,R._)`${e} !== undefined`,()=>t.assign((0,R._)`${e}[${r}]`,n))}function di(t,e,r,n=Ut.Correct){let o=n===Ut.Correct?R.operators.EQ:R.operators.NEQ,s;switch(t){case"null":return(0,R._)`${e} ${o} null`;case"array":s=(0,R._)`Array.isArray(${e})`;break;case"object":s=(0,R._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,R._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,R._)`typeof ${e} ${o} ${t}`}return n===Ut.Correct?s:(0,R.not)(s);function i(a=R.nil){return(0,R.and)((0,R._)`typeof ${e} == "number"`,a,r?(0,R._)`isFinite(${e})`:R.nil)}}_e.checkDataType=di;function pi(t,e,r,n){if(t.length===1)return di(t[0],e,r,n);let o,s=(0,zd.toHash)(t);if(s.array&&s.object){let i=(0,R._)`typeof ${e} != "object"`;o=s.null?i:(0,R._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else o=R.nil;s.number&&delete s.integer;for(let i in s)o=(0,R.and)(o,di(i,e,r,n));return o}_e.checkDataTypes=pi;var M_={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,R._)`{type: ${t}}`:(0,R._)`{type: ${e}}`};function fi(t){let e=q_(t);(0,C_.reportError)(e,M_)}_e.reportTypeError=fi;function q_(t){let{gen:e,data:r,schema:n}=t,o=(0,zd.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var Td=$(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.assignDefaults=void 0;var Vt=I(),A_=D();function Z_(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)Ed(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Ed(t,s,o.default))}Kn.assignDefaults=Z_;function Ed(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Vt._)`${s}${(0,Vt.getProperty)(e)}`;if(o){(0,A_.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Vt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Vt._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Vt._)`${a} = ${(0,Vt.stringify)(r)}`)}});var je=$(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.validateUnion=J.validateArray=J.usePattern=J.callValidateCode=J.schemaProperties=J.allSchemaProperties=J.noPropertyInData=J.propertyInData=J.isOwnProperty=J.hasPropFunc=J.reportMissingProp=J.checkMissingProp=J.checkReportMissingProp=void 0;var X=I(),mi=D(),ft=nt(),D_=D();function L_(t,e){let{gen:r,data:n,it:o}=t;r.if(gi(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,X._)`${e}`},!0),t.error()})}J.checkReportMissingProp=L_;function F_({gen:t,data:e,it:{opts:r}},n,o){return(0,X.or)(...n.map(s=>(0,X.and)(gi(t,e,s,r.ownProperties),(0,X._)`${o} = ${s}`)))}J.checkMissingProp=F_;function U_(t,e){t.setParams({missingProperty:e},!0),t.error()}J.reportMissingProp=U_;function Cd(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,X._)`Object.prototype.hasOwnProperty`})}J.hasPropFunc=Cd;function hi(t,e,r){return(0,X._)`${Cd(t)}.call(${e}, ${r})`}J.isOwnProperty=hi;function V_(t,e,r,n){let o=(0,X._)`${e}${(0,X.getProperty)(r)} !== undefined`;return n?(0,X._)`${o} && ${hi(t,e,r)}`:o}J.propertyInData=V_;function gi(t,e,r,n){let o=(0,X._)`${e}${(0,X.getProperty)(r)} === undefined`;return n?(0,X.or)(o,(0,X.not)(hi(t,e,r))):o}J.noPropertyInData=gi;function Rd(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}J.allSchemaProperties=Rd;function B_(t,e){return Rd(e).filter(r=>!(0,mi.alwaysValidSchema)(t,e[r]))}J.schemaProperties=B_;function H_({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,X._)`${t}, ${e}, ${n}${o}`:e,d=[[ft.default.instancePath,(0,X.strConcat)(ft.default.instancePath,s)],[ft.default.parentData,i.parentData],[ft.default.parentDataProperty,i.parentDataProperty],[ft.default.rootData,ft.default.rootData]];i.opts.dynamicRef&&d.push([ft.default.dynamicAnchors,ft.default.dynamicAnchors]);let p=(0,X._)`${l}, ${r.object(...d)}`;return c!==X.nil?(0,X._)`${a}.call(${c}, ${p})`:(0,X._)`${a}(${p})`}J.callValidateCode=H_;var J_=(0,X._)`new RegExp`;function K_({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,X._)`${o.code==="new RegExp"?J_:(0,D_.useFunc)(t,o)}(${r}, ${n})`})}J.usePattern=K_;function W_(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,X._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:mi.Type.Num},s),e.if((0,X.not)(s),a)})}}J.validateArray=W_;function G_(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,mi.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,X._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,X.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}J.validateUnion=G_});var Od=$(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.validateKeywordUsage=Je.validSchemaType=Je.funcKeywordCode=Je.macroKeywordCode=void 0;var $e=I(),Pt=nt(),Y_=je(),Q_=jr();function X_(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=Id(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:$e.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Je.macroKeywordCode=X_;function ev(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;rv(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=Id(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)h(),e.modifying&&Nd(t),y(()=>t.error());else{let v=e.async?f():m();e.modifying&&Nd(t),y(()=>tv(t,v))}}function f(){let v=n.let("ruleErrs",null);return n.try(()=>h((0,$e._)`await `),w=>n.assign(d,!1).if((0,$e._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,$e._)`${w}.errors`),()=>n.throw(w))),v}function m(){let v=(0,$e._)`${l}.errors`;return n.assign(v,null),h($e.nil),v}function h(v=e.async?(0,$e._)`await `:$e.nil){let w=c.opts.passContext?Pt.default.this:Pt.default.self,b=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,$e._)`${v}${(0,Y_.callValidateCode)(t,l,w,b)}`,e.modifying)}function y(v){var w;n.if((0,$e.not)((w=e.valid)!==null&&w!==void 0?w:d),v)}}Je.funcKeywordCode=ev;function Nd(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,$e._)`${n.parentData}[${n.parentDataProperty}]`))}function tv(t,e){let{gen:r}=t;r.if((0,$e._)`Array.isArray(${e})`,()=>{r.assign(Pt.default.vErrors,(0,$e._)`${Pt.default.vErrors} === null ? ${e} : ${Pt.default.vErrors}.concat(${e})`).assign(Pt.default.errors,(0,$e._)`${Pt.default.vErrors}.length`),(0,Q_.extendErrors)(t)},()=>t.error())}function rv({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Id(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,$e.stringify)(r)})}function nv(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Je.validSchemaType=nv;function ov({schema:t,opts:e,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Je.validateKeywordUsage=ov});var Md=$(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.extendSubschemaMode=mt.extendSubschemaData=mt.getSubschema=void 0;var Ke=I(),jd=D();function sv(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ke._)`${t.schemaPath}${(0,Ke.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ke._)`${t.schemaPath}${(0,Ke.getProperty)(e)}${(0,Ke.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,jd.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}mt.getSubschema=sv;function iv(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Ke._)`${e.data}${(0,Ke.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Ke.str)`${u}${(0,jd.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ke._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ke.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}mt.extendSubschemaData=iv;function av(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}mt.extendSubschemaMode=av});var yi=$((zE,qd)=>{"use strict";qd.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Zd=$((kE,Ad)=>{"use strict";var ht=Ad.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Wn(e,n,o,t,"",t)};ht.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ht.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ht.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ht.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 Wn(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ht.arrayKeywords)for(var p=0;p<d.length;p++)Wn(t,e,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in ht.propsKeywords){if(d&&typeof d=="object")for(var f in d)Wn(t,e,r,d[f],o+"/"+l+"/"+cv(f),s,o,l,n,f)}else(l in ht.keywords||t.allKeys&&!(l in ht.skipKeywords))&&Wn(t,e,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function cv(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var qr=$(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.getSchemaRefs=ke.resolveUrl=ke.normalizeId=ke._getFullPath=ke.getFullPath=ke.inlineRef=void 0;var uv=D(),lv=yi(),dv=Zd(),pv=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function fv(t,e=!0){return typeof t=="boolean"?!0:e===!0?!_i(t):e?Dd(t)<=e:!1}ke.inlineRef=fv;var mv=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function _i(t){for(let e in t){if(mv.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(_i)||typeof r=="object"&&_i(r))return!0}return!1}function Dd(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!pv.has(r)&&(typeof t[r]=="object"&&(0,uv.eachItem)(t[r],n=>e+=Dd(n)),e===1/0))return 1/0}return e}function Ld(t,e="",r){r!==!1&&(e=Bt(e));let n=t.parse(e);return Fd(t,n)}ke.getFullPath=Ld;function Fd(t,e){return t.serialize(e).split("#")[0]+"#"}ke._getFullPath=Fd;var hv=/#\/?$/;function Bt(t){return t?t.replace(hv,""):""}ke.normalizeId=Bt;function gv(t,e,r){return r=Bt(r),t.resolve(e,r)}ke.resolveUrl=gv;var yv=/^[a-z_][-a-z0-9._]*$/i;function _v(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Bt(t[r]||e),s={"":o},i=Ld(n,o,!1),a={},c=new Set;return dv(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=i+p,y=s[m];typeof d[r]=="string"&&(y=v.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[p]=y;function v(b){let S=this.opts.uriResolver.resolve;if(b=Bt(y?S(y,b):b),c.has(b))throw l(b);c.add(b);let z=this.refs[b];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?u(d,z.schema,b):b!==Bt(h)&&(b[0]==="#"?(u(d,a[b],b),a[b]=d):this.refs[b]=h),b}function w(b){if(typeof b=="string"){if(!yv.test(b))throw new Error(`invalid anchor "${b}"`);v.call(this,`#${b}`)}}}),a;function u(d,p,f){if(p!==void 0&&!lv(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ke.getSchemaRefs=_v});var Dr=$(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.getData=gt.KeywordCxt=gt.validateFunctionCode=void 0;var Jd=$d(),Ud=Mr(),wi=li(),Gn=Mr(),vv=Td(),Zr=Od(),vi=Md(),P=I(),T=nt(),wv=qr(),ot=D(),Ar=jr();function bv(t){if(Gd(t)&&(Yd(t),Wd(t))){Sv(t);return}Kd(t,()=>(0,Jd.topBoolOrEmptySchema)(t))}gt.validateFunctionCode=bv;function Kd({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0,P._)`${T.default.data}, ${T.default.valCxt}`,n.$async,()=>{t.code((0,P._)`"use strict"; ${Vd(r,o)}`),xv(t,o),t.code(s)}):t.func(e,(0,P._)`${T.default.data}, ${$v(o)}`,n.$async,()=>t.code(Vd(r,o)).code(s))}function $v(t){return(0,P._)`{${T.default.instancePath}="", ${T.default.parentData}, ${T.default.parentDataProperty}, ${T.default.rootData}=${T.default.data}${t.dynamicRef?(0,P._)`, ${T.default.dynamicAnchors}={}`:P.nil}}={}`}function xv(t,e){t.if(T.default.valCxt,()=>{t.var(T.default.instancePath,(0,P._)`${T.default.valCxt}.${T.default.instancePath}`),t.var(T.default.parentData,(0,P._)`${T.default.valCxt}.${T.default.parentData}`),t.var(T.default.parentDataProperty,(0,P._)`${T.default.valCxt}.${T.default.parentDataProperty}`),t.var(T.default.rootData,(0,P._)`${T.default.valCxt}.${T.default.rootData}`),e.dynamicRef&&t.var(T.default.dynamicAnchors,(0,P._)`${T.default.valCxt}.${T.default.dynamicAnchors}`)},()=>{t.var(T.default.instancePath,(0,P._)`""`),t.var(T.default.parentData,(0,P._)`undefined`),t.var(T.default.parentDataProperty,(0,P._)`undefined`),t.var(T.default.rootData,T.default.data),e.dynamicRef&&t.var(T.default.dynamicAnchors,(0,P._)`{}`)})}function Sv(t){let{schema:e,opts:r,gen:n}=t;Kd(t,()=>{r.$comment&&e.$comment&&Xd(t),Tv(t),n.let(T.default.vErrors,null),n.let(T.default.errors,0),r.unevaluated&&zv(t),Qd(t),Nv(t)})}function zv(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,P._)`${r}.evaluated`),e.if((0,P._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,P._)`${t.evaluated}.props`,(0,P._)`undefined`)),e.if((0,P._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,P._)`${t.evaluated}.items`,(0,P._)`undefined`))}function Vd(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,P._)`/*# sourceURL=${r} */`:P.nil}function kv(t,e){if(Gd(t)&&(Yd(t),Wd(t))){Pv(t,e);return}(0,Jd.boolOrEmptySchema)(t,e)}function Wd({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Gd(t){return typeof t.schema!="boolean"}function Pv(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&Xd(t),Cv(t),Rv(t);let s=n.const("_errs",T.default.errors);Qd(t,s),n.var(e,(0,P._)`${s} === ${T.default.errors}`)}function Yd(t){(0,ot.checkUnknownRules)(t),Ev(t)}function Qd(t,e){if(t.opts.jtd)return Bd(t,[],!1,e);let r=(0,Ud.getSchemaTypes)(t.schema),n=(0,Ud.coerceAndCheckDataType)(t,r);Bd(t,r,!n,e)}function Ev(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,ot.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Tv(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ot.checkStrictMode)(t,"default is ignored in the schema root")}function Cv(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,wv.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Rv(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Xd({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)t.code((0,P._)`${T.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,P.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,P._)`${T.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Nv(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0,P._)`${T.default.errors} === 0`,()=>e.return(T.default.data),()=>e.throw((0,P._)`new ${o}(${T.default.vErrors})`)):(e.assign((0,P._)`${n}.errors`,T.default.vErrors),s.unevaluated&&Iv(t),e.return((0,P._)`${T.default.errors} === 0`))}function Iv({gen:t,evaluated:e,props:r,items:n}){r instanceof P.Name&&t.assign((0,P._)`${e}.props`,r),n instanceof P.Name&&t.assign((0,P._)`${e}.items`,n)}function Bd(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ot.schemaHasRulesButRef)(s,l))){o.block(()=>tp(t,"$ref",l.all.$ref.definition));return}c.jtd||Ov(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,wi.shouldUseGroup)(s,p)&&(p.type?(o.if((0,Gn.checkDataType)(p.type,i,c.strictNumbers)),Hd(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0,Gn.reportTypeError)(t)),o.endIf()):Hd(t,p),a||o.if((0,P._)`${T.default.errors} === ${n||0}`))}}function Hd(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,vv.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,wi.shouldUseRule)(n,s)&&tp(t,s.keyword,s.definition,e.type)})}function Ov(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(jv(t,e),t.opts.allowUnionTypes||Mv(t,e),qv(t,t.dataTypes))}function jv(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{ep(t.dataTypes,r)||bi(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Zv(t,e)}}function Mv(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&bi(t,"use allowUnionTypes to allow union type keyword")}function qv(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,wi.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>Av(e,i))&&bi(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function Av(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function ep(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Zv(t,e){let r=[];for(let n of t.dataTypes)ep(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function bi(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,ot.checkStrictMode)(t,e,t.opts.strictTypes)}var Yn=class{constructor(e,r,n){if((0,Zr.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ot.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",rp(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Zr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",T.default.errors))}result(e,r,n){this.failResult((0,P.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,P.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,P._)`${r} !== undefined && (${(0,P.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ar.reportExtraError:Ar.reportError)(this,this.def.error,r)}$dataError(){(0,Ar.reportError)(this,this.def.$dataError||Ar.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ar.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=P.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=P.nil,r=P.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,P.or)((0,P._)`${o} === undefined`,r)),e!==P.nil&&n.assign(e,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==P.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,P.or)(i(),a());function i(){if(n.length){if(!(r instanceof P.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,P._)`${(0,Gn.checkDataTypes)(c,r,s.opts.strictNumbers,Gn.DataType.Wrong)}`}return P.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,P._)`!${c}(${r})`}return P.nil}}subschema(e,r){let n=(0,vi.getSubschema)(this.it,e);(0,vi.extendSubschemaData)(n,this.it,e),(0,vi.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return kv(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=ot.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=ot.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,P.Name)),!0}};gt.KeywordCxt=Yn;function tp(t,e,r,n){let o=new Yn(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Zr.funcKeywordCode)(o,r):"macro"in r?(0,Zr.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Zr.funcKeywordCode)(o,r)}var Dv=/^\/(?:[^~]|~0|~1)*$/,Lv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function rp(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return T.default.rootData;if(t[0]==="/"){if(!Dv.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=T.default.rootData}else{let u=Lv.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,P._)`${s}${(0,P.getProperty)((0,ot.unescapeJsonPointer)(u))}`,i=(0,P._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}gt.getData=rp});var Qn=$(xi=>{"use strict";Object.defineProperty(xi,"__esModule",{value:!0});var $i=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};xi.default=$i});var Lr=$(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});var Si=qr(),zi=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Si.resolveUrl)(e,r,n),this.missingSchema=(0,Si.normalizeId)((0,Si.getFullPath)(e,this.missingRef))}};ki.default=zi});var eo=$(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.resolveSchema=Me.getCompilingSchema=Me.resolveRef=Me.compileSchema=Me.SchemaEnv=void 0;var Le=I(),Fv=Qn(),Et=nt(),Fe=qr(),np=D(),Uv=Dr(),Ht=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Fe.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Me.SchemaEnv=Ht;function Ei(t){let e=op.call(this,t);if(e)return e;let r=(0,Fe.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new Le.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:Fv.default,code:(0,Le._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Et.default.data,parentData:Et.default.parentData,parentDataProperty:Et.default.parentDataProperty,dataNames:[Et.default.data],dataPathArr:[Le.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Le.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Le.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Le._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Uv.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Et.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Et.default.self}`,`${Et.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:h}=u;f.evaluated={props:m instanceof Le.Name?void 0:m,items:h instanceof Le.Name?void 0:h,dynamicProps:m instanceof Le.Name,dynamicItems:h instanceof Le.Name},f.source&&(f.source.evaluated=(0,Le.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Me.compileSchema=Ei;function Vv(t,e,r){var n;r=(0,Fe.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=Jv.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new Ht({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=Bv.call(this,s)}Me.resolveRef=Vv;function Bv(t){return(0,Fe.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Ei.call(this,t)}function op(t){for(let e of this._compilations)if(Hv(e,t))return e}Me.getCompilingSchema=op;function Hv(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Jv(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Xn.call(this,t,e)}function Xn(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Fe._getFullPath)(this.opts.uriResolver,r),o=(0,Fe.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return Pi.call(this,r,t);let s=(0,Fe.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Xn.call(this,t,i);return typeof a?.schema!="object"?void 0:Pi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Ei.call(this,i),s===(0,Fe.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Fe.resolveUrl)(this.opts.uriResolver,o,u)),new Ht({schema:a,schemaId:c,root:t,baseId:o})}return Pi.call(this,r,i)}}Me.resolveSchema=Xn;var Kv=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Pi(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,np.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Kv.has(a)&&u&&(e=(0,Fe.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,np.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Fe.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Xn.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Ht({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var sp=$((NE,Wv)=>{Wv.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ci=$((IE,up)=>{"use strict";var Gv=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ap=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Ti(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var Yv=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function ip(t){return t.length=0,!0}function Qv(t,e,r){if(t.length){let n=Ti(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function Xv(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=Qv;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=ip}else{o.push(u);continue}}return o.length&&(a===ip?r.zone=o.join(""):i?n.push(o.join("")):n.push(Ti(o))),r.address=n.join(""),r}function cp(t){if(ew(t,":")<2)return{host:t,isIPV6:!1};let e=Xv(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ew(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function tw(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function rw(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function nw(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!ap(r)){let n=cp(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}up.exports={nonSimpleDomain:Yv,recomposeAuthority:nw,normalizeComponentEncoding:rw,removeDotSegments:tw,isIPv4:ap,isUUID:Gv,normalizeIPv6:cp,stringArrayToHexStripped:Ti}});var mp=$((OE,fp)=>{"use strict";var{isUUID:ow}=Ci(),sw=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,iw=["http","https","ws","wss","urn","urn:uuid"];function aw(t){return iw.indexOf(t)!==-1}function Ri(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function lp(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function dp(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function cw(t){return t.secure=Ri(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function uw(t){if((t.port===(Ri(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function lw(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(sw);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,s=Ni(o);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function dw(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,s=Ni(o);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function pw(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!ow(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function fw(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var pp={scheme:"http",domainHost:!0,parse:lp,serialize:dp},mw={scheme:"https",domainHost:pp.domainHost,parse:lp,serialize:dp},to={scheme:"ws",domainHost:!0,parse:cw,serialize:uw},hw={scheme:"wss",domainHost:to.domainHost,parse:to.parse,serialize:to.serialize},gw={scheme:"urn",parse:lw,serialize:dw,skipNormalize:!0},yw={scheme:"urn:uuid",parse:pw,serialize:fw,skipNormalize:!0},ro={http:pp,https:mw,ws:to,wss:hw,urn:gw,"urn:uuid":yw};Object.setPrototypeOf(ro,null);function Ni(t){return t&&(ro[t]||ro[t.toLowerCase()])||void 0}fp.exports={wsIsSecure:Ri,SCHEMES:ro,isValidSchemeName:aw,getSchemeHandler:Ni}});var yp=$((jE,oo)=>{"use strict";var{normalizeIPv6:_w,removeDotSegments:Fr,recomposeAuthority:vw,normalizeComponentEncoding:no,isIPv4:ww,nonSimpleDomain:bw}=Ci(),{SCHEMES:$w,getSchemeHandler:hp}=mp();function xw(t,e){return typeof t=="string"?t=We(st(t,e),e):typeof t=="object"&&(t=st(We(t,e),e)),t}function Sw(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=gp(st(t,n),st(e,n),n,!0);return n.skipEscape=!0,We(o,n)}function gp(t,e,r,n){let o={};return n||(t=st(We(t,r),r),e=st(We(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Fr(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Fr(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Fr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Fr(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function zw(t,e,r){return typeof t=="string"?(t=unescape(t),t=We(no(st(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=We(no(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=We(no(st(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=We(no(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function We(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],s=hp(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let i=vw(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=Fr(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var kw=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function st(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let s=t.match(kw);if(s){if(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]),n.host)if(ww(n.host)===!1){let c=_w(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let i=hp(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&o===!1&&bw(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),i&&i.parse&&i.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Ii={SCHEMES:$w,normalize:xw,resolve:Sw,resolveComponent:gp,equal:zw,serialize:We,parse:st};oo.exports=Ii;oo.exports.default=Ii;oo.exports.fastUri=Ii});var vp=$(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});var _p=yp();_p.code='require("ajv/dist/runtime/uri").default';Oi.default=_p});var Pp=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.CodeGen=fe.Name=fe.nil=fe.stringify=fe.str=fe._=fe.KeywordCxt=void 0;var Pw=Dr();Object.defineProperty(fe,"KeywordCxt",{enumerable:!0,get:function(){return Pw.KeywordCxt}});var Jt=I();Object.defineProperty(fe,"_",{enumerable:!0,get:function(){return Jt._}});Object.defineProperty(fe,"str",{enumerable:!0,get:function(){return Jt.str}});Object.defineProperty(fe,"stringify",{enumerable:!0,get:function(){return Jt.stringify}});Object.defineProperty(fe,"nil",{enumerable:!0,get:function(){return Jt.nil}});Object.defineProperty(fe,"Name",{enumerable:!0,get:function(){return Jt.Name}});Object.defineProperty(fe,"CodeGen",{enumerable:!0,get:function(){return Jt.CodeGen}});var Ew=Qn(),Sp=Lr(),Tw=ui(),Ur=eo(),Cw=I(),Vr=qr(),so=Mr(),Mi=D(),wp=sp(),Rw=vp(),zp=(t,e)=>new RegExp(t,e);zp.code="new RegExp";var Nw=["removeAdditional","useDefaults","coerceTypes"],Iw=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Ow={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},jw={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},bp=200;function Mw(t){var e,r,n,o,s,i,a,c,u,l,d,p,f,m,h,y,v,w,b,S,z,V,N,H,q;let ie=t.strict,ve=(e=t.code)===null||e===void 0?void 0:e.optimize,Ee=ve===!0||ve===void 0?1:ve||0,Ce=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:zp,Ae=(o=t.uriResolver)!==null&&o!==void 0?o:Rw.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:ie)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:ie)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:ie)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:ie)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:ie)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Ee,regExp:Ce}:{optimize:Ee,regExp:Ce},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:bp,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:bp,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(b=t.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(S=t.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(z=t.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(V=t.validateSchema)!==null&&V!==void 0?V:!0,validateFormats:(N=t.validateFormats)!==null&&N!==void 0?N:!0,unicodeRegExp:(H=t.unicodeRegExp)!==null&&H!==void 0?H:!0,int32range:(q=t.int32range)!==null&&q!==void 0?q:!0,uriResolver:Ae}}var Br=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Mw(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new Cw.ValueScope({scope:{},prefixes:Iw,es5:r,lines:n}),this.logger=Fw(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Tw.getRules)(),$p.call(this,Ow,e,"NOT SUPPORTED"),$p.call(this,jw,e,"DEPRECATED","warn"),this._metaOpts=Dw.call(this),e.formats&&Aw.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Zw.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),qw.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=wp;n==="id"&&(o={...wp},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Sp.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Vr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(e){let r;for(;typeof(r=xp.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Ur.SchemaEnv({schema:{},schemaId:n});if(r=Ur.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=xp.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Vr.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Vw.call(this,n,r),!r)return(0,Mi.eachItem)(n,s=>ji.call(this,s)),this;Hw.call(this,r);let o={...r,type:(0,so.getJSONTypes)(r.type),schemaType:(0,so.getJSONTypes)(r.schemaType)};return(0,Mi.eachItem)(n,o.type.length===0?s=>ji.call(this,s,o):s=>o.type.forEach(i=>ji.call(this,s,o,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=kp(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Vr.normalizeId)(i||n);let u=Vr.getSchemaRefs.call(this,e,n);return c=new Ur.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Ur.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Ur.compileSchema.call(this,e)}finally{this.opts=r}}};Br.ValidationError=Ew.default;Br.MissingRefError=Sp.default;fe.default=Br;function $p(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`)}}function xp(t){return t=(0,Vr.normalizeId)(t),this.schemas[t]||this.refs[t]}function qw(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Aw(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Zw(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Dw(){let t={...this.opts};for(let e of Nw)delete t[e];return t}var Lw={log(){},warn(){},error(){}};function Fw(t){if(t===!1)return Lw;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Uw=/^[a-z_$][a-z0-9_$:-]*$/i;function Vw(t,e){let{RULES:r}=this;if((0,Mi.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Uw.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function ji(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,so.getJSONTypes)(e.type),schemaType:(0,so.getJSONTypes)(e.schemaType)}};e.before?Bw.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Bw(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Hw(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=kp(e)),t.validateSchema=this.compile(e,!0))}var Jw={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function kp(t){return{anyOf:[t,Jw]}}});var Ep=$(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var Kw={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};qi.default=Kw});var Np=$(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.callRef=Tt.getValidate=void 0;var Ww=Lr(),Tp=je(),Pe=I(),Kt=nt(),Cp=eo(),io=D(),Gw={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Cp.resolveRef.call(c,u,o,r);if(l===void 0)throw new Ww.default(n.opts.uriResolver,o,r);if(l instanceof Cp.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return ao(t,i,s,s.$async);let m=e.scopeValue("root",{ref:u});return ao(t,(0,Pe._)`${m}.validate`,u,u.$async)}function p(m){let h=Rp(t,m);ao(t,h,m,m.$async)}function f(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Pe.stringify)(m)}:{ref:m}),y=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:Pe.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(v),t.ok(y)}}};function Rp(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Pe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Tt.getValidate=Rp;function ao(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Kt.default.this:Pe.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,Pe._)`await ${(0,Tp.callValidateCode)(t,e,u)}`),f(e),i||o.assign(m,!0)},h=>{o.if((0,Pe._)`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),p(h),i||o.assign(m,!1)}),t.ok(m)}function d(){t.result((0,Tp.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(m){let h=(0,Pe._)`${m}.errors`;o.assign(Kt.default.vErrors,(0,Pe._)`${Kt.default.vErrors} === null ? ${h} : ${Kt.default.vErrors}.concat(${h})`),o.assign(Kt.default.errors,(0,Pe._)`${Kt.default.vErrors}.length`)}function f(m){var h;if(!s.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=io.mergeEvaluated.props(o,y.props,s.props));else{let v=o.var("props",(0,Pe._)`${m}.evaluated.props`);s.props=io.mergeEvaluated.props(o,v,s.props,Pe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=io.mergeEvaluated.items(o,y.items,s.items));else{let v=o.var("items",(0,Pe._)`${m}.evaluated.items`);s.items=io.mergeEvaluated.items(o,v,s.items,Pe.Name)}}}Tt.callRef=ao;Tt.default=Gw});var Ip=$(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});var Yw=Ep(),Qw=Np(),Xw=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Yw.default,Qw.default];Ai.default=Xw});var Op=$(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});var co=I(),yt=co.operators,uo={maximum:{okStr:"<=",ok:yt.LTE,fail:yt.GT},minimum:{okStr:">=",ok:yt.GTE,fail:yt.LT},exclusiveMaximum:{okStr:"<",ok:yt.LT,fail:yt.GTE},exclusiveMinimum:{okStr:">",ok:yt.GT,fail:yt.LTE}},eb={message:({keyword:t,schemaCode:e})=>(0,co.str)`must be ${uo[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,co._)`{comparison: ${uo[t].okStr}, limit: ${e}}`},tb={keyword:Object.keys(uo),type:"number",schemaType:"number",$data:!0,error:eb,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,co._)`${r} ${uo[e].fail} ${n} || isNaN(${r})`)}};Zi.default=tb});var jp=$(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});var Hr=I(),rb={message:({schemaCode:t})=>(0,Hr.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Hr._)`{multipleOf: ${t}}`},nb={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:rb,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,Hr._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Hr._)`${i} !== parseInt(${i})`;t.fail$data((0,Hr._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Di.default=nb});var qp=$(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});function Mp(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}Li.default=Mp;Mp.code='require("ajv/dist/runtime/ucs2length").default'});var Ap=$(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});var Ct=I(),ob=D(),sb=qp(),ib={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ct.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ct._)`{limit: ${t}}`},ab={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ib,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?Ct.operators.GT:Ct.operators.LT,i=o.opts.unicode===!1?(0,Ct._)`${r}.length`:(0,Ct._)`${(0,ob.useFunc)(t.gen,sb.default)}(${r})`;t.fail$data((0,Ct._)`${i} ${s} ${n}`)}};Fi.default=ab});var Zp=$(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});var cb=je(),ub=D(),Wt=I(),lb={message:({schemaCode:t})=>(0,Wt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Wt._)`{pattern: ${t}}`},db={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:lb,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Wt._)`new RegExp`:(0,ub.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Wt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Wt._)`!${l}`)}else{let c=(0,cb.usePattern)(t,o);t.fail$data((0,Wt._)`!${c}.test(${r})`)}}};Ui.default=db});var Dp=$(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});var Jr=I(),pb={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Jr.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Jr._)`{limit: ${t}}`},fb={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:pb,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Jr.operators.GT:Jr.operators.LT;t.fail$data((0,Jr._)`Object.keys(${r}).length ${o} ${n}`)}};Vi.default=fb});var Lp=$(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var Kr=je(),Wr=I(),mb=D(),hb={message:({params:{missingProperty:t}})=>(0,Wr.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Wr._)`{missingProperty: ${t}}`},gb={keyword:"required",type:"object",schemaType:"array",$data:!0,error:hb,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,mb.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(Wr.nil,d);else for(let f of r)(0,Kr.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,Kr.checkMissingProp)(t,r,f)),(0,Kr.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,Kr.noPropertyInData)(e,o,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(m,(0,Kr.propertyInData)(e,o,f,a.ownProperties)),e.if((0,Wr.not)(m),()=>{t.error(),e.break()})},Wr.nil)}}};Bi.default=gb});var Fp=$(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Gr=I(),yb={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Gr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Gr._)`{limit: ${t}}`},_b={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:yb,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Gr.operators.GT:Gr.operators.LT;t.fail$data((0,Gr._)`${r}.length ${o} ${n}`)}};Hi.default=_b});var lo=$(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});var Up=yi();Up.code='require("ajv/dist/runtime/equal").default';Ji.default=Up});var Vp=$(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var Ki=Mr(),me=I(),vb=D(),wb=lo(),bb={message:({params:{i:t,j:e}})=>(0,me.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,me._)`{i: ${t}, j: ${e}}`},$b={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:bb,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0,Ki.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,me._)`${i} === false`),t.ok(c);function l(){let m=e.let("i",(0,me._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,me._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,h){let y=e.name("item"),v=(0,Ki.checkDataTypes)(u,y,a.opts.strictNumbers,Ki.DataType.Wrong),w=e.const("indices",(0,me._)`{}`);e.for((0,me._)`;${m}--;`,()=>{e.let(y,(0,me._)`${r}[${m}]`),e.if(v,(0,me._)`continue`),u.length>1&&e.if((0,me._)`typeof ${y} == "string"`,(0,me._)`${y} += "_"`),e.if((0,me._)`typeof ${w}[${y}] == "number"`,()=>{e.assign(h,(0,me._)`${w}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,me._)`${w}[${y}] = ${m}`)})}function f(m,h){let y=(0,vb.useFunc)(e,wb.default),v=e.name("outer");e.label(v).for((0,me._)`;${m}--;`,()=>e.for((0,me._)`${h} = ${m}; ${h}--;`,()=>e.if((0,me._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Wi.default=$b});var Bp=$(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Gi=I(),xb=D(),Sb=lo(),zb={message:"must be equal to constant",params:({schemaCode:t})=>(0,Gi._)`{allowedValue: ${t}}`},kb={keyword:"const",$data:!0,error:zb,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Gi._)`!${(0,xb.useFunc)(e,Sb.default)}(${r}, ${o})`):t.fail((0,Gi._)`${s} !== ${r}`)}};Yi.default=kb});var Hp=$(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var Yr=I(),Pb=D(),Eb=lo(),Tb={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Yr._)`{allowedValues: ${t}}`},Cb={keyword:"enum",schemaType:"array",$data:!0,error:Tb,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Pb.useFunc)(e,Eb.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,Yr.or)(...o.map((m,h)=>p(f,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,Yr._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,m){let h=o[m];return typeof h=="object"&&h!==null?(0,Yr._)`${u()}(${r}, ${f}[${m}])`:(0,Yr._)`${r} === ${h}`}}};Qi.default=Cb});var Jp=$(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var Rb=Op(),Nb=jp(),Ib=Ap(),Ob=Zp(),jb=Dp(),Mb=Lp(),qb=Fp(),Ab=Vp(),Zb=Bp(),Db=Hp(),Lb=[Rb.default,Nb.default,Ib.default,Ob.default,jb.default,Mb.default,qb.default,Ab.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Zb.default,Db.default];Xi.default=Lb});var ta=$(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.validateAdditionalItems=void 0;var Rt=I(),ea=D(),Fb={message:({params:{len:t}})=>(0,Rt.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Rt._)`{limit: ${t}}`},Ub={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Fb,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,ea.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Kp(t,n)}};function Kp(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Rt._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Rt._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,ea.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Rt._)`${a} <= ${e.length}`);r.if((0,Rt.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:ea.Type.Num},u),i.allErrors||r.if((0,Rt.not)(u),()=>r.break())})}}Qr.validateAdditionalItems=Kp;Qr.default=Ub});var ra=$(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.validateTuple=void 0;var Wp=I(),po=D(),Vb=je(),Bb={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Gp(t,"additionalItems",e);r.items=!0,!(0,po.alwaysValidSchema)(r,e)&&t.ok((0,Vb.validateArray)(t))}};function Gp(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=po.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Wp._)`${s}.length`);r.forEach((d,p)=>{(0,po.alwaysValidSchema)(a,d)||(n.if((0,Wp._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!h){let y=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,po.checkStrictMode)(a,y,p.strictTuples)}}}Xr.validateTuple=Gp;Xr.default=Bb});var Yp=$(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var Hb=ra(),Jb={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Hb.validateTuple)(t,"items")};na.default=Jb});var Xp=$(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});var Qp=I(),Kb=D(),Wb=je(),Gb=ta(),Yb={message:({params:{len:t}})=>(0,Qp.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Qp._)`{limit: ${t}}`},Qb={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Yb,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Kb.alwaysValidSchema)(n,e)&&(o?(0,Gb.validateAdditionalItems)(t,o):t.ok((0,Wb.validateArray)(t)))}};oa.default=Qb});var ef=$(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var qe=I(),fo=D(),Xb={message:({params:{min:t,max:e}})=>e===void 0?(0,qe.str)`must contain at least ${t} valid item(s)`:(0,qe.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,qe._)`{minContains: ${t}}`:(0,qe._)`{minContains: ${t}, maxContains: ${e}}`},e0={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Xb,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,qe._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,fo.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,fo.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,fo.alwaysValidSchema)(s,r)){let h=(0,qe._)`${l} >= ${i}`;a!==void 0&&(h=(0,qe._)`${h} && ${l} <= ${a}`),t.pass(h);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,qe._)`${o}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let h=e.name("_valid"),y=e.let("count",0);f(h,()=>e.if(h,()=>m(y)))}function f(h,y){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:fo.Type.Num,compositeRule:!0},h),y()})}function m(h){e.code((0,qe._)`${h}++`),a===void 0?e.if((0,qe._)`${h} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,qe._)`${h} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,qe._)`${h} >= ${i}`,()=>e.assign(d,!0)))}}};sa.default=e0});var nf=$(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.validateSchemaDeps=Ge.validatePropertyDeps=Ge.error=void 0;var ia=I(),t0=D(),en=je();Ge.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,ia.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,ia._)`{property: ${t},
|
|
7
|
+
missingProperty: ${n},
|
|
8
|
+
depsCount: ${e},
|
|
9
|
+
deps: ${r}}`};var r0={keyword:"dependencies",type:"object",schemaType:"object",error:Ge.error,code(t){let[e,r]=n0(t);tf(t,e),rf(t,r)}};function n0({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function tf(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,en.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,en.checkReportMissingProp)(t,u)}):(r.if((0,ia._)`${c} && (${(0,en.checkMissingProp)(t,a,s)})`),(0,en.reportMissingProp)(t,s),r.else())}}Ge.validatePropertyDeps=tf;function rf(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0,t0.alwaysValidSchema)(s,e[a])||(r.if((0,en.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Ge.validateSchemaDeps=rf;Ge.default=r0});var sf=$(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var of=I(),o0=D(),s0={message:"property name must be valid",params:({params:t})=>(0,of._)`{propertyName: ${t.propertyName}}`},i0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:s0,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,o0.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,of.not)(s),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(s)}};aa.default=i0});var ua=$(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var mo=je(),Ue=I(),a0=nt(),ho=D(),c0={message:"must NOT have additional properties",params:({params:t})=>(0,Ue._)`{additionalProperty: ${t.additionalProperty}}`},u0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:c0,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,ho.alwaysValidSchema)(i,r))return;let u=(0,mo.allSchemaProperties)(n.properties),l=(0,mo.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Ue._)`${s} === ${a0.default.errors}`);function d(){e.forIn("key",o,y=>{!u.length&&!l.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let v;if(u.length>8){let w=(0,ho.schemaRefOrVal)(i,n.properties,"properties");v=(0,mo.isOwnProperty)(e,w,y)}else u.length?v=(0,Ue.or)(...u.map(w=>(0,Ue._)`${y} === ${w}`)):v=Ue.nil;return l.length&&(v=(0,Ue.or)(v,...l.map(w=>(0,Ue._)`${(0,mo.usePattern)(t,w)}.test(${y})`))),(0,Ue.not)(v)}function f(y){e.code((0,Ue._)`delete ${o}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,ho.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(y,v,!1),e.if((0,Ue.not)(v),()=>{t.reset(),f(y)})):(h(y,v),a||e.if((0,Ue.not)(v),()=>e.break()))}}function h(y,v,w){let b={keyword:"additionalProperties",dataProp:y,dataPropType:ho.Type.Str};w===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(b,v)}}};ca.default=u0});var uf=$(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var l0=Dr(),af=je(),la=D(),cf=ua(),d0={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&cf.default.code(new l0.KeywordCxt(s,cf.default,"additionalProperties"));let i=(0,af.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=la.mergeEvaluated.props(e,(0,la.toHash)(i),s.props));let a=i.filter(d=>!(0,la.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,af.propertyInData)(e,o,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};da.default=d0});var ff=$(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var lf=je(),go=I(),df=D(),pf=D(),p0={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0,lf.allSchemaProperties)(r),c=a.filter(h=>(0,df.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof go.Name)&&(s.props=(0,pf.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let h of a)u&&f(h),s.allErrors?m(h):(e.var(l,!0),m(h),e.if(l))}function f(h){for(let y in u)new RegExp(h).test(y)&&(0,df.checkStrictMode)(s,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,y=>{e.if((0,go._)`${(0,lf.usePattern)(t,h)}.test(${y})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:pf.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,go._)`${d}[${y}]`,!0):!v&&!s.allErrors&&e.if((0,go.not)(l),()=>e.break())})})}}};pa.default=p0});var mf=$(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var f0=D(),m0={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,f0.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};fa.default=m0});var hf=$(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var h0=je(),g0={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:h0.validateUnion,error:{message:"must match a schema in anyOf"}};ma.default=g0});var gf=$(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var yo=I(),y0=D(),_0={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,yo._)`{passingSchemas: ${t.passing}}`},v0={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:_0,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,y0.alwaysValidSchema)(o,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,yo._)`${c} && ${i}`).assign(i,!1).assign(a,(0,yo._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,yo.Name)})})}}};ha.default=v0});var yf=$(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var w0=D(),b0={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((s,i)=>{if((0,w0.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a)})}};ga.default=b0});var wf=$(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var _o=I(),vf=D(),$0={message:({params:t})=>(0,_o.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,_o._)`{failingKeyword: ${t.ifClause}}`},x0={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:$0,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,vf.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=_f(n,"then"),s=_f(n,"else");if(!o&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,_o.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,_o._)`${l}`):t.setParams({ifClause:l})}}}};function _f(t,e){let r=t.schema[e];return r!==void 0&&!(0,vf.alwaysValidSchema)(t,r)}ya.default=x0});var bf=$(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var S0=D(),z0={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,S0.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};_a.default=z0});var $f=$(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var k0=ta(),P0=Yp(),E0=ra(),T0=Xp(),C0=ef(),R0=nf(),N0=sf(),I0=ua(),O0=uf(),j0=ff(),M0=mf(),q0=hf(),A0=gf(),Z0=yf(),D0=wf(),L0=bf();function F0(t=!1){let e=[M0.default,q0.default,A0.default,Z0.default,D0.default,L0.default,N0.default,I0.default,R0.default,O0.default,j0.default];return t?e.push(P0.default,T0.default):e.push(k0.default,E0.default),e.push(C0.default),e}va.default=F0});var xf=$(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var ae=I(),U0={message:({schemaCode:t})=>(0,ae.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ae._)`{format: ${t}}`},V0={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:U0,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,ae._)`${m}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,ae._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,ae._)`${h}.type || "string"`).assign(v,(0,ae._)`${h}.validate`),()=>r.assign(y,(0,ae._)`"string"`).assign(v,h)),t.fail$data((0,ae.or)(w(),b()));function w(){return c.strictSchema===!1?ae.nil:(0,ae._)`${i} && !${v}`}function b(){let S=l.$async?(0,ae._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,ae._)`${v}(${n})`,z=(0,ae._)`(typeof ${v} == "function" ? ${S} : ${v}.test(${n}))`;return(0,ae._)`${v} && ${v} !== true && ${y} === ${e} && !${z}`}}function f(){let m=d.formats[s];if(!m){w();return}if(m===!0)return;let[h,y,v]=b(m);h===e&&t.pass(S());function w(){if(c.strictSchema===!1){d.logger.warn(z());return}throw new Error(z());function z(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function b(z){let V=z instanceof RegExp?(0,ae.regexpCode)(z):c.code.formats?(0,ae._)`${c.code.formats}${(0,ae.getProperty)(s)}`:void 0,N=r.scopeValue("formats",{key:s,ref:z,code:V});return typeof z=="object"&&!(z instanceof RegExp)?[z.type||"string",z.validate,(0,ae._)`${N}.validate`]:["string",z,N]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ae._)`await ${v}(${n})`}return typeof y=="function"?(0,ae._)`${v}(${n})`:(0,ae._)`${v}.test(${n})`}}}};wa.default=V0});var Sf=$(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var B0=xf(),H0=[B0.default];ba.default=H0});var zf=$(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.contentVocabulary=Gt.metadataVocabulary=void 0;Gt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Gt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Pf=$($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var J0=Ip(),K0=Jp(),W0=$f(),G0=Sf(),kf=zf(),Y0=[J0.default,K0.default,(0,W0.default)(),G0.default,kf.metadataVocabulary,kf.contentVocabulary];$a.default=Y0});var Tf=$(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});vo.DiscrError=void 0;var Ef;(function(t){t.Tag="tag",t.Mapping="mapping"})(Ef||(vo.DiscrError=Ef={}))});var Rf=$(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var Yt=I(),xa=Tf(),Cf=eo(),Q0=Lr(),X0=D(),e$={message:({params:{discrError:t,tagName:e}})=>t===xa.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Yt._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},t$={keyword:"discriminator",type:"object",schemaType:"object",error:e$,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,Yt._)`${r}${(0,Yt.getProperty)(a)}`);e.if((0,Yt._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:xa.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,Yt._)`${u} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:xa.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(h,Yt.Name),m}function p(){var f;let m={},h=v(o),y=!0;for(let S=0;S<i.length;S++){let z=i[S];if(z?.$ref&&!(0,X0.schemaHasRulesButRef)(z,s.self.RULES)){let N=z.$ref;if(z=Cf.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,N),z instanceof Cf.SchemaEnv&&(z=z.schema),z===void 0)throw new Q0.default(s.opts.uriResolver,s.baseId,N)}let V=(f=z?.properties)===null||f===void 0?void 0:f[a];if(typeof V!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||v(z)),w(V,S)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function v({required:S}){return Array.isArray(S)&&S.includes(a)}function w(S,z){if(S.const)b(S.const,z);else if(S.enum)for(let V of S.enum)b(V,z);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(S,z){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[S]=z}}}};Sa.default=t$});var Nf=$((xT,r$)=>{r$.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var ka=$((ee,za)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.MissingRefError=ee.ValidationError=ee.CodeGen=ee.Name=ee.nil=ee.stringify=ee.str=ee._=ee.KeywordCxt=ee.Ajv=void 0;var n$=Pp(),o$=Pf(),s$=Rf(),If=Nf(),i$=["/properties"],wo="http://json-schema.org/draft-07/schema",Qt=class extends n$.default{_addVocabularies(){super._addVocabularies(),o$.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(s$.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(If,i$):If;this.addMetaSchema(e,wo,!1),this.refs["http://json-schema.org/schema"]=wo}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(wo)?wo:void 0)}};ee.Ajv=Qt;za.exports=ee=Qt;za.exports.Ajv=Qt;Object.defineProperty(ee,"__esModule",{value:!0});ee.default=Qt;var a$=Dr();Object.defineProperty(ee,"KeywordCxt",{enumerable:!0,get:function(){return a$.KeywordCxt}});var Xt=I();Object.defineProperty(ee,"_",{enumerable:!0,get:function(){return Xt._}});Object.defineProperty(ee,"str",{enumerable:!0,get:function(){return Xt.str}});Object.defineProperty(ee,"stringify",{enumerable:!0,get:function(){return Xt.stringify}});Object.defineProperty(ee,"nil",{enumerable:!0,get:function(){return Xt.nil}});Object.defineProperty(ee,"Name",{enumerable:!0,get:function(){return Xt.Name}});Object.defineProperty(ee,"CodeGen",{enumerable:!0,get:function(){return Xt.CodeGen}});var c$=Qn();Object.defineProperty(ee,"ValidationError",{enumerable:!0,get:function(){return c$.default}});var u$=Lr();Object.defineProperty(ee,"MissingRefError",{enumerable:!0,get:function(){return u$.default}})});var Lf=$(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.formatNames=Qe.fastFormats=Qe.fullFormats=void 0;function Ye(t,e){return{validate:t,compare:e}}Qe.fullFormats={date:Ye(qf,Ca),time:Ye(Ea(!0),Ra),"date-time":Ye(Of(!0),Zf),"iso-time":Ye(Ea(),Af),"iso-date-time":Ye(Of(),Df),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h$,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,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:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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}))|:)))$/i,regex:$$,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:g$,int32:{type:"number",validate:v$},int64:{type:"number",validate:w$},float:{type:"number",validate:Mf},double:{type:"number",validate:Mf},password:!0,binary:!0};Qe.fastFormats={...Qe.fullFormats,date:Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ca),time:Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ra),"date-time":Ye(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Zf),"iso-time":Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Af),"iso-date-time":Ye(/^\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,Df),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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};Qe.formatNames=Object.keys(Qe.fullFormats);function l$(t){return t%4===0&&(t%100!==0||t%400===0)}var d$=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,p$=[0,31,28,31,30,31,30,31,31,30,31,30,31];function qf(t){let e=d$.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&l$(r)?29:p$[n])}function Ca(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Pa=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ea(t){return function(r){let n=Pa.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ra(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function Af(t,e){if(!(t&&e))return;let r=Pa.exec(t),n=Pa.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var Ta=/t|\s/i;function Of(t){let e=Ea(t);return function(n){let o=n.split(Ta);return o.length===2&&qf(o[0])&&e(o[1])}}function Zf(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function Df(t,e){if(!(t&&e))return;let[r,n]=t.split(Ta),[o,s]=e.split(Ta),i=Ca(r,o);if(i!==void 0)return i||Ra(n,s)}var f$=/\/|:/,m$=/^(?:[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;function h$(t){return f$.test(t)&&m$.test(t)}var jf=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function g$(t){return jf.lastIndex=0,jf.test(t)}var y$=-(2**31),_$=2**31-1;function v$(t){return Number.isInteger(t)&&t<=_$&&t>=y$}function w$(t){return Number.isInteger(t)}function Mf(){return!0}var b$=/[^\\]\\Z/;function $$(t){if(b$.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Ff=$(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.formatLimitDefinition=void 0;var x$=ka(),Ve=I(),_t=Ve.operators,bo={formatMaximum:{okStr:"<=",ok:_t.LTE,fail:_t.GT},formatMinimum:{okStr:">=",ok:_t.GTE,fail:_t.LT},formatExclusiveMaximum:{okStr:"<",ok:_t.LT,fail:_t.GTE},formatExclusiveMinimum:{okStr:">",ok:_t.GT,fail:_t.LTE}},S$={message:({keyword:t,schemaCode:e})=>(0,Ve.str)`should be ${bo[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ve._)`{comparison: ${bo[t].okStr}, limit: ${e}}`};er.formatLimitDefinition={keyword:Object.keys(bo),type:"string",schemaType:"string",$data:!0,error:S$,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new x$.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Ve._)`${p}[${c.schemaCode}]`);t.fail$data((0,Ve.or)((0,Ve._)`typeof ${f} != "object"`,(0,Ve._)`${f} instanceof RegExp`,(0,Ve._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,Ve._)`${i.code.formats}${(0,Ve.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,Ve._)`${p}.compare(${r}, ${n}) ${bo[o].fail} 0`}},dependencies:["format"]};var z$=t=>(t.addKeyword(er.formatLimitDefinition),t);er.default=z$});var Hf=$((tn,Bf)=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});var tr=Lf(),k$=Ff(),Na=I(),Uf=new Na.Name("fullFormats"),P$=new Na.Name("fastFormats"),Ia=(t,e={keywords:!0})=>{if(Array.isArray(e))return Vf(t,e,tr.fullFormats,Uf),t;let[r,n]=e.mode==="fast"?[tr.fastFormats,P$]:[tr.fullFormats,Uf],o=e.formats||tr.formatNames;return Vf(t,o,r,n),e.keywords&&(0,k$.default)(t),t};Ia.get=(t,e="full")=>{let n=(e==="fast"?tr.fastFormats:tr.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function Vf(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Na._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}Bf.exports=tn=Ia;Object.defineProperty(tn,"__esModule",{value:!0});tn.default=Ia});var j$=Object.freeze({status:"aborted"});function _(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var M$=Symbol("zod_brand"),Xe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},an={};function Re(t){return t&&Object.assign(an,t),an}var U={};Aa(U,{BIGINT_FORMAT_RANGES:()=>La,Class:()=>Io,NUMBER_FORMAT_RANGES:()=>Lo,aborted:()=>wt,allowsEval:()=>Ao,assert:()=>Om,assertEqual:()=>Cm,assertIs:()=>Nm,assertNever:()=>Im,assertNotEqual:()=>Rm,assignProp:()=>qo,cached:()=>or,captureStackTrace:()=>un,cleanEnum:()=>Jm,cleanRegex:()=>ir,clone:()=>Be,createTransparentProxy:()=>Dm,defineLazy:()=>W,esc:()=>vt,escapeRegex:()=>at,extend:()=>Um,finalizeIssue:()=>Ze,floatSafeRemainder:()=>Mo,getElementAtPath:()=>jm,getEnumValues:()=>Oo,getLengthableOrigin:()=>ar,getParsedType:()=>Zm,getSizableOrigin:()=>Fa,isObject:()=>Nt,isPlainObject:()=>It,issue:()=>Fo,joinValues:()=>cn,jsonStringifyReplacer:()=>jo,merge:()=>Vm,normalizeParams:()=>E,nullish:()=>sr,numKeys:()=>Am,omit:()=>Fm,optionalKeys:()=>Do,partial:()=>Bm,pick:()=>Lm,prefixIssues:()=>He,primitiveTypes:()=>Da,promiseAllObject:()=>Mm,propertyKeyTypes:()=>Zo,randomString:()=>qm,required:()=>Hm,stringifyPrimitive:()=>ln,unwrapMessage:()=>nr});function Cm(t){return t}function Rm(t){return t}function Nm(t){}function Im(t){throw new Error}function Om(t){}function Oo(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function cn(t,e="|"){return t.map(r=>ln(r)).join(e)}function jo(t,e){return typeof e=="bigint"?e.toString():e}function or(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function sr(t){return t==null}function ir(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Mo(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function W(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function qo(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jm(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Mm(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function qm(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function vt(t){return JSON.stringify(t)}var un=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Nt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Ao=or(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function It(t){if(Nt(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(Nt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Am(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Zm=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Zo=new Set(["string","number","symbol"]),Da=new Set(["string","number","bigint","boolean","symbol","undefined"]);function at(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Be(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function E(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Dm(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function ln(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Do(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Lo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},La={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Lm(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return Be(t,{...t._zod.def,shape:r,checks:[]})}function Fm(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return Be(t,{...t._zod.def,shape:r,checks:[]})}function Um(t,e){if(!It(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return qo(this,"shape",n),n},checks:[]};return Be(t,r)}function Vm(t,e){return Be(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return qo(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function Bm(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return Be(e,{...e._zod.def,shape:o,checks:[]})}function Hm(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return Be(e,{...e._zod.def,shape:o,checks:[]})}function wt(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function He(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function nr(t){return typeof t=="string"?t:t?.message}function Ze(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=nr(t.inst?._zod.def?.error?.(t))??nr(e?.error?.(t))??nr(r.customError?.(t))??nr(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Fa(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function ar(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Fo(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Jm(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Io=class{constructor(...e){}};var Ua=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,jo,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},dn=_("$ZodError",Ua),Uo=_("$ZodError",Ua,{Parent:Error});function Va(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Ba(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(t),n}var Ha=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Xe;if(i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>Ze(c,s,Re())));throw un(a,o?.callee),a}return i.value};var Ja=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>Ze(c,s,Re())));throw un(a,o?.callee),a}return i.value};var Vo=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Xe;return s.issues.length?{success:!1,error:new(t??dn)(s.issues.map(i=>Ze(i,o,Re())))}:{success:!0,data:s.value}},cr=Vo(Uo),Bo=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Ze(i,o,Re())))}:{success:!0,data:s.value}},pn=Bo(Uo);var Ka=/^[cC][^\s-]{8,}$/,Wa=/^[0-9a-z]+$/,Ga=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ya=/^[0-9a-vA-V]{20}$/,Qa=/^[A-Za-z0-9]{27}$/,Xa=/^[a-zA-Z0-9_-]{21}$/,ec=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var tc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ho=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var rc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Wm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function nc(){return new RegExp(Wm,"u")}var oc=/^(?:(?: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])$/,sc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,ic=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ac=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jo=/^[A-Za-z0-9_-]*$/,uc=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var lc=/^\+(?:[0-9]){6,14}[0-9]$/,dc="(?:(?:\\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])))",pc=new RegExp(`^${dc}$`);function fc(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function mc(t){return new RegExp(`^${fc(t)}$`)}function hc(t){let e=fc({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${dc}T(?:${n})$`)}var gc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var yc=/^\d+$/,_c=/^-?\d+(?:\.\d+)?/i,vc=/true|false/i,wc=/null/i;var bc=/^[^A-Z]*$/,$c=/^[^a-z]*$/;var he=_("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),xc={number:"number",bigint:"bigint",object:"date"},Wo=_("$ZodCheckLessThan",(t,e)=>{he.init(t,e);let r=xc[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Go=_("$ZodCheckGreaterThan",(t,e)=>{he.init(t,e);let r=xc[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Sc=_("$ZodCheckMultipleOf",(t,e)=>{he.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Mo(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),zc=_("$ZodCheckNumberFormat",(t,e)=>{he.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=Lo[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=o,a.maximum=s,r&&(a.pattern=yc)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:t})}});var kc=_("$ZodCheckMaxLength",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let i=ar(o);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Pc=_("$ZodCheckMinLength",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let i=ar(o);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Ec=_("$ZodCheckLengthEquals",(t,e)=>{var r;he.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!sr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let i=ar(o),a=s>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ur=_("$ZodCheckStringFormat",(t,e)=>{var r,n;he.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Tc=_("$ZodCheckRegex",(t,e)=>{ur.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Cc=_("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=bc),ur.init(t,e)}),Rc=_("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=$c),ur.init(t,e)}),Nc=_("$ZodCheckIncludes",(t,e)=>{he.init(t,e);let r=at(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),Ic=_("$ZodCheckStartsWith",(t,e)=>{he.init(t,e);let r=new RegExp(`^${at(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Oc=_("$ZodCheckEndsWith",(t,e)=>{he.init(t,e);let r=new RegExp(`.*${at(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var jc=_("$ZodCheckOverwrite",(t,e)=>{he.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var fn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
10
|
+
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
|
|
11
|
+
`))}};var qc={major:4,minor:0,patch:0};var G=_("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=qc;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,i,a)=>{let c=wt(s),u;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;let d=s.issues.length,p=l._zod.check(s);if(p instanceof Promise&&a?.async===!1)throw new Xe;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,s.issues.length!==d&&(c||(c=wt(s,d)))});else{if(s.issues.length===d)continue;c||(c=wt(s,d))}}return u?u.then(()=>s):s};t._zod.run=(s,i)=>{let a=t._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new Xe;return a.then(c=>o(c,n,i))}return o(a,n,i)}}t["~standard"]={validate:o=>{try{let s=cr(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return pn(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),hn=_("$ZodString",(t,e)=>{G.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??gc(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Q=_("$ZodStringFormat",(t,e)=>{ur.init(t,e),hn.init(t,e)}),Jc=_("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=tc),Q.init(t,e)}),Kc=_("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ho(n))}else e.pattern??(e.pattern=Ho());Q.init(t,e)}),Wc=_("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=rc),Q.init(t,e)}),Gc=_("$ZodURL",(t,e)=>{Q.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),s=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:uc.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Yc=_("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=nc()),Q.init(t,e)}),Qc=_("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Xa),Q.init(t,e)}),Xc=_("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Ka),Q.init(t,e)}),eu=_("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Wa),Q.init(t,e)}),tu=_("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Ga),Q.init(t,e)}),ru=_("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Ya),Q.init(t,e)}),nu=_("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Qa),Q.init(t,e)}),ou=_("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=hc(e)),Q.init(t,e)}),su=_("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=pc),Q.init(t,e)}),iu=_("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=mc(e)),Q.init(t,e)}),au=_("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=ec),Q.init(t,e)}),cu=_("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=oc),Q.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),uu=_("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=sc),Q.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),lu=_("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=ic),Q.init(t,e)}),du=_("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=ac),Q.init(t,e),t._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function pu(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var fu=_("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=cc),Q.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{pu(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Gm(t){if(!Jo.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return pu(r)}var mu=_("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Jo),Q.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{Gm(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),hu=_("$ZodE164",(t,e)=>{e.pattern??(e.pattern=lc),Q.init(t,e)});function Ym(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var gu=_("$ZodJWT",(t,e)=>{Q.init(t,e),t._zod.check=r=>{Ym(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var Qo=_("$ZodNumber",(t,e)=>{G.init(t,e),t._zod.pattern=t._zod.bag.pattern??_c,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),r}}),yu=_("$ZodNumber",(t,e)=>{zc.init(t,e),Qo.init(t,e)}),_u=_("$ZodBoolean",(t,e)=>{G.init(t,e),t._zod.pattern=vc,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}});var vu=_("$ZodNull",(t,e)=>{G.init(t,e),t._zod.pattern=wc,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}});var wu=_("$ZodUnknown",(t,e)=>{G.init(t,e),t._zod.parse=r=>r}),bu=_("$ZodNever",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Ac(t,e,r){t.issues.length&&e.issues.push(...He(r,t.issues)),e.value[r]=t.value}var $u=_("$ZodArray",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Ac(u,r,i))):Ac(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function mn(t,e,r){t.issues.length&&e.issues.push(...He(r,t.issues)),e.value[r]=t.value}function Zc(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...He(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}var xu=_("$ZodObject",(t,e)=>{G.init(t,e);let r=or(()=>{let d=Object.keys(e.shape);for(let f of d)if(!(e.shape[f]instanceof G))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);let p=Do(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(p)}});W(t._zod,"propValues",()=>{let d=e.shape,p={};for(let f in d){let m=d[f]._zod;if(m.values){p[f]??(p[f]=new Set);for(let h of m.values)p[f].add(h)}}return p});let n=d=>{let p=new fn(["shape","payload","ctx"]),f=r.value,m=w=>{let b=vt(w);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};p.write("const input = payload.value;");let h=Object.create(null),y=0;for(let w of f.keys)h[w]=`key_${y++}`;p.write("const newResult = {}");for(let w of f.keys)if(f.optionalKeys.has(w)){let b=h[w];p.write(`const ${b} = ${m(w)};`);let S=vt(w);p.write(`
|
|
12
|
+
if (${b}.issues.length) {
|
|
13
|
+
if (input[${S}] === undefined) {
|
|
14
|
+
if (${S} in input) {
|
|
15
|
+
newResult[${S}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
payload.issues = payload.issues.concat(
|
|
19
|
+
${b}.issues.map((iss) => ({
|
|
20
|
+
...iss,
|
|
21
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}],
|
|
22
|
+
}))
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
} else if (${b}.value === undefined) {
|
|
26
|
+
if (${S} in input) newResult[${S}] = undefined;
|
|
27
|
+
} else {
|
|
28
|
+
newResult[${S}] = ${b}.value;
|
|
29
|
+
}
|
|
30
|
+
`)}else{let b=h[w];p.write(`const ${b} = ${m(w)};`),p.write(`
|
|
31
|
+
if (${b}.issues.length) payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
|
32
|
+
...iss,
|
|
33
|
+
path: iss.path ? [${vt(w)}, ...iss.path] : [${vt(w)}]
|
|
34
|
+
})));`),p.write(`newResult[${vt(w)}] = ${b}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");let v=p.compile();return(w,b)=>v(d,w,b)},o,s=Nt,i=!an.jitless,c=i&&Ao.value,u=e.catchall,l;t._zod.parse=(d,p)=>{l??(l=r.value);let f=d.value;if(!s(f))return d.issues.push({expected:"object",code:"invalid_type",input:f,inst:t}),d;let m=[];if(i&&c&&p?.async===!1&&p.jitless!==!0)o||(o=n(e.shape)),d=o(d,p);else{d.value={};let b=l.shape;for(let S of l.keys){let z=b[S],V=z._zod.run({value:f[S],issues:[]},p),N=z._zod.optin==="optional"&&z._zod.optout==="optional";V instanceof Promise?m.push(V.then(H=>N?Zc(H,d,S,f):mn(H,d,S))):N?Zc(V,d,S,f):mn(V,d,S)}}if(!u)return m.length?Promise.all(m).then(()=>d):d;let h=[],y=l.keySet,v=u._zod,w=v.def.type;for(let b of Object.keys(f)){if(y.has(b))continue;if(w==="never"){h.push(b);continue}let S=v.run({value:f[b],issues:[]},p);S instanceof Promise?m.push(S.then(z=>mn(z,d,b))):mn(S,d,b)}return h.length&&d.issues.push({code:"unrecognized_keys",keys:h,input:f,inst:t}),m.length?Promise.all(m).then(()=>d):d}});function Dc(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>Ze(s,n,Re())))}),e}var Xo=_("$ZodUnion",(t,e)=>{G.init(t,e),W(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),W(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),W(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),W(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>ir(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>Dc(i,r,t,n)):Dc(s,r,t,n)}}),Su=_("$ZodDiscriminatedUnion",(t,e)=>{Xo.init(t,e);let r=t._zod.parse;W(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=or(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!Nt(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),o)}}),zu=_("$ZodIntersection",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Lc(r,c,u)):Lc(r,s,i)}});function Yo(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(It(t)&&It(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=Yo(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],i=Yo(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Lc(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),wt(t))return t;let n=Yo(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var ku=_("$ZodRecord",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!It(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...He(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...He(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>Ze(u,n,Re())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...He(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...He(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Pu=_("$ZodEnum",(t,e)=>{G.init(t,e);let r=Oo(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>Zo.has(typeof n)).map(n=>typeof n=="string"?at(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return t._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),Eu=_("$ZodLiteral",(t,e)=>{G.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?at(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}});var Tu=_("$ZodTransform",(t,e)=>{G.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Xe;return r.value=o,r}}),Cu=_("$ZodOptional",(t,e)=>{G.init(t,e),t._zod.optin="optional",t._zod.optout="optional",W(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),W(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${ir(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),Ru=_("$ZodNullable",(t,e)=>{G.init(t,e),W(t._zod,"optin",()=>e.innerType._zod.optin),W(t._zod,"optout",()=>e.innerType._zod.optout),W(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${ir(r.source)}|null)$`):void 0}),W(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),Nu=_("$ZodDefault",(t,e)=>{G.init(t,e),t._zod.optin="optional",W(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Fc(s,e)):Fc(o,e)}});function Fc(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Iu=_("$ZodPrefault",(t,e)=>{G.init(t,e),t._zod.optin="optional",W(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Ou=_("$ZodNonOptional",(t,e)=>{G.init(t,e),W(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Uc(s,t)):Uc(o,t)}});function Uc(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var ju=_("$ZodCatch",(t,e)=>{G.init(t,e),t._zod.optin="optional",W(t._zod,"optout",()=>e.innerType._zod.optout),W(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Ze(i,n,Re()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>Ze(s,n,Re()))},input:r.value}),r.issues=[]),r)}});var Mu=_("$ZodPipe",(t,e)=>{G.init(t,e),W(t._zod,"values",()=>e.in._zod.values),W(t._zod,"optin",()=>e.in._zod.optin),W(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Vc(s,e,n)):Vc(o,e,n)}});function Vc(t,e,r){return wt(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var qu=_("$ZodReadonly",(t,e)=>{G.init(t,e),W(t._zod,"propValues",()=>e.innerType._zod.propValues),W(t._zod,"values",()=>e.innerType._zod.values),W(t._zod,"optin",()=>e.innerType._zod.optin),W(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Bc):Bc(o)}});function Bc(t){return t.value=Object.freeze(t.value),t}var Au=_("$ZodCustom",(t,e)=>{he.init(t,e),G.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(s=>Hc(s,r,n,t));Hc(o,r,n,t)}});function Hc(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Fo(o))}}var Qm=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Xm=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${Qm(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${ln(n.values[0])}`:`Invalid option: expected one of ${cn(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${cn(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Zu(){return{localeError:Xm()}}var G$=Symbol("ZodOutput"),Y$=Symbol("ZodInput"),es=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function eh(){return new es}var lr=eh();function Du(t,e){return new t({type:"string",...E(e)})}function Lu(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function ts(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function Fu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function Uu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function Vu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function Bu(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function Hu(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function Ju(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function Ku(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function Wu(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function Gu(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function Yu(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function Qu(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function Xu(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function el(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function tl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function rl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function nl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function ol(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function sl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function il(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function al(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function cl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function ul(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function ll(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function dl(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function pl(t,e){return new t({type:"number",checks:[],...E(e)})}function fl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function ml(t,e){return new t({type:"boolean",...E(e)})}function hl(t,e){return new t({type:"null",...E(e)})}function gl(t){return new t({type:"unknown"})}function yl(t,e){return new t({type:"never",...E(e)})}function gn(t,e){return new Wo({check:"less_than",...E(e),value:t,inclusive:!1})}function dr(t,e){return new Wo({check:"less_than",...E(e),value:t,inclusive:!0})}function yn(t,e){return new Go({check:"greater_than",...E(e),value:t,inclusive:!1})}function pr(t,e){return new Go({check:"greater_than",...E(e),value:t,inclusive:!0})}function _n(t,e){return new Sc({check:"multiple_of",...E(e),value:t})}function vn(t,e){return new kc({check:"max_length",...E(e),maximum:t})}function Ot(t,e){return new Pc({check:"min_length",...E(e),minimum:t})}function wn(t,e){return new Ec({check:"length_equals",...E(e),length:t})}function rs(t,e){return new Tc({check:"string_format",format:"regex",...E(e),pattern:t})}function ns(t){return new Cc({check:"string_format",format:"lowercase",...E(t)})}function os(t){return new Rc({check:"string_format",format:"uppercase",...E(t)})}function ss(t,e){return new Nc({check:"string_format",format:"includes",...E(e),includes:t})}function is(t,e){return new Ic({check:"string_format",format:"starts_with",...E(e),prefix:t})}function as(t,e){return new Oc({check:"string_format",format:"ends_with",...E(e),suffix:t})}function bt(t){return new jc({check:"overwrite",tx:t})}function cs(t){return bt(e=>e.normalize(t))}function us(){return bt(t=>t.trim())}function ls(){return bt(t=>t.toLowerCase())}function ds(){return bt(t=>t.toUpperCase())}function _l(t,e,r){return new t({type:"array",element:e,...E(r)})}function vl(t,e,r){let n=E(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function wl(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function jt(t){return!!t._zod}function ct(t,e){return jt(t)?cr(t,e):t.safeParse(e)}function bn(t){if(!t)return;let e;if(jt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function bl(t){if(jt(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var mr={};Aa(mr,{ZodISODate:()=>xl,ZodISODateTime:()=>$l,ZodISODuration:()=>zl,ZodISOTime:()=>Sl,date:()=>fs,datetime:()=>ps,duration:()=>hs,time:()=>ms});var $l=_("ZodISODateTime",(t,e)=>{ou.init(t,e),te.init(t,e)});function ps(t){return cl($l,t)}var xl=_("ZodISODate",(t,e)=>{su.init(t,e),te.init(t,e)});function fs(t){return ul(xl,t)}var Sl=_("ZodISOTime",(t,e)=>{iu.init(t,e),te.init(t,e)});function ms(t){return ll(Sl,t)}var zl=_("ZodISODuration",(t,e)=>{au.init(t,e),te.init(t,e)});function hs(t){return dl(zl,t)}var kl=(t,e)=>{dn.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Ba(t,r)},flatten:{value:r=>Va(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Rx=_("ZodError",kl),hr=_("ZodError",kl,{Parent:Error});var Pl=Ha(hr),El=Ja(hr),Tl=Vo(hr),Cl=Bo(hr);var se=_("ZodType",(t,e)=>(G.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Be(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>Pl(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Tl(t,r,n),t.parseAsync=async(r,n)=>El(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Cl(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Yh(r,n)),t.superRefine=r=>t.check(Qh(r)),t.overwrite=r=>t.check(bt(r)),t.optional=()=>oe(t),t.nullable=()=>Il(t),t.nullish=()=>oe(Il(t)),t.nonoptional=r=>Vh(t,r),t.array=()=>A(t),t.or=r=>Y([t,r]),t.and=r=>xn(t,r),t.transform=r=>ys(t,Al(r)),t.default=r=>Lh(t,r),t.prefault=r=>Uh(t,r),t.catch=r=>Hh(t,r),t.pipe=r=>ys(t,r),t.readonly=()=>Wh(t),t.describe=r=>{let n=t.clone();return lr.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return lr.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return lr.get(t);let n=t.clone();return lr.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Ol=_("_ZodString",(t,e)=>{hn.init(t,e),se.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(rs(...n)),t.includes=(...n)=>t.check(ss(...n)),t.startsWith=(...n)=>t.check(is(...n)),t.endsWith=(...n)=>t.check(as(...n)),t.min=(...n)=>t.check(Ot(...n)),t.max=(...n)=>t.check(vn(...n)),t.length=(...n)=>t.check(wn(...n)),t.nonempty=(...n)=>t.check(Ot(1,...n)),t.lowercase=n=>t.check(ns(n)),t.uppercase=n=>t.check(os(n)),t.trim=()=>t.check(us()),t.normalize=(...n)=>t.check(cs(...n)),t.toLowerCase=()=>t.check(ls()),t.toUpperCase=()=>t.check(ds())}),uh=_("ZodString",(t,e)=>{hn.init(t,e),Ol.init(t,e),t.email=r=>t.check(Lu(lh,r)),t.url=r=>t.check(Hu(dh,r)),t.jwt=r=>t.check(al(kh,r)),t.emoji=r=>t.check(Ju(ph,r)),t.guid=r=>t.check(ts(Rl,r)),t.uuid=r=>t.check(Fu($n,r)),t.uuidv4=r=>t.check(Uu($n,r)),t.uuidv6=r=>t.check(Vu($n,r)),t.uuidv7=r=>t.check(Bu($n,r)),t.nanoid=r=>t.check(Ku(fh,r)),t.guid=r=>t.check(ts(Rl,r)),t.cuid=r=>t.check(Wu(mh,r)),t.cuid2=r=>t.check(Gu(hh,r)),t.ulid=r=>t.check(Yu(gh,r)),t.base64=r=>t.check(ol(xh,r)),t.base64url=r=>t.check(sl(Sh,r)),t.xid=r=>t.check(Qu(yh,r)),t.ksuid=r=>t.check(Xu(_h,r)),t.ipv4=r=>t.check(el(vh,r)),t.ipv6=r=>t.check(tl(wh,r)),t.cidrv4=r=>t.check(rl(bh,r)),t.cidrv6=r=>t.check(nl($h,r)),t.e164=r=>t.check(il(zh,r)),t.datetime=r=>t.check(ps(r)),t.date=r=>t.check(fs(r)),t.time=r=>t.check(ms(r)),t.duration=r=>t.check(hs(r))});function g(t){return Du(uh,t)}var te=_("ZodStringFormat",(t,e)=>{Q.init(t,e),Ol.init(t,e)}),lh=_("ZodEmail",(t,e)=>{Wc.init(t,e),te.init(t,e)});var Rl=_("ZodGUID",(t,e)=>{Jc.init(t,e),te.init(t,e)});var $n=_("ZodUUID",(t,e)=>{Kc.init(t,e),te.init(t,e)});var dh=_("ZodURL",(t,e)=>{Gc.init(t,e),te.init(t,e)});var ph=_("ZodEmoji",(t,e)=>{Yc.init(t,e),te.init(t,e)});var fh=_("ZodNanoID",(t,e)=>{Qc.init(t,e),te.init(t,e)});var mh=_("ZodCUID",(t,e)=>{Xc.init(t,e),te.init(t,e)});var hh=_("ZodCUID2",(t,e)=>{eu.init(t,e),te.init(t,e)});var gh=_("ZodULID",(t,e)=>{tu.init(t,e),te.init(t,e)});var yh=_("ZodXID",(t,e)=>{ru.init(t,e),te.init(t,e)});var _h=_("ZodKSUID",(t,e)=>{nu.init(t,e),te.init(t,e)});var vh=_("ZodIPv4",(t,e)=>{cu.init(t,e),te.init(t,e)});var wh=_("ZodIPv6",(t,e)=>{uu.init(t,e),te.init(t,e)});var bh=_("ZodCIDRv4",(t,e)=>{lu.init(t,e),te.init(t,e)});var $h=_("ZodCIDRv6",(t,e)=>{du.init(t,e),te.init(t,e)});var xh=_("ZodBase64",(t,e)=>{fu.init(t,e),te.init(t,e)});var Sh=_("ZodBase64URL",(t,e)=>{mu.init(t,e),te.init(t,e)});var zh=_("ZodE164",(t,e)=>{hu.init(t,e),te.init(t,e)});var kh=_("ZodJWT",(t,e)=>{gu.init(t,e),te.init(t,e)});var jl=_("ZodNumber",(t,e)=>{Qo.init(t,e),se.init(t,e),t.gt=(n,o)=>t.check(yn(n,o)),t.gte=(n,o)=>t.check(pr(n,o)),t.min=(n,o)=>t.check(pr(n,o)),t.lt=(n,o)=>t.check(gn(n,o)),t.lte=(n,o)=>t.check(dr(n,o)),t.max=(n,o)=>t.check(dr(n,o)),t.int=n=>t.check(Nl(n)),t.safe=n=>t.check(Nl(n)),t.positive=n=>t.check(yn(0,n)),t.nonnegative=n=>t.check(pr(0,n)),t.negative=n=>t.check(gn(0,n)),t.nonpositive=n=>t.check(dr(0,n)),t.multipleOf=(n,o)=>t.check(_n(n,o)),t.step=(n,o)=>t.check(_n(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function B(t){return pl(jl,t)}var Ph=_("ZodNumberFormat",(t,e)=>{yu.init(t,e),jl.init(t,e)});function Nl(t){return fl(Ph,t)}var Eh=_("ZodBoolean",(t,e)=>{_u.init(t,e),se.init(t,e)});function ce(t){return ml(Eh,t)}var Th=_("ZodNull",(t,e)=>{vu.init(t,e),se.init(t,e)});function _s(t){return hl(Th,t)}var Ch=_("ZodUnknown",(t,e)=>{wu.init(t,e),se.init(t,e)});function re(){return gl(Ch)}var Rh=_("ZodNever",(t,e)=>{bu.init(t,e),se.init(t,e)});function Nh(t){return yl(Rh,t)}var Ih=_("ZodArray",(t,e)=>{$u.init(t,e),se.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Ot(r,n)),t.nonempty=r=>t.check(Ot(1,r)),t.max=(r,n)=>t.check(vn(r,n)),t.length=(r,n)=>t.check(wn(r,n)),t.unwrap=()=>t.element});function A(t,e){return _l(Ih,t,e)}var Ml=_("ZodObject",(t,e)=>{xu.init(t,e),se.init(t,e),U.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>xe(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:re()}),t.loose=()=>t.clone({...t._zod.def,catchall:re()}),t.strict=()=>t.clone({...t._zod.def,catchall:Nh()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>U.extend(t,r),t.merge=r=>U.merge(t,r),t.pick=r=>U.pick(t,r),t.omit=r=>U.omit(t,r),t.partial=(...r)=>U.partial(Zl,t,r[0]),t.required=(...r)=>U.required(Dl,t,r[0])});function x(t,e){let r={type:"object",get shape(){return U.assignProp(this,"shape",{...t}),this.shape},...U.normalizeParams(e)};return new Ml(r)}function we(t,e){return new Ml({type:"object",get shape(){return U.assignProp(this,"shape",{...t}),this.shape},catchall:re(),...U.normalizeParams(e)})}var ql=_("ZodUnion",(t,e)=>{Xo.init(t,e),se.init(t,e),t.options=e.options});function Y(t,e){return new ql({type:"union",options:t,...U.normalizeParams(e)})}var Oh=_("ZodDiscriminatedUnion",(t,e)=>{ql.init(t,e),Su.init(t,e)});function vs(t,e,r){return new Oh({type:"union",options:e,discriminator:t,...U.normalizeParams(r)})}var jh=_("ZodIntersection",(t,e)=>{zu.init(t,e),se.init(t,e)});function xn(t,e){return new jh({type:"intersection",left:t,right:e})}var Mh=_("ZodRecord",(t,e)=>{ku.init(t,e),se.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function ne(t,e,r){return new Mh({type:"record",keyType:t,valueType:e,...U.normalizeParams(r)})}var gs=_("ZodEnum",(t,e)=>{Pu.init(t,e),se.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new gs({...e,checks:[],...U.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new gs({...e,checks:[],...U.normalizeParams(o),entries:s})}});function xe(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new gs({type:"enum",entries:r,...U.normalizeParams(e)})}var qh=_("ZodLiteral",(t,e)=>{Eu.init(t,e),se.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function k(t,e){return new qh({type:"literal",values:Array.isArray(t)?t:[t],...U.normalizeParams(e)})}var Ah=_("ZodTransform",(t,e)=>{Tu.init(t,e),se.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(U.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(U.issue(i))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Al(t){return new Ah({type:"transform",transform:t})}var Zl=_("ZodOptional",(t,e)=>{Cu.init(t,e),se.init(t,e),t.unwrap=()=>t._zod.def.innerType});function oe(t){return new Zl({type:"optional",innerType:t})}var Zh=_("ZodNullable",(t,e)=>{Ru.init(t,e),se.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Il(t){return new Zh({type:"nullable",innerType:t})}var Dh=_("ZodDefault",(t,e)=>{Nu.init(t,e),se.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Lh(t,e){return new Dh({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Fh=_("ZodPrefault",(t,e)=>{Iu.init(t,e),se.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Uh(t,e){return new Fh({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Dl=_("ZodNonOptional",(t,e)=>{Ou.init(t,e),se.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Vh(t,e){return new Dl({type:"nonoptional",innerType:t,...U.normalizeParams(e)})}var Bh=_("ZodCatch",(t,e)=>{ju.init(t,e),se.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Hh(t,e){return new Bh({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Jh=_("ZodPipe",(t,e)=>{Mu.init(t,e),se.init(t,e),t.in=e.in,t.out=e.out});function ys(t,e){return new Jh({type:"pipe",in:t,out:e})}var Kh=_("ZodReadonly",(t,e)=>{qu.init(t,e),se.init(t,e)});function Wh(t){return new Kh({type:"readonly",innerType:t})}var Ll=_("ZodCustom",(t,e)=>{Au.init(t,e),se.init(t,e)});function Gh(t){let e=new he({check:"custom"});return e._zod.check=t,e}function Fl(t,e){return vl(Ll,t??(()=>!0),e)}function Yh(t,e={}){return wl(Ll,t,e)}function Qh(t){let e=Gh(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(U.issue(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(U.issue(o))}},t(r.value,r)));return e}function ws(t,e){return ys(Al(t),e)}Re(Zu());var $s="2025-11-25";var Ul=[$s,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ut="io.modelcontextprotocol/related-task",zn="2.0",ue=Fl(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Vl=Y([g(),B().int()]),Bl=g(),SS=we({ttl:Y([B(),_s()]).optional(),pollInterval:B().optional()}),Xh=x({ttl:B().optional()}),eg=x({taskId:g()}),xs=we({progressToken:Vl.optional(),[ut]:eg.optional()}),Te=x({_meta:xs.optional()}),gr=Te.extend({task:Xh.optional()}),Hl=t=>gr.safeParse(t).success,le=x({method:g(),params:Te.loose().optional()}),Ne=x({_meta:xs.optional()}),Ie=x({method:g(),params:Ne.loose().optional()}),de=we({_meta:xs.optional()}),kn=Y([g(),B().int()]),Jl=x({jsonrpc:k(zn),id:kn,...le.shape}).strict(),Ss=t=>Jl.safeParse(t).success,Kl=x({jsonrpc:k(zn),...Ie.shape}).strict(),Wl=t=>Kl.safeParse(t).success,zs=x({jsonrpc:k(zn),id:kn,result:de}).strict(),yr=t=>zs.safeParse(t).success;var M;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(M||(M={}));var ks=x({jsonrpc:k(zn),id:kn.optional(),error:x({code:B().int(),message:g(),data:re().optional()})}).strict();var Gl=t=>ks.safeParse(t).success;var Yl=Y([Jl,Kl,zs,ks]),zS=Y([zs,ks]),Pn=de.strict(),tg=Ne.extend({requestId:kn.optional(),reason:g().optional()}),En=Ie.extend({method:k("notifications/cancelled"),params:tg}),rg=x({src:g(),mimeType:g().optional(),sizes:A(g()).optional(),theme:xe(["light","dark"]).optional()}),_r=x({icons:A(rg).optional()}),Mt=x({name:g(),title:g().optional()}),Ql=Mt.extend({...Mt.shape,..._r.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),ng=xn(x({applyDefaults:ce().optional()}),ne(g(),re())),og=ws(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,xn(x({form:ng.optional(),url:ue.optional()}),ne(g(),re()).optional())),sg=we({list:ue.optional(),cancel:ue.optional(),requests:we({sampling:we({createMessage:ue.optional()}).optional(),elicitation:we({create:ue.optional()}).optional()}).optional()}),ig=we({list:ue.optional(),cancel:ue.optional(),requests:we({tools:we({call:ue.optional()}).optional()}).optional()}),ag=x({experimental:ne(g(),ue).optional(),sampling:x({context:ue.optional(),tools:ue.optional()}).optional(),elicitation:og.optional(),roots:x({listChanged:ce().optional()}).optional(),tasks:sg.optional()}),cg=Te.extend({protocolVersion:g(),capabilities:ag,clientInfo:Ql}),Ps=le.extend({method:k("initialize"),params:cg});var ug=x({experimental:ne(g(),ue).optional(),logging:ue.optional(),completions:ue.optional(),prompts:x({listChanged:ce().optional()}).optional(),resources:x({subscribe:ce().optional(),listChanged:ce().optional()}).optional(),tools:x({listChanged:ce().optional()}).optional(),tasks:ig.optional()}),lg=de.extend({protocolVersion:g(),capabilities:ug,serverInfo:Ql,instructions:g().optional()}),Es=Ie.extend({method:k("notifications/initialized"),params:Ne.optional()});var Tn=le.extend({method:k("ping"),params:Te.optional()}),dg=x({progress:B(),total:oe(B()),message:oe(g())}),pg=x({...Ne.shape,...dg.shape,progressToken:Vl}),Cn=Ie.extend({method:k("notifications/progress"),params:pg}),fg=Te.extend({cursor:Bl.optional()}),vr=le.extend({params:fg.optional()}),wr=de.extend({nextCursor:Bl.optional()}),mg=xe(["working","input_required","completed","failed","cancelled"]),br=x({taskId:g(),status:mg,ttl:Y([B(),_s()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:oe(B()),statusMessage:oe(g())}),qt=de.extend({task:br}),hg=Ne.merge(br),$r=Ie.extend({method:k("notifications/tasks/status"),params:hg}),Rn=le.extend({method:k("tasks/get"),params:Te.extend({taskId:g()})}),Nn=de.merge(br),In=le.extend({method:k("tasks/result"),params:Te.extend({taskId:g()})}),kS=de.loose(),On=vr.extend({method:k("tasks/list")}),jn=wr.extend({tasks:A(br)}),Mn=le.extend({method:k("tasks/cancel"),params:Te.extend({taskId:g()})}),Xl=de.merge(br),ed=x({uri:g(),mimeType:oe(g()),_meta:ne(g(),re()).optional()}),td=ed.extend({text:g()}),Ts=g().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),rd=ed.extend({blob:Ts}),xr=xe(["user","assistant"]),At=x({audience:A(xr).optional(),priority:B().min(0).max(1).optional(),lastModified:mr.datetime({offset:!0}).optional()}),nd=x({...Mt.shape,..._r.shape,uri:g(),description:oe(g()),mimeType:oe(g()),annotations:At.optional(),_meta:oe(we({}))}),gg=x({...Mt.shape,..._r.shape,uriTemplate:g(),description:oe(g()),mimeType:oe(g()),annotations:At.optional(),_meta:oe(we({}))}),yg=vr.extend({method:k("resources/list")}),_g=wr.extend({resources:A(nd)}),vg=vr.extend({method:k("resources/templates/list")}),wg=wr.extend({resourceTemplates:A(gg)}),Cs=Te.extend({uri:g()}),bg=Cs,$g=le.extend({method:k("resources/read"),params:bg}),xg=de.extend({contents:A(Y([td,rd]))}),Sg=Ie.extend({method:k("notifications/resources/list_changed"),params:Ne.optional()}),zg=Cs,kg=le.extend({method:k("resources/subscribe"),params:zg}),Pg=Cs,Eg=le.extend({method:k("resources/unsubscribe"),params:Pg}),Tg=Ne.extend({uri:g()}),Cg=Ie.extend({method:k("notifications/resources/updated"),params:Tg}),Rg=x({name:g(),description:oe(g()),required:oe(ce())}),Ng=x({...Mt.shape,..._r.shape,description:oe(g()),arguments:oe(A(Rg)),_meta:oe(we({}))}),Ig=vr.extend({method:k("prompts/list")}),Og=wr.extend({prompts:A(Ng)}),jg=Te.extend({name:g(),arguments:ne(g(),g()).optional()}),Mg=le.extend({method:k("prompts/get"),params:jg}),Rs=x({type:k("text"),text:g(),annotations:At.optional(),_meta:ne(g(),re()).optional()}),Ns=x({type:k("image"),data:Ts,mimeType:g(),annotations:At.optional(),_meta:ne(g(),re()).optional()}),Is=x({type:k("audio"),data:Ts,mimeType:g(),annotations:At.optional(),_meta:ne(g(),re()).optional()}),qg=x({type:k("tool_use"),name:g(),id:g(),input:ne(g(),re()),_meta:ne(g(),re()).optional()}),Ag=x({type:k("resource"),resource:Y([td,rd]),annotations:At.optional(),_meta:ne(g(),re()).optional()}),Zg=nd.extend({type:k("resource_link")}),Os=Y([Rs,Ns,Is,Zg,Ag]),Dg=x({role:xr,content:Os}),Lg=de.extend({description:g().optional(),messages:A(Dg)}),Fg=Ie.extend({method:k("notifications/prompts/list_changed"),params:Ne.optional()}),Ug=x({title:g().optional(),readOnlyHint:ce().optional(),destructiveHint:ce().optional(),idempotentHint:ce().optional(),openWorldHint:ce().optional()}),Vg=x({taskSupport:xe(["required","optional","forbidden"]).optional()}),od=x({...Mt.shape,..._r.shape,description:g().optional(),inputSchema:x({type:k("object"),properties:ne(g(),ue).optional(),required:A(g()).optional()}).catchall(re()),outputSchema:x({type:k("object"),properties:ne(g(),ue).optional(),required:A(g()).optional()}).catchall(re()).optional(),annotations:Ug.optional(),execution:Vg.optional(),_meta:ne(g(),re()).optional()}),js=vr.extend({method:k("tools/list")}),Bg=wr.extend({tools:A(od)}),qn=de.extend({content:A(Os).default([]),structuredContent:ne(g(),re()).optional(),isError:ce().optional()}),PS=qn.or(de.extend({toolResult:re()})),Hg=gr.extend({name:g(),arguments:ne(g(),re()).optional()}),Sr=le.extend({method:k("tools/call"),params:Hg}),Jg=Ie.extend({method:k("notifications/tools/list_changed"),params:Ne.optional()}),ES=x({autoRefresh:ce().default(!0),debounceMs:B().int().nonnegative().default(300)}),zr=xe(["debug","info","notice","warning","error","critical","alert","emergency"]),Kg=Te.extend({level:zr}),Ms=le.extend({method:k("logging/setLevel"),params:Kg}),Wg=Ne.extend({level:zr,logger:g().optional(),data:re()}),Gg=Ie.extend({method:k("notifications/message"),params:Wg}),Yg=x({name:g().optional()}),Qg=x({hints:A(Yg).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),Xg=x({mode:xe(["auto","required","none"]).optional()}),ey=x({type:k("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:A(Os).default([]),structuredContent:x({}).loose().optional(),isError:ce().optional(),_meta:ne(g(),re()).optional()}),ty=vs("type",[Rs,Ns,Is]),Sn=vs("type",[Rs,Ns,Is,qg,ey]),ry=x({role:xr,content:Y([Sn,A(Sn)]),_meta:ne(g(),re()).optional()}),ny=gr.extend({messages:A(ry),modelPreferences:Qg.optional(),systemPrompt:g().optional(),includeContext:xe(["none","thisServer","allServers"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:A(g()).optional(),metadata:ue.optional(),tools:A(od).optional(),toolChoice:Xg.optional()}),oy=le.extend({method:k("sampling/createMessage"),params:ny}),qs=de.extend({model:g(),stopReason:oe(xe(["endTurn","stopSequence","maxTokens"]).or(g())),role:xr,content:ty}),As=de.extend({model:g(),stopReason:oe(xe(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:xr,content:Y([Sn,A(Sn)])}),sy=x({type:k("boolean"),title:g().optional(),description:g().optional(),default:ce().optional()}),iy=x({type:k("string"),title:g().optional(),description:g().optional(),minLength:B().optional(),maxLength:B().optional(),format:xe(["email","uri","date","date-time"]).optional(),default:g().optional()}),ay=x({type:xe(["number","integer"]),title:g().optional(),description:g().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),cy=x({type:k("string"),title:g().optional(),description:g().optional(),enum:A(g()),default:g().optional()}),uy=x({type:k("string"),title:g().optional(),description:g().optional(),oneOf:A(x({const:g(),title:g()})),default:g().optional()}),ly=x({type:k("string"),title:g().optional(),description:g().optional(),enum:A(g()),enumNames:A(g()).optional(),default:g().optional()}),dy=Y([cy,uy]),py=x({type:k("array"),title:g().optional(),description:g().optional(),minItems:B().optional(),maxItems:B().optional(),items:x({type:k("string"),enum:A(g())}),default:A(g()).optional()}),fy=x({type:k("array"),title:g().optional(),description:g().optional(),minItems:B().optional(),maxItems:B().optional(),items:x({anyOf:A(x({const:g(),title:g()}))}),default:A(g()).optional()}),my=Y([py,fy]),hy=Y([ly,dy,my]),gy=Y([hy,sy,iy,ay]),yy=gr.extend({mode:k("form").optional(),message:g(),requestedSchema:x({type:k("object"),properties:ne(g(),gy),required:A(g()).optional()})}),_y=gr.extend({mode:k("url"),message:g(),elicitationId:g(),url:g().url()}),vy=Y([yy,_y]),wy=le.extend({method:k("elicitation/create"),params:vy}),by=Ne.extend({elicitationId:g()}),$y=Ie.extend({method:k("notifications/elicitation/complete"),params:by}),An=de.extend({action:xe(["accept","decline","cancel"]),content:ws(t=>t===null?void 0:t,ne(g(),Y([g(),B(),ce(),A(g())])).optional())}),xy=x({type:k("ref/resource"),uri:g()});var Sy=x({type:k("ref/prompt"),name:g()}),zy=Te.extend({ref:Y([Sy,xy]),argument:x({name:g(),value:g()}),context:x({arguments:ne(g(),g()).optional()}).optional()}),ky=le.extend({method:k("completion/complete"),params:zy});var Py=de.extend({completion:we({values:A(g()).max(100),total:oe(B().int()),hasMore:oe(ce())})}),Ey=x({uri:g().startsWith("file://"),name:g().optional(),_meta:ne(g(),re()).optional()}),Ty=le.extend({method:k("roots/list"),params:Te.optional()}),Zs=de.extend({roots:A(Ey)}),Cy=Ie.extend({method:k("notifications/roots/list_changed"),params:Ne.optional()}),TS=Y([Tn,Ps,ky,Ms,Mg,Ig,yg,vg,$g,kg,Eg,Sr,js,Rn,In,On,Mn]),CS=Y([En,Cn,Es,Cy,$r]),RS=Y([Pn,qs,As,An,Zs,Nn,jn,qt]),NS=Y([Tn,oy,wy,Ty,Rn,In,On,Mn]),IS=Y([En,Cn,Gg,Cg,Sg,Jg,Fg,$r,$y]),OS=Y([Pn,lg,Py,Lg,Og,_g,wg,xg,qn,Bg,Nn,jn,qt]),C=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===M.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new bs(o.elicitations,r)}return new t(e,r,n)}},bs=class extends C{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(M.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function lt(t){return t==="completed"||t==="failed"||t==="cancelled"}var Ry=Symbol("Let zodToJsonSchema decide on which parser to use");var fz=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ds(t){let r=bn(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=bl(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ls(t,e){let r=ct(t,e);if(!r.success)throw r.error;return r.data}var qy=6e4,Zn=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(En,r=>{this._oncancel(r)}),this.setNotificationHandler(Cn,r=>{this._onprogress(r)}),this.setRequestHandler(Tn,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Rn,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new C(M.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(In,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new C(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new C(M.InvalidParams,`Task not found: ${s}`);if(!lt(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(lt(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ut]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(On,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new C(M.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Mn,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new C(M.InvalidParams,`Task not found: ${r.params.taskId}`);if(lt(o.status))throw new C(M.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new C(M.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof C?o:new C(M.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),C.fromError(M.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),yr(s)||Gl(s)?this._onresponse(s):Ss(s)?this._onrequest(s,i):Wl(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=C.fromError(M.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,s=e.params?._meta?.[ut]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:M.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Hl(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new C(M.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let m=f.relatedTask?.taskId??s;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:M.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),yr(e))n(e);else{let i=new C(e.error.code,e.error.message,e.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(yr(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),yr(e))o(e);else{let i=C.fromError(e.error.code,e.error.message,e.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(i){yield{type:"error",error:i instanceof C?i:new C(M.InternalError,String(i))}}return}let s;try{let i=await this.request(e,qt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new C(M.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},lt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new C(M.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new C(M.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof C?i:new C(M.InternalError,String(i))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ut]:c}});let m=w=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(w)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let b=w instanceof C?w:new C(M.RequestTimeout,String(w));l(b)};this._responseHandlers.set(p,w=>{if(!n?.signal?.aborted){if(w instanceof Error)return l(w);try{let b=ct(r,w.result);b.success?u(b.data):l(b.error)}catch(b){l(b)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??qy,y=()=>m(C.fromError(M.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let w=b=>{let S=this._responseHandlers.get(p);S?S(b):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage(v,{type:"request",message:f,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(p),l(b)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Nn,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},jn,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Xl,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ut]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ut]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ut]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let n=Ds(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=Ls(e,o);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Ds(e);this._notificationHandlers.set(n,o=>{let s=Ls(e,o);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&Ss(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new C(M.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,s)=>{if(r.aborted){s(new C(M.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new C(M.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new C(M.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=$r.parse({method:"notifications/tasks/status",params:a});await this.notification(c),lt(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new C(M.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(lt(a.status))throw new C(M.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=$r.parse({method:"notifications/tasks/status",params:c});await this.notification(u),lt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function sd(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function id(t,e){let r={...t};for(let n in e){let o=n,s=e[o];if(s===void 0)continue;let i=r[o];sd(i)&&sd(s)?r[o]={...i,...s}:r[o]=s}return r}var Jf=Za(ka(),1),Kf=Za(Hf(),1);function E$(){let t=new Jf.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Kf.default)(t),t}var $o=class{constructor(e){this._ajv=e??E$()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var xo=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function Wf(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Gf(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var So=class extends Zn{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(zr.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new $o,this.setRequestHandler(Ps,n=>this._oninitialize(n)),this.setNotificationHandler(Es,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Ms,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=zr.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new xo(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=id(this._capabilities,e)}setRequestHandler(e,r){let o=bn(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(jt(o)){let a=o;s=a._zod?.def?.value??a.value}else{let a=o;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=ct(Sr,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new C(M.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=ct(qt,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new C(M.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=ct(qn,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new C(M.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Gf(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Wf(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Ul.includes(r)?r:$s,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Pn)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},As,r):this.request({method:"sampling/createMessage",params:e},qs,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},An,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:o},An,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new C(M.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof C?i:new C(M.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Zs,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import Qf from"node:process";var zo=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
35
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),T$(r)}clear(){this._buffer=void 0}};function T$(t){return Yl.parse(JSON.parse(t))}function Yf(t){return JSON.stringify(t)+`
|
|
36
|
+
`}var ko=class{constructor(e=Qf.stdin,r=Qf.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new zo,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=Yf(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};import{chromium as em}from"playwright-core";var Oa=(n=>(n.CDP_CONNECT="cdp-connect",n.PLAYWRIGHT_LAUNCH="playwright-launch",n.CDP_ONLY="cdp-only",n))(Oa||{}),Xf={mode:"playwright-launch",cdpPort:9222,cdpHost:"localhost",url:"http://localhost:5175",timeout:3e4,enableFallback:!0,skipBridgeCheck:!1};var rn=class{browser=null;context=null;page=null;config;connectionMode;hasBridge=!1;constructor(e={}){this.config={...Xf,...e},this.connectionMode=this.config.mode}async connect(){console.error("[CDP] Attempting connection...");let e=this.config.enableFallback?["cdp-connect","playwright-launch"]:[this.connectionMode],r;for(let n of e)try{return console.error(`[CDP] Trying connection mode: ${n}`),n==="cdp-connect"?await this.connectViaCDP():n==="playwright-launch"?await this.launchViaPlaywright():n==="cdp-only"&&await this.connectViaCDPOnly(),this.config.skipBridgeCheck?(this.hasBridge=!1,console.error("[CDP] Bridge check skipped (external site mode)")):await this.checkBridgeAvailability(),console.error(`[CDP] Connected successfully via ${n}`),this.connectionMode=n,{mode:this.connectionMode,success:!0,hasBridge:this.hasBridge}}catch(o){let s=o;if(console.error(`[CDP] Failed to connect via ${n}:`,s.message),console.error("[CDP] Error stack:",s.stack),r=s,await this.cleanup(),!this.config.enableFallback)break}return{mode:this.connectionMode,success:!1,hasBridge:!1,error:r?.message||"All connection modes failed"}}async connectViaCDP(){let e=`http://${this.config.cdpHost}:${this.config.cdpPort}`;console.error(`[CDP] Connecting to existing browser at ${e}...`);let r=3,n=0,o;for(;n<r;)try{this.browser=await em.connectOverCDP(e,{timeout:this.config.timeout});break}catch(i){if(o=i,n++,n<r)console.error(`[CDP] Connection attempt ${n} failed, retrying in 1s...`),await new Promise(a=>setTimeout(a,1e3));else throw new Error(`Failed to connect to CDP endpoint after ${r} attempts. Ensure Chrome/Chromium is running with --remote-debugging-port=${this.config.cdpPort}. Original error: ${o?.message}`)}if(!this.browser)throw new Error("Browser connection failed");let s=this.browser.contexts();if(s.length>0){this.context=s[0];let i=this.context.pages();i.length>0?(this.page=i[0],this.page.url().startsWith(this.config.url)||await this.page.goto(this.config.url,{waitUntil:"domcontentloaded",timeout:this.config.timeout})):(this.page=await this.context.newPage(),await this.page.goto(this.config.url,{waitUntil:"domcontentloaded",timeout:this.config.timeout}))}else this.context=await this.browser.newContext(),this.page=await this.context.newPage(),await this.page.goto(this.config.url,{waitUntil:"domcontentloaded",timeout:this.config.timeout});console.error("[CDP] Connected to existing browser successfully"),this.setupPageErrorHandlers()}setupPageErrorHandlers(){this.page&&(this.page.on("crash",()=>{console.error("[CDP] Page crashed! The browser tab has crashed unexpectedly."),this.page=null}),this.page.on("pageerror",e=>{console.error("[CDP] Page error:",e.message)}),this.browser&&this.browser.on("disconnected",()=>{console.error("[CDP] Browser disconnected. Connection lost."),this.cleanup()}))}async launchViaPlaywright(){console.error("[CDP] Launching new browser via Playwright..."),this.browser=await em.launch({headless:!1,timeout:this.config.timeout,args:["--disable-extensions","--no-first-run","--disable-default-apps"]}),this.context=await this.browser.newContext({viewport:{width:1440,height:900}}),this.page=await this.context.newPage();let e=this.config.url;e&&e!=="about:blank"&&!e.startsWith("about:")&&await this.page.goto(e,{waitUntil:"domcontentloaded",timeout:this.config.timeout}),console.error("[CDP] Browser launched successfully"),this.setupPageErrorHandlers()}async connectViaCDPOnly(){await this.connectViaCDP(),this.hasBridge=!1}async checkBridgeAvailability(){if(!this.page)throw new Error("Page not available. Please ensure the browser is connected before checking bridge availability.");try{await this.page.waitForFunction(()=>window.__VISIONCRAFT__?.ready===!0,{timeout:5e3}),this.hasBridge=!0,console.error("[CDP] VisionCraft bridge detected")}catch{this.hasBridge=!1,console.error("[CDP] VisionCraft bridge not available, using CDP-only mode"),this.connectionMode!=="cdp-only"&&(this.connectionMode="cdp-only")}}async evaluate(e,r){if(!this.page)throw new Error("Not connected to browser. Call connect() first or check if the browser is running.");return await this.page.evaluate(e,r)}async callBridge(e,...r){if(!this.hasBridge)throw new Error("VisionCraft bridge not available in CDP-only mode. Ensure the @visioncraft/vite-plugin is installed and the dev server is running.");return await this.evaluate(n=>{let o=window.__VISIONCRAFT__;if(!o)throw new Error("VisionCraft bridge not available. The bridge script may not have loaded. Check the browser console for errors.");let s=o[n.method];if(typeof s!="function")throw new Error(`Bridge method not found: ${n.method}. Available methods: ${Object.keys(o).filter(i=>typeof o[i]=="function").join(", ")}`);return s.apply(o,n.args)},{method:e,args:r})}async navigate(e){if(!this.page)throw new Error("Not connected to browser. Call connect() first or check if the browser is running.");try{new URL(e)}catch{throw new Error(`Invalid URL format: "${e}". URL must include protocol (e.g., "http://localhost:3000" or "https://example.com")`)}this.config.url=e;try{await this.page.goto(e,{waitUntil:"domcontentloaded",timeout:this.config.timeout})}catch(r){let n=r;throw new Error(`Navigation to "${e}" failed: ${n.message}. Check if the URL is correct and the server is running.`)}await this.checkBridgeAvailability()}async screenshot(e={}){if(!this.page)throw new Error("Not connected to browser");let{format:r="jpeg",quality:n=80,fullPage:o=!0}=e;return await this.page.screenshot({type:r,quality:r==="jpeg"?n:void 0,fullPage:o})}getUrl(){return this.page?.url()||this.config.url}getMode(){return this.connectionMode}hasBridgeAvailable(){return this.hasBridge}isConnected(){return this.page!==null&&!this.page.isClosed()}async cleanup(){try{this.context&&(await this.context.close(),this.context=null),this.browser&&this.connectionMode==="playwright-launch"&&await this.browser.close(),this.browser=null,this.page=null,this.hasBridge=!1}catch(e){console.error("[CDP] Error during cleanup:",e)}}async disconnect(){console.error("[CDP] Disconnecting..."),await this.cleanup(),console.error("[CDP] Disconnected")}};var rr=class{cdpClient;url;connectionResult=null;constructor(e="http://localhost:5175",r={}){this.url=e,this.cdpClient=new rn({url:e,enableFallback:!0,...r})}async connect(){if(console.error("[BrowserClient] Connecting..."),this.connectionResult=await this.cdpClient.connect(),!this.connectionResult.success)throw new Error(`Failed to connect: ${this.connectionResult.error}`);console.error(`[BrowserClient] Connected via ${this.connectionResult.mode} (bridge: ${this.connectionResult.hasBridge?"yes":"no"})`)}async ensureConnected(){this.isConnected()||await this.connect()}async evaluate(e,r){return await this.ensureConnected(),await this.cdpClient.evaluate(e,r)}async callBridge(e,...r){if(await this.ensureConnected(),!this.cdpClient.hasBridgeAvailable())throw new Error(`VisionCraft bridge not available. Make sure the dev server is running and the bridge script loaded. Current mode: ${this.cdpClient.getMode()}`);return await this.cdpClient.callBridge(e,...r)}getUrl(){return this.cdpClient.getUrl()||this.url}setUrl(e){this.url=e,this.cdpClient.disconnect(),this.connectionResult=null}async navigate(e){await this.ensureConnected(),this.url=e,await this.cdpClient.navigate(e)}async disconnect(){await this.cdpClient.disconnect(),this.connectionResult=null}isConnected(){return this.cdpClient.isConnected()}getConnectionMode(){return this.connectionResult?.mode||null}hasBridge(){return this.cdpClient.hasBridgeAvailable()}get page(){return this.cdpClient.page}async screenshot(e={}){return await this.ensureConnected(),await this.cdpClient.screenshot(e)}},nn=null;function Po(t,e){return nn?t&&t!==nn.getUrl()&&nn.setUrl(t):nn=new rr(t,e),nn}var Eo=class{bridgeUrl;_isConnected=!1;_currentUrl="";constructor(e){this.bridgeUrl=e}async connect(){try{let e=new AbortController,r=setTimeout(()=>e.abort(),1e4),n=await fetch(`${this.bridgeUrl}/health`,{signal:e.signal});if(clearTimeout(r),!n.ok)throw new Error(`Bridge health check failed: ${n.status}`);let o=await n.json();console.error(`[WebviewClient] Connected to bridge at port ${o.port}`),this._isConnected=!0}catch(e){throw console.error("[WebviewClient] Failed to connect to bridge:",e),new Error(`Failed to connect to VS Code extension bridge: ${e instanceof Error?e.message:String(e)}`)}}async disconnect(){this._isConnected=!1}isConnected(){return this._isConnected}getUrl(){return this._currentUrl||"about:blank"}async navigate(e){this._currentUrl=e,await this.callBridge("navigate",e)}async callBridge(e,...r){let o;for(let s=0;s<=2;s++)try{let i=new AbortController,a=setTimeout(()=>i.abort(),3e4),c=await fetch(`${this.bridgeUrl}/tools/call`,{method:"POST",signal:i.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"tools/call",params:{name:this.mapMethodToTool(e),arguments:this.mapArgsToToolArgs(e,r)}})});if(clearTimeout(a),!c.ok){let l=c.statusText;try{let d=await c.json();l=d.error?.message||d.error||l}catch{}throw new Error(`HTTP ${c.status}: ${l}`)}let u=await c.json();if(u.error)throw new Error(u.error.message||"Unknown error");return u.result}catch(i){o=i instanceof Error?i:new Error(String(i)),console.error(`[WebviewClient] callBridge(${e}) attempt ${s+1} failed:`,o.message),s<2&&await new Promise(a=>setTimeout(a,500))}throw o||new Error(`callBridge(${e}) failed after 3 attempts`)}mapMethodToTool(e){return{screenshot:"visioncraft_screenshot",elementAtPoint:"visioncraft_element_at_point",batchInspect:"visioncraft_batch_inspect",inspectElement:"visioncraft_inspect_element",getElementSource:"visioncraft_get_source",clickElement:"visioncraft_click",typeText:"visioncraft_type",scrollTo:"visioncraft_scroll",hoverElement:"visioncraft_hover",findElements:"visioncraft_find_elements",getPageStructure:"visioncraft_get_structure",getCSSSource:"visioncraft_get_css_source",setViewport:"visioncraft_set_viewport",getConsoleLogs:"visioncraft_get_console_logs",clearConsoleLogs:"visioncraft_clear_console_logs",getNetworkRequests:"visioncraft_get_network_requests",clearNetworkRequests:"visioncraft_clear_network_requests",getHMRStatus:"visioncraft_get_hmr_status",clearHMRErrors:"visioncraft_clear_hmr_errors",getCurrentUrl:"visioncraft_get_current_url",visualDiff:"visioncraft_visual_diff",navigate:"visioncraft_navigate",getStyleDiff:"visioncraft_style_diff",getComponentTree:"visioncraft_get_component_tree",auditAccessibility:"visioncraft_audit_accessibility",measureElement:"visioncraft_measure_element",measureSpacing:"visioncraft_measure_spacing",getComputedLayout:"visioncraft_get_computed_layout",getPalette:"visioncraft_get_palette",waitForHMR:"visioncraft_wait_for_hmr"}[e]||e}mapArgsToToolArgs(e,r){switch(e){case"screenshot":return{format:r[0]||"jpeg",quality:r[1]||80,selector:r[2],highlight:r[3],highlightColor:r[4]};case"elementAtPoint":return{x:r[0],y:r[1]};case"batchInspect":return{selectors:r[0],region:r[1],includeStyles:r[2]||!1};case"inspectElement":case"getElementSource":case"clickElement":case"hoverElement":return{selector:r[0]};case"typeText":return{selector:r[0],text:r[1]};case"scrollTo":return{x:r[0]||0,y:r[1]||0};case"findElements":return{query:r[0],mode:r[1]||"css",includeSource:r[2]||!1};case"getPageStructure":return{maxDepth:r[0]||5};case"getCSSSource":return{selector:r[0],properties:r[1]};case"setViewport":return{width:r[0],height:r[1],preset:r[2]};case"getStyleDiff":return{selector:r[0],action:r[1],actionArg:r[2],properties:r[3]};case"getComponentTree":return{selector:r[0],maxDepth:r[1]||10,framework:r[2]||"auto"};case"auditAccessibility":return{selector:r[0],tags:r[1]};case"getNetworkRequests":return{filter:r[0],limit:r[1]||50};case"getConsoleLogs":return{level:r[0],limit:r[1]};case"navigate":return{url:r[0]};case"measureElement":return{selectorA:r[0],selectorB:r[1]};case"measureSpacing":return{selector:r[0]};case"getComputedLayout":return{selector:r[0]};case"getPalette":return{selector:r[0],limit:r[1]||20};case"waitForHMR":return{timeout:r[0]||1e4};default:return{}}}};async function ja(t,e){return await t.evaluate(r=>{let n=document.querySelector(r);if(!n)return{error:`Element not found: ${r}`};let o=n.getBoundingClientRect(),s=window.getComputedStyle(n),i={};for(let c=0;c<n.attributes.length;c++){let u=n.attributes[c];i[u.name]=u.value}let a=n.tagName.toLowerCase();if(n.id)a=`#${n.id}`;else if(n.className&&typeof n.className=="string"){let c=n.className.trim().split(/\s+/).slice(0,2).join(".");c&&(a+=`.${c}`)}return{tagName:n.tagName.toLowerCase(),selector:a,sourceFile:null,sourceLine:null,sourceCol:null,boundingBox:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)},computedStyles:{display:s.display,position:s.position,width:s.width,height:s.height,color:s.color,backgroundColor:s.backgroundColor,fontSize:s.fontSize,fontWeight:s.fontWeight,fontFamily:s.fontFamily,fontStyle:s.fontStyle,lineHeight:s.lineHeight,letterSpacing:s.letterSpacing,textAlign:s.textAlign,textTransform:s.textTransform,padding:s.padding,margin:s.margin,border:s.border,zIndex:s.zIndex},innerText:n.innerText?.substring(0,200)||"",innerHTML:n.innerHTML?.substring(0,500)||"",attributes:i}},e)}async function tm(t,e,r){return await t.evaluate(({x:n,y:o})=>{let s=document.elementFromPoint(n,o);if(!s)return{error:`No element found at point (${n}, ${o})`};let i=s.getBoundingClientRect(),a=window.getComputedStyle(s),c=s.tagName.toLowerCase();if(s.id)c=`#${s.id}`;else if(s.className&&typeof s.className=="string"){let u=s.className.trim().split(/\s+/).slice(0,2).join(".");u&&(c+=`.${u}`)}return{tagName:s.tagName.toLowerCase(),selector:c,sourceFile:null,sourceLine:null,sourceCol:null,boundingBox:{x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)},computedStyles:{display:a.display,position:a.position,width:a.width,height:a.height,color:a.color,backgroundColor:a.backgroundColor,fontSize:a.fontSize,fontWeight:a.fontWeight,fontFamily:a.fontFamily,fontStyle:a.fontStyle,lineHeight:a.lineHeight,letterSpacing:a.letterSpacing,textAlign:a.textAlign,textTransform:a.textTransform,padding:a.padding,margin:a.margin,border:a.border,zIndex:a.zIndex},innerText:s.innerText?.substring(0,200)||"",attributes:{}}},{x:e,y:r})}async function rm(t,e,r,n){return await t.evaluate(({selectors:o,region:s,includeStyles:i})=>{let a=[];function c(u){let l=u.getBoundingClientRect(),d=u.tagName.toLowerCase();if(u.id)d=`#${u.id}`;else if(u.className&&typeof u.className=="string"){let f=u.className.trim().split(/\s+/).slice(0,2).join(".");f&&(d+=`.${f}`)}let p={tagName:u.tagName.toLowerCase(),selector:d,sourceFile:null,sourceLine:null,sourceCol:null,boundingBox:{x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height)}};if(i){let f=window.getComputedStyle(u);p.computedStyles={display:f.display,position:f.position,width:f.width,height:f.height,color:f.color,backgroundColor:f.backgroundColor,fontSize:f.fontSize,fontWeight:f.fontWeight,fontFamily:f.fontFamily,fontStyle:f.fontStyle,lineHeight:f.lineHeight,letterSpacing:f.letterSpacing,textAlign:f.textAlign,textTransform:f.textTransform}}return p}if(o)for(let u of o){let l=document.querySelector(u);l?a.push(c(l)):a.push({error:`Element not found: ${u}`})}if(s){let u=document.querySelectorAll("*"),l=0;for(let d=0;d<u.length&&l<50;d++){let p=u[d].getBoundingClientRect();p.right>=s.x&&p.left<=s.x+s.width&&p.bottom>=s.y&&p.top<=s.y+s.height&&p.width>0&&p.height>0&&(a.push(c(u[d])),l++)}}return a},{selectors:e,region:r,includeStyles:n})}async function nm(t,e,r="css",n=!1){return await t.evaluate(({query:o,mode:s})=>{let i=[],a=[];if(s==="css")try{a=Array.from(document.querySelectorAll(o)).slice(0,20)}catch{return[{error:`Invalid CSS selector: ${o}`}]}else if(s==="text"){let c=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT),u;for(;(u=c.nextNode())&&a.length<20;){let l=u;l.innerText&&l.innerText.includes(o)&&l.children.length===0&&a.push(l)}}else if(s==="role"){a=Array.from(document.querySelectorAll(`[role="${o}"]`)).slice(0,20);let c={button:"button",link:"a",heading:"h1,h2,h3,h4,h5,h6",img:"img",navigation:"nav",main:"main",banner:"header",contentinfo:"footer"};if(c[o]&&a.length<20){let u=Array.from(document.querySelectorAll(c[o]));for(let l of u)!a.includes(l)&&a.length<20&&a.push(l)}}for(let c of a){let u=c.getBoundingClientRect(),l=c.tagName.toLowerCase();if(c.id)l=`#${c.id}`;else if(c.className&&typeof c.className=="string"){let d=c.className.trim().split(/\s+/).slice(0,2).join(".");d&&(l+=`.${d}`)}i.push({tagName:c.tagName.toLowerCase(),selector:l,innerText:c.innerText?.substring(0,100)||"",boundingBox:{x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height)},sourceFile:null,sourceLine:null,sourceCol:null})}return i},{query:e,mode:r})}async function om(t,e=5){return await t.evaluate(r=>{function n(o,s){if(s>r)return null;let i=o.tagName.toLowerCase();o.id&&(i=`#${o.id}`);let a={tag:o.tagName.toLowerCase(),selector:i};if(o.id&&(a.id=o.id),o.className&&typeof o.className=="string"){let l=o.className.trim();l&&(a.classes=l)}let c=[],u=Array.from(o.children).slice(0,20);for(let l of u){let d=n(l,s+1);d&&c.push(d)}return c.length>0&&(a.children=c),o.children.length>20&&(a.truncated=`${o.children.length-20} more children`),a}return n(document.documentElement,0)},e)}async function sm(t,e){try{return await t.locator(e).click({timeout:5e3}),{success:!0}}catch(r){return{success:!1,error:r.message}}}async function im(t,e,r){try{return await t.locator(e).fill(r,{timeout:5e3}),{success:!0}}catch(n){return{success:!1,error:n.message}}}async function am(t,e){try{return await t.locator(e).hover({timeout:5e3}),{success:!0}}catch(r){return{success:!1,error:r.message}}}async function cm(t,e,r){return await t.evaluate(({x:n,y:o})=>{window.scrollTo(n,o)},{x:e,y:r}),{success:!0}}async function um(t,e,r){return await t.evaluate(({sel:n,props:o})=>{let s=document.querySelector(n);if(!s)return{error:`Element not found: ${n}`};let i=[];for(let a=0;a<document.styleSheets.length;a++){let c=document.styleSheets[a],u;try{u=c.cssRules}catch{continue}let l=c.href||"inline";for(let d=0;d<u.length;d++){let p=u[d];if(p.selectorText){try{if(!s.matches(p.selectorText))continue}catch{continue}for(let f=0;f<p.style.length;f++){let m=p.style[f];o&&o.length>0&&!o.includes(m)||i.push({property:m,value:p.style.getPropertyValue(m),selector:p.selectorText,file:l,line:null})}}}}return i},{sel:e,props:r})}var C$=["display","visibility","opacity","position","top","right","bottom","left","width","height","min-width","min-height","max-width","max-height","margin","padding","border","color","background-color","background","font-size","font-weight","font-family","line-height","text-decoration","text-align","transform","transition","box-shadow","text-shadow","border-radius","outline","cursor","pointer-events","overflow","z-index","flex","flex-direction","align-items","justify-content","grid-template-columns","grid-template-rows"];async function lm(t,e,r,n,o){let s=o||C$,i=await t.evaluate(({sel:d,props:p})=>{let f=document.querySelector(d);if(!f)return null;let m=window.getComputedStyle(f),h={};for(let v of p)h[v]=m.getPropertyValue(v);let y=f.getBoundingClientRect();return{styles:h,rect:{x:y.x,y:y.y,width:y.width,height:y.height},classes:Array.from(f.classList)}},{sel:e,props:s});if(!i)return{error:`Element not found: ${e}`};switch(r){case"hover":await t.locator(e).hover();break;case"click":await t.locator(e).click();break;case"focus":await t.locator(e).focus();break;case"blur":await t.evaluate(d=>document.querySelector(d)?.blur(),e);break;case"addClass":n&&await t.evaluate(({s:d,c:p})=>document.querySelector(d)?.classList.add(p),{s:e,c:n});break;case"removeClass":n&&await t.evaluate(({s:d,c:p})=>document.querySelector(d)?.classList.remove(p),{s:e,c:n});break;case"toggleClass":n&&await t.evaluate(({s:d,c:p})=>document.querySelector(d)?.classList.toggle(p),{s:e,c:n});break}await t.evaluate(()=>new Promise(d=>requestAnimationFrame(()=>requestAnimationFrame(()=>d()))));let a=await t.evaluate(({sel:d,props:p})=>{let f=document.querySelector(d);if(!f)return null;let m=window.getComputedStyle(f),h={};for(let v of p)h[v]=m.getPropertyValue(v);let y=f.getBoundingClientRect();return{styles:h,rect:{x:y.x,y:y.y,width:y.width,height:y.height},classes:Array.from(f.classList)}},{sel:e,props:s});if(!a)return{error:`Element disappeared after action: ${e}`};let c=[];for(let d of s)i.styles[d]!==a.styles[d]&&c.push({property:d,before:i.styles[d],after:a.styles[d]});let u=a.classes.filter(d=>!i.classes.includes(d)),l=i.classes.filter(d=>!a.classes.includes(d));return{selector:e,action:r,changes:c,boundingBox:{before:i.rect,after:a.rect},classesChanged:u.length>0||l.length>0?{added:u,removed:l}:void 0,note:r==="hover"?"Used real Playwright hover \u2014 CSS :hover pseudo-class was triggered.":void 0}}async function dm(t,e){return{error:"Source file mapping is not available for external websites. Source mapping requires the @visioncraft/vite-plugin to inject data-vc-source attributes during development builds."}}function pm(t,e,r){let n=t;return e&&(n=n.filter(o=>o.level===e)),r&&r>0&&(n=n.slice(-r)),n}function fm(t,e,r){let n=t;if(e){if(e.urlPattern){let o=new RegExp(e.urlPattern);n=n.filter(s=>o.test(s.url))}e.method&&(n=n.filter(o=>o.method===e.method)),e.status!==void 0&&(n=n.filter(o=>o.status===e.status)),e.hasError!==void 0&&(n=e.hasError?n.filter(o=>o.status>=400||o.error):n.filter(o=>o.status<400&&!o.error))}return r&&r>0&&(n=n.slice(-r)),n}function mm(){return{connected:!1,lastUpdate:null,errors:[],updates:[],totalUpdates:0,averageLatency:0,note:"HMR is not available for external websites. HMR requires a Vite dev server."}}function hm(){return{note:"No HMR errors to clear on external websites."}}async function gm(t,e,r=10,n="auto"){return await t.evaluate(({selector:o,maxDepth:s})=>{let i=(o?document.querySelector(o):null)||document.getElementById("root")||document.getElementById("app")||document.getElementById("__next")||document.body;if(!i)return{error:`Root element not found${o?`: ${o}`:""}`};function a(p){let f=[p,...Array.from(p.querySelectorAll("*")).slice(0,50)];for(let m of f){let h=Object.keys(m);if(h.some(y=>y.startsWith("__reactFiber$")||y.startsWith("__reactInternalInstance$")))return"react";if(m.__vue_app__||m.__vue__)return"vue";if(h.some(y=>y.startsWith("__svelte")))return"svelte"}return"unknown"}let c=a(i);function u(p,f){if(f>s)return null;let m={name:p.tagName.toLowerCase(),type:"element"};if(p.id&&(m.id=p.id),p.className&&typeof p.className=="string"){let y=p.className.trim();y&&(m.classes=y)}if(p.children.length===0&&p.innerText){let y=p.innerText.trim();y&&y.length<=100&&(m.text=y)}let h=[];for(let y of Array.from(p.children).slice(0,20)){let v=u(y,f+1);v&&h.push(v)}return h.length>0&&(m.children=h),m}if(c==="react"){let p,f=null,m=Object.keys(i).find(h=>h.startsWith("__reactContainer$"));if(m){let h=i[m];if(h)try{let y=function(w,b){if(!w||b>s)return null;let S=typeof w.type=="function"||typeof w.type=="object",z=w.type?.displayName||w.type?.name||(typeof w.type=="string"?w.type:null),V={};z&&(V.name=z),V.type=S?"component":"element";let N=[],H=w.child;for(;H;){let q=y(H,b+1);q&&N.push(q),H=H.sibling}return N.length>0&&(V.children=N),V};var l=y;let v=h;for(;v.return;)v=v.return;return{framework:"react",tree:y(v,0)}}catch{}}for(let h of Array.from(i.children).slice(0,10))if(p=Object.keys(h).find(y=>y.startsWith("__reactFiber$")||y.startsWith("__reactInternalInstance$")),p){f=h;break}if(p&&f)try{let v=function(w,b){if(!w||b>s)return null;let S=typeof w.type=="function"||typeof w.type=="object",z=w.type?.displayName||w.type?.name||(typeof w.type=="string"?w.type:null),V={};z&&(V.name=z),V.type=S?"component":"element";let N=[],H=w.child;for(;H;){let q=v(H,b+1);q&&N.push(q),H=H.sibling}return N.length>0&&(V.children=N),V};var d=v;let y=f[p];for(;y.return;)y=y.return;return{framework:"react",tree:v(y,0)}}catch{}}return{framework:c!=="unknown"?c:"none",note:"Production builds typically strip framework internals. Showing DOM tree.",tree:u(i,0)}},{selector:e,maxDepth:r})}async function Ma(t,e,r){if(!await t.evaluate(()=>!!window.axe))try{await t.addScriptTag({url:"https://cdnjs.cloudflare.com/ajax/libs/axe-core/4.8.4/axe.min.js"}),await t.waitForFunction(()=>!!window.axe,{timeout:1e4})}catch{return{error:"Could not load axe-core for accessibility audit. The page's Content Security Policy may be blocking external scripts."}}return await t.evaluate(({sel:o,tagList:s})=>{let i=window.axe;if(!i)return{error:"axe-core not available"};let a=o&&document.querySelector(o)||document,c={};return s&&s.length>0&&(c.runOnly={type:"tag",values:s}),i.run(a,c).then(u=>({violations:u.violations.map(l=>({id:l.id,impact:l.impact,description:l.description,help:l.help,helpUrl:l.helpUrl,tags:l.tags,nodes:l.nodes.slice(0,5).map(d=>({html:d.html?.substring(0,200),target:d.target,failureSummary:d.failureSummary}))})),passCount:u.passes?.length||0,incompleteCount:u.incomplete?.length||0,summary:`${u.violations.length} violations, ${u.passes?.length||0} passes, ${u.incomplete?.length||0} incomplete`}))},{sel:e,tagList:r})}async function ym(t,e,r){return await t.evaluate(({selA:n,selB:o})=>{let s=document.querySelector(n),i=document.querySelector(o);if(!s)return{error:`Element not found: ${n}`};if(!i)return{error:`Element not found: ${o}`};let a=s.getBoundingClientRect(),c=i.getBoundingClientRect(),u=c.top-a.bottom,l=a.top-c.bottom,d=c.left-a.right,p=a.left-c.right,f=Math.max(0,Math.max(d,p)),m=Math.max(0,Math.max(u,l)),h=Math.max(0,Math.min(a.right,c.right)-Math.max(a.left,c.left)),y=Math.max(0,Math.min(a.bottom,c.bottom)-Math.max(a.top,c.top)),v=h>0&&y>0;return{elementA:{selector:n,boundingBox:{x:Math.round(a.x),y:Math.round(a.y),width:Math.round(a.width),height:Math.round(a.height)}},elementB:{selector:o,boundingBox:{x:Math.round(c.x),y:Math.round(c.y),width:Math.round(c.width),height:Math.round(c.height)}},distances:{top:Math.round(u),right:Math.round(p),bottom:Math.round(l),left:Math.round(d),horizontal:Math.round(f),vertical:Math.round(m)},overlap:v,overlapArea:v?{width:Math.round(h),height:Math.round(y)}:void 0}},{selA:e,selB:r})}async function _m(t,e){return await t.evaluate(r=>{let n=document.querySelector(r);if(!n)return{error:`Element not found: ${r}`};let o=window.getComputedStyle(n);return{padding:{top:parseFloat(o.paddingTop)||0,right:parseFloat(o.paddingRight)||0,bottom:parseFloat(o.paddingBottom)||0,left:parseFloat(o.paddingLeft)||0},margin:{top:parseFloat(o.marginTop)||0,right:parseFloat(o.marginRight)||0,bottom:parseFloat(o.marginBottom)||0,left:parseFloat(o.marginLeft)||0},borderWidth:{top:parseFloat(o.borderTopWidth)||0,right:parseFloat(o.borderRightWidth)||0,bottom:parseFloat(o.borderBottomWidth)||0,left:parseFloat(o.borderLeftWidth)||0},gap:{row:parseFloat(o.rowGap)||0,column:parseFloat(o.columnGap)||0},boxSizing:o.boxSizing}},e)}async function vm(t,e){return await t.evaluate(r=>{let n=document.querySelector(r);if(!n)return{error:`Element not found: ${r}`};let o=window.getComputedStyle(n),s=[];for(let i=0;i<n.children.length&&i<50;i++){let a=n.children[i],c=a.getBoundingClientRect(),u=a.tagName.toLowerCase();if(a.id)u=`#${a.id}`;else if(a.className&&typeof a.className=="string"){let l=a.className.trim().split(/\s+/).slice(0,2).join(".");l&&(u+=`.${l}`)}s.push({selector:u,width:Math.round(c.width),height:Math.round(c.height)})}return{layout:{display:o.display,flexDirection:o.flexDirection,flexWrap:o.flexWrap,justifyContent:o.justifyContent,alignItems:o.alignItems,alignContent:o.alignContent,gap:o.gap,gridTemplateColumns:o.gridTemplateColumns,gridTemplateRows:o.gridTemplateRows,gridAutoFlow:o.gridAutoFlow,position:o.position,overflow:o.overflow},children:{count:n.children.length,sizes:s}}},e)}async function wm(t,e,r=20){return await t.evaluate(({sel:n,limit:o})=>{let s=n?document.querySelector(n):document.body;if(!s)return{error:`Element not found: ${n}`};let i=new Map;function a(p){let f=p.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(!f)return null;let m=parseInt(f[1]),h=parseInt(f[2]),y=parseInt(f[3]);return"#"+[m,h,y].map(v=>v.toString(16).padStart(2,"0")).join("")}function c(p,f){if(!p||p==="transparent"||p==="rgba(0, 0, 0, 0)")return;let m=a(p);if(!m)return;let h=i.get(m);h?(h.count++,h.properties.includes(f)||h.properties.push(f)):i.set(m,{count:1,properties:[f]})}let u=s.querySelectorAll("*"),l=0;for(let p=0;p<u.length&&p<500;p++){let f=u[p];if(f.offsetWidth===0&&f.offsetHeight===0)continue;l++;let m=window.getComputedStyle(f);c(m.color,"color"),c(m.backgroundColor,"backgroundColor"),c(m.borderColor,"borderColor")}return{colors:Array.from(i.entries()).map(([p,f])=>({hex:p,rgb:p.replace(/^#/,"").match(/.{2}/g).map(m=>parseInt(m,16)).join(", "),count:f.count,properties:f.properties})).sort((p,f)=>f.count-p.count).slice(0,o),totalElements:l}},{sel:e,limit:r})}function bm(){return{updated:!1,note:"HMR waiting only available for local Vite dev servers via webview mode."}}async function $m(t){return t.url()}import*as Co from"fs";var To=null,it=null;async function xm(){if(!To){let t=await import("pixelmatch");To=t.default||t,it=(await import("pngjs")).PNG}}var N$=[{name:"visioncraft_screenshot",description:"Capture a screenshot of the current page. Returns a base64-encoded image data URL. Optionally crop to a specific element and/or highlight elements with colored overlays.",inputSchema:{type:"object",properties:{format:{type:"string",enum:["jpeg","png"],description:"Image format (default: jpeg)",default:"jpeg"},quality:{type:"number",description:"JPEG quality 0-100 (default: 80)",minimum:0,maximum:100,default:80},selector:{type:"string",description:"CSS selector \u2014 crop screenshot to this element's bounding box (+ 10px padding)"},highlight:{type:"array",items:{type:"string"},description:"Array of CSS selectors \u2014 draw colored overlay rectangles on these elements before capture"},highlightColor:{type:"string",description:'Color for highlight overlays (default: "rgba(255, 0, 0, 0.3)")',default:"rgba(255, 0, 0, 0.3)"}},required:[]}},{name:"visioncraft_element_at_point",description:`Identify the element at a specific pixel coordinate on the page. Returns the same detailed information as inspect_element (tag, source location, bounding box, styles, selector). Useful for going from "what's at this pixel?" to source code without needing to guess a CSS selector.`,inputSchema:{type:"object",properties:{x:{type:"number",description:"X coordinate (pixels from left edge of viewport)"},y:{type:"number",description:"Y coordinate (pixels from top edge of viewport)"}},required:["x","y"]}},{name:"visioncraft_inspect_element",description:"Inspect an element and get detailed information including source location, styles, and bounding box. Use CSS selectors to target elements.",inputSchema:{type:"object",properties:{selector:{type:"string",description:'CSS selector for the element to inspect (e.g., "button.primary", "#submit-btn")'}},required:["selector"]}},{name:"visioncraft_get_source",description:"Get the source file location for an element. Returns the file path, line number, and column number where the element is defined in the source code.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the element"}},required:["selector"]}},{name:"visioncraft_click",description:"Click an element on the page. Use CSS selectors to target the element.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the element to click"}},required:["selector"]}},{name:"visioncraft_type",description:"Type text into an input or textarea element. Triggers input and change events.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the input element"},text:{type:"string",description:"Text to type into the element"}},required:["selector","text"]}},{name:"visioncraft_scroll",description:"Scroll the page to specific coordinates.",inputSchema:{type:"object",properties:{x:{type:"number",description:"Horizontal scroll position",default:0},y:{type:"number",description:"Vertical scroll position"}},required:["y"]}},{name:"visioncraft_batch_inspect",description:"Inspect multiple elements at once. Provide an array of CSS selectors and/or a rectangular region to find all source-mapped elements. Reduces multiple serial inspect calls to a single request.",inputSchema:{type:"object",properties:{selectors:{type:"array",items:{type:"string"},description:"Array of CSS selectors to inspect"},region:{type:"object",properties:{x:{type:"number"},y:{type:"number"},width:{type:"number"},height:{type:"number"}},required:["x","y","width","height"],description:"Rectangular region to find all source-mapped elements within"},includeStyles:{type:"boolean",description:"Include computed styles for each element (default: false for lighter payloads)",default:!1}},required:[]}},{name:"visioncraft_hover",description:"Hover over an element to trigger CSS :hover states, tooltips, dropdown menus, and other hover-activated UI. Use CSS selectors to target the element.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the element to hover over"}},required:["selector"]}},{name:"visioncraft_find_elements",description:"Find elements on the page by text content, ARIA role, or CSS selector. Returns an array of matching elements with their selectors and source locations.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query (text content, role name, or CSS selector)"},mode:{type:"string",enum:["text","role","css"],description:'Search mode: "text" for text content, "role" for ARIA role, "css" for CSS selector',default:"css"},includeSource:{type:"boolean",description:"When true, also return file line/col for each element (eliminates follow-up get_source calls)",default:!1}},required:["query"]}},{name:"visioncraft_get_structure",description:"Get the page structure as a tree of elements with source mapping information. Useful for understanding the DOM hierarchy.",inputSchema:{type:"object",properties:{maxDepth:{type:"number",description:"Maximum depth to traverse (default: 5)",default:5,minimum:1,maximum:10}},required:[]}},{name:"visioncraft_get_css_source",description:"Trace which CSS rules apply to an element. Returns matched CSS rules with their selectors and source files. Useful for understanding where styles come from.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the element to trace styles for"},properties:{type:"array",items:{type:"string"},description:'Specific CSS properties to trace (default: all matched rules). E.g., ["font-size", "color", "background-color"]'}},required:["selector"]}},{name:"visioncraft_set_viewport",description:"Set the viewport size for responsive design testing. Use presets for common device sizes or specify custom dimensions.",inputSchema:{type:"object",properties:{width:{type:"number",description:"Viewport width in pixels"},height:{type:"number",description:"Viewport height in pixels"},deviceScaleFactor:{type:"number",description:"Device scale factor (default: 1)",default:1},preset:{type:"string",enum:["mobile","mobile_landscape","tablet","tablet_landscape","desktop","desktop_hd"],description:"Device preset: mobile (375x812), mobile_landscape (812x375), tablet (768x1024), tablet_landscape (1024x768), desktop (1440x900), desktop_hd (1920x1080). Overrides width/height if provided."}},required:[]}},{name:"visioncraft_get_console_logs",description:"Get captured console logs from the page. Can filter by level (log, warn, error, info) and limit the number of results.",inputSchema:{type:"object",properties:{level:{type:"string",enum:["log","warn","error","info"],description:"Filter by log level (optional)"},limit:{type:"number",description:"Maximum number of logs to return (default: all)",minimum:1}},required:[]}},{name:"visioncraft_clear_console_logs",description:"Clear all captured console logs.",inputSchema:{type:"object",properties:{},required:[]}},{name:"visioncraft_get_network_requests",description:"Get captured network requests (fetch and XHR). Useful for debugging API calls, seeing failed requests, and understanding data flow.",inputSchema:{type:"object",properties:{filter:{type:"object",properties:{urlPattern:{type:"string",description:"Regex pattern to match URLs"},method:{type:"string",description:"HTTP method (GET, POST, etc.)"},status:{type:"number",description:"Filter by exact status code"},hasError:{type:"boolean",description:"Filter for errored requests (status >= 400 or network error)"}},description:"Filter criteria for network requests"},limit:{type:"number",description:"Maximum number of requests to return (default: 50)",default:50}},required:[]}},{name:"visioncraft_clear_network_requests",description:"Clear all captured network requests.",inputSchema:{type:"object",properties:{},required:[]}},{name:"visioncraft_get_hmr_status",description:"Get the Hot Module Replacement (HMR) status, including connection state, recent errors, update history, and average latency.",inputSchema:{type:"object",properties:{},required:[]}},{name:"visioncraft_clear_hmr_errors",description:"Clear all captured HMR errors. Useful after fixing issues to reset error state.",inputSchema:{type:"object",properties:{},required:[]}},{name:"visioncraft_visual_diff",description:"Compare the current page to the last screenshot taken. Highlights changed pixels and returns a diff image plus summary statistics. Call visioncraft_screenshot first to establish a baseline, then make changes and call this to see what changed.",inputSchema:{type:"object",properties:{threshold:{type:"number",description:"Pixel difference threshold 0-255. Lower = more sensitive (default: 30)",default:30,minimum:0,maximum:255},selector:{type:"string",description:"CSS selector to scope the diff to a specific element. When provided, both baseline and current screenshots are cropped to the element bounding box before comparison."}},required:[]}},{name:"visioncraft_navigate",description:"Navigate to a different URL in the browser.",inputSchema:{type:"object",properties:{url:{type:"string",description:'URL to navigate to (e.g., "http://localhost:3000")'}},required:["url"]}},{name:"visioncraft_get_current_url",description:"Get the current URL of the browser.",inputSchema:{type:"object",properties:{},required:[]}},{name:"visioncraft_style_diff",description:"Capture computed styles before and after an action (hover, click, focus, addClass, etc.) and return only the changed properties. Useful for debugging CSS transitions and interactive states. Note: JS mouseenter/mouseover events do NOT trigger CSS :hover pseudo-class \u2014 use addClass/toggleClass for reliable style comparison, or use Playwright mode for real cursor hover.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the element to observe"},action:{type:"string",enum:["hover","click","focus","blur","addClass","removeClass","toggleClass"],description:"Action to perform between style captures"},actionArg:{type:"string",description:"Class name for addClass/removeClass/toggleClass actions"},properties:{type:"array",items:{type:"string"},description:"Specific CSS properties to watch (default: ~40 common properties)"}},required:["selector","action"]}},{name:"visioncraft_get_component_tree",description:"Show the React, Vue, or Svelte component hierarchy with component names, props, and state. Walks framework-specific internals (React Fiber, Vue instance tree) to provide a developer-friendly view instead of raw DOM.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the root element (default: #root or #app or body)"},maxDepth:{type:"number",description:"Maximum depth to traverse (default: 10)",default:10,minimum:1,maximum:50},framework:{type:"string",enum:["auto","react","vue","svelte"],description:"Framework to use for introspection (default: auto-detect)",default:"auto"}},required:[]}},{name:"visioncraft_audit_accessibility",description:"Run a WCAG accessibility audit using axe-core (same engine as Chrome DevTools Lighthouse). Returns violations with impact level, description, help URL, and affected elements.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector to scope the audit to a specific subtree (default: entire page)"},tags:{type:"array",items:{type:"string"},description:"WCAG tags to check. Options: wcag2a, wcag2aa, wcag21a, wcag21aa, best-practice (default: all)"}},required:[]}},{name:"visioncraft_measure_element",description:"Measure the distance between two elements. Returns gap distances (top, right, bottom, left, horizontal, vertical) and overlap detection. Replaces manual bounding-box math from two inspect_element calls.",inputSchema:{type:"object",properties:{selectorA:{type:"string",description:"CSS selector for the first element"},selectorB:{type:"string",description:"CSS selector for the second element"}},required:["selectorA","selectorB"]}},{name:"visioncraft_measure_spacing",description:"Get the padding, margin, border-width, and gap of an element as clean numeric pixel values. More precise than get_css_source which returns shorthand CSS text.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the element"}},required:["selector"]}},{name:"visioncraft_get_computed_layout",description:"Get flex/grid layout properties and children sizes for a container element. Returns display, flexDirection, justifyContent, alignItems, gap, gridTemplateColumns, and child element dimensions.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector for the container element"}},required:["selector"]}},{name:"visioncraft_diff_against_reference",description:"Compare the current page (or a specific element) against a reference PNG image file. Returns similarity percentage, changed pixel count, and a visual diff image. Use this to compare rendered output against a design mockup or Figma export.",inputSchema:{type:"object",properties:{referencePath:{type:"string",description:"Absolute path to the reference PNG image file"},selector:{type:"string",description:"CSS selector to crop the current screenshot to before comparison"},tolerance:{type:"number",description:"Pixel difference threshold 0-255. Lower = more sensitive (default: 30)",default:30,minimum:0,maximum:255}},required:["referencePath"]}},{name:"visioncraft_get_palette",description:"Extract the color palette from the page or a specific element. Returns colors sorted by frequency with hex values, RGB, occurrence count, and which CSS properties use each color.",inputSchema:{type:"object",properties:{selector:{type:"string",description:"CSS selector to scope palette extraction (default: entire page)"},limit:{type:"number",description:"Maximum number of colors to return (default: 20)",default:20}},required:[]}},{name:"visioncraft_snapshot",description:"Capture a screenshot, inspect elements, and optionally run accessibility audit in a single call. Replaces 4-6 individual tool calls with one request. Returns screenshot image, element inspection results, and optional audit.",inputSchema:{type:"object",properties:{selectors:{type:"array",items:{type:"string"},description:"CSS selectors of elements to inspect alongside the screenshot"},screenshot:{type:"boolean",description:"Whether to capture a screenshot (default: true)",default:!0},audit:{type:"boolean",description:"Whether to run accessibility audit (default: false)",default:!1}},required:[]}},{name:"visioncraft_wait_for_hmr",description:"Wait for a Hot Module Replacement update to complete before taking screenshots or inspecting elements. Polls HMR status until a new update is detected or timeout is reached.",inputSchema:{type:"object",properties:{timeout:{type:"number",description:"Maximum wait time in milliseconds (default: 10000)",default:1e4}},required:[]}}],qa=class{server;isWebviewMode;webviewClient=null;lastScreenshotBuffer=null;currentMode="webview";browserClient=null;browserListenersAttached=!1;consoleLogs=[];networkRequests=[];constructor(){if(this.server=new So({name:"visioncraft-mcp-server",version:"1.0.0"},{capabilities:{tools:{}}}),this.isWebviewMode=process.env.VISIONCRAFT_WEBVIEW_ENABLED==="true",this.isWebviewMode){let e=process.env.VISIONCRAFT_BRIDGE_URL;e?(console.error(`[MCP] Running in webview mode with bridge at ${e}`),this.webviewClient=new Eo(e),this.currentMode="webview",this.webviewClient.connect().catch(r=>{console.error("[MCP] Initial bridge health check failed (will retry on first tool call):",r instanceof Error?r.message:String(r))})):(console.error("[MCP] VISIONCRAFT_WEBVIEW_ENABLED is true but VISIONCRAFT_BRIDGE_URL is not set"),this.isWebviewMode=!1,this.currentMode="browser")}else console.error("[MCP] Running in external browser mode (Playwright)"),this.currentMode="browser";this.setupHandlers(),this.setupErrorHandling()}getClient(e){return this.currentMode==="webview"&&this.webviewClient?this.webviewClient:Po(e)}isLocalUrl(e){try{let n=new URL(e).hostname;return n==="localhost"||n==="127.0.0.1"||n==="0.0.0.0"||n==="::1"||n==="[::1]"||n.endsWith(".localhost")}catch{return!1}}async ensureBrowserClient(){return this.browserClient||(this.browserClient=new rr("about:blank",{mode:"playwright-launch",enableFallback:!1,skipBridgeCheck:!0})),await this.browserClient.ensureConnected(),this.setupPlaywrightListeners(),this.browserClient}getPlaywrightPage(){let e=this.browserClient?.page;if(!e)throw new Error("Browser not connected. Call visioncraft_navigate with an external URL first.");return e}setupPlaywrightListeners(){if(this.browserListenersAttached)return;let e=this.browserClient?.page;if(!e)return;this.browserListenersAttached=!0,e.on("console",n=>{this.consoleLogs.push({level:n.type()==="warning"?"warn":n.type(),message:n.text(),timestamp:Date.now()}),this.consoleLogs.length>200&&this.consoleLogs.shift()});let r=new Map;e.on("request",n=>{let o=n.url()+"|"+n.method();r.set(o,{url:n.url(),method:n.method(),timestamp:Date.now()})}),e.on("response",n=>{let o=n.url()+"|"+n.request().method(),s=r.get(o);s&&(this.networkRequests.push({url:s.url,method:s.method,status:n.status(),duration:Date.now()-s.timestamp,timestamp:s.timestamp}),r.delete(o),this.networkRequests.length>200&&this.networkRequests.shift())}),e.on("requestfailed",n=>{let o=n.url()+"|"+n.method(),s=r.get(o);s&&(this.networkRequests.push({url:s.url,method:s.method,status:0,duration:Date.now()-s.timestamp,timestamp:s.timestamp,error:n.failure()?.errorText||"Network error"}),r.delete(o))}),console.error("[MCP] Playwright event listeners attached for console/network capture")}async tryWebviewWithFallback(e,r){try{return await e()}catch(n){console.error("[MCP] Webview bridge call failed, falling back to Playwright:",n instanceof Error?n.message:String(n));let s=(await this.ensureBrowserClient()).page;if(!s)throw new Error("Fallback failed: no Playwright page available. Original error: "+(n instanceof Error?n.message:String(n)));return await r(s)}}setupErrorHandling(){this.server.onerror=e=>{console.error("[MCP Error]",e)},process.on("SIGINT",async()=>{if(console.error("[MCP] Shutting down..."),this.webviewClient?.isConnected()&&await this.webviewClient.disconnect(),this.browserClient?.isConnected())await this.browserClient.disconnect();else{let e=Po();e.isConnected()&&await e.disconnect()}process.exit(0)})}setupHandlers(){this.server.setRequestHandler(js,async()=>({tools:N$})),this.server.setRequestHandler(Sr,async e=>{let{name:r,arguments:n}=e.params;try{if(this.currentMode==="webview"&&this.webviewClient&&!this.webviewClient.isConnected())try{await this.webviewClient.connect()}catch{}let o=this.getClient(n?.url);switch(r){case"visioncraft_screenshot":{let s=n?.format||"jpeg",i=n?.quality||80,a=n?.selector,c=n?.highlight,u=n?.highlightColor||"rgba(255, 0, 0, 0.3)";if(this.currentMode==="webview"&&this.webviewClient){let l=await o.callBridge("screenshot",s,i,a,c,u);if(typeof l!="string")throw new Error(`Expected string data URL, got ${typeof l}: ${JSON.stringify(l)}`);let d=l.match(/^data:image\/\w+;base64,(.+)$/),p=d?d[1]:l;if(s==="png")this.lastScreenshotBuffer=Buffer.from(p,"base64");else try{let f=await o.callBridge("screenshot","png",100),m=f.match(/^data:image\/\w+;base64,(.+)$/);this.lastScreenshotBuffer=Buffer.from(m?m[1]:f,"base64")}catch{this.lastScreenshotBuffer=Buffer.from(p,"base64")}return{content:[{type:"text",text:`Screenshot captured successfully (${s}, quality: ${i})`},{type:"image",data:p,mimeType:`image/${s}`}]}}else{let l=this.getPlaywrightPage();c&&c.length>0&&await l.evaluate(({selectors:f,color:m})=>{for(let h of f)document.querySelectorAll(h).forEach(y=>{let v=y.getBoundingClientRect(),w=document.createElement("div");w.style.cssText=`position:absolute;left:${v.left+window.scrollX}px;top:${v.top+window.scrollY}px;width:${v.width}px;height:${v.height}px;background:${m};pointer-events:none;z-index:999999;`,w.setAttribute("data-vc-highlight","true"),document.body.appendChild(w)})},{selectors:c,color:u});let d;a?d=await l.locator(a).screenshot({type:s,quality:s==="jpeg"?i:void 0}):d=await l.screenshot({type:s,quality:s==="jpeg"?i:void 0,fullPage:!0}),c&&c.length>0&&await l.evaluate(()=>{document.querySelectorAll("[data-vc-highlight]").forEach(f=>f.remove())}),s==="png"?this.lastScreenshotBuffer=d:this.lastScreenshotBuffer=await l.screenshot({type:"png",fullPage:!0});let p=d.toString("base64");return{content:[{type:"text",text:`Screenshot captured successfully (${s}, quality: ${i})`},{type:"image",data:p,mimeType:`image/${s}`}]}}}case"visioncraft_element_at_point":{let s=n?.x,i=n?.y;if(this.currentMode==="browser"){let c=await tm(this.getPlaywrightPage(),s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("elementAtPoint",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_inspect_element":{let s=n?.selector;if(this.currentMode==="browser"){let a=await ja(this.getPlaywrightPage(),s);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}let i=await o.callBridge("inspectElement",s);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}case"visioncraft_get_source":{let s=n?.selector;if(this.currentMode==="browser"){let a=await dm(this.getPlaywrightPage(),s);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}let i=await o.callBridge("getElementSource",s);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}case"visioncraft_click":{let s=n?.selector;if(this.currentMode==="browser"){let a=await sm(this.getPlaywrightPage(),s);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}let i=await o.callBridge("clickElement",s);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}case"visioncraft_type":{let s=n?.selector,i=n?.text;if(this.currentMode==="browser"){let c=await im(this.getPlaywrightPage(),s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("typeText",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_scroll":{let s=n?.x||0,i=n?.y;if(this.currentMode==="browser"){let c=await cm(this.getPlaywrightPage(),s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("scrollTo",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_batch_inspect":{let s=n?.selectors,i=n?.region,a=n?.includeStyles||!1;if(this.currentMode==="browser"){let u=await rm(this.getPlaywrightPage(),s,i,a);return{content:[{type:"text",text:JSON.stringify(u,null,2)}]}}let c=await o.callBridge("batchInspect",s,i,a);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}case"visioncraft_hover":{let s=n?.selector;if(this.currentMode==="browser"){let a=await am(this.getPlaywrightPage(),s);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}let i=await o.callBridge("hoverElement",s);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}case"visioncraft_find_elements":{let s=n?.query,i=n?.mode||"css",a=n?.includeSource||!1;if(this.currentMode==="browser"){let u=await nm(this.getPlaywrightPage(),s,i,a);return{content:[{type:"text",text:JSON.stringify(u,null,2)}]}}let c=await o.callBridge("findElements",s,i,a);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}case"visioncraft_get_structure":{let s=n?.maxDepth||5;if(this.currentMode==="browser"){let a=await om(this.getPlaywrightPage(),s);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}let i=await o.callBridge("getPageStructure",s);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}case"visioncraft_get_css_source":{let s=n?.selector,i=n?.properties;if(this.currentMode==="browser"){let c=await um(this.getPlaywrightPage(),s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("getCSSSource",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_set_viewport":{let s={mobile:{width:375,height:812},mobile_landscape:{width:812,height:375},tablet:{width:768,height:1024},tablet_landscape:{width:1024,height:768},desktop:{width:1440,height:900},desktop_hd:{width:1920,height:1080}},i=n?.width,a=n?.height,c=n?.preset,u=n?.deviceScaleFactor||1;if(c&&s[c]&&(i=s[c].width,a=s[c].height),!i||!a)throw new Error("Either preset or width+height must be provided");if(this.currentMode==="webview"&&this.webviewClient){let l=await o.callBridge("setViewport",i,a);return{content:[{type:"text",text:`Viewport set to ${i}x${a} (scale: ${u})`}]}}else return await this.getPlaywrightPage().setViewportSize({width:i,height:a}),{content:[{type:"text",text:`Viewport set to ${i}x${a} (scale: ${u})`}]}}case"visioncraft_get_console_logs":{let s=n?.level,i=n?.limit;if(this.currentMode==="browser"){let c=pm(this.consoleLogs,s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("getConsoleLogs",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_clear_console_logs":return this.currentMode==="browser"?(this.consoleLogs=[],{content:[{type:"text",text:"Console logs cleared"}]}):(await o.callBridge("clearConsoleLogs"),{content:[{type:"text",text:"Console logs cleared"}]});case"visioncraft_get_network_requests":{let s=n?.filter,i=n?.limit||50;if(this.currentMode==="browser"){let c=fm(this.networkRequests,s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("getNetworkRequests",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_clear_network_requests":return this.currentMode==="browser"?(this.networkRequests=[],{content:[{type:"text",text:"Network requests cleared"}]}):(await o.callBridge("clearNetworkRequests"),{content:[{type:"text",text:"Network requests cleared"}]});case"visioncraft_get_hmr_status":{if(this.currentMode==="browser"){let i=mm();return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}let s=await o.callBridge("getHMRStatus");return{content:[{type:"text",text:JSON.stringify(s,null,2)}]}}case"visioncraft_clear_hmr_errors":{if(this.currentMode==="browser"){let s=hm();return{content:[{type:"text",text:JSON.stringify(s,null,2)}]}}return await o.callBridge("clearHMRErrors"),{content:[{type:"text",text:"HMR errors cleared"}]}}case"visioncraft_visual_diff":{if(!this.lastScreenshotBuffer)throw new Error("No previous screenshot to compare. Call visioncraft_screenshot first to establish a baseline.");let s=n?.threshold||30,i=n?.selector,a;if(i)if(this.currentMode==="webview"&&this.webviewClient){let N=await o.callBridge("screenshot","png",100,i),H=N.match(/^data:image\/\w+;base64,(.+)$/),q=H?H[1]:N;a=Buffer.from(q,"base64")}else a=await this.getPlaywrightPage().locator(i).screenshot({type:"png"});else if(this.currentMode==="webview"&&this.webviewClient){let N=await o.callBridge("screenshot","png",100),H=N.match(/^data:image\/\w+;base64,(.+)$/),q=H?H[1]:N;a=Buffer.from(q,"base64")}else a=await this.getPlaywrightPage().screenshot({type:"png",fullPage:!0});await xm();let c=it.sync.read(this.lastScreenshotBuffer),u=it.sync.read(a),l=Math.max(c.width,u.width),d=Math.max(c.height,u.height),p=(N,H,q)=>{if(N.width===H&&N.height===q)return N.data;let ie=Buffer.alloc(H*q*4,0);for(let ve=0;ve<N.height;ve++)for(let Ee=0;Ee<N.width;Ee++){let Ce=(ve*N.width+Ee)*4,Ae=(ve*H+Ee)*4;ie[Ae]=N.data[Ce],ie[Ae+1]=N.data[Ce+1],ie[Ae+2]=N.data[Ce+2],ie[Ae+3]=N.data[Ce+3]}return ie},f=p(c,l,d),m=p(u,l,d),h=Buffer.alloc(l*d*4),y=To(f,m,h,l,d,{threshold:s/255}),v=l*d,w=(y/v*100).toFixed(2),b=parseFloat((100-parseFloat(w)).toFixed(2)),S=new it({width:l,height:d});S.data=h;let V=it.sync.write(S).toString("base64");return{content:[{type:"text",text:JSON.stringify({changedPixels:y,totalPixels:v,changedPercent:parseFloat(w),similarityPercent:b,dimensions:{width:l,height:d}},null,2)},{type:"image",data:V,mimeType:"image/png"}]}}case"visioncraft_navigate":{let s=n?.url,i=this.currentMode;if(this.isLocalUrl(s)&&this.webviewClient)try{return await this.webviewClient.callBridge("navigate",s),this.currentMode="webview",{content:[{type:"text",text:`Navigated to ${s}`}]}}catch(a){throw this.currentMode=i,a}else try{return await(await this.ensureBrowserClient()).navigate(s),this.currentMode="browser",this.consoleLogs=[],this.networkRequests=[],{content:[{type:"text",text:`Navigated to ${s} (browser mode)`}]}}catch(a){throw this.currentMode=i,a}}case"visioncraft_get_current_url":{if(this.currentMode==="browser")return{content:[{type:"text",text:await $m(this.getPlaywrightPage())}]};let s;try{s=await o.callBridge("getCurrentUrl"),(typeof s!="string"||!s)&&(s=o.getUrl())}catch{s=o.getUrl()}return{content:[{type:"text",text:s}]}}case"visioncraft_style_diff":{let s=n?.selector,i=n?.action,a=n?.actionArg,c=n?.properties;if(this.currentMode==="browser"){let l=await lm(this.getPlaywrightPage(),s,i,a,c);return{content:[{type:"text",text:JSON.stringify(l,null,2)}]}}let u=await o.callBridge("getStyleDiff",s,i,a,c);return{content:[{type:"text",text:JSON.stringify(u,null,2)}]}}case"visioncraft_get_component_tree":{let s=n?.selector,i=n?.maxDepth||10,a=n?.framework||"auto";if(this.currentMode==="browser"){let u=await gm(this.getPlaywrightPage(),s,i,a);return{content:[{type:"text",text:JSON.stringify(u,null,2)}]}}let c=await o.callBridge("getComponentTree",s,i,a);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}case"visioncraft_audit_accessibility":{let s=n?.selector,i=n?.tags;if(this.currentMode==="browser"){let c=await Ma(this.getPlaywrightPage(),s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("auditAccessibility",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_measure_element":{let s=n?.selectorA,i=n?.selectorB;if(this.currentMode==="browser"){let c=await ym(this.getPlaywrightPage(),s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("measureElement",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_measure_spacing":{let s=n?.selector;if(this.currentMode==="browser"){let a=await _m(this.getPlaywrightPage(),s);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}let i=await o.callBridge("measureSpacing",s);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}case"visioncraft_get_computed_layout":{let s=n?.selector;if(this.currentMode==="browser"){let a=await vm(this.getPlaywrightPage(),s);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}let i=await o.callBridge("getComputedLayout",s);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}case"visioncraft_diff_against_reference":{let s=n?.referencePath,i=n?.selector,a=n?.tolerance||30;if(!Co.existsSync(s))throw new Error(`Reference file not found: ${s}`);let c=Co.readFileSync(s),u;if(i)if(this.currentMode==="webview"&&this.webviewClient){let q=await o.callBridge("screenshot","png",100,i),ie=q.match(/^data:image\/\w+;base64,(.+)$/),ve=ie?ie[1]:q;u=Buffer.from(ve,"base64")}else u=await this.getPlaywrightPage().locator(i).screenshot({type:"png"});else if(this.currentMode==="webview"&&this.webviewClient){let q=await o.callBridge("screenshot","png",100),ie=q.match(/^data:image\/\w+;base64,(.+)$/),ve=ie?ie[1]:q;u=Buffer.from(ve,"base64")}else u=await this.getPlaywrightPage().screenshot({type:"png",fullPage:!0});await xm();let l=it.sync.read(c),d=it.sync.read(u),p=Math.max(l.width,d.width),f=Math.max(l.height,d.height),m=(q,ie,ve)=>{if(q.width===ie&&q.height===ve)return q.data;let Ee=Buffer.alloc(ie*ve*4,0);for(let Ce=0;Ce<q.height;Ce++)for(let Ae=0;Ae<q.width;Ae++){let on=(Ce*q.width+Ae)*4,sn=(Ce*ie+Ae)*4;Ee[sn]=q.data[on],Ee[sn+1]=q.data[on+1],Ee[sn+2]=q.data[on+2],Ee[sn+3]=q.data[on+3]}return Ee},h=m(l,p,f),y=m(d,p,f),v=Buffer.alloc(p*f*4),w=To(h,y,v,p,f,{threshold:a/255}),b=p*f,S=(w/b*100).toFixed(2),z=parseFloat((100-parseFloat(S)).toFixed(2)),V=new it({width:p,height:f});V.data=v;let H=it.sync.write(V).toString("base64");return{content:[{type:"text",text:JSON.stringify({similarityPercent:z,changedPixels:w,totalPixels:b,changedPercent:parseFloat(S),dimensions:{width:p,height:f},referencePath:s},null,2)},{type:"image",data:H,mimeType:"image/png"}]}}case"visioncraft_get_palette":{let s=n?.selector,i=n?.limit||20;if(this.currentMode==="browser"){let c=await wm(this.getPlaywrightPage(),s,i);return{content:[{type:"text",text:JSON.stringify(c,null,2)}]}}let a=await o.callBridge("getPalette",s,i);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}case"visioncraft_snapshot":{let s=n?.selectors,i=n?.screenshot!==!1,a=n?.audit||!1,c={},u=[];i&&u.push((async()=>{if(this.currentMode==="webview"&&this.webviewClient){let d=await o.callBridge("screenshot","jpeg",80);c.screenshot=d}else{let p=await this.getPlaywrightPage().screenshot({type:"jpeg",quality:80,fullPage:!0});c.screenshot=`data:image/jpeg;base64,${p.toString("base64")}`}})()),s&&s.length>0&&u.push((async()=>{let d=[];for(let p of s)this.currentMode==="browser"?d.push(await ja(this.getPlaywrightPage(),p)):d.push(await o.callBridge("inspectElement",p));c.elements=d})()),a&&u.push((async()=>{this.currentMode==="browser"?c.audit=await Ma(this.getPlaywrightPage()):c.audit=await o.callBridge("auditAccessibility")})()),await Promise.all(u);let l=[{type:"text",text:JSON.stringify({elements:c.elements||[],audit:c.audit||null},null,2)}];if(c.screenshot){let d=c.screenshot.match(/^data:image\/\w+;base64,(.+)$/),p=d?d[1]:c.screenshot;l.push({type:"image",data:p,mimeType:"image/jpeg"})}return{content:l}}case"visioncraft_wait_for_hmr":{let s=n?.timeout||1e4;if(this.currentMode==="browser"){let a=bm();return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}let i=await o.callBridge("waitForHMR",s);return{content:[{type:"text",text:JSON.stringify(i,null,2)}]}}default:throw new Error(`Unknown tool: ${r}`)}}catch(o){return{content:[{type:"text",text:`Error: ${o instanceof Error?o.message:String(o)}`}],isError:!0}}})}async run(){let e=new ko;await this.server.connect(e),console.error("[MCP] VisionCraft MCP Server running on stdio")}},I$=new qa;I$.run().catch(t=>{console.error("[MCP] Fatal error:",t),process.exit(1)});export{rr as BrowserClient,rn as CDPClient,Oa as ConnectionMode,Po as getBrowserClient};
|
|
37
|
+
//# sourceMappingURL=index.js.map
|