gigabuddy 0.3.0 → 0.3.2

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/bin/cli.js CHANGED
@@ -1,92 +1,93 @@
1
1
  #!/usr/bin/env node
2
- var mg=Object.create;var Ln=Object.defineProperty;var hg=Object.getOwnPropertyDescriptor;var gg=Object.getOwnPropertyNames;var _g=Object.getPrototypeOf,yg=Object.prototype.hasOwnProperty;var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Fn=(e,t)=>{for(var r in t)Ln(e,r,{get:t[r],enumerable:!0})},vg=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of gg(t))!yg.call(e,n)&&n!==r&&Ln(e,n,{get:()=>t[n],enumerable:!(o=hg(t,n))||o.enumerable});return e};var wg=(e,t,r)=>(r=e!=null?mg(_g(e)):{},vg(t||!e||!e.__esModule?Ln(r,"default",{value:e,enumerable:!0}):r,e));var Fr=b(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.regexpCode=D.getEsmExportName=D.getProperty=D.safeStringify=D.stringify=D.strConcat=D.addCodeArg=D.str=D._=D.nil=D._Code=D.Name=D.IDENTIFIER=D._CodeOrName=void 0;var Ur=class{};D._CodeOrName=Ur;D.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Pt=class extends Ur{constructor(t){if(super(),!D.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};D.Name=Pt;var Ae=class extends Ur{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,o)=>(o instanceof Pt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};D._Code=Ae;D.nil=new Ae("");function ef(e,...t){let r=[e[0]],o=0;for(;o<t.length;)di(r,t[o]),r.push(e[++o]);return new Ae(r)}D._=ef;var li=new Ae("+");function tf(e,...t){let r=[Lr(e[0])],o=0;for(;o<t.length;)r.push(li),di(r,t[o]),r.push(li,Lr(e[++o]));return Kv(r),new Ae(r)}D.str=tf;function di(e,t){t instanceof Ae?e.push(...t._items):t instanceof Pt?e.push(t):e.push(Wv(t))}D.addCodeArg=di;function Kv(e){let t=1;for(;t<e.length-1;){if(e[t]===li){let r=Bv(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Bv(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Pt||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Pt))return`"${e}${t.slice(1)}`}function Gv(e,t){return t.emptyStr()?e:e.emptyStr()?t:tf`${e}${t}`}D.strConcat=Gv;function Wv(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Lr(Array.isArray(e)?e.join(","):e)}function Yv(e){return new Ae(Lr(e))}D.stringify=Yv;function Lr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}D.safeStringify=Lr;function Qv(e){return typeof e=="string"&&D.IDENTIFIER.test(e)?new Ae(`.${e}`):ef`[${e}]`}D.getProperty=Qv;function Xv(e){if(typeof e=="string"&&D.IDENTIFIER.test(e))return new Ae(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}D.getEsmExportName=Xv;function ew(e){return new Ae(e.toString())}D.regexpCode=ew});var mi=b(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.ValueScope=ze.ValueScopeName=ze.Scope=ze.varKinds=ze.UsedValueState=void 0;var be=Fr(),pi=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},tn;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(tn||(ze.UsedValueState=tn={}));ze.varKinds={const:new be.Name("const"),let:new be.Name("let"),var:new be.Name("var")};var rn=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof be.Name?t:this.name(t)}name(t){return new be.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};ze.Scope=rn;var on=class extends be.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:o}){this.value=t,this.scopePath=(0,be._)`.${new be.Name(r)}[${o}]`}};ze.ValueScopeName=on;var tw=(0,be._)`\n`,fi=class extends rn{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?tw:be.nil}}get(){return this._scope}name(t){return new on(t,this._newName(t))}value(t,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o: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,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,be._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(t,r,o={},n){let s=be.nil;for(let i in t){let a=t[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,tn.Started);let l=r(u);if(l){let p=this.opts.es5?ze.varKinds.var:ze.varKinds.const;s=(0,be._)`${s}${p} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,be._)`${s}${l}${this.opts._n}`;else throw new pi(u);c.set(u,tn.Completed)})}return s}};ze.ValueScope=fi});var C=b(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var Z=Fr(),Ue=mi(),gt=Fr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return gt._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return gt.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return gt.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return gt.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return gt.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return gt.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return gt.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return gt.Name}});var cn=mi();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return cn.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return cn.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return cn.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return cn.varKinds}});N.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 it=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},hi=class extends it{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let o=t?Ue.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Wt(this.rhs,t,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},nn=class extends it{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Z.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Wt(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return an(t,this.rhs)}},gi=class extends nn{constructor(t,r,o,n){super(t,o,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},_i=class extends it{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},yi=class extends it{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},vi=class extends it{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},wi=class extends it{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=Wt(this.code,t,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Vr=class extends it{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(t,r)||(rw(t,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Rt(t,r.names),{})}},at=class extends Vr{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},$i=class extends Vr{},Gt=class extends at{};Gt.kind="else";var Tt=class e extends at{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Gt(o):o}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(rf(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Wt(this.condition,t,r),this}get names(){let t=super.names;return an(t,this.condition),this.else&&Rt(t,this.else.names),t}};Tt.kind="if";var Et=class extends at{};Et.kind="for";var bi=class extends Et{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=Wt(this.iteration,t,r),this}get names(){return Rt(super.names,this.iteration.names)}},zi=class extends Et{constructor(t,r,o,n){super(),this.varKind=t,this.name=r,this.from=o,this.to=n}render(t){let r=t.es5?Ue.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(t)}get names(){let t=an(super.names,this.from);return an(t,this.to)}},sn=class extends Et{constructor(t,r,o,n){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=Wt(this.iterable,t,r),this}get names(){return Rt(super.names,this.iterable.names)}},Hr=class extends at{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Hr.kind="func";var Jr=class extends Vr{render(t){return"return "+super.render(t)}};Jr.kind="return";var xi=class extends at{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var o,n;return super.optimizeNames(t,r),(o=this.catch)===null||o===void 0||o.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Rt(t,this.catch.names),this.finally&&Rt(t,this.finally.names),t}},Kr=class extends at{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Kr.kind="catch";var Br=class extends at{render(t){return"finally"+super.render(t)}};Br.kind="finally";var ki=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
- `:""},this._extScope=t,this._scope=new Ue.Scope({parent:t}),this._nodes=[new $i]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new hi(t,s,o)),s}const(t,r,o){return this._def(Ue.varKinds.const,t,r,o)}let(t,r,o){return this._def(Ue.varKinds.let,t,r,o)}var(t,r,o){return this._def(Ue.varKinds.var,t,r,o)}assign(t,r,o){return this._leafNode(new nn(t,r,o))}add(t,r){return this._leafNode(new gi(t,N.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Z.nil&&this._leafNode(new wi(t)),this}object(...t){let r=["{"];for(let[o,n]of t)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,n));return r.push("}"),new Z._Code(r)}if(t,r,o){if(this._blockNode(new Tt(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Tt(t))}else(){return this._elseNode(new Gt)}endIf(){return this._endBlockNode(Tt,Gt)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new bi(t),r)}forRange(t,r,o,n,s=this.opts.es5?Ue.varKinds.var:Ue.varKinds.let){let i=this._scope.toName(t);return this._for(new zi(s,i,r,o),()=>n(i))}forOf(t,r,o,n=Ue.varKinds.const){let s=this._scope.toName(t);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}]`),o(s)})}return this._for(new sn("of",n,s,r),()=>o(s))}forIn(t,r,o,n=this.opts.es5?Ue.varKinds.var:Ue.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Z._)`Object.keys(${r})`,o);let s=this._scope.toName(t);return this._for(new sn("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(Et)}label(t){return this._leafNode(new _i(t))}break(t){return this._leafNode(new yi(t))}return(t){let r=new Jr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jr)}try(t,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new xi;if(this._blockNode(n),this.code(t),r){let s=this.name("e");this._currNode=n.catch=new Kr(s),r(s)}return o&&(this._currNode=n.finally=new Br,this.code(o)),this._endBlockNode(Kr,Br)}throw(t){return this._leafNode(new vi(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||t!==void 0&&o!==t)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Z.nil,o,n){return this._blockNode(new Hr(t,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Hr)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let o=this._currNode;if(o instanceof t||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Tt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};N.CodeGen=ki;function Rt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function an(e,t){return t instanceof Z._CodeOrName?Rt(e,t.names):e}function Wt(e,t,r){if(e instanceof Z.Name)return o(e);if(!n(e))return e;return new Z._Code(e._items.reduce((s,i)=>(i instanceof Z.Name&&(i=o(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function n(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function rw(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function rf(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Z._)`!${Si(e)}`}N.not=rf;var ow=of(N.operators.AND);function nw(...e){return e.reduce(ow)}N.and=nw;var sw=of(N.operators.OR);function iw(...e){return e.reduce(sw)}N.or=iw;function of(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:(0,Z._)`${Si(t)} ${e} ${Si(r)}`}function Si(e){return e instanceof Z.Name?e:(0,Z._)`(${e})`}});var M=b(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=C(),aw=Fr();function cw(e){let t={};for(let r of e)t[r]=!0;return t}j.toHash=cw;function uw(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(af(e,t),!cf(t,e.self.RULES.all))}j.alwaysValidSchema=uw;function af(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=o.RULES.keywords;for(let s in t)n[s]||df(e,`unknown keyword: "${s}"`)}j.checkUnknownRules=af;function cf(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}j.schemaHasRules=cf;function lw(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}j.schemaHasRulesButRef=lw;function dw({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,K._)`${r}`}return(0,K._)`${e}${t}${(0,K.getProperty)(o)}`}j.schemaRefOrVal=dw;function pw(e){return uf(decodeURIComponent(e))}j.unescapeFragment=pw;function fw(e){return encodeURIComponent(Ti(e))}j.escapeFragment=fw;function Ti(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}j.escapeJsonPointer=Ti;function uf(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}j.unescapeJsonPointer=uf;function mw(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}j.eachItem=mw;function nf({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof K.Name?(s instanceof K.Name?e(n,s,i):t(n,s,i),i):s instanceof K.Name?(t(n,i,s),s):r(s,i);return a===K.Name&&!(c instanceof K.Name)?o(n,c):c}}j.mergeEvaluated={props:nf({mergeNames:(e,t,r)=>e.if((0,K._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,K._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,K._)`${r} || {}`).code((0,K._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,K._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,K._)`${r} || {}`),Ei(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:lf}),items:nf({mergeNames:(e,t,r)=>e.if((0,K._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,K._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,K._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,K._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function lf(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,K._)`{}`);return t!==void 0&&Ei(e,r,t),r}j.evaluatedPropsToName=lf;function Ei(e,t,r){Object.keys(r).forEach(o=>e.assign((0,K._)`${t}${(0,K.getProperty)(o)}`,!0))}j.setEvaluated=Ei;var sf={};function hw(e,t){return e.scopeValue("func",{ref:t,code:sf[t.code]||(sf[t.code]=new aw._Code(t.code))})}j.useFunc=hw;var Pi;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Pi||(j.Type=Pi={}));function gw(e,t,r){if(e instanceof K.Name){let o=t===Pi.Num;return r?o?(0,K._)`"[" + ${e} + "]"`:(0,K._)`"['" + ${e} + "']"`:o?(0,K._)`"/" + ${e}`:(0,K._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,K.getProperty)(e).toString():"/"+Ti(e)}j.getErrorPath=gw;function df(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}j.checkStrictMode=df});var ct=b(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var me=C(),_w={data:new me.Name("data"),valCxt:new me.Name("valCxt"),instancePath:new me.Name("instancePath"),parentData:new me.Name("parentData"),parentDataProperty:new me.Name("parentDataProperty"),rootData:new me.Name("rootData"),dynamicAnchors:new me.Name("dynamicAnchors"),vErrors:new me.Name("vErrors"),errors:new me.Name("errors"),this:new me.Name("this"),self:new me.Name("self"),scope:new me.Name("scope"),json:new me.Name("json"),jsonPos:new me.Name("jsonPos"),jsonLen:new me.Name("jsonLen"),jsonPart:new me.Name("jsonPart")};Ri.default=_w});var Gr=b(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.extendErrors=he.resetErrorsCount=he.reportExtraError=he.reportError=he.keyword$DataError=he.keywordError=void 0;var q=C(),un=M(),ye=ct();he.keywordError={message:({keyword:e})=>(0,q.str)`must pass "${e}" keyword validation`};he.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,q.str)`"${e}" keyword must be ${t} ($data)`:(0,q.str)`"${e}" keyword is invalid ($data)`};function yw(e,t=he.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=mf(e,t,r);o??(i||a)?pf(s,c):ff(n,(0,q._)`[${c}]`)}he.reportError=yw;function vw(e,t=he.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=mf(e,t,r);pf(n,a),s||i||ff(o,ye.default.vErrors)}he.reportExtraError=vw;function ww(e,t){e.assign(ye.default.errors,t),e.if((0,q._)`${ye.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,q._)`${ye.default.vErrors}.length`,t),()=>e.assign(ye.default.vErrors,null)))}he.resetErrorsCount=ww;function $w({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,ye.default.errors,a=>{e.const(i,(0,q._)`${ye.default.vErrors}[${a}]`),e.if((0,q._)`${i}.instancePath === undefined`,()=>e.assign((0,q._)`${i}.instancePath`,(0,q.strConcat)(ye.default.instancePath,s.errorPath))),e.assign((0,q._)`${i}.schemaPath`,(0,q.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,q._)`${i}.schema`,r),e.assign((0,q._)`${i}.data`,o))})}he.extendErrors=$w;function pf(e,t){let r=e.const("err",t);e.if((0,q._)`${ye.default.vErrors} === null`,()=>e.assign(ye.default.vErrors,(0,q._)`[${r}]`),(0,q._)`${ye.default.vErrors}.push(${r})`),e.code((0,q._)`${ye.default.errors}++`)}function ff(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;n.$async?r.throw((0,q._)`new ${e.ValidationError}(${t})`):(r.assign((0,q._)`${o}.errors`,t),r.return(!1))}var Ot={keyword:new q.Name("keyword"),schemaPath:new q.Name("schemaPath"),params:new q.Name("params"),propertyName:new q.Name("propertyName"),message:new q.Name("message"),schema:new q.Name("schema"),parentSchema:new q.Name("parentSchema")};function mf(e,t,r){let{createErrors:o}=e.it;return o===!1?(0,q._)`{}`:bw(e,t,r)}function bw(e,t,r={}){let{gen:o,it:n}=e,s=[zw(n,r),xw(e,r)];return kw(e,t,s),o.object(...s)}function zw({errorPath:e},{instancePath:t}){let r=t?(0,q.str)`${e}${(0,un.getErrorPath)(t,un.Type.Str)}`:e;return[ye.default.instancePath,(0,q.strConcat)(ye.default.instancePath,r)]}function xw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:(0,q.str)`${t}/${e}`;return r&&(n=(0,q.str)`${n}${(0,un.getErrorPath)(r,un.Type.Str)}`),[Ot.schemaPath,n]}function kw(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:p}=a;o.push([Ot.keyword,n],[Ot.params,typeof t=="function"?t(e):t||(0,q._)`{}`]),c.messages&&o.push([Ot.message,typeof r=="function"?r(e):r]),c.verbose&&o.push([Ot.schema,i],[Ot.parentSchema,(0,q._)`${l}${p}`],[ye.default.data,s]),u&&o.push([Ot.propertyName,u])}});var gf=b(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.boolOrEmptySchema=Yt.topBoolOrEmptySchema=void 0;var Sw=Gr(),Pw=C(),Tw=ct(),Ew={message:"boolean schema is false"};function Rw(e){let{gen:t,schema:r,validateName:o}=e;r===!1?hf(e,!1):typeof r=="object"&&r.$async===!0?t.return(Tw.default.data):(t.assign((0,Pw._)`${o}.errors`,null),t.return(!0))}Yt.topBoolOrEmptySchema=Rw;function Ow(e,t){let{gen:r,schema:o}=e;o===!1?(r.var(t,!1),hf(e)):r.var(t,!0)}Yt.boolOrEmptySchema=Ow;function hf(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Sw.reportError)(n,Ew,void 0,t)}});var Oi=b(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.getRules=Qt.isJSONType=void 0;var Iw=["string","number","integer","boolean","null","object","array"],Cw=new Set(Iw);function Nw(e){return typeof e=="string"&&Cw.has(e)}Qt.isJSONType=Nw;function jw(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Qt.getRules=jw});var Ii=b(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.shouldUseRule=_t.shouldUseGroup=_t.schemaHasRulesForType=void 0;function Aw({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&_f(e,o)}_t.schemaHasRulesForType=Aw;function _f(e,t){return t.rules.some(r=>yf(e,r))}_t.shouldUseGroup=_f;function yf(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(o=>e[o]!==void 0))}_t.shouldUseRule=yf});var Wr=b(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.reportTypeError=ge.checkDataTypes=ge.checkDataType=ge.coerceAndCheckDataType=ge.getJSONTypes=ge.getSchemaTypes=ge.DataType=void 0;var Zw=Oi(),Mw=Ii(),qw=Gr(),I=C(),vf=M(),Xt;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Xt||(ge.DataType=Xt={}));function Dw(e){let t=wf(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}ge.getSchemaTypes=Dw;function wf(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Zw.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ge.getJSONTypes=wf;function Uw(e,t){let{gen:r,data:o,opts:n}=e,s=Lw(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,Mw.schemaHasRulesForType)(e,t[0]));if(i){let a=Ni(t,o,n.strictNumbers,Xt.Wrong);r.if(a,()=>{s.length?Fw(e,t,s):ji(e)})}return i}ge.coerceAndCheckDataType=Uw;var $f=new Set(["string","number","integer","boolean","null"]);function Lw(e,t){return t?e.filter(r=>$f.has(r)||t==="array"&&r==="array"):[]}function Fw(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(Ni(t,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let u of r)($f.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),ji(e),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),Vw(e,a)});function c(u){switch(u){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null
2
+ var _g=Object.create;var Ln=Object.defineProperty;var yg=Object.getOwnPropertyDescriptor;var vg=Object.getOwnPropertyNames;var wg=Object.getPrototypeOf,$g=Object.prototype.hasOwnProperty;var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Fn=(e,t)=>{for(var r in t)Ln(e,r,{get:t[r],enumerable:!0})},bg=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of vg(t))!$g.call(e,n)&&n!==r&&Ln(e,n,{get:()=>t[n],enumerable:!(o=yg(t,n))||o.enumerable});return e};var zg=(e,t,r)=>(r=e!=null?_g(wg(e)):{},bg(t||!e||!e.__esModule?Ln(r,"default",{value:e,enumerable:!0}):r,e));var Fr=b(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var Ur=class{};q._CodeOrName=Ur;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Pt=class extends Ur{constructor(t){if(super(),!q.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=Pt;var Ae=class extends Ur{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,o)=>(o instanceof Pt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};q._Code=Ae;q.nil=new Ae("");function tf(e,...t){let r=[e[0]],o=0;for(;o<t.length;)di(r,t[o]),r.push(e[++o]);return new Ae(r)}q._=tf;var li=new Ae("+");function rf(e,...t){let r=[Lr(e[0])],o=0;for(;o<t.length;)r.push(li),di(r,t[o]),r.push(li,Lr(e[++o]));return Wv(r),new Ae(r)}q.str=rf;function di(e,t){t instanceof Ae?e.push(...t._items):t instanceof Pt?e.push(t):e.push(Xv(t))}q.addCodeArg=di;function Wv(e){let t=1;for(;t<e.length-1;){if(e[t]===li){let r=Yv(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Yv(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Pt||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Pt))return`"${e}${t.slice(1)}`}function Qv(e,t){return t.emptyStr()?e:e.emptyStr()?t:rf`${e}${t}`}q.strConcat=Qv;function Xv(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Lr(Array.isArray(e)?e.join(","):e)}function ew(e){return new Ae(Lr(e))}q.stringify=ew;function Lr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q.safeStringify=Lr;function tw(e){return typeof e=="string"&&q.IDENTIFIER.test(e)?new Ae(`.${e}`):tf`[${e}]`}q.getProperty=tw;function rw(e){if(typeof e=="string"&&q.IDENTIFIER.test(e))return new Ae(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}q.getEsmExportName=rw;function ow(e){return new Ae(e.toString())}q.regexpCode=ow});var mi=b(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.ValueScope=ze.ValueScopeName=ze.Scope=ze.varKinds=ze.UsedValueState=void 0;var be=Fr(),pi=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},tn;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(tn||(ze.UsedValueState=tn={}));ze.varKinds={const:new be.Name("const"),let:new be.Name("let"),var:new be.Name("var")};var rn=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof be.Name?t:this.name(t)}name(t){return new be.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};ze.Scope=rn;var on=class extends be.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:o}){this.value=t,this.scopePath=(0,be._)`.${new be.Name(r)}[${o}]`}};ze.ValueScopeName=on;var nw=(0,be._)`\n`,fi=class extends rn{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?nw:be.nil}}get(){return this._scope}name(t){return new on(t,this._newName(t))}value(t,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o: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,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,be._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(t,r,o={},n){let s=be.nil;for(let i in t){let a=t[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,tn.Started);let l=r(u);if(l){let p=this.opts.es5?ze.varKinds.var:ze.varKinds.const;s=(0,be._)`${s}${p} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,be._)`${s}${l}${this.opts._n}`;else throw new pi(u);c.set(u,tn.Completed)})}return s}};ze.ValueScope=fi});var C=b(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var Z=Fr(),Ue=mi(),gt=Fr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return gt._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return gt.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return gt.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return gt.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return gt.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return gt.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return gt.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return gt.Name}});var cn=mi();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return cn.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return cn.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return cn.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return cn.varKinds}});N.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 it=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},hi=class extends it{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let o=t?Ue.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Wt(this.rhs,t,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},nn=class extends it{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Z.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Wt(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return an(t,this.rhs)}},gi=class extends nn{constructor(t,r,o,n){super(t,o,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},_i=class extends it{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},yi=class extends it{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},vi=class extends it{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},wi=class extends it{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=Wt(this.code,t,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Vr=class extends it{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(t,r)||(sw(t,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Rt(t,r.names),{})}},at=class extends Vr{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},$i=class extends Vr{},Gt=class extends at{};Gt.kind="else";var Tt=class e extends at{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Gt(o):o}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(of(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Wt(this.condition,t,r),this}get names(){let t=super.names;return an(t,this.condition),this.else&&Rt(t,this.else.names),t}};Tt.kind="if";var Et=class extends at{};Et.kind="for";var bi=class extends Et{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=Wt(this.iteration,t,r),this}get names(){return Rt(super.names,this.iteration.names)}},zi=class extends Et{constructor(t,r,o,n){super(),this.varKind=t,this.name=r,this.from=o,this.to=n}render(t){let r=t.es5?Ue.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(t)}get names(){let t=an(super.names,this.from);return an(t,this.to)}},sn=class extends Et{constructor(t,r,o,n){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=Wt(this.iterable,t,r),this}get names(){return Rt(super.names,this.iterable.names)}},Hr=class extends at{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Hr.kind="func";var Jr=class extends Vr{render(t){return"return "+super.render(t)}};Jr.kind="return";var xi=class extends at{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var o,n;return super.optimizeNames(t,r),(o=this.catch)===null||o===void 0||o.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Rt(t,this.catch.names),this.finally&&Rt(t,this.finally.names),t}},Kr=class extends at{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Kr.kind="catch";var Br=class extends at{render(t){return"finally"+super.render(t)}};Br.kind="finally";var ki=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=t,this._scope=new Ue.Scope({parent:t}),this._nodes=[new $i]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new hi(t,s,o)),s}const(t,r,o){return this._def(Ue.varKinds.const,t,r,o)}let(t,r,o){return this._def(Ue.varKinds.let,t,r,o)}var(t,r,o){return this._def(Ue.varKinds.var,t,r,o)}assign(t,r,o){return this._leafNode(new nn(t,r,o))}add(t,r){return this._leafNode(new gi(t,N.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Z.nil&&this._leafNode(new wi(t)),this}object(...t){let r=["{"];for(let[o,n]of t)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,n));return r.push("}"),new Z._Code(r)}if(t,r,o){if(this._blockNode(new Tt(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Tt(t))}else(){return this._elseNode(new Gt)}endIf(){return this._endBlockNode(Tt,Gt)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new bi(t),r)}forRange(t,r,o,n,s=this.opts.es5?Ue.varKinds.var:Ue.varKinds.let){let i=this._scope.toName(t);return this._for(new zi(s,i,r,o),()=>n(i))}forOf(t,r,o,n=Ue.varKinds.const){let s=this._scope.toName(t);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}]`),o(s)})}return this._for(new sn("of",n,s,r),()=>o(s))}forIn(t,r,o,n=this.opts.es5?Ue.varKinds.var:Ue.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Z._)`Object.keys(${r})`,o);let s=this._scope.toName(t);return this._for(new sn("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(Et)}label(t){return this._leafNode(new _i(t))}break(t){return this._leafNode(new yi(t))}return(t){let r=new Jr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jr)}try(t,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new xi;if(this._blockNode(n),this.code(t),r){let s=this.name("e");this._currNode=n.catch=new Kr(s),r(s)}return o&&(this._currNode=n.finally=new Br,this.code(o)),this._endBlockNode(Kr,Br)}throw(t){return this._leafNode(new vi(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||t!==void 0&&o!==t)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Z.nil,o,n){return this._blockNode(new Hr(t,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Hr)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let o=this._currNode;if(o instanceof t||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Tt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};N.CodeGen=ki;function Rt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function an(e,t){return t instanceof Z._CodeOrName?Rt(e,t.names):e}function Wt(e,t,r){if(e instanceof Z.Name)return o(e);if(!n(e))return e;return new Z._Code(e._items.reduce((s,i)=>(i instanceof Z.Name&&(i=o(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function n(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function sw(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function of(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Z._)`!${Si(e)}`}N.not=of;var iw=nf(N.operators.AND);function aw(...e){return e.reduce(iw)}N.and=aw;var cw=nf(N.operators.OR);function uw(...e){return e.reduce(cw)}N.or=uw;function nf(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:(0,Z._)`${Si(t)} ${e} ${Si(r)}`}function Si(e){return e instanceof Z.Name?e:(0,Z._)`(${e})`}});var M=b(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=C(),lw=Fr();function dw(e){let t={};for(let r of e)t[r]=!0;return t}j.toHash=dw;function pw(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(cf(e,t),!uf(t,e.self.RULES.all))}j.alwaysValidSchema=pw;function cf(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=o.RULES.keywords;for(let s in t)n[s]||pf(e,`unknown keyword: "${s}"`)}j.checkUnknownRules=cf;function uf(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}j.schemaHasRules=uf;function fw(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}j.schemaHasRulesButRef=fw;function mw({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,K._)`${r}`}return(0,K._)`${e}${t}${(0,K.getProperty)(o)}`}j.schemaRefOrVal=mw;function hw(e){return lf(decodeURIComponent(e))}j.unescapeFragment=hw;function gw(e){return encodeURIComponent(Ti(e))}j.escapeFragment=gw;function Ti(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}j.escapeJsonPointer=Ti;function lf(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}j.unescapeJsonPointer=lf;function _w(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}j.eachItem=_w;function sf({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof K.Name?(s instanceof K.Name?e(n,s,i):t(n,s,i),i):s instanceof K.Name?(t(n,i,s),s):r(s,i);return a===K.Name&&!(c instanceof K.Name)?o(n,c):c}}j.mergeEvaluated={props:sf({mergeNames:(e,t,r)=>e.if((0,K._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,K._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,K._)`${r} || {}`).code((0,K._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,K._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,K._)`${r} || {}`),Ei(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:df}),items:sf({mergeNames:(e,t,r)=>e.if((0,K._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,K._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,K._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,K._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function df(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,K._)`{}`);return t!==void 0&&Ei(e,r,t),r}j.evaluatedPropsToName=df;function Ei(e,t,r){Object.keys(r).forEach(o=>e.assign((0,K._)`${t}${(0,K.getProperty)(o)}`,!0))}j.setEvaluated=Ei;var af={};function yw(e,t){return e.scopeValue("func",{ref:t,code:af[t.code]||(af[t.code]=new lw._Code(t.code))})}j.useFunc=yw;var Pi;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Pi||(j.Type=Pi={}));function vw(e,t,r){if(e instanceof K.Name){let o=t===Pi.Num;return r?o?(0,K._)`"[" + ${e} + "]"`:(0,K._)`"['" + ${e} + "']"`:o?(0,K._)`"/" + ${e}`:(0,K._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,K.getProperty)(e).toString():"/"+Ti(e)}j.getErrorPath=vw;function pf(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}j.checkStrictMode=pf});var ct=b(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var me=C(),ww={data:new me.Name("data"),valCxt:new me.Name("valCxt"),instancePath:new me.Name("instancePath"),parentData:new me.Name("parentData"),parentDataProperty:new me.Name("parentDataProperty"),rootData:new me.Name("rootData"),dynamicAnchors:new me.Name("dynamicAnchors"),vErrors:new me.Name("vErrors"),errors:new me.Name("errors"),this:new me.Name("this"),self:new me.Name("self"),scope:new me.Name("scope"),json:new me.Name("json"),jsonPos:new me.Name("jsonPos"),jsonLen:new me.Name("jsonLen"),jsonPart:new me.Name("jsonPart")};Ri.default=ww});var Gr=b(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.extendErrors=he.resetErrorsCount=he.reportExtraError=he.reportError=he.keyword$DataError=he.keywordError=void 0;var D=C(),un=M(),ye=ct();he.keywordError={message:({keyword:e})=>(0,D.str)`must pass "${e}" keyword validation`};he.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,D.str)`"${e}" keyword must be ${t} ($data)`:(0,D.str)`"${e}" keyword is invalid ($data)`};function $w(e,t=he.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=hf(e,t,r);o??(i||a)?ff(s,c):mf(n,(0,D._)`[${c}]`)}he.reportError=$w;function bw(e,t=he.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=hf(e,t,r);ff(n,a),s||i||mf(o,ye.default.vErrors)}he.reportExtraError=bw;function zw(e,t){e.assign(ye.default.errors,t),e.if((0,D._)`${ye.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,D._)`${ye.default.vErrors}.length`,t),()=>e.assign(ye.default.vErrors,null)))}he.resetErrorsCount=zw;function xw({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,ye.default.errors,a=>{e.const(i,(0,D._)`${ye.default.vErrors}[${a}]`),e.if((0,D._)`${i}.instancePath === undefined`,()=>e.assign((0,D._)`${i}.instancePath`,(0,D.strConcat)(ye.default.instancePath,s.errorPath))),e.assign((0,D._)`${i}.schemaPath`,(0,D.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,D._)`${i}.schema`,r),e.assign((0,D._)`${i}.data`,o))})}he.extendErrors=xw;function ff(e,t){let r=e.const("err",t);e.if((0,D._)`${ye.default.vErrors} === null`,()=>e.assign(ye.default.vErrors,(0,D._)`[${r}]`),(0,D._)`${ye.default.vErrors}.push(${r})`),e.code((0,D._)`${ye.default.errors}++`)}function mf(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;n.$async?r.throw((0,D._)`new ${e.ValidationError}(${t})`):(r.assign((0,D._)`${o}.errors`,t),r.return(!1))}var Ot={keyword:new D.Name("keyword"),schemaPath:new D.Name("schemaPath"),params:new D.Name("params"),propertyName:new D.Name("propertyName"),message:new D.Name("message"),schema:new D.Name("schema"),parentSchema:new D.Name("parentSchema")};function hf(e,t,r){let{createErrors:o}=e.it;return o===!1?(0,D._)`{}`:kw(e,t,r)}function kw(e,t,r={}){let{gen:o,it:n}=e,s=[Sw(n,r),Pw(e,r)];return Tw(e,t,s),o.object(...s)}function Sw({errorPath:e},{instancePath:t}){let r=t?(0,D.str)`${e}${(0,un.getErrorPath)(t,un.Type.Str)}`:e;return[ye.default.instancePath,(0,D.strConcat)(ye.default.instancePath,r)]}function Pw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:(0,D.str)`${t}/${e}`;return r&&(n=(0,D.str)`${n}${(0,un.getErrorPath)(r,un.Type.Str)}`),[Ot.schemaPath,n]}function Tw(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:p}=a;o.push([Ot.keyword,n],[Ot.params,typeof t=="function"?t(e):t||(0,D._)`{}`]),c.messages&&o.push([Ot.message,typeof r=="function"?r(e):r]),c.verbose&&o.push([Ot.schema,i],[Ot.parentSchema,(0,D._)`${l}${p}`],[ye.default.data,s]),u&&o.push([Ot.propertyName,u])}});var _f=b(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.boolOrEmptySchema=Yt.topBoolOrEmptySchema=void 0;var Ew=Gr(),Rw=C(),Ow=ct(),Iw={message:"boolean schema is false"};function Cw(e){let{gen:t,schema:r,validateName:o}=e;r===!1?gf(e,!1):typeof r=="object"&&r.$async===!0?t.return(Ow.default.data):(t.assign((0,Rw._)`${o}.errors`,null),t.return(!0))}Yt.topBoolOrEmptySchema=Cw;function Nw(e,t){let{gen:r,schema:o}=e;o===!1?(r.var(t,!1),gf(e)):r.var(t,!0)}Yt.boolOrEmptySchema=Nw;function gf(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Ew.reportError)(n,Iw,void 0,t)}});var Oi=b(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.getRules=Qt.isJSONType=void 0;var jw=["string","number","integer","boolean","null","object","array"],Aw=new Set(jw);function Zw(e){return typeof e=="string"&&Aw.has(e)}Qt.isJSONType=Zw;function Mw(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Qt.getRules=Mw});var Ii=b(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.shouldUseRule=_t.shouldUseGroup=_t.schemaHasRulesForType=void 0;function Dw({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&yf(e,o)}_t.schemaHasRulesForType=Dw;function yf(e,t){return t.rules.some(r=>vf(e,r))}_t.shouldUseGroup=yf;function vf(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(o=>e[o]!==void 0))}_t.shouldUseRule=vf});var Wr=b(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.reportTypeError=ge.checkDataTypes=ge.checkDataType=ge.coerceAndCheckDataType=ge.getJSONTypes=ge.getSchemaTypes=ge.DataType=void 0;var qw=Oi(),Uw=Ii(),Lw=Gr(),I=C(),wf=M(),Xt;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Xt||(ge.DataType=Xt={}));function Fw(e){let t=$f(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}ge.getSchemaTypes=Fw;function $f(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(qw.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ge.getJSONTypes=$f;function Vw(e,t){let{gen:r,data:o,opts:n}=e,s=Hw(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,Uw.schemaHasRulesForType)(e,t[0]));if(i){let a=Ni(t,o,n.strictNumbers,Xt.Wrong);r.if(a,()=>{s.length?Jw(e,t,s):ji(e)})}return i}ge.coerceAndCheckDataType=Vw;var bf=new Set(["string","number","integer","boolean","null"]);function Hw(e,t){return t?e.filter(r=>bf.has(r)||t==="array"&&r==="array"):[]}function Jw(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(Ni(t,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let u of r)(bf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),ji(e),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),Kw(e,a)});function c(u){switch(u){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null
4
4
  || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,I._)`+${n}`);return;case"integer":o.elseIf((0,I._)`${i} === "boolean" || ${n} === null
5
5
  || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,I._)`+${n}`);return;case"boolean":o.elseIf((0,I._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,I._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,I._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,I._)`${i} === "string" || ${i} === "number"
6
- || ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function Vw({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,I._)`${t} !== undefined`,()=>e.assign((0,I._)`${t}[${r}]`,o))}function Ci(e,t,r,o=Xt.Correct){let n=o===Xt.Correct?I.operators.EQ:I.operators.NEQ,s;switch(e){case"null":return(0,I._)`${t} ${n} null`;case"array":s=(0,I._)`Array.isArray(${t})`;break;case"object":s=(0,I._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,I._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${t} ${n} ${e}`}return o===Xt.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${t} == "number"`,a,r?(0,I._)`isFinite(${t})`:I.nil)}}ge.checkDataType=Ci;function Ni(e,t,r,o){if(e.length===1)return Ci(e[0],t,r,o);let n,s=(0,vf.toHash)(e);if(s.array&&s.object){let i=(0,I._)`typeof ${t} != "object"`;n=s.null?i:(0,I._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,Ci(i,t,r,o));return n}ge.checkDataTypes=Ni;var Hw={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,I._)`{type: ${e}}`:(0,I._)`{type: ${t}}`};function ji(e){let t=Jw(e);(0,qw.reportError)(t,Hw)}ge.reportTypeError=ji;function Jw(e){let{gen:t,data:r,schema:o}=e,n=(0,vf.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var zf=b(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.assignDefaults=void 0;var er=C(),Kw=M();function Bw(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)bf(e,n,r[n].default);else t==="array"&&Array.isArray(o)&&o.forEach((n,s)=>bf(e,s,n.default))}ln.assignDefaults=Bw;function bf(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=(0,er._)`${s}${(0,er.getProperty)(t)}`;if(n){(0,Kw.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,er._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,er._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,er._)`${a} = ${(0,er.stringify)(r)}`)}});var Ze=b(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var W=C(),Ai=M(),yt=ct(),Gw=M();function Ww(e,t){let{gen:r,data:o,it:n}=e;r.if(Mi(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,W._)`${t}`},!0),e.error()})}V.checkReportMissingProp=Ww;function Yw({gen:e,data:t,it:{opts:r}},o,n){return(0,W.or)(...o.map(s=>(0,W.and)(Mi(e,t,s,r.ownProperties),(0,W._)`${n} = ${s}`)))}V.checkMissingProp=Yw;function Qw(e,t){e.setParams({missingProperty:t},!0),e.error()}V.reportMissingProp=Qw;function xf(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=xf;function Zi(e,t,r){return(0,W._)`${xf(e)}.call(${t}, ${r})`}V.isOwnProperty=Zi;function Xw(e,t,r,o){let n=(0,W._)`${t}${(0,W.getProperty)(r)} !== undefined`;return o?(0,W._)`${n} && ${Zi(e,t,r)}`:n}V.propertyInData=Xw;function Mi(e,t,r,o){let n=(0,W._)`${t}${(0,W.getProperty)(r)} === undefined`;return o?(0,W.or)(n,(0,W.not)(Zi(e,t,r))):n}V.noPropertyInData=Mi;function kf(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}V.allSchemaProperties=kf;function e$(e,t){return kf(t).filter(r=>!(0,Ai.alwaysValidSchema)(e,t[r]))}V.schemaProperties=e$;function t$({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,W._)`${e}, ${t}, ${o}${n}`:t,p=[[yt.default.instancePath,(0,W.strConcat)(yt.default.instancePath,s)],[yt.default.parentData,i.parentData],[yt.default.parentDataProperty,i.parentDataProperty],[yt.default.rootData,yt.default.rootData]];i.opts.dynamicRef&&p.push([yt.default.dynamicAnchors,yt.default.dynamicAnchors]);let m=(0,W._)`${l}, ${r.object(...p)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${m})`:(0,W._)`${a}(${m})`}V.callValidateCode=t$;var r$=(0,W._)`new RegExp`;function o$({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,W._)`${n.code==="new RegExp"?r$:(0,Gw.useFunc)(e,n)}(${r}, ${o})`})}V.usePattern=o$;function n$(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,W._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:Ai.Type.Num},s),t.if((0,W.not)(s),a)})}}V.validateArray=n$;function s$(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ai.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,W._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,W.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}V.validateUnion=s$});var Tf=b(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateKeywordUsage=Ke.validSchemaType=Ke.funcKeywordCode=Ke.macroKeywordCode=void 0;var ve=C(),It=ct(),i$=Ze(),a$=Gr();function c$(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=Pf(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:ve.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Ke.macroKeywordCode=c$;function u$(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;d$(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Pf(o,n,u),p=o.let("valid");e.block$data(p,m),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function m(){if(t.errors===!1)_(),t.modifying&&Sf(e),y(()=>e.error());else{let v=t.async?f():g();t.modifying&&Sf(e),y(()=>l$(e,v))}}function f(){let v=o.let("ruleErrs",null);return o.try(()=>_((0,ve._)`await `),O=>o.assign(p,!1).if((0,ve._)`${O} instanceof ${c.ValidationError}`,()=>o.assign(v,(0,ve._)`${O}.errors`),()=>o.throw(O))),v}function g(){let v=(0,ve._)`${l}.errors`;return o.assign(v,null),_(ve.nil),v}function _(v=t.async?(0,ve._)`await `:ve.nil){let O=c.opts.passContext?It.default.this:It.default.self,z=!("compile"in t&&!a||t.schema===!1);o.assign(p,(0,ve._)`${v}${(0,i$.callValidateCode)(e,l,O,z)}`,t.modifying)}function y(v){var O;o.if((0,ve.not)((O=t.valid)!==null&&O!==void 0?O:p),v)}}Ke.funcKeywordCode=u$;function Sf(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,ve._)`${o.parentData}[${o.parentDataProperty}]`))}function l$(e,t){let{gen:r}=e;r.if((0,ve._)`Array.isArray(${t})`,()=>{r.assign(It.default.vErrors,(0,ve._)`${It.default.vErrors} === null ? ${t} : ${It.default.vErrors}.concat(${t})`).assign(It.default.errors,(0,ve._)`${It.default.vErrors}.length`),(0,a$.extendErrors)(e)},()=>e.error())}function d$({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Pf(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ve.stringify)(r)})}function p$(e,t,r=!1){return!t.length||t.some(o=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}Ke.validSchemaType=p$;function f$({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ke.validateKeywordUsage=f$});var Rf=b(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.extendSubschemaMode=vt.extendSubschemaData=vt.getSubschema=void 0;var Be=C(),Ef=M();function m$(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Be._)`${e.schemaPath}${(0,Be.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Be._)`${e.schemaPath}${(0,Be.getProperty)(t)}${(0,Be.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Ef.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}vt.getSubschema=m$;function h$(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:p}=t,m=a.let("data",(0,Be._)`${t.data}${(0,Be.getProperty)(r)}`,!0);c(m),e.errorPath=(0,Be.str)`${u}${(0,Ef.getErrorPath)(r,o,p.jsPropertySyntax)}`,e.parentDataProperty=(0,Be._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof Be.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}vt.extendSubschemaData=h$;function g$(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(e.compositeRule=o),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}vt.extendSubschemaMode=g$});var qi=b((EO,Of)=>{"use strict";Of.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Cf=b((RO,If)=>{"use strict";var wt=If.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};dn(t,o,n,e,"",e)};wt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};wt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};wt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};wt.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 dn(e,t,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,u);for(var l in o){var p=o[l];if(Array.isArray(p)){if(l in wt.arrayKeywords)for(var m=0;m<p.length;m++)dn(e,t,r,p[m],n+"/"+l+"/"+m,s,n,l,o,m)}else if(l in wt.propsKeywords){if(p&&typeof p=="object")for(var f in p)dn(e,t,r,p[f],n+"/"+l+"/"+_$(f),s,n,l,o,f)}else(l in wt.keywords||e.allKeys&&!(l in wt.skipKeywords))&&dn(e,t,r,p,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function _$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Yr=b(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.getSchemaRefs=xe.resolveUrl=xe.normalizeId=xe._getFullPath=xe.getFullPath=xe.inlineRef=void 0;var y$=M(),v$=qi(),w$=Cf(),$$=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function b$(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Di(e):t?Nf(e)<=t:!1}xe.inlineRef=b$;var z$=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Di(e){for(let t in e){if(z$.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Di)||typeof r=="object"&&Di(r))return!0}return!1}function Nf(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!$$.has(r)&&(typeof e[r]=="object"&&(0,y$.eachItem)(e[r],o=>t+=Nf(o)),t===1/0))return 1/0}return t}function jf(e,t="",r){r!==!1&&(t=tr(t));let o=e.parse(t);return Af(e,o)}xe.getFullPath=jf;function Af(e,t){return e.serialize(t).split("#")[0]+"#"}xe._getFullPath=Af;var x$=/#\/?$/;function tr(e){return e?e.replace(x$,""):""}xe.normalizeId=tr;function k$(e,t,r){return r=tr(r),e.resolve(t,r)}xe.resolveUrl=k$;var S$=/^[a-z_][-a-z0-9._]*$/i;function P$(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=tr(e[r]||t),s={"":n},i=jf(o,n,!1),a={},c=new Set;return w$(e,{allKeys:!0},(p,m,f,g)=>{if(g===void 0)return;let _=i+m,y=s[g];typeof p[r]=="string"&&(y=v.call(this,p[r])),O.call(this,p.$anchor),O.call(this,p.$dynamicAnchor),s[m]=y;function v(z){let T=this.opts.uriResolver.resolve;if(z=tr(y?T(y,z):z),c.has(z))throw l(z);c.add(z);let x=this.refs[z];return typeof x=="string"&&(x=this.refs[x]),typeof x=="object"?u(p,x.schema,z):z!==tr(_)&&(z[0]==="#"?(u(p,a[z],z),a[z]=p):this.refs[z]=_),z}function O(z){if(typeof z=="string"){if(!S$.test(z))throw new Error(`invalid anchor "${z}"`);v.call(this,`#${z}`)}}}),a;function u(p,m,f){if(m!==void 0&&!v$(p,m))throw l(f)}function l(p){return new Error(`reference "${p}" resolves to more than one schema`)}}xe.getSchemaRefs=P$});var eo=b($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.getData=$t.KeywordCxt=$t.validateFunctionCode=void 0;var Uf=gf(),Zf=Wr(),Li=Ii(),pn=Wr(),T$=zf(),Xr=Tf(),Ui=Rf(),S=C(),E=ct(),E$=Yr(),ut=M(),Qr=Gr();function R$(e){if(Vf(e)&&(Hf(e),Ff(e))){C$(e);return}Lf(e,()=>(0,Uf.topBoolOrEmptySchema)(e))}$t.validateFunctionCode=R$;function Lf({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){n.code.es5?e.func(t,(0,S._)`${E.default.data}, ${E.default.valCxt}`,o.$async,()=>{e.code((0,S._)`"use strict"; ${Mf(r,n)}`),I$(e,n),e.code(s)}):e.func(t,(0,S._)`${E.default.data}, ${O$(n)}`,o.$async,()=>e.code(Mf(r,n)).code(s))}function O$(e){return(0,S._)`{${E.default.instancePath}="", ${E.default.parentData}, ${E.default.parentDataProperty}, ${E.default.rootData}=${E.default.data}${e.dynamicRef?(0,S._)`, ${E.default.dynamicAnchors}={}`:S.nil}}={}`}function I$(e,t){e.if(E.default.valCxt,()=>{e.var(E.default.instancePath,(0,S._)`${E.default.valCxt}.${E.default.instancePath}`),e.var(E.default.parentData,(0,S._)`${E.default.valCxt}.${E.default.parentData}`),e.var(E.default.parentDataProperty,(0,S._)`${E.default.valCxt}.${E.default.parentDataProperty}`),e.var(E.default.rootData,(0,S._)`${E.default.valCxt}.${E.default.rootData}`),t.dynamicRef&&e.var(E.default.dynamicAnchors,(0,S._)`${E.default.valCxt}.${E.default.dynamicAnchors}`)},()=>{e.var(E.default.instancePath,(0,S._)`""`),e.var(E.default.parentData,(0,S._)`undefined`),e.var(E.default.parentDataProperty,(0,S._)`undefined`),e.var(E.default.rootData,E.default.data),t.dynamicRef&&e.var(E.default.dynamicAnchors,(0,S._)`{}`)})}function C$(e){let{schema:t,opts:r,gen:o}=e;Lf(e,()=>{r.$comment&&t.$comment&&Kf(e),M$(e),o.let(E.default.vErrors,null),o.let(E.default.errors,0),r.unevaluated&&N$(e),Jf(e),U$(e)})}function N$(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,S._)`${r}.evaluated`),t.if((0,S._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,S._)`${e.evaluated}.props`,(0,S._)`undefined`)),t.if((0,S._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,S._)`${e.evaluated}.items`,(0,S._)`undefined`))}function Mf(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,S._)`/*# sourceURL=${r} */`:S.nil}function j$(e,t){if(Vf(e)&&(Hf(e),Ff(e))){A$(e,t);return}(0,Uf.boolOrEmptySchema)(e,t)}function Ff({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Vf(e){return typeof e.schema!="boolean"}function A$(e,t){let{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&Kf(e),q$(e),D$(e);let s=o.const("_errs",E.default.errors);Jf(e,s),o.var(t,(0,S._)`${s} === ${E.default.errors}`)}function Hf(e){(0,ut.checkUnknownRules)(e),Z$(e)}function Jf(e,t){if(e.opts.jtd)return qf(e,[],!1,t);let r=(0,Zf.getSchemaTypes)(e.schema),o=(0,Zf.coerceAndCheckDataType)(e,r);qf(e,r,!o,t)}function Z$(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,ut.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function M$(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ut.checkStrictMode)(e,"default is ignored in the schema root")}function q$(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,E$.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function D$(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Kf({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,S._)`${E.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,S.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,S._)`${E.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function U$(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;r.$async?t.if((0,S._)`${E.default.errors} === 0`,()=>t.return(E.default.data),()=>t.throw((0,S._)`new ${n}(${E.default.vErrors})`)):(t.assign((0,S._)`${o}.errors`,E.default.vErrors),s.unevaluated&&L$(e),t.return((0,S._)`${E.default.errors} === 0`))}function L$({gen:e,evaluated:t,props:r,items:o}){r instanceof S.Name&&e.assign((0,S._)`${t}.props`,r),o instanceof S.Name&&e.assign((0,S._)`${t}.items`,o)}function qf(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ut.schemaHasRulesButRef)(s,l))){n.block(()=>Gf(e,"$ref",l.all.$ref.definition));return}c.jtd||F$(e,t),n.block(()=>{for(let m of l.rules)p(m);p(l.post)});function p(m){(0,Li.shouldUseGroup)(s,m)&&(m.type?(n.if((0,pn.checkDataType)(m.type,i,c.strictNumbers)),Df(e,m),t.length===1&&t[0]===m.type&&r&&(n.else(),(0,pn.reportTypeError)(e)),n.endIf()):Df(e,m),a||n.if((0,S._)`${E.default.errors} === ${o||0}`))}}function Df(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;n&&(0,T$.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Li.shouldUseRule)(o,s)&&Gf(e,s.keyword,s.definition,t.type)})}function F$(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(V$(e,t),e.opts.allowUnionTypes||H$(e,t),J$(e,e.dataTypes))}function V$(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Bf(e.dataTypes,r)||Fi(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),B$(e,t)}}function H$(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Fi(e,"use allowUnionTypes to allow union type keyword")}function J$(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Li.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>K$(t,i))&&Fi(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function K$(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Bf(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function B$(e,t){let r=[];for(let o of e.dataTypes)Bf(t,o)?r.push(o):t.includes("integer")&&o==="number"&&r.push("integer");e.dataTypes=r}function Fi(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,ut.checkStrictMode)(e,t,e.opts.strictTypes)}var fn=class{constructor(t,r,o){if((0,Xr.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ut.schemaRefOrVal)(t,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Wf(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Xr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",E.default.errors))}result(t,r,o){this.failResult((0,S.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,S.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,S._)`${r} !== undefined && (${(0,S.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?Qr.reportExtraError:Qr.reportError)(this,this.def.error,r)}$dataError(){(0,Qr.reportError)(this,this.def.$dataError||Qr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Qr.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,o=S.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=S.nil,r=S.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,S.or)((0,S._)`${n} === undefined`,r)),t!==S.nil&&o.assign(t,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==S.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,S.or)(i(),a());function i(){if(o.length){if(!(r instanceof S.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,S._)`${(0,pn.checkDataTypes)(c,r,s.opts.strictNumbers,pn.DataType.Wrong)}`}return S.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,S._)`!${c}(${r})`}return S.nil}}subschema(t,r){let o=(0,Ui.getSubschema)(this.it,t);(0,Ui.extendSubschemaData)(o,this.it,t),(0,Ui.extendSubschemaMode)(o,t);let n={...this.it,...o,items:void 0,props:void 0};return j$(n,r),n}mergeEvaluated(t,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&t.props!==void 0&&(o.props=ut.mergeEvaluated.props(n,t.props,o.props,r)),o.items!==!0&&t.items!==void 0&&(o.items=ut.mergeEvaluated.items(n,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,S.Name)),!0}};$t.KeywordCxt=fn;function Gf(e,t,r,o){let n=new fn(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Xr.funcKeywordCode)(n,r):"macro"in r?(0,Xr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Xr.funcKeywordCode)(n,r)}var G$=/^\/(?:[^~]|~0|~1)*$/,W$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Wf(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return E.default.rootData;if(e[0]==="/"){if(!G$.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,s=E.default.rootData}else{let u=W$.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=t)throw new Error(c("property/index",l));return o[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,S._)`${s}${(0,S.getProperty)((0,ut.unescapeJsonPointer)(u))}`,i=(0,S._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}$t.getData=Wf});var mn=b(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Vi=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Hi.default=Vi});var to=b(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var Ji=Yr(),Ki=class extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Ji.resolveUrl)(t,r,o),this.missingSchema=(0,Ji.normalizeId)((0,Ji.getFullPath)(t,this.missingRef))}};Bi.default=Ki});var gn=b(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.resolveSchema=Me.getCompilingSchema=Me.resolveRef=Me.compileSchema=Me.SchemaEnv=void 0;var Le=C(),Y$=mn(),Ct=ct(),Fe=Yr(),Yf=M(),Q$=eo(),rr=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let o;typeof t.schema=="object"&&(o=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Fe.normalizeId)(o?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=o?.$async,this.refs={}}};Me.SchemaEnv=rr;function Wi(e){let t=Qf.call(this,e);if(t)return t;let r=(0,Fe.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Le.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:Y$.default,code:(0,Le._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ct.default.data,parentData:Ct.default.parentData,parentDataProperty:Ct.default.parentDataProperty,dataNames:[Ct.default.data],dataPathArr:[Le.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Le.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Le.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Le._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Q$.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let p=i.toString();l=`${i.scopeRefs(Ct.default.scope)}return ${p}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Ct.default.self}`,`${Ct.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:p,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:_}=u;f.evaluated={props:g instanceof Le.Name?void 0:g,items:_ instanceof Le.Name?void 0:_,dynamicProps:g instanceof Le.Name,dynamicItems:_ instanceof Le.Name},f.source&&(f.source.evaluated=(0,Le.stringify)(f.evaluated))}return e.validate=f,e}catch(p){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),p}finally{this._compilations.delete(e)}}Me.compileSchema=Wi;function X$(e,t,r){var o;r=(0,Fe.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=rb.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new rr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=eb.call(this,s)}Me.resolveRef=X$;function eb(e){return(0,Fe.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Wi.call(this,e)}function Qf(e){for(let t of this._compilations)if(tb(t,e))return t}Me.getCompilingSchema=Qf;function tb(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function rb(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||hn.call(this,e,t)}function hn(e,t){let r=this.opts.uriResolver.parse(t),o=(0,Fe._getFullPath)(this.opts.uriResolver,r),n=(0,Fe.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return Gi.call(this,r,e);let s=(0,Fe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=hn.call(this,e,i);return typeof a?.schema!="object"?void 0:Gi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Wi.call(this,i),s===(0,Fe.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Fe.resolveUrl)(this.opts.uriResolver,n,u)),new rr({schema:a,schemaId:c,root:e,baseId:n})}return Gi.call(this,r,i)}}Me.resolveSchema=hn;var ob=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Gi(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Yf.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!ob.has(a)&&u&&(t=(0,Fe.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Yf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Fe.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=hn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new rr({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s}});var Xf=b((AO,nb)=>{nb.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 Qi=b((ZO,om)=>{"use strict";var sb=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),tm=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 Yi(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(r=e[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var ib=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function em(e){return e.length=0,!0}function ab(e,t,r){if(e.length){let o=Yi(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function cb(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=ab;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=em}else{n.push(u);continue}}return n.length&&(a===em?r.zone=n.join(""):i?o.push(n.join("")):o.push(Yi(n))),r.address=o.join(""),r}function rm(e){if(ub(e,":")<2)return{host:e,isIPV6:!1};let t=cb(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,o=t.address;return t.zone&&(r+="%"+t.zone,o+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:o}}}function ub(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}function lb(e){let t=e,r=[],o=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(n===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}function db(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function pb(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!tm(r)){let o=rm(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}om.exports={nonSimpleDomain:ib,recomposeAuthority:pb,normalizeComponentEncoding:db,removeDotSegments:lb,isIPv4:tm,isUUID:sb,normalizeIPv6:rm,stringArrayToHexStripped:Yi}});var cm=b((MO,am)=>{"use strict";var{isUUID:fb}=Qi(),mb=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,hb=["http","https","ws","wss","urn","urn:uuid"];function gb(e){return hb.indexOf(e)!==-1}function Xi(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function nm(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function sm(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function _b(e){return e.secure=Xi(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function yb(e){if((e.port===(Xi(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function vb(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(mb);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=ea(n);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function wb(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=ea(n);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function $b(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!fb(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function bb(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var im={scheme:"http",domainHost:!0,parse:nm,serialize:sm},zb={scheme:"https",domainHost:im.domainHost,parse:nm,serialize:sm},_n={scheme:"ws",domainHost:!0,parse:_b,serialize:yb},xb={scheme:"wss",domainHost:_n.domainHost,parse:_n.parse,serialize:_n.serialize},kb={scheme:"urn",parse:vb,serialize:wb,skipNormalize:!0},Sb={scheme:"urn:uuid",parse:$b,serialize:bb,skipNormalize:!0},yn={http:im,https:zb,ws:_n,wss:xb,urn:kb,"urn:uuid":Sb};Object.setPrototypeOf(yn,null);function ea(e){return e&&(yn[e]||yn[e.toLowerCase()])||void 0}am.exports={wsIsSecure:Xi,SCHEMES:yn,isValidSchemeName:gb,getSchemeHandler:ea}});var dm=b((qO,wn)=>{"use strict";var{normalizeIPv6:Pb,removeDotSegments:ro,recomposeAuthority:Tb,normalizeComponentEncoding:vn,isIPv4:Eb,nonSimpleDomain:Rb}=Qi(),{SCHEMES:Ob,getSchemeHandler:um}=cm();function Ib(e,t){return typeof e=="string"?e=Ge(lt(e,t),t):typeof e=="object"&&(e=lt(Ge(e,t),t)),e}function Cb(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=lm(lt(e,o),lt(t,o),o,!0);return o.skipEscape=!0,Ge(n,o)}function lm(e,t,r,o){let n={};return o||(e=lt(Ge(e,r),r),t=lt(Ge(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=ro(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=ro(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=ro(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=ro(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function Nb(e,t,r){return typeof e=="string"?(e=unescape(e),e=Ge(vn(lt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Ge(vn(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Ge(vn(lt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Ge(vn(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function Ge(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],s=um(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=Tb(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=ro(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var jb=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function lt(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let s=e.match(jb);if(s){if(o.scheme=s[1],o.userinfo=s[3],o.host=s[4],o.port=parseInt(s[5],10),o.path=s[6]||"",o.query=s[7],o.fragment=s[8],isNaN(o.port)&&(o.port=s[5]),o.host)if(Eb(o.host)===!1){let c=Pb(o.host);o.host=c.host.toLowerCase(),n=c.isIPV6}else n=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let i=um(r.scheme||o.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&o.host&&(r.domainHost||i&&i.domainHost)&&n===!1&&Rb(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(a){o.error=o.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.skipNormalize)&&(e.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=unescape(o.host))),o.path&&(o.path=escape(unescape(o.path))),o.fragment&&(o.fragment=encodeURI(decodeURIComponent(o.fragment)))),i&&i.parse&&i.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return o}var ta={SCHEMES:Ob,normalize:Ib,resolve:Cb,resolveComponent:lm,equal:Nb,serialize:Ge,parse:lt};wn.exports=ta;wn.exports.default=ta;wn.exports.fastUri=ta});var fm=b(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var pm=dm();pm.code='require("ajv/dist/runtime/uri").default';ra.default=pm});var $m=b(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.CodeGen=de.Name=de.nil=de.stringify=de.str=de._=de.KeywordCxt=void 0;var Ab=eo();Object.defineProperty(de,"KeywordCxt",{enumerable:!0,get:function(){return Ab.KeywordCxt}});var or=C();Object.defineProperty(de,"_",{enumerable:!0,get:function(){return or._}});Object.defineProperty(de,"str",{enumerable:!0,get:function(){return or.str}});Object.defineProperty(de,"stringify",{enumerable:!0,get:function(){return or.stringify}});Object.defineProperty(de,"nil",{enumerable:!0,get:function(){return or.nil}});Object.defineProperty(de,"Name",{enumerable:!0,get:function(){return or.Name}});Object.defineProperty(de,"CodeGen",{enumerable:!0,get:function(){return or.CodeGen}});var Zb=mn(),ym=to(),Mb=Oi(),oo=gn(),qb=C(),no=Yr(),$n=Wr(),na=M(),mm=Xf(),Db=fm(),vm=(e,t)=>new RegExp(e,t);vm.code="new RegExp";var Ub=["removeAdditional","useDefaults","coerceTypes"],Lb=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Fb={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."},Vb={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},hm=200;function Hb(e){var t,r,o,n,s,i,a,c,u,l,p,m,f,g,_,y,v,O,z,T,x,Se,Oe,yr,Dn;let vr=e.strict,Un=(t=e.code)===null||t===void 0?void 0:t.optimize,ic=Un===!0||Un===void 0?1:Un||0,ac=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:vm,fg=(n=e.uriResolver)!==null&&n!==void 0?n:Db.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:vr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:vr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:vr)!==null&&l!==void 0?l:"log",strictTuples:(m=(p=e.strictTuples)!==null&&p!==void 0?p:vr)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:vr)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:ic,regExp:ac}:{optimize:ic,regExp:ac},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:hm,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:hm,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(O=e.messages)!==null&&O!==void 0?O:!0,inlineRefs:(z=e.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(T=e.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(x=e.addUsedSchema)!==null&&x!==void 0?x:!0,validateSchema:(Se=e.validateSchema)!==null&&Se!==void 0?Se:!0,validateFormats:(Oe=e.validateFormats)!==null&&Oe!==void 0?Oe:!0,unicodeRegExp:(yr=e.unicodeRegExp)!==null&&yr!==void 0?yr:!0,int32range:(Dn=e.int32range)!==null&&Dn!==void 0?Dn:!0,uriResolver:fg}}var so=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Hb(t)};let{es5:r,lines:o}=this.opts.code;this.scope=new qb.ValueScope({scope:{},prefixes:Lb,es5:r,lines:o}),this.logger=Yb(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Mb.getRules)(),gm.call(this,Fb,t,"NOT SUPPORTED"),gm.call(this,Vb,t,"DEPRECATED","warn"),this._metaOpts=Gb.call(this),t.formats&&Kb.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Bb.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Jb.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,n=mm;o==="id"&&(n={...mm},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let o;if(typeof t=="string"){if(o=this.getSchema(t),!o)throw new Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,t,r);async function n(l,p){await s.call(this,l.$schema);let m=this._addSchema(l,p);return m.validate||i.call(this,m)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(p){if(!(p instanceof ym.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:p}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${p} cannot be resolved`)}async function c(l){let p=await u.call(this,l);this.refs[l]||await s.call(this,p.$schema),this.refs[l]||this.addSchema(p,l,r)}async function u(l){let p=this._loading[l];if(p)return p;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(t,r,o,n=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,o,n);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,no.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,n,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let o;if(o=t.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,t);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(t){let r;for(;typeof(r=_m.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:o}=this.opts,n=new oo.SchemaEnv({schema:{},schemaId:o});if(r=oo.resolveSchema.call(this,n,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=_m.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let o=t[this.opts.schemaId];return o&&(o=(0,no.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let o;if(typeof t=="string")o=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof t=="object"&&r===void 0){if(r=t,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Xb.call(this,o,r),!r)return(0,na.eachItem)(o,s=>oa.call(this,s)),this;t0.call(this,r);let n={...r,type:(0,$n.getJSONTypes)(r.type),schemaType:(0,$n.getJSONTypes)(r.schemaType)};return(0,na.eachItem)(o,n.type.length===0?s=>oa.call(this,s,n):s=>n.type.forEach(i=>oa.call(this,s,n,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===t);n>=0&&o.rules.splice(n,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(t,r){let o=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let s=n.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=wm(l))}}return t}_removeAllSchemas(t,r){for(let o in t){let n=t[o];(!r||r.test(o))&&(typeof n=="string"?delete t[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[o]))}}_addSchema(t,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;o=(0,no.normalizeId)(i||o);let u=no.getSchemaRefs.call(this,t,o);return c=new oo.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):oo.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{oo.compileSchema.call(this,t)}finally{this.opts=r}}};so.ValidationError=Zb.default;so.MissingRefError=ym.default;de.default=so;function gm(e,t,r,o="error"){for(let n in e){let s=n;s in t&&this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function _m(e){return e=(0,no.normalizeId)(e),this.schemas[e]||this.refs[e]}function Jb(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Kb(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Bb(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function Gb(){let e={...this.opts};for(let t of Ub)delete e[t];return e}var Wb={log(){},warn(){},error(){}};function Yb(e){if(e===!1)return Wb;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var Qb=/^[a-z_$][a-z0-9_$:-]*$/i;function Xb(e,t){let{RULES:r}=this;if((0,na.eachItem)(e,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Qb.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function oa(e,t,r){var o;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,$n.getJSONTypes)(t.type),schemaType:(0,$n.getJSONTypes)(t.schemaType)}};t.before?e0.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function e0(e,t,r){let o=e.rules.findIndex(n=>n.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function t0(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=wm(t)),e.validateSchema=this.compile(t,!0))}var r0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function wm(e){return{anyOf:[e,r0]}}});var bm=b(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var o0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};sa.default=o0});var Sm=b(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.callRef=Nt.getValidate=void 0;var n0=to(),zm=Ze(),ke=C(),nr=ct(),xm=gn(),bn=M(),s0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return p();let l=xm.resolveRef.call(c,u,n,r);if(l===void 0)throw new n0.default(o.opts.uriResolver,n,r);if(l instanceof xm.SchemaEnv)return m(l);return f(l);function p(){if(s===u)return zn(e,i,s,s.$async);let g=t.scopeValue("root",{ref:u});return zn(e,(0,ke._)`${g}.validate`,u,u.$async)}function m(g){let _=km(e,g);zn(e,_,g,g.$async)}function f(g){let _=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,ke.stringify)(g)}:{ref:g}),y=t.name("valid"),v=e.subschema({schema:g,dataTypes:[],schemaPath:ke.nil,topSchemaRef:_,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function km(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,ke._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Nt.getValidate=km;function zn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?nr.default.this:ke.nil;o?l():p();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=n.let("valid");n.try(()=>{n.code((0,ke._)`await ${(0,zm.callValidateCode)(e,t,u)}`),f(t),i||n.assign(g,!0)},_=>{n.if((0,ke._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),m(_),i||n.assign(g,!1)}),e.ok(g)}function p(){e.result((0,zm.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(g){let _=(0,ke._)`${g}.errors`;n.assign(nr.default.vErrors,(0,ke._)`${nr.default.vErrors} === null ? ${_} : ${nr.default.vErrors}.concat(${_})`),n.assign(nr.default.errors,(0,ke._)`${nr.default.vErrors}.length`)}function f(g){var _;if(!s.opts.unevaluated)return;let y=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=bn.mergeEvaluated.props(n,y.props,s.props));else{let v=n.var("props",(0,ke._)`${g}.evaluated.props`);s.props=bn.mergeEvaluated.props(n,v,s.props,ke.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=bn.mergeEvaluated.items(n,y.items,s.items));else{let v=n.var("items",(0,ke._)`${g}.evaluated.items`);s.items=bn.mergeEvaluated.items(n,v,s.items,ke.Name)}}}Nt.callRef=zn;Nt.default=s0});var Pm=b(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var i0=bm(),a0=Sm(),c0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",i0.default,a0.default];ia.default=c0});var Tm=b(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var xn=C(),bt=xn.operators,kn={maximum:{okStr:"<=",ok:bt.LTE,fail:bt.GT},minimum:{okStr:">=",ok:bt.GTE,fail:bt.LT},exclusiveMaximum:{okStr:"<",ok:bt.LT,fail:bt.GTE},exclusiveMinimum:{okStr:">",ok:bt.GT,fail:bt.LTE}},u0={message:({keyword:e,schemaCode:t})=>(0,xn.str)`must be ${kn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,xn._)`{comparison: ${kn[e].okStr}, limit: ${t}}`},l0={keyword:Object.keys(kn),type:"number",schemaType:"number",$data:!0,error:u0,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,xn._)`${r} ${kn[t].fail} ${o} || isNaN(${r})`)}};aa.default=l0});var Em=b(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var io=C(),d0={message:({schemaCode:e})=>(0,io.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,io._)`{multipleOf: ${e}}`},p0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:d0,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,io._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,io._)`${i} !== parseInt(${i})`;e.fail$data((0,io._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};ca.default=p0});var Om=b(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});function Rm(e){let t=e.length,r=0,o=0,n;for(;o<t;)r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t&&(n=e.charCodeAt(o),(n&64512)===56320&&o++);return r}ua.default=Rm;Rm.code='require("ajv/dist/runtime/ucs2length").default'});var Im=b(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});var jt=C(),f0=M(),m0=Om(),h0={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,jt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,jt._)`{limit: ${e}}`},g0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:h0,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?jt.operators.GT:jt.operators.LT,i=n.opts.unicode===!1?(0,jt._)`${r}.length`:(0,jt._)`${(0,f0.useFunc)(e.gen,m0.default)}(${r})`;e.fail$data((0,jt._)`${i} ${s} ${o}`)}};la.default=g0});var Cm=b(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var _0=Ze(),y0=M(),sr=C(),v0={message:({schemaCode:e})=>(0,sr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,sr._)`{pattern: ${e}}`},w0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:v0,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,sr._)`new RegExp`:(0,y0.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,sr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,sr._)`!${l}`)}else{let c=(0,_0.usePattern)(e,n);e.fail$data((0,sr._)`!${c}.test(${r})`)}}};da.default=w0});var Nm=b(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var ao=C(),$0={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ao.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ao._)`{limit: ${e}}`},b0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:$0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?ao.operators.GT:ao.operators.LT;e.fail$data((0,ao._)`Object.keys(${r}).length ${n} ${o}`)}};pa.default=b0});var jm=b(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var co=Ze(),uo=C(),z0=M(),x0={message:({params:{missingProperty:e}})=>(0,uo.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,uo._)`{missingProperty: ${e}}`},k0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:x0,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:g}=e.it;for(let _ of r)if(f?.[_]===void 0&&!g.has(_)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,z0.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(uo.nil,p);else for(let f of r)(0,co.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let g=t.let("valid",!0);e.block$data(g,()=>m(f,g)),e.ok(g)}else t.if((0,co.checkMissingProp)(e,r,f)),(0,co.reportMissingProp)(e,f),t.else()}function p(){t.forOf("prop",o,f=>{e.setParams({missingProperty:f}),t.if((0,co.noPropertyInData)(t,n,f,a.ownProperties),()=>e.error())})}function m(f,g){e.setParams({missingProperty:f}),t.forOf(f,o,()=>{t.assign(g,(0,co.propertyInData)(t,n,f,a.ownProperties)),t.if((0,uo.not)(g),()=>{e.error(),t.break()})},uo.nil)}}};fa.default=k0});var Am=b(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var lo=C(),S0={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,lo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,lo._)`{limit: ${e}}`},P0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:S0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?lo.operators.GT:lo.operators.LT;e.fail$data((0,lo._)`${r}.length ${n} ${o}`)}};ma.default=P0});var Sn=b(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var Zm=qi();Zm.code='require("ajv/dist/runtime/equal").default';ha.default=Zm});var Mm=b(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var ga=Wr(),pe=C(),T0=M(),E0=Sn(),R0={message:({params:{i:e,j:t}})=>(0,pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,pe._)`{i: ${e}, j: ${t}}`},O0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:R0,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=s.items?(0,ga.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,pe._)`${i} === false`),e.ok(c);function l(){let g=t.let("i",(0,pe._)`${r}.length`),_=t.let("j");e.setParams({i:g,j:_}),t.assign(c,!0),t.if((0,pe._)`${g} > 1`,()=>(p()?m:f)(g,_))}function p(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,_){let y=t.name("item"),v=(0,ga.checkDataTypes)(u,y,a.opts.strictNumbers,ga.DataType.Wrong),O=t.const("indices",(0,pe._)`{}`);t.for((0,pe._)`;${g}--;`,()=>{t.let(y,(0,pe._)`${r}[${g}]`),t.if(v,(0,pe._)`continue`),u.length>1&&t.if((0,pe._)`typeof ${y} == "string"`,(0,pe._)`${y} += "_"`),t.if((0,pe._)`typeof ${O}[${y}] == "number"`,()=>{t.assign(_,(0,pe._)`${O}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,pe._)`${O}[${y}] = ${g}`)})}function f(g,_){let y=(0,T0.useFunc)(t,E0.default),v=t.name("outer");t.label(v).for((0,pe._)`;${g}--;`,()=>t.for((0,pe._)`${_} = ${g}; ${_}--;`,()=>t.if((0,pe._)`${y}(${r}[${g}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};_a.default=O0});var qm=b(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var ya=C(),I0=M(),C0=Sn(),N0={message:"must be equal to constant",params:({schemaCode:e})=>(0,ya._)`{allowedValue: ${e}}`},j0={keyword:"const",$data:!0,error:N0,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;o||s&&typeof s=="object"?e.fail$data((0,ya._)`!${(0,I0.useFunc)(t,C0.default)}(${r}, ${n})`):e.fail((0,ya._)`${s} !== ${r}`)}};va.default=j0});var Dm=b(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var po=C(),A0=M(),Z0=Sn(),M0={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,po._)`{allowedValues: ${e}}`},q0={keyword:"enum",schemaType:"array",$data:!0,error:M0,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,A0.useFunc)(t,Z0.default)),l;if(a||o)l=t.let("valid"),e.block$data(l,p);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,po.or)(...n.map((g,_)=>m(f,_)))}e.pass(l);function p(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,po._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,g){let _=n[g];return typeof _=="object"&&_!==null?(0,po._)`${u()}(${r}, ${f}[${g}])`:(0,po._)`${r} === ${_}`}}};wa.default=q0});var Um=b($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var D0=Tm(),U0=Em(),L0=Im(),F0=Cm(),V0=Nm(),H0=jm(),J0=Am(),K0=Mm(),B0=qm(),G0=Dm(),W0=[D0.default,U0.default,L0.default,F0.default,V0.default,H0.default,J0.default,K0.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},B0.default,G0.default];$a.default=W0});var za=b(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.validateAdditionalItems=void 0;var At=C(),ba=M(),Y0={message:({params:{len:e}})=>(0,At.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,At._)`{limit: ${e}}`},Q0={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Y0,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,ba.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Lm(e,o)}};function Lm(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,At._)`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass((0,At._)`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,ba.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,At._)`${a} <= ${t.length}`);r.if((0,At.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:ba.Type.Num},u),i.allErrors||r.if((0,At.not)(u),()=>r.break())})}}fo.validateAdditionalItems=Lm;fo.default=Q0});var xa=b(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.validateTuple=void 0;var Fm=C(),Pn=M(),X0=Ze(),ez={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Vm(e,"additionalItems",t);r.items=!0,!(0,Pn.alwaysValidSchema)(r,t)&&e.ok((0,X0.validateArray)(e))}};function Vm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Pn.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Fm._)`${s}.length`);r.forEach((p,m)=>{(0,Pn.alwaysValidSchema)(a,p)||(o.if((0,Fm._)`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(p){let{opts:m,errSchemaPath:f}=a,g=r.length,_=g===p.minItems&&(g===p.maxItems||p[t]===!1);if(m.strictTuples&&!_){let y=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Pn.checkStrictMode)(a,y,m.strictTuples)}}}mo.validateTuple=Vm;mo.default=ez});var Hm=b(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var tz=xa(),rz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,tz.validateTuple)(e,"items")};ka.default=rz});var Km=b(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var Jm=C(),oz=M(),nz=Ze(),sz=za(),iz={message:({params:{len:e}})=>(0,Jm.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Jm._)`{limit: ${e}}`},az={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:iz,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;o.items=!0,!(0,oz.alwaysValidSchema)(o,t)&&(n?(0,sz.validateAdditionalItems)(e,n):e.ok((0,nz.validateArray)(e)))}};Sa.default=az});var Bm=b(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var qe=C(),Tn=M(),cz={message:({params:{min:e,max:t}})=>t===void 0?(0,qe.str)`must contain at least ${e} valid item(s)`:(0,qe.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,qe._)`{minContains: ${e}}`:(0,qe._)`{minContains: ${e}, maxContains: ${t}}`},uz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:cz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,qe._)`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Tn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Tn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Tn.alwaysValidSchema)(s,r)){let _=(0,qe._)`${l} >= ${i}`;a!==void 0&&(_=(0,qe._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let p=t.name("valid");a===void 0&&i===1?f(p,()=>t.if(p,()=>t.break())):i===0?(t.let(p,!0),a!==void 0&&t.if((0,qe._)`${n}.length > 0`,m)):(t.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let _=t.name("_valid"),y=t.let("count",0);f(_,()=>t.if(_,()=>g(y)))}function f(_,y){t.forRange("i",0,l,v=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Tn.Type.Num,compositeRule:!0},_),y()})}function g(_){t.code((0,qe._)`${_}++`),a===void 0?t.if((0,qe._)`${_} >= ${i}`,()=>t.assign(p,!0).break()):(t.if((0,qe._)`${_} > ${a}`,()=>t.assign(p,!1).break()),i===1?t.assign(p,!0):t.if((0,qe._)`${_} >= ${i}`,()=>t.assign(p,!0)))}}};Pa.default=uz});var Ym=b(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.validateSchemaDeps=We.validatePropertyDeps=We.error=void 0;var Ta=C(),lz=M(),ho=Ze();We.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return(0,Ta.str)`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,Ta._)`{property: ${e},
6
+ || ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function Kw({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,I._)`${t} !== undefined`,()=>e.assign((0,I._)`${t}[${r}]`,o))}function Ci(e,t,r,o=Xt.Correct){let n=o===Xt.Correct?I.operators.EQ:I.operators.NEQ,s;switch(e){case"null":return(0,I._)`${t} ${n} null`;case"array":s=(0,I._)`Array.isArray(${t})`;break;case"object":s=(0,I._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,I._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${t} ${n} ${e}`}return o===Xt.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${t} == "number"`,a,r?(0,I._)`isFinite(${t})`:I.nil)}}ge.checkDataType=Ci;function Ni(e,t,r,o){if(e.length===1)return Ci(e[0],t,r,o);let n,s=(0,wf.toHash)(e);if(s.array&&s.object){let i=(0,I._)`typeof ${t} != "object"`;n=s.null?i:(0,I._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,Ci(i,t,r,o));return n}ge.checkDataTypes=Ni;var Bw={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,I._)`{type: ${e}}`:(0,I._)`{type: ${t}}`};function ji(e){let t=Gw(e);(0,Lw.reportError)(t,Bw)}ge.reportTypeError=ji;function Gw(e){let{gen:t,data:r,schema:o}=e,n=(0,wf.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var xf=b(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.assignDefaults=void 0;var er=C(),Ww=M();function Yw(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)zf(e,n,r[n].default);else t==="array"&&Array.isArray(o)&&o.forEach((n,s)=>zf(e,s,n.default))}ln.assignDefaults=Yw;function zf(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=(0,er._)`${s}${(0,er.getProperty)(t)}`;if(n){(0,Ww.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,er._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,er._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,er._)`${a} = ${(0,er.stringify)(r)}`)}});var Ze=b(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var W=C(),Ai=M(),yt=ct(),Qw=M();function Xw(e,t){let{gen:r,data:o,it:n}=e;r.if(Mi(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,W._)`${t}`},!0),e.error()})}V.checkReportMissingProp=Xw;function e$({gen:e,data:t,it:{opts:r}},o,n){return(0,W.or)(...o.map(s=>(0,W.and)(Mi(e,t,s,r.ownProperties),(0,W._)`${n} = ${s}`)))}V.checkMissingProp=e$;function t$(e,t){e.setParams({missingProperty:t},!0),e.error()}V.reportMissingProp=t$;function kf(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=kf;function Zi(e,t,r){return(0,W._)`${kf(e)}.call(${t}, ${r})`}V.isOwnProperty=Zi;function r$(e,t,r,o){let n=(0,W._)`${t}${(0,W.getProperty)(r)} !== undefined`;return o?(0,W._)`${n} && ${Zi(e,t,r)}`:n}V.propertyInData=r$;function Mi(e,t,r,o){let n=(0,W._)`${t}${(0,W.getProperty)(r)} === undefined`;return o?(0,W.or)(n,(0,W.not)(Zi(e,t,r))):n}V.noPropertyInData=Mi;function Sf(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}V.allSchemaProperties=Sf;function o$(e,t){return Sf(t).filter(r=>!(0,Ai.alwaysValidSchema)(e,t[r]))}V.schemaProperties=o$;function n$({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,W._)`${e}, ${t}, ${o}${n}`:t,p=[[yt.default.instancePath,(0,W.strConcat)(yt.default.instancePath,s)],[yt.default.parentData,i.parentData],[yt.default.parentDataProperty,i.parentDataProperty],[yt.default.rootData,yt.default.rootData]];i.opts.dynamicRef&&p.push([yt.default.dynamicAnchors,yt.default.dynamicAnchors]);let m=(0,W._)`${l}, ${r.object(...p)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${m})`:(0,W._)`${a}(${m})`}V.callValidateCode=n$;var s$=(0,W._)`new RegExp`;function i$({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,W._)`${n.code==="new RegExp"?s$:(0,Qw.useFunc)(e,n)}(${r}, ${o})`})}V.usePattern=i$;function a$(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,W._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:Ai.Type.Num},s),t.if((0,W.not)(s),a)})}}V.validateArray=a$;function c$(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ai.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,W._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,W.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}V.validateUnion=c$});var Ef=b(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateKeywordUsage=Ke.validSchemaType=Ke.funcKeywordCode=Ke.macroKeywordCode=void 0;var ve=C(),It=ct(),u$=Ze(),l$=Gr();function d$(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=Tf(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:ve.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Ke.macroKeywordCode=d$;function p$(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;m$(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Tf(o,n,u),p=o.let("valid");e.block$data(p,m),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function m(){if(t.errors===!1)_(),t.modifying&&Pf(e),y(()=>e.error());else{let v=t.async?f():g();t.modifying&&Pf(e),y(()=>f$(e,v))}}function f(){let v=o.let("ruleErrs",null);return o.try(()=>_((0,ve._)`await `),O=>o.assign(p,!1).if((0,ve._)`${O} instanceof ${c.ValidationError}`,()=>o.assign(v,(0,ve._)`${O}.errors`),()=>o.throw(O))),v}function g(){let v=(0,ve._)`${l}.errors`;return o.assign(v,null),_(ve.nil),v}function _(v=t.async?(0,ve._)`await `:ve.nil){let O=c.opts.passContext?It.default.this:It.default.self,x=!("compile"in t&&!a||t.schema===!1);o.assign(p,(0,ve._)`${v}${(0,u$.callValidateCode)(e,l,O,x)}`,t.modifying)}function y(v){var O;o.if((0,ve.not)((O=t.valid)!==null&&O!==void 0?O:p),v)}}Ke.funcKeywordCode=p$;function Pf(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,ve._)`${o.parentData}[${o.parentDataProperty}]`))}function f$(e,t){let{gen:r}=e;r.if((0,ve._)`Array.isArray(${t})`,()=>{r.assign(It.default.vErrors,(0,ve._)`${It.default.vErrors} === null ? ${t} : ${It.default.vErrors}.concat(${t})`).assign(It.default.errors,(0,ve._)`${It.default.vErrors}.length`),(0,l$.extendErrors)(e)},()=>e.error())}function m$({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Tf(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ve.stringify)(r)})}function h$(e,t,r=!1){return!t.length||t.some(o=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}Ke.validSchemaType=h$;function g$({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ke.validateKeywordUsage=g$});var Of=b(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.extendSubschemaMode=vt.extendSubschemaData=vt.getSubschema=void 0;var Be=C(),Rf=M();function _$(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Be._)`${e.schemaPath}${(0,Be.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Be._)`${e.schemaPath}${(0,Be.getProperty)(t)}${(0,Be.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Rf.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}vt.getSubschema=_$;function y$(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:p}=t,m=a.let("data",(0,Be._)`${t.data}${(0,Be.getProperty)(r)}`,!0);c(m),e.errorPath=(0,Be.str)`${u}${(0,Rf.getErrorPath)(r,o,p.jsPropertySyntax)}`,e.parentDataProperty=(0,Be._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof Be.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}vt.extendSubschemaData=y$;function v$(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(e.compositeRule=o),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}vt.extendSubschemaMode=v$});var Di=b((NO,If)=>{"use strict";If.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Nf=b((jO,Cf)=>{"use strict";var wt=Cf.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};dn(t,o,n,e,"",e)};wt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};wt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};wt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};wt.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 dn(e,t,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,u);for(var l in o){var p=o[l];if(Array.isArray(p)){if(l in wt.arrayKeywords)for(var m=0;m<p.length;m++)dn(e,t,r,p[m],n+"/"+l+"/"+m,s,n,l,o,m)}else if(l in wt.propsKeywords){if(p&&typeof p=="object")for(var f in p)dn(e,t,r,p[f],n+"/"+l+"/"+w$(f),s,n,l,o,f)}else(l in wt.keywords||e.allKeys&&!(l in wt.skipKeywords))&&dn(e,t,r,p,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function w$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Yr=b(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.getSchemaRefs=xe.resolveUrl=xe.normalizeId=xe._getFullPath=xe.getFullPath=xe.inlineRef=void 0;var $$=M(),b$=Di(),z$=Nf(),x$=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function k$(e,t=!0){return typeof e=="boolean"?!0:t===!0?!qi(e):t?jf(e)<=t:!1}xe.inlineRef=k$;var S$=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qi(e){for(let t in e){if(S$.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(qi)||typeof r=="object"&&qi(r))return!0}return!1}function jf(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!x$.has(r)&&(typeof e[r]=="object"&&(0,$$.eachItem)(e[r],o=>t+=jf(o)),t===1/0))return 1/0}return t}function Af(e,t="",r){r!==!1&&(t=tr(t));let o=e.parse(t);return Zf(e,o)}xe.getFullPath=Af;function Zf(e,t){return e.serialize(t).split("#")[0]+"#"}xe._getFullPath=Zf;var P$=/#\/?$/;function tr(e){return e?e.replace(P$,""):""}xe.normalizeId=tr;function T$(e,t,r){return r=tr(r),e.resolve(t,r)}xe.resolveUrl=T$;var E$=/^[a-z_][-a-z0-9._]*$/i;function R$(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=tr(e[r]||t),s={"":n},i=Af(o,n,!1),a={},c=new Set;return z$(e,{allKeys:!0},(p,m,f,g)=>{if(g===void 0)return;let _=i+m,y=s[g];typeof p[r]=="string"&&(y=v.call(this,p[r])),O.call(this,p.$anchor),O.call(this,p.$dynamicAnchor),s[m]=y;function v(x){let E=this.opts.uriResolver.resolve;if(x=tr(y?E(y,x):x),c.has(x))throw l(x);c.add(x);let k=this.refs[x];return typeof k=="string"&&(k=this.refs[k]),typeof k=="object"?u(p,k.schema,x):x!==tr(_)&&(x[0]==="#"?(u(p,a[x],x),a[x]=p):this.refs[x]=_),x}function O(x){if(typeof x=="string"){if(!E$.test(x))throw new Error(`invalid anchor "${x}"`);v.call(this,`#${x}`)}}}),a;function u(p,m,f){if(m!==void 0&&!b$(p,m))throw l(f)}function l(p){return new Error(`reference "${p}" resolves to more than one schema`)}}xe.getSchemaRefs=R$});var eo=b($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.getData=$t.KeywordCxt=$t.validateFunctionCode=void 0;var Lf=_f(),Mf=Wr(),Li=Ii(),pn=Wr(),O$=xf(),Xr=Ef(),Ui=Of(),P=C(),R=ct(),I$=Yr(),ut=M(),Qr=Gr();function C$(e){if(Hf(e)&&(Jf(e),Vf(e))){A$(e);return}Ff(e,()=>(0,Lf.topBoolOrEmptySchema)(e))}$t.validateFunctionCode=C$;function Ff({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){n.code.es5?e.func(t,(0,P._)`${R.default.data}, ${R.default.valCxt}`,o.$async,()=>{e.code((0,P._)`"use strict"; ${Df(r,n)}`),j$(e,n),e.code(s)}):e.func(t,(0,P._)`${R.default.data}, ${N$(n)}`,o.$async,()=>e.code(Df(r,n)).code(s))}function N$(e){return(0,P._)`{${R.default.instancePath}="", ${R.default.parentData}, ${R.default.parentDataProperty}, ${R.default.rootData}=${R.default.data}${e.dynamicRef?(0,P._)`, ${R.default.dynamicAnchors}={}`:P.nil}}={}`}function j$(e,t){e.if(R.default.valCxt,()=>{e.var(R.default.instancePath,(0,P._)`${R.default.valCxt}.${R.default.instancePath}`),e.var(R.default.parentData,(0,P._)`${R.default.valCxt}.${R.default.parentData}`),e.var(R.default.parentDataProperty,(0,P._)`${R.default.valCxt}.${R.default.parentDataProperty}`),e.var(R.default.rootData,(0,P._)`${R.default.valCxt}.${R.default.rootData}`),t.dynamicRef&&e.var(R.default.dynamicAnchors,(0,P._)`${R.default.valCxt}.${R.default.dynamicAnchors}`)},()=>{e.var(R.default.instancePath,(0,P._)`""`),e.var(R.default.parentData,(0,P._)`undefined`),e.var(R.default.parentDataProperty,(0,P._)`undefined`),e.var(R.default.rootData,R.default.data),t.dynamicRef&&e.var(R.default.dynamicAnchors,(0,P._)`{}`)})}function A$(e){let{schema:t,opts:r,gen:o}=e;Ff(e,()=>{r.$comment&&t.$comment&&Bf(e),U$(e),o.let(R.default.vErrors,null),o.let(R.default.errors,0),r.unevaluated&&Z$(e),Kf(e),V$(e)})}function Z$(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,P._)`${r}.evaluated`),t.if((0,P._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,P._)`${e.evaluated}.props`,(0,P._)`undefined`)),t.if((0,P._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,P._)`${e.evaluated}.items`,(0,P._)`undefined`))}function Df(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,P._)`/*# sourceURL=${r} */`:P.nil}function M$(e,t){if(Hf(e)&&(Jf(e),Vf(e))){D$(e,t);return}(0,Lf.boolOrEmptySchema)(e,t)}function Vf({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Hf(e){return typeof e.schema!="boolean"}function D$(e,t){let{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&Bf(e),L$(e),F$(e);let s=o.const("_errs",R.default.errors);Kf(e,s),o.var(t,(0,P._)`${s} === ${R.default.errors}`)}function Jf(e){(0,ut.checkUnknownRules)(e),q$(e)}function Kf(e,t){if(e.opts.jtd)return qf(e,[],!1,t);let r=(0,Mf.getSchemaTypes)(e.schema),o=(0,Mf.coerceAndCheckDataType)(e,r);qf(e,r,!o,t)}function q$(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,ut.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function U$(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ut.checkStrictMode)(e,"default is ignored in the schema root")}function L$(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,I$.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function F$(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Bf({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,P._)`${R.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,P.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,P._)`${R.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function V$(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;r.$async?t.if((0,P._)`${R.default.errors} === 0`,()=>t.return(R.default.data),()=>t.throw((0,P._)`new ${n}(${R.default.vErrors})`)):(t.assign((0,P._)`${o}.errors`,R.default.vErrors),s.unevaluated&&H$(e),t.return((0,P._)`${R.default.errors} === 0`))}function H$({gen:e,evaluated:t,props:r,items:o}){r instanceof P.Name&&e.assign((0,P._)`${t}.props`,r),o instanceof P.Name&&e.assign((0,P._)`${t}.items`,o)}function qf(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ut.schemaHasRulesButRef)(s,l))){n.block(()=>Wf(e,"$ref",l.all.$ref.definition));return}c.jtd||J$(e,t),n.block(()=>{for(let m of l.rules)p(m);p(l.post)});function p(m){(0,Li.shouldUseGroup)(s,m)&&(m.type?(n.if((0,pn.checkDataType)(m.type,i,c.strictNumbers)),Uf(e,m),t.length===1&&t[0]===m.type&&r&&(n.else(),(0,pn.reportTypeError)(e)),n.endIf()):Uf(e,m),a||n.if((0,P._)`${R.default.errors} === ${o||0}`))}}function Uf(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;n&&(0,O$.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Li.shouldUseRule)(o,s)&&Wf(e,s.keyword,s.definition,t.type)})}function J$(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(K$(e,t),e.opts.allowUnionTypes||B$(e,t),G$(e,e.dataTypes))}function K$(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Gf(e.dataTypes,r)||Fi(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Y$(e,t)}}function B$(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Fi(e,"use allowUnionTypes to allow union type keyword")}function G$(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Li.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>W$(t,i))&&Fi(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function W$(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Gf(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Y$(e,t){let r=[];for(let o of e.dataTypes)Gf(t,o)?r.push(o):t.includes("integer")&&o==="number"&&r.push("integer");e.dataTypes=r}function Fi(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,ut.checkStrictMode)(e,t,e.opts.strictTypes)}var fn=class{constructor(t,r,o){if((0,Xr.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ut.schemaRefOrVal)(t,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Yf(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Xr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",R.default.errors))}result(t,r,o){this.failResult((0,P.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,P.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,P._)`${r} !== undefined && (${(0,P.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?Qr.reportExtraError:Qr.reportError)(this,this.def.error,r)}$dataError(){(0,Qr.reportError)(this,this.def.$dataError||Qr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Qr.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,o=P.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=P.nil,r=P.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,P.or)((0,P._)`${n} === undefined`,r)),t!==P.nil&&o.assign(t,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==P.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,P.or)(i(),a());function i(){if(o.length){if(!(r instanceof P.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,P._)`${(0,pn.checkDataTypes)(c,r,s.opts.strictNumbers,pn.DataType.Wrong)}`}return P.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,P._)`!${c}(${r})`}return P.nil}}subschema(t,r){let o=(0,Ui.getSubschema)(this.it,t);(0,Ui.extendSubschemaData)(o,this.it,t),(0,Ui.extendSubschemaMode)(o,t);let n={...this.it,...o,items:void 0,props:void 0};return M$(n,r),n}mergeEvaluated(t,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&t.props!==void 0&&(o.props=ut.mergeEvaluated.props(n,t.props,o.props,r)),o.items!==!0&&t.items!==void 0&&(o.items=ut.mergeEvaluated.items(n,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,P.Name)),!0}};$t.KeywordCxt=fn;function Wf(e,t,r,o){let n=new fn(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Xr.funcKeywordCode)(n,r):"macro"in r?(0,Xr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Xr.funcKeywordCode)(n,r)}var Q$=/^\/(?:[^~]|~0|~1)*$/,X$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yf(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return R.default.rootData;if(e[0]==="/"){if(!Q$.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,s=R.default.rootData}else{let u=X$.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=t)throw new Error(c("property/index",l));return o[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,P._)`${s}${(0,P.getProperty)((0,ut.unescapeJsonPointer)(u))}`,i=(0,P._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}$t.getData=Yf});var mn=b(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Vi=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Hi.default=Vi});var to=b(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var Ji=Yr(),Ki=class extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Ji.resolveUrl)(t,r,o),this.missingSchema=(0,Ji.normalizeId)((0,Ji.getFullPath)(t,this.missingRef))}};Bi.default=Ki});var gn=b(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.resolveSchema=Me.getCompilingSchema=Me.resolveRef=Me.compileSchema=Me.SchemaEnv=void 0;var Le=C(),eb=mn(),Ct=ct(),Fe=Yr(),Qf=M(),tb=eo(),rr=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let o;typeof t.schema=="object"&&(o=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Fe.normalizeId)(o?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=o?.$async,this.refs={}}};Me.SchemaEnv=rr;function Wi(e){let t=Xf.call(this,e);if(t)return t;let r=(0,Fe.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Le.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:eb.default,code:(0,Le._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ct.default.data,parentData:Ct.default.parentData,parentDataProperty:Ct.default.parentDataProperty,dataNames:[Ct.default.data],dataPathArr:[Le.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Le.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Le.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Le._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,tb.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let p=i.toString();l=`${i.scopeRefs(Ct.default.scope)}return ${p}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Ct.default.self}`,`${Ct.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:p,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:_}=u;f.evaluated={props:g instanceof Le.Name?void 0:g,items:_ instanceof Le.Name?void 0:_,dynamicProps:g instanceof Le.Name,dynamicItems:_ instanceof Le.Name},f.source&&(f.source.evaluated=(0,Le.stringify)(f.evaluated))}return e.validate=f,e}catch(p){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),p}finally{this._compilations.delete(e)}}Me.compileSchema=Wi;function rb(e,t,r){var o;r=(0,Fe.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=sb.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new rr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=ob.call(this,s)}Me.resolveRef=rb;function ob(e){return(0,Fe.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Wi.call(this,e)}function Xf(e){for(let t of this._compilations)if(nb(t,e))return t}Me.getCompilingSchema=Xf;function nb(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function sb(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||hn.call(this,e,t)}function hn(e,t){let r=this.opts.uriResolver.parse(t),o=(0,Fe._getFullPath)(this.opts.uriResolver,r),n=(0,Fe.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return Gi.call(this,r,e);let s=(0,Fe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=hn.call(this,e,i);return typeof a?.schema!="object"?void 0:Gi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Wi.call(this,i),s===(0,Fe.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Fe.resolveUrl)(this.opts.uriResolver,n,u)),new rr({schema:a,schemaId:c,root:e,baseId:n})}return Gi.call(this,r,i)}}Me.resolveSchema=hn;var ib=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Gi(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Qf.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!ib.has(a)&&u&&(t=(0,Fe.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Qf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Fe.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=hn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new rr({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s}});var em=b((UO,ab)=>{ab.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 Qi=b((LO,nm)=>{"use strict";var cb=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),rm=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 Yi(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(r=e[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var ub=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function tm(e){return e.length=0,!0}function lb(e,t,r){if(e.length){let o=Yi(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function db(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=lb;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=tm}else{n.push(u);continue}}return n.length&&(a===tm?r.zone=n.join(""):i?o.push(n.join("")):o.push(Yi(n))),r.address=o.join(""),r}function om(e){if(pb(e,":")<2)return{host:e,isIPV6:!1};let t=db(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,o=t.address;return t.zone&&(r+="%"+t.zone,o+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:o}}}function pb(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}function fb(e){let t=e,r=[],o=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(n===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}function mb(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function hb(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!rm(r)){let o=om(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}nm.exports={nonSimpleDomain:ub,recomposeAuthority:hb,normalizeComponentEncoding:mb,removeDotSegments:fb,isIPv4:rm,isUUID:cb,normalizeIPv6:om,stringArrayToHexStripped:Yi}});var um=b((FO,cm)=>{"use strict";var{isUUID:gb}=Qi(),_b=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,yb=["http","https","ws","wss","urn","urn:uuid"];function vb(e){return yb.indexOf(e)!==-1}function Xi(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function sm(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function im(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function wb(e){return e.secure=Xi(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function $b(e){if((e.port===(Xi(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function bb(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(_b);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=ea(n);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function zb(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=ea(n);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function xb(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!gb(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function kb(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var am={scheme:"http",domainHost:!0,parse:sm,serialize:im},Sb={scheme:"https",domainHost:am.domainHost,parse:sm,serialize:im},_n={scheme:"ws",domainHost:!0,parse:wb,serialize:$b},Pb={scheme:"wss",domainHost:_n.domainHost,parse:_n.parse,serialize:_n.serialize},Tb={scheme:"urn",parse:bb,serialize:zb,skipNormalize:!0},Eb={scheme:"urn:uuid",parse:xb,serialize:kb,skipNormalize:!0},yn={http:am,https:Sb,ws:_n,wss:Pb,urn:Tb,"urn:uuid":Eb};Object.setPrototypeOf(yn,null);function ea(e){return e&&(yn[e]||yn[e.toLowerCase()])||void 0}cm.exports={wsIsSecure:Xi,SCHEMES:yn,isValidSchemeName:vb,getSchemeHandler:ea}});var pm=b((VO,wn)=>{"use strict";var{normalizeIPv6:Rb,removeDotSegments:ro,recomposeAuthority:Ob,normalizeComponentEncoding:vn,isIPv4:Ib,nonSimpleDomain:Cb}=Qi(),{SCHEMES:Nb,getSchemeHandler:lm}=um();function jb(e,t){return typeof e=="string"?e=Ge(lt(e,t),t):typeof e=="object"&&(e=lt(Ge(e,t),t)),e}function Ab(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=dm(lt(e,o),lt(t,o),o,!0);return o.skipEscape=!0,Ge(n,o)}function dm(e,t,r,o){let n={};return o||(e=lt(Ge(e,r),r),t=lt(Ge(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=ro(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=ro(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=ro(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=ro(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function Zb(e,t,r){return typeof e=="string"?(e=unescape(e),e=Ge(vn(lt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Ge(vn(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Ge(vn(lt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Ge(vn(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function Ge(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],s=lm(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=Ob(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=ro(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var Mb=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function lt(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let s=e.match(Mb);if(s){if(o.scheme=s[1],o.userinfo=s[3],o.host=s[4],o.port=parseInt(s[5],10),o.path=s[6]||"",o.query=s[7],o.fragment=s[8],isNaN(o.port)&&(o.port=s[5]),o.host)if(Ib(o.host)===!1){let c=Rb(o.host);o.host=c.host.toLowerCase(),n=c.isIPV6}else n=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let i=lm(r.scheme||o.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&o.host&&(r.domainHost||i&&i.domainHost)&&n===!1&&Cb(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(a){o.error=o.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.skipNormalize)&&(e.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=unescape(o.host))),o.path&&(o.path=escape(unescape(o.path))),o.fragment&&(o.fragment=encodeURI(decodeURIComponent(o.fragment)))),i&&i.parse&&i.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return o}var ta={SCHEMES:Nb,normalize:jb,resolve:Ab,resolveComponent:dm,equal:Zb,serialize:Ge,parse:lt};wn.exports=ta;wn.exports.default=ta;wn.exports.fastUri=ta});var mm=b(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var fm=pm();fm.code='require("ajv/dist/runtime/uri").default';ra.default=fm});var bm=b(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.CodeGen=de.Name=de.nil=de.stringify=de.str=de._=de.KeywordCxt=void 0;var Db=eo();Object.defineProperty(de,"KeywordCxt",{enumerable:!0,get:function(){return Db.KeywordCxt}});var or=C();Object.defineProperty(de,"_",{enumerable:!0,get:function(){return or._}});Object.defineProperty(de,"str",{enumerable:!0,get:function(){return or.str}});Object.defineProperty(de,"stringify",{enumerable:!0,get:function(){return or.stringify}});Object.defineProperty(de,"nil",{enumerable:!0,get:function(){return or.nil}});Object.defineProperty(de,"Name",{enumerable:!0,get:function(){return or.Name}});Object.defineProperty(de,"CodeGen",{enumerable:!0,get:function(){return or.CodeGen}});var qb=mn(),vm=to(),Ub=Oi(),oo=gn(),Lb=C(),no=Yr(),$n=Wr(),na=M(),hm=em(),Fb=mm(),wm=(e,t)=>new RegExp(e,t);wm.code="new RegExp";var Vb=["removeAdditional","useDefaults","coerceTypes"],Hb=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Jb={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."},Kb={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},gm=200;function Bb(e){var t,r,o,n,s,i,a,c,u,l,p,m,f,g,_,y,v,O,x,E,k,Se,Oe,yr,qn;let vr=e.strict,Un=(t=e.code)===null||t===void 0?void 0:t.optimize,ac=Un===!0||Un===void 0?1:Un||0,cc=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:wm,gg=(n=e.uriResolver)!==null&&n!==void 0?n:Fb.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:vr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:vr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:vr)!==null&&l!==void 0?l:"log",strictTuples:(m=(p=e.strictTuples)!==null&&p!==void 0?p:vr)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:vr)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:ac,regExp:cc}:{optimize:ac,regExp:cc},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:gm,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:gm,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(O=e.messages)!==null&&O!==void 0?O:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(k=e.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:(Se=e.validateSchema)!==null&&Se!==void 0?Se:!0,validateFormats:(Oe=e.validateFormats)!==null&&Oe!==void 0?Oe:!0,unicodeRegExp:(yr=e.unicodeRegExp)!==null&&yr!==void 0?yr:!0,int32range:(qn=e.int32range)!==null&&qn!==void 0?qn:!0,uriResolver:gg}}var so=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Bb(t)};let{es5:r,lines:o}=this.opts.code;this.scope=new Lb.ValueScope({scope:{},prefixes:Hb,es5:r,lines:o}),this.logger=e0(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Ub.getRules)(),_m.call(this,Jb,t,"NOT SUPPORTED"),_m.call(this,Kb,t,"DEPRECATED","warn"),this._metaOpts=Qb.call(this),t.formats&&Wb.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Yb.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Gb.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,n=hm;o==="id"&&(n={...hm},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let o;if(typeof t=="string"){if(o=this.getSchema(t),!o)throw new Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,t,r);async function n(l,p){await s.call(this,l.$schema);let m=this._addSchema(l,p);return m.validate||i.call(this,m)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(p){if(!(p instanceof vm.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:p}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${p} cannot be resolved`)}async function c(l){let p=await u.call(this,l);this.refs[l]||await s.call(this,p.$schema),this.refs[l]||this.addSchema(p,l,r)}async function u(l){let p=this._loading[l];if(p)return p;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(t,r,o,n=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,o,n);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,no.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,n,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let o;if(o=t.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,t);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(t){let r;for(;typeof(r=ym.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:o}=this.opts,n=new oo.SchemaEnv({schema:{},schemaId:o});if(r=oo.resolveSchema.call(this,n,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=ym.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let o=t[this.opts.schemaId];return o&&(o=(0,no.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let o;if(typeof t=="string")o=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof t=="object"&&r===void 0){if(r=t,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(r0.call(this,o,r),!r)return(0,na.eachItem)(o,s=>oa.call(this,s)),this;n0.call(this,r);let n={...r,type:(0,$n.getJSONTypes)(r.type),schemaType:(0,$n.getJSONTypes)(r.schemaType)};return(0,na.eachItem)(o,n.type.length===0?s=>oa.call(this,s,n):s=>n.type.forEach(i=>oa.call(this,s,n,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===t);n>=0&&o.rules.splice(n,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(t,r){let o=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let s=n.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=$m(l))}}return t}_removeAllSchemas(t,r){for(let o in t){let n=t[o];(!r||r.test(o))&&(typeof n=="string"?delete t[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[o]))}}_addSchema(t,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;o=(0,no.normalizeId)(i||o);let u=no.getSchemaRefs.call(this,t,o);return c=new oo.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):oo.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{oo.compileSchema.call(this,t)}finally{this.opts=r}}};so.ValidationError=qb.default;so.MissingRefError=vm.default;de.default=so;function _m(e,t,r,o="error"){for(let n in e){let s=n;s in t&&this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function ym(e){return e=(0,no.normalizeId)(e),this.schemas[e]||this.refs[e]}function Gb(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Wb(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Yb(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function Qb(){let e={...this.opts};for(let t of Vb)delete e[t];return e}var Xb={log(){},warn(){},error(){}};function e0(e){if(e===!1)return Xb;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var t0=/^[a-z_$][a-z0-9_$:-]*$/i;function r0(e,t){let{RULES:r}=this;if((0,na.eachItem)(e,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!t0.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function oa(e,t,r){var o;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,$n.getJSONTypes)(t.type),schemaType:(0,$n.getJSONTypes)(t.schemaType)}};t.before?o0.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function o0(e,t,r){let o=e.rules.findIndex(n=>n.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function n0(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=$m(t)),e.validateSchema=this.compile(t,!0))}var s0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function $m(e){return{anyOf:[e,s0]}}});var zm=b(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var i0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};sa.default=i0});var Pm=b(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.callRef=Nt.getValidate=void 0;var a0=to(),xm=Ze(),ke=C(),nr=ct(),km=gn(),bn=M(),c0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return p();let l=km.resolveRef.call(c,u,n,r);if(l===void 0)throw new a0.default(o.opts.uriResolver,n,r);if(l instanceof km.SchemaEnv)return m(l);return f(l);function p(){if(s===u)return zn(e,i,s,s.$async);let g=t.scopeValue("root",{ref:u});return zn(e,(0,ke._)`${g}.validate`,u,u.$async)}function m(g){let _=Sm(e,g);zn(e,_,g,g.$async)}function f(g){let _=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,ke.stringify)(g)}:{ref:g}),y=t.name("valid"),v=e.subschema({schema:g,dataTypes:[],schemaPath:ke.nil,topSchemaRef:_,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function Sm(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,ke._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Nt.getValidate=Sm;function zn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?nr.default.this:ke.nil;o?l():p();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=n.let("valid");n.try(()=>{n.code((0,ke._)`await ${(0,xm.callValidateCode)(e,t,u)}`),f(t),i||n.assign(g,!0)},_=>{n.if((0,ke._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),m(_),i||n.assign(g,!1)}),e.ok(g)}function p(){e.result((0,xm.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(g){let _=(0,ke._)`${g}.errors`;n.assign(nr.default.vErrors,(0,ke._)`${nr.default.vErrors} === null ? ${_} : ${nr.default.vErrors}.concat(${_})`),n.assign(nr.default.errors,(0,ke._)`${nr.default.vErrors}.length`)}function f(g){var _;if(!s.opts.unevaluated)return;let y=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=bn.mergeEvaluated.props(n,y.props,s.props));else{let v=n.var("props",(0,ke._)`${g}.evaluated.props`);s.props=bn.mergeEvaluated.props(n,v,s.props,ke.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=bn.mergeEvaluated.items(n,y.items,s.items));else{let v=n.var("items",(0,ke._)`${g}.evaluated.items`);s.items=bn.mergeEvaluated.items(n,v,s.items,ke.Name)}}}Nt.callRef=zn;Nt.default=c0});var Tm=b(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var u0=zm(),l0=Pm(),d0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",u0.default,l0.default];ia.default=d0});var Em=b(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var xn=C(),bt=xn.operators,kn={maximum:{okStr:"<=",ok:bt.LTE,fail:bt.GT},minimum:{okStr:">=",ok:bt.GTE,fail:bt.LT},exclusiveMaximum:{okStr:"<",ok:bt.LT,fail:bt.GTE},exclusiveMinimum:{okStr:">",ok:bt.GT,fail:bt.LTE}},p0={message:({keyword:e,schemaCode:t})=>(0,xn.str)`must be ${kn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,xn._)`{comparison: ${kn[e].okStr}, limit: ${t}}`},f0={keyword:Object.keys(kn),type:"number",schemaType:"number",$data:!0,error:p0,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,xn._)`${r} ${kn[t].fail} ${o} || isNaN(${r})`)}};aa.default=f0});var Rm=b(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var io=C(),m0={message:({schemaCode:e})=>(0,io.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,io._)`{multipleOf: ${e}}`},h0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:m0,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,io._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,io._)`${i} !== parseInt(${i})`;e.fail$data((0,io._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};ca.default=h0});var Im=b(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});function Om(e){let t=e.length,r=0,o=0,n;for(;o<t;)r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t&&(n=e.charCodeAt(o),(n&64512)===56320&&o++);return r}ua.default=Om;Om.code='require("ajv/dist/runtime/ucs2length").default'});var Cm=b(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});var jt=C(),g0=M(),_0=Im(),y0={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,jt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,jt._)`{limit: ${e}}`},v0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:y0,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?jt.operators.GT:jt.operators.LT,i=n.opts.unicode===!1?(0,jt._)`${r}.length`:(0,jt._)`${(0,g0.useFunc)(e.gen,_0.default)}(${r})`;e.fail$data((0,jt._)`${i} ${s} ${o}`)}};la.default=v0});var Nm=b(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var w0=Ze(),$0=M(),sr=C(),b0={message:({schemaCode:e})=>(0,sr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,sr._)`{pattern: ${e}}`},z0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:b0,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,sr._)`new RegExp`:(0,$0.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,sr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,sr._)`!${l}`)}else{let c=(0,w0.usePattern)(e,n);e.fail$data((0,sr._)`!${c}.test(${r})`)}}};da.default=z0});var jm=b(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var ao=C(),x0={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ao.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ao._)`{limit: ${e}}`},k0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:x0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?ao.operators.GT:ao.operators.LT;e.fail$data((0,ao._)`Object.keys(${r}).length ${n} ${o}`)}};pa.default=k0});var Am=b(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var co=Ze(),uo=C(),S0=M(),P0={message:({params:{missingProperty:e}})=>(0,uo.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,uo._)`{missingProperty: ${e}}`},T0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:P0,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:g}=e.it;for(let _ of r)if(f?.[_]===void 0&&!g.has(_)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,S0.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(uo.nil,p);else for(let f of r)(0,co.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let g=t.let("valid",!0);e.block$data(g,()=>m(f,g)),e.ok(g)}else t.if((0,co.checkMissingProp)(e,r,f)),(0,co.reportMissingProp)(e,f),t.else()}function p(){t.forOf("prop",o,f=>{e.setParams({missingProperty:f}),t.if((0,co.noPropertyInData)(t,n,f,a.ownProperties),()=>e.error())})}function m(f,g){e.setParams({missingProperty:f}),t.forOf(f,o,()=>{t.assign(g,(0,co.propertyInData)(t,n,f,a.ownProperties)),t.if((0,uo.not)(g),()=>{e.error(),t.break()})},uo.nil)}}};fa.default=T0});var Zm=b(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var lo=C(),E0={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,lo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,lo._)`{limit: ${e}}`},R0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:E0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?lo.operators.GT:lo.operators.LT;e.fail$data((0,lo._)`${r}.length ${n} ${o}`)}};ma.default=R0});var Sn=b(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var Mm=Di();Mm.code='require("ajv/dist/runtime/equal").default';ha.default=Mm});var Dm=b(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var ga=Wr(),pe=C(),O0=M(),I0=Sn(),C0={message:({params:{i:e,j:t}})=>(0,pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,pe._)`{i: ${e}, j: ${t}}`},N0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:C0,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=s.items?(0,ga.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,pe._)`${i} === false`),e.ok(c);function l(){let g=t.let("i",(0,pe._)`${r}.length`),_=t.let("j");e.setParams({i:g,j:_}),t.assign(c,!0),t.if((0,pe._)`${g} > 1`,()=>(p()?m:f)(g,_))}function p(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,_){let y=t.name("item"),v=(0,ga.checkDataTypes)(u,y,a.opts.strictNumbers,ga.DataType.Wrong),O=t.const("indices",(0,pe._)`{}`);t.for((0,pe._)`;${g}--;`,()=>{t.let(y,(0,pe._)`${r}[${g}]`),t.if(v,(0,pe._)`continue`),u.length>1&&t.if((0,pe._)`typeof ${y} == "string"`,(0,pe._)`${y} += "_"`),t.if((0,pe._)`typeof ${O}[${y}] == "number"`,()=>{t.assign(_,(0,pe._)`${O}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,pe._)`${O}[${y}] = ${g}`)})}function f(g,_){let y=(0,O0.useFunc)(t,I0.default),v=t.name("outer");t.label(v).for((0,pe._)`;${g}--;`,()=>t.for((0,pe._)`${_} = ${g}; ${_}--;`,()=>t.if((0,pe._)`${y}(${r}[${g}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};_a.default=N0});var qm=b(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var ya=C(),j0=M(),A0=Sn(),Z0={message:"must be equal to constant",params:({schemaCode:e})=>(0,ya._)`{allowedValue: ${e}}`},M0={keyword:"const",$data:!0,error:Z0,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;o||s&&typeof s=="object"?e.fail$data((0,ya._)`!${(0,j0.useFunc)(t,A0.default)}(${r}, ${n})`):e.fail((0,ya._)`${s} !== ${r}`)}};va.default=M0});var Um=b(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var po=C(),D0=M(),q0=Sn(),U0={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,po._)`{allowedValues: ${e}}`},L0={keyword:"enum",schemaType:"array",$data:!0,error:U0,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,D0.useFunc)(t,q0.default)),l;if(a||o)l=t.let("valid"),e.block$data(l,p);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,po.or)(...n.map((g,_)=>m(f,_)))}e.pass(l);function p(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,po._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,g){let _=n[g];return typeof _=="object"&&_!==null?(0,po._)`${u()}(${r}, ${f}[${g}])`:(0,po._)`${r} === ${_}`}}};wa.default=L0});var Lm=b($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var F0=Em(),V0=Rm(),H0=Cm(),J0=Nm(),K0=jm(),B0=Am(),G0=Zm(),W0=Dm(),Y0=qm(),Q0=Um(),X0=[F0.default,V0.default,H0.default,J0.default,K0.default,B0.default,G0.default,W0.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Y0.default,Q0.default];$a.default=X0});var za=b(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.validateAdditionalItems=void 0;var At=C(),ba=M(),ez={message:({params:{len:e}})=>(0,At.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,At._)`{limit: ${e}}`},tz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:ez,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,ba.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Fm(e,o)}};function Fm(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,At._)`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass((0,At._)`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,ba.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,At._)`${a} <= ${t.length}`);r.if((0,At.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:ba.Type.Num},u),i.allErrors||r.if((0,At.not)(u),()=>r.break())})}}fo.validateAdditionalItems=Fm;fo.default=tz});var xa=b(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.validateTuple=void 0;var Vm=C(),Pn=M(),rz=Ze(),oz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Hm(e,"additionalItems",t);r.items=!0,!(0,Pn.alwaysValidSchema)(r,t)&&e.ok((0,rz.validateArray)(e))}};function Hm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Pn.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Vm._)`${s}.length`);r.forEach((p,m)=>{(0,Pn.alwaysValidSchema)(a,p)||(o.if((0,Vm._)`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(p){let{opts:m,errSchemaPath:f}=a,g=r.length,_=g===p.minItems&&(g===p.maxItems||p[t]===!1);if(m.strictTuples&&!_){let y=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Pn.checkStrictMode)(a,y,m.strictTuples)}}}mo.validateTuple=Hm;mo.default=oz});var Jm=b(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var nz=xa(),sz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,nz.validateTuple)(e,"items")};ka.default=sz});var Bm=b(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var Km=C(),iz=M(),az=Ze(),cz=za(),uz={message:({params:{len:e}})=>(0,Km.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Km._)`{limit: ${e}}`},lz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:uz,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;o.items=!0,!(0,iz.alwaysValidSchema)(o,t)&&(n?(0,cz.validateAdditionalItems)(e,n):e.ok((0,az.validateArray)(e)))}};Sa.default=lz});var Gm=b(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var De=C(),Tn=M(),dz={message:({params:{min:e,max:t}})=>t===void 0?(0,De.str)`must contain at least ${e} valid item(s)`:(0,De.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,De._)`{minContains: ${e}}`:(0,De._)`{minContains: ${e}, maxContains: ${t}}`},pz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:dz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,De._)`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Tn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Tn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Tn.alwaysValidSchema)(s,r)){let _=(0,De._)`${l} >= ${i}`;a!==void 0&&(_=(0,De._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let p=t.name("valid");a===void 0&&i===1?f(p,()=>t.if(p,()=>t.break())):i===0?(t.let(p,!0),a!==void 0&&t.if((0,De._)`${n}.length > 0`,m)):(t.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let _=t.name("_valid"),y=t.let("count",0);f(_,()=>t.if(_,()=>g(y)))}function f(_,y){t.forRange("i",0,l,v=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Tn.Type.Num,compositeRule:!0},_),y()})}function g(_){t.code((0,De._)`${_}++`),a===void 0?t.if((0,De._)`${_} >= ${i}`,()=>t.assign(p,!0).break()):(t.if((0,De._)`${_} > ${a}`,()=>t.assign(p,!1).break()),i===1?t.assign(p,!0):t.if((0,De._)`${_} >= ${i}`,()=>t.assign(p,!0)))}}};Pa.default=pz});var Qm=b(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.validateSchemaDeps=We.validatePropertyDeps=We.error=void 0;var Ta=C(),fz=M(),ho=Ze();We.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return(0,Ta.str)`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,Ta._)`{property: ${e},
7
7
  missingProperty: ${o},
8
8
  depsCount: ${t},
9
- deps: ${r}}`};var dz={keyword:"dependencies",type:"object",schemaType:"object",error:We.error,code(e){let[t,r]=pz(e);Gm(e,t),Wm(e,r)}};function pz({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Gm(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,ho.propertyInData)(r,o,i,n.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,ho.checkReportMissingProp)(e,u)}):(r.if((0,Ta._)`${c} && (${(0,ho.checkMissingProp)(e,a,s)})`),(0,ho.reportMissingProp)(e,s),r.else())}}We.validatePropertyDeps=Gm;function Wm(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t)(0,lz.alwaysValidSchema)(s,t[a])||(r.if((0,ho.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}We.validateSchemaDeps=Wm;We.default=dz});var Xm=b(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var Qm=C(),fz=M(),mz={message:"property name must be valid",params:({params:e})=>(0,Qm._)`{propertyName: ${e.propertyName}}`},hz={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:mz,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,fz.alwaysValidSchema)(n,r))return;let s=t.name("valid");t.forIn("key",o,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,Qm.not)(s),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(s)}};Ea.default=hz});var Oa=b(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var En=Ze(),Ve=C(),gz=ct(),Rn=M(),_z={message:"must NOT have additional properties",params:({params:e})=>(0,Ve._)`{additionalProperty: ${e.additionalProperty}}`},yz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:_z,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Rn.alwaysValidSchema)(i,r))return;let u=(0,En.allSchemaProperties)(o.properties),l=(0,En.allSchemaProperties)(o.patternProperties);p(),e.ok((0,Ve._)`${s} === ${gz.default.errors}`);function p(){t.forIn("key",n,y=>{!u.length&&!l.length?g(y):t.if(m(y),()=>g(y))})}function m(y){let v;if(u.length>8){let O=(0,Rn.schemaRefOrVal)(i,o.properties,"properties");v=(0,En.isOwnProperty)(t,O,y)}else u.length?v=(0,Ve.or)(...u.map(O=>(0,Ve._)`${y} === ${O}`)):v=Ve.nil;return l.length&&(v=(0,Ve.or)(v,...l.map(O=>(0,Ve._)`${(0,En.usePattern)(e,O)}.test(${y})`))),(0,Ve.not)(v)}function f(y){t.code((0,Ve._)`delete ${n}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Rn.alwaysValidSchema)(i,r)){let v=t.name("valid");c.removeAdditional==="failing"?(_(y,v,!1),t.if((0,Ve.not)(v),()=>{e.reset(),f(y)})):(_(y,v),a||t.if((0,Ve.not)(v),()=>t.break()))}}function _(y,v,O){let z={keyword:"additionalProperties",dataProp:y,dataPropType:Rn.Type.Str};O===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(z,v)}}};Ra.default=yz});var rh=b(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var vz=eo(),eh=Ze(),Ia=M(),th=Oa(),wz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&th.default.code(new vz.KeywordCxt(s,th.default,"additionalProperties"));let i=(0,eh.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ia.mergeEvaluated.props(t,(0,Ia.toHash)(i),s.props));let a=i.filter(p=>!(0,Ia.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a)u(p)?l(p):(t.if((0,eh.propertyInData)(t,n,p,s.opts.ownProperties)),l(p),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(c);function u(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};Ca.default=wz});var ih=b(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var oh=Ze(),On=C(),nh=M(),sh=M(),$z={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=(0,oh.allSchemaProperties)(r),c=a.filter(_=>(0,nh.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof On.Name)&&(s.props=(0,sh.evaluatedPropsToName)(t,s.props));let{props:p}=s;m();function m(){for(let _ of a)u&&f(_),s.allErrors?g(_):(t.var(l,!0),g(_),t.if(l))}function f(_){for(let y in u)new RegExp(_).test(y)&&(0,nh.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function g(_){t.forIn("key",o,y=>{t.if((0,On._)`${(0,oh.usePattern)(e,_)}.test(${y})`,()=>{let v=c.includes(_);v||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:sh.Type.Str},l),s.opts.unevaluated&&p!==!0?t.assign((0,On._)`${p}[${y}]`,!0):!v&&!s.allErrors&&t.if((0,On.not)(l),()=>t.break())})})}}};Na.default=$z});var ah=b(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var bz=M(),zz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,bz.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ja.default=zz});var ch=b(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var xz=Ze(),kz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:xz.validateUnion,error:{message:"must match a schema in anyOf"}};Aa.default=kz});var uh=b(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var In=C(),Sz=M(),Pz={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,In._)`{passingSchemas: ${e.passing}}`},Tz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Pz,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,p)=>{let m;(0,Sz.alwaysValidSchema)(n,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&t.if((0,In._)`${c} && ${i}`).assign(i,!1).assign(a,(0,In._)`[${a}, ${p}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,p),m&&e.mergeEvaluated(m,In.Name)})})}}};Za.default=Tz});var lh=b(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var Ez=M(),Rz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if((0,Ez.alwaysValidSchema)(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};Ma.default=Rz});var fh=b(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var Cn=C(),ph=M(),Oz={message:({params:e})=>(0,Cn.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Cn._)`{failingKeyword: ${e.ifClause}}`},Iz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Oz,code(e){let{gen:t,parentSchema:r,it:o}=e;r.then===void 0&&r.else===void 0&&(0,ph.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=dh(o,"then"),s=dh(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else n?t.if(a,u("then")):t.if((0,Cn.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,p){return()=>{let m=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(m,i),p?t.assign(p,(0,Cn._)`${l}`):e.setParams({ifClause:l})}}}};function dh(e,t){let r=e.schema[t];return r!==void 0&&!(0,ph.alwaysValidSchema)(e,r)}qa.default=Iz});var mh=b(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var Cz=M(),Nz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Cz.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Da.default=Nz});var hh=b(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var jz=za(),Az=Hm(),Zz=xa(),Mz=Km(),qz=Bm(),Dz=Ym(),Uz=Xm(),Lz=Oa(),Fz=rh(),Vz=ih(),Hz=ah(),Jz=ch(),Kz=uh(),Bz=lh(),Gz=fh(),Wz=mh();function Yz(e=!1){let t=[Hz.default,Jz.default,Kz.default,Bz.default,Gz.default,Wz.default,Uz.default,Lz.default,Dz.default,Fz.default,Vz.default];return e?t.push(Az.default,Mz.default):t.push(jz.default,Zz.default),t.push(qz.default),t}Ua.default=Yz});var gh=b(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var oe=C(),Qz={message:({schemaCode:e})=>(0,oe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,oe._)`{format: ${e}}`},Xz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Qz,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:p}=a;if(!c.validateFormats)return;n?m():f();function m(){let g=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),_=r.const("fDef",(0,oe._)`${g}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,oe._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${_}.type || "string"`).assign(v,(0,oe._)`${_}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(v,_)),e.fail$data((0,oe.or)(O(),z()));function O(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${v}`}function z(){let T=l.$async?(0,oe._)`(${_}.async ? await ${v}(${o}) : ${v}(${o}))`:(0,oe._)`${v}(${o})`,x=(0,oe._)`(typeof ${v} == "function" ? ${T} : ${v}.test(${o}))`;return(0,oe._)`${v} && ${v} !== true && ${y} === ${t} && !${x}`}}function f(){let g=p.formats[s];if(!g){O();return}if(g===!0)return;let[_,y,v]=z(g);_===t&&e.pass(T());function O(){if(c.strictSchema===!1){p.logger.warn(x());return}throw new Error(x());function x(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function z(x){let Se=x instanceof RegExp?(0,oe.regexpCode)(x):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Oe=r.scopeValue("formats",{key:s,ref:x,code:Se});return typeof x=="object"&&!(x instanceof RegExp)?[x.type||"string",x.validate,(0,oe._)`${Oe}.validate`]:["string",x,Oe]}function T(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${v}(${o})`}return typeof y=="function"?(0,oe._)`${v}(${o})`:(0,oe._)`${v}.test(${o})`}}}};La.default=Xz});var _h=b(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var ex=gh(),tx=[ex.default];Fa.default=tx});var yh=b(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.contentVocabulary=ir.metadataVocabulary=void 0;ir.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ir.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var wh=b(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var rx=Pm(),ox=Um(),nx=hh(),sx=_h(),vh=yh(),ix=[rx.default,ox.default,(0,nx.default)(),sx.default,vh.metadataVocabulary,vh.contentVocabulary];Va.default=ix});var bh=b(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.DiscrError=void 0;var $h;(function(e){e.Tag="tag",e.Mapping="mapping"})($h||(Nn.DiscrError=$h={}))});var xh=b(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var ar=C(),Ha=bh(),zh=gn(),ax=to(),cx=M(),ux={message:({params:{discrError:e,tagName:t}})=>e===Ha.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,ar._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},lx={keyword:"discriminator",type:"object",schemaType:"object",error:ux,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,ar._)`${r}${(0,ar.getProperty)(a)}`);t.if((0,ar._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Ha.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=m();t.if(!1);for(let g in f)t.elseIf((0,ar._)`${u} === ${g}`),t.assign(c,p(f[g]));t.else(),e.error(!1,{discrError:Ha.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function p(f){let g=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(_,ar.Name),g}function m(){var f;let g={},_=v(n),y=!0;for(let T=0;T<i.length;T++){let x=i[T];if(x?.$ref&&!(0,cx.schemaHasRulesButRef)(x,s.self.RULES)){let Oe=x.$ref;if(x=zh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Oe),x instanceof zh.SchemaEnv&&(x=x.schema),x===void 0)throw new ax.default(s.opts.uriResolver,s.baseId,Oe)}let Se=(f=x?.properties)===null||f===void 0?void 0:f[a];if(typeof Se!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||v(x)),O(Se,T)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return g;function v({required:T}){return Array.isArray(T)&&T.includes(a)}function O(T,x){if(T.const)z(T.const,x);else if(T.enum)for(let Se of T.enum)z(Se,x);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(T,x){if(typeof T!="string"||T in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[T]=x}}}};Ja.default=lx});var kh=b((PI,dx)=>{dx.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 Ph=b((Y,Ka)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var px=$m(),fx=wh(),mx=xh(),Sh=kh(),hx=["/properties"],jn="http://json-schema.org/draft-07/schema",cr=class extends px.default{_addVocabularies(){super._addVocabularies(),fx.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(mx.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Sh,hx):Sh;this.addMetaSchema(t,jn,!1),this.refs["http://json-schema.org/schema"]=jn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(jn)?jn:void 0)}};Y.Ajv=cr;Ka.exports=Y=cr;Ka.exports.Ajv=cr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=cr;var gx=eo();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return gx.KeywordCxt}});var ur=C();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return ur._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return ur.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return ur.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return ur.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return ur.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return ur.CodeGen}});var _x=mn();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return _x.default}});var yx=to();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return yx.default}})});var jh=b(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.formatNames=Qe.fastFormats=Qe.fullFormats=void 0;function Ye(e,t){return{validate:e,compare:t}}Qe.fullFormats={date:Ye(Oh,Ya),time:Ye(Ga(!0),Qa),"date-time":Ye(Th(!0),Ch),"iso-time":Ye(Ga(),Ih),"iso-date-time":Ye(Th(),Nh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:xx,"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:Ox,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:kx,int32:{type:"number",validate:Tx},int64:{type:"number",validate:Ex},float:{type:"number",validate:Rh},double:{type:"number",validate:Rh},password:!0,binary:!0};Qe.fastFormats={...Qe.fullFormats,date:Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ya),time:Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Qa),"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,Ch),"iso-time":Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Ih),"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,Nh),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 vx(e){return e%4===0&&(e%100!==0||e%400===0)}var wx=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,$x=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Oh(e){let t=wx.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&vx(r)?29:$x[o])}function Ya(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Ba=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ga(e){return function(r){let o=Ba.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let p=s-l*c,m=n-u*c-(p<0?1:0);return(m===23||m===-1)&&(p===59||p===-1)&&i<61}}function Qa(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function Ih(e,t){if(!(e&&t))return;let r=Ba.exec(e),o=Ba.exec(t);if(r&&o)return e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t?1:e<t?-1:0}var Wa=/t|\s/i;function Th(e){let t=Ga(e);return function(o){let n=o.split(Wa);return n.length===2&&Oh(n[0])&&t(n[1])}}function Ch(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function Nh(e,t){if(!(e&&t))return;let[r,o]=e.split(Wa),[n,s]=t.split(Wa),i=Ya(r,n);if(i!==void 0)return i||Qa(o,s)}var bx=/\/|:/,zx=/^(?:[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 xx(e){return bx.test(e)&&zx.test(e)}var Eh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function kx(e){return Eh.lastIndex=0,Eh.test(e)}var Sx=-(2**31),Px=2**31-1;function Tx(e){return Number.isInteger(e)&&e<=Px&&e>=Sx}function Ex(e){return Number.isInteger(e)}function Rh(){return!0}var Rx=/[^\\]\\Z/;function Ox(e){if(Rx.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Ah=b(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.formatLimitDefinition=void 0;var Ix=Ph(),He=C(),zt=He.operators,An={formatMaximum:{okStr:"<=",ok:zt.LTE,fail:zt.GT},formatMinimum:{okStr:">=",ok:zt.GTE,fail:zt.LT},formatExclusiveMaximum:{okStr:"<",ok:zt.LT,fail:zt.GTE},formatExclusiveMinimum:{okStr:">",ok:zt.GT,fail:zt.LTE}},Cx={message:({keyword:e,schemaCode:t})=>(0,He.str)`should be ${An[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,He._)`{comparison: ${An[e].okStr}, limit: ${t}}`};lr.formatLimitDefinition={keyword:Object.keys(An),type:"string",schemaType:"string",$data:!0,error:Cx,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new Ix.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,He._)`${m}[${c.schemaCode}]`);e.fail$data((0,He.or)((0,He._)`typeof ${f} != "object"`,(0,He._)`${f} instanceof RegExp`,(0,He._)`typeof ${f}.compare != "function"`,p(f)))}function l(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,He._)`${i.code.formats}${(0,He.getProperty)(m)}`:void 0});e.fail$data(p(g))}function p(m){return(0,He._)`${m}.compare(${r}, ${o}) ${An[n].fail} 0`}},dependencies:["format"]};var Nx=e=>(e.addKeyword(lr.formatLimitDefinition),e);lr.default=Nx});var Dh=b((go,qh)=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});var dr=jh(),jx=Ah(),Xa=C(),Zh=new Xa.Name("fullFormats"),Ax=new Xa.Name("fastFormats"),ec=(e,t={keywords:!0})=>{if(Array.isArray(t))return Mh(e,t,dr.fullFormats,Zh),e;let[r,o]=t.mode==="fast"?[dr.fastFormats,Ax]:[dr.fullFormats,Zh],n=t.formats||dr.formatNames;return Mh(e,n,r,o),t.keywords&&(0,jx.default)(e),e};ec.get=(e,t="full")=>{let o=(t==="fast"?dr.fastFormats:dr.fullFormats)[e];if(!o)throw new Error(`Unknown format "${e}"`);return o};function Mh(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Xa._)`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}qh.exports=go=ec;Object.defineProperty(go,"__esModule",{value:!0});go.default=ec});import{readFileSync as uk}from"node:fs";import{dirname as lk,join as dk}from"node:path";import{fileURLToPath as pk}from"node:url";import{parseArgs as fk}from"node:util";import{execFileSync as ek}from"node:child_process";import{readFileSync as rg}from"node:fs";import*as Pe from"node:fs";import*as cc from"node:os";import*as Hn from"node:path";var Vn=Hn.join(cc.homedir(),".gigabuddy"),$g={shared:{prod:"credentials.json",staging:"credentials.staging.json"},user:{prod:"user-credentials.json",staging:"user-credentials.staging.json"},agent:{prod:"agent-credentials.json",staging:"agent-credentials.staging.json"}};function wr(e=!1,t="shared"){let r=$g[t];return Hn.join(Vn,e?r.staging:r.prod)}function kt(e=!1,t="shared"){try{let r=Pe.readFileSync(wr(e,t),"utf-8"),o=JSON.parse(r);return o.refreshToken?o:null}catch{return null}}function Jn(e,t=!1,r="shared"){Pe.existsSync(Vn)||Pe.mkdirSync(Vn,{recursive:!0,mode:448}),Oo(wr(t,r),JSON.stringify(e,null,2))}function uc(e=!1,t="shared"){let r=wr(e,t);Pe.existsSync(r)&&Pe.unlinkSync(r)}function Oo(e,t){Pe.writeFileSync(e,t,{mode:384});try{Pe.chmodSync(e,384)}catch{}}var lc,Kn=Object.freeze({status:"aborted"});function h(e,t,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let m=l[p];m in a||(a[m]=u[m].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var bg=Symbol("zod_brand"),Je=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Mt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(lc=globalThis).__zod_globalConfig??(lc.__zod_globalConfig={});var qt=globalThis.__zod_globalConfig;function we(e){return e&&Object.assign(qt,e),qt}var A={};Fn(A,{BIGINT_FORMAT_RANGES:()=>mc,Class:()=>Gn,NUMBER_FORMAT_RANGES:()=>ts,aborted:()=>ft,allowsEval:()=>Qn,assert:()=>Pg,assertEqual:()=>zg,assertIs:()=>kg,assertNever:()=>Sg,assertNotEqual:()=>xg,assignProp:()=>dt,base64ToUint8Array:()=>gc,base64urlToUint8Array:()=>Vg,cached:()=>Ut,captureStackTrace:()=>No,cleanEnum:()=>Fg,cleanRegex:()=>xr,clone:()=>Ie,cloneDef:()=>Eg,createTransparentProxy:()=>jg,defineLazy:()=>L,esc:()=>Co,escapeRegex:()=>rt,explicitlyAborted:()=>rs,extend:()=>Mg,finalizeIssue:()=>Ce,floatSafeRemainder:()=>Wn,getElementAtPath:()=>Rg,getEnumValues:()=>br,getLengthableOrigin:()=>kr,getParsedType:()=>Ng,getSizableOrigin:()=>hc,hexToUint8Array:()=>Jg,isObject:()=>St,isPlainObject:()=>pt,issue:()=>Lt,joinValues:()=>Io,jsonStringifyReplacer:()=>Dt,merge:()=>Dg,mergeDefs:()=>tt,normalizeParams:()=>P,nullish:()=>zr,numKeys:()=>Cg,objectClone:()=>Tg,omit:()=>Zg,optionalKeys:()=>es,parsedType:()=>os,partial:()=>Ug,pick:()=>Ag,prefixIssues:()=>ot,primitiveTypes:()=>fc,promiseAllObject:()=>Og,propertyKeyTypes:()=>Xn,randomString:()=>Ig,required:()=>Lg,safeExtend:()=>qg,shallowClone:()=>pc,slugify:()=>Yn,stringifyPrimitive:()=>jo,uint8ArrayToBase64:()=>_c,uint8ArrayToBase64url:()=>Hg,uint8ArrayToHex:()=>Kg,unwrapMessage:()=>$r});function zg(e){return e}function xg(e){return e}function kg(e){}function Sg(e){throw new Error("Unexpected value in exhaustive check")}function Pg(e){}function br(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Io(e,t="|"){return e.map(r=>jo(r)).join(t)}function Dt(e,t){return typeof t=="bigint"?t.toString():t}function Ut(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function zr(e){return e==null}function xr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Wn(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var dc=Symbol("evaluating");function L(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==dc)return o===void 0&&(o=dc,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Tg(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function dt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tt(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Eg(e){return tt(e._zod.def)}function Rg(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function Og(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function Ig(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Co(e){return JSON.stringify(e)}function Yn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var No="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function St(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qn=Ut(()=>{if(qt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function pt(e){if(St(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(St(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function pc(e){return pt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Cg(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Ng=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Xn=new Set(["string","number","symbol"]),fc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ie(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function P(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function jg(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function jo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function es(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ts={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]},mc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ag(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=tt(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return dt(this,"shape",i),i},checks:[]});return Ie(e,s)}function Zg(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=tt(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return dt(this,"shape",i),i},checks:[]});return Ie(e,s)}function Mg(e,t){if(!pt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=tt(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return dt(this,"shape",s),s}});return Ie(e,n)}function qg(e,t){if(!pt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=tt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return dt(this,"shape",o),o}});return Ie(e,r)}function Dg(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=tt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return dt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ie(e,r)}function Ug(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=tt(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return dt(this,"shape",c),c},checks:[]});return Ie(t,i)}function Lg(e,t,r){let o=tt(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return dt(this,"shape",s),s}});return Ie(t,o)}function ft(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function rs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ot(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function $r(e){return typeof e=="string"?e:e?.message}function Ce(e,t,r){let o=e.message?e.message:$r(e.inst?._zod.def?.error?.(e))??$r(t?.error?.(e))??$r(r.customError?.(e))??$r(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=i),a}function hc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function kr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function os(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Lt(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function Fg(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function gc(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function _c(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Vg(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return gc(t+r)}function Hg(e){return _c(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Jg(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function Kg(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Gn=class{constructor(...t){}};var yc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Dt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ao=h("$ZodError",yc),ns=h("$ZodError",yc,{Parent:Error});function ss(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function is(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(e),r}var Zo=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Je;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Ce(c,s,we())));throw No(a,n?.callee),a}return i.value};var Mo=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Ce(c,s,we())));throw No(a,n?.callee),a}return i.value};var Sr=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Je;return s.issues.length?{success:!1,error:new(e??Ao)(s.issues.map(i=>Ce(i,n,we())))}:{success:!0,data:s.value}},vc=Sr(ns),Pr=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ce(i,n,we())))}:{success:!0,data:s.value}},wc=Pr(ns),$c=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Zo(e)(t,r,n)};var bc=e=>(t,r,o)=>Zo(e)(t,r,o);var zc=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Mo(e)(t,r,n)};var xc=e=>async(t,r,o)=>Mo(e)(t,r,o);var kc=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Sr(e)(t,r,n)};var Sc=e=>(t,r,o)=>Sr(e)(t,r,o);var Pc=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Pr(e)(t,r,n)};var Tc=e=>async(t,r,o)=>Pr(e)(t,r,o);var Ec=/^[cC][0-9a-z]{6,}$/,Rc=/^[0-9a-z]+$/,Oc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ic=/^[0-9a-vA-V]{20}$/,Cc=/^[A-Za-z0-9]{27}$/,Nc=/^[a-zA-Z0-9_-]{21}$/,jc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Ac=/^([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})$/,as=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var Zc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Gg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mc(){return new RegExp(Gg,"u")}var qc=/^(?:(?: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])$/,Dc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Uc=/^((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])$/,Lc=/^(([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])$/,Fc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cs=/^[A-Za-z0-9_-]*$/;var Vc=/^https?$/,Hc=/^\+[1-9]\d{6,14}$/,Jc="(?:(?:\\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])))",Kc=new RegExp(`^${Jc}$`);function Bc(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Gc(e){return new RegExp(`^${Bc(e)}$`)}function Wc(e){let t=Bc({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Jc}T(?:${o})$`)}var Yc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Qc=/^-?\d+n?$/,Xc=/^-?\d+$/,us=/^-?\d+(?:\.\d+)?$/,eu=/^(?:true|false)$/i,tu=/^null$/i;var ru=/^[^A-Z]*$/,ou=/^[^a-z]*$/;var ie=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),nu={number:"number",bigint:"bigint",object:"date"},ls=h("$ZodCheckLessThan",(e,t)=>{ie.init(e,t);let r=nu[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ds=h("$ZodCheckGreaterThan",(e,t)=>{ie.init(e,t);let r=nu[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),su=h("$ZodCheckMultipleOf",(e,t)=>{ie.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Wn(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),iu=h("$ZodCheckNumberFormat",(e,t)=>{ie.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=ts[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Xc)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});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:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var au=h("$ZodCheckMaxLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=kr(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),cu=h("$ZodCheckMinLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=kr(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),uu=h("$ZodCheckLengthEquals",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=kr(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Er=h("$ZodCheckStringFormat",(e,t)=>{var r,o;ie.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),lu=h("$ZodCheckRegex",(e,t)=>{Er.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),du=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ru),Er.init(e,t)}),pu=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ou),Er.init(e,t)}),fu=h("$ZodCheckIncludes",(e,t)=>{ie.init(e,t);let r=rt(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),mu=h("$ZodCheckStartsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(`^${rt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),hu=h("$ZodCheckEndsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(`.*${rt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var gu=h("$ZodCheckOverwrite",(e,t)=>{ie.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var qo=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
9
+ deps: ${r}}`};var mz={keyword:"dependencies",type:"object",schemaType:"object",error:We.error,code(e){let[t,r]=hz(e);Wm(e,t),Ym(e,r)}};function hz({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Wm(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,ho.propertyInData)(r,o,i,n.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,ho.checkReportMissingProp)(e,u)}):(r.if((0,Ta._)`${c} && (${(0,ho.checkMissingProp)(e,a,s)})`),(0,ho.reportMissingProp)(e,s),r.else())}}We.validatePropertyDeps=Wm;function Ym(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t)(0,fz.alwaysValidSchema)(s,t[a])||(r.if((0,ho.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}We.validateSchemaDeps=Ym;We.default=mz});var eh=b(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var Xm=C(),gz=M(),_z={message:"property name must be valid",params:({params:e})=>(0,Xm._)`{propertyName: ${e.propertyName}}`},yz={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:_z,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,gz.alwaysValidSchema)(n,r))return;let s=t.name("valid");t.forIn("key",o,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,Xm.not)(s),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(s)}};Ea.default=yz});var Oa=b(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var En=Ze(),Ve=C(),vz=ct(),Rn=M(),wz={message:"must NOT have additional properties",params:({params:e})=>(0,Ve._)`{additionalProperty: ${e.additionalProperty}}`},$z={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:wz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Rn.alwaysValidSchema)(i,r))return;let u=(0,En.allSchemaProperties)(o.properties),l=(0,En.allSchemaProperties)(o.patternProperties);p(),e.ok((0,Ve._)`${s} === ${vz.default.errors}`);function p(){t.forIn("key",n,y=>{!u.length&&!l.length?g(y):t.if(m(y),()=>g(y))})}function m(y){let v;if(u.length>8){let O=(0,Rn.schemaRefOrVal)(i,o.properties,"properties");v=(0,En.isOwnProperty)(t,O,y)}else u.length?v=(0,Ve.or)(...u.map(O=>(0,Ve._)`${y} === ${O}`)):v=Ve.nil;return l.length&&(v=(0,Ve.or)(v,...l.map(O=>(0,Ve._)`${(0,En.usePattern)(e,O)}.test(${y})`))),(0,Ve.not)(v)}function f(y){t.code((0,Ve._)`delete ${n}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Rn.alwaysValidSchema)(i,r)){let v=t.name("valid");c.removeAdditional==="failing"?(_(y,v,!1),t.if((0,Ve.not)(v),()=>{e.reset(),f(y)})):(_(y,v),a||t.if((0,Ve.not)(v),()=>t.break()))}}function _(y,v,O){let x={keyword:"additionalProperties",dataProp:y,dataPropType:Rn.Type.Str};O===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,v)}}};Ra.default=$z});var oh=b(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var bz=eo(),th=Ze(),Ia=M(),rh=Oa(),zz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&rh.default.code(new bz.KeywordCxt(s,rh.default,"additionalProperties"));let i=(0,th.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ia.mergeEvaluated.props(t,(0,Ia.toHash)(i),s.props));let a=i.filter(p=>!(0,Ia.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a)u(p)?l(p):(t.if((0,th.propertyInData)(t,n,p,s.opts.ownProperties)),l(p),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(c);function u(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};Ca.default=zz});var ah=b(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var nh=Ze(),On=C(),sh=M(),ih=M(),xz={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=(0,nh.allSchemaProperties)(r),c=a.filter(_=>(0,sh.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof On.Name)&&(s.props=(0,ih.evaluatedPropsToName)(t,s.props));let{props:p}=s;m();function m(){for(let _ of a)u&&f(_),s.allErrors?g(_):(t.var(l,!0),g(_),t.if(l))}function f(_){for(let y in u)new RegExp(_).test(y)&&(0,sh.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function g(_){t.forIn("key",o,y=>{t.if((0,On._)`${(0,nh.usePattern)(e,_)}.test(${y})`,()=>{let v=c.includes(_);v||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:ih.Type.Str},l),s.opts.unevaluated&&p!==!0?t.assign((0,On._)`${p}[${y}]`,!0):!v&&!s.allErrors&&t.if((0,On.not)(l),()=>t.break())})})}}};Na.default=xz});var ch=b(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var kz=M(),Sz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,kz.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ja.default=Sz});var uh=b(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var Pz=Ze(),Tz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Pz.validateUnion,error:{message:"must match a schema in anyOf"}};Aa.default=Tz});var lh=b(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var In=C(),Ez=M(),Rz={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,In._)`{passingSchemas: ${e.passing}}`},Oz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Rz,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,p)=>{let m;(0,Ez.alwaysValidSchema)(n,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&t.if((0,In._)`${c} && ${i}`).assign(i,!1).assign(a,(0,In._)`[${a}, ${p}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,p),m&&e.mergeEvaluated(m,In.Name)})})}}};Za.default=Oz});var dh=b(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var Iz=M(),Cz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if((0,Iz.alwaysValidSchema)(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};Ma.default=Cz});var mh=b(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var Cn=C(),fh=M(),Nz={message:({params:e})=>(0,Cn.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Cn._)`{failingKeyword: ${e.ifClause}}`},jz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Nz,code(e){let{gen:t,parentSchema:r,it:o}=e;r.then===void 0&&r.else===void 0&&(0,fh.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=ph(o,"then"),s=ph(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else n?t.if(a,u("then")):t.if((0,Cn.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,p){return()=>{let m=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(m,i),p?t.assign(p,(0,Cn._)`${l}`):e.setParams({ifClause:l})}}}};function ph(e,t){let r=e.schema[t];return r!==void 0&&!(0,fh.alwaysValidSchema)(e,r)}Da.default=jz});var hh=b(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var Az=M(),Zz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Az.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};qa.default=Zz});var gh=b(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var Mz=za(),Dz=Jm(),qz=xa(),Uz=Bm(),Lz=Gm(),Fz=Qm(),Vz=eh(),Hz=Oa(),Jz=oh(),Kz=ah(),Bz=ch(),Gz=uh(),Wz=lh(),Yz=dh(),Qz=mh(),Xz=hh();function ex(e=!1){let t=[Bz.default,Gz.default,Wz.default,Yz.default,Qz.default,Xz.default,Vz.default,Hz.default,Fz.default,Jz.default,Kz.default];return e?t.push(Dz.default,Uz.default):t.push(Mz.default,qz.default),t.push(Lz.default),t}Ua.default=ex});var _h=b(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var oe=C(),tx={message:({schemaCode:e})=>(0,oe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,oe._)`{format: ${e}}`},rx={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:tx,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:p}=a;if(!c.validateFormats)return;n?m():f();function m(){let g=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),_=r.const("fDef",(0,oe._)`${g}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,oe._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${_}.type || "string"`).assign(v,(0,oe._)`${_}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(v,_)),e.fail$data((0,oe.or)(O(),x()));function O(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${v}`}function x(){let E=l.$async?(0,oe._)`(${_}.async ? await ${v}(${o}) : ${v}(${o}))`:(0,oe._)`${v}(${o})`,k=(0,oe._)`(typeof ${v} == "function" ? ${E} : ${v}.test(${o}))`;return(0,oe._)`${v} && ${v} !== true && ${y} === ${t} && !${k}`}}function f(){let g=p.formats[s];if(!g){O();return}if(g===!0)return;let[_,y,v]=x(g);_===t&&e.pass(E());function O(){if(c.strictSchema===!1){p.logger.warn(k());return}throw new Error(k());function k(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function x(k){let Se=k instanceof RegExp?(0,oe.regexpCode)(k):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Oe=r.scopeValue("formats",{key:s,ref:k,code:Se});return typeof k=="object"&&!(k instanceof RegExp)?[k.type||"string",k.validate,(0,oe._)`${Oe}.validate`]:["string",k,Oe]}function E(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${v}(${o})`}return typeof y=="function"?(0,oe._)`${v}(${o})`:(0,oe._)`${v}.test(${o})`}}}};La.default=rx});var yh=b(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var ox=_h(),nx=[ox.default];Fa.default=nx});var vh=b(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.contentVocabulary=ir.metadataVocabulary=void 0;ir.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ir.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var $h=b(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var sx=Tm(),ix=Lm(),ax=gh(),cx=yh(),wh=vh(),ux=[sx.default,ix.default,(0,ax.default)(),cx.default,wh.metadataVocabulary,wh.contentVocabulary];Va.default=ux});var zh=b(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.DiscrError=void 0;var bh;(function(e){e.Tag="tag",e.Mapping="mapping"})(bh||(Nn.DiscrError=bh={}))});var kh=b(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var ar=C(),Ha=zh(),xh=gn(),lx=to(),dx=M(),px={message:({params:{discrError:e,tagName:t}})=>e===Ha.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,ar._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},fx={keyword:"discriminator",type:"object",schemaType:"object",error:px,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,ar._)`${r}${(0,ar.getProperty)(a)}`);t.if((0,ar._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Ha.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=m();t.if(!1);for(let g in f)t.elseIf((0,ar._)`${u} === ${g}`),t.assign(c,p(f[g]));t.else(),e.error(!1,{discrError:Ha.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function p(f){let g=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(_,ar.Name),g}function m(){var f;let g={},_=v(n),y=!0;for(let E=0;E<i.length;E++){let k=i[E];if(k?.$ref&&!(0,dx.schemaHasRulesButRef)(k,s.self.RULES)){let Oe=k.$ref;if(k=xh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Oe),k instanceof xh.SchemaEnv&&(k=k.schema),k===void 0)throw new lx.default(s.opts.uriResolver,s.baseId,Oe)}let Se=(f=k?.properties)===null||f===void 0?void 0:f[a];if(typeof Se!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||v(k)),O(Se,E)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return g;function v({required:E}){return Array.isArray(E)&&E.includes(a)}function O(E,k){if(E.const)x(E.const,k);else if(E.enum)for(let Se of E.enum)x(Se,k);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(E,k){if(typeof E!="string"||E in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[E]=k}}}};Ja.default=fx});var Sh=b((II,mx)=>{mx.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 Th=b((Y,Ka)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var hx=bm(),gx=$h(),_x=kh(),Ph=Sh(),yx=["/properties"],jn="http://json-schema.org/draft-07/schema",cr=class extends hx.default{_addVocabularies(){super._addVocabularies(),gx.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(_x.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Ph,yx):Ph;this.addMetaSchema(t,jn,!1),this.refs["http://json-schema.org/schema"]=jn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(jn)?jn:void 0)}};Y.Ajv=cr;Ka.exports=Y=cr;Ka.exports.Ajv=cr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=cr;var vx=eo();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return vx.KeywordCxt}});var ur=C();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return ur._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return ur.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return ur.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return ur.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return ur.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return ur.CodeGen}});var wx=mn();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return wx.default}});var $x=to();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return $x.default}})});var Ah=b(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.formatNames=Qe.fastFormats=Qe.fullFormats=void 0;function Ye(e,t){return{validate:e,compare:t}}Qe.fullFormats={date:Ye(Ih,Ya),time:Ye(Ga(!0),Qa),"date-time":Ye(Eh(!0),Nh),"iso-time":Ye(Ga(),Ch),"iso-date-time":Ye(Eh(),jh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Px,"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:Nx,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:Tx,int32:{type:"number",validate:Ox},int64:{type:"number",validate:Ix},float:{type:"number",validate:Oh},double:{type:"number",validate:Oh},password:!0,binary:!0};Qe.fastFormats={...Qe.fullFormats,date:Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ya),time:Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Qa),"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,Nh),"iso-time":Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Ch),"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,jh),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 bx(e){return e%4===0&&(e%100!==0||e%400===0)}var zx=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,xx=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Ih(e){let t=zx.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&bx(r)?29:xx[o])}function Ya(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Ba=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ga(e){return function(r){let o=Ba.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let p=s-l*c,m=n-u*c-(p<0?1:0);return(m===23||m===-1)&&(p===59||p===-1)&&i<61}}function Qa(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function Ch(e,t){if(!(e&&t))return;let r=Ba.exec(e),o=Ba.exec(t);if(r&&o)return e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t?1:e<t?-1:0}var Wa=/t|\s/i;function Eh(e){let t=Ga(e);return function(o){let n=o.split(Wa);return n.length===2&&Ih(n[0])&&t(n[1])}}function Nh(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function jh(e,t){if(!(e&&t))return;let[r,o]=e.split(Wa),[n,s]=t.split(Wa),i=Ya(r,n);if(i!==void 0)return i||Qa(o,s)}var kx=/\/|:/,Sx=/^(?:[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 Px(e){return kx.test(e)&&Sx.test(e)}var Rh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Tx(e){return Rh.lastIndex=0,Rh.test(e)}var Ex=-(2**31),Rx=2**31-1;function Ox(e){return Number.isInteger(e)&&e<=Rx&&e>=Ex}function Ix(e){return Number.isInteger(e)}function Oh(){return!0}var Cx=/[^\\]\\Z/;function Nx(e){if(Cx.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Zh=b(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.formatLimitDefinition=void 0;var jx=Th(),He=C(),zt=He.operators,An={formatMaximum:{okStr:"<=",ok:zt.LTE,fail:zt.GT},formatMinimum:{okStr:">=",ok:zt.GTE,fail:zt.LT},formatExclusiveMaximum:{okStr:"<",ok:zt.LT,fail:zt.GTE},formatExclusiveMinimum:{okStr:">",ok:zt.GT,fail:zt.LTE}},Ax={message:({keyword:e,schemaCode:t})=>(0,He.str)`should be ${An[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,He._)`{comparison: ${An[e].okStr}, limit: ${t}}`};lr.formatLimitDefinition={keyword:Object.keys(An),type:"string",schemaType:"string",$data:!0,error:Ax,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new jx.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,He._)`${m}[${c.schemaCode}]`);e.fail$data((0,He.or)((0,He._)`typeof ${f} != "object"`,(0,He._)`${f} instanceof RegExp`,(0,He._)`typeof ${f}.compare != "function"`,p(f)))}function l(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,He._)`${i.code.formats}${(0,He.getProperty)(m)}`:void 0});e.fail$data(p(g))}function p(m){return(0,He._)`${m}.compare(${r}, ${o}) ${An[n].fail} 0`}},dependencies:["format"]};var Zx=e=>(e.addKeyword(lr.formatLimitDefinition),e);lr.default=Zx});var Uh=b((go,qh)=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});var dr=Ah(),Mx=Zh(),Xa=C(),Mh=new Xa.Name("fullFormats"),Dx=new Xa.Name("fastFormats"),ec=(e,t={keywords:!0})=>{if(Array.isArray(t))return Dh(e,t,dr.fullFormats,Mh),e;let[r,o]=t.mode==="fast"?[dr.fastFormats,Dx]:[dr.fullFormats,Mh],n=t.formats||dr.formatNames;return Dh(e,n,r,o),t.keywords&&(0,Mx.default)(e),e};ec.get=(e,t="full")=>{let o=(t==="fast"?dr.fastFormats:dr.fullFormats)[e];if(!o)throw new Error(`Unknown format "${e}"`);return o};function Dh(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Xa._)`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}qh.exports=go=ec;Object.defineProperty(go,"__esModule",{value:!0});go.default=ec});import{readFileSync as mk}from"node:fs";import{dirname as hk,join as gk}from"node:path";import{fileURLToPath as _k}from"node:url";import{parseArgs as yk}from"node:util";import{execFileSync as ok,spawnSync as nk}from"node:child_process";import{readFileSync as ng}from"node:fs";import*as Pe from"node:fs";import*as uc from"node:os";import*as Hn from"node:path";var Vn=Hn.join(uc.homedir(),".gigabuddy"),xg={shared:{prod:"credentials.json",staging:"credentials.staging.json"},user:{prod:"user-credentials.json",staging:"user-credentials.staging.json"},agent:{prod:"agent-credentials.json",staging:"agent-credentials.staging.json"}};function wr(e=!1,t="shared"){let r=xg[t];return Hn.join(Vn,e?r.staging:r.prod)}function kt(e=!1,t="shared"){try{let r=Pe.readFileSync(wr(e,t),"utf-8"),o=JSON.parse(r);return o.refreshToken?o:null}catch{return null}}function Jn(e,t=!1,r="shared"){Pe.existsSync(Vn)||Pe.mkdirSync(Vn,{recursive:!0,mode:448}),Oo(wr(t,r),JSON.stringify(e,null,2))}function lc(e=!1,t="shared"){let r=wr(e,t);Pe.existsSync(r)&&Pe.unlinkSync(r)}function Oo(e,t){Pe.writeFileSync(e,t,{mode:384});try{Pe.chmodSync(e,384)}catch{}}var dc,Kn=Object.freeze({status:"aborted"});function h(e,t,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let m=l[p];m in a||(a[m]=u[m].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var kg=Symbol("zod_brand"),Je=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Mt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(dc=globalThis).__zod_globalConfig??(dc.__zod_globalConfig={});var Dt=globalThis.__zod_globalConfig;function we(e){return e&&Object.assign(Dt,e),Dt}var A={};Fn(A,{BIGINT_FORMAT_RANGES:()=>hc,Class:()=>Gn,NUMBER_FORMAT_RANGES:()=>ts,aborted:()=>ft,allowsEval:()=>Qn,assert:()=>Rg,assertEqual:()=>Sg,assertIs:()=>Tg,assertNever:()=>Eg,assertNotEqual:()=>Pg,assignProp:()=>dt,base64ToUint8Array:()=>_c,base64urlToUint8Array:()=>Kg,cached:()=>Ut,captureStackTrace:()=>No,cleanEnum:()=>Jg,cleanRegex:()=>xr,clone:()=>Ie,cloneDef:()=>Ig,createTransparentProxy:()=>Mg,defineLazy:()=>L,esc:()=>Co,escapeRegex:()=>rt,explicitlyAborted:()=>rs,extend:()=>Ug,finalizeIssue:()=>Ce,floatSafeRemainder:()=>Wn,getElementAtPath:()=>Cg,getEnumValues:()=>br,getLengthableOrigin:()=>kr,getParsedType:()=>Zg,getSizableOrigin:()=>gc,hexToUint8Array:()=>Gg,isObject:()=>St,isPlainObject:()=>pt,issue:()=>Lt,joinValues:()=>Io,jsonStringifyReplacer:()=>qt,merge:()=>Fg,mergeDefs:()=>tt,normalizeParams:()=>T,nullish:()=>zr,numKeys:()=>Ag,objectClone:()=>Og,omit:()=>qg,optionalKeys:()=>es,parsedType:()=>os,partial:()=>Vg,pick:()=>Dg,prefixIssues:()=>ot,primitiveTypes:()=>mc,promiseAllObject:()=>Ng,propertyKeyTypes:()=>Xn,randomString:()=>jg,required:()=>Hg,safeExtend:()=>Lg,shallowClone:()=>fc,slugify:()=>Yn,stringifyPrimitive:()=>jo,uint8ArrayToBase64:()=>yc,uint8ArrayToBase64url:()=>Bg,uint8ArrayToHex:()=>Wg,unwrapMessage:()=>$r});function Sg(e){return e}function Pg(e){return e}function Tg(e){}function Eg(e){throw new Error("Unexpected value in exhaustive check")}function Rg(e){}function br(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Io(e,t="|"){return e.map(r=>jo(r)).join(t)}function qt(e,t){return typeof t=="bigint"?t.toString():t}function Ut(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function zr(e){return e==null}function xr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Wn(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var pc=Symbol("evaluating");function L(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==pc)return o===void 0&&(o=pc,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Og(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function dt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tt(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Ig(e){return tt(e._zod.def)}function Cg(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function Ng(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function jg(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Co(e){return JSON.stringify(e)}function Yn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var No="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function St(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qn=Ut(()=>{if(Dt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function pt(e){if(St(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(St(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function fc(e){return pt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Ag(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Zg=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Xn=new Set(["string","number","symbol"]),mc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ie(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function T(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Mg(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function jo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function es(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ts={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]},hc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Dg(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=tt(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return dt(this,"shape",i),i},checks:[]});return Ie(e,s)}function qg(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=tt(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return dt(this,"shape",i),i},checks:[]});return Ie(e,s)}function Ug(e,t){if(!pt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=tt(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return dt(this,"shape",s),s}});return Ie(e,n)}function Lg(e,t){if(!pt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=tt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return dt(this,"shape",o),o}});return Ie(e,r)}function Fg(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=tt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return dt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ie(e,r)}function Vg(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=tt(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return dt(this,"shape",c),c},checks:[]});return Ie(t,i)}function Hg(e,t,r){let o=tt(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return dt(this,"shape",s),s}});return Ie(t,o)}function ft(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function rs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ot(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function $r(e){return typeof e=="string"?e:e?.message}function Ce(e,t,r){let o=e.message?e.message:$r(e.inst?._zod.def?.error?.(e))??$r(t?.error?.(e))??$r(r.customError?.(e))??$r(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=i),a}function gc(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function kr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function os(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Lt(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function Jg(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function _c(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function yc(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Kg(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return _c(t+r)}function Bg(e){return yc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Gg(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function Wg(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Gn=class{constructor(...t){}};var vc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,qt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ao=h("$ZodError",vc),ns=h("$ZodError",vc,{Parent:Error});function ss(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function is(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(e),r}var Zo=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Je;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Ce(c,s,we())));throw No(a,n?.callee),a}return i.value};var Mo=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Ce(c,s,we())));throw No(a,n?.callee),a}return i.value};var Sr=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Je;return s.issues.length?{success:!1,error:new(e??Ao)(s.issues.map(i=>Ce(i,n,we())))}:{success:!0,data:s.value}},wc=Sr(ns),Pr=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ce(i,n,we())))}:{success:!0,data:s.value}},$c=Pr(ns),bc=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Zo(e)(t,r,n)};var zc=e=>(t,r,o)=>Zo(e)(t,r,o);var xc=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Mo(e)(t,r,n)};var kc=e=>async(t,r,o)=>Mo(e)(t,r,o);var Sc=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Sr(e)(t,r,n)};var Pc=e=>(t,r,o)=>Sr(e)(t,r,o);var Tc=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Pr(e)(t,r,n)};var Ec=e=>async(t,r,o)=>Pr(e)(t,r,o);var Rc=/^[cC][0-9a-z]{6,}$/,Oc=/^[0-9a-z]+$/,Ic=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cc=/^[0-9a-vA-V]{20}$/,Nc=/^[A-Za-z0-9]{27}$/,jc=/^[a-zA-Z0-9_-]{21}$/,Ac=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Zc=/^([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})$/,as=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var Mc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Qg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Dc(){return new RegExp(Qg,"u")}var qc=/^(?:(?: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])$/,Uc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Lc=/^((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])$/,Fc=/^(([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])$/,Vc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cs=/^[A-Za-z0-9_-]*$/;var Hc=/^https?$/,Jc=/^\+[1-9]\d{6,14}$/,Kc="(?:(?:\\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])))",Bc=new RegExp(`^${Kc}$`);function Gc(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Wc(e){return new RegExp(`^${Gc(e)}$`)}function Yc(e){let t=Gc({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Kc}T(?:${o})$`)}var Qc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Xc=/^-?\d+n?$/,eu=/^-?\d+$/,us=/^-?\d+(?:\.\d+)?$/,tu=/^(?:true|false)$/i,ru=/^null$/i;var ou=/^[^A-Z]*$/,nu=/^[^a-z]*$/;var ie=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),su={number:"number",bigint:"bigint",object:"date"},ls=h("$ZodCheckLessThan",(e,t)=>{ie.init(e,t);let r=su[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ds=h("$ZodCheckGreaterThan",(e,t)=>{ie.init(e,t);let r=su[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),iu=h("$ZodCheckMultipleOf",(e,t)=>{ie.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Wn(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),au=h("$ZodCheckNumberFormat",(e,t)=>{ie.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=ts[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=eu)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});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:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var cu=h("$ZodCheckMaxLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=kr(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),uu=h("$ZodCheckMinLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=kr(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),lu=h("$ZodCheckLengthEquals",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=kr(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Er=h("$ZodCheckStringFormat",(e,t)=>{var r,o;ie.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),du=h("$ZodCheckRegex",(e,t)=>{Er.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pu=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ou),Er.init(e,t)}),fu=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nu),Er.init(e,t)}),mu=h("$ZodCheckIncludes",(e,t)=>{ie.init(e,t);let r=rt(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),hu=h("$ZodCheckStartsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(`^${rt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),gu=h("$ZodCheckEndsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(`.*${rt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var _u=h("$ZodCheckOverwrite",(e,t)=>{ie.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Do=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
10
10
  `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,n.join(`
11
- `))}};var yu={major:4,minor:4,patch:3};var F=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yu;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,c)=>{let u=ft(i),l;for(let p of a){if(p._zod.def.when){if(rs(i)||!p._zod.def.when(i))continue}else if(u)continue;let m=i.issues.length,f=p._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Je;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==m&&(u||(u=ft(i,m)))});else{if(i.issues.length===m)continue;u||(u=ft(i,m))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(ft(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Je;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Je;return c.then(u=>n(u,o,a))}return n(c,o,a)}}L(e,"~standard",()=>({validate:n=>{try{let s=vc(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return wc(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Lo=h("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Yc(e._zod.bag),e._zod.parse=(r,o)=>{if(t.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:e}),r}}),G=h("$ZodStringFormat",(e,t)=>{Er.init(e,t),Lo.init(e,t)}),Pu=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ac),G.init(e,t)}),Tu=h("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=as(o))}else t.pattern??(t.pattern=as());G.init(e,t)}),Eu=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Zc),G.init(e,t)}),Ru=h("$ZodURL",(e,t)=>{G.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===Vc.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ou=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mc()),G.init(e,t)}),Iu=h("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Nc),G.init(e,t)}),Cu=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ec),G.init(e,t)}),Nu=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Rc),G.init(e,t)}),ju=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Oc),G.init(e,t)}),Au=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ic),G.init(e,t)}),Zu=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cc),G.init(e,t)}),Mu=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Wc(t)),G.init(e,t)}),qu=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Kc),G.init(e,t)}),Du=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Gc(t)),G.init(e,t)}),Uu=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=jc),G.init(e,t)}),Lu=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=qc),G.init(e,t),e._zod.bag.format="ipv4"}),Fu=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Dc),G.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var Vu=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Uc),G.init(e,t)}),Hu=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Lc),G.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ju(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ku=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Fc),G.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ju(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Wg(e){if(!cs.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ju(r)}var Bu=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=cs),G.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Wg(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Gu=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Hc),G.init(e,t)});function Yg(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Wu=h("$ZodJWT",(e,t)=>{G.init(e,t),e._zod.check=r=>{Yg(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var fs=h("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??us,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Yu=h("$ZodNumberFormat",(e,t)=>{iu.init(e,t),fs.init(e,t)}),Qu=h("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=eu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Xu=h("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=Qc,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var el=h("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=tu,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),tl=h("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),rl=h("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),ol=h("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var nl=h("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function vu(e,t,r){e.issues.length&&t.issues.push(...ot(r,e.issues)),t.value[r]=e.value}var sl=h("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>vu(u,r,i))):vu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Uo(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...ot(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function il(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=es(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function al(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",p=c.optout==="optional";for(let m in t){if(m==="__proto__"||a.has(m))continue;if(u==="never"){i.push(m);continue}let f=c.run({value:t[m],issues:[]},o);f instanceof Promise?e.push(f.then(g=>Uo(g,r,m,t,l,p))):Uo(f,r,m,t,l,p)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var Qg=h("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=Ut(()=>il(t));L(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let n=St,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],p=i.shape;for(let m of i.keys){let f=p[m],g=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[m],issues:[]},c);y instanceof Promise?l.push(y.then(v=>Uo(v,a,m,u,g,_))):Uo(y,a,m,u,g,_)}return s?al(l,u,a,c,o.value,e):l.length?Promise.all(l).then(()=>a):a}}),cl=h("$ZodObjectJIT",(e,t)=>{Qg.init(e,t);let r=e._zod.parse,o=Ut(()=>il(t)),n=m=>{let f=new qo(["shape","payload","ctx"]),g=o.value,_=z=>{let T=Co(z);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let z of g.keys)y[z]=`key_${v++}`;f.write("const newResult = {};");for(let z of g.keys){let T=y[z],x=Co(z),Se=m[z],Oe=Se?._zod?.optin==="optional",yr=Se?._zod?.optout==="optional";f.write(`const ${T} = ${_(z)};`),Oe&&yr?f.write(`
12
- if (${T}.issues.length) {
13
- if (${x} in input) {
14
- payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
11
+ `))}};var vu={major:4,minor:4,patch:3};var F=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vu;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,c)=>{let u=ft(i),l;for(let p of a){if(p._zod.def.when){if(rs(i)||!p._zod.def.when(i))continue}else if(u)continue;let m=i.issues.length,f=p._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Je;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==m&&(u||(u=ft(i,m)))});else{if(i.issues.length===m)continue;u||(u=ft(i,m))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(ft(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Je;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Je;return c.then(u=>n(u,o,a))}return n(c,o,a)}}L(e,"~standard",()=>({validate:n=>{try{let s=wc(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return $c(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Lo=h("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qc(e._zod.bag),e._zod.parse=(r,o)=>{if(t.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:e}),r}}),G=h("$ZodStringFormat",(e,t)=>{Er.init(e,t),Lo.init(e,t)}),Tu=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zc),G.init(e,t)}),Eu=h("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=as(o))}else t.pattern??(t.pattern=as());G.init(e,t)}),Ru=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mc),G.init(e,t)}),Ou=h("$ZodURL",(e,t)=>{G.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===Hc.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Iu=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Dc()),G.init(e,t)}),Cu=h("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=jc),G.init(e,t)}),Nu=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rc),G.init(e,t)}),ju=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Oc),G.init(e,t)}),Au=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ic),G.init(e,t)}),Zu=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cc),G.init(e,t)}),Mu=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Nc),G.init(e,t)}),Du=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yc(t)),G.init(e,t)}),qu=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Bc),G.init(e,t)}),Uu=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wc(t)),G.init(e,t)}),Lu=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ac),G.init(e,t)}),Fu=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=qc),G.init(e,t),e._zod.bag.format="ipv4"}),Vu=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Uc),G.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var Hu=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Lc),G.init(e,t)}),Ju=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Fc),G.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ku(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Bu=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vc),G.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ku(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Xg(e){if(!cs.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ku(r)}var Gu=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=cs),G.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Xg(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Wu=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Jc),G.init(e,t)});function e_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Yu=h("$ZodJWT",(e,t)=>{G.init(e,t),e._zod.check=r=>{e_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var fs=h("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??us,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Qu=h("$ZodNumberFormat",(e,t)=>{au.init(e,t),fs.init(e,t)}),Xu=h("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=tu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),el=h("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=Xc,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var tl=h("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=ru,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),rl=h("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),ol=h("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),nl=h("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var sl=h("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function wu(e,t,r){e.issues.length&&t.issues.push(...ot(r,e.issues)),t.value[r]=e.value}var il=h("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>wu(u,r,i))):wu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Uo(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...ot(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function al(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=es(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function cl(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",p=c.optout==="optional";for(let m in t){if(m==="__proto__"||a.has(m))continue;if(u==="never"){i.push(m);continue}let f=c.run({value:t[m],issues:[]},o);f instanceof Promise?e.push(f.then(g=>Uo(g,r,m,t,l,p))):Uo(f,r,m,t,l,p)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var t_=h("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=Ut(()=>al(t));L(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let n=St,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],p=i.shape;for(let m of i.keys){let f=p[m],g=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[m],issues:[]},c);y instanceof Promise?l.push(y.then(v=>Uo(v,a,m,u,g,_))):Uo(y,a,m,u,g,_)}return s?cl(l,u,a,c,o.value,e):l.length?Promise.all(l).then(()=>a):a}}),ul=h("$ZodObjectJIT",(e,t)=>{t_.init(e,t);let r=e._zod.parse,o=Ut(()=>al(t)),n=m=>{let f=new Do(["shape","payload","ctx"]),g=o.value,_=x=>{let E=Co(x);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let x of g.keys)y[x]=`key_${v++}`;f.write("const newResult = {};");for(let x of g.keys){let E=y[x],k=Co(x),Se=m[x],Oe=Se?._zod?.optin==="optional",yr=Se?._zod?.optout==="optional";f.write(`const ${E} = ${_(x)};`),Oe&&yr?f.write(`
12
+ if (${E}.issues.length) {
13
+ if (${k} in input) {
14
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
15
15
  ...iss,
16
- path: iss.path ? [${x}, ...iss.path] : [${x}]
16
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
17
17
  })));
18
18
  }
19
19
  }
20
20
 
21
- if (${T}.value === undefined) {
22
- if (${x} in input) {
23
- newResult[${x}] = undefined;
21
+ if (${E}.value === undefined) {
22
+ if (${k} in input) {
23
+ newResult[${k}] = undefined;
24
24
  }
25
25
  } else {
26
- newResult[${x}] = ${T}.value;
26
+ newResult[${k}] = ${E}.value;
27
27
  }
28
28
 
29
29
  `):Oe?f.write(`
30
- if (${T}.issues.length) {
31
- payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
30
+ if (${E}.issues.length) {
31
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
32
32
  ...iss,
33
- path: iss.path ? [${x}, ...iss.path] : [${x}]
33
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
34
34
  })));
35
35
  }
36
36
 
37
- if (${T}.value === undefined) {
38
- if (${x} in input) {
39
- newResult[${x}] = undefined;
37
+ if (${E}.value === undefined) {
38
+ if (${k} in input) {
39
+ newResult[${k}] = undefined;
40
40
  }
41
41
  } else {
42
- newResult[${x}] = ${T}.value;
42
+ newResult[${k}] = ${E}.value;
43
43
  }
44
44
 
45
45
  `):f.write(`
46
- const ${T}_present = ${x} in input;
47
- if (${T}.issues.length) {
48
- payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
46
+ const ${E}_present = ${k} in input;
47
+ if (${E}.issues.length) {
48
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
49
49
  ...iss,
50
- path: iss.path ? [${x}, ...iss.path] : [${x}]
50
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
51
51
  })));
52
52
  }
53
- if (!${T}_present && !${T}.issues.length) {
53
+ if (!${E}_present && !${E}.issues.length) {
54
54
  payload.issues.push({
55
55
  code: "invalid_type",
56
56
  expected: "nonoptional",
57
57
  input: undefined,
58
- path: [${x}]
58
+ path: [${k}]
59
59
  });
60
60
  }
61
61
 
62
- if (${T}_present) {
63
- if (${T}.value === undefined) {
64
- newResult[${x}] = undefined;
62
+ if (${E}_present) {
63
+ if (${E}.value === undefined) {
64
+ newResult[${k}] = undefined;
65
65
  } else {
66
- newResult[${x}] = ${T}.value;
66
+ newResult[${k}] = ${E}.value;
67
67
  }
68
68
  }
69
69
 
70
- `)}f.write("payload.value = newResult;"),f.write("return payload;");let O=f.compile();return(z,T)=>O(m,z,T)},s,i=St,a=!qt.jitless,u=a&&Qn.value,l=t.catchall,p;e._zod.parse=(m,f)=>{p??(p=o.value);let g=m.value;return i(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(t.shape)),m=s(m,f),l?al([],g,m,f,p,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function wu(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!ft(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Ce(i,o,we())))}),t)}var ms=h("$ZodUnion",(e,t)=>{F.init(e,t),L(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),L(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),L(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),L(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>xr(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>wu(a,o,e,n)):wu(i,o,e,n)}});var ul=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ms.init(e,t);let r=e._zod.parse;L(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=Ut(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.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});e._zod.parse=(n,s)=>{let i=n.value;if(!St(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),ll=h("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>$u(r,c,u)):$u(r,s,i)}});function ps(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(pt(e)&&pt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=ps(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=ps(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function $u(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&e.issues.push({...n,keys:s}),ft(e))return e;let i=ps(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var dl=h("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!pt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Ce(f,o,we())),input:u,path:[u],inst:e});continue}let p=l.value,m=t.valueType._zod.run({value:n[u],issues:[]},o);m instanceof Promise?s.push(m.then(f=>{f.issues.length&&r.issues.push(...ot(u,f.issues)),r.value[p]=f.value})):(m.issues.length&&r.issues.push(...ot(u,m.issues)),r.value[p]=m.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&us.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Ce(p,o,we())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(p=>{p.issues.length&&r.issues.push(...ot(a,p.issues)),r.value[c.value]=p.value})):(l.issues.length&&r.issues.push(...ot(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var pl=h("$ZodEnum",(e,t)=>{F.init(e,t);let r=br(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Xn.has(typeof n)).map(n=>typeof n=="string"?rt(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),fl=h("$ZodLiteral",(e,t)=>{if(F.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?rt(o):o?rt(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var ml=h("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Mt(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Je;return r.value=n,r.fallback=!0,r}});function bu(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var hs=h("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),L(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${xr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>bu(i,n)):bu(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),hl=h("$ZodExactOptional",(e,t)=>{hs.init(e,t),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),gl=h("$ZodNullable",(e,t)=>{F.init(e,t),L(e._zod,"optin",()=>t.innerType._zod.optin),L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${xr(r.source)}|null)$`):void 0}),L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),_l=h("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>zu(s,t)):zu(n,t)}});function zu(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var yl=h("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),vl=h("$ZodNonOptional",(e,t)=>{F.init(e,t),L(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>xu(s,e)):xu(n,e)}});function xu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var wl=h("$ZodCatch",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Ce(i,o,we()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>Ce(s,o,we()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var gs=h("$ZodPipe",(e,t)=>{F.init(e,t),L(e._zod,"values",()=>t.in._zod.values),L(e._zod,"optin",()=>t.in._zod.optin),L(e._zod,"optout",()=>t.out._zod.optout),L(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Do(i,t.in,o)):Do(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Do(s,t.out,o)):Do(n,t.out,o)}});function Do(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var $l=h("$ZodPreprocess",(e,t)=>{gs.init(e,t)}),bl=h("$ZodReadonly",(e,t)=>{F.init(e,t),L(e._zod,"propValues",()=>t.innerType._zod.propValues),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"optin",()=>t.innerType?._zod?.optin),L(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(ku):ku(n)}});function ku(e){return e.value=Object.freeze(e.value),e}var zl=h("$ZodCustom",(e,t)=>{ie.init(e,t),F.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Su(s,r,o,e));Su(n,r,o,e)}});function Su(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Lt(n))}}var Xg=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[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",mac:"MAC 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"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=os(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${jo(n.values[0])}`:`Invalid option: expected one of ${Io(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.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":""}: ${Io(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function xl(){return{localeError:Xg()}}var kl,e_=Symbol("ZodOutput"),t_=Symbol("ZodInput"),_s=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Sl(){return new _s}(kl=globalThis).__zod_globalRegistry??(kl.__zod_globalRegistry=Sl());var mt=globalThis.__zod_globalRegistry;function Pl(e,t){return new e({type:"string",...P(t)})}function Tl(e,t){return new e({type:"string",coerce:!0,...P(t)})}function El(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...P(t)})}function ys(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...P(t)})}function Rl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...P(t)})}function Ol(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...P(t)})}function Il(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...P(t)})}function Cl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...P(t)})}function vs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...P(t)})}function Nl(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...P(t)})}function jl(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...P(t)})}function Al(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...P(t)})}function Zl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...P(t)})}function Ml(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...P(t)})}function ql(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...P(t)})}function Dl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...P(t)})}function Ul(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...P(t)})}function Ll(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...P(t)})}function Fl(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...P(t)})}function Vl(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...P(t)})}function Hl(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...P(t)})}function Jl(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...P(t)})}function Kl(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...P(t)})}function Bl(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...P(t)})}function Gl(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...P(t)})}function Wl(e,t){return new e({type:"string",format:"date",check:"string_format",...P(t)})}function Yl(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...P(t)})}function Ql(e,t){return new e({type:"string",format:"duration",check:"string_format",...P(t)})}function Xl(e,t){return new e({type:"number",checks:[],...P(t)})}function ed(e,t){return new e({type:"number",coerce:!0,checks:[],...P(t)})}function td(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...P(t)})}function rd(e,t){return new e({type:"boolean",...P(t)})}function od(e,t){return new e({type:"boolean",coerce:!0,...P(t)})}function nd(e,t){return new e({type:"bigint",coerce:!0,...P(t)})}function sd(e,t){return new e({type:"null",...P(t)})}function id(e){return new e({type:"any"})}function ad(e){return new e({type:"unknown"})}function cd(e,t){return new e({type:"never",...P(t)})}function ud(e,t){return new e({type:"date",coerce:!0,...P(t)})}function Ft(e,t){return new ls({check:"less_than",...P(t),value:e,inclusive:!1})}function nt(e,t){return new ls({check:"less_than",...P(t),value:e,inclusive:!0})}function Vt(e,t){return new ds({check:"greater_than",...P(t),value:e,inclusive:!1})}function De(e,t){return new ds({check:"greater_than",...P(t),value:e,inclusive:!0})}function Rr(e,t){return new su({check:"multiple_of",...P(t),value:e})}function Fo(e,t){return new au({check:"max_length",...P(t),maximum:e})}function Ht(e,t){return new cu({check:"min_length",...P(t),minimum:e})}function Vo(e,t){return new uu({check:"length_equals",...P(t),length:e})}function ws(e,t){return new lu({check:"string_format",format:"regex",...P(t),pattern:e})}function $s(e){return new du({check:"string_format",format:"lowercase",...P(e)})}function bs(e){return new pu({check:"string_format",format:"uppercase",...P(e)})}function zs(e,t){return new fu({check:"string_format",format:"includes",...P(t),includes:e})}function xs(e,t){return new mu({check:"string_format",format:"starts_with",...P(t),prefix:e})}function ks(e,t){return new hu({check:"string_format",format:"ends_with",...P(t),suffix:e})}function ht(e){return new gu({check:"overwrite",tx:e})}function Ss(e){return ht(t=>t.normalize(e))}function Ps(){return ht(e=>e.trim())}function Ts(){return ht(e=>e.toLowerCase())}function Es(){return ht(e=>e.toUpperCase())}function Rs(){return ht(e=>Yn(e))}function ld(e,t,r){return new e({type:"array",element:t,...P(r)})}function dd(e,t,r){let o=P(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function pd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...P(r)})}function fd(e,t){let r=r_(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Lt(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Lt(s))}},e(o.value,o)),t);return r}function r_(e,t){let r=new ie({check:"custom",...P(t)});return r._zod.check=e,r}function Os(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??mt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function re(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,m,l)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),re(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&_e(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Is(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
70
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let O=f.compile();return(x,E)=>O(m,x,E)},s,i=St,a=!Dt.jitless,u=a&&Qn.value,l=t.catchall,p;e._zod.parse=(m,f)=>{p??(p=o.value);let g=m.value;return i(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(t.shape)),m=s(m,f),l?cl([],g,m,f,p,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function $u(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!ft(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Ce(i,o,we())))}),t)}var ms=h("$ZodUnion",(e,t)=>{F.init(e,t),L(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),L(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),L(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),L(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>xr(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>$u(a,o,e,n)):$u(i,o,e,n)}});var ll=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ms.init(e,t);let r=e._zod.parse;L(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=Ut(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.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});e._zod.parse=(n,s)=>{let i=n.value;if(!St(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),dl=h("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>bu(r,c,u)):bu(r,s,i)}});function ps(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(pt(e)&&pt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=ps(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=ps(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bu(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&e.issues.push({...n,keys:s}),ft(e))return e;let i=ps(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var pl=h("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!pt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Ce(f,o,we())),input:u,path:[u],inst:e});continue}let p=l.value,m=t.valueType._zod.run({value:n[u],issues:[]},o);m instanceof Promise?s.push(m.then(f=>{f.issues.length&&r.issues.push(...ot(u,f.issues)),r.value[p]=f.value})):(m.issues.length&&r.issues.push(...ot(u,m.issues)),r.value[p]=m.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&us.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Ce(p,o,we())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(p=>{p.issues.length&&r.issues.push(...ot(a,p.issues)),r.value[c.value]=p.value})):(l.issues.length&&r.issues.push(...ot(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var fl=h("$ZodEnum",(e,t)=>{F.init(e,t);let r=br(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Xn.has(typeof n)).map(n=>typeof n=="string"?rt(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),ml=h("$ZodLiteral",(e,t)=>{if(F.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?rt(o):o?rt(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var hl=h("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Mt(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Je;return r.value=n,r.fallback=!0,r}});function zu(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var hs=h("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),L(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${xr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>zu(i,n)):zu(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),gl=h("$ZodExactOptional",(e,t)=>{hs.init(e,t),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),_l=h("$ZodNullable",(e,t)=>{F.init(e,t),L(e._zod,"optin",()=>t.innerType._zod.optin),L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${xr(r.source)}|null)$`):void 0}),L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),yl=h("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>xu(s,t)):xu(n,t)}});function xu(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var vl=h("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),wl=h("$ZodNonOptional",(e,t)=>{F.init(e,t),L(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>ku(s,e)):ku(n,e)}});function ku(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var $l=h("$ZodCatch",(e,t)=>{F.init(e,t),e._zod.optin="optional",L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Ce(i,o,we()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>Ce(s,o,we()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var gs=h("$ZodPipe",(e,t)=>{F.init(e,t),L(e._zod,"values",()=>t.in._zod.values),L(e._zod,"optin",()=>t.in._zod.optin),L(e._zod,"optout",()=>t.out._zod.optout),L(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>qo(i,t.in,o)):qo(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>qo(s,t.out,o)):qo(n,t.out,o)}});function qo(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var bl=h("$ZodPreprocess",(e,t)=>{gs.init(e,t)}),zl=h("$ZodReadonly",(e,t)=>{F.init(e,t),L(e._zod,"propValues",()=>t.innerType._zod.propValues),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"optin",()=>t.innerType?._zod?.optin),L(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Su):Su(n)}});function Su(e){return e.value=Object.freeze(e.value),e}var xl=h("$ZodCustom",(e,t)=>{ie.init(e,t),F.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Pu(s,r,o,e));Pu(n,r,o,e)}});function Pu(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Lt(n))}}var r_=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[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",mac:"MAC 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"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=os(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${jo(n.values[0])}`:`Invalid option: expected one of ${Io(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.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":""}: ${Io(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function kl(){return{localeError:r_()}}var Sl,o_=Symbol("ZodOutput"),n_=Symbol("ZodInput"),_s=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Pl(){return new _s}(Sl=globalThis).__zod_globalRegistry??(Sl.__zod_globalRegistry=Pl());var mt=globalThis.__zod_globalRegistry;function Tl(e,t){return new e({type:"string",...T(t)})}function El(e,t){return new e({type:"string",coerce:!0,...T(t)})}function Rl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...T(t)})}function ys(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...T(t)})}function Ol(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...T(t)})}function Il(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(t)})}function Cl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(t)})}function Nl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(t)})}function vs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...T(t)})}function jl(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...T(t)})}function Al(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(t)})}function Zl(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...T(t)})}function Ml(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(t)})}function Dl(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...T(t)})}function ql(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...T(t)})}function Ul(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(t)})}function Ll(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(t)})}function Fl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(t)})}function Vl(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(t)})}function Hl(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(t)})}function Jl(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...T(t)})}function Kl(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...T(t)})}function Bl(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...T(t)})}function Gl(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...T(t)})}function Wl(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(t)})}function Yl(e,t){return new e({type:"string",format:"date",check:"string_format",...T(t)})}function Ql(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...T(t)})}function Xl(e,t){return new e({type:"string",format:"duration",check:"string_format",...T(t)})}function ed(e,t){return new e({type:"number",checks:[],...T(t)})}function td(e,t){return new e({type:"number",coerce:!0,checks:[],...T(t)})}function rd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...T(t)})}function od(e,t){return new e({type:"boolean",...T(t)})}function nd(e,t){return new e({type:"boolean",coerce:!0,...T(t)})}function sd(e,t){return new e({type:"bigint",coerce:!0,...T(t)})}function id(e,t){return new e({type:"null",...T(t)})}function ad(e){return new e({type:"any"})}function cd(e){return new e({type:"unknown"})}function ud(e,t){return new e({type:"never",...T(t)})}function ld(e,t){return new e({type:"date",coerce:!0,...T(t)})}function Ft(e,t){return new ls({check:"less_than",...T(t),value:e,inclusive:!1})}function nt(e,t){return new ls({check:"less_than",...T(t),value:e,inclusive:!0})}function Vt(e,t){return new ds({check:"greater_than",...T(t),value:e,inclusive:!1})}function qe(e,t){return new ds({check:"greater_than",...T(t),value:e,inclusive:!0})}function Rr(e,t){return new iu({check:"multiple_of",...T(t),value:e})}function Fo(e,t){return new cu({check:"max_length",...T(t),maximum:e})}function Ht(e,t){return new uu({check:"min_length",...T(t),minimum:e})}function Vo(e,t){return new lu({check:"length_equals",...T(t),length:e})}function ws(e,t){return new du({check:"string_format",format:"regex",...T(t),pattern:e})}function $s(e){return new pu({check:"string_format",format:"lowercase",...T(e)})}function bs(e){return new fu({check:"string_format",format:"uppercase",...T(e)})}function zs(e,t){return new mu({check:"string_format",format:"includes",...T(t),includes:e})}function xs(e,t){return new hu({check:"string_format",format:"starts_with",...T(t),prefix:e})}function ks(e,t){return new gu({check:"string_format",format:"ends_with",...T(t),suffix:e})}function ht(e){return new _u({check:"overwrite",tx:e})}function Ss(e){return ht(t=>t.normalize(e))}function Ps(){return ht(e=>e.trim())}function Ts(){return ht(e=>e.toLowerCase())}function Es(){return ht(e=>e.toUpperCase())}function Rs(){return ht(e=>Yn(e))}function dd(e,t,r){return new e({type:"array",element:t,...T(r)})}function pd(e,t,r){let o=T(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function fd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...T(r)})}function md(e,t){let r=s_(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Lt(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Lt(s))}},e(o.value,o)),t);return r}function s_(e,t){let r=new ie({check:"custom",...T(t)});return r._zod.check=e,r}function Os(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??mt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function re(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,m,l)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),re(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&_e(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Is(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
71
71
 
72
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Cs(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){o(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Object.assign(u,g),Object.assign(u,l),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(g.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let m=a._zod.parent;if(m&&m!==p){o(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Or(t,"input",e.processors),output:Or(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function _e(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return _e(o.element,r);if(o.type==="set")return _e(o.valueType,r);if(o.type==="lazy")return _e(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return _e(o.innerType,r);if(o.type==="intersection")return _e(o.left,r)||_e(o.right,r);if(o.type==="record"||o.type==="map")return _e(o.keyType,r)||_e(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:_e(o.in,r)||_e(o.out,r);if(o.type==="object"){for(let n in o.shape)if(_e(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(_e(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(_e(n,r))return!0;return!!(o.rest&&_e(o.rest,r))}return!1}var md=(e,t={})=>r=>{let o=Os({...r,processors:t});return re(e,o),Is(o,e),Cs(o,e)},Or=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Os({...n??{},target:s,io:t,processors:r});return re(e,i),Is(i,e),Cs(i,e)};var o_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hd=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=o_[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},gd=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),m?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},_d=(e,t,r,o)=>{r.type="boolean"},yd=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};var vd=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var wd=(e,t,r,o)=>{r.not={}},$d=(e,t,r,o)=>{},bd=(e,t,r,o)=>{},zd=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},xd=(e,t,r,o)=>{let n=e._zod.def,s=br(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},kd=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var Sd=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Pd=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Td=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=re(s.element,t,{...o,path:[...o.path,"items"]})},Ed=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=re(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=re(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Rd=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>re(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Od=(e,t,r,o)=>{let n=e._zod.def,s=re(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=re(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var Id=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)n.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=re(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=re(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(n.required=l)}},Cd=(e,t,r,o)=>{let n=e._zod.def,s=re(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Nd=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},jd=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Ad=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Zd=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Md=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;re(i,t,o);let a=t.seen.get(e);a.ref=i},qd=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var Ns=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType};var Ir={};Fn(Ir,{ZodISODate:()=>Ud,ZodISODateTime:()=>Dd,ZodISODuration:()=>Fd,ZodISOTime:()=>Ld,date:()=>As,datetime:()=>js,duration:()=>Ms,time:()=>Zs});var Dd=h("ZodISODateTime",(e,t)=>{Mu.init(e,t),Q.init(e,t)});function js(e){return Gl(Dd,e)}var Ud=h("ZodISODate",(e,t)=>{qu.init(e,t),Q.init(e,t)});function As(e){return Wl(Ud,e)}var Ld=h("ZodISOTime",(e,t)=>{Du.init(e,t),Q.init(e,t)});function Zs(e){return Yl(Ld,e)}var Fd=h("ZodISODuration",(e,t)=>{Uu.init(e,t),Q.init(e,t)});function Ms(e){return Ql(Fd,e)}var d_=(e,t)=>{Ao.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>is(e,r)},flatten:{value:r=>ss(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Dt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Dt,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Te=h("ZodError",d_,{Parent:Error});var Hd=Zo(Te),Jd=Mo(Te),Kd=Sr(Te),Bd=Pr(Te),Gd=$c(Te),Wd=bc(Te),Yd=zc(Te),Qd=xc(Te),Xd=kc(Te),ep=Sc(Te),tp=Pc(Te),rp=Tc(Te);var op=new WeakMap;function Cr(e,t,r){let o=Object.getPrototypeOf(e),n=op.get(o);if(n||(n=new Set,op.set(o,n)),!n.has(t)){n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var H=h("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Or(e,"input"),output:Or(e,"output")}}),e.toJSONSchema=md(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Hd(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Kd(e,r,o),e.parseAsync=async(r,o)=>Jd(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Bd(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Gd(e,r,o),e.decode=(r,o)=>Wd(e,r,o),e.encodeAsync=async(r,o)=>Yd(e,r,o),e.decodeAsync=async(r,o)=>Qd(e,r,o),e.safeEncode=(r,o)=>Xd(e,r,o),e.safeDecode=(r,o)=>ep(e,r,o),e.safeEncodeAsync=async(r,o)=>tp(e,r,o),e.safeDecodeAsync=async(r,o)=>rp(e,r,o),Cr(e,"ZodType",{check(...r){let o=this.def;return this.clone(A.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ie(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(X_(r,o))},superRefine(r,o){return this.check(ey(r,o))},overwrite(r){return this.check(ht(r))},optional(){return te(this)},exactOptional(){return U_(this)},nullable(){return ap(this)},nullish(){return te(ap(this))},nonoptional(r){return K_(this,r)},array(){return w(this)},or(r){return B([this,r])},and(r){return Ko(this,r)},transform(r){return cp(this,_p(r))},default(r){return V_(this,r)},prefault(r){return J_(this,r)},catch(r){return G_(this,r)},pipe(r){return cp(this,r)},readonly(){return Q_(this)},describe(r){let o=this.clone();return mt.add(o,{description:r}),o},meta(...r){if(r.length===0)return mt.get(this);let o=this.clone();return mt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return mt.get(e)?.description},configurable:!0}),e)),up=h("_ZodString",(e,t)=>{Lo.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>hd(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Cr(e,"_ZodString",{regex(...o){return this.check(ws(...o))},includes(...o){return this.check(zs(...o))},startsWith(...o){return this.check(xs(...o))},endsWith(...o){return this.check(ks(...o))},min(...o){return this.check(Ht(...o))},max(...o){return this.check(Fo(...o))},length(...o){return this.check(Vo(...o))},nonempty(...o){return this.check(Ht(1,...o))},lowercase(o){return this.check($s(o))},uppercase(o){return this.check(bs(o))},trim(){return this.check(Ps())},normalize(...o){return this.check(Ss(...o))},toLowerCase(){return this.check(Ts())},toUpperCase(){return this.check(Es())},slugify(){return this.check(Rs())}})}),Ds=h("ZodString",(e,t)=>{Lo.init(e,t),up.init(e,t),e.email=r=>e.check(El(f_,r)),e.url=r=>e.check(vs(lp,r)),e.jwt=r=>e.check(Bl(T_,r)),e.emoji=r=>e.check(Nl(m_,r)),e.guid=r=>e.check(ys(np,r)),e.uuid=r=>e.check(Rl(Ho,r)),e.uuidv4=r=>e.check(Ol(Ho,r)),e.uuidv6=r=>e.check(Il(Ho,r)),e.uuidv7=r=>e.check(Cl(Ho,r)),e.nanoid=r=>e.check(jl(h_,r)),e.guid=r=>e.check(ys(np,r)),e.cuid=r=>e.check(Al(g_,r)),e.cuid2=r=>e.check(Zl(__,r)),e.ulid=r=>e.check(Ml(y_,r)),e.base64=r=>e.check(Hl(k_,r)),e.base64url=r=>e.check(Jl(S_,r)),e.xid=r=>e.check(ql(v_,r)),e.ksuid=r=>e.check(Dl(w_,r)),e.ipv4=r=>e.check(Ul($_,r)),e.ipv6=r=>e.check(Ll(b_,r)),e.cidrv4=r=>e.check(Fl(z_,r)),e.cidrv6=r=>e.check(Vl(x_,r)),e.e164=r=>e.check(Kl(P_,r)),e.datetime=r=>e.check(js(r)),e.date=r=>e.check(As(r)),e.time=r=>e.check(Zs(r)),e.duration=r=>e.check(Ms(r))});function d(e){return Pl(Ds,e)}var Q=h("ZodStringFormat",(e,t)=>{G.init(e,t),up.init(e,t)}),f_=h("ZodEmail",(e,t)=>{Eu.init(e,t),Q.init(e,t)});var np=h("ZodGUID",(e,t)=>{Pu.init(e,t),Q.init(e,t)});var Ho=h("ZodUUID",(e,t)=>{Tu.init(e,t),Q.init(e,t)});var lp=h("ZodURL",(e,t)=>{Ru.init(e,t),Q.init(e,t)});function dp(e){return vs(lp,e)}var m_=h("ZodEmoji",(e,t)=>{Ou.init(e,t),Q.init(e,t)});var h_=h("ZodNanoID",(e,t)=>{Iu.init(e,t),Q.init(e,t)});var g_=h("ZodCUID",(e,t)=>{Cu.init(e,t),Q.init(e,t)});var __=h("ZodCUID2",(e,t)=>{Nu.init(e,t),Q.init(e,t)});var y_=h("ZodULID",(e,t)=>{ju.init(e,t),Q.init(e,t)});var v_=h("ZodXID",(e,t)=>{Au.init(e,t),Q.init(e,t)});var w_=h("ZodKSUID",(e,t)=>{Zu.init(e,t),Q.init(e,t)});var $_=h("ZodIPv4",(e,t)=>{Lu.init(e,t),Q.init(e,t)});var b_=h("ZodIPv6",(e,t)=>{Fu.init(e,t),Q.init(e,t)});var z_=h("ZodCIDRv4",(e,t)=>{Vu.init(e,t),Q.init(e,t)});var x_=h("ZodCIDRv6",(e,t)=>{Hu.init(e,t),Q.init(e,t)});var k_=h("ZodBase64",(e,t)=>{Ku.init(e,t),Q.init(e,t)});var S_=h("ZodBase64URL",(e,t)=>{Bu.init(e,t),Q.init(e,t)});var P_=h("ZodE164",(e,t)=>{Gu.init(e,t),Q.init(e,t)});var T_=h("ZodJWT",(e,t)=>{Wu.init(e,t),Q.init(e,t)});var Jo=h("ZodNumber",(e,t)=>{fs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>gd(e,o,n,s),Cr(e,"ZodNumber",{gt(o,n){return this.check(Vt(o,n))},gte(o,n){return this.check(De(o,n))},min(o,n){return this.check(De(o,n))},lt(o,n){return this.check(Ft(o,n))},lte(o,n){return this.check(nt(o,n))},max(o,n){return this.check(nt(o,n))},int(o){return this.check(sp(o))},safe(o){return this.check(sp(o))},positive(o){return this.check(Vt(0,o))},nonnegative(o){return this.check(De(0,o))},negative(o){return this.check(Ft(0,o))},nonpositive(o){return this.check(nt(0,o))},multipleOf(o,n){return this.check(Rr(o,n))},step(o,n){return this.check(Rr(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function U(e){return Xl(Jo,e)}var E_=h("ZodNumberFormat",(e,t)=>{Yu.init(e,t),Jo.init(e,t)});function sp(e){return td(E_,e)}var Us=h("ZodBoolean",(e,t)=>{Qu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_d(e,r,o,n)});function J(e){return rd(Us,e)}var pp=h("ZodBigInt",(e,t)=>{Xu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>yd(e,o,n,s),e.gte=(o,n)=>e.check(De(o,n)),e.min=(o,n)=>e.check(De(o,n)),e.gt=(o,n)=>e.check(Vt(o,n)),e.gte=(o,n)=>e.check(De(o,n)),e.min=(o,n)=>e.check(De(o,n)),e.lt=(o,n)=>e.check(Ft(o,n)),e.lte=(o,n)=>e.check(nt(o,n)),e.max=(o,n)=>e.check(nt(o,n)),e.positive=o=>e.check(Vt(BigInt(0),o)),e.negative=o=>e.check(Ft(BigInt(0),o)),e.nonpositive=o=>e.check(nt(BigInt(0),o)),e.nonnegative=o=>e.check(De(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Rr(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var R_=h("ZodNull",(e,t)=>{el.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vd(e,r,o,n)});function Ls(e){return sd(R_,e)}var O_=h("ZodAny",(e,t)=>{tl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$d(e,r,o,n)});function fp(){return id(O_)}var I_=h("ZodUnknown",(e,t)=>{rl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bd(e,r,o,n)});function X(){return ad(I_)}var C_=h("ZodNever",(e,t)=>{ol.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wd(e,r,o,n)});function N_(e){return cd(C_,e)}var mp=h("ZodDate",(e,t)=>{nl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>zd(e,o,n,s),e.min=(o,n)=>e.check(De(o,n)),e.max=(o,n)=>e.check(nt(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var j_=h("ZodArray",(e,t)=>{sl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Td(e,r,o,n),e.element=t.element,Cr(e,"ZodArray",{min(r,o){return this.check(Ht(r,o))},nonempty(r){return this.check(Ht(1,r))},max(r,o){return this.check(Fo(r,o))},length(r,o){return this.check(Vo(r,o))},unwrap(){return this.element}})});function w(e,t){return ld(j_,e,t)}var hp=h("ZodObject",(e,t)=>{cl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ed(e,r,o,n),A.defineLazy(e,"shape",()=>t.shape),Cr(e,"ZodObject",{keyof(){return $e(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:N_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return A.extend(this,r)},safeExtend(r){return A.safeExtend(this,r)},merge(r){return A.merge(this,r)},pick(r){return A.pick(this,r)},omit(r){return A.omit(this,r)},partial(...r){return A.partial(yp,this,r[0])},required(...r){return A.required(vp,this,r[0])}})});function $(e,t){let r={type:"object",shape:e??{},...A.normalizeParams(t)};return new hp(r)}function se(e,t){return new hp({type:"object",shape:e,catchall:X(),...A.normalizeParams(t)})}var gp=h("ZodUnion",(e,t)=>{ms.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rd(e,r,o,n),e.options=t.options});function B(e,t){return new gp({type:"union",options:e,...A.normalizeParams(t)})}var A_=h("ZodDiscriminatedUnion",(e,t)=>{gp.init(e,t),ul.init(e,t)});function Fs(e,t,r){return new A_({type:"union",options:t,discriminator:e,...A.normalizeParams(r)})}var Z_=h("ZodIntersection",(e,t)=>{ll.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Od(e,r,o,n)});function Ko(e,t){return new Z_({type:"intersection",left:e,right:t})}var ip=h("ZodRecord",(e,t)=>{dl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Id(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return!t||!t._zod?new ip({type:"record",keyType:d(),valueType:e,...A.normalizeParams(t)}):new ip({type:"record",keyType:e,valueType:t,...A.normalizeParams(r)})}var qs=h("ZodEnum",(e,t)=>{pl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>xd(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new qs({...t,checks:[],...A.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new qs({...t,checks:[],...A.normalizeParams(n),entries:s})}});function $e(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new qs({type:"enum",entries:r,...A.normalizeParams(t)})}var M_=h("ZodLiteral",(e,t)=>{fl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kd(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function k(e,t){return new M_({type:"literal",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var q_=h("ZodTransform",(e,t)=>{ml.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pd(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Mt(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(A.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(A.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function _p(e){return new q_({type:"transform",transform:e})}var yp=h("ZodOptional",(e,t)=>{hs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ns(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function te(e){return new yp({type:"optional",innerType:e})}var D_=h("ZodExactOptional",(e,t)=>{hl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ns(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function U_(e){return new D_({type:"optional",innerType:e})}var L_=h("ZodNullable",(e,t)=>{gl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ap(e){return new L_({type:"nullable",innerType:e})}var F_=h("ZodDefault",(e,t)=>{_l.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function V_(e,t){return new F_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var H_=h("ZodPrefault",(e,t)=>{yl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ad(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function J_(e,t){return new H_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var vp=h("ZodNonOptional",(e,t)=>{vl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Nd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function K_(e,t){return new vp({type:"nonoptional",innerType:e,...A.normalizeParams(t)})}var B_=h("ZodCatch",(e,t)=>{wl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function G_(e,t){return new B_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var wp=h("ZodPipe",(e,t)=>{gs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Md(e,r,o,n),e.in=t.in,e.out=t.out});function cp(e,t){return new wp({type:"pipe",in:e,out:t})}var W_=h("ZodPreprocess",(e,t)=>{wp.init(e,t),$l.init(e,t)}),Y_=h("ZodReadonly",(e,t)=>{bl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Q_(e){return new Y_({type:"readonly",innerType:e})}var $p=h("ZodCustom",(e,t)=>{zl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sd(e,r,o,n)});function bp(e,t){return dd($p,e??(()=>!0),t)}function X_(e,t={}){return pd($p,e,t)}function ey(e,t){return fd(e,t)}function Vs(e,t){return new W_({type:"pipe",in:_p(e),out:t})}var xp={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var zp;zp||(zp={});var Bo={};Fn(Bo,{bigint:()=>ny,boolean:()=>oy,date:()=>sy,number:()=>ry,string:()=>ty});function ty(e){return Tl(Ds,e)}function ry(e){return ed(Jo,e)}function oy(e){return od(Us,e)}function ny(e){return nd(pp,e)}function sy(e){return ud(mp,e)}we(xl());var kp="io.modelcontextprotocol/related-task",Wo="2.0",ae=bp(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Sp=B([d(),U().int()]),Pp=d(),bP=se({ttl:B([U(),Ls()]).optional(),pollInterval:U().optional()}),ay=$({ttl:U().optional()}),cy=$({taskId:d()}),Hs=se({progressToken:Sp.optional(),[kp]:cy.optional()}),Ee=$({_meta:Hs.optional()}),Yo=Ee.extend({task:ay.optional()});var ce=$({method:d(),params:Ee.loose().optional()}),Ne=$({_meta:Hs.optional()}),je=$({method:d(),params:Ne.loose().optional()}),ue=se({_meta:Hs.optional()}),Qo=B([d(),U().int()]),uy=$({jsonrpc:k(Wo),id:Qo,...ce.shape}).strict();var ly=$({jsonrpc:k(Wo),...je.shape}).strict();var Tp=$({jsonrpc:k(Wo),id:Qo,result:ue}).strict();var Nr;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Nr||(Nr={}));var Ep=$({jsonrpc:k(Wo),id:Qo.optional(),error:$({code:U().int(),message:d(),data:X().optional()})}).strict();var dy=B([uy,ly,Tp,Ep]),zP=B([Tp,Ep]),Js=ue.strict(),py=Ne.extend({requestId:Qo.optional(),reason:d().optional()}),Ks=je.extend({method:k("notifications/cancelled"),params:py}),fy=$({src:d(),mimeType:d().optional(),sizes:w(d()).optional(),theme:$e(["light","dark"]).optional()}),jr=$({icons:w(fy).optional()}),Kt=$({name:d(),title:d().optional()}),Rp=Kt.extend({...Kt.shape,...jr.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),my=Ko($({applyDefaults:J().optional()}),ee(d(),X())),hy=Vs(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ko($({form:my.optional(),url:ae.optional()}),ee(d(),X()).optional())),gy=se({list:ae.optional(),cancel:ae.optional(),requests:se({sampling:se({createMessage:ae.optional()}).optional(),elicitation:se({create:ae.optional()}).optional()}).optional()}),_y=se({list:ae.optional(),cancel:ae.optional(),requests:se({tools:se({call:ae.optional()}).optional()}).optional()}),yy=$({experimental:ee(d(),ae).optional(),sampling:$({context:ae.optional(),tools:ae.optional()}).optional(),elicitation:hy.optional(),roots:$({listChanged:J().optional()}).optional(),tasks:gy.optional()}),vy=Ee.extend({protocolVersion:d(),capabilities:yy,clientInfo:Rp}),wy=ce.extend({method:k("initialize"),params:vy});var $y=$({experimental:ee(d(),ae).optional(),logging:ae.optional(),completions:ae.optional(),prompts:$({listChanged:J().optional()}).optional(),resources:$({subscribe:J().optional(),listChanged:J().optional()}).optional(),tools:$({listChanged:J().optional()}).optional(),tasks:_y.optional()}),Op=ue.extend({protocolVersion:d(),capabilities:$y,serverInfo:Rp,instructions:d().optional()}),by=je.extend({method:k("notifications/initialized"),params:Ne.optional()});var Bs=ce.extend({method:k("ping"),params:Ee.optional()}),zy=$({progress:U(),total:te(U()),message:te(d())}),xy=$({...Ne.shape,...zy.shape,progressToken:Sp}),Gs=je.extend({method:k("notifications/progress"),params:xy}),ky=Ee.extend({cursor:Pp.optional()}),Ar=ce.extend({params:ky.optional()}),Zr=ue.extend({nextCursor:Pp.optional()}),Sy=$e(["working","input_required","completed","failed","cancelled"]),Mr=$({taskId:d(),status:Sy,ttl:B([U(),Ls()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:te(U()),statusMessage:te(d())}),Xo=ue.extend({task:Mr}),Py=Ne.merge(Mr),Ws=je.extend({method:k("notifications/tasks/status"),params:Py}),Ys=ce.extend({method:k("tasks/get"),params:Ee.extend({taskId:d()})}),Qs=ue.merge(Mr),Xs=ce.extend({method:k("tasks/result"),params:Ee.extend({taskId:d()})}),xP=ue.loose(),ei=Ar.extend({method:k("tasks/list")}),ti=Zr.extend({tasks:w(Mr)}),ri=ce.extend({method:k("tasks/cancel"),params:Ee.extend({taskId:d()})}),Ty=ue.merge(Mr),Ip=$({uri:d(),mimeType:te(d()),_meta:ee(d(),X()).optional()}),Cp=Ip.extend({text:d()}),oi=d().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Np=Ip.extend({blob:oi}),qr=$e(["user","assistant"]),Bt=$({audience:w(qr).optional(),priority:U().min(0).max(1).optional(),lastModified:Ir.datetime({offset:!0}).optional()}),jp=$({...Kt.shape,...jr.shape,uri:d(),description:te(d()),mimeType:te(d()),annotations:Bt.optional(),_meta:te(se({}))}),Ey=$({...Kt.shape,...jr.shape,uriTemplate:d(),description:te(d()),mimeType:te(d()),annotations:Bt.optional(),_meta:te(se({}))}),Ry=Ar.extend({method:k("resources/list")}),Ap=Zr.extend({resources:w(jp)}),Oy=Ar.extend({method:k("resources/templates/list")}),Zp=Zr.extend({resourceTemplates:w(Ey)}),ni=Ee.extend({uri:d()}),Iy=ni,Cy=ce.extend({method:k("resources/read"),params:Iy}),Mp=ue.extend({contents:w(B([Cp,Np]))}),qp=je.extend({method:k("notifications/resources/list_changed"),params:Ne.optional()}),Ny=ni,jy=ce.extend({method:k("resources/subscribe"),params:Ny}),Ay=ni,Zy=ce.extend({method:k("resources/unsubscribe"),params:Ay}),My=Ne.extend({uri:d()}),qy=je.extend({method:k("notifications/resources/updated"),params:My}),Dy=$({name:d(),description:te(d()),required:te(J())}),Uy=$({...Kt.shape,...jr.shape,description:te(d()),arguments:te(w(Dy)),_meta:te(se({}))}),Ly=Ar.extend({method:k("prompts/list")}),Dp=Zr.extend({prompts:w(Uy)}),Fy=Ee.extend({name:d(),arguments:ee(d(),d()).optional()}),Vy=ce.extend({method:k("prompts/get"),params:Fy}),si=$({type:k("text"),text:d(),annotations:Bt.optional(),_meta:ee(d(),X()).optional()}),ii=$({type:k("image"),data:oi,mimeType:d(),annotations:Bt.optional(),_meta:ee(d(),X()).optional()}),ai=$({type:k("audio"),data:oi,mimeType:d(),annotations:Bt.optional(),_meta:ee(d(),X()).optional()}),Hy=$({type:k("tool_use"),name:d(),id:d(),input:ee(d(),X()),_meta:ee(d(),X()).optional()}),Jy=$({type:k("resource"),resource:B([Cp,Np]),annotations:Bt.optional(),_meta:ee(d(),X()).optional()}),Ky=jp.extend({type:k("resource_link")}),ci=B([si,ii,ai,Ky,Jy]),By=$({role:qr,content:ci}),Up=ue.extend({description:d().optional(),messages:w(By)}),Lp=je.extend({method:k("notifications/prompts/list_changed"),params:Ne.optional()}),Gy=$({title:d().optional(),readOnlyHint:J().optional(),destructiveHint:J().optional(),idempotentHint:J().optional(),openWorldHint:J().optional()}),Wy=$({taskSupport:$e(["required","optional","forbidden"]).optional()}),Fp=$({...Kt.shape,...jr.shape,description:d().optional(),inputSchema:$({type:k("object"),properties:ee(d(),ae).optional(),required:w(d()).optional()}).catchall(X()),outputSchema:$({type:k("object"),properties:ee(d(),ae).optional(),required:w(d()).optional()}).catchall(X()).optional(),annotations:Gy.optional(),execution:Wy.optional(),_meta:ee(d(),X()).optional()}),Yy=Ar.extend({method:k("tools/list")}),Vp=Zr.extend({tools:w(Fp)}),en=ue.extend({content:w(ci).default([]),structuredContent:ee(d(),X()).optional(),isError:J().optional()}),kP=en.or(ue.extend({toolResult:X()})),Qy=Yo.extend({name:d(),arguments:ee(d(),X()).optional()}),Xy=ce.extend({method:k("tools/call"),params:Qy}),ui=je.extend({method:k("notifications/tools/list_changed"),params:Ne.optional()}),ev=$({autoRefresh:J().default(!0),debounceMs:U().int().nonnegative().default(300)}),Hp=$e(["debug","info","notice","warning","error","critical","alert","emergency"]),tv=Ee.extend({level:Hp}),rv=ce.extend({method:k("logging/setLevel"),params:tv}),ov=Ne.extend({level:Hp,logger:d().optional(),data:X()}),nv=je.extend({method:k("notifications/message"),params:ov}),sv=$({name:d().optional()}),iv=$({hints:w(sv).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),av=$({mode:$e(["auto","required","none"]).optional()}),cv=$({type:k("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:w(ci).default([]),structuredContent:$({}).loose().optional(),isError:J().optional(),_meta:ee(d(),X()).optional()}),uv=Fs("type",[si,ii,ai]),Go=Fs("type",[si,ii,ai,Hy,cv]),lv=$({role:qr,content:B([Go,w(Go)]),_meta:ee(d(),X()).optional()}),dv=Yo.extend({messages:w(lv),modelPreferences:iv.optional(),systemPrompt:d().optional(),includeContext:$e(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:w(d()).optional(),metadata:ae.optional(),tools:w(Fp).optional(),toolChoice:av.optional()}),Jp=ce.extend({method:k("sampling/createMessage"),params:dv}),Kp=ue.extend({model:d(),stopReason:te($e(["endTurn","stopSequence","maxTokens"]).or(d())),role:qr,content:uv}),Bp=ue.extend({model:d(),stopReason:te($e(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:qr,content:B([Go,w(Go)])}),pv=$({type:k("boolean"),title:d().optional(),description:d().optional(),default:J().optional()}),fv=$({type:k("string"),title:d().optional(),description:d().optional(),minLength:U().optional(),maxLength:U().optional(),format:$e(["email","uri","date","date-time"]).optional(),default:d().optional()}),mv=$({type:$e(["number","integer"]),title:d().optional(),description:d().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),hv=$({type:k("string"),title:d().optional(),description:d().optional(),enum:w(d()),default:d().optional()}),gv=$({type:k("string"),title:d().optional(),description:d().optional(),oneOf:w($({const:d(),title:d()})),default:d().optional()}),_v=$({type:k("string"),title:d().optional(),description:d().optional(),enum:w(d()),enumNames:w(d()).optional(),default:d().optional()}),yv=B([hv,gv]),vv=$({type:k("array"),title:d().optional(),description:d().optional(),minItems:U().optional(),maxItems:U().optional(),items:$({type:k("string"),enum:w(d())}),default:w(d()).optional()}),wv=$({type:k("array"),title:d().optional(),description:d().optional(),minItems:U().optional(),maxItems:U().optional(),items:$({anyOf:w($({const:d(),title:d()}))}),default:w(d()).optional()}),$v=B([vv,wv]),bv=B([_v,yv,$v]),zv=B([bv,pv,fv,mv]),xv=Yo.extend({mode:k("form").optional(),message:d(),requestedSchema:$({type:k("object"),properties:ee(d(),zv),required:w(d()).optional()})}),kv=Yo.extend({mode:k("url"),message:d(),elicitationId:d(),url:d().url()}),Sv=B([xv,kv]),Gp=ce.extend({method:k("elicitation/create"),params:Sv}),Pv=Ne.extend({elicitationId:d()}),Tv=je.extend({method:k("notifications/elicitation/complete"),params:Pv}),Wp=ue.extend({action:$e(["accept","decline","cancel"]),content:Vs(e=>e===null?void 0:e,ee(d(),B([d(),U(),J(),w(d())])).optional())}),Ev=$({type:k("ref/resource"),uri:d()});var Rv=$({type:k("ref/prompt"),name:d()}),Ov=Ee.extend({ref:B([Rv,Ev]),argument:$({name:d(),value:d()}),context:$({arguments:ee(d(),d()).optional()}).optional()}),Iv=ce.extend({method:k("completion/complete"),params:Ov});var Yp=ue.extend({completion:se({values:w(d()).max(100),total:te(U().int()),hasMore:te(J())})}),Cv=$({uri:d().startsWith("file://"),name:d().optional(),_meta:ee(d(),X()).optional()}),Nv=ce.extend({method:k("roots/list"),params:Ee.optional()}),jv=ue.extend({roots:w(Cv)}),Av=je.extend({method:k("notifications/roots/list_changed"),params:Ne.optional()}),SP=B([Bs,wy,Iv,rv,Vy,Ly,Ry,Oy,Cy,jy,Zy,Xy,Yy,Ys,Xs,ei,ri]),PP=B([Ks,Gs,by,Av,Ws]),TP=B([Js,Kp,Bp,Wp,jv,Qs,ti,Xo]),EP=B([Bs,Jp,Gp,Nv,Ys,Xs,ei,ri]),RP=B([Ks,Gs,nv,qy,qp,ui,Lp,Ws,Tv]),OP=B([Js,Op,Yp,Up,Dp,Ap,Zp,Mp,en,Vp,Qs,ti,Xo]);var Zv=Symbol("Let zodToJsonSchema decide on which parser to use");var lT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var Zx=wg(Dh(),1);var qx;qx=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);var fe=dp().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:xp.custom,message:"URL must be parseable",fatal:!0}),Kn}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Dx=se({resource:d().url(),authorization_servers:w(fe).optional(),jwks_uri:d().url().optional(),scopes_supported:w(d()).optional(),bearer_methods_supported:w(d()).optional(),resource_signing_alg_values_supported:w(d()).optional(),resource_name:d().optional(),resource_documentation:d().optional(),resource_policy_uri:d().url().optional(),resource_tos_uri:d().url().optional(),tls_client_certificate_bound_access_tokens:J().optional(),authorization_details_types_supported:w(d()).optional(),dpop_signing_alg_values_supported:w(d()).optional(),dpop_bound_access_tokens_required:J().optional()}),Lh=se({issuer:d(),authorization_endpoint:fe,token_endpoint:fe,registration_endpoint:fe.optional(),scopes_supported:w(d()).optional(),response_types_supported:w(d()),response_modes_supported:w(d()).optional(),grant_types_supported:w(d()).optional(),token_endpoint_auth_methods_supported:w(d()).optional(),token_endpoint_auth_signing_alg_values_supported:w(d()).optional(),service_documentation:fe.optional(),revocation_endpoint:fe.optional(),revocation_endpoint_auth_methods_supported:w(d()).optional(),revocation_endpoint_auth_signing_alg_values_supported:w(d()).optional(),introspection_endpoint:d().optional(),introspection_endpoint_auth_methods_supported:w(d()).optional(),introspection_endpoint_auth_signing_alg_values_supported:w(d()).optional(),code_challenge_methods_supported:w(d()).optional(),client_id_metadata_document_supported:J().optional()}),Ux=se({issuer:d(),authorization_endpoint:fe,token_endpoint:fe,userinfo_endpoint:fe.optional(),jwks_uri:fe,registration_endpoint:fe.optional(),scopes_supported:w(d()).optional(),response_types_supported:w(d()),response_modes_supported:w(d()).optional(),grant_types_supported:w(d()).optional(),acr_values_supported:w(d()).optional(),subject_types_supported:w(d()),id_token_signing_alg_values_supported:w(d()),id_token_encryption_alg_values_supported:w(d()).optional(),id_token_encryption_enc_values_supported:w(d()).optional(),userinfo_signing_alg_values_supported:w(d()).optional(),userinfo_encryption_alg_values_supported:w(d()).optional(),userinfo_encryption_enc_values_supported:w(d()).optional(),request_object_signing_alg_values_supported:w(d()).optional(),request_object_encryption_alg_values_supported:w(d()).optional(),request_object_encryption_enc_values_supported:w(d()).optional(),token_endpoint_auth_methods_supported:w(d()).optional(),token_endpoint_auth_signing_alg_values_supported:w(d()).optional(),display_values_supported:w(d()).optional(),claim_types_supported:w(d()).optional(),claims_supported:w(d()).optional(),service_documentation:d().optional(),claims_locales_supported:w(d()).optional(),ui_locales_supported:w(d()).optional(),claims_parameter_supported:J().optional(),request_parameter_supported:J().optional(),request_uri_parameter_supported:J().optional(),require_request_uri_registration:J().optional(),op_policy_uri:fe.optional(),op_tos_uri:fe.optional(),client_id_metadata_document_supported:J().optional()}),Lx=$({...Ux.shape,...Lh.pick({code_challenge_methods_supported:!0}).shape}),Fx=$({access_token:d(),id_token:d().optional(),token_type:d(),expires_in:Bo.number().optional(),scope:d().optional(),refresh_token:d().optional()}).strip(),Vx=$({error:d(),error_description:d().optional(),error_uri:d().optional()}),Uh=fe.optional().or(k("").transform(()=>{})),Hx=$({redirect_uris:w(fe),token_endpoint_auth_method:d().optional(),grant_types:w(d()).optional(),response_types:w(d()).optional(),client_name:d().optional(),client_uri:fe.optional(),logo_uri:Uh,scope:d().optional(),contacts:w(d()).optional(),tos_uri:Uh,policy_uri:d().optional(),jwks_uri:fe.optional(),jwks:fp().optional(),software_id:d().optional(),software_version:d().optional(),software_statement:d().optional()}).strip(),Jx=$({client_id:d(),client_secret:d().optional(),client_id_issued_at:U().optional(),client_secret_expires_at:U().optional()}).strip(),Kx=Hx.merge(Jx),WI=$({error:d(),error_description:d().optional()}).strip(),YI=$({token:d(),token_type_hint:d().optional()}).strip();var ne=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},_o=class extends ne{};_o.errorCode="invalid_request";var pr=class extends ne{};pr.errorCode="invalid_client";var fr=class extends ne{};fr.errorCode="invalid_grant";var mr=class extends ne{};mr.errorCode="unauthorized_client";var yo=class extends ne{};yo.errorCode="unsupported_grant_type";var vo=class extends ne{};vo.errorCode="invalid_scope";var wo=class extends ne{};wo.errorCode="access_denied";var hr=class extends ne{};hr.errorCode="server_error";var $o=class extends ne{};$o.errorCode="temporarily_unavailable";var bo=class extends ne{};bo.errorCode="unsupported_response_type";var zo=class extends ne{};zo.errorCode="unsupported_token_type";var xo=class extends ne{};xo.errorCode="invalid_token";var ko=class extends ne{};ko.errorCode="method_not_allowed";var So=class extends ne{};So.errorCode="too_many_requests";var gr=class extends ne{};gr.errorCode="invalid_client_metadata";var Po=class extends ne{};Po.errorCode="insufficient_scope";var To=class extends ne{};To.errorCode="invalid_target";var Bx={[_o.errorCode]:_o,[pr.errorCode]:pr,[fr.errorCode]:fr,[mr.errorCode]:mr,[yo.errorCode]:yo,[vo.errorCode]:vo,[wo.errorCode]:wo,[hr.errorCode]:hr,[$o.errorCode]:$o,[bo.errorCode]:bo,[zo.errorCode]:zo,[xo.errorCode]:xo,[ko.errorCode]:ko,[So.errorCode]:So,[gr.errorCode]:gr,[Po.errorCode]:Po,[To.errorCode]:To};async function Gx(e){let{exec:t}=await import("node:child_process"),{promisify:r}=await import("node:util"),o=r(t),n=process.platform,s=n==="darwin"?`open "${e}"`:n==="win32"?`start "" "${e}"`:`xdg-open "${e}"`;await o(s)}function Fh(e){return new Promise(t=>setTimeout(t,e))}function Eo(e){try{let t=e.split(".")[1];if(!t)return;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8"));return typeof r.email=="string"?r.email:void 0}catch{return}}async function Wx(e){let t=e.fetchImpl??fetch,r={clientId:e.clientId??"gigabuddy-cli"};e.productId!==void 0&&(r.productId=e.productId),e.scopes!==void 0&&(r.scopes=e.scopes);let o=await t(`${e.authUrl}/api/auth/device/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Failed to start device flow: ${await o.text()}`);let{deviceCode:n,userCode:s,verificationUrl:i,expiresIn:a,interval:c}=await o.json();return{deviceCode:n,userCode:s,verificationUrl:i,expiresIn:a,interval:c}}async function Yx(e,t,r={}){let o=r.fetchImpl??fetch,n=Date.now()+t.expiresIn*1e3,s=(t.interval||5)*1e3;for(;Date.now()<n;){await Fh(s);let i=await o(`${e}/api/auth/device/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:t.deviceCode})});if(i.status===429){await Fh(s);continue}if(!i.ok)continue;let a=await i.json();if(a.status==="complete"&&a.platformToken&&a.refreshToken&&a.userId)return{refreshToken:a.refreshToken,platformToken:a.platformToken,userId:a.userId,userEmail:a.userEmail??Eo(a.platformToken)};if(a.status==="expired")throw new Error("Device code expired. Please try again.");r.onPending?.()}throw new Error("Authentication timed out. Please try again.")}async function Vh(e){let t=await Wx({authUrl:e.authUrl,clientId:e.clientId??"gigabuddy-cli",productId:e.productId??"gigabuddy/studio",scopes:e.scopes,fetchImpl:e.fetchImpl});return e.onPrompt?.({verificationUrl:t.verificationUrl,userCode:t.userCode}),(e.openBrowserImpl??Gx)(t.verificationUrl).catch(()=>{}),Yx(e.authUrl,t,{onPending:e.onPending,fetchImpl:e.fetchImpl})}function Zt(e){let t=new URL(e),r=t.pathname.replace(/\/+$/,"");return`//${t.host}${r}/:_authToken`}function Ro(e){return`${e}:registry`}function Zn(e){return e.replace(/\/+$/,"")+"/"}function Hh(e,t){let r=Zn(t.registryUrl),o=new Map([[Ro(t.scope).toLowerCase(),`${Ro(t.scope)}=${r}`],[Zt(r).toLowerCase(),`${Zt(r)}=${t.token}`]]),n=e.length>0?e.split(`
73
- `):[],s=new Set,i=[];for(let c of n){let u=Kh(c);if(u&&o.has(u)){if(s.has(u))continue;s.add(u),i.push(o.get(u));continue}i.push(c)}let a=[...o.entries()].filter(([c])=>!s.has(c)).map(([,c])=>c);if(a.length===0)return i.join(`
72
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Cs(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){o(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Object.assign(u,g),Object.assign(u,l),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(g.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let m=a._zod.parent;if(m&&m!==p){o(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Or(t,"input",e.processors),output:Or(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function _e(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return _e(o.element,r);if(o.type==="set")return _e(o.valueType,r);if(o.type==="lazy")return _e(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return _e(o.innerType,r);if(o.type==="intersection")return _e(o.left,r)||_e(o.right,r);if(o.type==="record"||o.type==="map")return _e(o.keyType,r)||_e(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:_e(o.in,r)||_e(o.out,r);if(o.type==="object"){for(let n in o.shape)if(_e(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(_e(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(_e(n,r))return!0;return!!(o.rest&&_e(o.rest,r))}return!1}var hd=(e,t={})=>r=>{let o=Os({...r,processors:t});return re(e,o),Is(o,e),Cs(o,e)},Or=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Os({...n??{},target:s,io:t,processors:r});return re(e,i),Is(i,e),Cs(i,e)};var i_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gd=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=i_[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},_d=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),m?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},yd=(e,t,r,o)=>{r.type="boolean"},vd=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};var wd=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var $d=(e,t,r,o)=>{r.not={}},bd=(e,t,r,o)=>{},zd=(e,t,r,o)=>{},xd=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},kd=(e,t,r,o)=>{let n=e._zod.def,s=br(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Sd=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var Pd=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Td=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Ed=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=re(s.element,t,{...o,path:[...o.path,"items"]})},Rd=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=re(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=re(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Od=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>re(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Id=(e,t,r,o)=>{let n=e._zod.def,s=re(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=re(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var Cd=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)n.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=re(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=re(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(n.required=l)}},Nd=(e,t,r,o)=>{let n=e._zod.def,s=re(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},jd=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Ad=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Zd=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Md=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Dd=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;re(i,t,o);let a=t.seen.get(e);a.ref=i},qd=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var Ns=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType};var Ir={};Fn(Ir,{ZodISODate:()=>Ld,ZodISODateTime:()=>Ud,ZodISODuration:()=>Vd,ZodISOTime:()=>Fd,date:()=>As,datetime:()=>js,duration:()=>Ms,time:()=>Zs});var Ud=h("ZodISODateTime",(e,t)=>{Du.init(e,t),Q.init(e,t)});function js(e){return Wl(Ud,e)}var Ld=h("ZodISODate",(e,t)=>{qu.init(e,t),Q.init(e,t)});function As(e){return Yl(Ld,e)}var Fd=h("ZodISOTime",(e,t)=>{Uu.init(e,t),Q.init(e,t)});function Zs(e){return Ql(Fd,e)}var Vd=h("ZodISODuration",(e,t)=>{Lu.init(e,t),Q.init(e,t)});function Ms(e){return Xl(Vd,e)}var m_=(e,t)=>{Ao.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>is(e,r)},flatten:{value:r=>ss(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,qt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,qt,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Te=h("ZodError",m_,{Parent:Error});var Jd=Zo(Te),Kd=Mo(Te),Bd=Sr(Te),Gd=Pr(Te),Wd=bc(Te),Yd=zc(Te),Qd=xc(Te),Xd=kc(Te),ep=Sc(Te),tp=Pc(Te),rp=Tc(Te),op=Ec(Te);var np=new WeakMap;function Cr(e,t,r){let o=Object.getPrototypeOf(e),n=np.get(o);if(n||(n=new Set,np.set(o,n)),!n.has(t)){n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var H=h("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Or(e,"input"),output:Or(e,"output")}}),e.toJSONSchema=hd(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Jd(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Bd(e,r,o),e.parseAsync=async(r,o)=>Kd(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Gd(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Wd(e,r,o),e.decode=(r,o)=>Yd(e,r,o),e.encodeAsync=async(r,o)=>Qd(e,r,o),e.decodeAsync=async(r,o)=>Xd(e,r,o),e.safeEncode=(r,o)=>ep(e,r,o),e.safeDecode=(r,o)=>tp(e,r,o),e.safeEncodeAsync=async(r,o)=>rp(e,r,o),e.safeDecodeAsync=async(r,o)=>op(e,r,o),Cr(e,"ZodType",{check(...r){let o=this.def;return this.clone(A.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ie(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(ry(r,o))},superRefine(r,o){return this.check(oy(r,o))},overwrite(r){return this.check(ht(r))},optional(){return te(this)},exactOptional(){return V_(this)},nullable(){return cp(this)},nullish(){return te(cp(this))},nonoptional(r){return W_(this,r)},array(){return w(this)},or(r){return B([this,r])},and(r){return Ko(this,r)},transform(r){return up(this,yp(r))},default(r){return K_(this,r)},prefault(r){return G_(this,r)},catch(r){return Q_(this,r)},pipe(r){return up(this,r)},readonly(){return ty(this)},describe(r){let o=this.clone();return mt.add(o,{description:r}),o},meta(...r){if(r.length===0)return mt.get(this);let o=this.clone();return mt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return mt.get(e)?.description},configurable:!0}),e)),lp=h("_ZodString",(e,t)=>{Lo.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>gd(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Cr(e,"_ZodString",{regex(...o){return this.check(ws(...o))},includes(...o){return this.check(zs(...o))},startsWith(...o){return this.check(xs(...o))},endsWith(...o){return this.check(ks(...o))},min(...o){return this.check(Ht(...o))},max(...o){return this.check(Fo(...o))},length(...o){return this.check(Vo(...o))},nonempty(...o){return this.check(Ht(1,...o))},lowercase(o){return this.check($s(o))},uppercase(o){return this.check(bs(o))},trim(){return this.check(Ps())},normalize(...o){return this.check(Ss(...o))},toLowerCase(){return this.check(Ts())},toUpperCase(){return this.check(Es())},slugify(){return this.check(Rs())}})}),qs=h("ZodString",(e,t)=>{Lo.init(e,t),lp.init(e,t),e.email=r=>e.check(Rl(g_,r)),e.url=r=>e.check(vs(dp,r)),e.jwt=r=>e.check(Gl(O_,r)),e.emoji=r=>e.check(jl(__,r)),e.guid=r=>e.check(ys(sp,r)),e.uuid=r=>e.check(Ol(Ho,r)),e.uuidv4=r=>e.check(Il(Ho,r)),e.uuidv6=r=>e.check(Cl(Ho,r)),e.uuidv7=r=>e.check(Nl(Ho,r)),e.nanoid=r=>e.check(Al(y_,r)),e.guid=r=>e.check(ys(sp,r)),e.cuid=r=>e.check(Zl(v_,r)),e.cuid2=r=>e.check(Ml(w_,r)),e.ulid=r=>e.check(Dl($_,r)),e.base64=r=>e.check(Jl(T_,r)),e.base64url=r=>e.check(Kl(E_,r)),e.xid=r=>e.check(ql(b_,r)),e.ksuid=r=>e.check(Ul(z_,r)),e.ipv4=r=>e.check(Ll(x_,r)),e.ipv6=r=>e.check(Fl(k_,r)),e.cidrv4=r=>e.check(Vl(S_,r)),e.cidrv6=r=>e.check(Hl(P_,r)),e.e164=r=>e.check(Bl(R_,r)),e.datetime=r=>e.check(js(r)),e.date=r=>e.check(As(r)),e.time=r=>e.check(Zs(r)),e.duration=r=>e.check(Ms(r))});function d(e){return Tl(qs,e)}var Q=h("ZodStringFormat",(e,t)=>{G.init(e,t),lp.init(e,t)}),g_=h("ZodEmail",(e,t)=>{Ru.init(e,t),Q.init(e,t)});var sp=h("ZodGUID",(e,t)=>{Tu.init(e,t),Q.init(e,t)});var Ho=h("ZodUUID",(e,t)=>{Eu.init(e,t),Q.init(e,t)});var dp=h("ZodURL",(e,t)=>{Ou.init(e,t),Q.init(e,t)});function pp(e){return vs(dp,e)}var __=h("ZodEmoji",(e,t)=>{Iu.init(e,t),Q.init(e,t)});var y_=h("ZodNanoID",(e,t)=>{Cu.init(e,t),Q.init(e,t)});var v_=h("ZodCUID",(e,t)=>{Nu.init(e,t),Q.init(e,t)});var w_=h("ZodCUID2",(e,t)=>{ju.init(e,t),Q.init(e,t)});var $_=h("ZodULID",(e,t)=>{Au.init(e,t),Q.init(e,t)});var b_=h("ZodXID",(e,t)=>{Zu.init(e,t),Q.init(e,t)});var z_=h("ZodKSUID",(e,t)=>{Mu.init(e,t),Q.init(e,t)});var x_=h("ZodIPv4",(e,t)=>{Fu.init(e,t),Q.init(e,t)});var k_=h("ZodIPv6",(e,t)=>{Vu.init(e,t),Q.init(e,t)});var S_=h("ZodCIDRv4",(e,t)=>{Hu.init(e,t),Q.init(e,t)});var P_=h("ZodCIDRv6",(e,t)=>{Ju.init(e,t),Q.init(e,t)});var T_=h("ZodBase64",(e,t)=>{Bu.init(e,t),Q.init(e,t)});var E_=h("ZodBase64URL",(e,t)=>{Gu.init(e,t),Q.init(e,t)});var R_=h("ZodE164",(e,t)=>{Wu.init(e,t),Q.init(e,t)});var O_=h("ZodJWT",(e,t)=>{Yu.init(e,t),Q.init(e,t)});var Jo=h("ZodNumber",(e,t)=>{fs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>_d(e,o,n,s),Cr(e,"ZodNumber",{gt(o,n){return this.check(Vt(o,n))},gte(o,n){return this.check(qe(o,n))},min(o,n){return this.check(qe(o,n))},lt(o,n){return this.check(Ft(o,n))},lte(o,n){return this.check(nt(o,n))},max(o,n){return this.check(nt(o,n))},int(o){return this.check(ip(o))},safe(o){return this.check(ip(o))},positive(o){return this.check(Vt(0,o))},nonnegative(o){return this.check(qe(0,o))},negative(o){return this.check(Ft(0,o))},nonpositive(o){return this.check(nt(0,o))},multipleOf(o,n){return this.check(Rr(o,n))},step(o,n){return this.check(Rr(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function U(e){return ed(Jo,e)}var I_=h("ZodNumberFormat",(e,t)=>{Qu.init(e,t),Jo.init(e,t)});function ip(e){return rd(I_,e)}var Us=h("ZodBoolean",(e,t)=>{Xu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yd(e,r,o,n)});function J(e){return od(Us,e)}var fp=h("ZodBigInt",(e,t)=>{el.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>vd(e,o,n,s),e.gte=(o,n)=>e.check(qe(o,n)),e.min=(o,n)=>e.check(qe(o,n)),e.gt=(o,n)=>e.check(Vt(o,n)),e.gte=(o,n)=>e.check(qe(o,n)),e.min=(o,n)=>e.check(qe(o,n)),e.lt=(o,n)=>e.check(Ft(o,n)),e.lte=(o,n)=>e.check(nt(o,n)),e.max=(o,n)=>e.check(nt(o,n)),e.positive=o=>e.check(Vt(BigInt(0),o)),e.negative=o=>e.check(Ft(BigInt(0),o)),e.nonpositive=o=>e.check(nt(BigInt(0),o)),e.nonnegative=o=>e.check(qe(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Rr(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var C_=h("ZodNull",(e,t)=>{tl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wd(e,r,o,n)});function Ls(e){return id(C_,e)}var N_=h("ZodAny",(e,t)=>{rl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bd(e,r,o,n)});function mp(){return ad(N_)}var j_=h("ZodUnknown",(e,t)=>{ol.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zd(e,r,o,n)});function X(){return cd(j_)}var A_=h("ZodNever",(e,t)=>{nl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$d(e,r,o,n)});function Z_(e){return ud(A_,e)}var hp=h("ZodDate",(e,t)=>{sl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>xd(e,o,n,s),e.min=(o,n)=>e.check(qe(o,n)),e.max=(o,n)=>e.check(nt(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var M_=h("ZodArray",(e,t)=>{il.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ed(e,r,o,n),e.element=t.element,Cr(e,"ZodArray",{min(r,o){return this.check(Ht(r,o))},nonempty(r){return this.check(Ht(1,r))},max(r,o){return this.check(Fo(r,o))},length(r,o){return this.check(Vo(r,o))},unwrap(){return this.element}})});function w(e,t){return dd(M_,e,t)}var gp=h("ZodObject",(e,t)=>{ul.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rd(e,r,o,n),A.defineLazy(e,"shape",()=>t.shape),Cr(e,"ZodObject",{keyof(){return $e(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:Z_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return A.extend(this,r)},safeExtend(r){return A.safeExtend(this,r)},merge(r){return A.merge(this,r)},pick(r){return A.pick(this,r)},omit(r){return A.omit(this,r)},partial(...r){return A.partial(vp,this,r[0])},required(...r){return A.required(wp,this,r[0])}})});function $(e,t){let r={type:"object",shape:e??{},...A.normalizeParams(t)};return new gp(r)}function se(e,t){return new gp({type:"object",shape:e,catchall:X(),...A.normalizeParams(t)})}var _p=h("ZodUnion",(e,t)=>{ms.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Od(e,r,o,n),e.options=t.options});function B(e,t){return new _p({type:"union",options:e,...A.normalizeParams(t)})}var D_=h("ZodDiscriminatedUnion",(e,t)=>{_p.init(e,t),ll.init(e,t)});function Fs(e,t,r){return new D_({type:"union",options:t,discriminator:e,...A.normalizeParams(r)})}var q_=h("ZodIntersection",(e,t)=>{dl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Id(e,r,o,n)});function Ko(e,t){return new q_({type:"intersection",left:e,right:t})}var ap=h("ZodRecord",(e,t)=>{pl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cd(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return!t||!t._zod?new ap({type:"record",keyType:d(),valueType:e,...A.normalizeParams(t)}):new ap({type:"record",keyType:e,valueType:t,...A.normalizeParams(r)})}var Ds=h("ZodEnum",(e,t)=>{fl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(o,n,s)=>kd(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ds({...t,checks:[],...A.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ds({...t,checks:[],...A.normalizeParams(n),entries:s})}});function $e(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Ds({type:"enum",entries:r,...A.normalizeParams(t)})}var U_=h("ZodLiteral",(e,t)=>{ml.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sd(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function S(e,t){return new U_({type:"literal",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var L_=h("ZodTransform",(e,t)=>{hl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Td(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Mt(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(A.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(A.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function yp(e){return new L_({type:"transform",transform:e})}var vp=h("ZodOptional",(e,t)=>{hs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ns(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function te(e){return new vp({type:"optional",innerType:e})}var F_=h("ZodExactOptional",(e,t)=>{gl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ns(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function V_(e){return new F_({type:"optional",innerType:e})}var H_=h("ZodNullable",(e,t)=>{_l.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Nd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function cp(e){return new H_({type:"nullable",innerType:e})}var J_=h("ZodDefault",(e,t)=>{yl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ad(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function K_(e,t){return new J_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var B_=h("ZodPrefault",(e,t)=>{vl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function G_(e,t){return new B_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var wp=h("ZodNonOptional",(e,t)=>{wl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function W_(e,t){return new wp({type:"nonoptional",innerType:e,...A.normalizeParams(t)})}var Y_=h("ZodCatch",(e,t)=>{$l.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Md(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Q_(e,t){return new Y_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var $p=h("ZodPipe",(e,t)=>{gs.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dd(e,r,o,n),e.in=t.in,e.out=t.out});function up(e,t){return new $p({type:"pipe",in:e,out:t})}var X_=h("ZodPreprocess",(e,t)=>{$p.init(e,t),bl.init(e,t)}),ey=h("ZodReadonly",(e,t)=>{zl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ty(e){return new ey({type:"readonly",innerType:e})}var bp=h("ZodCustom",(e,t)=>{xl.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pd(e,r,o,n)});function zp(e,t){return pd(bp,e??(()=>!0),t)}function ry(e,t={}){return fd(bp,e,t)}function oy(e,t){return md(e,t)}function Vs(e,t){return new X_({type:"pipe",in:yp(e),out:t})}var kp={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var xp;xp||(xp={});var Bo={};Fn(Bo,{bigint:()=>ay,boolean:()=>iy,date:()=>cy,number:()=>sy,string:()=>ny});function ny(e){return El(qs,e)}function sy(e){return td(Jo,e)}function iy(e){return nd(Us,e)}function ay(e){return sd(fp,e)}function cy(e){return ld(hp,e)}we(kl());var Sp="io.modelcontextprotocol/related-task",Wo="2.0",ae=zp(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Pp=B([d(),U().int()]),Tp=d(),PP=se({ttl:B([U(),Ls()]).optional(),pollInterval:U().optional()}),ly=$({ttl:U().optional()}),dy=$({taskId:d()}),Hs=se({progressToken:Pp.optional(),[Sp]:dy.optional()}),Ee=$({_meta:Hs.optional()}),Yo=Ee.extend({task:ly.optional()});var ce=$({method:d(),params:Ee.loose().optional()}),Ne=$({_meta:Hs.optional()}),je=$({method:d(),params:Ne.loose().optional()}),ue=se({_meta:Hs.optional()}),Qo=B([d(),U().int()]),py=$({jsonrpc:S(Wo),id:Qo,...ce.shape}).strict();var fy=$({jsonrpc:S(Wo),...je.shape}).strict();var Ep=$({jsonrpc:S(Wo),id:Qo,result:ue}).strict();var Nr;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Nr||(Nr={}));var Rp=$({jsonrpc:S(Wo),id:Qo.optional(),error:$({code:U().int(),message:d(),data:X().optional()})}).strict();var my=B([py,fy,Ep,Rp]),TP=B([Ep,Rp]),Js=ue.strict(),hy=Ne.extend({requestId:Qo.optional(),reason:d().optional()}),Ks=je.extend({method:S("notifications/cancelled"),params:hy}),gy=$({src:d(),mimeType:d().optional(),sizes:w(d()).optional(),theme:$e(["light","dark"]).optional()}),jr=$({icons:w(gy).optional()}),Kt=$({name:d(),title:d().optional()}),Op=Kt.extend({...Kt.shape,...jr.shape,version:d(),websiteUrl:d().optional(),description:d().optional()}),_y=Ko($({applyDefaults:J().optional()}),ee(d(),X())),yy=Vs(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ko($({form:_y.optional(),url:ae.optional()}),ee(d(),X()).optional())),vy=se({list:ae.optional(),cancel:ae.optional(),requests:se({sampling:se({createMessage:ae.optional()}).optional(),elicitation:se({create:ae.optional()}).optional()}).optional()}),wy=se({list:ae.optional(),cancel:ae.optional(),requests:se({tools:se({call:ae.optional()}).optional()}).optional()}),$y=$({experimental:ee(d(),ae).optional(),sampling:$({context:ae.optional(),tools:ae.optional()}).optional(),elicitation:yy.optional(),roots:$({listChanged:J().optional()}).optional(),tasks:vy.optional()}),by=Ee.extend({protocolVersion:d(),capabilities:$y,clientInfo:Op}),zy=ce.extend({method:S("initialize"),params:by});var xy=$({experimental:ee(d(),ae).optional(),logging:ae.optional(),completions:ae.optional(),prompts:$({listChanged:J().optional()}).optional(),resources:$({subscribe:J().optional(),listChanged:J().optional()}).optional(),tools:$({listChanged:J().optional()}).optional(),tasks:wy.optional()}),Ip=ue.extend({protocolVersion:d(),capabilities:xy,serverInfo:Op,instructions:d().optional()}),ky=je.extend({method:S("notifications/initialized"),params:Ne.optional()});var Bs=ce.extend({method:S("ping"),params:Ee.optional()}),Sy=$({progress:U(),total:te(U()),message:te(d())}),Py=$({...Ne.shape,...Sy.shape,progressToken:Pp}),Gs=je.extend({method:S("notifications/progress"),params:Py}),Ty=Ee.extend({cursor:Tp.optional()}),Ar=ce.extend({params:Ty.optional()}),Zr=ue.extend({nextCursor:Tp.optional()}),Ey=$e(["working","input_required","completed","failed","cancelled"]),Mr=$({taskId:d(),status:Ey,ttl:B([U(),Ls()]),createdAt:d(),lastUpdatedAt:d(),pollInterval:te(U()),statusMessage:te(d())}),Xo=ue.extend({task:Mr}),Ry=Ne.merge(Mr),Ws=je.extend({method:S("notifications/tasks/status"),params:Ry}),Ys=ce.extend({method:S("tasks/get"),params:Ee.extend({taskId:d()})}),Qs=ue.merge(Mr),Xs=ce.extend({method:S("tasks/result"),params:Ee.extend({taskId:d()})}),EP=ue.loose(),ei=Ar.extend({method:S("tasks/list")}),ti=Zr.extend({tasks:w(Mr)}),ri=ce.extend({method:S("tasks/cancel"),params:Ee.extend({taskId:d()})}),Oy=ue.merge(Mr),Cp=$({uri:d(),mimeType:te(d()),_meta:ee(d(),X()).optional()}),Np=Cp.extend({text:d()}),oi=d().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),jp=Cp.extend({blob:oi}),Dr=$e(["user","assistant"]),Bt=$({audience:w(Dr).optional(),priority:U().min(0).max(1).optional(),lastModified:Ir.datetime({offset:!0}).optional()}),Ap=$({...Kt.shape,...jr.shape,uri:d(),description:te(d()),mimeType:te(d()),annotations:Bt.optional(),_meta:te(se({}))}),Iy=$({...Kt.shape,...jr.shape,uriTemplate:d(),description:te(d()),mimeType:te(d()),annotations:Bt.optional(),_meta:te(se({}))}),Cy=Ar.extend({method:S("resources/list")}),Zp=Zr.extend({resources:w(Ap)}),Ny=Ar.extend({method:S("resources/templates/list")}),Mp=Zr.extend({resourceTemplates:w(Iy)}),ni=Ee.extend({uri:d()}),jy=ni,Ay=ce.extend({method:S("resources/read"),params:jy}),Dp=ue.extend({contents:w(B([Np,jp]))}),qp=je.extend({method:S("notifications/resources/list_changed"),params:Ne.optional()}),Zy=ni,My=ce.extend({method:S("resources/subscribe"),params:Zy}),Dy=ni,qy=ce.extend({method:S("resources/unsubscribe"),params:Dy}),Uy=Ne.extend({uri:d()}),Ly=je.extend({method:S("notifications/resources/updated"),params:Uy}),Fy=$({name:d(),description:te(d()),required:te(J())}),Vy=$({...Kt.shape,...jr.shape,description:te(d()),arguments:te(w(Fy)),_meta:te(se({}))}),Hy=Ar.extend({method:S("prompts/list")}),Up=Zr.extend({prompts:w(Vy)}),Jy=Ee.extend({name:d(),arguments:ee(d(),d()).optional()}),Ky=ce.extend({method:S("prompts/get"),params:Jy}),si=$({type:S("text"),text:d(),annotations:Bt.optional(),_meta:ee(d(),X()).optional()}),ii=$({type:S("image"),data:oi,mimeType:d(),annotations:Bt.optional(),_meta:ee(d(),X()).optional()}),ai=$({type:S("audio"),data:oi,mimeType:d(),annotations:Bt.optional(),_meta:ee(d(),X()).optional()}),By=$({type:S("tool_use"),name:d(),id:d(),input:ee(d(),X()),_meta:ee(d(),X()).optional()}),Gy=$({type:S("resource"),resource:B([Np,jp]),annotations:Bt.optional(),_meta:ee(d(),X()).optional()}),Wy=Ap.extend({type:S("resource_link")}),ci=B([si,ii,ai,Wy,Gy]),Yy=$({role:Dr,content:ci}),Lp=ue.extend({description:d().optional(),messages:w(Yy)}),Fp=je.extend({method:S("notifications/prompts/list_changed"),params:Ne.optional()}),Qy=$({title:d().optional(),readOnlyHint:J().optional(),destructiveHint:J().optional(),idempotentHint:J().optional(),openWorldHint:J().optional()}),Xy=$({taskSupport:$e(["required","optional","forbidden"]).optional()}),Vp=$({...Kt.shape,...jr.shape,description:d().optional(),inputSchema:$({type:S("object"),properties:ee(d(),ae).optional(),required:w(d()).optional()}).catchall(X()),outputSchema:$({type:S("object"),properties:ee(d(),ae).optional(),required:w(d()).optional()}).catchall(X()).optional(),annotations:Qy.optional(),execution:Xy.optional(),_meta:ee(d(),X()).optional()}),ev=Ar.extend({method:S("tools/list")}),Hp=Zr.extend({tools:w(Vp)}),en=ue.extend({content:w(ci).default([]),structuredContent:ee(d(),X()).optional(),isError:J().optional()}),RP=en.or(ue.extend({toolResult:X()})),tv=Yo.extend({name:d(),arguments:ee(d(),X()).optional()}),rv=ce.extend({method:S("tools/call"),params:tv}),ui=je.extend({method:S("notifications/tools/list_changed"),params:Ne.optional()}),ov=$({autoRefresh:J().default(!0),debounceMs:U().int().nonnegative().default(300)}),Jp=$e(["debug","info","notice","warning","error","critical","alert","emergency"]),nv=Ee.extend({level:Jp}),sv=ce.extend({method:S("logging/setLevel"),params:nv}),iv=Ne.extend({level:Jp,logger:d().optional(),data:X()}),av=je.extend({method:S("notifications/message"),params:iv}),cv=$({name:d().optional()}),uv=$({hints:w(cv).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),lv=$({mode:$e(["auto","required","none"]).optional()}),dv=$({type:S("tool_result"),toolUseId:d().describe("The unique identifier for the corresponding tool call."),content:w(ci).default([]),structuredContent:$({}).loose().optional(),isError:J().optional(),_meta:ee(d(),X()).optional()}),pv=Fs("type",[si,ii,ai]),Go=Fs("type",[si,ii,ai,By,dv]),fv=$({role:Dr,content:B([Go,w(Go)]),_meta:ee(d(),X()).optional()}),mv=Yo.extend({messages:w(fv),modelPreferences:uv.optional(),systemPrompt:d().optional(),includeContext:$e(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:w(d()).optional(),metadata:ae.optional(),tools:w(Vp).optional(),toolChoice:lv.optional()}),Kp=ce.extend({method:S("sampling/createMessage"),params:mv}),Bp=ue.extend({model:d(),stopReason:te($e(["endTurn","stopSequence","maxTokens"]).or(d())),role:Dr,content:pv}),Gp=ue.extend({model:d(),stopReason:te($e(["endTurn","stopSequence","maxTokens","toolUse"]).or(d())),role:Dr,content:B([Go,w(Go)])}),hv=$({type:S("boolean"),title:d().optional(),description:d().optional(),default:J().optional()}),gv=$({type:S("string"),title:d().optional(),description:d().optional(),minLength:U().optional(),maxLength:U().optional(),format:$e(["email","uri","date","date-time"]).optional(),default:d().optional()}),_v=$({type:$e(["number","integer"]),title:d().optional(),description:d().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),yv=$({type:S("string"),title:d().optional(),description:d().optional(),enum:w(d()),default:d().optional()}),vv=$({type:S("string"),title:d().optional(),description:d().optional(),oneOf:w($({const:d(),title:d()})),default:d().optional()}),wv=$({type:S("string"),title:d().optional(),description:d().optional(),enum:w(d()),enumNames:w(d()).optional(),default:d().optional()}),$v=B([yv,vv]),bv=$({type:S("array"),title:d().optional(),description:d().optional(),minItems:U().optional(),maxItems:U().optional(),items:$({type:S("string"),enum:w(d())}),default:w(d()).optional()}),zv=$({type:S("array"),title:d().optional(),description:d().optional(),minItems:U().optional(),maxItems:U().optional(),items:$({anyOf:w($({const:d(),title:d()}))}),default:w(d()).optional()}),xv=B([bv,zv]),kv=B([wv,$v,xv]),Sv=B([kv,hv,gv,_v]),Pv=Yo.extend({mode:S("form").optional(),message:d(),requestedSchema:$({type:S("object"),properties:ee(d(),Sv),required:w(d()).optional()})}),Tv=Yo.extend({mode:S("url"),message:d(),elicitationId:d(),url:d().url()}),Ev=B([Pv,Tv]),Wp=ce.extend({method:S("elicitation/create"),params:Ev}),Rv=Ne.extend({elicitationId:d()}),Ov=je.extend({method:S("notifications/elicitation/complete"),params:Rv}),Yp=ue.extend({action:$e(["accept","decline","cancel"]),content:Vs(e=>e===null?void 0:e,ee(d(),B([d(),U(),J(),w(d())])).optional())}),Iv=$({type:S("ref/resource"),uri:d()});var Cv=$({type:S("ref/prompt"),name:d()}),Nv=Ee.extend({ref:B([Cv,Iv]),argument:$({name:d(),value:d()}),context:$({arguments:ee(d(),d()).optional()}).optional()}),jv=ce.extend({method:S("completion/complete"),params:Nv});var Qp=ue.extend({completion:se({values:w(d()).max(100),total:te(U().int()),hasMore:te(J())})}),Av=$({uri:d().startsWith("file://"),name:d().optional(),_meta:ee(d(),X()).optional()}),Zv=ce.extend({method:S("roots/list"),params:Ee.optional()}),Mv=ue.extend({roots:w(Av)}),Dv=je.extend({method:S("notifications/roots/list_changed"),params:Ne.optional()}),OP=B([Bs,zy,jv,sv,Ky,Hy,Cy,Ny,Ay,My,qy,rv,ev,Ys,Xs,ei,ri]),IP=B([Ks,Gs,ky,Dv,Ws]),CP=B([Js,Bp,Gp,Yp,Mv,Qs,ti,Xo]),NP=B([Bs,Kp,Wp,Zv,Ys,Xs,ei,ri]),jP=B([Ks,Gs,av,Ly,qp,ui,Fp,Ws,Ov]),AP=B([Js,Ip,Qp,Lp,Up,Zp,Mp,Dp,en,Hp,Qs,ti,Xo]);var qv=Symbol("Let zodToJsonSchema decide on which parser to use");var hT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var qx=zg(Uh(),1);var Lx;Lx=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);var fe=pp().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:kp.custom,message:"URL must be parseable",fatal:!0}),Kn}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Fx=se({resource:d().url(),authorization_servers:w(fe).optional(),jwks_uri:d().url().optional(),scopes_supported:w(d()).optional(),bearer_methods_supported:w(d()).optional(),resource_signing_alg_values_supported:w(d()).optional(),resource_name:d().optional(),resource_documentation:d().optional(),resource_policy_uri:d().url().optional(),resource_tos_uri:d().url().optional(),tls_client_certificate_bound_access_tokens:J().optional(),authorization_details_types_supported:w(d()).optional(),dpop_signing_alg_values_supported:w(d()).optional(),dpop_bound_access_tokens_required:J().optional()}),Fh=se({issuer:d(),authorization_endpoint:fe,token_endpoint:fe,registration_endpoint:fe.optional(),scopes_supported:w(d()).optional(),response_types_supported:w(d()),response_modes_supported:w(d()).optional(),grant_types_supported:w(d()).optional(),token_endpoint_auth_methods_supported:w(d()).optional(),token_endpoint_auth_signing_alg_values_supported:w(d()).optional(),service_documentation:fe.optional(),revocation_endpoint:fe.optional(),revocation_endpoint_auth_methods_supported:w(d()).optional(),revocation_endpoint_auth_signing_alg_values_supported:w(d()).optional(),introspection_endpoint:d().optional(),introspection_endpoint_auth_methods_supported:w(d()).optional(),introspection_endpoint_auth_signing_alg_values_supported:w(d()).optional(),code_challenge_methods_supported:w(d()).optional(),client_id_metadata_document_supported:J().optional()}),Vx=se({issuer:d(),authorization_endpoint:fe,token_endpoint:fe,userinfo_endpoint:fe.optional(),jwks_uri:fe,registration_endpoint:fe.optional(),scopes_supported:w(d()).optional(),response_types_supported:w(d()),response_modes_supported:w(d()).optional(),grant_types_supported:w(d()).optional(),acr_values_supported:w(d()).optional(),subject_types_supported:w(d()),id_token_signing_alg_values_supported:w(d()),id_token_encryption_alg_values_supported:w(d()).optional(),id_token_encryption_enc_values_supported:w(d()).optional(),userinfo_signing_alg_values_supported:w(d()).optional(),userinfo_encryption_alg_values_supported:w(d()).optional(),userinfo_encryption_enc_values_supported:w(d()).optional(),request_object_signing_alg_values_supported:w(d()).optional(),request_object_encryption_alg_values_supported:w(d()).optional(),request_object_encryption_enc_values_supported:w(d()).optional(),token_endpoint_auth_methods_supported:w(d()).optional(),token_endpoint_auth_signing_alg_values_supported:w(d()).optional(),display_values_supported:w(d()).optional(),claim_types_supported:w(d()).optional(),claims_supported:w(d()).optional(),service_documentation:d().optional(),claims_locales_supported:w(d()).optional(),ui_locales_supported:w(d()).optional(),claims_parameter_supported:J().optional(),request_parameter_supported:J().optional(),request_uri_parameter_supported:J().optional(),require_request_uri_registration:J().optional(),op_policy_uri:fe.optional(),op_tos_uri:fe.optional(),client_id_metadata_document_supported:J().optional()}),Hx=$({...Vx.shape,...Fh.pick({code_challenge_methods_supported:!0}).shape}),Jx=$({access_token:d(),id_token:d().optional(),token_type:d(),expires_in:Bo.number().optional(),scope:d().optional(),refresh_token:d().optional()}).strip(),Kx=$({error:d(),error_description:d().optional(),error_uri:d().optional()}),Lh=fe.optional().or(S("").transform(()=>{})),Bx=$({redirect_uris:w(fe),token_endpoint_auth_method:d().optional(),grant_types:w(d()).optional(),response_types:w(d()).optional(),client_name:d().optional(),client_uri:fe.optional(),logo_uri:Lh,scope:d().optional(),contacts:w(d()).optional(),tos_uri:Lh,policy_uri:d().optional(),jwks_uri:fe.optional(),jwks:mp().optional(),software_id:d().optional(),software_version:d().optional(),software_statement:d().optional()}).strip(),Gx=$({client_id:d(),client_secret:d().optional(),client_id_issued_at:U().optional(),client_secret_expires_at:U().optional()}).strip(),Wx=Bx.merge(Gx),tC=$({error:d(),error_description:d().optional()}).strip(),rC=$({token:d(),token_type_hint:d().optional()}).strip();var ne=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},_o=class extends ne{};_o.errorCode="invalid_request";var pr=class extends ne{};pr.errorCode="invalid_client";var fr=class extends ne{};fr.errorCode="invalid_grant";var mr=class extends ne{};mr.errorCode="unauthorized_client";var yo=class extends ne{};yo.errorCode="unsupported_grant_type";var vo=class extends ne{};vo.errorCode="invalid_scope";var wo=class extends ne{};wo.errorCode="access_denied";var hr=class extends ne{};hr.errorCode="server_error";var $o=class extends ne{};$o.errorCode="temporarily_unavailable";var bo=class extends ne{};bo.errorCode="unsupported_response_type";var zo=class extends ne{};zo.errorCode="unsupported_token_type";var xo=class extends ne{};xo.errorCode="invalid_token";var ko=class extends ne{};ko.errorCode="method_not_allowed";var So=class extends ne{};So.errorCode="too_many_requests";var gr=class extends ne{};gr.errorCode="invalid_client_metadata";var Po=class extends ne{};Po.errorCode="insufficient_scope";var To=class extends ne{};To.errorCode="invalid_target";var Yx={[_o.errorCode]:_o,[pr.errorCode]:pr,[fr.errorCode]:fr,[mr.errorCode]:mr,[yo.errorCode]:yo,[vo.errorCode]:vo,[wo.errorCode]:wo,[hr.errorCode]:hr,[$o.errorCode]:$o,[bo.errorCode]:bo,[zo.errorCode]:zo,[xo.errorCode]:xo,[ko.errorCode]:ko,[So.errorCode]:So,[gr.errorCode]:gr,[Po.errorCode]:Po,[To.errorCode]:To};async function Qx(e){let{exec:t}=await import("node:child_process"),{promisify:r}=await import("node:util"),o=r(t),n=process.platform,s=n==="darwin"?`open "${e}"`:n==="win32"?`start "" "${e}"`:`xdg-open "${e}"`;await o(s)}function Vh(e){return new Promise(t=>setTimeout(t,e))}function Eo(e){try{let t=e.split(".")[1];if(!t)return;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8"));return typeof r.email=="string"?r.email:void 0}catch{return}}async function Xx(e){let t=e.fetchImpl??fetch,r={clientId:e.clientId??"gigabuddy-cli"};e.productId!==void 0&&(r.productId=e.productId),e.scopes!==void 0&&(r.scopes=e.scopes);let o=await t(`${e.authUrl}/api/auth/device/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Failed to start device flow: ${await o.text()}`);let{deviceCode:n,userCode:s,verificationUrl:i,expiresIn:a,interval:c}=await o.json();return{deviceCode:n,userCode:s,verificationUrl:i,expiresIn:a,interval:c}}async function ek(e,t,r={}){let o=r.fetchImpl??fetch,n=Date.now()+t.expiresIn*1e3,s=(t.interval||5)*1e3;for(;Date.now()<n;){await Vh(s);let i=await o(`${e}/api/auth/device/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:t.deviceCode})});if(i.status===429){await Vh(s);continue}if(!i.ok)continue;let a=await i.json();if(a.status==="complete"&&a.platformToken&&a.refreshToken&&a.userId)return{refreshToken:a.refreshToken,platformToken:a.platformToken,userId:a.userId,userEmail:a.userEmail??Eo(a.platformToken)};if(a.status==="expired")throw new Error("Device code expired. Please try again.");r.onPending?.()}throw new Error("Authentication timed out. Please try again.")}async function Hh(e){let t=await Xx({authUrl:e.authUrl,clientId:e.clientId??"gigabuddy-cli",productId:e.productId??"gigabuddy/studio",scopes:e.scopes,fetchImpl:e.fetchImpl});return e.onPrompt?.({verificationUrl:t.verificationUrl,userCode:t.userCode}),(e.openBrowserImpl??Qx)(t.verificationUrl).catch(()=>{}),ek(e.authUrl,t,{onPending:e.onPending,fetchImpl:e.fetchImpl})}function Zt(e){let t=new URL(e),r=t.pathname.replace(/\/+$/,"");return`//${t.host}${r}/:_authToken`}function Ro(e){return`${e}:registry`}function Zn(e){return e.replace(/\/+$/,"")+"/"}function Jh(e,t){let r=Zn(t.registryUrl),o=new Map([[Ro(t.scope).toLowerCase(),`${Ro(t.scope)}=${r}`],[Zt(r).toLowerCase(),`${Zt(r)}=${t.token}`]]),n=e.length>0?e.split(`
73
+ `):[],s=new Set,i=[];for(let c of n){let u=Bh(c);if(u&&o.has(u)){if(s.has(u))continue;s.add(u),i.push(o.get(u));continue}i.push(c)}let a=[...o.entries()].filter(([c])=>!s.has(c)).map(([,c])=>c);if(a.length===0)return i.join(`
74
74
  `);for(;i.length>0&&i[i.length-1].trim()==="";)i.pop();return[...i,...a,""].join(`
75
- `)}function Jh(e,t){let r=Zn(t.registryUrl),o=new Set([Ro(t.scope).toLowerCase(),Zt(r).toLowerCase()]),s=e.split(`
76
- `).filter(i=>{let a=Kh(i);return!(a&&o.has(a))}).join(`
77
- `);return s.trim().length===0?"":s}function Kh(e){let t=e.trim();if(t.length===0||t.startsWith("#")||t.startsWith(";"))return null;let r=t.indexOf("=");return r===-1?null:t.slice(0,r).trim().toLowerCase()}import*as Mn from"node:fs";import*as Bh from"node:os";import*as xt from"node:path";var Xe="@gigabuddy";async function Gh(e){let r=await(e.fetchImpl??fetch)(`${e.authUrl}/api/token/registry`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})});if(!r.ok)throw new Error(`Could not mint a registry credential (${r.status}): ${await r.text()}`);let o=await r.json();if(!o.token||!o.registryUrl)throw new Error("Auth returned an incomplete registry credential");return{token:o.token,expiresIn:o.expiresIn??0,registryUrl:o.registryUrl}}async function Wh(e){try{return(await(e.fetchImpl??fetch)(`${e.authUrl}/api/auth/signout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})})).ok}catch{return!1}}function Re(){return process.env.NPM_CONFIG_USERCONFIG??xt.join(Bh.homedir(),".npmrc")}function Yh(e){try{return Mn.readFileSync(e,"utf-8")}catch{return""}}function Qh(e,t=Re()){let r=Hh(Yh(t),{scope:Xe,registryUrl:e.registryUrl,token:e.token});return Oo(t,r),t}function tc(e,t=Re()){let r=[],o=xt.resolve(e);for(;;){let n=xt.join(o,".npmrc");n!==xt.resolve(t)&&Mn.existsSync(n)&&r.push(n);let s=xt.dirname(o);if(s===o)break;o=s}return r}function qn(e,t){let r=Zt(Zn(t)).toLowerCase(),o=Ro(Xe).toLowerCase();return e.split(`
78
- `).some(n=>{let s=n.trim();if(!s||s.startsWith("#")||s.startsWith(";"))return!1;let i=s.indexOf("=");if(i===-1)return!1;let a=s.slice(0,i).trim().toLowerCase();return a===r||a===o})}function Xh(e,t=Re()){let r=Yh(t),o=Jh(r,{scope:Xe,registryUrl:e});return o===r?null:(Oo(t,o),t)}var _r=class{refreshToken;authUrl;platformToken=null;tokenExpiresAt=0;refreshPromise=null;onRefreshTokenRotated;reloginHint;fetchImpl;constructor(t){this.refreshToken=t.refreshToken,this.authUrl=t.authUrl,this.onRefreshTokenRotated=t.onRefreshTokenRotated,this.reloginHint=t.reloginHint??"Sign in again with 'gigabuddy login'.",this.fetchImpl=t.fetchImpl??fetch}async getToken(){return this.platformToken&&Date.now()<this.tokenExpiresAt-6e4?this.platformToken:this.refresh()}invalidate(){this.platformToken=null,this.tokenExpiresAt=0}async refresh(){return this.refreshPromise?this.refreshPromise:(this.refreshPromise=this.doRefresh().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}async doRefresh(){let t=await this.fetchImpl(`${this.authUrl}/api/token/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:this.refreshToken})});if(!t.ok){let o=await t.text();throw new Error(`Token refresh failed (${t.status}): ${o}. ${this.reloginHint}`)}let r=await t.json();return this.platformToken=r.token,this.tokenExpiresAt=Date.now()+r.expiresIn*1e3,r.refreshToken&&r.refreshToken!==this.refreshToken&&(this.refreshToken=r.refreshToken,this.onRefreshTokenRotated?.(r.refreshToken)),r.token}};var rc="@gigabuddy",oc=20;function Qx(e){try{let t=e.split(".")[1];if(!t)return null;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8"));return typeof r.exp=="number"?new Date(r.exp*1e3):null}catch{return null}}function nc(e,t){let r=null;for(let o of e.split(`
79
- `)){let n=o.trim();if(!n||n.startsWith("#")||n.startsWith(";"))continue;let s=n.indexOf("=");s!==-1&&n.slice(0,s).trim().toLowerCase()===t.toLowerCase()&&(r=n.slice(s+1).trim())}return r}async function eg(e,t){let r=[],o=[],n=(v,O,z)=>r.push({label:v,status:O,detail:z}),s=Number(e.nodeVersion.replace(/^v/,"").split(".")[0]);Number.isFinite(s)&&s<oc?(n("Node version","fail",`${e.nodeVersion} \u2014 gigabuddy needs Node ${oc} or newer`),o.push(`Upgrade Node to ${oc}+ \u2014 nothing below that is supported.`)):n("Node version","ok",e.nodeVersion);let i=e.loadCredentials(!1)??e.loadCredentials(!0);if(!i)return n("Signed in","fail","no credentials found"),o.push("Run `gigabuddy login --npm` \u2014 you are not signed in, so the registry cannot know who you are."),{checks:r,advice:o};let a={label:"Signed in",status:"ok",detail:i.userEmail??i.userId};r.push(a);let c=null;try{c=await new _r({refreshToken:i.refreshToken,authUrl:i.authUrl,fetchImpl:e.fetchImpl}).getToken();let v=Eo(c);v&&(a.detail=v),n("Session","ok","live")}catch(v){n("Session","fail",`not accepted by auth \u2014 ${v instanceof Error?v.message:String(v)}`),o.push("Run `gigabuddy login` \u2014 your session was revoked or expired, so every credential from it is dead.")}let u=e.readNpmrc(),l=nc(u,`${rc}:registry`);l?n(`${rc} registry`,"ok",l):(n(`${rc} registry`,"fail",`not set in ${Re()}`),o.push("Run `gigabuddy login --npm` \u2014 npm has no registry configured for @gigabuddy packages."));let p=l?Zt(l):null,m=p?nc(u,p):null;if(l&&!m)n("Registry credential","fail",`no ${p} in ${Re()}`),o.push("Run `gigabuddy login --npm` \u2014 the registry is configured but has no credential to authenticate with.");else if(m){let v=Qx(m);v&&v.getTime()<Date.now()?(n("Registry credential","fail",`expired ${v.toISOString().slice(0,10)}`),o.push("Run `gigabuddy login --npm` \u2014 your npm credential expired. They are long-lived, not permanent.")):n("Registry credential","ok",v?`valid until ${v.toISOString().slice(0,10)}`:"present")}let f=e.shadowingNpmrcFiles().filter(v=>qn(v.contents,l??"")),g=m,_=Re();if(f.length>0){let v=f[0],O=p?nc(v.contents,p):null;O&&(g=O,_=v.path),n("Other .npmrc files","fail",`${v.path} also configures this registry`),o.push(`${v.path} sets a credential for this registry, and npm prefers it over ${Re()} \u2014 so the credential you just minted is not the one being sent. Delete that file's \`_authToken\` line (or the file), then install again. This is usually a leftover from configuring the registry by hand before \`login --npm\` existed.`)}let y=e.npmEffectiveRegistry();if(y&&l&&y.replace(/\/+$/,"")!==l.replace(/\/+$/,"")?(n("npm resolves @gigabuddy to","fail",`${y} \u2014 NOT what we configured`),o.push(`Something is overriding your user-level .npmrc \u2014 most often a project .npmrc, or an npm_config_ env var. npm is sending @gigabuddy installs to ${y}.`)):y&&n("npm resolves @gigabuddy to","ok",y),l&&g){let v=l.replace(/\/+$/,""),O=_===Re()?"":` (using the credential from ${_})`;try{let z=await e.fetchImpl(`${v}/-/ping`,{headers:{authorization:`Bearer ${g}`}});z.ok?n("Registry reachable","ok",`${v}${O}`):z.status===401?(n("Registry reachable","fail",`reachable, but rejected the credential (401)${O}`),o.push(_===Re()?"Run `gigabuddy login --npm` \u2014 the registry did not accept your credential.":`The registry rejected the credential in ${_}. That file is the problem, not your login.`)):n("Registry reachable","warn",`responded ${z.status}`)}catch(z){n("Registry reachable","fail",`cannot reach ${v} \u2014 ${z instanceof Error?z.message:String(z)}`),o.push("Check your network or proxy \u2014 the registry is unreachable from here.")}if(t)try{let z=await e.fetchImpl(`${v}/${t.replace("/","%2F")}`,{headers:{authorization:`Bearer ${g}`}});z.ok?n(`Access to ${t}`,"ok","you can install it"):z.status===404?(n(`Access to ${t}`,"fail","the registry will not serve it to you"),o.push(`The registry answers "no such package" for ${t}. That single answer covers BOTH "this name does not exist" and "you do not have access" \u2014 deliberately, so private names stay private. Everything else above is healthy, so: check the spelling first, and if it is right, ask whoever owns the package to grant you access.`)):z.status===401?n(`Access to ${t}`,"fail","credential rejected (401)"):n(`Access to ${t}`,"warn",`registry responded ${z.status}`)}catch(z){n(`Access to ${t}`,"fail",z instanceof Error?z.message:String(z))}}return{checks:r,advice:o}}var Xx={ok:"\u2713",warn:"!",fail:"\u2717",skip:"-"};function tg(e,t){let r=(i,a)=>t?`\x1B[${i}m${a}\x1B[0m`:a,o={ok:"32",warn:"33",fail:"31",skip:"90"},n=Math.max(...e.checks.map(i=>i.label.length)),s=e.checks.map(i=>` ${r(o[i.status],Xx[i.status])} ${i.label.padEnd(n)} ${i.detail??""}`.trimEnd());if(e.advice.length===0)return s.push("",` ${r("32","Everything checks out.")}`),s.join(`
75
+ `)}function Kh(e,t){let r=Zn(t.registryUrl),o=new Set([Ro(t.scope).toLowerCase(),Zt(r).toLowerCase()]),s=e.split(`
76
+ `).filter(i=>{let a=Bh(i);return!(a&&o.has(a))}).join(`
77
+ `);return s.trim().length===0?"":s}function Bh(e){let t=e.trim();if(t.length===0||t.startsWith("#")||t.startsWith(";"))return null;let r=t.indexOf("=");return r===-1?null:t.slice(0,r).trim().toLowerCase()}import*as Mn from"node:fs";import*as Gh from"node:os";import*as xt from"node:path";var Xe="@gigabuddy";async function Wh(e){let r=await(e.fetchImpl??fetch)(`${e.authUrl}/api/token/registry`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})});if(!r.ok)throw new Error(`Could not mint a registry credential (${r.status}): ${await r.text()}`);let o=await r.json();if(!o.token||!o.registryUrl)throw new Error("Auth returned an incomplete registry credential");return{token:o.token,expiresIn:o.expiresIn??0,registryUrl:o.registryUrl}}async function Yh(e){try{return(await(e.fetchImpl??fetch)(`${e.authUrl}/api/auth/signout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.refreshToken})})).ok}catch{return!1}}function Re(){return process.env.NPM_CONFIG_USERCONFIG??xt.join(Gh.homedir(),".npmrc")}function Qh(e){try{return Mn.readFileSync(e,"utf-8")}catch{return""}}function Xh(e,t=Re()){let r=Jh(Qh(t),{scope:Xe,registryUrl:e.registryUrl,token:e.token});return Oo(t,r),t}function tc(e,t=Re()){let r=[],o=xt.resolve(e);for(;;){let n=xt.join(o,".npmrc");n!==xt.resolve(t)&&Mn.existsSync(n)&&r.push(n);let s=xt.dirname(o);if(s===o)break;o=s}return r}function Dn(e,t){let r=Zt(Zn(t)).toLowerCase(),o=Ro(Xe).toLowerCase();return e.split(`
78
+ `).some(n=>{let s=n.trim();if(!s||s.startsWith("#")||s.startsWith(";"))return!1;let i=s.indexOf("=");if(i===-1)return!1;let a=s.slice(0,i).trim().toLowerCase();return a===r||a===o})}function eg(e,t=Re()){let r=Qh(t),o=Kh(r,{scope:Xe,registryUrl:e});return o===r?null:(Oo(t,o),t)}var _r=class{refreshToken;authUrl;platformToken=null;tokenExpiresAt=0;refreshPromise=null;onRefreshTokenRotated;reloginHint;fetchImpl;constructor(t){this.refreshToken=t.refreshToken,this.authUrl=t.authUrl,this.onRefreshTokenRotated=t.onRefreshTokenRotated,this.reloginHint=t.reloginHint??"Sign in again with 'gigabuddy login'.",this.fetchImpl=t.fetchImpl??fetch}async getToken(){return this.platformToken&&Date.now()<this.tokenExpiresAt-6e4?this.platformToken:this.refresh()}invalidate(){this.platformToken=null,this.tokenExpiresAt=0}async refresh(){return this.refreshPromise?this.refreshPromise:(this.refreshPromise=this.doRefresh().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}async doRefresh(){let t=await this.fetchImpl(`${this.authUrl}/api/token/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:this.refreshToken})});if(!t.ok){let o=await t.text();throw new Error(`Token refresh failed (${t.status}): ${o}. ${this.reloginHint}`)}let r=await t.json();return this.platformToken=r.token,this.tokenExpiresAt=Date.now()+r.expiresIn*1e3,r.refreshToken&&r.refreshToken!==this.refreshToken&&(this.refreshToken=r.refreshToken,this.onRefreshTokenRotated?.(r.refreshToken)),r.token}};var rc="@gigabuddy",oc=20;function tk(e){try{let t=e.split(".")[1];if(!t)return null;let r=JSON.parse(Buffer.from(t,"base64url").toString("utf-8"));return typeof r.exp=="number"?new Date(r.exp*1e3):null}catch{return null}}function nc(e,t){let r=null;for(let o of e.split(`
79
+ `)){let n=o.trim();if(!n||n.startsWith("#")||n.startsWith(";"))continue;let s=n.indexOf("=");s!==-1&&n.slice(0,s).trim().toLowerCase()===t.toLowerCase()&&(r=n.slice(s+1).trim())}return r}async function tg(e,t){let r=[],o=[],n=(v,O,x)=>r.push({label:v,status:O,detail:x}),s=Number(e.nodeVersion.replace(/^v/,"").split(".")[0]);Number.isFinite(s)&&s<oc?(n("Node version","fail",`${e.nodeVersion} \u2014 gigabuddy needs Node ${oc} or newer`),o.push(`Upgrade Node to ${oc}+ \u2014 nothing below that is supported.`)):n("Node version","ok",e.nodeVersion);let i=e.loadCredentials(!1)??e.loadCredentials(!0);if(!i)return n("Signed in","fail","no credentials found"),o.push("Run `gigabuddy login --npm` \u2014 you are not signed in, so the registry cannot know who you are."),{checks:r,advice:o};let a={label:"Signed in",status:"ok",detail:i.userEmail??i.userId};r.push(a);let c=null;try{c=await new _r({refreshToken:i.refreshToken,authUrl:i.authUrl,fetchImpl:e.fetchImpl}).getToken();let v=Eo(c);v&&(a.detail=v),n("Session","ok","live")}catch(v){n("Session","fail",`not accepted by auth \u2014 ${v instanceof Error?v.message:String(v)}`),o.push("Run `gigabuddy login` \u2014 your session was revoked or expired, so every credential from it is dead.")}let u=e.readNpmrc(),l=nc(u,`${rc}:registry`);l?n(`${rc} registry`,"ok",l):(n(`${rc} registry`,"fail",`not set in ${Re()}`),o.push("Run `gigabuddy login --npm` \u2014 npm has no registry configured for @gigabuddy packages."));let p=l?Zt(l):null,m=p?nc(u,p):null;if(l&&!m)n("Registry credential","fail",`no ${p} in ${Re()}`),o.push("Run `gigabuddy login --npm` \u2014 the registry is configured but has no credential to authenticate with.");else if(m){let v=tk(m);v&&v.getTime()<Date.now()?(n("Registry credential","fail",`expired ${v.toISOString().slice(0,10)}`),o.push("Run `gigabuddy login --npm` \u2014 your npm credential expired. They are long-lived, not permanent.")):n("Registry credential","ok",v?`valid until ${v.toISOString().slice(0,10)}`:"present")}let f=e.shadowingNpmrcFiles().filter(v=>Dn(v.contents,l??"")),g=m,_=Re();if(f.length>0){let v=f[0],O=p?nc(v.contents,p):null;O&&(g=O,_=v.path),n("Other .npmrc files","fail",`${v.path} also configures this registry`),o.push(`${v.path} sets a credential for this registry, and npm prefers it over ${Re()} \u2014 so the credential you just minted is not the one being sent. Delete that file's \`_authToken\` line (or the file), then install again. This is usually a leftover from configuring the registry by hand before \`login --npm\` existed.`)}let y=e.npmEffectiveRegistry();if(y&&l&&y.replace(/\/+$/,"")!==l.replace(/\/+$/,"")?(n("npm resolves @gigabuddy to","fail",`${y} \u2014 NOT what we configured`),o.push(`Something is overriding your user-level .npmrc \u2014 most often a project .npmrc, or an npm_config_ env var. npm is sending @gigabuddy installs to ${y}.`)):y&&n("npm resolves @gigabuddy to","ok",y),l&&g){let v=l.replace(/\/+$/,""),O=_===Re()?"":` (using the credential from ${_})`;try{let x=await e.fetchImpl(`${v}/-/ping`,{headers:{authorization:`Bearer ${g}`}});x.ok?n("Registry reachable","ok",`${v}${O}`):x.status===401?(n("Registry reachable","fail",`reachable, but rejected the credential (401)${O}`),o.push(_===Re()?"Run `gigabuddy login --npm` \u2014 the registry did not accept your credential.":`The registry rejected the credential in ${_}. That file is the problem, not your login.`)):n("Registry reachable","warn",`responded ${x.status}`)}catch(x){n("Registry reachable","fail",`cannot reach ${v} \u2014 ${x instanceof Error?x.message:String(x)}`),o.push("Check your network or proxy \u2014 the registry is unreachable from here.")}if(t)try{let x=await e.fetchImpl(`${v}/${t.replace("/","%2F")}`,{headers:{authorization:`Bearer ${g}`}});x.ok?n(`Access to ${t}`,"ok","you can install it"):x.status===404?(n(`Access to ${t}`,"fail","the registry will not serve it to you"),o.push(`The registry answers "no such package" for ${t}. That single answer covers BOTH "this name does not exist" and "you do not have access" \u2014 deliberately, so private names stay private. Everything else above is healthy, so: check the spelling first, and if it is right, ask whoever owns the package to grant you access.`)):x.status===401?n(`Access to ${t}`,"fail","credential rejected (401)"):n(`Access to ${t}`,"warn",`registry responded ${x.status}`)}catch(x){n(`Access to ${t}`,"fail",x instanceof Error?x.message:String(x))}}return{checks:r,advice:o}}var rk={ok:"\u2713",warn:"!",fail:"\u2717",skip:"-"};function rg(e,t){let r=(i,a)=>t?`\x1B[${i}m${a}\x1B[0m`:a,o={ok:"32",warn:"33",fail:"31",skip:"90"},n=Math.max(...e.checks.map(i=>i.label.length)),s=e.checks.map(i=>` ${r(o[i.status],rk[i.status])} ${i.label.padEnd(n)} ${i.detail??""}`.trimEnd());if(e.advice.length===0)return s.push("",` ${r("32","Everything checks out.")}`),s.join(`
80
80
  `);s.push("",r("1"," What to do:"));for(let i of e.advice){let a=i.replace(/(.{1,74})(\s|$)/g,`$1
81
81
  `).trimEnd().split(`
82
82
  `);s.push(` \u2022 ${a[0]}`);for(let c of a.slice(1))s.push(` ${c}`)}return s.join(`
83
- `)}var tk=["agent:spawn","discovery:read","packages:read"],et="user",rk="https://auth.gigabuddy.com",ok="https://api.gigabuddy.com",nk="https://auth.staging.gigabuddy.com",sk="https://api.staging.gigabuddy.com";function og(e){let t=e.staging??!1;return{staging:t,authUrl:e.authUrl??(t?nk:rk),apiUrl:e.apiUrl??(t?sk:ok)}}function ng(e){try{return rg(e,"utf-8")}catch{return""}}function R(e=""){console.error(e)}async function sg(e){R(`Signing in to ${e.staging?"Gigabuddy Staging":"Gigabuddy"}\u2026`);let t=await Vh({authUrl:e.authUrl,apiUrl:e.apiUrl,clientId:"gigabuddy-cli",scopes:tk,onPrompt:({verificationUrl:o,userCode:n})=>{R(),R(` Open: ${o}`),R(` Code: ${n}`),R()},onPending:()=>process.stderr.write(".")}),r={refreshToken:t.refreshToken,userId:t.userId,userEmail:t.userEmail,authUrl:e.authUrl,apiUrl:e.apiUrl,createdAt:new Date().toISOString()};return Jn(r,e.staging,et),r}async function ig(e,t={}){let r=await sg(e);if(R(),R(" Signed in."),r.userEmail&&R(` Account: ${r.userEmail}`),R(` Saved to: ${wr(e.staging,et)}`),t.npm===!1){R(),R(` Skipped npm setup. To install ${Xe} packages: gigabuddy login --npm`);return}try{await cg(r)}catch(o){R(),R(` \u26A0 Signed in, but npm setup failed: ${o instanceof Error?o.message:String(o)}`),R(" You are signed in \u2014 retry just that half with: gigabuddy login --npm"),process.exitCode=1}}function ik(e){if(e<=0)return"";let t=Math.round(e/86400);return t>=1?` (valid ~${t} days)`:` (valid ${Math.round(e/3600)}h)`}async function ag(e){let t=kt(e.staging,et);t||(R("Not signed in yet \u2014 signing in first."),R(),t=await sg(e),R(),R(" Signed in.")),await cg(t)}async function cg(e){let t=await Gh({authUrl:e.authUrl,refreshToken:e.refreshToken}),r=Qh(t);R(),R(` npm is set up for ${Xe} packages${ik(t.expiresIn)}`),R(` Registry: ${t.registryUrl}`),R(` Written to: ${r}`),R(),R(` Try it: npm install ${Xe}/app-kit`),R(),R(" This credential is registry-only \u2014 it installs what you can install and nothing else."),R(" Run this again when it expires, or after your access changes.");let o=tc(process.cwd()).filter(n=>qn(ng(n),t.registryUrl));o.length>0&&(R(),R(` \u26A0 ${o[0]} also configures this registry, and npm prefers it over ${r}.`),R(" Installs will keep using THAT credential, not this one. Delete its _authToken line."))}function ak(e){let t=kt(e,et),r=process.env.GIGABUDDY_NPM_REGISTRY_URL;return r||(t?.authUrl.includes("staging")?"https://npm.staging.gigabuddy.com":"https://npm.gigabuddy.com")}function sc(e){let t=Xh(ak(e.staging));if(!t){R(`No ${Xe} registry entries found in ${Re()}`);return}R(`Removed ${Xe} registry credentials from ${t}`)}async function ug(e){let t=kt(e.staging,et);if(sc(e),!t){R("Not signed in.");return}let r=await Wh({authUrl:t.authUrl,refreshToken:t.refreshToken});uc(e.staging,et),r?R(`Signed out${e.staging?" of staging":""}. Any npm credential from this session stops working shortly.`):(R(`Signed out locally${e.staging?" of staging":""} \u2014 but could not reach the server to revoke the session.`),R(" Credentials already copied elsewhere may keep working. Sign out again when you are back online,"),R(" or revoke the session from your account settings."))}async function ck(e,t){if(e.userEmail)return e.userEmail;try{let r=await new _r({refreshToken:e.refreshToken,authUrl:e.authUrl}).getToken(),o=Eo(r);return o?(Jn({...e,userEmail:o},t,et),o):e.userId}catch{return e.userId}}async function lg(e,t){let r=await eg({readNpmrc:()=>{try{return rg(Re(),"utf-8")}catch{return""}},npmEffectiveRegistry:()=>{try{let n=ek("npm",["config","get",`${Xe}:registry`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();return n&&n!=="undefined"&&n!=="null"?n:null}catch{return null}},shadowingNpmrcFiles:()=>tc(process.cwd()).map(n=>({path:n,contents:ng(n)})),fetchImpl:fetch,nodeVersion:process.version,loadCredentials:n=>kt(n,et)},t),o=process.stderr.isTTY===!0&&!process.env.NO_COLOR;R(),R(tg(r,o)),R(),r.advice.length>0&&(process.exitCode=1)}async function dg(){let e=kt(!1,et),t=kt(!0,et);if(!e&&!t){R("Not signed in."),R(),R(" gigabuddy login");return}for(let[r,o,n]of[["Production",e,!1],["Staging",t,!0]])o&&(R(`${r}:`),R(` Account: ${await ck(o,n)}`),R(` Since: ${o.createdAt}`))}function mk(){try{let e=dk(lk(pk(import.meta.url)),"..","package.json");return JSON.parse(uk(e,"utf-8")).version}catch{return"unknown"}}function pg(){console.error(`
83
+ `)}var sk=["agent:spawn","discovery:read","packages:read"],et="user",ik="https://auth.gigabuddy.com",ak="https://api.gigabuddy.com",ck="https://auth.staging.gigabuddy.com",uk="https://api.staging.gigabuddy.com";function sg(e){let t=e.staging??!1;return{staging:t,authUrl:e.authUrl??(t?ck:ik),apiUrl:e.apiUrl??(t?uk:ak)}}function ig(e){try{return ng(e,"utf-8")}catch{return""}}function z(e=""){console.error(e)}async function ag(e){z(`Signing in to ${e.staging?"Gigabuddy Staging":"Gigabuddy"}\u2026`);let t=await Hh({authUrl:e.authUrl,apiUrl:e.apiUrl,clientId:"gigabuddy-cli",scopes:sk,onPrompt:({verificationUrl:o,userCode:n})=>{z(),z(` Open: ${o}`),z(` Code: ${n}`),z()},onPending:()=>process.stderr.write(".")}),r={refreshToken:t.refreshToken,userId:t.userId,userEmail:t.userEmail,authUrl:e.authUrl,apiUrl:e.apiUrl,createdAt:new Date().toISOString()};return Jn(r,e.staging,et),r}async function cg(e,t={}){let r=await ag(e);if(z(),z(" Signed in."),r.userEmail&&z(` Account: ${r.userEmail}`),z(` Saved to: ${wr(e.staging,et)}`),t.npm===!1){z(),z(` Skipped npm setup. To install ${Xe} packages: gigabuddy login --npm`);return}try{await lg(r)}catch(o){z(),z(` \u26A0 Signed in, but npm setup failed: ${o instanceof Error?o.message:String(o)}`),z(" You are signed in \u2014 retry just that half with: gigabuddy login --npm"),process.exitCode=1}}function lk(e){if(e<=0)return"";let t=Math.round(e/86400);return t>=1?` (valid ~${t} days)`:` (valid ${Math.round(e/3600)}h)`}async function ug(e){let t=kt(e.staging,et);t||(z("Not signed in yet \u2014 signing in first."),z(),t=await ag(e),z(),z(" Signed in.")),await lg(t)}async function lg(e){let t=await Wh({authUrl:e.authUrl,refreshToken:e.refreshToken}),r=Xh(t);z(),z(` npm is set up for ${Xe} packages${lk(t.expiresIn)}`),z(` Registry: ${t.registryUrl}`),z(` Written to: ${r}`),z(),z(` Try it: npm install ${Xe}/app-kit`),z(),z(" This credential is registry-only \u2014 it installs what you can install and nothing else."),z(" Run this again when it expires, or after your access changes.");let o=tc(process.cwd()).filter(n=>Dn(ig(n),t.registryUrl));o.length>0&&(z(),z(` \u26A0 ${o[0]} also configures this registry, and npm prefers it over ${r}.`),z(" Installs will keep using THAT credential, not this one. Delete its _authToken line."))}function dk(e){let t=kt(e,et),r=process.env.GIGABUDDY_NPM_REGISTRY_URL;return r||(t?.authUrl.includes("staging")?"https://npm.staging.gigabuddy.com":"https://npm.gigabuddy.com")}function ic(e){let t=eg(dk(e.staging));if(!t){z(`No ${Xe} registry entries found in ${Re()}`);return}z(`Removed ${Xe} registry credentials from ${t}`)}async function dg(e){let t=kt(e.staging,et);if(ic(e),!t){z("Not signed in.");return}let r=await Yh({authUrl:t.authUrl,refreshToken:t.refreshToken});lc(e.staging,et),r?z(`Signed out${e.staging?" of staging":""}. Any npm credential from this session stops working shortly.`):(z(`Signed out locally${e.staging?" of staging":""} \u2014 but could not reach the server to revoke the session.`),z(" Credentials already copied elsewhere may keep working. Sign out again when you are back online,"),z(" or revoke the session from your account settings."))}async function pk(e,t){if(e.userEmail)return e.userEmail;try{let r=await new _r({refreshToken:e.refreshToken,authUrl:e.authUrl}).getToken(),o=Eo(r);return o?(Jn({...e,userEmail:o},t,et),o):e.userId}catch{return e.userId}}async function pg(e,t){let r=await tg({readNpmrc:()=>{try{return ng(Re(),"utf-8")}catch{return""}},npmEffectiveRegistry:()=>{try{let n=ok("npm",["config","get",`${Xe}:registry`],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();return n&&n!=="undefined"&&n!=="null"?n:null}catch{return null}},shadowingNpmrcFiles:()=>tc(process.cwd()).map(n=>({path:n,contents:ig(n)})),fetchImpl:fetch,nodeVersion:process.version,loadCredentials:n=>kt(n,et)},t),o=process.stderr.isTTY===!0&&!process.env.NO_COLOR;z(),z(rg(r,o)),z(),r.advice.length>0&&(process.exitCode=1)}var og="gigabuddy/claude-plugin",sc="gigabuddy@gigabuddy",fk={runClaude(e){let t=nk("claude",e,{stdio:["ignore","inherit","inherit"]});if(t.error&&t.error.code==="ENOENT")return"missing";if(t.error)throw t.error;return t.status??1}};function fg(e=fk){z("Setting up Gigabuddy for Claude Code\u2026"),z();let t=e.runClaude(["plugin","marketplace","add",og]);if(t==="missing"){z(" Could not find the `claude` command on this machine."),z(" If Claude Code is installed, run these inside any Claude Code session instead:"),z(),z(` /plugin marketplace add ${og}`),z(` /plugin install ${sc}`),z(),z(" Then restart Claude Code."),process.exitCode=1;return}if(t!==0){z(),z(" \u26A0 Adding the Gigabuddy marketplace failed (see above). Nothing else was changed."),process.exitCode=1;return}if(e.runClaude(["plugin","install",sc])!==0){z(),z(" \u26A0 Installing the plugin failed (see above). The marketplace was added \u2014 retry with:"),z(),z(` claude plugin install ${sc}`),process.exitCode=1;return}z(),z(" Gigabuddy is installed. Next:"),z(),z(" 1. Restart Claude Code so the plugin loads."),z(" 2. Sign in with /gigabuddy:login (or now, from here: npx -y @gigabuddy/agent login)"),z(" 3. Ask your session to connect you to a room.")}async function mg(){let e=kt(!1,et),t=kt(!0,et);if(!e&&!t){z("Not signed in."),z(),z(" gigabuddy login");return}for(let[r,o,n]of[["Production",e,!1],["Staging",t,!0]])o&&(z(`${r}:`),z(` Account: ${await pk(o,n)}`),z(` Since: ${o.createdAt}`))}function vk(){try{let e=gk(hk(_k(import.meta.url)),"..","package.json");return JSON.parse(mk(e,"utf-8")).version}catch{return"unknown"}}function hg(){console.error(`
84
84
  gigabuddy \u2014 the Gigabuddy CLI
85
85
 
86
86
  Usage:
87
87
  gigabuddy <command> [options]
88
88
 
89
89
  Commands:
90
+ setup Install the Gigabuddy plugin into Claude Code
90
91
  login Sign in (opens your browser) and set npm up to install
91
92
  login --npm Re-mint just the npm credential (when it expires)
92
93
  logout Sign out (--npm clears only the npm credential)
@@ -115,5 +116,5 @@ If an install fails:
115
116
 
116
117
  npm answers a denied read with "not found", which looks the same as a typo.
117
118
  doctor tells you which it is.
118
- `)}async function hk(){let{values:e,positionals:t}=fk({options:{npm:{type:"boolean"},"no-npm":{type:"boolean"},staging:{type:"boolean"},"auth-url":{type:"string"},"api-url":{type:"string"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}},allowPositionals:!0});if(e.version){console.log(`gigabuddy v${mk()}`);return}let r=t[0];if(e.help||!r){pg(),process.exitCode=e.help?0:1;return}let o=og({staging:e.staging,authUrl:e["auth-url"],apiUrl:e["api-url"]});switch(r){case"login":e.npm?await ag(o):await ig(o,{npm:e["no-npm"]?!1:void 0});return;case"logout":e.npm?sc(o):await ug(o);return;case"status":await dg();return;case"doctor":await lg(o,t[1]);return;default:console.error(`Unknown command: ${r}`),console.error(""),pg(),process.exitCode=1}}hk().catch(e=>{console.error(""),console.error(e instanceof Error?e.message:String(e)),process.exit(1)});
119
+ `)}async function wk(){let{values:e,positionals:t}=yk({options:{npm:{type:"boolean"},"no-npm":{type:"boolean"},staging:{type:"boolean"},"auth-url":{type:"string"},"api-url":{type:"string"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}},allowPositionals:!0});if(e.version){console.log(`gigabuddy v${vk()}`);return}let r=t[0];if(e.help||!r){hg(),process.exitCode=e.help?0:1;return}let o=sg({staging:e.staging,authUrl:e["auth-url"],apiUrl:e["api-url"]});switch(r){case"setup":fg();return;case"login":e.npm?await ug(o):await cg(o,{npm:e["no-npm"]?!1:void 0});return;case"logout":e.npm?ic(o):await dg(o);return;case"status":await mg();return;case"doctor":await pg(o,t[1]);return;default:console.error(`Unknown command: ${r}`),console.error(""),hg(),process.exitCode=1}}wk().catch(e=>{console.error(""),console.error(e instanceof Error?e.message:String(e)),process.exit(1)});
119
120
  //# sourceMappingURL=cli.js.map