buildkeel 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +49 -0
- package/README.md +37 -3
- package/THIRD-PARTY-NOTICES +231 -0
- package/antigravity/LICENSE +49 -0
- package/antigravity/THIRD-PARTY-NOTICES +231 -0
- package/antigravity/bin/bk-launch +38 -0
- package/antigravity/bin/bk-launch.cmd +50 -0
- package/antigravity/dist/hooks/main.js +20 -0
- package/antigravity/dist/server/main.js +358 -0
- package/antigravity/package.json +8 -0
- package/antigravity/plugin.json +6 -0
- package/antigravity/rules/buildkeel.md +72 -0
- package/antigravity/skills/bk-adhoc/SKILL.md +49 -0
- package/antigravity/skills/bk-approve/SKILL.md +50 -0
- package/antigravity/skills/bk-build/SKILL.md +50 -0
- package/antigravity/skills/bk-capture/SKILL.md +94 -0
- package/antigravity/skills/bk-done/SKILL.md +56 -0
- package/antigravity/skills/bk-impact/SKILL.md +46 -0
- package/antigravity/skills/bk-init/SKILL.md +34 -0
- package/antigravity/skills/bk-migrate/SKILL.md +19 -0
- package/antigravity/skills/bk-new/SKILL.md +99 -0
- package/antigravity/skills/bk-onboard/SKILL.md +116 -0
- package/antigravity/skills/bk-start/SKILL.md +38 -0
- package/antigravity/skills/bk-stats/SKILL.md +38 -0
- package/antigravity/skills/bk-status/SKILL.md +16 -0
- package/antigravity/templates/adhoc.md +15 -0
- package/antigravity/templates/bug.md +33 -0
- package/antigravity/templates/design.md +47 -0
- package/antigravity/templates/epic.md +30 -0
- package/antigravity/templates/idea.md +34 -0
- package/antigravity/templates/story.md +30 -0
- package/antigravity/templates/task.md +21 -0
- package/antigravity/templates/test-plan.md +29 -0
- package/cli.mjs +220 -0
- package/package.json +14 -9
- package/bin/buildkeel.js +0 -3
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { createRequire as __bkCreateRequire } from 'node:module'; const require = __bkCreateRequire(import.meta.url);
|
|
2
|
+
var eK=Object.create;var K_=Object.defineProperty;var tK=Object.getOwnPropertyDescriptor;var rK=Object.getOwnPropertyNames;var nK=Object.getPrototypeOf,iK=Object.prototype.hasOwnProperty;var Pm=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var S=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Si=(e,t)=>{for(var r in t)K_(e,r,{get:t[r],enumerable:!0})},oK=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of rK(t))!iK.call(e,n)&&n!==r&&K_(e,n,{get:()=>t[n],enumerable:!(i=tK(t,n))||i.enumerable});return e};var gr=(e,t,r)=>(r=e!=null?eK(nK(e)):{},oK(t||!e||!e.__esModule?K_(r,"default",{value:e,enumerable:!0}):r,e));var sf=S(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.regexpCode=Ve.getEsmExportName=Ve.getProperty=Ve.safeStringify=Ve.stringify=Ve.strConcat=Ve.addCodeArg=Ve.str=Ve._=Ve.nil=Ve._Code=Ve.Name=Ve.IDENTIFIER=Ve._CodeOrName=void 0;var nf=class{};Ve._CodeOrName=nf;Ve.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ms=class extends nf{constructor(t){if(super(),!Ve.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}}};Ve.Name=Ms;var hn=class extends nf{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,i)=>`${r}${i}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,i)=>(i instanceof Ms&&(r[i.str]=(r[i.str]||0)+1),r),{})}};Ve._Code=hn;Ve.nil=new hn("");function _1(e,...t){let r=[e[0]],i=0;for(;i<t.length;)yx(r,t[i]),r.push(e[++i]);return new hn(r)}Ve._=_1;var gx=new hn("+");function w1(e,...t){let r=[of(e[0])],i=0;for(;i<t.length;)r.push(gx),yx(r,t[i]),r.push(gx,of(e[++i]));return F3(r),new hn(r)}Ve.str=w1;function yx(e,t){t instanceof hn?e.push(...t._items):t instanceof Ms?e.push(t):e.push(B3(t))}Ve.addCodeArg=yx;function F3(e){let t=1;for(;t<e.length-1;){if(e[t]===gx){let r=Z3(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Z3(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Ms||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 Ms))return`"${e}${t.slice(1)}`}function V3(e,t){return t.emptyStr()?e:e.emptyStr()?t:w1`${e}${t}`}Ve.strConcat=V3;function B3(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:of(Array.isArray(e)?e.join(","):e)}function K3(e){return new hn(of(e))}Ve.stringify=K3;function of(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ve.safeStringify=of;function G3(e){return typeof e=="string"&&Ve.IDENTIFIER.test(e)?new hn(`.${e}`):_1`[${e}]`}Ve.getProperty=G3;function W3(e){if(typeof e=="string"&&Ve.IDENTIFIER.test(e))return new hn(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Ve.getEsmExportName=W3;function J3(e){return new hn(e.toString())}Ve.regexpCode=J3});var bx=S(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.ValueScope=jr.ValueScopeName=jr.Scope=jr.varKinds=jr.UsedValueState=void 0;var zr=sf(),vx=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},vv;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(vv||(jr.UsedValueState=vv={}));jr.varKinds={const:new zr.Name("const"),let:new zr.Name("let"),var:new zr.Name("var")};var $v=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof zr.Name?t:this.name(t)}name(t){return new zr.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,i;if(!((i=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||i===void 0)&&i.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}}};jr.Scope=$v;var bv=class extends zr.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:i}){this.value=t,this.scopePath=(0,zr._)`.${new zr.Name(r)}[${i}]`}};jr.ValueScopeName=bv;var H3=(0,zr._)`\n`,$x=class extends $v{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?H3:zr.nil}}get(){return this._scope}name(t){return new bv(t,this._newName(t))}value(t,r){var i;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:o}=n,s=(i=r.key)!==null&&i!==void 0?i:r.ref,a=this._values[o];if(a){let l=a.get(s);if(l)return l}else a=this._values[o]=new Map;a.set(s,n);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:o,itemIndex:u}),n}getValue(t,r){let i=this._values[t];if(i)return i.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,zr._)`${t}${i.scopePath}`})}scopeCode(t=this._values,r,i){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,i)}_reduceValues(t,r,i={},n){let o=zr.nil;for(let s in t){let a=t[s];if(!a)continue;let c=i[s]=i[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,vv.Started);let l=r(u);if(l){let d=this.opts.es5?jr.varKinds.var:jr.varKinds.const;o=(0,zr._)`${o}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))o=(0,zr._)`${o}${l}${this.opts._n}`;else throw new vx(u);c.set(u,vv.Completed)})}return o}};jr.ValueScope=$x});var Ae=S(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.or=xe.and=xe.not=xe.CodeGen=xe.operators=xe.varKinds=xe.ValueScopeName=xe.ValueScope=xe.Scope=xe.Name=xe.regexpCode=xe.stringify=xe.getProperty=xe.nil=xe.strConcat=xe.str=xe._=void 0;var ze=sf(),jn=bx(),_o=sf();Object.defineProperty(xe,"_",{enumerable:!0,get:function(){return _o._}});Object.defineProperty(xe,"str",{enumerable:!0,get:function(){return _o.str}});Object.defineProperty(xe,"strConcat",{enumerable:!0,get:function(){return _o.strConcat}});Object.defineProperty(xe,"nil",{enumerable:!0,get:function(){return _o.nil}});Object.defineProperty(xe,"getProperty",{enumerable:!0,get:function(){return _o.getProperty}});Object.defineProperty(xe,"stringify",{enumerable:!0,get:function(){return _o.stringify}});Object.defineProperty(xe,"regexpCode",{enumerable:!0,get:function(){return _o.regexpCode}});Object.defineProperty(xe,"Name",{enumerable:!0,get:function(){return _o.Name}});var Sv=bx();Object.defineProperty(xe,"Scope",{enumerable:!0,get:function(){return Sv.Scope}});Object.defineProperty(xe,"ValueScope",{enumerable:!0,get:function(){return Sv.ValueScope}});Object.defineProperty(xe,"ValueScopeName",{enumerable:!0,get:function(){return Sv.ValueScopeName}});Object.defineProperty(xe,"varKinds",{enumerable:!0,get:function(){return Sv.varKinds}});xe.operators={GT:new ze._Code(">"),GTE:new ze._Code(">="),LT:new ze._Code("<"),LTE:new ze._Code("<="),EQ:new ze._Code("==="),NEQ:new ze._Code("!=="),NOT:new ze._Code("!"),OR:new ze._Code("||"),AND:new ze._Code("&&"),ADD:new ze._Code("+")};var Ni=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},_x=class extends Ni{constructor(t,r,i){super(),this.varKind=t,this.name=r,this.rhs=i}render({es5:t,_n:r}){let i=t?jn.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Yc(this.rhs,t,r)),this}get names(){return this.rhs instanceof ze._CodeOrName?this.rhs.names:{}}},_v=class extends Ni{constructor(t,r,i){super(),this.lhs=t,this.rhs=r,this.sideEffects=i}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof ze.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Yc(this.rhs,t,r),this}get names(){let t=this.lhs instanceof ze.Name?{}:{...this.lhs.names};return kv(t,this.rhs)}},wx=class extends _v{constructor(t,r,i,n){super(t,i,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},kx=class extends Ni{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Sx=class extends Ni{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xx=class extends Ni{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Ix=class extends Ni{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=Yc(this.code,t,r),this}get names(){return this.code instanceof ze._CodeOrName?this.code.names:{}}},af=class extends Ni{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,i)=>r+i.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let i=t[r].optimizeNodes();Array.isArray(i)?t.splice(r,1,...i):i?t[r]=i:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:i}=this,n=i.length;for(;n--;){let o=i[n];o.optimizeNames(t,r)||(Y3(t,o.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>qs(t,r.names),{})}},Ci=class extends af{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Px=class extends af{},Hc=class extends Ci{};Hc.kind="else";var Ls=class e extends Ci{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 i=r.optimizeNodes();r=this.else=Array.isArray(i)?new Hc(i):i}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(k1(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var i;if(this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Yc(this.condition,t,r),this}get names(){let t=super.names;return kv(t,this.condition),this.else&&qs(t,this.else.names),t}};Ls.kind="if";var Us=class extends Ci{};Us.kind="for";var Tx=class extends Us{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=Yc(this.iteration,t,r),this}get names(){return qs(super.names,this.iteration.names)}},Ax=class extends Us{constructor(t,r,i,n){super(),this.varKind=t,this.name=r,this.from=i,this.to=n}render(t){let r=t.es5?jn.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(t)}get names(){let t=kv(super.names,this.from);return kv(t,this.to)}},wv=class extends Us{constructor(t,r,i,n){super(),this.loop=t,this.varKind=r,this.name=i,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=Yc(this.iterable,t,r),this}get names(){return qs(super.names,this.iterable.names)}},cf=class extends Ci{constructor(t,r,i){super(),this.name=t,this.args=r,this.async=i}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};cf.kind="func";var uf=class extends af{render(t){return"return "+super.render(t)}};uf.kind="return";var Rx=class extends Ci{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 i,n;return super.optimizeNames(t,r),(i=this.catch)===null||i===void 0||i.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&qs(t,this.catch.names),this.finally&&qs(t,this.finally.names),t}},lf=class extends Ci{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};lf.kind="catch";var df=class extends Ci{render(t){return"finally"+super.render(t)}};df.kind="finally";var Ex=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=t,this._scope=new jn.Scope({parent:t}),this._nodes=[new Px]}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 i=this._extScope.value(t,r);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}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,i,n){let o=this._scope.toName(r);return i!==void 0&&n&&(this._constants[o.str]=i),this._leafNode(new _x(t,o,i)),o}const(t,r,i){return this._def(jn.varKinds.const,t,r,i)}let(t,r,i){return this._def(jn.varKinds.let,t,r,i)}var(t,r,i){return this._def(jn.varKinds.var,t,r,i)}assign(t,r,i){return this._leafNode(new _v(t,r,i))}add(t,r){return this._leafNode(new wx(t,xe.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==ze.nil&&this._leafNode(new Ix(t)),this}object(...t){let r=["{"];for(let[i,n]of t)r.length>1&&r.push(","),r.push(i),(i!==n||this.opts.es5)&&(r.push(":"),(0,ze.addCodeArg)(r,n));return r.push("}"),new ze._Code(r)}if(t,r,i){if(this._blockNode(new Ls(t)),r&&i)this.code(r).else().code(i).endIf();else if(r)this.code(r).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Ls(t))}else(){return this._elseNode(new Hc)}endIf(){return this._endBlockNode(Ls,Hc)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Tx(t),r)}forRange(t,r,i,n,o=this.opts.es5?jn.varKinds.var:jn.varKinds.let){let s=this._scope.toName(t);return this._for(new Ax(o,s,r,i),()=>n(s))}forOf(t,r,i,n=jn.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let s=r instanceof ze.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ze._)`${s}.length`,a=>{this.var(o,(0,ze._)`${s}[${a}]`),i(o)})}return this._for(new wv("of",n,o,r),()=>i(o))}forIn(t,r,i,n=this.opts.es5?jn.varKinds.var:jn.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,ze._)`Object.keys(${r})`,i);let o=this._scope.toName(t);return this._for(new wv("in",n,o,r),()=>i(o))}endFor(){return this._endBlockNode(Us)}label(t){return this._leafNode(new kx(t))}break(t){return this._leafNode(new Sx(t))}return(t){let r=new uf;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(uf)}try(t,r,i){if(!r&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Rx;if(this._blockNode(n),this.code(t),r){let o=this.name("e");this._currNode=n.catch=new lf(o),r(o)}return i&&(this._currNode=n.finally=new df,this.code(i)),this._endBlockNode(lf,df)}throw(t){return this._leafNode(new xx(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 i=this._nodes.length-r;if(i<0||t!==void 0&&i!==t)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=ze.nil,i,n){return this._blockNode(new cf(t,r,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(cf)}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 i=this._currNode;if(i instanceof t||r&&i 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 Ls))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}};xe.CodeGen=Ex;function qs(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function kv(e,t){return t instanceof ze._CodeOrName?qs(e,t.names):e}function Yc(e,t,r){if(e instanceof ze.Name)return i(e);if(!n(e))return e;return new ze._Code(e._items.reduce((o,s)=>(s instanceof ze.Name&&(s=i(s)),s instanceof ze._Code?o.push(...s._items):o.push(s),o),[]));function i(o){let s=r[o.str];return s===void 0||t[o.str]!==1?o:(delete t[o.str],s)}function n(o){return o instanceof ze._Code&&o._items.some(s=>s instanceof ze.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function Y3(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function k1(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,ze._)`!${Ox(e)}`}xe.not=k1;var X3=S1(xe.operators.AND);function Q3(...e){return e.reduce(X3)}xe.and=Q3;var e5=S1(xe.operators.OR);function t5(...e){return e.reduce(e5)}xe.or=t5;function S1(e){return(t,r)=>t===ze.nil?r:r===ze.nil?t:(0,ze._)`${Ox(t)} ${e} ${Ox(r)}`}function Ox(e){return e instanceof ze.Name?e:(0,ze._)`(${e})`}});var De=S(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.checkStrictMode=Re.getErrorPath=Re.Type=Re.useFunc=Re.setEvaluated=Re.evaluatedPropsToName=Re.mergeEvaluated=Re.eachItem=Re.unescapeJsonPointer=Re.escapeJsonPointer=Re.escapeFragment=Re.unescapeFragment=Re.schemaRefOrVal=Re.schemaHasRulesButRef=Re.schemaHasRules=Re.checkUnknownRules=Re.alwaysValidSchema=Re.toHash=void 0;var ct=Ae(),r5=sf();function n5(e){let t={};for(let r of e)t[r]=!0;return t}Re.toHash=n5;function i5(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(P1(e,t),!T1(t,e.self.RULES.all))}Re.alwaysValidSchema=i5;function P1(e,t=e.schema){let{opts:r,self:i}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=i.RULES.keywords;for(let o in t)n[o]||E1(e,`unknown keyword: "${o}"`)}Re.checkUnknownRules=P1;function T1(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Re.schemaHasRules=T1;function o5(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Re.schemaHasRulesButRef=o5;function s5({topSchemaRef:e,schemaPath:t},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ct._)`${r}`}return(0,ct._)`${e}${t}${(0,ct.getProperty)(i)}`}Re.schemaRefOrVal=s5;function a5(e){return A1(decodeURIComponent(e))}Re.unescapeFragment=a5;function c5(e){return encodeURIComponent(Cx(e))}Re.escapeFragment=c5;function Cx(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Re.escapeJsonPointer=Cx;function A1(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Re.unescapeJsonPointer=A1;function u5(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Re.eachItem=u5;function x1({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{let c=s===void 0?o:s instanceof ct.Name?(o instanceof ct.Name?e(n,o,s):t(n,o,s),s):o instanceof ct.Name?(t(n,s,o),o):r(o,s);return a===ct.Name&&!(c instanceof ct.Name)?i(n,c):c}}Re.mergeEvaluated={props:x1({mergeNames:(e,t,r)=>e.if((0,ct._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,ct._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,ct._)`${r} || {}`).code((0,ct._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,ct._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,ct._)`${r} || {}`),zx(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:R1}),items:x1({mergeNames:(e,t,r)=>e.if((0,ct._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,ct._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,ct._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,ct._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function R1(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,ct._)`{}`);return t!==void 0&&zx(e,r,t),r}Re.evaluatedPropsToName=R1;function zx(e,t,r){Object.keys(r).forEach(i=>e.assign((0,ct._)`${t}${(0,ct.getProperty)(i)}`,!0))}Re.setEvaluated=zx;var I1={};function l5(e,t){return e.scopeValue("func",{ref:t,code:I1[t.code]||(I1[t.code]=new r5._Code(t.code))})}Re.useFunc=l5;var Nx;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Nx||(Re.Type=Nx={}));function d5(e,t,r){if(e instanceof ct.Name){let i=t===Nx.Num;return r?i?(0,ct._)`"[" + ${e} + "]"`:(0,ct._)`"['" + ${e} + "']"`:i?(0,ct._)`"/" + ${e}`:(0,ct._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ct.getProperty)(e).toString():"/"+Cx(e)}Re.getErrorPath=d5;function E1(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Re.checkStrictMode=E1});var zi=S(jx=>{"use strict";Object.defineProperty(jx,"__esModule",{value:!0});var ir=Ae(),f5={data:new ir.Name("data"),valCxt:new ir.Name("valCxt"),instancePath:new ir.Name("instancePath"),parentData:new ir.Name("parentData"),parentDataProperty:new ir.Name("parentDataProperty"),rootData:new ir.Name("rootData"),dynamicAnchors:new ir.Name("dynamicAnchors"),vErrors:new ir.Name("vErrors"),errors:new ir.Name("errors"),this:new ir.Name("this"),self:new ir.Name("self"),scope:new ir.Name("scope"),json:new ir.Name("json"),jsonPos:new ir.Name("jsonPos"),jsonLen:new ir.Name("jsonLen"),jsonPart:new ir.Name("jsonPart")};jx.default=f5});var ff=S(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.extendErrors=or.resetErrorsCount=or.reportExtraError=or.reportError=or.keyword$DataError=or.keywordError=void 0;var Me=Ae(),xv=De(),Sr=zi();or.keywordError={message:({keyword:e})=>(0,Me.str)`must pass "${e}" keyword validation`};or.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,Me.str)`"${e}" keyword must be ${t} ($data)`:(0,Me.str)`"${e}" keyword is invalid ($data)`};function p5(e,t=or.keywordError,r,i){let{it:n}=e,{gen:o,compositeRule:s,allErrors:a}=n,c=C1(e,t,r);i??(s||a)?O1(o,c):N1(n,(0,Me._)`[${c}]`)}or.reportError=p5;function m5(e,t=or.keywordError,r){let{it:i}=e,{gen:n,compositeRule:o,allErrors:s}=i,a=C1(e,t,r);O1(n,a),o||s||N1(i,Sr.default.vErrors)}or.reportExtraError=m5;function h5(e,t){e.assign(Sr.default.errors,t),e.if((0,Me._)`${Sr.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,Me._)`${Sr.default.vErrors}.length`,t),()=>e.assign(Sr.default.vErrors,null)))}or.resetErrorsCount=h5;function g5({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,Sr.default.errors,a=>{e.const(s,(0,Me._)`${Sr.default.vErrors}[${a}]`),e.if((0,Me._)`${s}.instancePath === undefined`,()=>e.assign((0,Me._)`${s}.instancePath`,(0,Me.strConcat)(Sr.default.instancePath,o.errorPath))),e.assign((0,Me._)`${s}.schemaPath`,(0,Me.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,Me._)`${s}.schema`,r),e.assign((0,Me._)`${s}.data`,i))})}or.extendErrors=g5;function O1(e,t){let r=e.const("err",t);e.if((0,Me._)`${Sr.default.vErrors} === null`,()=>e.assign(Sr.default.vErrors,(0,Me._)`[${r}]`),(0,Me._)`${Sr.default.vErrors}.push(${r})`),e.code((0,Me._)`${Sr.default.errors}++`)}function N1(e,t){let{gen:r,validateName:i,schemaEnv:n}=e;n.$async?r.throw((0,Me._)`new ${e.ValidationError}(${t})`):(r.assign((0,Me._)`${i}.errors`,t),r.return(!1))}var Fs={keyword:new Me.Name("keyword"),schemaPath:new Me.Name("schemaPath"),params:new Me.Name("params"),propertyName:new Me.Name("propertyName"),message:new Me.Name("message"),schema:new Me.Name("schema"),parentSchema:new Me.Name("parentSchema")};function C1(e,t,r){let{createErrors:i}=e.it;return i===!1?(0,Me._)`{}`:y5(e,t,r)}function y5(e,t,r={}){let{gen:i,it:n}=e,o=[v5(n,r),$5(e,r)];return b5(e,t,o),i.object(...o)}function v5({errorPath:e},{instancePath:t}){let r=t?(0,Me.str)`${e}${(0,xv.getErrorPath)(t,xv.Type.Str)}`:e;return[Sr.default.instancePath,(0,Me.strConcat)(Sr.default.instancePath,r)]}function $5({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:i}){let n=i?t:(0,Me.str)`${t}/${e}`;return r&&(n=(0,Me.str)`${n}${(0,xv.getErrorPath)(r,xv.Type.Str)}`),[Fs.schemaPath,n]}function b5(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:s,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;i.push([Fs.keyword,n],[Fs.params,typeof t=="function"?t(e):t||(0,Me._)`{}`]),c.messages&&i.push([Fs.message,typeof r=="function"?r(e):r]),c.verbose&&i.push([Fs.schema,s],[Fs.parentSchema,(0,Me._)`${l}${d}`],[Sr.default.data,o]),u&&i.push([Fs.propertyName,u])}});var j1=S(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.boolOrEmptySchema=Xc.topBoolOrEmptySchema=void 0;var _5=ff(),w5=Ae(),k5=zi(),S5={message:"boolean schema is false"};function x5(e){let{gen:t,schema:r,validateName:i}=e;r===!1?z1(e,!1):typeof r=="object"&&r.$async===!0?t.return(k5.default.data):(t.assign((0,w5._)`${i}.errors`,null),t.return(!0))}Xc.topBoolOrEmptySchema=x5;function I5(e,t){let{gen:r,schema:i}=e;i===!1?(r.var(t,!1),z1(e)):r.var(t,!0)}Xc.boolOrEmptySchema=I5;function z1(e,t){let{gen:r,data:i}=e,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,_5.reportError)(n,S5,void 0,t)}});var Dx=S(Qc=>{"use strict";Object.defineProperty(Qc,"__esModule",{value:!0});Qc.getRules=Qc.isJSONType=void 0;var P5=["string","number","integer","boolean","null","object","array"],T5=new Set(P5);function A5(e){return typeof e=="string"&&T5.has(e)}Qc.isJSONType=A5;function R5(){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:{}}}Qc.getRules=R5});var Mx=S(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.shouldUseRule=wo.shouldUseGroup=wo.schemaHasRulesForType=void 0;function E5({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&D1(e,i)}wo.schemaHasRulesForType=E5;function D1(e,t){return t.rules.some(r=>M1(e,r))}wo.shouldUseGroup=D1;function M1(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(i=>e[i]!==void 0))}wo.shouldUseRule=M1});var pf=S(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.reportTypeError=sr.checkDataTypes=sr.checkDataType=sr.coerceAndCheckDataType=sr.getJSONTypes=sr.getSchemaTypes=sr.DataType=void 0;var O5=Dx(),N5=Mx(),C5=ff(),$e=Ae(),L1=De(),eu;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(eu||(sr.DataType=eu={}));function z5(e){let t=U1(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}sr.getSchemaTypes=z5;function U1(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(O5.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}sr.getJSONTypes=U1;function j5(e,t){let{gen:r,data:i,opts:n}=e,o=D5(t,n.coerceTypes),s=t.length>0&&!(o.length===0&&t.length===1&&(0,N5.schemaHasRulesForType)(e,t[0]));if(s){let a=Ux(t,i,n.strictNumbers,eu.Wrong);r.if(a,()=>{o.length?M5(e,t,o):qx(e)})}return s}sr.coerceAndCheckDataType=j5;var q1=new Set(["string","number","integer","boolean","null"]);function D5(e,t){return t?e.filter(r=>q1.has(r)||t==="array"&&r==="array"):[]}function M5(e,t,r){let{gen:i,data:n,opts:o}=e,s=i.let("dataType",(0,$e._)`typeof ${n}`),a=i.let("coerced",(0,$e._)`undefined`);o.coerceTypes==="array"&&i.if((0,$e._)`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,$e._)`${n}[0]`).assign(s,(0,$e._)`typeof ${n}`).if(Ux(t,n,o.strictNumbers),()=>i.assign(a,n))),i.if((0,$e._)`${a} !== undefined`);for(let u of r)(q1.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);i.else(),qx(e),i.endIf(),i.if((0,$e._)`${a} !== undefined`,()=>{i.assign(n,a),L5(e,a)});function c(u){switch(u){case"string":i.elseIf((0,$e._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,$e._)`"" + ${n}`).elseIf((0,$e._)`${n} === null`).assign(a,(0,$e._)`""`);return;case"number":i.elseIf((0,$e._)`${s} == "boolean" || ${n} === null
|
|
4
|
+
|| (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,$e._)`+${n}`);return;case"integer":i.elseIf((0,$e._)`${s} === "boolean" || ${n} === null
|
|
5
|
+
|| (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,$e._)`+${n}`);return;case"boolean":i.elseIf((0,$e._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,$e._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":i.elseIf((0,$e._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(a,null);return;case"array":i.elseIf((0,$e._)`${s} === "string" || ${s} === "number"
|
|
6
|
+
|| ${s} === "boolean" || ${n} === null`).assign(a,(0,$e._)`[${n}]`)}}}function L5({gen:e,parentData:t,parentDataProperty:r},i){e.if((0,$e._)`${t} !== undefined`,()=>e.assign((0,$e._)`${t}[${r}]`,i))}function Lx(e,t,r,i=eu.Correct){let n=i===eu.Correct?$e.operators.EQ:$e.operators.NEQ,o;switch(e){case"null":return(0,$e._)`${t} ${n} null`;case"array":o=(0,$e._)`Array.isArray(${t})`;break;case"object":o=(0,$e._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s((0,$e._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return(0,$e._)`typeof ${t} ${n} ${e}`}return i===eu.Correct?o:(0,$e.not)(o);function s(a=$e.nil){return(0,$e.and)((0,$e._)`typeof ${t} == "number"`,a,r?(0,$e._)`isFinite(${t})`:$e.nil)}}sr.checkDataType=Lx;function Ux(e,t,r,i){if(e.length===1)return Lx(e[0],t,r,i);let n,o=(0,L1.toHash)(e);if(o.array&&o.object){let s=(0,$e._)`typeof ${t} != "object"`;n=o.null?s:(0,$e._)`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=$e.nil;o.number&&delete o.integer;for(let s in o)n=(0,$e.and)(n,Lx(s,t,r,i));return n}sr.checkDataTypes=Ux;var U5={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,$e._)`{type: ${e}}`:(0,$e._)`{type: ${t}}`};function qx(e){let t=q5(e);(0,C5.reportError)(t,U5)}sr.reportTypeError=qx;function q5(e){let{gen:t,data:r,schema:i}=e,n=(0,L1.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var Z1=S(Iv=>{"use strict";Object.defineProperty(Iv,"__esModule",{value:!0});Iv.assignDefaults=void 0;var tu=Ae(),F5=De();function Z5(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)F1(e,n,r[n].default);else t==="array"&&Array.isArray(i)&&i.forEach((n,o)=>F1(e,o,n.default))}Iv.assignDefaults=Z5;function F1(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let a=(0,tu._)`${o}${(0,tu.getProperty)(t)}`;if(n){(0,F5.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,tu._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,tu._)`${c} || ${a} === null || ${a} === ""`),i.if(c,(0,tu._)`${a} = ${(0,tu.stringify)(r)}`)}});var gn=S(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.validateUnion=ot.validateArray=ot.usePattern=ot.callValidateCode=ot.schemaProperties=ot.allSchemaProperties=ot.noPropertyInData=ot.propertyInData=ot.isOwnProperty=ot.hasPropFunc=ot.reportMissingProp=ot.checkMissingProp=ot.checkReportMissingProp=void 0;var ft=Ae(),Fx=De(),ko=zi(),V5=De();function B5(e,t){let{gen:r,data:i,it:n}=e;r.if(Vx(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ft._)`${t}`},!0),e.error()})}ot.checkReportMissingProp=B5;function K5({gen:e,data:t,it:{opts:r}},i,n){return(0,ft.or)(...i.map(o=>(0,ft.and)(Vx(e,t,o,r.ownProperties),(0,ft._)`${n} = ${o}`)))}ot.checkMissingProp=K5;function G5(e,t){e.setParams({missingProperty:t},!0),e.error()}ot.reportMissingProp=G5;function V1(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ft._)`Object.prototype.hasOwnProperty`})}ot.hasPropFunc=V1;function Zx(e,t,r){return(0,ft._)`${V1(e)}.call(${t}, ${r})`}ot.isOwnProperty=Zx;function W5(e,t,r,i){let n=(0,ft._)`${t}${(0,ft.getProperty)(r)} !== undefined`;return i?(0,ft._)`${n} && ${Zx(e,t,r)}`:n}ot.propertyInData=W5;function Vx(e,t,r,i){let n=(0,ft._)`${t}${(0,ft.getProperty)(r)} === undefined`;return i?(0,ft.or)(n,(0,ft.not)(Zx(e,t,r))):n}ot.noPropertyInData=Vx;function B1(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ot.allSchemaProperties=B1;function J5(e,t){return B1(t).filter(r=>!(0,Fx.alwaysValidSchema)(e,t[r]))}ot.schemaProperties=J5;function H5({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,c,u){let l=u?(0,ft._)`${e}, ${t}, ${i}${n}`:t,d=[[ko.default.instancePath,(0,ft.strConcat)(ko.default.instancePath,o)],[ko.default.parentData,s.parentData],[ko.default.parentDataProperty,s.parentDataProperty],[ko.default.rootData,ko.default.rootData]];s.opts.dynamicRef&&d.push([ko.default.dynamicAnchors,ko.default.dynamicAnchors]);let f=(0,ft._)`${l}, ${r.object(...d)}`;return c!==ft.nil?(0,ft._)`${a}.call(${c}, ${f})`:(0,ft._)`${a}(${f})`}ot.callValidateCode=H5;var Y5=(0,ft._)`new RegExp`;function X5({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,ft._)`${n.code==="new RegExp"?Y5:(0,V5.useFunc)(e,n)}(${r}, ${i})`})}ot.usePattern=X5;function Q5(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(o,!0),s(()=>t.break()),o;function s(a){let c=t.const("len",(0,ft._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:i,dataProp:u,dataPropType:Fx.Type.Num},o),t.if((0,ft.not)(o),a)})}}ot.validateArray=Q5;function e8(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Fx.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:i,schemaProp:u,compositeRule:!0},a);t.assign(s,(0,ft._)`${s} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,ft.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}ot.validateUnion=e8});var W1=S(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.validateKeywordUsage=si.validSchemaType=si.funcKeywordCode=si.macroKeywordCode=void 0;var xr=Ae(),Zs=zi(),t8=gn(),r8=ff();function n8(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,a=t.macro.call(s.self,n,o,s),c=G1(r,i,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:xr.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}si.macroKeywordCode=n8;function i8(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:a,it:c}=e;s8(c,t);let u=!a&&t.compile?t.compile.call(c.self,o,s,c):t.validate,l=G1(i,n,u),d=i.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)h(),t.modifying&&K1(e),g(()=>e.error());else{let y=t.async?p():m();t.modifying&&K1(e),g(()=>o8(e,y))}}function p(){let y=i.let("ruleErrs",null);return i.try(()=>h((0,xr._)`await `),v=>i.assign(d,!1).if((0,xr._)`${v} instanceof ${c.ValidationError}`,()=>i.assign(y,(0,xr._)`${v}.errors`),()=>i.throw(v))),y}function m(){let y=(0,xr._)`${l}.errors`;return i.assign(y,null),h(xr.nil),y}function h(y=t.async?(0,xr._)`await `:xr.nil){let v=c.opts.passContext?Zs.default.this:Zs.default.self,$=!("compile"in t&&!a||t.schema===!1);i.assign(d,(0,xr._)`${y}${(0,t8.callValidateCode)(e,l,v,$)}`,t.modifying)}function g(y){var v;i.if((0,xr.not)((v=t.valid)!==null&&v!==void 0?v:d),y)}}si.funcKeywordCode=i8;function K1(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,(0,xr._)`${i.parentData}[${i.parentDataProperty}]`))}function o8(e,t){let{gen:r}=e;r.if((0,xr._)`Array.isArray(${t})`,()=>{r.assign(Zs.default.vErrors,(0,xr._)`${Zs.default.vErrors} === null ? ${t} : ${Zs.default.vErrors}.concat(${t})`).assign(Zs.default.errors,(0,xr._)`${Zs.default.vErrors}.length`),(0,r8.extendErrors)(e)},()=>e.error())}function s8({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function G1(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,xr.stringify)(r)})}function a8(e,t,r=!1){return!t.length||t.some(i=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}si.validSchemaType=a8;function c8({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}si.validateKeywordUsage=c8});var H1=S(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.extendSubschemaMode=So.extendSubschemaData=So.getSubschema=void 0;var ai=Ae(),J1=De();function u8(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==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,ai._)`${e.schemaPath}${(0,ai.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,ai._)`${e.schemaPath}${(0,ai.getProperty)(t)}${(0,ai.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,J1.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}So.getSubschema=u8;function l8(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){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:d}=t,f=a.let("data",(0,ai._)`${t.data}${(0,ai.getProperty)(r)}`,!0);c(f),e.errorPath=(0,ai.str)`${u}${(0,J1.getErrorPath)(r,i,d.jsPropertySyntax)}`,e.parentDataProperty=(0,ai._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof ai.Name?n:a.let("data",n,!0);c(u),s!==void 0&&(e.propertyName=s)}o&&(e.dataTypes=o);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]}}So.extendSubschemaData=l8;function d8(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){i!==void 0&&(e.compositeRule=i),n!==void 0&&(e.createErrors=n),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}So.extendSubschemaMode=d8});var mf=S((xSe,Y1)=>{"use strict";Y1.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 i,n,o;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(n=i;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(o=Object.keys(t),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var Q1=S((ISe,X1)=>{"use strict";var xo=X1.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Pv(t,i,n,e,"",e)};xo.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};xo.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xo.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xo.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 Pv(e,t,r,i,n,o,s,a,c,u){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,a,c,u);for(var l in i){var d=i[l];if(Array.isArray(d)){if(l in xo.arrayKeywords)for(var f=0;f<d.length;f++)Pv(e,t,r,d[f],n+"/"+l+"/"+f,o,n,l,i,f)}else if(l in xo.propsKeywords){if(d&&typeof d=="object")for(var p in d)Pv(e,t,r,d[p],n+"/"+l+"/"+f8(p),o,n,l,i,p)}else(l in xo.keywords||e.allKeys&&!(l in xo.skipKeywords))&&Pv(e,t,r,d,n+"/"+l,o,n,l,i)}r(i,n,o,s,a,c,u)}}function f8(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var hf=S(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.getSchemaRefs=Dr.resolveUrl=Dr.normalizeId=Dr._getFullPath=Dr.getFullPath=Dr.inlineRef=void 0;var p8=De(),m8=mf(),h8=Q1(),g8=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function y8(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Bx(e):t?eD(e)<=t:!1}Dr.inlineRef=y8;var v8=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Bx(e){for(let t in e){if(v8.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Bx)||typeof r=="object"&&Bx(r))return!0}return!1}function eD(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!g8.has(r)&&(typeof e[r]=="object"&&(0,p8.eachItem)(e[r],i=>t+=eD(i)),t===1/0))return 1/0}return t}function tD(e,t="",r){r!==!1&&(t=ru(t));let i=e.parse(t);return rD(e,i)}Dr.getFullPath=tD;function rD(e,t){return e.serialize(t).split("#")[0]+"#"}Dr._getFullPath=rD;var $8=/#\/?$/;function ru(e){return e?e.replace($8,""):""}Dr.normalizeId=ru;function b8(e,t,r){return r=ru(r),e.resolve(t,r)}Dr.resolveUrl=b8;var _8=/^[a-z_][-a-z0-9._]*$/i;function w8(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=ru(e[r]||t),o={"":n},s=tD(i,n,!1),a={},c=new Set;return h8(e,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,g=o[m];typeof d[r]=="string"&&(g=y.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),o[f]=g;function y($){let _=this.opts.uriResolver.resolve;if($=ru(g?_(g,$):$),c.has($))throw l($);c.add($);let w=this.refs[$];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?u(d,w.schema,$):$!==ru(h)&&($[0]==="#"?(u(d,a[$],$),a[$]=d):this.refs[$]=h),$}function v($){if(typeof $=="string"){if(!_8.test($))throw new Error(`invalid anchor "${$}"`);y.call(this,`#${$}`)}}}),a;function u(d,f,p){if(f!==void 0&&!m8(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Dr.getSchemaRefs=w8});var vf=S(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.getData=Io.KeywordCxt=Io.validateFunctionCode=void 0;var aD=j1(),nD=pf(),Gx=Mx(),Tv=pf(),k8=Z1(),yf=W1(),Kx=H1(),X=Ae(),pe=zi(),S8=hf(),ji=De(),gf=ff();function x8(e){if(lD(e)&&(dD(e),uD(e))){T8(e);return}cD(e,()=>(0,aD.topBoolOrEmptySchema)(e))}Io.validateFunctionCode=x8;function cD({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){n.code.es5?e.func(t,(0,X._)`${pe.default.data}, ${pe.default.valCxt}`,i.$async,()=>{e.code((0,X._)`"use strict"; ${iD(r,n)}`),P8(e,n),e.code(o)}):e.func(t,(0,X._)`${pe.default.data}, ${I8(n)}`,i.$async,()=>e.code(iD(r,n)).code(o))}function I8(e){return(0,X._)`{${pe.default.instancePath}="", ${pe.default.parentData}, ${pe.default.parentDataProperty}, ${pe.default.rootData}=${pe.default.data}${e.dynamicRef?(0,X._)`, ${pe.default.dynamicAnchors}={}`:X.nil}}={}`}function P8(e,t){e.if(pe.default.valCxt,()=>{e.var(pe.default.instancePath,(0,X._)`${pe.default.valCxt}.${pe.default.instancePath}`),e.var(pe.default.parentData,(0,X._)`${pe.default.valCxt}.${pe.default.parentData}`),e.var(pe.default.parentDataProperty,(0,X._)`${pe.default.valCxt}.${pe.default.parentDataProperty}`),e.var(pe.default.rootData,(0,X._)`${pe.default.valCxt}.${pe.default.rootData}`),t.dynamicRef&&e.var(pe.default.dynamicAnchors,(0,X._)`${pe.default.valCxt}.${pe.default.dynamicAnchors}`)},()=>{e.var(pe.default.instancePath,(0,X._)`""`),e.var(pe.default.parentData,(0,X._)`undefined`),e.var(pe.default.parentDataProperty,(0,X._)`undefined`),e.var(pe.default.rootData,pe.default.data),t.dynamicRef&&e.var(pe.default.dynamicAnchors,(0,X._)`{}`)})}function T8(e){let{schema:t,opts:r,gen:i}=e;cD(e,()=>{r.$comment&&t.$comment&&pD(e),N8(e),i.let(pe.default.vErrors,null),i.let(pe.default.errors,0),r.unevaluated&&A8(e),fD(e),j8(e)})}function A8(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,X._)`${r}.evaluated`),t.if((0,X._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,X._)`${e.evaluated}.props`,(0,X._)`undefined`)),t.if((0,X._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,X._)`${e.evaluated}.items`,(0,X._)`undefined`))}function iD(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,X._)`/*# sourceURL=${r} */`:X.nil}function R8(e,t){if(lD(e)&&(dD(e),uD(e))){E8(e,t);return}(0,aD.boolOrEmptySchema)(e,t)}function uD({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 lD(e){return typeof e.schema!="boolean"}function E8(e,t){let{schema:r,gen:i,opts:n}=e;n.$comment&&r.$comment&&pD(e),C8(e),z8(e);let o=i.const("_errs",pe.default.errors);fD(e,o),i.var(t,(0,X._)`${o} === ${pe.default.errors}`)}function dD(e){(0,ji.checkUnknownRules)(e),O8(e)}function fD(e,t){if(e.opts.jtd)return oD(e,[],!1,t);let r=(0,nD.getSchemaTypes)(e.schema),i=(0,nD.coerceAndCheckDataType)(e,r);oD(e,r,!i,t)}function O8(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,ji.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function N8(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ji.checkStrictMode)(e,"default is ignored in the schema root")}function C8(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,S8.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function z8(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function pD({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code((0,X._)`${pe.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=(0,X.str)`${i}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,X._)`${pe.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function j8(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;r.$async?t.if((0,X._)`${pe.default.errors} === 0`,()=>t.return(pe.default.data),()=>t.throw((0,X._)`new ${n}(${pe.default.vErrors})`)):(t.assign((0,X._)`${i}.errors`,pe.default.vErrors),o.unevaluated&&D8(e),t.return((0,X._)`${pe.default.errors} === 0`))}function D8({gen:e,evaluated:t,props:r,items:i}){r instanceof X.Name&&e.assign((0,X._)`${t}.props`,r),i instanceof X.Name&&e.assign((0,X._)`${t}.items`,i)}function oD(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,ji.schemaHasRulesButRef)(o,l))){n.block(()=>hD(e,"$ref",l.all.$ref.definition));return}c.jtd||M8(e,t),n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,Gx.shouldUseGroup)(o,f)&&(f.type?(n.if((0,Tv.checkDataType)(f.type,s,c.strictNumbers)),sD(e,f),t.length===1&&t[0]===f.type&&r&&(n.else(),(0,Tv.reportTypeError)(e)),n.endIf()):sD(e,f),a||n.if((0,X._)`${pe.default.errors} === ${i||0}`))}}function sD(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;n&&(0,k8.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0,Gx.shouldUseRule)(i,o)&&hD(e,o.keyword,o.definition,t.type)})}function M8(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(L8(e,t),e.opts.allowUnionTypes||U8(e,t),q8(e,e.dataTypes))}function L8(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{mD(e.dataTypes,r)||Wx(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Z8(e,t)}}function U8(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Wx(e,"use allowUnionTypes to allow union type keyword")}function q8(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,Gx.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;o.length&&!o.some(s=>F8(t,s))&&Wx(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function F8(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function mD(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Z8(e,t){let r=[];for(let i of e.dataTypes)mD(t,i)?r.push(i):t.includes("integer")&&i==="number"&&r.push("integer");e.dataTypes=r}function Wx(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,ji.checkStrictMode)(e,t,e.opts.strictTypes)}var Av=class{constructor(t,r,i){if((0,yf.validateKeywordUsage)(t,r,i),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=i,this.data=t.data,this.schema=t.schema[i],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ji.schemaRefOrVal)(t,this.schema,i,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",gD(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,yf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${i} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",pe.default.errors))}result(t,r,i){this.failResult((0,X.not)(t),r,i)}failResult(t,r,i){this.gen.if(t),i?i():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,X.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,X._)`${r} !== undefined && (${(0,X.or)(this.invalid$data(),t)})`)}error(t,r,i){if(r){this.setParams(r),this._error(t,i),this.setParams({});return}this._error(t,i)}_error(t,r){(t?gf.reportExtraError:gf.reportError)(this,this.def.error,r)}$dataError(){(0,gf.reportError)(this,this.def.$dataError||gf.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,gf.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,i=X.nil){this.gen.block(()=>{this.check$data(t,i),r()})}check$data(t=X.nil,r=X.nil){if(!this.$data)return;let{gen:i,schemaCode:n,schemaType:o,def:s}=this;i.if((0,X.or)((0,X._)`${n} === undefined`,r)),t!==X.nil&&i.assign(t,!0),(o.length||s.validateSchema)&&(i.elseIf(this.invalid$data()),this.$dataError(),t!==X.nil&&i.assign(t,!1)),i.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:i,def:n,it:o}=this;return(0,X.or)(s(),a());function s(){if(i.length){if(!(r instanceof X.Name))throw new Error("ajv implementation error");let c=Array.isArray(i)?i:[i];return(0,X._)`${(0,Tv.checkDataTypes)(c,r,o.opts.strictNumbers,Tv.DataType.Wrong)}`}return X.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,X._)`!${c}(${r})`}return X.nil}}subschema(t,r){let i=(0,Kx.getSubschema)(this.it,t);(0,Kx.extendSubschemaData)(i,this.it,t),(0,Kx.extendSubschemaMode)(i,t);let n={...this.it,...i,items:void 0,props:void 0};return R8(n,r),n}mergeEvaluated(t,r){let{it:i,gen:n}=this;i.opts.unevaluated&&(i.props!==!0&&t.props!==void 0&&(i.props=ji.mergeEvaluated.props(n,t.props,i.props,r)),i.items!==!0&&t.items!==void 0&&(i.items=ji.mergeEvaluated.items(n,t.items,i.items,r)))}mergeValidEvaluated(t,r){let{it:i,gen:n}=this;if(i.opts.unevaluated&&(i.props!==!0||i.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,X.Name)),!0}};Io.KeywordCxt=Av;function hD(e,t,r,i){let n=new Av(e,r,t);"code"in r?r.code(n,i):n.$data&&r.validate?(0,yf.funcKeywordCode)(n,r):"macro"in r?(0,yf.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,yf.funcKeywordCode)(n,r)}var V8=/^\/(?:[^~]|~0|~1)*$/,B8=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function gD(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return pe.default.rootData;if(e[0]==="/"){if(!V8.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,o=pe.default.rootData}else{let u=B8.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 i[t-l]}if(l>t)throw new Error(c("data",l));if(o=r[t-l],!n)return o}let s=o,a=n.split("/");for(let u of a)u&&(o=(0,X._)`${o}${(0,X.getProperty)((0,ji.unescapeJsonPointer)(u))}`,s=(0,X._)`${s} && ${o}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Io.getData=gD});var Rv=S(Hx=>{"use strict";Object.defineProperty(Hx,"__esModule",{value:!0});var Jx=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Hx.default=Jx});var $f=S(Qx=>{"use strict";Object.defineProperty(Qx,"__esModule",{value:!0});var Yx=hf(),Xx=class extends Error{constructor(t,r,i,n){super(n||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,Yx.resolveUrl)(t,r,i),this.missingSchema=(0,Yx.normalizeId)((0,Yx.getFullPath)(t,this.missingRef))}};Qx.default=Xx});var Ov=S(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.resolveSchema=yn.getCompilingSchema=yn.resolveRef=yn.compileSchema=yn.SchemaEnv=void 0;var Dn=Ae(),K8=Rv(),Vs=zi(),Mn=hf(),yD=De(),G8=vf(),nu=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let i;typeof t.schema=="object"&&(i=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,Mn.normalizeId)(i?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=i?.$async,this.refs={}}};yn.SchemaEnv=nu;function tI(e){let t=vD.call(this,e);if(t)return t;let r=(0,Mn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new Dn.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),a;e.$async&&(a=s.scopeValue("Error",{ref:K8.default,code:(0,Dn._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");e.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:Vs.default.data,parentData:Vs.default.parentData,parentDataProperty:Vs.default.parentDataProperty,dataNames:[Vs.default.data],dataPathArr:[Dn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Dn.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Dn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Dn._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,G8.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(Vs.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${Vs.default.self}`,`${Vs.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof Dn.Name?void 0:m,items:h instanceof Dn.Name?void 0:h,dynamicProps:m instanceof Dn.Name,dynamicItems:h instanceof Dn.Name},p.source&&(p.source.evaluated=(0,Dn.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}yn.compileSchema=tI;function W8(e,t,r){var i;r=(0,Mn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=Y8.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:a}=this.opts;s&&(o=new nu({schema:s,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=J8.call(this,o)}yn.resolveRef=W8;function J8(e){return(0,Mn.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:tI.call(this,e)}function vD(e){for(let t of this._compilations)if(H8(t,e))return t}yn.getCompilingSchema=vD;function H8(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Y8(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Ev.call(this,e,t)}function Ev(e,t){let r=this.opts.uriResolver.parse(t),i=(0,Mn._getFullPath)(this.opts.uriResolver,r),n=(0,Mn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return eI.call(this,r,e);let o=(0,Mn.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=Ev.call(this,e,s);return typeof a?.schema!="object"?void 0:eI.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||tI.call(this,s),o===(0,Mn.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Mn.resolveUrl)(this.opts.uriResolver,n,u)),new nu({schema:a,schemaId:c,root:e,baseId:n})}return eI.call(this,r,s)}}yn.resolveSchema=Ev;var X8=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function eI(e,{baseId:t,schema:r,root:i}){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,yD.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!X8.has(a)&&u&&(t=(0,Mn.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,yD.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Mn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Ev.call(this,i,a)}let{schemaId:s}=this.opts;if(o=o||new nu({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o}});var $D=S((OSe,Q8)=>{Q8.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 aI=S((NSe,ID)=>{"use strict";var eY=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),nI=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),tY=RegExp.prototype.test.bind(/^\d*$/u),Bs=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),iI=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),_D=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),oI=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),rY=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Mr=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Mr[t]="%"+e[t>>4]+e[t&15]}function ar(e){return e<2048?Mr[192|e>>6]+Mr[128|e&63]:e<65536?Mr[224|e>>12]+Mr[128|e>>6&63]+Mr[128|e&63]:Mr[240|e>>18]+Mr[128|e>>12&63]+Mr[128|e>>6&63]+Mr[128|e&63]}function nY(e){let t="",r=0,i=0;for(i=0;i<e.length;i++)if(r=e[i].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(r=e[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i]}return t}var iY=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),oY=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),sY=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),aY=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function cY(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!sY(e[t])){if(e[t]==="%"&&t+2<e.length&&Bs(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function bD(e){let t=-1,r=0,i=-1,n=0;for(let a=0;a<e.length;a++)e[a]==="0"?(i===-1&&(i=a),n++,n>r&&(r=n,t=i)):(i=-1,n=0);if(r<2)return e.join(":");let o=e.slice(0,t).join(":"),s=e.slice(t+r).join(":");return o+"::"+s}function uY(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),i=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),i.length===1&&i[0]===""&&(i.length=0));let n=r.concat(i),o=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||t!==-1&&i.length===0||!nI(c))return;o+=2;continue}if(!iY(c))return;n[a]=parseInt(c,16).toString(16),o++}if(t===-1)return o!==8?void 0:bD(n);if(o>=8)return;let s=n.slice(0,r.length);for(let a=o;a<8;a++)s.push("0");for(let a=r.length;a<n.length;a++)s.push(n[a]);return bD(s)}function rI(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let i=t?e.slice(1,-1):e;if(t&&oY(i))return i=i.toLowerCase(),{host:`[${i}]`,escapedHost:i,isIPV6:!1,isIPVFuture:!0};if(lY(i,":")<2)return{host:e,isIPV6:!1,error:t};let n="",o=i.indexOf("%");if(o!==-1){let a=i.slice(o,o+3).toLowerCase()==="%25"?3:1;if(n=i.slice(o+a),!cY(n))return{host:e,isIPV6:!1,error:!0};i=i.slice(0,o)}let s=uY(i);return s===void 0?{host:e,isIPV6:!1,error:!0}:{host:s+(n?"%"+n:""),escapedHost:s+(n?"%25"+n:""),isIPV6:!0}}function lY(e,t){let r=0;for(let i=0;i<e.length;i++)e[i]===t&&r++;return r}function dY(e){let t=e,r=[],i=-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((i=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,i)),t=t.slice(i)}return r.join("")}var fY={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},pY=/[@/?#:]/g,mY=/[@/?#]/g;function wD(e,t){let r=t?mY:pY;return r.lastIndex=0,e.replace(r,i=>fY[i])}function kD(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let n=e.slice(i+1,i+3);if(Bs(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));t&&iI(s)?r+=s:r+="%"+o,i+=2;continue}}r+=e[i]}return r}function hY(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(i==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Bs(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));s!=="."&&iI(s)?t+=s:t+="%"+o,r+=2;continue}}if(_D(i))t+=i;else{let n=e.charCodeAt(r);if(n<128)t+=xD(n)?i:Mr[n];else if(n<55296||n>57343)t+=ar(n);else if(n<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=ar(65536+(n-55296<<10)+(o-56320)),r++):t+=ar(65533)}else t+=ar(65533)}}return t}function gY(e,t=!1){let r="",i=t&&e[0]!=="/";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Bs(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(o==="/"&&(i=!1),_D(o)&&(o!==":"||!i))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Mr[s];else if(s<55296||s>57343)r+=ar(s);else if(s<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ar(65536+(s-55296<<10)+(a-56320)),n++):r+=ar(65533)}else r+=ar(65533)}}return r}function sI(e,t){let r="";for(let i=0;i<e.length;i++){let n=e[i];if(n==="%"&&i+2<e.length){let o=e.slice(i+1,i+3);if(Bs(o)){r+="%"+o.toUpperCase(),i+=2;continue}}if(t(n))r+=n;else{let o=e.charCodeAt(i);if(o<128)r+=Mr[o];else if(o<55296||o>57343)r+=ar(o);else if(o<=56319&&i+1<e.length){let s=e.charCodeAt(i+1);s>=56320&&s<=57343?(r+=ar(65536+(o-55296<<10)+(s-56320)),i++):r+=ar(65533)}else r+=ar(65533)}}return r}function SD(e){return sI(e,rY)}function yY(e){return sI(e,oI)}function vY(e){return sI(e,oI)}function xD(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function $Y(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(i==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Bs(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));iI(s)?t+=s:t+="%"+o,r+=2;continue}}if(oI(i))t+=i;else{let n=e.charCodeAt(r);if(n<128)t+=xD(n)?i:Mr[n];else if(n<55296||n>57343)t+=ar(n);else if(n<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=ar(65536+(n-55296<<10)+(o-56320)),r++):t+=ar(65533)}else t+=ar(65533)}}return t}function bY(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Bs(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function _Y(e){let t=[];if(e.userinfo!==void 0&&(t.push(SD(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!nI(r)){let i=rI(r);i.isIPV6!==!0&&i.isIPVFuture!==!0&&(r=kD(r,!0),i=rI(r)),i.isIPV6===!0||i.isIPVFuture===!0?r=`[${i.escapedHost}]`:r=wD(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!tY(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}ID.exports={nonSimpleDomain:aY,recomposeAuthority:_Y,reescapeHostDelimiters:wD,normalizePercentEncoding:kD,normalizePathEncoding:hY,serializePathEncoding:gY,normalizeQueryFragmentEncoding:$Y,encodeUserinfo:SD,encodeQuery:yY,encodeFragment:vY,escapePreservingEscapes:bY,removeDotSegments:dY,isIPv4:nI,isUUID:eY,normalizeIPv6:rI,stringArrayToHexStripped:nY}});var ED=S((CSe,RD)=>{"use strict";var{isUUID:wY}=aI(),kY=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,SY=["http","https","ws","wss","urn","urn:uuid"];function xY(e){return SY.indexOf(e)!==-1}function cI(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 PD(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function TD(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 IY(e){return e.secure=cI(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function PY(e){if((e.port===(cI(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=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function TY(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(kY);if(r&&r[0]===e.path){let i=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${i}:${t.nid||e.nid}`,o=uI(n);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function AY(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),n=`${r}:${t.nid||i}`,o=uI(n);o&&(e=o.serialize(e,t));let s=e,a=e.nss;return s.path=`${i||t.nid}:${a}`,t.skipEscape=!0,s}function RY(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!wY(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function EY(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var AD={scheme:"http",domainHost:!0,parse:PD,serialize:TD},OY={scheme:"https",domainHost:AD.domainHost,parse:PD,serialize:TD},Nv={scheme:"ws",domainHost:!0,parse:IY,serialize:PY},NY={scheme:"wss",domainHost:Nv.domainHost,parse:Nv.parse,serialize:Nv.serialize},CY={scheme:"urn",parse:TY,serialize:AY,skipNormalize:!0},zY={scheme:"urn:uuid",parse:RY,serialize:EY,skipNormalize:!0},Cv={http:AD,https:OY,ws:Nv,wss:NY,urn:CY,"urn:uuid":zY};Object.setPrototypeOf(Cv,null);function uI(e){return e&&(Cv[e]||Cv[e.toLowerCase()])||void 0}RD.exports={wsIsSecure:cI,SCHEMES:Cv,isValidSchemeName:xY,getSchemeHandler:uI}});var mI=S((zSe,Dv)=>{"use strict";var{normalizeIPv6:jD,removeDotSegments:_f,recomposeAuthority:jY,normalizePercentEncoding:lI,normalizePathEncoding:DY,serializePathEncoding:OD,normalizeQueryFragmentEncoding:ND,encodeQuery:MY,encodeFragment:LY,reescapeHostDelimiters:UY,isIPv4:DD,nonSimpleDomain:qY}=aI(),{SCHEMES:MD,getSchemeHandler:dI}=ED(),LD=/^[A-Za-z][A-Za-z0-9+.-]*$/u,UD="URI scheme is malformed.";function CD(e){let t=unescape(String(e));if(!LD.test(t))throw new TypeError(UD);return t}function FY(e,t){return typeof e=="string"?e=HY(e,t):typeof e=="object"&&(e=jv(Ks(e,t),t)),e}function ZY(e,t,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=zv(e,i),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:h}=zv(t,i);if(o||d||s||f||a||p||c||m||u||h)throw new Error(n.error||l.error||"URI is malformed.");let g=qD(n,l,i,!0),y=dI(r&&r.scheme||g.scheme),v=g.host,$=v!==void 0&&v!==""&&(DD(v)||jD(v).isIPV6);FD(g,r||{},y,$);let _=v&&v.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(v);if(g.error&&!_)throw new Error(g.error);return i.skipEscape=!0,Ks(g,i)}function qD(e,t,r,i){let n={};return i||(e=jv(Ks(e,r),r),t=jv(Ks(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=_f(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=_f(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=_f(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=_f(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 VY(e,t,r){let i=zD(e,r),n=zD(t,r);return i!==void 0&&n!==void 0&&i===n}function Ks(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:""},i=Object.assign({},t),n=[];r.scheme&&(r.scheme=CD(r.scheme));let o=dI(i.scheme||r.scheme);o&&o.serialize&&o.serialize(r,i);let s=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!i.skipEscape&&r.scheme===void 0&&!s;r.path!==void 0&&(i.skipEscape?r.path=lI(r.path):r.path=OD(r.path,a)),i.reference!=="suffix"&&r.scheme&&(r.scheme=CD(r.scheme),n.push(r.scheme,":"));let c=jY(r);if(c!==void 0&&(i.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let u=r.path;!i.absolutePath&&(!o||!o.absolutePath)&&(u=_f(u)),a&&(u=OD(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),n.push(u)}return r.query!==void 0&&n.push("?",MY(r.query)),r.fragment!==void 0&&n.push("#",LY(r.fragment)),n.join("")}var BY=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,KY=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,GY=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function WY(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function bf(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function fI(e){return e[0]==="["&&e[e.length-1]==="]"}function JY(e){let t=e[4];return bf(e[3])||t!==void 0&&!fI(t)&&bf(t)||bf(e[6])||bf(e[7])||bf(e[8])}function FD(e,t,r,i){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!fI(e.host)&&(t.domainHost||r&&r.domainHost)&&i===!1&&qY(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(n){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function zv(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1,s=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(KY);d!==null&&d[1].indexOf("\\")!==-1&&(i.error="URI authority must not contain a literal backslash.",n=!0);let f=e.match(GY);if(f!==null){let m=f[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(i.error=i.error||"URI authority must not contain a literal backslash.",n=!0):m.length!==h.length&&(i.error=i.error||"URI authority introducer must not contain whitespace.",n=!0))}let p=e.match(BY);if(p){if(i.scheme=p[1],i.userinfo=p[3],i.host=p[4],i.port=parseInt(p[5],10),i.path=p[6]||"",i.query=p[7],i.fragment=p[8],i.scheme!==void 0){let g=unescape(i.scheme);LD.test(g)?i.scheme=g.toLowerCase():(i.error=i.error||UD,u=!0)}o=JY(p),o&&(i.error=i.error||"URI contains malformed percent-encoding."),isNaN(i.port)&&(i.port=p[5]);let m=WY(i,p);if(m!==void 0&&(i.error=i.error||m,n=!0),i.host)if(DD(i.host)===!1){let y=fI(i.host),v=i.host.indexOf("[")!==-1||i.host.indexOf("]")!==-1,$=jD(i.host);l=$.isIPV6||$.isIPVFuture===!0,c=v&&(!y||$.error===!0),i.host=l?$.host:$.host.toLowerCase(),c&&(i.error=i.error||"URI host is malformed.",n=!0)}else l=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference="same-document":i.scheme===void 0?i.reference="relative":i.fragment===void 0?i.reference="absolute":i.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");let h=dI(r.scheme||i.scheme);if(c||(a=FD(i,r,h,l)),e.indexOf("%")!==-1&&i.host!==void 0&&!c){let g=l?i.host:lI(i.host,!0);l||(g=lI(g.toLowerCase())),i.host=UY(g,l)}(!h||h&&!h.skipNormalize)&&(i.path&&(i.path=DY(i.path)),i.query&&(i.query=ND(i.query)),i.fragment&&(i.fragment=ND(i.fragment))),h&&h.parse&&(h.parse(i,r),h===MD.urn&&i.nid===void 0&&(s=!0))}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:u}}function jv(e,t){return zv(e,t).parsed}function HY(e,t){return ZD(e,t).normalized}function ZD(e,t){let{parsed:r,malformedAuthorityOrPort:i,malformedPercentEncoding:n,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:a}=zv(e,t);return{normalized:i||n||o||s||a?e:Ks(r,t),malformedAuthorityOrPort:i,malformedPercentEncoding:n,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:a}}function zD(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Ks(e,t)}catch{return}let{normalized:i,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:a,malformedScheme:c}=ZD(r,t);return n||o||s||a||c?void 0:i}var pI={SCHEMES:MD,normalize:FY,resolve:ZY,resolveComponent:qD,equal:VY,serialize:Ks,parse:jv};Dv.exports=pI;Dv.exports.default=pI;Dv.exports.fastUri=pI});var BD=S(hI=>{"use strict";Object.defineProperty(hI,"__esModule",{value:!0});var VD=mI();VD.code='require("ajv/dist/runtime/uri").default';hI.default=VD});var QD=S(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.CodeGen=Ht.Name=Ht.nil=Ht.stringify=Ht.str=Ht._=Ht.KeywordCxt=void 0;var YY=vf();Object.defineProperty(Ht,"KeywordCxt",{enumerable:!0,get:function(){return YY.KeywordCxt}});var iu=Ae();Object.defineProperty(Ht,"_",{enumerable:!0,get:function(){return iu._}});Object.defineProperty(Ht,"str",{enumerable:!0,get:function(){return iu.str}});Object.defineProperty(Ht,"stringify",{enumerable:!0,get:function(){return iu.stringify}});Object.defineProperty(Ht,"nil",{enumerable:!0,get:function(){return iu.nil}});Object.defineProperty(Ht,"Name",{enumerable:!0,get:function(){return iu.Name}});Object.defineProperty(Ht,"CodeGen",{enumerable:!0,get:function(){return iu.CodeGen}});var XY=Rv(),HD=$f(),QY=Dx(),wf=Ov(),eX=Ae(),kf=hf(),Mv=pf(),yI=De(),KD=$D(),tX=BD(),YD=(e,t)=>new RegExp(e,t);YD.code="new RegExp";var rX=["removeAdditional","useDefaults","coerceTypes"],nX=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),iX={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."},oX={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},GD=200;function sX(e){var t,r,i,n,o,s,a,c,u,l,d,f,p,m,h,g,y,v,$,_,w,k,T,C,D;let K=e.strict,V=(t=e.code)===null||t===void 0?void 0:t.optimize,te=V===!0||V===void 0?1:V||0,Oe=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:YD,_t=(n=e.uriResolver)!==null&&n!==void 0?n:tX.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:K)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:K)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:K)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:K)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:K)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:te,regExp:Oe}:{optimize:te,regExp:Oe},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:GD,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:GD,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(v=e.messages)!==null&&v!==void 0?v:!0,inlineRefs:($=e.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(_=e.schemaId)!==null&&_!==void 0?_:"$id",addUsedSchema:(w=e.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(k=e.validateSchema)!==null&&k!==void 0?k:!0,validateFormats:(T=e.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(C=e.unicodeRegExp)!==null&&C!==void 0?C:!0,int32range:(D=e.int32range)!==null&&D!==void 0?D:!0,uriResolver:_t}}var Sf=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,...sX(t)};let{es5:r,lines:i}=this.opts.code;this.scope=new eX.ValueScope({scope:{},prefixes:nX,es5:r,lines:i}),this.logger=fX(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,QY.getRules)(),WD.call(this,iX,t,"NOT SUPPORTED"),WD.call(this,oX,t,"DEPRECATED","warn"),this._metaOpts=lX.call(this),t.formats&&cX.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&uX.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),aX.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:i}=this.opts,n=KD;i==="id"&&(n={...KD},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[i],!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 i;if(typeof t=="string"){if(i=this.getSchema(t),!i)throw new Error(`no schema with key or ref "${t}"`)}else i=this.compile(t);let n=i(r);return"$async"in i||(this.errors=i.errors),n}compile(t,r){let i=this._addSchema(t,r);return i.validate||this._compileSchemaEnv(i)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:i}=this.opts;return n.call(this,t,r);async function n(l,d){await o.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function o(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof HD.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=i(l))}finally{delete this._loading[l]}}}addSchema(t,r,i,n=this.opts.validateSchema){if(Array.isArray(t)){for(let s of t)this.addSchema(s,void 0,i,n);return this}let o;if(typeof t=="object"){let{schemaId:s}=this.opts;if(o=t[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,kf.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,i,r,n,!0),this}addMetaSchema(t,r,i=this.opts.validateSchema){return this.addSchema(t,r,!0,i),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let i;if(i=t.$schema,i!==void 0&&typeof i!="string")throw new Error("$schema must be a string");if(i=i||this.opts.defaultMeta||this.defaultMeta(),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(i,t);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(t){let r;for(;typeof(r=JD.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:i}=this.opts,n=new wf.SchemaEnv({schema:{},schemaId:i});if(r=wf.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=JD.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 i=t[this.opts.schemaId];return i&&(i=(0,kf.normalizeId)(i),delete this.schemas[i],delete this.refs[i]),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 i;if(typeof t=="string")i=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=i);else if(typeof t=="object"&&r===void 0){if(r=t,i=r.keyword,Array.isArray(i)&&!i.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(mX.call(this,i,r),!r)return(0,yI.eachItem)(i,o=>gI.call(this,o)),this;gX.call(this,r);let n={...r,type:(0,Mv.getJSONTypes)(r.type),schemaType:(0,Mv.getJSONTypes)(r.schemaType)};return(0,yI.eachItem)(i,n.type.length===0?o=>gI.call(this,o,n):o=>n.type.forEach(s=>gI.call(this,o,n,s))),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 i of r.rules){let n=i.rules.findIndex(o=>o.keyword===t);n>=0&&i.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:i="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${i}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(t,r){let i=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let o=n.split("/").slice(1),s=t;for(let a of o)s=s[a];for(let a in i){let c=i[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=XD(l))}}return t}_removeAllSchemas(t,r){for(let i in t){let n=t[i];(!r||r.test(i))&&(typeof n=="string"?delete t[i]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[i]))}}_addSchema(t,r,i,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof t=="object")s=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;i=(0,kf.normalizeId)(s||i);let u=kf.getSchemaRefs.call(this,t,i);return c=new wf.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:i,localRefs:u}),this._cache.set(c.schema,c),o&&!i.startsWith("#")&&(i&&this._checkUnique(i),this.refs[i]=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):wf.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{wf.compileSchema.call(this,t)}finally{this.opts=r}}};Sf.ValidationError=XY.default;Sf.MissingRefError=HD.default;Ht.default=Sf;function WD(e,t,r,i="error"){for(let n in e){let o=n;o in t&&this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function JD(e){return e=(0,kf.normalizeId)(e),this.schemas[e]||this.refs[e]}function aX(){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 cX(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function uX(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 lX(){let e={...this.opts};for(let t of rX)delete e[t];return e}var dX={log(){},warn(){},error(){}};function fX(e){if(e===!1)return dX;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 pX=/^[a-z_$][a-z0-9_$:-]*$/i;function mX(e,t){let{RULES:r}=this;if((0,yI.eachItem)(e,i=>{if(r.keywords[i])throw new Error(`Keyword ${i} is already defined`);if(!pX.test(i))throw new Error(`Keyword ${i} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function gI(e,t,r){var i;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Mv.getJSONTypes)(t.type),schemaType:(0,Mv.getJSONTypes)(t.schemaType)}};t.before?hX.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,(i=t.implements)===null||i===void 0||i.forEach(c=>this.addKeyword(c))}function hX(e,t,r){let i=e.rules.findIndex(n=>n.keyword===r);i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function gX(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=XD(t)),e.validateSchema=this.compile(t,!0))}var yX={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function XD(e){return{anyOf:[e,yX]}}});var eM=S(vI=>{"use strict";Object.defineProperty(vI,"__esModule",{value:!0});var vX={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};vI.default=vX});var iM=S(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.callRef=Gs.getValidate=void 0;var $X=$f(),tM=gn(),Lr=Ae(),ou=zi(),rM=Ov(),Lv=De(),bX={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:a,self:c}=i,{root:u}=o;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=rM.resolveRef.call(c,u,n,r);if(l===void 0)throw new $X.default(i.opts.uriResolver,n,r);if(l instanceof rM.SchemaEnv)return f(l);return p(l);function d(){if(o===u)return Uv(e,s,o,o.$async);let m=t.scopeValue("root",{ref:u});return Uv(e,(0,Lr._)`${m}.validate`,u,u.$async)}function f(m){let h=nM(e,m);Uv(e,h,m,m.$async)}function p(m){let h=t.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Lr.stringify)(m)}:{ref:m}),g=t.name("valid"),y=e.subschema({schema:m,dataTypes:[],schemaPath:Lr.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function nM(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Lr._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Gs.getValidate=nM;function Uv(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:a,opts:c}=o,u=c.passContext?ou.default.this:Lr.nil;i?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,Lr._)`await ${(0,tM.callValidateCode)(e,t,u)}`),p(t),s||n.assign(m,!0)},h=>{n.if((0,Lr._)`!(${h} instanceof ${o.ValidationError})`,()=>n.throw(h)),f(h),s||n.assign(m,!1)}),e.ok(m)}function d(){e.result((0,tM.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(m){let h=(0,Lr._)`${m}.errors`;n.assign(ou.default.vErrors,(0,Lr._)`${ou.default.vErrors} === null ? ${h} : ${ou.default.vErrors}.concat(${h})`),n.assign(ou.default.errors,(0,Lr._)`${ou.default.vErrors}.length`)}function p(m){var h;if(!o.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(o.props=Lv.mergeEvaluated.props(n,g.props,o.props));else{let y=n.var("props",(0,Lr._)`${m}.evaluated.props`);o.props=Lv.mergeEvaluated.props(n,y,o.props,Lr.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=Lv.mergeEvaluated.items(n,g.items,o.items));else{let y=n.var("items",(0,Lr._)`${m}.evaluated.items`);o.items=Lv.mergeEvaluated.items(n,y,o.items,Lr.Name)}}}Gs.callRef=Uv;Gs.default=bX});var oM=S($I=>{"use strict";Object.defineProperty($I,"__esModule",{value:!0});var _X=eM(),wX=iM(),kX=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_X.default,wX.default];$I.default=kX});var sM=S(bI=>{"use strict";Object.defineProperty(bI,"__esModule",{value:!0});var qv=Ae(),Po=qv.operators,Fv={maximum:{okStr:"<=",ok:Po.LTE,fail:Po.GT},minimum:{okStr:">=",ok:Po.GTE,fail:Po.LT},exclusiveMaximum:{okStr:"<",ok:Po.LT,fail:Po.GTE},exclusiveMinimum:{okStr:">",ok:Po.GT,fail:Po.LTE}},SX={message:({keyword:e,schemaCode:t})=>(0,qv.str)`must be ${Fv[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,qv._)`{comparison: ${Fv[e].okStr}, limit: ${t}}`},xX={keyword:Object.keys(Fv),type:"number",schemaType:"number",$data:!0,error:SX,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data((0,qv._)`${r} ${Fv[t].fail} ${i} || isNaN(${r})`)}};bI.default=xX});var aM=S(_I=>{"use strict";Object.defineProperty(_I,"__esModule",{value:!0});var xf=Ae(),IX={message:({schemaCode:e})=>(0,xf.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,xf._)`{multipleOf: ${e}}`},PX={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:IX,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),a=o?(0,xf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,xf._)`${s} !== parseInt(${s})`;e.fail$data((0,xf._)`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};_I.default=PX});var uM=S(wI=>{"use strict";Object.defineProperty(wI,"__esModule",{value:!0});function cM(e){let t=e.length,r=0,i=0,n;for(;i<t;)r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t&&(n=e.charCodeAt(i),(n&64512)===56320&&i++);return r}wI.default=cM;cM.code='require("ajv/dist/runtime/ucs2length").default'});var lM=S(kI=>{"use strict";Object.defineProperty(kI,"__esModule",{value:!0});var Ws=Ae(),TX=De(),AX=uM(),RX={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Ws.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Ws._)`{limit: ${e}}`},EX={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:RX,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?Ws.operators.GT:Ws.operators.LT,s=n.opts.unicode===!1?(0,Ws._)`${r}.length`:(0,Ws._)`${(0,TX.useFunc)(e.gen,AX.default)}(${r})`;e.fail$data((0,Ws._)`${s} ${o} ${i}`)}};kI.default=EX});var dM=S(SI=>{"use strict";Object.defineProperty(SI,"__esModule",{value:!0});var OX=gn(),NX=De(),su=Ae(),CX={message:({schemaCode:e})=>(0,su.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,su._)`{pattern: ${e}}`},zX={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:CX,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?(0,su._)`new RegExp`:(0,NX.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,su._)`${u}(${o}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,su._)`!${l}`)}else{let c=(0,OX.usePattern)(e,n);e.fail$data((0,su._)`!${c}.test(${r})`)}}};SI.default=zX});var fM=S(xI=>{"use strict";Object.defineProperty(xI,"__esModule",{value:!0});var If=Ae(),jX={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,If.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,If._)`{limit: ${e}}`},DX={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:jX,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?If.operators.GT:If.operators.LT;e.fail$data((0,If._)`Object.keys(${r}).length ${n} ${i}`)}};xI.default=DX});var pM=S(II=>{"use strict";Object.defineProperty(II,"__esModule",{value:!0});var Pf=gn(),Tf=Ae(),MX=De(),LX={message:({params:{missingProperty:e}})=>(0,Tf.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Tf._)`{missingProperty: ${e}}`},UX={keyword:"required",type:"object",schemaType:"array",$data:!0,error:LX,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:a}=s;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let g=s.schemaEnv.baseId+s.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,MX.checkStrictMode)(s,y,s.opts.strictRequired)}}function u(){if(c||o)e.block$data(Tf.nil,d);else for(let p of r)(0,Pf.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||o){let m=t.let("valid",!0);e.block$data(m,()=>f(p,m)),e.ok(m)}else t.if((0,Pf.checkMissingProp)(e,r,p)),(0,Pf.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",i,p=>{e.setParams({missingProperty:p}),t.if((0,Pf.noPropertyInData)(t,n,p,a.ownProperties),()=>e.error())})}function f(p,m){e.setParams({missingProperty:p}),t.forOf(p,i,()=>{t.assign(m,(0,Pf.propertyInData)(t,n,p,a.ownProperties)),t.if((0,Tf.not)(m),()=>{e.error(),t.break()})},Tf.nil)}}};II.default=UX});var mM=S(PI=>{"use strict";Object.defineProperty(PI,"__esModule",{value:!0});var Af=Ae(),qX={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Af.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Af._)`{limit: ${e}}`},FX={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:qX,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?Af.operators.GT:Af.operators.LT;e.fail$data((0,Af._)`${r}.length ${n} ${i}`)}};PI.default=FX});var Zv=S(TI=>{"use strict";Object.defineProperty(TI,"__esModule",{value:!0});var hM=mf();hM.code='require("ajv/dist/runtime/equal").default';TI.default=hM});var gM=S(RI=>{"use strict";Object.defineProperty(RI,"__esModule",{value:!0});var AI=pf(),Yt=Ae(),ZX=De(),VX=Zv(),BX={message:({params:{i:e,j:t}})=>(0,Yt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Yt._)`{i: ${e}, j: ${t}}`},KX={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:BX,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=e;if(!i&&!n)return;let c=t.let("valid"),u=o.items?(0,AI.getSchemaTypes)(o.items):[];e.block$data(c,l,(0,Yt._)`${s} === false`),e.ok(c);function l(){let m=t.let("i",(0,Yt._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Yt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let g=t.name("item"),y=(0,AI.checkDataTypes)(u,g,a.opts.strictNumbers,AI.DataType.Wrong),v=t.const("indices",(0,Yt._)`{}`);t.for((0,Yt._)`;${m}--;`,()=>{t.let(g,(0,Yt._)`${r}[${m}]`),t.if(y,(0,Yt._)`continue`),u.length>1&&t.if((0,Yt._)`typeof ${g} == "string"`,(0,Yt._)`${g} += "_"`),t.if((0,Yt._)`typeof ${v}[${g}] == "number"`,()=>{t.assign(h,(0,Yt._)`${v}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,Yt._)`${v}[${g}] = ${m}`)})}function p(m,h){let g=(0,ZX.useFunc)(t,VX.default),y=t.name("outer");t.label(y).for((0,Yt._)`;${m}--;`,()=>t.for((0,Yt._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Yt._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};RI.default=KX});var yM=S(OI=>{"use strict";Object.defineProperty(OI,"__esModule",{value:!0});var EI=Ae(),GX=De(),WX=Zv(),JX={message:"must be equal to constant",params:({schemaCode:e})=>(0,EI._)`{allowedValue: ${e}}`},HX={keyword:"const",$data:!0,error:JX,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;i||o&&typeof o=="object"?e.fail$data((0,EI._)`!${(0,GX.useFunc)(t,WX.default)}(${r}, ${n})`):e.fail((0,EI._)`${o} !== ${r}`)}};OI.default=HX});var vM=S(NI=>{"use strict";Object.defineProperty(NI,"__esModule",{value:!0});var Rf=Ae(),YX=De(),XX=Zv(),QX={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Rf._)`{allowedValues: ${e}}`},e7={keyword:"enum",schemaType:"array",$data:!0,error:QX,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,YX.useFunc)(t,XX.default)),l;if(a||i)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let p=t.const("vSchema",o);l=(0,Rf.or)(...n.map((m,h)=>f(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",o,p=>t.if((0,Rf._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,m){let h=n[m];return typeof h=="object"&&h!==null?(0,Rf._)`${u()}(${r}, ${p}[${m}])`:(0,Rf._)`${r} === ${h}`}}};NI.default=e7});var $M=S(CI=>{"use strict";Object.defineProperty(CI,"__esModule",{value:!0});var t7=sM(),r7=aM(),n7=lM(),i7=dM(),o7=fM(),s7=pM(),a7=mM(),c7=gM(),u7=yM(),l7=vM(),d7=[t7.default,r7.default,n7.default,i7.default,o7.default,s7.default,a7.default,c7.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u7.default,l7.default];CI.default=d7});var jI=S(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.validateAdditionalItems=void 0;var Js=Ae(),zI=De(),f7={message:({params:{len:e}})=>(0,Js.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Js._)`{limit: ${e}}`},p7={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:f7,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,zI.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}bM(e,i)}};function bM(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let a=r.const("len",(0,Js._)`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass((0,Js._)`${a} <= ${t.length}`);else if(typeof i=="object"&&!(0,zI.alwaysValidSchema)(s,i)){let u=r.var("valid",(0,Js._)`${a} <= ${t.length}`);r.if((0,Js.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:zI.Type.Num},u),s.allErrors||r.if((0,Js.not)(u),()=>r.break())})}}Ef.validateAdditionalItems=bM;Ef.default=p7});var DI=S(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});Of.validateTuple=void 0;var _M=Ae(),Vv=De(),m7=gn(),h7={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return wM(e,"additionalItems",t);r.items=!0,!(0,Vv.alwaysValidSchema)(r,t)&&e.ok((0,m7.validateArray)(e))}};function wM(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:a}=e;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Vv.mergeEvaluated.items(i,r.length,a.items));let c=i.name("valid"),u=i.const("len",(0,_M._)`${o}.length`);r.forEach((d,f)=>{(0,Vv.alwaysValidSchema)(a,d)||(i.if((0,_M._)`${u} > ${f}`,()=>e.subschema({keyword:s,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(f.strictTuples&&!h){let g=`"${s}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,Vv.checkStrictMode)(a,g,f.strictTuples)}}}Of.validateTuple=wM;Of.default=h7});var kM=S(MI=>{"use strict";Object.defineProperty(MI,"__esModule",{value:!0});var g7=DI(),y7={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,g7.validateTuple)(e,"items")};MI.default=y7});var xM=S(LI=>{"use strict";Object.defineProperty(LI,"__esModule",{value:!0});var SM=Ae(),v7=De(),$7=gn(),b7=jI(),_7={message:({params:{len:e}})=>(0,SM.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,SM._)`{limit: ${e}}`},w7={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_7,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;i.items=!0,!(0,v7.alwaysValidSchema)(i,t)&&(n?(0,b7.validateAdditionalItems)(e,n):e.ok((0,$7.validateArray)(e)))}};LI.default=w7});var IM=S(UI=>{"use strict";Object.defineProperty(UI,"__esModule",{value:!0});var vn=Ae(),Bv=De(),k7={message:({params:{min:e,max:t}})=>t===void 0?(0,vn.str)`must contain at least ${e} valid item(s)`:(0,vn.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,vn._)`{minContains: ${e}}`:(0,vn._)`{minContains: ${e}, maxContains: ${t}}`},S7={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:k7,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,a,{minContains:c,maxContains:u}=i;o.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=t.const("len",(0,vn._)`${n}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,Bv.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Bv.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Bv.alwaysValidSchema)(o,r)){let h=(0,vn._)`${l} >= ${s}`;a!==void 0&&(h=(0,vn._)`${h} && ${l} <= ${a}`),e.pass(h);return}o.items=!0;let d=t.name("valid");a===void 0&&s===1?p(d,()=>t.if(d,()=>t.break())):s===0?(t.let(d,!0),a!==void 0&&t.if((0,vn._)`${n}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let h=t.name("_valid"),g=t.let("count",0);p(h,()=>t.if(h,()=>m(g)))}function p(h,g){t.forRange("i",0,l,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:Bv.Type.Num,compositeRule:!0},h),g()})}function m(h){t.code((0,vn._)`${h}++`),a===void 0?t.if((0,vn._)`${h} >= ${s}`,()=>t.assign(d,!0).break()):(t.if((0,vn._)`${h} > ${a}`,()=>t.assign(d,!1).break()),s===1?t.assign(d,!0):t.if((0,vn._)`${h} >= ${s}`,()=>t.assign(d,!0)))}}};UI.default=S7});var AM=S(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.validateSchemaDeps=ci.validatePropertyDeps=ci.error=void 0;var qI=Ae(),x7=De(),Nf=gn();ci.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return(0,qI.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>(0,qI._)`{property: ${e},
|
|
7
|
+
missingProperty: ${i},
|
|
8
|
+
depsCount: ${t},
|
|
9
|
+
deps: ${r}}`};var I7={keyword:"dependencies",type:"object",schemaType:"object",error:ci.error,code(e){let[t,r]=P7(e);PM(e,t),TM(e,r)}};function P7({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function PM(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,Nf.propertyInData)(r,i,s,n.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,Nf.checkReportMissingProp)(e,u)}):(r.if((0,qI._)`${c} && (${(0,Nf.checkMissingProp)(e,a,o)})`),(0,Nf.reportMissingProp)(e,o),r.else())}}ci.validatePropertyDeps=PM;function TM(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let a in t)(0,x7.alwaysValidSchema)(o,t[a])||(r.if((0,Nf.propertyInData)(r,i,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s))}ci.validateSchemaDeps=TM;ci.default=I7});var EM=S(FI=>{"use strict";Object.defineProperty(FI,"__esModule",{value:!0});var RM=Ae(),T7=De(),A7={message:"property name must be valid",params:({params:e})=>(0,RM._)`{propertyName: ${e.propertyName}}`},R7={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:A7,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,T7.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,RM.not)(o),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(o)}};FI.default=R7});var VI=S(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});var Kv=gn(),Ln=Ae(),E7=zi(),Gv=De(),O7={message:"must NOT have additional properties",params:({params:e})=>(0,Ln._)`{additionalProperty: ${e.additionalProperty}}`},N7={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:O7,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,Gv.alwaysValidSchema)(s,r))return;let u=(0,Kv.allSchemaProperties)(i.properties),l=(0,Kv.allSchemaProperties)(i.patternProperties);d(),e.ok((0,Ln._)`${o} === ${E7.default.errors}`);function d(){t.forIn("key",n,g=>{!u.length&&!l.length?m(g):t.if(f(g),()=>m(g))})}function f(g){let y;if(u.length>8){let v=(0,Gv.schemaRefOrVal)(s,i.properties,"properties");y=(0,Kv.isOwnProperty)(t,v,g)}else u.length?y=(0,Ln.or)(...u.map(v=>(0,Ln._)`${g} === ${v}`)):y=Ln.nil;return l.length&&(y=(0,Ln.or)(y,...l.map(v=>(0,Ln._)`${(0,Kv.usePattern)(e,v)}.test(${g})`))),(0,Ln.not)(y)}function p(g){t.code((0,Ln._)`delete ${n}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Gv.alwaysValidSchema)(s,r)){let y=t.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),t.if((0,Ln.not)(y),()=>{e.reset(),p(g)})):(h(g,y),a||t.if((0,Ln.not)(y),()=>t.break()))}}function h(g,y,v){let $={keyword:"additionalProperties",dataProp:g,dataPropType:Gv.Type.Str};v===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema($,y)}}};ZI.default=N7});var CM=S(KI=>{"use strict";Object.defineProperty(KI,"__esModule",{value:!0});var C7=vf(),OM=gn(),BI=De(),NM=VI(),z7={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&NM.default.code(new C7.KeywordCxt(o,NM.default,"additionalProperties"));let s=(0,OM.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=BI.mergeEvaluated.props(t,(0,BI.toHash)(s),o.props));let a=s.filter(d=>!(0,BI.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,OM.propertyInData)(t,n,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};KI.default=z7});var MM=S(GI=>{"use strict";Object.defineProperty(GI,"__esModule",{value:!0});var zM=gn(),Wv=Ae(),jM=De(),DM=De(),j7={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,a=(0,zM.allSchemaProperties)(r),c=a.filter(h=>(0,jM.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof Wv.Name)&&(o.props=(0,DM.evaluatedPropsToName)(t,o.props));let{props:d}=o;f();function f(){for(let h of a)u&&p(h),o.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function p(h){for(let g in u)new RegExp(h).test(g)&&(0,jM.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",i,g=>{t.if((0,Wv._)`${(0,zM.usePattern)(e,h)}.test(${g})`,()=>{let y=c.includes(h);y||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:DM.Type.Str},l),o.opts.unevaluated&&d!==!0?t.assign((0,Wv._)`${d}[${g}]`,!0):!y&&!o.allErrors&&t.if((0,Wv.not)(l),()=>t.break())})})}}};GI.default=j7});var LM=S(WI=>{"use strict";Object.defineProperty(WI,"__esModule",{value:!0});var D7=De(),M7={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,D7.alwaysValidSchema)(i,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"}};WI.default=M7});var UM=S(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});var L7=gn(),U7={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:L7.validateUnion,error:{message:"must match a schema in anyOf"}};JI.default=U7});var qM=S(HI=>{"use strict";Object.defineProperty(HI,"__esModule",{value:!0});var Jv=Ae(),q7=De(),F7={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Jv._)`{passingSchemas: ${e.passing}}`},Z7={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:F7,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((l,d)=>{let f;(0,q7.alwaysValidSchema)(n,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Jv._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Jv._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,d),f&&e.mergeEvaluated(f,Jv.Name)})})}}};HI.default=Z7});var FM=S(YI=>{"use strict";Object.defineProperty(YI,"__esModule",{value:!0});var V7=De(),B7={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,V7.alwaysValidSchema)(i,o))return;let a=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(a)})}};YI.default=B7});var BM=S(XI=>{"use strict";Object.defineProperty(XI,"__esModule",{value:!0});var Hv=Ae(),VM=De(),K7={message:({params:e})=>(0,Hv.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Hv._)`{failingKeyword: ${e.ifClause}}`},G7={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:K7,code(e){let{gen:t,parentSchema:r,it:i}=e;r.then===void 0&&r.else===void 0&&(0,VM.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=ZM(i,"then"),o=ZM(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&o){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,Hv.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},a);t.assign(s,a),e.mergeValidEvaluated(f,s),d?t.assign(d,(0,Hv._)`${l}`):e.setParams({ifClause:l})}}}};function ZM(e,t){let r=e.schema[t];return r!==void 0&&!(0,VM.alwaysValidSchema)(e,r)}XI.default=G7});var KM=S(QI=>{"use strict";Object.defineProperty(QI,"__esModule",{value:!0});var W7=De(),J7={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,W7.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};QI.default=J7});var GM=S(eP=>{"use strict";Object.defineProperty(eP,"__esModule",{value:!0});var H7=jI(),Y7=kM(),X7=DI(),Q7=xM(),eQ=IM(),tQ=AM(),rQ=EM(),nQ=VI(),iQ=CM(),oQ=MM(),sQ=LM(),aQ=UM(),cQ=qM(),uQ=FM(),lQ=BM(),dQ=KM();function fQ(e=!1){let t=[sQ.default,aQ.default,cQ.default,uQ.default,lQ.default,dQ.default,rQ.default,nQ.default,tQ.default,iQ.default,oQ.default];return e?t.push(Y7.default,Q7.default):t.push(H7.default,X7.default),t.push(eQ.default),t}eP.default=fQ});var WM=S(tP=>{"use strict";Object.defineProperty(tP,"__esModule",{value:!0});var At=Ae(),pQ={message:({schemaCode:e})=>(0,At.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,At._)`{format: ${e}}`},mQ={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:pQ,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,At._)`${m}[${s}]`),g=r.let("fType"),y=r.let("format");r.if((0,At._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,At._)`${h}.type || "string"`).assign(y,(0,At._)`${h}.validate`),()=>r.assign(g,(0,At._)`"string"`).assign(y,h)),e.fail$data((0,At.or)(v(),$()));function v(){return c.strictSchema===!1?At.nil:(0,At._)`${s} && !${y}`}function $(){let _=l.$async?(0,At._)`(${h}.async ? await ${y}(${i}) : ${y}(${i}))`:(0,At._)`${y}(${i})`,w=(0,At._)`(typeof ${y} == "function" ? ${_} : ${y}.test(${i}))`;return(0,At._)`${y} && ${y} !== true && ${g} === ${t} && !${w}`}}function p(){let m=d.formats[o];if(!m){v();return}if(m===!0)return;let[h,g,y]=$(m);h===t&&e.pass(_());function v(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function $(w){let k=w instanceof RegExp?(0,At.regexpCode)(w):c.code.formats?(0,At._)`${c.code.formats}${(0,At.getProperty)(o)}`:void 0,T=r.scopeValue("formats",{key:o,ref:w,code:k});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,At._)`${T}.validate`]:["string",w,T]}function _(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,At._)`await ${y}(${i})`}return typeof g=="function"?(0,At._)`${y}(${i})`:(0,At._)`${y}.test(${i})`}}}};tP.default=mQ});var JM=S(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0});var hQ=WM(),gQ=[hQ.default];rP.default=gQ});var HM=S(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.contentVocabulary=au.metadataVocabulary=void 0;au.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];au.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var XM=S(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0});var yQ=oM(),vQ=$M(),$Q=GM(),bQ=JM(),YM=HM(),_Q=[yQ.default,vQ.default,(0,$Q.default)(),bQ.default,YM.metadataVocabulary,YM.contentVocabulary];nP.default=_Q});var eL=S(Yv=>{"use strict";Object.defineProperty(Yv,"__esModule",{value:!0});Yv.DiscrError=void 0;var QM;(function(e){e.Tag="tag",e.Mapping="mapping"})(QM||(Yv.DiscrError=QM={}))});var rL=S(oP=>{"use strict";Object.defineProperty(oP,"__esModule",{value:!0});var cu=Ae(),iP=eL(),tL=Ov(),wQ=$f(),kQ=De(),SQ={message:({params:{discrError:e,tagName:t}})=>e===iP.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,cu._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},xQ={keyword:"discriminator",type:"object",schemaType:"object",error:SQ,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=i.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,cu._)`${r}${(0,cu.getProperty)(a)}`);t.if((0,cu._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:iP.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let p=f();t.if(!1);for(let m in p)t.elseIf((0,cu._)`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:iP.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(p){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(h,cu.Name),m}function f(){var p;let m={},h=y(n),g=!0;for(let _=0;_<s.length;_++){let w=s[_];if(w?.$ref&&!(0,kQ.schemaHasRulesButRef)(w,o.self.RULES)){let T=w.$ref;if(w=tL.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),w instanceof tL.SchemaEnv&&(w=w.schema),w===void 0)throw new wQ.default(o.opts.uriResolver,o.baseId,T)}let k=(p=w?.properties)===null||p===void 0?void 0:p[a];if(typeof k!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||y(w)),v(k,_)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function y({required:_}){return Array.isArray(_)&&_.includes(a)}function v(_,w){if(_.const)$(_.const,w);else if(_.enum)for(let k of _.enum)$(k,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function $(_,w){if(typeof _!="string"||_ in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[_]=w}}}};oP.default=xQ});var nL=S((k0e,IQ)=>{IQ.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 oL=S((pt,sP)=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.MissingRefError=pt.ValidationError=pt.CodeGen=pt.Name=pt.nil=pt.stringify=pt.str=pt._=pt.KeywordCxt=pt.Ajv=void 0;var PQ=QD(),TQ=XM(),AQ=rL(),iL=nL(),RQ=["/properties"],Xv="http://json-schema.org/draft-07/schema",uu=class extends PQ.default{_addVocabularies(){super._addVocabularies(),TQ.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(AQ.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(iL,RQ):iL;this.addMetaSchema(t,Xv,!1),this.refs["http://json-schema.org/schema"]=Xv}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Xv)?Xv:void 0)}};pt.Ajv=uu;sP.exports=pt=uu;sP.exports.Ajv=uu;Object.defineProperty(pt,"__esModule",{value:!0});pt.default=uu;var EQ=vf();Object.defineProperty(pt,"KeywordCxt",{enumerable:!0,get:function(){return EQ.KeywordCxt}});var lu=Ae();Object.defineProperty(pt,"_",{enumerable:!0,get:function(){return lu._}});Object.defineProperty(pt,"str",{enumerable:!0,get:function(){return lu.str}});Object.defineProperty(pt,"stringify",{enumerable:!0,get:function(){return lu.stringify}});Object.defineProperty(pt,"nil",{enumerable:!0,get:function(){return lu.nil}});Object.defineProperty(pt,"Name",{enumerable:!0,get:function(){return lu.Name}});Object.defineProperty(pt,"CodeGen",{enumerable:!0,get:function(){return lu.CodeGen}});var OQ=Rv();Object.defineProperty(pt,"ValidationError",{enumerable:!0,get:function(){return OQ.default}});var NQ=$f();Object.defineProperty(pt,"MissingRefError",{enumerable:!0,get:function(){return NQ.default}})});var pL=S(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.formatNames=li.fastFormats=li.fullFormats=void 0;function ui(e,t){return{validate:e,compare:t}}li.fullFormats={date:ui(uL,lP),time:ui(cP(!0),dP),"date-time":ui(sL(!0),dL),"iso-time":ui(cP(),lL),"iso-date-time":ui(sL(),fL),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:LQ,"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:KQ,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:UQ,int32:{type:"number",validate:ZQ},int64:{type:"number",validate:VQ},float:{type:"number",validate:cL},double:{type:"number",validate:cL},password:!0,binary:!0};li.fastFormats={...li.fullFormats,date:ui(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,lP),time:ui(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,dP),"date-time":ui(/^\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,dL),"iso-time":ui(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,lL),"iso-date-time":ui(/^\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,fL),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};li.formatNames=Object.keys(li.fullFormats);function CQ(e){return e%4===0&&(e%100!==0||e%400===0)}var zQ=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,jQ=[0,31,28,31,30,31,30,31,31,30,31,30,31];function uL(e){let t=zQ.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&CQ(r)?29:jQ[i])}function lP(e,t){if(e&&t)return e>t?1:e<t?-1:0}var aP=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function cP(e){return function(r){let i=aP.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],a=i[4],c=i[5]==="-"?-1:1,u=+(i[6]||0),l=+(i[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&o<=59&&s<60)return!0;let d=o-l*c,f=n-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&s<61}}function dP(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(r&&i)return r-i}function lL(e,t){if(!(e&&t))return;let r=aP.exec(e),i=aP.exec(t);if(r&&i)return e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t?1:e<t?-1:0}var uP=/t|\s/i;function sL(e){let t=cP(e);return function(i){let n=i.split(uP);return n.length===2&&uL(n[0])&&t(n[1])}}function dL(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(r&&i)return r-i}function fL(e,t){if(!(e&&t))return;let[r,i]=e.split(uP),[n,o]=t.split(uP),s=lP(r,n);if(s!==void 0)return s||dP(i,o)}var DQ=/\/|:/,MQ=/^(?:[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 LQ(e){return DQ.test(e)&&MQ.test(e)}var aL=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function UQ(e){return aL.lastIndex=0,aL.test(e)}var qQ=-(2**31),FQ=2**31-1;function ZQ(e){return Number.isInteger(e)&&e<=FQ&&e>=qQ}function VQ(e){return Number.isInteger(e)}function cL(){return!0}var BQ=/[^\\]\\Z/;function KQ(e){if(BQ.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var jf=S(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.regexpCode=Be.getEsmExportName=Be.getProperty=Be.safeStringify=Be.stringify=Be.strConcat=Be.addCodeArg=Be.str=Be._=Be.nil=Be._Code=Be.Name=Be.IDENTIFIER=Be._CodeOrName=void 0;var Cf=class{};Be._CodeOrName=Cf;Be.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Hs=class extends Cf{constructor(t){if(super(),!Be.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}}};Be.Name=Hs;var $n=class extends Cf{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,i)=>`${r}${i}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,i)=>(i instanceof Hs&&(r[i.str]=(r[i.str]||0)+1),r),{})}};Be._Code=$n;Be.nil=new $n("");function mL(e,...t){let r=[e[0]],i=0;for(;i<t.length;)pP(r,t[i]),r.push(e[++i]);return new $n(r)}Be._=mL;var fP=new $n("+");function hL(e,...t){let r=[zf(e[0])],i=0;for(;i<t.length;)r.push(fP),pP(r,t[i]),r.push(fP,zf(e[++i]));return GQ(r),new $n(r)}Be.str=hL;function pP(e,t){t instanceof $n?e.push(...t._items):t instanceof Hs?e.push(t):e.push(HQ(t))}Be.addCodeArg=pP;function GQ(e){let t=1;for(;t<e.length-1;){if(e[t]===fP){let r=WQ(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function WQ(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Hs||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 Hs))return`"${e}${t.slice(1)}`}function JQ(e,t){return t.emptyStr()?e:e.emptyStr()?t:hL`${e}${t}`}Be.strConcat=JQ;function HQ(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:zf(Array.isArray(e)?e.join(","):e)}function YQ(e){return new $n(zf(e))}Be.stringify=YQ;function zf(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Be.safeStringify=zf;function XQ(e){return typeof e=="string"&&Be.IDENTIFIER.test(e)?new $n(`.${e}`):mL`[${e}]`}Be.getProperty=XQ;function QQ(e){if(typeof e=="string"&&Be.IDENTIFIER.test(e))return new $n(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Be.getEsmExportName=QQ;function eee(e){return new $n(e.toString())}Be.regexpCode=eee});var gP=S(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.ValueScope=qr.ValueScopeName=qr.Scope=qr.varKinds=qr.UsedValueState=void 0;var Ur=jf(),mP=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Qv;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Qv||(qr.UsedValueState=Qv={}));qr.varKinds={const:new Ur.Name("const"),let:new Ur.Name("let"),var:new Ur.Name("var")};var e$=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Ur.Name?t:this.name(t)}name(t){return new Ur.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,i;if(!((i=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||i===void 0)&&i.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}}};qr.Scope=e$;var t$=class extends Ur.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:i}){this.value=t,this.scopePath=(0,Ur._)`.${new Ur.Name(r)}[${i}]`}};qr.ValueScopeName=t$;var tee=(0,Ur._)`\n`,hP=class extends e${constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?tee:Ur.nil}}get(){return this._scope}name(t){return new t$(t,this._newName(t))}value(t,r){var i;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:o}=n,s=(i=r.key)!==null&&i!==void 0?i:r.ref,a=this._values[o];if(a){let l=a.get(s);if(l)return l}else a=this._values[o]=new Map;a.set(s,n);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:o,itemIndex:u}),n}getValue(t,r){let i=this._values[t];if(i)return i.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,Ur._)`${t}${i.scopePath}`})}scopeCode(t=this._values,r,i){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,i)}_reduceValues(t,r,i={},n){let o=Ur.nil;for(let s in t){let a=t[s];if(!a)continue;let c=i[s]=i[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qv.Started);let l=r(u);if(l){let d=this.opts.es5?qr.varKinds.var:qr.varKinds.const;o=(0,Ur._)`${o}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))o=(0,Ur._)`${o}${l}${this.opts._n}`;else throw new mP(u);c.set(u,Qv.Completed)})}return o}};qr.ValueScope=hP});var we=S(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.or=Ie.and=Ie.not=Ie.CodeGen=Ie.operators=Ie.varKinds=Ie.ValueScopeName=Ie.ValueScope=Ie.Scope=Ie.Name=Ie.regexpCode=Ie.stringify=Ie.getProperty=Ie.nil=Ie.strConcat=Ie.str=Ie._=void 0;var je=jf(),Un=gP(),To=jf();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return To._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return To.str}});Object.defineProperty(Ie,"strConcat",{enumerable:!0,get:function(){return To.strConcat}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return To.nil}});Object.defineProperty(Ie,"getProperty",{enumerable:!0,get:function(){return To.getProperty}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return To.stringify}});Object.defineProperty(Ie,"regexpCode",{enumerable:!0,get:function(){return To.regexpCode}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return To.Name}});var o$=gP();Object.defineProperty(Ie,"Scope",{enumerable:!0,get:function(){return o$.Scope}});Object.defineProperty(Ie,"ValueScope",{enumerable:!0,get:function(){return o$.ValueScope}});Object.defineProperty(Ie,"ValueScopeName",{enumerable:!0,get:function(){return o$.ValueScopeName}});Object.defineProperty(Ie,"varKinds",{enumerable:!0,get:function(){return o$.varKinds}});Ie.operators={GT:new je._Code(">"),GTE:new je._Code(">="),LT:new je._Code("<"),LTE:new je._Code("<="),EQ:new je._Code("==="),NEQ:new je._Code("!=="),NOT:new je._Code("!"),OR:new je._Code("||"),AND:new je._Code("&&"),ADD:new je._Code("+")};var Di=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},yP=class extends Di{constructor(t,r,i){super(),this.varKind=t,this.name=r,this.rhs=i}render({es5:t,_n:r}){let i=t?Un.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=fu(this.rhs,t,r)),this}get names(){return this.rhs instanceof je._CodeOrName?this.rhs.names:{}}},r$=class extends Di{constructor(t,r,i){super(),this.lhs=t,this.rhs=r,this.sideEffects=i}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof je.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=fu(this.rhs,t,r),this}get names(){let t=this.lhs instanceof je.Name?{}:{...this.lhs.names};return i$(t,this.rhs)}},vP=class extends r${constructor(t,r,i,n){super(t,i,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},$P=class extends Di{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},bP=class extends Di{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},_P=class extends Di{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},wP=class extends Di{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=fu(this.code,t,r),this}get names(){return this.code instanceof je._CodeOrName?this.code.names:{}}},Df=class extends Di{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,i)=>r+i.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let i=t[r].optimizeNodes();Array.isArray(i)?t.splice(r,1,...i):i?t[r]=i:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:i}=this,n=i.length;for(;n--;){let o=i[n];o.optimizeNames(t,r)||(ree(t,o.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Qs(t,r.names),{})}},Mi=class extends Df{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},kP=class extends Df{},du=class extends Mi{};du.kind="else";var Ys=class e extends Mi{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 i=r.optimizeNodes();r=this.else=Array.isArray(i)?new du(i):i}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(gL(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var i;if(this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=fu(this.condition,t,r),this}get names(){let t=super.names;return i$(t,this.condition),this.else&&Qs(t,this.else.names),t}};Ys.kind="if";var Xs=class extends Mi{};Xs.kind="for";var SP=class extends Xs{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=fu(this.iteration,t,r),this}get names(){return Qs(super.names,this.iteration.names)}},xP=class extends Xs{constructor(t,r,i,n){super(),this.varKind=t,this.name=r,this.from=i,this.to=n}render(t){let r=t.es5?Un.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(t)}get names(){let t=i$(super.names,this.from);return i$(t,this.to)}},n$=class extends Xs{constructor(t,r,i,n){super(),this.loop=t,this.varKind=r,this.name=i,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=fu(this.iterable,t,r),this}get names(){return Qs(super.names,this.iterable.names)}},Mf=class extends Mi{constructor(t,r,i){super(),this.name=t,this.args=r,this.async=i}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Mf.kind="func";var Lf=class extends Df{render(t){return"return "+super.render(t)}};Lf.kind="return";var IP=class extends Mi{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 i,n;return super.optimizeNames(t,r),(i=this.catch)===null||i===void 0||i.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Qs(t,this.catch.names),this.finally&&Qs(t,this.finally.names),t}},Uf=class extends Mi{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Uf.kind="catch";var qf=class extends Mi{render(t){return"finally"+super.render(t)}};qf.kind="finally";var PP=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
10
|
+
`:""},this._extScope=t,this._scope=new Un.Scope({parent:t}),this._nodes=[new kP]}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 i=this._extScope.value(t,r);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}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,i,n){let o=this._scope.toName(r);return i!==void 0&&n&&(this._constants[o.str]=i),this._leafNode(new yP(t,o,i)),o}const(t,r,i){return this._def(Un.varKinds.const,t,r,i)}let(t,r,i){return this._def(Un.varKinds.let,t,r,i)}var(t,r,i){return this._def(Un.varKinds.var,t,r,i)}assign(t,r,i){return this._leafNode(new r$(t,r,i))}add(t,r){return this._leafNode(new vP(t,Ie.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==je.nil&&this._leafNode(new wP(t)),this}object(...t){let r=["{"];for(let[i,n]of t)r.length>1&&r.push(","),r.push(i),(i!==n||this.opts.es5)&&(r.push(":"),(0,je.addCodeArg)(r,n));return r.push("}"),new je._Code(r)}if(t,r,i){if(this._blockNode(new Ys(t)),r&&i)this.code(r).else().code(i).endIf();else if(r)this.code(r).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Ys(t))}else(){return this._elseNode(new du)}endIf(){return this._endBlockNode(Ys,du)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new SP(t),r)}forRange(t,r,i,n,o=this.opts.es5?Un.varKinds.var:Un.varKinds.let){let s=this._scope.toName(t);return this._for(new xP(o,s,r,i),()=>n(s))}forOf(t,r,i,n=Un.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let s=r instanceof je.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,je._)`${s}.length`,a=>{this.var(o,(0,je._)`${s}[${a}]`),i(o)})}return this._for(new n$("of",n,o,r),()=>i(o))}forIn(t,r,i,n=this.opts.es5?Un.varKinds.var:Un.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,je._)`Object.keys(${r})`,i);let o=this._scope.toName(t);return this._for(new n$("in",n,o,r),()=>i(o))}endFor(){return this._endBlockNode(Xs)}label(t){return this._leafNode(new $P(t))}break(t){return this._leafNode(new bP(t))}return(t){let r=new Lf;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Lf)}try(t,r,i){if(!r&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new IP;if(this._blockNode(n),this.code(t),r){let o=this.name("e");this._currNode=n.catch=new Uf(o),r(o)}return i&&(this._currNode=n.finally=new qf,this.code(i)),this._endBlockNode(Uf,qf)}throw(t){return this._leafNode(new _P(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 i=this._nodes.length-r;if(i<0||t!==void 0&&i!==t)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=je.nil,i,n){return this._blockNode(new Mf(t,r,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Mf)}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 i=this._currNode;if(i instanceof t||r&&i 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 Ys))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}};Ie.CodeGen=PP;function Qs(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function i$(e,t){return t instanceof je._CodeOrName?Qs(e,t.names):e}function fu(e,t,r){if(e instanceof je.Name)return i(e);if(!n(e))return e;return new je._Code(e._items.reduce((o,s)=>(s instanceof je.Name&&(s=i(s)),s instanceof je._Code?o.push(...s._items):o.push(s),o),[]));function i(o){let s=r[o.str];return s===void 0||t[o.str]!==1?o:(delete t[o.str],s)}function n(o){return o instanceof je._Code&&o._items.some(s=>s instanceof je.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function ree(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function gL(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,je._)`!${TP(e)}`}Ie.not=gL;var nee=yL(Ie.operators.AND);function iee(...e){return e.reduce(nee)}Ie.and=iee;var oee=yL(Ie.operators.OR);function see(...e){return e.reduce(oee)}Ie.or=see;function yL(e){return(t,r)=>t===je.nil?r:r===je.nil?t:(0,je._)`${TP(t)} ${e} ${TP(r)}`}function TP(e){return e instanceof je.Name?e:(0,je._)`(${e})`}});var Le=S(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.checkStrictMode=Ee.getErrorPath=Ee.Type=Ee.useFunc=Ee.setEvaluated=Ee.evaluatedPropsToName=Ee.mergeEvaluated=Ee.eachItem=Ee.unescapeJsonPointer=Ee.escapeJsonPointer=Ee.escapeFragment=Ee.unescapeFragment=Ee.schemaRefOrVal=Ee.schemaHasRulesButRef=Ee.schemaHasRules=Ee.checkUnknownRules=Ee.alwaysValidSchema=Ee.toHash=void 0;var ut=we(),aee=jf();function cee(e){let t={};for(let r of e)t[r]=!0;return t}Ee.toHash=cee;function uee(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(bL(e,t),!_L(t,e.self.RULES.all))}Ee.alwaysValidSchema=uee;function bL(e,t=e.schema){let{opts:r,self:i}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=i.RULES.keywords;for(let o in t)n[o]||SL(e,`unknown keyword: "${o}"`)}Ee.checkUnknownRules=bL;function _L(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Ee.schemaHasRules=_L;function lee(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Ee.schemaHasRulesButRef=lee;function dee({topSchemaRef:e,schemaPath:t},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ut._)`${r}`}return(0,ut._)`${e}${t}${(0,ut.getProperty)(i)}`}Ee.schemaRefOrVal=dee;function fee(e){return wL(decodeURIComponent(e))}Ee.unescapeFragment=fee;function pee(e){return encodeURIComponent(RP(e))}Ee.escapeFragment=pee;function RP(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Ee.escapeJsonPointer=RP;function wL(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Ee.unescapeJsonPointer=wL;function mee(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Ee.eachItem=mee;function vL({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{let c=s===void 0?o:s instanceof ut.Name?(o instanceof ut.Name?e(n,o,s):t(n,o,s),s):o instanceof ut.Name?(t(n,s,o),o):r(o,s);return a===ut.Name&&!(c instanceof ut.Name)?i(n,c):c}}Ee.mergeEvaluated={props:vL({mergeNames:(e,t,r)=>e.if((0,ut._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,ut._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,ut._)`${r} || {}`).code((0,ut._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,ut._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,ut._)`${r} || {}`),EP(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:kL}),items:vL({mergeNames:(e,t,r)=>e.if((0,ut._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,ut._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,ut._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,ut._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function kL(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,ut._)`{}`);return t!==void 0&&EP(e,r,t),r}Ee.evaluatedPropsToName=kL;function EP(e,t,r){Object.keys(r).forEach(i=>e.assign((0,ut._)`${t}${(0,ut.getProperty)(i)}`,!0))}Ee.setEvaluated=EP;var $L={};function hee(e,t){return e.scopeValue("func",{ref:t,code:$L[t.code]||($L[t.code]=new aee._Code(t.code))})}Ee.useFunc=hee;var AP;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(AP||(Ee.Type=AP={}));function gee(e,t,r){if(e instanceof ut.Name){let i=t===AP.Num;return r?i?(0,ut._)`"[" + ${e} + "]"`:(0,ut._)`"['" + ${e} + "']"`:i?(0,ut._)`"/" + ${e}`:(0,ut._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ut.getProperty)(e).toString():"/"+RP(e)}Ee.getErrorPath=gee;function SL(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Ee.checkStrictMode=SL});var Li=S(OP=>{"use strict";Object.defineProperty(OP,"__esModule",{value:!0});var cr=we(),yee={data:new cr.Name("data"),valCxt:new cr.Name("valCxt"),instancePath:new cr.Name("instancePath"),parentData:new cr.Name("parentData"),parentDataProperty:new cr.Name("parentDataProperty"),rootData:new cr.Name("rootData"),dynamicAnchors:new cr.Name("dynamicAnchors"),vErrors:new cr.Name("vErrors"),errors:new cr.Name("errors"),this:new cr.Name("this"),self:new cr.Name("self"),scope:new cr.Name("scope"),json:new cr.Name("json"),jsonPos:new cr.Name("jsonPos"),jsonLen:new cr.Name("jsonLen"),jsonPart:new cr.Name("jsonPart")};OP.default=yee});var Ff=S(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.extendErrors=ur.resetErrorsCount=ur.reportExtraError=ur.reportError=ur.keyword$DataError=ur.keywordError=void 0;var Ue=we(),s$=Le(),Ir=Li();ur.keywordError={message:({keyword:e})=>(0,Ue.str)`must pass "${e}" keyword validation`};ur.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,Ue.str)`"${e}" keyword must be ${t} ($data)`:(0,Ue.str)`"${e}" keyword is invalid ($data)`};function vee(e,t=ur.keywordError,r,i){let{it:n}=e,{gen:o,compositeRule:s,allErrors:a}=n,c=PL(e,t,r);i??(s||a)?xL(o,c):IL(n,(0,Ue._)`[${c}]`)}ur.reportError=vee;function $ee(e,t=ur.keywordError,r){let{it:i}=e,{gen:n,compositeRule:o,allErrors:s}=i,a=PL(e,t,r);xL(n,a),o||s||IL(i,Ir.default.vErrors)}ur.reportExtraError=$ee;function bee(e,t){e.assign(Ir.default.errors,t),e.if((0,Ue._)`${Ir.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,Ue._)`${Ir.default.vErrors}.length`,t),()=>e.assign(Ir.default.vErrors,null)))}ur.resetErrorsCount=bee;function _ee({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,Ir.default.errors,a=>{e.const(s,(0,Ue._)`${Ir.default.vErrors}[${a}]`),e.if((0,Ue._)`${s}.instancePath === undefined`,()=>e.assign((0,Ue._)`${s}.instancePath`,(0,Ue.strConcat)(Ir.default.instancePath,o.errorPath))),e.assign((0,Ue._)`${s}.schemaPath`,(0,Ue.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,Ue._)`${s}.schema`,r),e.assign((0,Ue._)`${s}.data`,i))})}ur.extendErrors=_ee;function xL(e,t){let r=e.const("err",t);e.if((0,Ue._)`${Ir.default.vErrors} === null`,()=>e.assign(Ir.default.vErrors,(0,Ue._)`[${r}]`),(0,Ue._)`${Ir.default.vErrors}.push(${r})`),e.code((0,Ue._)`${Ir.default.errors}++`)}function IL(e,t){let{gen:r,validateName:i,schemaEnv:n}=e;n.$async?r.throw((0,Ue._)`new ${e.ValidationError}(${t})`):(r.assign((0,Ue._)`${i}.errors`,t),r.return(!1))}var ea={keyword:new Ue.Name("keyword"),schemaPath:new Ue.Name("schemaPath"),params:new Ue.Name("params"),propertyName:new Ue.Name("propertyName"),message:new Ue.Name("message"),schema:new Ue.Name("schema"),parentSchema:new Ue.Name("parentSchema")};function PL(e,t,r){let{createErrors:i}=e.it;return i===!1?(0,Ue._)`{}`:wee(e,t,r)}function wee(e,t,r={}){let{gen:i,it:n}=e,o=[kee(n,r),See(e,r)];return xee(e,t,o),i.object(...o)}function kee({errorPath:e},{instancePath:t}){let r=t?(0,Ue.str)`${e}${(0,s$.getErrorPath)(t,s$.Type.Str)}`:e;return[Ir.default.instancePath,(0,Ue.strConcat)(Ir.default.instancePath,r)]}function See({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:i}){let n=i?t:(0,Ue.str)`${t}/${e}`;return r&&(n=(0,Ue.str)`${n}${(0,s$.getErrorPath)(r,s$.Type.Str)}`),[ea.schemaPath,n]}function xee(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:s,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;i.push([ea.keyword,n],[ea.params,typeof t=="function"?t(e):t||(0,Ue._)`{}`]),c.messages&&i.push([ea.message,typeof r=="function"?r(e):r]),c.verbose&&i.push([ea.schema,s],[ea.parentSchema,(0,Ue._)`${l}${d}`],[Ir.default.data,o]),u&&i.push([ea.propertyName,u])}});var AL=S(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.boolOrEmptySchema=pu.topBoolOrEmptySchema=void 0;var Iee=Ff(),Pee=we(),Tee=Li(),Aee={message:"boolean schema is false"};function Ree(e){let{gen:t,schema:r,validateName:i}=e;r===!1?TL(e,!1):typeof r=="object"&&r.$async===!0?t.return(Tee.default.data):(t.assign((0,Pee._)`${i}.errors`,null),t.return(!0))}pu.topBoolOrEmptySchema=Ree;function Eee(e,t){let{gen:r,schema:i}=e;i===!1?(r.var(t,!1),TL(e)):r.var(t,!0)}pu.boolOrEmptySchema=Eee;function TL(e,t){let{gen:r,data:i}=e,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Iee.reportError)(n,Aee,void 0,t)}});var NP=S(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.getRules=mu.isJSONType=void 0;var Oee=["string","number","integer","boolean","null","object","array"],Nee=new Set(Oee);function Cee(e){return typeof e=="string"&&Nee.has(e)}mu.isJSONType=Cee;function zee(){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:{}}}mu.getRules=zee});var CP=S(Ao=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});Ao.shouldUseRule=Ao.shouldUseGroup=Ao.schemaHasRulesForType=void 0;function jee({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&RL(e,i)}Ao.schemaHasRulesForType=jee;function RL(e,t){return t.rules.some(r=>EL(e,r))}Ao.shouldUseGroup=RL;function EL(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(i=>e[i]!==void 0))}Ao.shouldUseRule=EL});var Zf=S(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.reportTypeError=lr.checkDataTypes=lr.checkDataType=lr.coerceAndCheckDataType=lr.getJSONTypes=lr.getSchemaTypes=lr.DataType=void 0;var Dee=NP(),Mee=CP(),Lee=Ff(),be=we(),OL=Le(),hu;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(hu||(lr.DataType=hu={}));function Uee(e){let t=NL(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}lr.getSchemaTypes=Uee;function NL(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Dee.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}lr.getJSONTypes=NL;function qee(e,t){let{gen:r,data:i,opts:n}=e,o=Fee(t,n.coerceTypes),s=t.length>0&&!(o.length===0&&t.length===1&&(0,Mee.schemaHasRulesForType)(e,t[0]));if(s){let a=jP(t,i,n.strictNumbers,hu.Wrong);r.if(a,()=>{o.length?Zee(e,t,o):DP(e)})}return s}lr.coerceAndCheckDataType=qee;var CL=new Set(["string","number","integer","boolean","null"]);function Fee(e,t){return t?e.filter(r=>CL.has(r)||t==="array"&&r==="array"):[]}function Zee(e,t,r){let{gen:i,data:n,opts:o}=e,s=i.let("dataType",(0,be._)`typeof ${n}`),a=i.let("coerced",(0,be._)`undefined`);o.coerceTypes==="array"&&i.if((0,be._)`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,be._)`${n}[0]`).assign(s,(0,be._)`typeof ${n}`).if(jP(t,n,o.strictNumbers),()=>i.assign(a,n))),i.if((0,be._)`${a} !== undefined`);for(let u of r)(CL.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);i.else(),DP(e),i.endIf(),i.if((0,be._)`${a} !== undefined`,()=>{i.assign(n,a),Vee(e,a)});function c(u){switch(u){case"string":i.elseIf((0,be._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,be._)`"" + ${n}`).elseIf((0,be._)`${n} === null`).assign(a,(0,be._)`""`);return;case"number":i.elseIf((0,be._)`${s} == "boolean" || ${n} === null
|
|
11
|
+
|| (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,be._)`+${n}`);return;case"integer":i.elseIf((0,be._)`${s} === "boolean" || ${n} === null
|
|
12
|
+
|| (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,be._)`+${n}`);return;case"boolean":i.elseIf((0,be._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,be._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":i.elseIf((0,be._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(a,null);return;case"array":i.elseIf((0,be._)`${s} === "string" || ${s} === "number"
|
|
13
|
+
|| ${s} === "boolean" || ${n} === null`).assign(a,(0,be._)`[${n}]`)}}}function Vee({gen:e,parentData:t,parentDataProperty:r},i){e.if((0,be._)`${t} !== undefined`,()=>e.assign((0,be._)`${t}[${r}]`,i))}function zP(e,t,r,i=hu.Correct){let n=i===hu.Correct?be.operators.EQ:be.operators.NEQ,o;switch(e){case"null":return(0,be._)`${t} ${n} null`;case"array":o=(0,be._)`Array.isArray(${t})`;break;case"object":o=(0,be._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s((0,be._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return(0,be._)`typeof ${t} ${n} ${e}`}return i===hu.Correct?o:(0,be.not)(o);function s(a=be.nil){return(0,be.and)((0,be._)`typeof ${t} == "number"`,a,r?(0,be._)`isFinite(${t})`:be.nil)}}lr.checkDataType=zP;function jP(e,t,r,i){if(e.length===1)return zP(e[0],t,r,i);let n,o=(0,OL.toHash)(e);if(o.array&&o.object){let s=(0,be._)`typeof ${t} != "object"`;n=o.null?s:(0,be._)`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=be.nil;o.number&&delete o.integer;for(let s in o)n=(0,be.and)(n,zP(s,t,r,i));return n}lr.checkDataTypes=jP;var Bee={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,be._)`{type: ${e}}`:(0,be._)`{type: ${t}}`};function DP(e){let t=Kee(e);(0,Lee.reportError)(t,Bee)}lr.reportTypeError=DP;function Kee(e){let{gen:t,data:r,schema:i}=e,n=(0,OL.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var jL=S(a$=>{"use strict";Object.defineProperty(a$,"__esModule",{value:!0});a$.assignDefaults=void 0;var gu=we(),Gee=Le();function Wee(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)zL(e,n,r[n].default);else t==="array"&&Array.isArray(i)&&i.forEach((n,o)=>zL(e,o,n.default))}a$.assignDefaults=Wee;function zL(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let a=(0,gu._)`${o}${(0,gu.getProperty)(t)}`;if(n){(0,Gee.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,gu._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,gu._)`${c} || ${a} === null || ${a} === ""`),i.if(c,(0,gu._)`${a} = ${(0,gu.stringify)(r)}`)}});var bn=S(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.validateUnion=st.validateArray=st.usePattern=st.callValidateCode=st.schemaProperties=st.allSchemaProperties=st.noPropertyInData=st.propertyInData=st.isOwnProperty=st.hasPropFunc=st.reportMissingProp=st.checkMissingProp=st.checkReportMissingProp=void 0;var mt=we(),MP=Le(),Ro=Li(),Jee=Le();function Hee(e,t){let{gen:r,data:i,it:n}=e;r.if(UP(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,mt._)`${t}`},!0),e.error()})}st.checkReportMissingProp=Hee;function Yee({gen:e,data:t,it:{opts:r}},i,n){return(0,mt.or)(...i.map(o=>(0,mt.and)(UP(e,t,o,r.ownProperties),(0,mt._)`${n} = ${o}`)))}st.checkMissingProp=Yee;function Xee(e,t){e.setParams({missingProperty:t},!0),e.error()}st.reportMissingProp=Xee;function DL(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,mt._)`Object.prototype.hasOwnProperty`})}st.hasPropFunc=DL;function LP(e,t,r){return(0,mt._)`${DL(e)}.call(${t}, ${r})`}st.isOwnProperty=LP;function Qee(e,t,r,i){let n=(0,mt._)`${t}${(0,mt.getProperty)(r)} !== undefined`;return i?(0,mt._)`${n} && ${LP(e,t,r)}`:n}st.propertyInData=Qee;function UP(e,t,r,i){let n=(0,mt._)`${t}${(0,mt.getProperty)(r)} === undefined`;return i?(0,mt.or)(n,(0,mt.not)(LP(e,t,r))):n}st.noPropertyInData=UP;function ML(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}st.allSchemaProperties=ML;function ete(e,t){return ML(t).filter(r=>!(0,MP.alwaysValidSchema)(e,t[r]))}st.schemaProperties=ete;function tte({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,c,u){let l=u?(0,mt._)`${e}, ${t}, ${i}${n}`:t,d=[[Ro.default.instancePath,(0,mt.strConcat)(Ro.default.instancePath,o)],[Ro.default.parentData,s.parentData],[Ro.default.parentDataProperty,s.parentDataProperty],[Ro.default.rootData,Ro.default.rootData]];s.opts.dynamicRef&&d.push([Ro.default.dynamicAnchors,Ro.default.dynamicAnchors]);let f=(0,mt._)`${l}, ${r.object(...d)}`;return c!==mt.nil?(0,mt._)`${a}.call(${c}, ${f})`:(0,mt._)`${a}(${f})`}st.callValidateCode=tte;var rte=(0,mt._)`new RegExp`;function nte({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,mt._)`${n.code==="new RegExp"?rte:(0,Jee.useFunc)(e,n)}(${r}, ${i})`})}st.usePattern=nte;function ite(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(o,!0),s(()=>t.break()),o;function s(a){let c=t.const("len",(0,mt._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:i,dataProp:u,dataPropType:MP.Type.Num},o),t.if((0,mt.not)(o),a)})}}st.validateArray=ite;function ote(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,MP.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:i,schemaProp:u,compositeRule:!0},a);t.assign(s,(0,mt._)`${s} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,mt.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}st.validateUnion=ote});var qL=S(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.validateKeywordUsage=di.validSchemaType=di.funcKeywordCode=di.macroKeywordCode=void 0;var Pr=we(),ta=Li(),ste=bn(),ate=Ff();function cte(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,a=t.macro.call(s.self,n,o,s),c=UL(r,i,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:Pr.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}di.macroKeywordCode=cte;function ute(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:a,it:c}=e;dte(c,t);let u=!a&&t.compile?t.compile.call(c.self,o,s,c):t.validate,l=UL(i,n,u),d=i.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)h(),t.modifying&&LL(e),g(()=>e.error());else{let y=t.async?p():m();t.modifying&&LL(e),g(()=>lte(e,y))}}function p(){let y=i.let("ruleErrs",null);return i.try(()=>h((0,Pr._)`await `),v=>i.assign(d,!1).if((0,Pr._)`${v} instanceof ${c.ValidationError}`,()=>i.assign(y,(0,Pr._)`${v}.errors`),()=>i.throw(v))),y}function m(){let y=(0,Pr._)`${l}.errors`;return i.assign(y,null),h(Pr.nil),y}function h(y=t.async?(0,Pr._)`await `:Pr.nil){let v=c.opts.passContext?ta.default.this:ta.default.self,$=!("compile"in t&&!a||t.schema===!1);i.assign(d,(0,Pr._)`${y}${(0,ste.callValidateCode)(e,l,v,$)}`,t.modifying)}function g(y){var v;i.if((0,Pr.not)((v=t.valid)!==null&&v!==void 0?v:d),y)}}di.funcKeywordCode=ute;function LL(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,(0,Pr._)`${i.parentData}[${i.parentDataProperty}]`))}function lte(e,t){let{gen:r}=e;r.if((0,Pr._)`Array.isArray(${t})`,()=>{r.assign(ta.default.vErrors,(0,Pr._)`${ta.default.vErrors} === null ? ${t} : ${ta.default.vErrors}.concat(${t})`).assign(ta.default.errors,(0,Pr._)`${ta.default.vErrors}.length`),(0,ate.extendErrors)(e)},()=>e.error())}function dte({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function UL(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,Pr.stringify)(r)})}function fte(e,t,r=!1){return!t.length||t.some(i=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}di.validSchemaType=fte;function pte({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}di.validateKeywordUsage=pte});var ZL=S(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.extendSubschemaMode=Eo.extendSubschemaData=Eo.getSubschema=void 0;var fi=we(),FL=Le();function mte(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==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,fi._)`${e.schemaPath}${(0,fi.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,fi._)`${e.schemaPath}${(0,fi.getProperty)(t)}${(0,fi.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,FL.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}Eo.getSubschema=mte;function hte(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){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:d}=t,f=a.let("data",(0,fi._)`${t.data}${(0,fi.getProperty)(r)}`,!0);c(f),e.errorPath=(0,fi.str)`${u}${(0,FL.getErrorPath)(r,i,d.jsPropertySyntax)}`,e.parentDataProperty=(0,fi._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof fi.Name?n:a.let("data",n,!0);c(u),s!==void 0&&(e.propertyName=s)}o&&(e.dataTypes=o);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]}}Eo.extendSubschemaData=hte;function gte(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){i!==void 0&&(e.compositeRule=i),n!==void 0&&(e.createErrors=n),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}Eo.extendSubschemaMode=gte});var BL=S((L0e,VL)=>{"use strict";var Oo=VL.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};c$(t,i,n,e,"",e)};Oo.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Oo.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Oo.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Oo.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 c$(e,t,r,i,n,o,s,a,c,u){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,a,c,u);for(var l in i){var d=i[l];if(Array.isArray(d)){if(l in Oo.arrayKeywords)for(var f=0;f<d.length;f++)c$(e,t,r,d[f],n+"/"+l+"/"+f,o,n,l,i,f)}else if(l in Oo.propsKeywords){if(d&&typeof d=="object")for(var p in d)c$(e,t,r,d[p],n+"/"+l+"/"+yte(p),o,n,l,i,p)}else(l in Oo.keywords||e.allKeys&&!(l in Oo.skipKeywords))&&c$(e,t,r,d,n+"/"+l,o,n,l,i)}r(i,n,o,s,a,c,u)}}function yte(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Vf=S(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.getSchemaRefs=Fr.resolveUrl=Fr.normalizeId=Fr._getFullPath=Fr.getFullPath=Fr.inlineRef=void 0;var vte=Le(),$te=mf(),bte=BL(),_te=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function wte(e,t=!0){return typeof e=="boolean"?!0:t===!0?!qP(e):t?KL(e)<=t:!1}Fr.inlineRef=wte;var kte=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qP(e){for(let t in e){if(kte.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(qP)||typeof r=="object"&&qP(r))return!0}return!1}function KL(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!_te.has(r)&&(typeof e[r]=="object"&&(0,vte.eachItem)(e[r],i=>t+=KL(i)),t===1/0))return 1/0}return t}function GL(e,t="",r){r!==!1&&(t=yu(t));let i=e.parse(t);return WL(e,i)}Fr.getFullPath=GL;function WL(e,t){return e.serialize(t).split("#")[0]+"#"}Fr._getFullPath=WL;var Ste=/#\/?$/;function yu(e){return e?e.replace(Ste,""):""}Fr.normalizeId=yu;function xte(e,t,r){return r=yu(r),e.resolve(t,r)}Fr.resolveUrl=xte;var Ite=/^[a-z_][-a-z0-9._]*$/i;function Pte(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=yu(e[r]||t),o={"":n},s=GL(i,n,!1),a={},c=new Set;return bte(e,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=s+f,g=o[m];typeof d[r]=="string"&&(g=y.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),o[f]=g;function y($){let _=this.opts.uriResolver.resolve;if($=yu(g?_(g,$):$),c.has($))throw l($);c.add($);let w=this.refs[$];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?u(d,w.schema,$):$!==yu(h)&&($[0]==="#"?(u(d,a[$],$),a[$]=d):this.refs[$]=h),$}function v($){if(typeof $=="string"){if(!Ite.test($))throw new Error(`invalid anchor "${$}"`);y.call(this,`#${$}`)}}}),a;function u(d,f,p){if(f!==void 0&&!$te(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Fr.getSchemaRefs=Pte});var Gf=S(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.getData=No.KeywordCxt=No.validateFunctionCode=void 0;var QL=AL(),JL=Zf(),ZP=CP(),u$=Zf(),Tte=jL(),Kf=qL(),FP=ZL(),Q=we(),me=Li(),Ate=Vf(),Ui=Le(),Bf=Ff();function Rte(e){if(rU(e)&&(nU(e),tU(e))){Nte(e);return}eU(e,()=>(0,QL.topBoolOrEmptySchema)(e))}No.validateFunctionCode=Rte;function eU({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){n.code.es5?e.func(t,(0,Q._)`${me.default.data}, ${me.default.valCxt}`,i.$async,()=>{e.code((0,Q._)`"use strict"; ${HL(r,n)}`),Ote(e,n),e.code(o)}):e.func(t,(0,Q._)`${me.default.data}, ${Ete(n)}`,i.$async,()=>e.code(HL(r,n)).code(o))}function Ete(e){return(0,Q._)`{${me.default.instancePath}="", ${me.default.parentData}, ${me.default.parentDataProperty}, ${me.default.rootData}=${me.default.data}${e.dynamicRef?(0,Q._)`, ${me.default.dynamicAnchors}={}`:Q.nil}}={}`}function Ote(e,t){e.if(me.default.valCxt,()=>{e.var(me.default.instancePath,(0,Q._)`${me.default.valCxt}.${me.default.instancePath}`),e.var(me.default.parentData,(0,Q._)`${me.default.valCxt}.${me.default.parentData}`),e.var(me.default.parentDataProperty,(0,Q._)`${me.default.valCxt}.${me.default.parentDataProperty}`),e.var(me.default.rootData,(0,Q._)`${me.default.valCxt}.${me.default.rootData}`),t.dynamicRef&&e.var(me.default.dynamicAnchors,(0,Q._)`${me.default.valCxt}.${me.default.dynamicAnchors}`)},()=>{e.var(me.default.instancePath,(0,Q._)`""`),e.var(me.default.parentData,(0,Q._)`undefined`),e.var(me.default.parentDataProperty,(0,Q._)`undefined`),e.var(me.default.rootData,me.default.data),t.dynamicRef&&e.var(me.default.dynamicAnchors,(0,Q._)`{}`)})}function Nte(e){let{schema:t,opts:r,gen:i}=e;eU(e,()=>{r.$comment&&t.$comment&&oU(e),Mte(e),i.let(me.default.vErrors,null),i.let(me.default.errors,0),r.unevaluated&&Cte(e),iU(e),qte(e)})}function Cte(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,Q._)`${r}.evaluated`),t.if((0,Q._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,Q._)`${e.evaluated}.props`,(0,Q._)`undefined`)),t.if((0,Q._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,Q._)`${e.evaluated}.items`,(0,Q._)`undefined`))}function HL(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,Q._)`/*# sourceURL=${r} */`:Q.nil}function zte(e,t){if(rU(e)&&(nU(e),tU(e))){jte(e,t);return}(0,QL.boolOrEmptySchema)(e,t)}function tU({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 rU(e){return typeof e.schema!="boolean"}function jte(e,t){let{schema:r,gen:i,opts:n}=e;n.$comment&&r.$comment&&oU(e),Lte(e),Ute(e);let o=i.const("_errs",me.default.errors);iU(e,o),i.var(t,(0,Q._)`${o} === ${me.default.errors}`)}function nU(e){(0,Ui.checkUnknownRules)(e),Dte(e)}function iU(e,t){if(e.opts.jtd)return YL(e,[],!1,t);let r=(0,JL.getSchemaTypes)(e.schema),i=(0,JL.coerceAndCheckDataType)(e,r);YL(e,r,!i,t)}function Dte(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,Ui.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Mte(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ui.checkStrictMode)(e,"default is ignored in the schema root")}function Lte(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Ate.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function Ute(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function oU({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code((0,Q._)`${me.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=(0,Q.str)`${i}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,Q._)`${me.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function qte(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;r.$async?t.if((0,Q._)`${me.default.errors} === 0`,()=>t.return(me.default.data),()=>t.throw((0,Q._)`new ${n}(${me.default.vErrors})`)):(t.assign((0,Q._)`${i}.errors`,me.default.vErrors),o.unevaluated&&Fte(e),t.return((0,Q._)`${me.default.errors} === 0`))}function Fte({gen:e,evaluated:t,props:r,items:i}){r instanceof Q.Name&&e.assign((0,Q._)`${t}.props`,r),i instanceof Q.Name&&e.assign((0,Q._)`${t}.items`,i)}function YL(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Ui.schemaHasRulesButRef)(o,l))){n.block(()=>aU(e,"$ref",l.all.$ref.definition));return}c.jtd||Zte(e,t),n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,ZP.shouldUseGroup)(o,f)&&(f.type?(n.if((0,u$.checkDataType)(f.type,s,c.strictNumbers)),XL(e,f),t.length===1&&t[0]===f.type&&r&&(n.else(),(0,u$.reportTypeError)(e)),n.endIf()):XL(e,f),a||n.if((0,Q._)`${me.default.errors} === ${i||0}`))}}function XL(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;n&&(0,Tte.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0,ZP.shouldUseRule)(i,o)&&aU(e,o.keyword,o.definition,t.type)})}function Zte(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Vte(e,t),e.opts.allowUnionTypes||Bte(e,t),Kte(e,e.dataTypes))}function Vte(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{sU(e.dataTypes,r)||VP(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Wte(e,t)}}function Bte(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&VP(e,"use allowUnionTypes to allow union type keyword")}function Kte(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,ZP.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;o.length&&!o.some(s=>Gte(t,s))&&VP(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function Gte(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function sU(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Wte(e,t){let r=[];for(let i of e.dataTypes)sU(t,i)?r.push(i):t.includes("integer")&&i==="number"&&r.push("integer");e.dataTypes=r}function VP(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ui.checkStrictMode)(e,t,e.opts.strictTypes)}var l$=class{constructor(t,r,i){if((0,Kf.validateKeywordUsage)(t,r,i),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=i,this.data=t.data,this.schema=t.schema[i],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ui.schemaRefOrVal)(t,this.schema,i,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",cU(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Kf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${i} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",me.default.errors))}result(t,r,i){this.failResult((0,Q.not)(t),r,i)}failResult(t,r,i){this.gen.if(t),i?i():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,Q.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,Q._)`${r} !== undefined && (${(0,Q.or)(this.invalid$data(),t)})`)}error(t,r,i){if(r){this.setParams(r),this._error(t,i),this.setParams({});return}this._error(t,i)}_error(t,r){(t?Bf.reportExtraError:Bf.reportError)(this,this.def.error,r)}$dataError(){(0,Bf.reportError)(this,this.def.$dataError||Bf.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Bf.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,i=Q.nil){this.gen.block(()=>{this.check$data(t,i),r()})}check$data(t=Q.nil,r=Q.nil){if(!this.$data)return;let{gen:i,schemaCode:n,schemaType:o,def:s}=this;i.if((0,Q.or)((0,Q._)`${n} === undefined`,r)),t!==Q.nil&&i.assign(t,!0),(o.length||s.validateSchema)&&(i.elseIf(this.invalid$data()),this.$dataError(),t!==Q.nil&&i.assign(t,!1)),i.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:i,def:n,it:o}=this;return(0,Q.or)(s(),a());function s(){if(i.length){if(!(r instanceof Q.Name))throw new Error("ajv implementation error");let c=Array.isArray(i)?i:[i];return(0,Q._)`${(0,u$.checkDataTypes)(c,r,o.opts.strictNumbers,u$.DataType.Wrong)}`}return Q.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,Q._)`!${c}(${r})`}return Q.nil}}subschema(t,r){let i=(0,FP.getSubschema)(this.it,t);(0,FP.extendSubschemaData)(i,this.it,t),(0,FP.extendSubschemaMode)(i,t);let n={...this.it,...i,items:void 0,props:void 0};return zte(n,r),n}mergeEvaluated(t,r){let{it:i,gen:n}=this;i.opts.unevaluated&&(i.props!==!0&&t.props!==void 0&&(i.props=Ui.mergeEvaluated.props(n,t.props,i.props,r)),i.items!==!0&&t.items!==void 0&&(i.items=Ui.mergeEvaluated.items(n,t.items,i.items,r)))}mergeValidEvaluated(t,r){let{it:i,gen:n}=this;if(i.opts.unevaluated&&(i.props!==!0||i.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,Q.Name)),!0}};No.KeywordCxt=l$;function aU(e,t,r,i){let n=new l$(e,r,t);"code"in r?r.code(n,i):n.$data&&r.validate?(0,Kf.funcKeywordCode)(n,r):"macro"in r?(0,Kf.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Kf.funcKeywordCode)(n,r)}var Jte=/^\/(?:[^~]|~0|~1)*$/,Hte=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function cU(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return me.default.rootData;if(e[0]==="/"){if(!Jte.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,o=me.default.rootData}else{let u=Hte.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 i[t-l]}if(l>t)throw new Error(c("data",l));if(o=r[t-l],!n)return o}let s=o,a=n.split("/");for(let u of a)u&&(o=(0,Q._)`${o}${(0,Q.getProperty)((0,Ui.unescapeJsonPointer)(u))}`,s=(0,Q._)`${s} && ${o}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}No.getData=cU});var d$=S(KP=>{"use strict";Object.defineProperty(KP,"__esModule",{value:!0});var BP=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};KP.default=BP});var Wf=S(JP=>{"use strict";Object.defineProperty(JP,"__esModule",{value:!0});var GP=Vf(),WP=class extends Error{constructor(t,r,i,n){super(n||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,GP.resolveUrl)(t,r,i),this.missingSchema=(0,GP.normalizeId)((0,GP.getFullPath)(t,this.missingRef))}};JP.default=WP});var p$=S(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.resolveSchema=_n.getCompilingSchema=_n.resolveRef=_n.compileSchema=_n.SchemaEnv=void 0;var qn=we(),Yte=d$(),ra=Li(),Fn=Vf(),uU=Le(),Xte=Gf(),vu=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let i;typeof t.schema=="object"&&(i=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,Fn.normalizeId)(i?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=i?.$async,this.refs={}}};_n.SchemaEnv=vu;function YP(e){let t=lU.call(this,e);if(t)return t;let r=(0,Fn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new qn.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),a;e.$async&&(a=s.scopeValue("Error",{ref:Yte.default,code:(0,qn._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");e.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:ra.default.data,parentData:ra.default.parentData,parentDataProperty:ra.default.parentDataProperty,dataNames:[ra.default.data],dataPathArr:[qn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,qn.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:qn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,qn._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Xte.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(ra.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${ra.default.self}`,`${ra.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof qn.Name?void 0:m,items:h instanceof qn.Name?void 0:h,dynamicProps:m instanceof qn.Name,dynamicItems:h instanceof qn.Name},p.source&&(p.source.evaluated=(0,qn.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}_n.compileSchema=YP;function Qte(e,t,r){var i;r=(0,Fn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=rre.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:a}=this.opts;s&&(o=new vu({schema:s,schemaId:a,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=ere.call(this,o)}_n.resolveRef=Qte;function ere(e){return(0,Fn.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:YP.call(this,e)}function lU(e){for(let t of this._compilations)if(tre(t,e))return t}_n.getCompilingSchema=lU;function tre(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function rre(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||f$.call(this,e,t)}function f$(e,t){let r=this.opts.uriResolver.parse(t),i=(0,Fn._getFullPath)(this.opts.uriResolver,r),n=(0,Fn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return HP.call(this,r,e);let o=(0,Fn.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=f$.call(this,e,s);return typeof a?.schema!="object"?void 0:HP.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||YP.call(this,s),o===(0,Fn.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Fn.resolveUrl)(this.opts.uriResolver,n,u)),new vu({schema:a,schemaId:c,root:e,baseId:n})}return HP.call(this,r,s)}}_n.resolveSchema=f$;var nre=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function HP(e,{baseId:t,schema:r,root:i}){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,uU.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!nre.has(a)&&u&&(t=(0,Fn.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,uU.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Fn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=f$.call(this,i,a)}let{schemaId:s}=this.opts;if(o=o||new vu({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o}});var dU=S((B0e,ire)=>{ire.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 pU=S(XP=>{"use strict";Object.defineProperty(XP,"__esModule",{value:!0});var fU=mI();fU.code='require("ajv/dist/runtime/uri").default';XP.default=fU});var _U=S(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=void 0;var ore=Gf();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return ore.KeywordCxt}});var $u=we();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return $u._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return $u.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return $u.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return $u.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return $u.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return $u.CodeGen}});var sre=d$(),vU=Wf(),are=NP(),Jf=p$(),cre=we(),Hf=Vf(),m$=Zf(),eT=Le(),mU=dU(),ure=pU(),$U=(e,t)=>new RegExp(e,t);$U.code="new RegExp";var lre=["removeAdditional","useDefaults","coerceTypes"],dre=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),fre={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."},pre={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},hU=200;function mre(e){var t,r,i,n,o,s,a,c,u,l,d,f,p,m,h,g,y,v,$,_,w,k,T,C,D;let K=e.strict,V=(t=e.code)===null||t===void 0?void 0:t.optimize,te=V===!0||V===void 0?1:V||0,Oe=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:$U,_t=(n=e.uriResolver)!==null&&n!==void 0?n:ure.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:K)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:K)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:K)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:K)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:K)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:te,regExp:Oe}:{optimize:te,regExp:Oe},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:hU,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:hU,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(v=e.messages)!==null&&v!==void 0?v:!0,inlineRefs:($=e.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(_=e.schemaId)!==null&&_!==void 0?_:"$id",addUsedSchema:(w=e.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(k=e.validateSchema)!==null&&k!==void 0?k:!0,validateFormats:(T=e.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(C=e.unicodeRegExp)!==null&&C!==void 0?C:!0,int32range:(D=e.int32range)!==null&&D!==void 0?D:!0,uriResolver:_t}}var Yf=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,...mre(t)};let{es5:r,lines:i}=this.opts.code;this.scope=new cre.ValueScope({scope:{},prefixes:dre,es5:r,lines:i}),this.logger=bre(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,are.getRules)(),gU.call(this,fre,t,"NOT SUPPORTED"),gU.call(this,pre,t,"DEPRECATED","warn"),this._metaOpts=vre.call(this),t.formats&&gre.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&yre.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),hre.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:i}=this.opts,n=mU;i==="id"&&(n={...mU},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[i],!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 i;if(typeof t=="string"){if(i=this.getSchema(t),!i)throw new Error(`no schema with key or ref "${t}"`)}else i=this.compile(t);let n=i(r);return"$async"in i||(this.errors=i.errors),n}compile(t,r){let i=this._addSchema(t,r);return i.validate||this._compileSchemaEnv(i)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:i}=this.opts;return n.call(this,t,r);async function n(l,d){await o.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||s.call(this,f)}async function o(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof vU.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=i(l))}finally{delete this._loading[l]}}}addSchema(t,r,i,n=this.opts.validateSchema){if(Array.isArray(t)){for(let s of t)this.addSchema(s,void 0,i,n);return this}let o;if(typeof t=="object"){let{schemaId:s}=this.opts;if(o=t[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Hf.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,i,r,n,!0),this}addMetaSchema(t,r,i=this.opts.validateSchema){return this.addSchema(t,r,!0,i),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let i;if(i=t.$schema,i!==void 0&&typeof i!="string")throw new Error("$schema must be a string");if(i=i||this.opts.defaultMeta||this.defaultMeta(),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(i,t);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(t){let r;for(;typeof(r=yU.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:i}=this.opts,n=new Jf.SchemaEnv({schema:{},schemaId:i});if(r=Jf.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=yU.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 i=t[this.opts.schemaId];return i&&(i=(0,Hf.normalizeId)(i),delete this.schemas[i],delete this.refs[i]),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 i;if(typeof t=="string")i=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=i);else if(typeof t=="object"&&r===void 0){if(r=t,i=r.keyword,Array.isArray(i)&&!i.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(wre.call(this,i,r),!r)return(0,eT.eachItem)(i,o=>QP.call(this,o)),this;Sre.call(this,r);let n={...r,type:(0,m$.getJSONTypes)(r.type),schemaType:(0,m$.getJSONTypes)(r.schemaType)};return(0,eT.eachItem)(i,n.type.length===0?o=>QP.call(this,o,n):o=>n.type.forEach(s=>QP.call(this,o,n,s))),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 i of r.rules){let n=i.rules.findIndex(o=>o.keyword===t);n>=0&&i.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:i="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${i}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(t,r){let i=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let o=n.split("/").slice(1),s=t;for(let a of o)s=s[a];for(let a in i){let c=i[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=bU(l))}}return t}_removeAllSchemas(t,r){for(let i in t){let n=t[i];(!r||r.test(i))&&(typeof n=="string"?delete t[i]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[i]))}}_addSchema(t,r,i,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof t=="object")s=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;i=(0,Hf.normalizeId)(s||i);let u=Hf.getSchemaRefs.call(this,t,i);return c=new Jf.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:i,localRefs:u}),this._cache.set(c.schema,c),o&&!i.startsWith("#")&&(i&&this._checkUnique(i),this.refs[i]=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):Jf.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{Jf.compileSchema.call(this,t)}finally{this.opts=r}}};Yf.ValidationError=sre.default;Yf.MissingRefError=vU.default;Xt.default=Yf;function gU(e,t,r,i="error"){for(let n in e){let o=n;o in t&&this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function yU(e){return e=(0,Hf.normalizeId)(e),this.schemas[e]||this.refs[e]}function hre(){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 gre(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function yre(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 vre(){let e={...this.opts};for(let t of lre)delete e[t];return e}var $re={log(){},warn(){},error(){}};function bre(e){if(e===!1)return $re;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 _re=/^[a-z_$][a-z0-9_$:-]*$/i;function wre(e,t){let{RULES:r}=this;if((0,eT.eachItem)(e,i=>{if(r.keywords[i])throw new Error(`Keyword ${i} is already defined`);if(!_re.test(i))throw new Error(`Keyword ${i} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function QP(e,t,r){var i;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,m$.getJSONTypes)(t.type),schemaType:(0,m$.getJSONTypes)(t.schemaType)}};t.before?kre.call(this,s,a,t.before):s.rules.push(a),o.all[e]=a,(i=t.implements)===null||i===void 0||i.forEach(c=>this.addKeyword(c))}function kre(e,t,r){let i=e.rules.findIndex(n=>n.keyword===r);i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function Sre(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=bU(t)),e.validateSchema=this.compile(t,!0))}var xre={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function bU(e){return{anyOf:[e,xre]}}});var wU=S(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0});var Ire={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};tT.default=Ire});var IU=S(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});na.callRef=na.getValidate=void 0;var Pre=Wf(),kU=bn(),Zr=we(),bu=Li(),SU=p$(),h$=Le(),Tre={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:a,self:c}=i,{root:u}=o;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=SU.resolveRef.call(c,u,n,r);if(l===void 0)throw new Pre.default(i.opts.uriResolver,n,r);if(l instanceof SU.SchemaEnv)return f(l);return p(l);function d(){if(o===u)return g$(e,s,o,o.$async);let m=t.scopeValue("root",{ref:u});return g$(e,(0,Zr._)`${m}.validate`,u,u.$async)}function f(m){let h=xU(e,m);g$(e,h,m,m.$async)}function p(m){let h=t.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Zr.stringify)(m)}:{ref:m}),g=t.name("valid"),y=e.subschema({schema:m,dataTypes:[],schemaPath:Zr.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function xU(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Zr._)`${r.scopeValue("wrapper",{ref:t})}.validate`}na.getValidate=xU;function g$(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:a,opts:c}=o,u=c.passContext?bu.default.this:Zr.nil;i?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,Zr._)`await ${(0,kU.callValidateCode)(e,t,u)}`),p(t),s||n.assign(m,!0)},h=>{n.if((0,Zr._)`!(${h} instanceof ${o.ValidationError})`,()=>n.throw(h)),f(h),s||n.assign(m,!1)}),e.ok(m)}function d(){e.result((0,kU.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(m){let h=(0,Zr._)`${m}.errors`;n.assign(bu.default.vErrors,(0,Zr._)`${bu.default.vErrors} === null ? ${h} : ${bu.default.vErrors}.concat(${h})`),n.assign(bu.default.errors,(0,Zr._)`${bu.default.vErrors}.length`)}function p(m){var h;if(!o.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(o.props=h$.mergeEvaluated.props(n,g.props,o.props));else{let y=n.var("props",(0,Zr._)`${m}.evaluated.props`);o.props=h$.mergeEvaluated.props(n,y,o.props,Zr.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=h$.mergeEvaluated.items(n,g.items,o.items));else{let y=n.var("items",(0,Zr._)`${m}.evaluated.items`);o.items=h$.mergeEvaluated.items(n,y,o.items,Zr.Name)}}}na.callRef=g$;na.default=Tre});var PU=S(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});var Are=wU(),Rre=IU(),Ere=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Are.default,Rre.default];rT.default=Ere});var TU=S(nT=>{"use strict";Object.defineProperty(nT,"__esModule",{value:!0});var y$=we(),Co=y$.operators,v$={maximum:{okStr:"<=",ok:Co.LTE,fail:Co.GT},minimum:{okStr:">=",ok:Co.GTE,fail:Co.LT},exclusiveMaximum:{okStr:"<",ok:Co.LT,fail:Co.GTE},exclusiveMinimum:{okStr:">",ok:Co.GT,fail:Co.LTE}},Ore={message:({keyword:e,schemaCode:t})=>(0,y$.str)`must be ${v$[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,y$._)`{comparison: ${v$[e].okStr}, limit: ${t}}`},Nre={keyword:Object.keys(v$),type:"number",schemaType:"number",$data:!0,error:Ore,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data((0,y$._)`${r} ${v$[t].fail} ${i} || isNaN(${r})`)}};nT.default=Nre});var AU=S(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});var Xf=we(),Cre={message:({schemaCode:e})=>(0,Xf.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Xf._)`{multipleOf: ${e}}`},zre={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Cre,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),a=o?(0,Xf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Xf._)`${s} !== parseInt(${s})`;e.fail$data((0,Xf._)`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};iT.default=zre});var EU=S(oT=>{"use strict";Object.defineProperty(oT,"__esModule",{value:!0});function RU(e){let t=e.length,r=0,i=0,n;for(;i<t;)r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t&&(n=e.charCodeAt(i),(n&64512)===56320&&i++);return r}oT.default=RU;RU.code='require("ajv/dist/runtime/ucs2length").default'});var OU=S(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});var ia=we(),jre=Le(),Dre=EU(),Mre={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,ia.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,ia._)`{limit: ${e}}`},Lre={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Mre,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?ia.operators.GT:ia.operators.LT,s=n.opts.unicode===!1?(0,ia._)`${r}.length`:(0,ia._)`${(0,jre.useFunc)(e.gen,Dre.default)}(${r})`;e.fail$data((0,ia._)`${s} ${o} ${i}`)}};sT.default=Lre});var NU=S(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});var Ure=bn(),qre=Le(),_u=we(),Fre={message:({schemaCode:e})=>(0,_u.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,_u._)`{pattern: ${e}}`},Zre={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Fre,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?(0,_u._)`new RegExp`:(0,qre.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,_u._)`${u}(${o}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,_u._)`!${l}`)}else{let c=(0,Ure.usePattern)(e,n);e.fail$data((0,_u._)`!${c}.test(${r})`)}}};aT.default=Zre});var CU=S(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});var Qf=we(),Vre={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Qf.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Qf._)`{limit: ${e}}`},Bre={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Vre,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?Qf.operators.GT:Qf.operators.LT;e.fail$data((0,Qf._)`Object.keys(${r}).length ${n} ${i}`)}};cT.default=Bre});var zU=S(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});var ep=bn(),tp=we(),Kre=Le(),Gre={message:({params:{missingProperty:e}})=>(0,tp.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,tp._)`{missingProperty: ${e}}`},Wre={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Gre,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:a}=s;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let p=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let g=s.schemaEnv.baseId+s.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,Kre.checkStrictMode)(s,y,s.opts.strictRequired)}}function u(){if(c||o)e.block$data(tp.nil,d);else for(let p of r)(0,ep.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||o){let m=t.let("valid",!0);e.block$data(m,()=>f(p,m)),e.ok(m)}else t.if((0,ep.checkMissingProp)(e,r,p)),(0,ep.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",i,p=>{e.setParams({missingProperty:p}),t.if((0,ep.noPropertyInData)(t,n,p,a.ownProperties),()=>e.error())})}function f(p,m){e.setParams({missingProperty:p}),t.forOf(p,i,()=>{t.assign(m,(0,ep.propertyInData)(t,n,p,a.ownProperties)),t.if((0,tp.not)(m),()=>{e.error(),t.break()})},tp.nil)}}};uT.default=Wre});var jU=S(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});var rp=we(),Jre={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,rp.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,rp._)`{limit: ${e}}`},Hre={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Jre,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?rp.operators.GT:rp.operators.LT;e.fail$data((0,rp._)`${r}.length ${n} ${i}`)}};lT.default=Hre});var $$=S(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});var DU=mf();DU.code='require("ajv/dist/runtime/equal").default';dT.default=DU});var MU=S(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});var fT=Zf(),Qt=we(),Yre=Le(),Xre=$$(),Qre={message:({params:{i:e,j:t}})=>(0,Qt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Qt._)`{i: ${e}, j: ${t}}`},ene={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Qre,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=e;if(!i&&!n)return;let c=t.let("valid"),u=o.items?(0,fT.getSchemaTypes)(o.items):[];e.block$data(c,l,(0,Qt._)`${s} === false`),e.ok(c);function l(){let m=t.let("i",(0,Qt._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Qt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let g=t.name("item"),y=(0,fT.checkDataTypes)(u,g,a.opts.strictNumbers,fT.DataType.Wrong),v=t.const("indices",(0,Qt._)`{}`);t.for((0,Qt._)`;${m}--;`,()=>{t.let(g,(0,Qt._)`${r}[${m}]`),t.if(y,(0,Qt._)`continue`),u.length>1&&t.if((0,Qt._)`typeof ${g} == "string"`,(0,Qt._)`${g} += "_"`),t.if((0,Qt._)`typeof ${v}[${g}] == "number"`,()=>{t.assign(h,(0,Qt._)`${v}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,Qt._)`${v}[${g}] = ${m}`)})}function p(m,h){let g=(0,Yre.useFunc)(t,Xre.default),y=t.name("outer");t.label(y).for((0,Qt._)`;${m}--;`,()=>t.for((0,Qt._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Qt._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};pT.default=ene});var LU=S(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});var mT=we(),tne=Le(),rne=$$(),nne={message:"must be equal to constant",params:({schemaCode:e})=>(0,mT._)`{allowedValue: ${e}}`},ine={keyword:"const",$data:!0,error:nne,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;i||o&&typeof o=="object"?e.fail$data((0,mT._)`!${(0,tne.useFunc)(t,rne.default)}(${r}, ${n})`):e.fail((0,mT._)`${o} !== ${r}`)}};hT.default=ine});var UU=S(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});var np=we(),one=Le(),sne=$$(),ane={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,np._)`{allowedValues: ${e}}`},cne={keyword:"enum",schemaType:"array",$data:!0,error:ane,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,one.useFunc)(t,sne.default)),l;if(a||i)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let p=t.const("vSchema",o);l=(0,np.or)(...n.map((m,h)=>f(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",o,p=>t.if((0,np._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,m){let h=n[m];return typeof h=="object"&&h!==null?(0,np._)`${u()}(${r}, ${p}[${m}])`:(0,np._)`${r} === ${h}`}}};gT.default=cne});var qU=S(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});var une=TU(),lne=AU(),dne=OU(),fne=NU(),pne=CU(),mne=zU(),hne=jU(),gne=MU(),yne=LU(),vne=UU(),$ne=[une.default,lne.default,dne.default,fne.default,pne.default,mne.default,hne.default,gne.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},yne.default,vne.default];yT.default=$ne});var $T=S(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});ip.validateAdditionalItems=void 0;var oa=we(),vT=Le(),bne={message:({params:{len:e}})=>(0,oa.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,oa._)`{limit: ${e}}`},_ne={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:bne,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,vT.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}FU(e,i)}};function FU(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let a=r.const("len",(0,oa._)`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass((0,oa._)`${a} <= ${t.length}`);else if(typeof i=="object"&&!(0,vT.alwaysValidSchema)(s,i)){let u=r.var("valid",(0,oa._)`${a} <= ${t.length}`);r.if((0,oa.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:vT.Type.Num},u),s.allErrors||r.if((0,oa.not)(u),()=>r.break())})}}ip.validateAdditionalItems=FU;ip.default=_ne});var bT=S(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.validateTuple=void 0;var ZU=we(),b$=Le(),wne=bn(),kne={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return VU(e,"additionalItems",t);r.items=!0,!(0,b$.alwaysValidSchema)(r,t)&&e.ok((0,wne.validateArray)(e))}};function VU(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:a}=e;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=b$.mergeEvaluated.items(i,r.length,a.items));let c=i.name("valid"),u=i.const("len",(0,ZU._)`${o}.length`);r.forEach((d,f)=>{(0,b$.alwaysValidSchema)(a,d)||(i.if((0,ZU._)`${u} > ${f}`,()=>e.subschema({keyword:s,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(f.strictTuples&&!h){let g=`"${s}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,b$.checkStrictMode)(a,g,f.strictTuples)}}}op.validateTuple=VU;op.default=kne});var BU=S(_T=>{"use strict";Object.defineProperty(_T,"__esModule",{value:!0});var Sne=bT(),xne={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Sne.validateTuple)(e,"items")};_T.default=xne});var GU=S(wT=>{"use strict";Object.defineProperty(wT,"__esModule",{value:!0});var KU=we(),Ine=Le(),Pne=bn(),Tne=$T(),Ane={message:({params:{len:e}})=>(0,KU.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,KU._)`{limit: ${e}}`},Rne={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Ane,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;i.items=!0,!(0,Ine.alwaysValidSchema)(i,t)&&(n?(0,Tne.validateAdditionalItems)(e,n):e.ok((0,Pne.validateArray)(e)))}};wT.default=Rne});var WU=S(kT=>{"use strict";Object.defineProperty(kT,"__esModule",{value:!0});var wn=we(),_$=Le(),Ene={message:({params:{min:e,max:t}})=>t===void 0?(0,wn.str)`must contain at least ${e} valid item(s)`:(0,wn.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,wn._)`{minContains: ${e}}`:(0,wn._)`{minContains: ${e}, maxContains: ${t}}`},One={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Ene,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,a,{minContains:c,maxContains:u}=i;o.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=t.const("len",(0,wn._)`${n}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,_$.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,_$.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,_$.alwaysValidSchema)(o,r)){let h=(0,wn._)`${l} >= ${s}`;a!==void 0&&(h=(0,wn._)`${h} && ${l} <= ${a}`),e.pass(h);return}o.items=!0;let d=t.name("valid");a===void 0&&s===1?p(d,()=>t.if(d,()=>t.break())):s===0?(t.let(d,!0),a!==void 0&&t.if((0,wn._)`${n}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let h=t.name("_valid"),g=t.let("count",0);p(h,()=>t.if(h,()=>m(g)))}function p(h,g){t.forRange("i",0,l,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:_$.Type.Num,compositeRule:!0},h),g()})}function m(h){t.code((0,wn._)`${h}++`),a===void 0?t.if((0,wn._)`${h} >= ${s}`,()=>t.assign(d,!0).break()):(t.if((0,wn._)`${h} > ${a}`,()=>t.assign(d,!1).break()),s===1?t.assign(d,!0):t.if((0,wn._)`${h} >= ${s}`,()=>t.assign(d,!0)))}}};kT.default=One});var YU=S(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.validateSchemaDeps=pi.validatePropertyDeps=pi.error=void 0;var ST=we(),Nne=Le(),sp=bn();pi.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return(0,ST.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>(0,ST._)`{property: ${e},
|
|
14
|
+
missingProperty: ${i},
|
|
15
|
+
depsCount: ${t},
|
|
16
|
+
deps: ${r}}`};var Cne={keyword:"dependencies",type:"object",schemaType:"object",error:pi.error,code(e){let[t,r]=zne(e);JU(e,t),HU(e,r)}};function zne({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function JU(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,sp.propertyInData)(r,i,s,n.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,sp.checkReportMissingProp)(e,u)}):(r.if((0,ST._)`${c} && (${(0,sp.checkMissingProp)(e,a,o)})`),(0,sp.reportMissingProp)(e,o),r.else())}}pi.validatePropertyDeps=JU;function HU(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let a in t)(0,Nne.alwaysValidSchema)(o,t[a])||(r.if((0,sp.propertyInData)(r,i,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s))}pi.validateSchemaDeps=HU;pi.default=Cne});var QU=S(xT=>{"use strict";Object.defineProperty(xT,"__esModule",{value:!0});var XU=we(),jne=Le(),Dne={message:"property name must be valid",params:({params:e})=>(0,XU._)`{propertyName: ${e.propertyName}}`},Mne={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Dne,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,jne.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,XU.not)(o),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(o)}};xT.default=Mne});var PT=S(IT=>{"use strict";Object.defineProperty(IT,"__esModule",{value:!0});var w$=bn(),Zn=we(),Lne=Li(),k$=Le(),Une={message:"must NOT have additional properties",params:({params:e})=>(0,Zn._)`{additionalProperty: ${e.additionalProperty}}`},qne={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Une,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,k$.alwaysValidSchema)(s,r))return;let u=(0,w$.allSchemaProperties)(i.properties),l=(0,w$.allSchemaProperties)(i.patternProperties);d(),e.ok((0,Zn._)`${o} === ${Lne.default.errors}`);function d(){t.forIn("key",n,g=>{!u.length&&!l.length?m(g):t.if(f(g),()=>m(g))})}function f(g){let y;if(u.length>8){let v=(0,k$.schemaRefOrVal)(s,i.properties,"properties");y=(0,w$.isOwnProperty)(t,v,g)}else u.length?y=(0,Zn.or)(...u.map(v=>(0,Zn._)`${g} === ${v}`)):y=Zn.nil;return l.length&&(y=(0,Zn.or)(y,...l.map(v=>(0,Zn._)`${(0,w$.usePattern)(e,v)}.test(${g})`))),(0,Zn.not)(y)}function p(g){t.code((0,Zn._)`delete ${n}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,k$.alwaysValidSchema)(s,r)){let y=t.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),t.if((0,Zn.not)(y),()=>{e.reset(),p(g)})):(h(g,y),a||t.if((0,Zn.not)(y),()=>t.break()))}}function h(g,y,v){let $={keyword:"additionalProperties",dataProp:g,dataPropType:k$.Type.Str};v===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema($,y)}}};IT.default=qne});var r4=S(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0});var Fne=Gf(),e4=bn(),TT=Le(),t4=PT(),Zne={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&t4.default.code(new Fne.KeywordCxt(o,t4.default,"additionalProperties"));let s=(0,e4.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=TT.mergeEvaluated.props(t,(0,TT.toHash)(s),o.props));let a=s.filter(d=>!(0,TT.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,e4.propertyInData)(t,n,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};AT.default=Zne});var s4=S(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});var n4=bn(),S$=we(),i4=Le(),o4=Le(),Vne={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,a=(0,n4.allSchemaProperties)(r),c=a.filter(h=>(0,i4.alwaysValidSchema)(o,r[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&n.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof S$.Name)&&(o.props=(0,o4.evaluatedPropsToName)(t,o.props));let{props:d}=o;f();function f(){for(let h of a)u&&p(h),o.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function p(h){for(let g in u)new RegExp(h).test(g)&&(0,i4.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",i,g=>{t.if((0,S$._)`${(0,n4.usePattern)(e,h)}.test(${g})`,()=>{let y=c.includes(h);y||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:o4.Type.Str},l),o.opts.unevaluated&&d!==!0?t.assign((0,S$._)`${d}[${g}]`,!0):!y&&!o.allErrors&&t.if((0,S$.not)(l),()=>t.break())})})}}};RT.default=Vne});var a4=S(ET=>{"use strict";Object.defineProperty(ET,"__esModule",{value:!0});var Bne=Le(),Kne={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,Bne.alwaysValidSchema)(i,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"}};ET.default=Kne});var c4=S(OT=>{"use strict";Object.defineProperty(OT,"__esModule",{value:!0});var Gne=bn(),Wne={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Gne.validateUnion,error:{message:"must match a schema in anyOf"}};OT.default=Wne});var u4=S(NT=>{"use strict";Object.defineProperty(NT,"__esModule",{value:!0});var x$=we(),Jne=Le(),Hne={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,x$._)`{passingSchemas: ${e.passing}}`},Yne={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Hne,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((l,d)=>{let f;(0,Jne.alwaysValidSchema)(n,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,x$._)`${c} && ${s}`).assign(s,!1).assign(a,(0,x$._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,d),f&&e.mergeEvaluated(f,x$.Name)})})}}};NT.default=Yne});var l4=S(CT=>{"use strict";Object.defineProperty(CT,"__esModule",{value:!0});var Xne=Le(),Qne={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,Xne.alwaysValidSchema)(i,o))return;let a=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(a)})}};CT.default=Qne});var p4=S(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0});var I$=we(),f4=Le(),eie={message:({params:e})=>(0,I$.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,I$._)`{failingKeyword: ${e.ifClause}}`},tie={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:eie,code(e){let{gen:t,parentSchema:r,it:i}=e;r.then===void 0&&r.else===void 0&&(0,f4.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=d4(i,"then"),o=d4(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&o){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,I$.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},a);t.assign(s,a),e.mergeValidEvaluated(f,s),d?t.assign(d,(0,I$._)`${l}`):e.setParams({ifClause:l})}}}};function d4(e,t){let r=e.schema[t];return r!==void 0&&!(0,f4.alwaysValidSchema)(e,r)}zT.default=tie});var m4=S(jT=>{"use strict";Object.defineProperty(jT,"__esModule",{value:!0});var rie=Le(),nie={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,rie.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};jT.default=nie});var h4=S(DT=>{"use strict";Object.defineProperty(DT,"__esModule",{value:!0});var iie=$T(),oie=BU(),sie=bT(),aie=GU(),cie=WU(),uie=YU(),lie=QU(),die=PT(),fie=r4(),pie=s4(),mie=a4(),hie=c4(),gie=u4(),yie=l4(),vie=p4(),$ie=m4();function bie(e=!1){let t=[mie.default,hie.default,gie.default,yie.default,vie.default,$ie.default,lie.default,die.default,uie.default,fie.default,pie.default];return e?t.push(oie.default,aie.default):t.push(iie.default,sie.default),t.push(cie.default),t}DT.default=bie});var g4=S(MT=>{"use strict";Object.defineProperty(MT,"__esModule",{value:!0});var Rt=we(),_ie={message:({schemaCode:e})=>(0,Rt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Rt._)`{format: ${e}}`},wie={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:_ie,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Rt._)`${m}[${s}]`),g=r.let("fType"),y=r.let("format");r.if((0,Rt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,Rt._)`${h}.type || "string"`).assign(y,(0,Rt._)`${h}.validate`),()=>r.assign(g,(0,Rt._)`"string"`).assign(y,h)),e.fail$data((0,Rt.or)(v(),$()));function v(){return c.strictSchema===!1?Rt.nil:(0,Rt._)`${s} && !${y}`}function $(){let _=l.$async?(0,Rt._)`(${h}.async ? await ${y}(${i}) : ${y}(${i}))`:(0,Rt._)`${y}(${i})`,w=(0,Rt._)`(typeof ${y} == "function" ? ${_} : ${y}.test(${i}))`;return(0,Rt._)`${y} && ${y} !== true && ${g} === ${t} && !${w}`}}function p(){let m=d.formats[o];if(!m){v();return}if(m===!0)return;let[h,g,y]=$(m);h===t&&e.pass(_());function v(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function $(w){let k=w instanceof RegExp?(0,Rt.regexpCode)(w):c.code.formats?(0,Rt._)`${c.code.formats}${(0,Rt.getProperty)(o)}`:void 0,T=r.scopeValue("formats",{key:o,ref:w,code:k});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,Rt._)`${T}.validate`]:["string",w,T]}function _(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Rt._)`await ${y}(${i})`}return typeof g=="function"?(0,Rt._)`${y}(${i})`:(0,Rt._)`${y}.test(${i})`}}}};MT.default=wie});var y4=S(LT=>{"use strict";Object.defineProperty(LT,"__esModule",{value:!0});var kie=g4(),Sie=[kie.default];LT.default=Sie});var v4=S(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.contentVocabulary=wu.metadataVocabulary=void 0;wu.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];wu.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var b4=S(UT=>{"use strict";Object.defineProperty(UT,"__esModule",{value:!0});var xie=PU(),Iie=qU(),Pie=h4(),Tie=y4(),$4=v4(),Aie=[xie.default,Iie.default,(0,Pie.default)(),Tie.default,$4.metadataVocabulary,$4.contentVocabulary];UT.default=Aie});var w4=S(P$=>{"use strict";Object.defineProperty(P$,"__esModule",{value:!0});P$.DiscrError=void 0;var _4;(function(e){e.Tag="tag",e.Mapping="mapping"})(_4||(P$.DiscrError=_4={}))});var S4=S(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0});var ku=we(),qT=w4(),k4=p$(),Rie=Wf(),Eie=Le(),Oie={message:({params:{discrError:e,tagName:t}})=>e===qT.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,ku._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Nie={keyword:"discriminator",type:"object",schemaType:"object",error:Oie,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=i.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,ku._)`${r}${(0,ku.getProperty)(a)}`);t.if((0,ku._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:qT.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let p=f();t.if(!1);for(let m in p)t.elseIf((0,ku._)`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:qT.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(p){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(h,ku.Name),m}function f(){var p;let m={},h=y(n),g=!0;for(let _=0;_<s.length;_++){let w=s[_];if(w?.$ref&&!(0,Eie.schemaHasRulesButRef)(w,o.self.RULES)){let T=w.$ref;if(w=k4.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,T),w instanceof k4.SchemaEnv&&(w=w.schema),w===void 0)throw new Rie.default(o.opts.uriResolver,o.baseId,T)}let k=(p=w?.properties)===null||p===void 0?void 0:p[a];if(typeof k!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||y(w)),v(k,_)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return m;function y({required:_}){return Array.isArray(_)&&_.includes(a)}function v(_,w){if(_.const)$(_.const,w);else if(_.enum)for(let k of _.enum)$(k,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function $(_,w){if(typeof _!="string"||_ in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[_]=w}}}};FT.default=Nie});var x4=S((Nxe,Cie)=>{Cie.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 P4=S((ht,ZT)=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.MissingRefError=ht.ValidationError=ht.CodeGen=ht.Name=ht.nil=ht.stringify=ht.str=ht._=ht.KeywordCxt=ht.Ajv=void 0;var zie=_U(),jie=b4(),Die=S4(),I4=x4(),Mie=["/properties"],T$="http://json-schema.org/draft-07/schema",Su=class extends zie.default{_addVocabularies(){super._addVocabularies(),jie.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Die.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(I4,Mie):I4;this.addMetaSchema(t,T$,!1),this.refs["http://json-schema.org/schema"]=T$}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(T$)?T$:void 0)}};ht.Ajv=Su;ZT.exports=ht=Su;ZT.exports.Ajv=Su;Object.defineProperty(ht,"__esModule",{value:!0});ht.default=Su;var Lie=Gf();Object.defineProperty(ht,"KeywordCxt",{enumerable:!0,get:function(){return Lie.KeywordCxt}});var xu=we();Object.defineProperty(ht,"_",{enumerable:!0,get:function(){return xu._}});Object.defineProperty(ht,"str",{enumerable:!0,get:function(){return xu.str}});Object.defineProperty(ht,"stringify",{enumerable:!0,get:function(){return xu.stringify}});Object.defineProperty(ht,"nil",{enumerable:!0,get:function(){return xu.nil}});Object.defineProperty(ht,"Name",{enumerable:!0,get:function(){return xu.Name}});Object.defineProperty(ht,"CodeGen",{enumerable:!0,get:function(){return xu.CodeGen}});var Uie=d$();Object.defineProperty(ht,"ValidationError",{enumerable:!0,get:function(){return Uie.default}});var qie=Wf();Object.defineProperty(ht,"MissingRefError",{enumerable:!0,get:function(){return qie.default}})});var T4=S(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.formatLimitDefinition=void 0;var Fie=P4(),Vn=we(),zo=Vn.operators,A$={formatMaximum:{okStr:"<=",ok:zo.LTE,fail:zo.GT},formatMinimum:{okStr:">=",ok:zo.GTE,fail:zo.LT},formatExclusiveMaximum:{okStr:"<",ok:zo.LT,fail:zo.GTE},formatExclusiveMinimum:{okStr:">",ok:zo.GT,fail:zo.LTE}},Zie={message:({keyword:e,schemaCode:t})=>(0,Vn.str)`should be ${A$[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Vn._)`{comparison: ${A$[e].okStr}, limit: ${t}}`};Iu.formatLimitDefinition={keyword:Object.keys(A$),type:"string",schemaType:"string",$data:!0,error:Zie,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:a}=o;if(!s.validateFormats)return;let c=new Fie.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),p=t.const("fmt",(0,Vn._)`${f}[${c.schemaCode}]`);e.fail$data((0,Vn.or)((0,Vn._)`typeof ${p} != "object"`,(0,Vn._)`${p} instanceof RegExp`,(0,Vn._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${n}": format "${f}" does not define "compare" function`);let m=t.scopeValue("formats",{key:f,ref:p,code:s.code.formats?(0,Vn._)`${s.code.formats}${(0,Vn.getProperty)(f)}`:void 0});e.fail$data(d(m))}function d(f){return(0,Vn._)`${f}.compare(${r}, ${i}) ${A$[n].fail} 0`}},dependencies:["format"]};var Vie=e=>(e.addKeyword(Iu.formatLimitDefinition),e);Iu.default=Vie});var O4=S((ap,E4)=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});var Pu=pL(),Bie=T4(),VT=we(),A4=new VT.Name("fullFormats"),Kie=new VT.Name("fastFormats"),BT=(e,t={keywords:!0})=>{if(Array.isArray(t))return R4(e,t,Pu.fullFormats,A4),e;let[r,i]=t.mode==="fast"?[Pu.fastFormats,Kie]:[Pu.fullFormats,A4],n=t.formats||Pu.formatNames;return R4(e,n,r,i),t.keywords&&(0,Bie.default)(e),e};BT.get=(e,t="full")=>{let i=(t==="fast"?Pu.fastFormats:Pu.fullFormats)[e];if(!i)throw new Error(`Unknown format "${e}"`);return i};function R4(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=(0,VT._)`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}E4.exports=ap=BT;Object.defineProperty(ap,"__esModule",{value:!0});ap.default=BT});var qe=S(er=>{"use strict";var HT=Symbol.for("yaml.alias"),H4=Symbol.for("yaml.document"),z$=Symbol.for("yaml.map"),Y4=Symbol.for("yaml.pair"),YT=Symbol.for("yaml.scalar"),j$=Symbol.for("yaml.seq"),qi=Symbol.for("yaml.node.type"),noe=e=>!!e&&typeof e=="object"&&e[qi]===HT,ioe=e=>!!e&&typeof e=="object"&&e[qi]===H4,ooe=e=>!!e&&typeof e=="object"&&e[qi]===z$,soe=e=>!!e&&typeof e=="object"&&e[qi]===Y4,X4=e=>!!e&&typeof e=="object"&&e[qi]===YT,aoe=e=>!!e&&typeof e=="object"&&e[qi]===j$;function Q4(e){if(e&&typeof e=="object")switch(e[qi]){case z$:case j$:return!0}return!1}function coe(e){if(e&&typeof e=="object")switch(e[qi]){case HT:case z$:case YT:case j$:return!0}return!1}var uoe=e=>(X4(e)||Q4(e))&&!!e.anchor;er.ALIAS=HT;er.DOC=H4;er.MAP=z$;er.NODE_TYPE=qi;er.PAIR=Y4;er.SCALAR=YT;er.SEQ=j$;er.hasAnchor=uoe;er.isAlias=noe;er.isCollection=Q4;er.isDocument=ioe;er.isMap=ooe;er.isNode=coe;er.isPair=soe;er.isScalar=X4;er.isSeq=aoe});var up=S(XT=>{"use strict";var Lt=qe(),Vr=Symbol("break visit"),eq=Symbol("skip children"),mi=Symbol("remove node");function D$(e,t){let r=tq(t);Lt.isDocument(e)?Tu(null,e.contents,r,Object.freeze([e]))===mi&&(e.contents=null):Tu(null,e,r,Object.freeze([]))}D$.BREAK=Vr;D$.SKIP=eq;D$.REMOVE=mi;function Tu(e,t,r,i){let n=rq(e,t,r,i);if(Lt.isNode(n)||Lt.isPair(n))return nq(e,i,n),Tu(e,n,r,i);if(typeof n!="symbol"){if(Lt.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=Tu(o,t.items[o],r,i);if(typeof s=="number")o=s-1;else{if(s===Vr)return Vr;s===mi&&(t.items.splice(o,1),o-=1)}}}else if(Lt.isPair(t)){i=Object.freeze(i.concat(t));let o=Tu("key",t.key,r,i);if(o===Vr)return Vr;o===mi&&(t.key=null);let s=Tu("value",t.value,r,i);if(s===Vr)return Vr;s===mi&&(t.value=null)}}return n}async function M$(e,t){let r=tq(t);Lt.isDocument(e)?await Au(null,e.contents,r,Object.freeze([e]))===mi&&(e.contents=null):await Au(null,e,r,Object.freeze([]))}M$.BREAK=Vr;M$.SKIP=eq;M$.REMOVE=mi;async function Au(e,t,r,i){let n=await rq(e,t,r,i);if(Lt.isNode(n)||Lt.isPair(n))return nq(e,i,n),Au(e,n,r,i);if(typeof n!="symbol"){if(Lt.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=await Au(o,t.items[o],r,i);if(typeof s=="number")o=s-1;else{if(s===Vr)return Vr;s===mi&&(t.items.splice(o,1),o-=1)}}}else if(Lt.isPair(t)){i=Object.freeze(i.concat(t));let o=await Au("key",t.key,r,i);if(o===Vr)return Vr;o===mi&&(t.key=null);let s=await Au("value",t.value,r,i);if(s===Vr)return Vr;s===mi&&(t.value=null)}}return n}function tq(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function rq(e,t,r,i){if(typeof r=="function")return r(e,t,i);if(Lt.isMap(t))return r.Map?.(e,t,i);if(Lt.isSeq(t))return r.Seq?.(e,t,i);if(Lt.isPair(t))return r.Pair?.(e,t,i);if(Lt.isScalar(t))return r.Scalar?.(e,t,i);if(Lt.isAlias(t))return r.Alias?.(e,t,i)}function nq(e,t,r){let i=t[t.length-1];if(Lt.isCollection(i))i.items[e]=r;else if(Lt.isPair(i))e==="key"?i.key=r:i.value=r;else if(Lt.isDocument(i))i.contents=r;else{let n=Lt.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}XT.visit=D$;XT.visitAsync=M$});var QT=S(oq=>{"use strict";var iq=qe(),loe=up(),doe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},foe=e=>e.replace(/[!,[\]{}]/g,t=>doe[t]),lp=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${n}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,i,n]=t.match(/^(.*!)([^!]*)$/s);n||r(`The ${t} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(n)}catch(s){return r(String(s)),null}return i==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,i]of Object.entries(this.tags))if(t.startsWith(i))return r+foe(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(t&&i.length>0&&iq.isNode(t.contents)){let o={};loe.visit(t.contents,(s,a)=>{iq.isNode(a)&&a.tag&&(o[a.tag]=!0)}),n=Object.keys(o)}else n=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||n.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(`
|
|
17
|
+
`)}};lp.defaultYaml={explicit:!1,version:"1.2"};lp.defaultTags={"!!":"tag:yaml.org,2002:"};oq.Directives=lp});var L$=S(dp=>{"use strict";var sq=qe(),poe=up();function moe(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function aq(e){let t=new Set;return poe.visit(e,{Value(r,i){i.anchor&&t.add(i.anchor)}}),t}function cq(e,t){for(let r=1;;++r){let i=`${e}${r}`;if(!t.has(i))return i}}function hoe(e,t){let r=[],i=new Map,n=null;return{onAnchor:o=>{r.push(o),n??(n=aq(e));let s=cq(t,n);return n.add(s),s},setAnchors:()=>{for(let o of r){let s=i.get(o);if(typeof s=="object"&&s.anchor&&(sq.isScalar(s.node)||sq.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:i}}dp.anchorIsValid=moe;dp.anchorNames=aq;dp.createNodeAnchors=hoe;dp.findNewAnchor=cq});var eA=S(uq=>{"use strict";function fp(e,t,r,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,o=i.length;n<o;++n){let s=i[n],a=fp(e,i,String(n),s);a===void 0?delete i[n]:a!==s&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let o=i.get(n),s=fp(e,i,n,o);s===void 0?i.delete(n):s!==o&&i.set(n,s)}else if(i instanceof Set)for(let n of Array.from(i)){let o=fp(e,i,n,n);o===void 0?i.delete(n):o!==n&&(i.delete(n),i.add(o))}else for(let[n,o]of Object.entries(i)){let s=fp(e,i,n,o);s===void 0?delete i[n]:s!==o&&(i[n]=s)}return e.call(t,r,i)}uq.applyReviver=fp});var Mo=S(dq=>{"use strict";var goe=qe();function lq(e,t,r){if(Array.isArray(e))return e.map((i,n)=>lq(i,String(n),r));if(e&&typeof e.toJSON=="function"){if(!r||!goe.hasAnchor(e))return e.toJSON(t,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=o=>{i.res=o,delete r.onCreate};let n=e.toJSON(t,r);return r.onCreate&&r.onCreate(n),n}return typeof e=="bigint"&&!r?.keep?Number(e):e}dq.toJS=lq});var U$=S(pq=>{"use strict";var yoe=eA(),fq=qe(),voe=Mo(),tA=class{constructor(t){Object.defineProperty(this,fq.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:i,onAnchor:n,reviver:o}={}){if(!fq.isDocument(t))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=voe.toJS(this,"",s);if(typeof n=="function")for(let{count:c,res:u}of s.anchors.values())n(u,c);return typeof o=="function"?yoe.applyReviver(o,{"":a},"",a):a}};pq.NodeBase=tA});var pp=S(mq=>{"use strict";var $oe=L$(),boe=up(),Ru=qe(),_oe=U$(),woe=Mo(),rA=class extends _oe.NodeBase{constructor(t){super(Ru.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;r?.aliasResolveCache?i=r.aliasResolveCache:(i=[],boe.visit(t,{Node:(o,s)=>{(Ru.isAlias(s)||Ru.hasAnchor(s))&&i.push(s)}}),r&&(r.aliasResolveCache=i));let n;for(let o of i){if(o===this)break;o.anchor===this.source&&(n=o)}if(n&&r){let{anchors:o,doc:s,maxAliasCount:a}=r,c=o.get(n);if(c||(woe.toJS(n,null,r),c=o.get(n)),c?.res===void 0){let u="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(u)}if(a>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=q$(s,n,o)),c.count*c.aliasCount>a)){let u="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(u)}}return n}toJSON(t,r){if(!r)return{source:this.source};let i=this.resolve(r.doc,r);if(!i){let n=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(n)}return r.anchors.get(i).res}toString(t,r,i){let n=`*${this.source}`;if(t){if($oe.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(t.implicitKey)return`${n} `}return n}};function q$(e,t,r){if(Ru.isAlias(t)){let i=t.resolve(e),n=r&&i&&r.get(i);return n?n.count*n.aliasCount:0}else if(Ru.isCollection(t)){let i=0;for(let n of t.items){let o=q$(e,n,r);o>i&&(i=o)}return i}else if(Ru.isPair(t)){let i=q$(e,t.key,r),n=q$(e,t.value,r);return Math.max(i,n)}return 1}mq.Alias=rA});var Ot=S(nA=>{"use strict";var koe=qe(),Soe=U$(),xoe=Mo(),Ioe=e=>!e||typeof e!="function"&&typeof e!="object",Lo=class extends Soe.NodeBase{constructor(t){super(koe.SCALAR),this.value=t}toJSON(t,r){return r?.keep?this.value:xoe.toJS(this.value,t,r)}toString(){return String(this.value)}};Lo.BLOCK_FOLDED="BLOCK_FOLDED";Lo.BLOCK_LITERAL="BLOCK_LITERAL";Lo.PLAIN="PLAIN";Lo.QUOTE_DOUBLE="QUOTE_DOUBLE";Lo.QUOTE_SINGLE="QUOTE_SINGLE";nA.Scalar=Lo;nA.isScalarValue=Ioe});var mp=S(gq=>{"use strict";var Poe=pp(),sa=qe(),hq=Ot(),Toe="tag:yaml.org,2002:";function Aoe(e,t,r){if(t){let i=r.filter(o=>o.tag===t),n=i.find(o=>!o.format)??i[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return r.find(i=>i.identify?.(e)&&!i.format)}function Roe(e,t,r){if(sa.isDocument(e)&&(e=e.contents),sa.isNode(e))return e;if(sa.isPair(e)){let d=r.schema[sa.MAP].createNode?.(r.schema,null,r);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:o,schema:s,sourceObjects:a}=r,c;if(i&&e&&typeof e=="object"){if(c=a.get(e),c)return c.anchor??(c.anchor=n(e)),new Poe.Alias(c.anchor);c={anchor:null,node:null},a.set(e,c)}t?.startsWith("!!")&&(t=Toe+t.slice(2));let u=Aoe(e,t,s.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new hq.Scalar(e);return c&&(c.node=d),d}u=e instanceof Map?s[sa.MAP]:Symbol.iterator in Object(e)?s[sa.SEQ]:s[sa.MAP]}o&&(o(u),delete r.onTagObj);let l=u?.createNode?u.createNode(r.schema,e,r):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(r.schema,e,r):new hq.Scalar(e);return t?l.tag=t:u.default||(l.tag=u.tag),c&&(c.node=l),l}gq.createNode=Roe});var Z$=S(F$=>{"use strict";var Eoe=mp(),hi=qe(),Ooe=U$();function iA(e,t,r){let i=r;for(let n=t.length-1;n>=0;--n){let o=t[n];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=i,i=s}else i=new Map([[o,i]])}return Eoe.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var yq=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,oA=class extends Ooe.NodeBase{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(i=>hi.isNode(i)||hi.isPair(i)?i.clone(t):i),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(yq(t))this.add(r);else{let[i,...n]=t,o=this.get(i,!0);if(hi.isCollection(o))o.addIn(n,r);else if(o===void 0&&this.schema)this.set(i,iA(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(t){let[r,...i]=t;if(i.length===0)return this.delete(r);let n=this.get(r,!0);if(hi.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}getIn(t,r){let[i,...n]=t,o=this.get(i,!0);return n.length===0?!r&&hi.isScalar(o)?o.value:o:hi.isCollection(o)?o.getIn(n,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!hi.isPair(r))return!1;let i=r.value;return i==null||t&&hi.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[r,...i]=t;if(i.length===0)return this.has(r);let n=this.get(r,!0);return hi.isCollection(n)?n.hasIn(i):!1}setIn(t,r){let[i,...n]=t;if(n.length===0)this.set(i,r);else{let o=this.get(i,!0);if(hi.isCollection(o))o.setIn(n,r);else if(o===void 0&&this.schema)this.set(i,iA(this.schema,n,r));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};F$.Collection=oA;F$.collectionFromPath=iA;F$.isEmptyPath=yq});var hp=S(V$=>{"use strict";var Noe=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function sA(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Coe=(e,t,r)=>e.endsWith(`
|
|
18
|
+
`)?sA(r,t):r.includes(`
|
|
19
|
+
`)?`
|
|
20
|
+
`+sA(r,t):(e.endsWith(" ")?"":" ")+r;V$.indentComment=sA;V$.lineComment=Coe;V$.stringifyComment=Noe});var $q=S(gp=>{"use strict";var zoe="flow",aA="block",B$="quoted";function joe(e,t,r="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!n||n<0)return e;n<o&&(o=0);let c=Math.max(1+o,1+n-t.length);if(e.length<=c)return e;let u=[],l={},d=n-t.length;typeof i=="number"&&(i>n-Math.max(2,o)?u.push(0):d=n-i);let f,p,m=!1,h=-1,g=-1,y=-1;r===aA&&(h=vq(e,h,t.length),h!==-1&&(d=h+c));for(let $;$=e[h+=1];){if(r===B$&&$==="\\"){switch(g=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if($===`
|
|
21
|
+
`)r===aA&&(h=vq(e,h,t.length)),d=h+t.length+c,f=void 0;else{if($===" "&&p&&p!==" "&&p!==`
|
|
22
|
+
`&&p!==" "){let _=e[h+1];_&&_!==" "&&_!==`
|
|
23
|
+
`&&_!==" "&&(f=h)}if(h>=d)if(f)u.push(f),d=f+c,f=void 0;else if(r===B$){for(;p===" "||p===" ";)p=$,$=e[h+=1],m=!0;let _=h>y+1?h-2:g-1;if(l[_])return e;u.push(_),l[_]=!0,d=_+c,f=void 0}else m=!0}p=$}if(m&&a&&a(),u.length===0)return e;s&&s();let v=e.slice(0,u[0]);for(let $=0;$<u.length;++$){let _=u[$],w=u[$+1]||e.length;_===0?v=`
|
|
24
|
+
${t}${e.slice(0,w)}`:(r===B$&&l[_]&&(v+=`${e[_]}\\`),v+=`
|
|
25
|
+
${t}${e.slice(_+1,w)}`)}return v}function vq(e,t,r){let i=t,n=t+1,o=e[n];for(;o===" "||o===" ";)if(t<n+r)o=e[++t];else{do o=e[++t];while(o&&o!==`
|
|
26
|
+
`);i=t,n=t+1,o=e[n]}return i}gp.FOLD_BLOCK=aA;gp.FOLD_FLOW=zoe;gp.FOLD_QUOTED=B$;gp.foldFlowLines=joe});var vp=S(bq=>{"use strict";var Bn=Ot(),Uo=$q(),G$=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),W$=e=>/^(%|---|\.\.\.)/m.test(e);function Doe(e,t,r){if(!t||t<0)return!1;let i=t-r,n=e.length;if(n<=i)return!1;for(let o=0,s=0;o<n;++o)if(e[o]===`
|
|
27
|
+
`){if(o-s>i)return!0;if(s=o+1,n-s<=i)return!1}return!0}function yp(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,n=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(W$(e)?" ":""),s="",a=0;for(let c=0,u=r[c];u;u=r[++c])if(u===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,u="\\"),u==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let l=r.substr(c+2,4);switch(l){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:l.substr(0,2)==="00"?s+="\\x"+l.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(i||r[c+2]==='"'||r.length<n)c+=1;else{for(s+=r.slice(a,c)+`
|
|
28
|
+
|
|
29
|
+
`;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)s+=`
|
|
30
|
+
`,c+=2;s+=o,r[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+r.slice(a):r,i?s:Uo.foldFlowLines(s,o,Uo.FOLD_QUOTED,G$(t,!1))}function cA(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
31
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return yp(e,t);let r=t.indent||(W$(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
32
|
+
${r}`)+"'";return t.implicitKey?i:Uo.foldFlowLines(i,r,Uo.FOLD_FLOW,G$(t,!1))}function Eu(e,t){let{singleQuote:r}=t.options,i;if(r===!1)i=yp;else{let n=e.includes('"'),o=e.includes("'");n&&!o?i=cA:o&&!n?i=yp:i=r?cA:yp}return i(e,t)}var uA;try{uA=new RegExp(`(^|(?<!
|
|
33
|
+
))
|
|
34
|
+
+(?!
|
|
35
|
+
|$)`,"g")}catch{uA=/\n+(?!\n|$)/g}function K$({comment:e,type:t,value:r},i,n,o){let{blockQuote:s,commentString:a,lineWidth:c}=i.options;if(!s||/\n[\t ]+$/.test(r))return Eu(r,i);let u=i.indent||(i.forceBlockIndent||W$(r)?" ":""),l=s==="literal"?!0:s==="folded"||t===Bn.Scalar.BLOCK_FOLDED?!1:t===Bn.Scalar.BLOCK_LITERAL?!0:!Doe(r,c,u.length);if(!r)return l?`|
|
|
36
|
+
`:`>
|
|
37
|
+
`;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==`
|
|
38
|
+
`&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(`
|
|
39
|
+
`);m===-1?d="-":r===p||m!==p.length-1?(d="+",o&&o()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===`
|
|
40
|
+
`&&(p=p.slice(0,-1)),p=p.replace(uA,`$&${u}`));let h=!1,g,y=-1;for(g=0;g<r.length;++g){let w=r[g];if(w===" ")h=!0;else if(w===`
|
|
41
|
+
`)y=g;else break}let v=r.substring(0,y<g?y+1:g);v&&(r=r.substring(v.length),v=v.replace(/\n+/g,`$&${u}`));let _=(h?u?"2":"1":"")+d;if(e&&(_+=" "+a(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!l){let w=r.replace(/\n+/g,`
|
|
42
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),k=!1,T=G$(i,!0);s!=="folded"&&t!==Bn.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{k=!0});let C=Uo.foldFlowLines(`${v}${w}${p}`,u,Uo.FOLD_BLOCK,T);if(!k)return`>${_}
|
|
43
|
+
${u}${C}`}return r=r.replace(/\n+/g,`$&${u}`),`|${_}
|
|
44
|
+
${u}${v}${r}${p}`}function Moe(e,t,r,i){let{type:n,value:o}=e,{actualString:s,implicitKey:a,indent:c,indentStep:u,inFlow:l}=t;if(a&&o.includes(`
|
|
45
|
+
`)||l&&/[[\]{},]/.test(o))return Eu(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||l||!o.includes(`
|
|
46
|
+
`)?Eu(o,t):K$(e,t,r,i);if(!a&&!l&&n!==Bn.Scalar.PLAIN&&o.includes(`
|
|
47
|
+
`))return K$(e,t,r,i);if(W$(o)){if(c==="")return t.forceBlockIndent=!0,K$(e,t,r,i);if(a&&c===u)return Eu(o,t)}let d=o.replace(/\n+/g,`$&
|
|
48
|
+
${c}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=t.doc.schema;if(m.some(f)||p?.some(f))return Eu(o,t)}return a?d:Uo.foldFlowLines(d,c,Uo.FOLD_FLOW,G$(t,!1))}function Loe(e,t,r,i){let{implicitKey:n,inFlow:o}=t,s=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==Bn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Bn.Scalar.QUOTE_DOUBLE);let c=l=>{switch(l){case Bn.Scalar.BLOCK_FOLDED:case Bn.Scalar.BLOCK_LITERAL:return n||o?Eu(s.value,t):K$(s,t,r,i);case Bn.Scalar.QUOTE_DOUBLE:return yp(s.value,t);case Bn.Scalar.QUOTE_SINGLE:return cA(s.value,t);case Bn.Scalar.PLAIN:return Moe(s,t,r,i);default:return null}},u=c(a);if(u===null){let{defaultKeyType:l,defaultStringType:d}=t.options,f=n&&l||d;if(u=c(f),u===null)throw new Error(`Unsupported default string type ${f}`)}return u}bq.stringifyString=Loe});var $p=S(lA=>{"use strict";var Uoe=L$(),qo=qe(),qoe=hp(),Foe=vp();function Zoe(e,t){let r=Object.assign({blockQuote:!0,commentString:qoe.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(r.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:i,options:r}}function Voe(e,t){if(t.tag){let n=e.filter(o=>o.tag===t.tag);if(n.length>0)return n.find(o=>o.format===t.format)??n[0]}let r,i;if(qo.isScalar(t)){i=t.value;let n=e.filter(o=>o.identify?.(i));if(n.length>1){let o=n.filter(s=>s.test);o.length>0&&(n=o)}r=n.find(o=>o.format===t.format)??n.find(o=>!o.format)}else i=t,r=e.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!r){let n=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${n} value`)}return r}function Boe(e,t,{anchors:r,doc:i}){if(!i.directives)return"";let n=[],o=(qo.isScalar(e)||qo.isCollection(e))&&e.anchor;o&&Uoe.anchorIsValid(o)&&(r.add(o),n.push(`&${o}`));let s=e.tag??(t.default?null:t.tag);return s&&n.push(i.directives.tagString(s)),n.join(" ")}function Koe(e,t,r,i){if(qo.isPair(e))return e.toString(t,r,i);if(qo.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,o=qo.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>n=c});n??(n=Voe(t.doc.schema.tags,o));let s=Boe(o,n,t);s.length>0&&(t.indentAtStart=(t.indentAtStart??0)+s.length+1);let a=typeof n.stringify=="function"?n.stringify(o,t,r,i):qo.isScalar(o)?Foe.stringifyString(o,t,r,i):o.toString(t,r,i);return s?qo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
49
|
+
${t.indent}${a}`:a}lA.createStringifyContext=Zoe;lA.stringify=Koe});var Sq=S(kq=>{"use strict";var Fi=qe(),_q=Ot(),wq=$p(),bp=hp();function Goe({key:e,value:t},r,i,n){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:u,indentSeq:l,simpleKeys:d}}=r,f=Fi.isNode(e)&&e.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Fi.isCollection(e)||!Fi.isNode(e)&&typeof e=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!d&&(!e||f&&t==null&&!r.inFlow||Fi.isCollection(e)||(Fi.isScalar(e)?e.type===_q.Scalar.BLOCK_FOLDED||e.type===_q.Scalar.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!o),indent:a+c});let m=!1,h=!1,g=wq.stringify(e,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(o||t==null)return m&&i&&i(),g===""?"?":p?`? ${g}`:g}else if(o&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=bp.lineComment(g,r.indent,u(f)):h&&n&&n(),g;m&&(f=null),p?(f&&(g+=bp.lineComment(g,r.indent,u(f))),g=`? ${g}
|
|
50
|
+
${a}:`):(g=`${g}:`,f&&(g+=bp.lineComment(g,r.indent,u(f))));let y,v,$;Fi.isNode(t)?(y=!!t.spaceBefore,v=t.commentBefore,$=t.comment):(y=!1,v=null,$=null,t&&typeof t=="object"&&(t=s.createNode(t))),r.implicitKey=!1,!p&&!f&&Fi.isScalar(t)&&(r.indentAtStart=g.length+1),h=!1,!l&&c.length>=2&&!r.inFlow&&!p&&Fi.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let _=!1,w=wq.stringify(t,r,()=>_=!0,()=>h=!0),k=" ";if(f||y||v){if(k=y?`
|
|
51
|
+
`:"",v){let T=u(v);k+=`
|
|
52
|
+
${bp.indentComment(T,r.indent)}`}w===""&&!r.inFlow?k===`
|
|
53
|
+
`&&$&&(k=`
|
|
54
|
+
|
|
55
|
+
`):k+=`
|
|
56
|
+
${r.indent}`}else if(!p&&Fi.isCollection(t)){let T=w[0],C=w.indexOf(`
|
|
57
|
+
`),D=C!==-1,K=r.inFlow??t.flow??t.items.length===0;if(D||!K){let V=!1;if(D&&(T==="&"||T==="!")){let te=w.indexOf(" ");T==="&"&&te!==-1&&te<C&&w[te+1]==="!"&&(te=w.indexOf(" ",te+1)),(te===-1||C<te)&&(V=!0)}V||(k=`
|
|
58
|
+
${r.indent}`)}}else(w===""||w[0]===`
|
|
59
|
+
`)&&(k="");return g+=k+w,r.inFlow?_&&i&&i():$&&!_?g+=bp.lineComment(g,r.indent,u($)):h&&n&&n(),g}kq.stringifyPair=Goe});var fA=S(dA=>{"use strict";var xq=Pm("process");function Woe(e,...t){e==="debug"&&console.log(...t)}function Joe(e,t){(e==="debug"||e==="warn")&&(typeof xq.emitWarning=="function"?xq.emitWarning(t):console.warn(t))}dA.debug=Woe;dA.warn=Joe});var Q$=S(X$=>{"use strict";var Y$=qe(),Iq=Ot(),J$="<<",H$={identify:e=>e===J$||typeof e=="symbol"&&e.description===J$,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Iq.Scalar(Symbol(J$)),{addToJSMap:Pq}),stringify:()=>J$},Hoe=(e,t)=>(H$.identify(t)||Y$.isScalar(t)&&(!t.type||t.type===Iq.Scalar.PLAIN)&&H$.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===H$.tag&&r.default);function Pq(e,t,r){let i=Tq(e,r);if(Y$.isSeq(i))for(let n of i.items)pA(e,t,n);else if(Array.isArray(i))for(let n of i)pA(e,t,n);else pA(e,t,i)}function pA(e,t,r){let i=Tq(e,r);if(!Y$.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,e,Map);for(let[o,s]of n)t instanceof Map?t.has(o)||t.set(o,s):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function Tq(e,t){return e&&Y$.isAlias(t)?t.resolve(e.doc,e):t}X$.addMergeToJSMap=Pq;X$.isMergeKey=Hoe;X$.merge=H$});var hA=S(Eq=>{"use strict";var Yoe=fA(),Aq=Q$(),Xoe=$p(),Rq=qe(),mA=Mo();function Qoe(e,t,{key:r,value:i}){if(Rq.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,i);else if(Aq.isMergeKey(e,r))Aq.addMergeToJSMap(e,t,i);else{let n=mA.toJS(r,"",e);if(t instanceof Map)t.set(n,mA.toJS(i,n,e));else if(t instanceof Set)t.add(n);else{let o=ese(r,n,e),s=mA.toJS(i,o,e);o in t?Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[o]=s}}return t}function ese(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(Rq.isNode(e)&&r?.doc){let i=Xoe.createStringifyContext(r.doc,{});i.anchors=new Set;for(let o of r.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=e.toString(i);if(!r.mapKeyWarned){let o=JSON.stringify(n);o.length>40&&(o=o.substring(0,36)+'..."'),Yoe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return n}return JSON.stringify(t)}Eq.addPairToJSMap=Qoe});var Fo=S(gA=>{"use strict";var Oq=mp(),tse=Sq(),rse=hA(),eb=qe();function nse(e,t,r){let i=Oq.createNode(e,void 0,r),n=Oq.createNode(t,void 0,r);return new tb(i,n)}var tb=class e{constructor(t,r=null){Object.defineProperty(this,eb.NODE_TYPE,{value:eb.PAIR}),this.key=t,this.value=r}clone(t){let{key:r,value:i}=this;return eb.isNode(r)&&(r=r.clone(t)),eb.isNode(i)&&(i=i.clone(t)),new e(r,i)}toJSON(t,r){let i=r?.mapAsMap?new Map:{};return rse.addPairToJSMap(r,i,this)}toString(t,r,i){return t?.doc?tse.stringifyPair(this,t,r,i):JSON.stringify(this)}};gA.Pair=tb;gA.createPair=nse});var yA=S(Cq=>{"use strict";var aa=qe(),Nq=$p(),rb=hp();function ise(e,t,r){return(t.inFlow??e.flow?sse:ose)(e,t,r)}function ose({comment:e,items:t},r,{blockItemPrefix:i,flowChars:n,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:c,options:{commentString:u}}=r,l=Object.assign({},r,{indent:o,type:null}),d=!1,f=[];for(let m=0;m<t.length;++m){let h=t[m],g=null;if(aa.isNode(h))!d&&h.spaceBefore&&f.push(""),nb(r,f,h.commentBefore,d),h.comment&&(g=h.comment);else if(aa.isPair(h)){let v=aa.isNode(h.key)?h.key:null;v&&(!d&&v.spaceBefore&&f.push(""),nb(r,f,v.commentBefore,d))}d=!1;let y=Nq.stringify(h,l,()=>g=null,()=>d=!0);g&&(y+=rb.lineComment(y,o,u(g))),d&&g&&(d=!1),f.push(i+y)}let p;if(f.length===0)p=n.start+n.end;else{p=f[0];for(let m=1;m<f.length;++m){let h=f[m];p+=h?`
|
|
60
|
+
${c}${h}`:`
|
|
61
|
+
`}}return e?(p+=`
|
|
62
|
+
`+rb.indentComment(u(e),c),a&&a()):d&&s&&s(),p}function sse({items:e},t,{flowChars:r,itemIndent:i}){let{indent:n,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=t;i+=o;let c=Object.assign({},t,{indent:i,inFlow:!0,type:null}),u=!1,l=0,d=[];for(let m=0;m<e.length;++m){let h=e[m],g=null;if(aa.isNode(h))h.spaceBefore&&d.push(""),nb(t,d,h.commentBefore,!1),h.comment&&(g=h.comment);else if(aa.isPair(h)){let v=aa.isNode(h.key)?h.key:null;v&&(v.spaceBefore&&d.push(""),nb(t,d,v.commentBefore,!1),v.comment&&(u=!0));let $=aa.isNode(h.value)?h.value:null;$?($.comment&&(g=$.comment),$.commentBefore&&(u=!0)):h.value==null&&v?.comment&&(g=v.comment)}g&&(u=!0);let y=Nq.stringify(h,c,()=>g=null);u||(u=d.length>l||y.includes(`
|
|
63
|
+
`)),m<e.length-1?y+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(u||(u=d.reduce((v,$)=>v+$.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),g&&(y+=rb.lineComment(y,i,a(g))),d.push(y),l=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!u){let m=d.reduce((h,g)=>h+g.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=f;for(let h of d)m+=h?`
|
|
64
|
+
${o}${n}${h}`:`
|
|
65
|
+
`;return`${m}
|
|
66
|
+
${n}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function nb({indent:e,options:{commentString:t}},r,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let o=rb.indentComment(t(i),e);r.push(o.trimStart())}}Cq.stringifyCollection=ise});var Vo=S($A=>{"use strict";var ase=yA(),cse=hA(),use=Z$(),Zo=qe(),ib=Fo(),lse=Ot();function _p(e,t){let r=Zo.isScalar(t)?t.value:t;for(let i of e)if(Zo.isPair(i)&&(i.key===t||i.key===r||Zo.isScalar(i.key)&&i.key.value===r))return i}var vA=class extends use.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Zo.MAP,t),this.items=[]}static from(t,r,i){let{keepUndefined:n,replacer:o}=i,s=new this(t),a=(c,u)=>{if(typeof o=="function")u=o.call(r,c,u);else if(Array.isArray(o)&&!o.includes(c))return;(u!==void 0||n)&&s.items.push(ib.createPair(c,u,i))};if(r instanceof Map)for(let[c,u]of r)a(c,u);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof t.sortMapEntries=="function"&&s.items.sort(t.sortMapEntries),s}add(t,r){let i;Zo.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new ib.Pair(t,t?.value):i=new ib.Pair(t.key,t.value);let n=_p(this.items,i.key),o=this.schema?.sortMapEntries;if(n){if(!r)throw new Error(`Key ${i.key} already set`);Zo.isScalar(n.value)&&lse.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(o){let s=this.items.findIndex(a=>o(i,a)<0);s===-1?this.items.push(i):this.items.splice(s,0,i)}else this.items.push(i)}delete(t){let r=_p(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let n=_p(this.items,t)?.value;return(!r&&Zo.isScalar(n)?n.value:n)??void 0}has(t){return!!_p(this.items,t)}set(t,r){this.add(new ib.Pair(t,r),!0)}toJSON(t,r,i){let n=i?new i:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(n);for(let o of this.items)cse.addPairToJSMap(r,n,o);return n}toString(t,r,i){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Zo.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),ase.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:r})}};$A.YAMLMap=vA;$A.findPair=_p});var Ou=S(jq=>{"use strict";var dse=qe(),zq=Vo(),fse={collection:"map",default:!0,nodeClass:zq.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return dse.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>zq.YAMLMap.from(e,t,r)};jq.map=fse});var Bo=S(Dq=>{"use strict";var pse=mp(),mse=yA(),hse=Z$(),sb=qe(),gse=Ot(),yse=Mo(),bA=class extends hse.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(sb.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let r=ob(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let i=ob(t);if(typeof i!="number")return;let n=this.items[i];return!r&&sb.isScalar(n)?n.value:n}has(t){let r=ob(t);return typeof r=="number"&&r<this.items.length}set(t,r){let i=ob(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[i];sb.isScalar(n)&&gse.isScalarValue(r)?n.value=r:this.items[i]=r}toJSON(t,r){let i=[];r?.onCreate&&r.onCreate(i);let n=0;for(let o of this.items)i.push(yse.toJS(o,String(n++),r));return i}toString(t,r,i){return t?mse.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:r}):JSON.stringify(this)}static from(t,r,i){let{replacer:n}=i,o=new this(t);if(r&&Symbol.iterator in Object(r)){let s=0;for(let a of r){if(typeof n=="function"){let c=r instanceof Set?a:String(s++);a=n.call(r,c,a)}o.items.push(pse.createNode(a,void 0,i))}}return o}};function ob(e){let t=sb.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Dq.YAMLSeq=bA});var Nu=S(Lq=>{"use strict";var vse=qe(),Mq=Bo(),$se={collection:"seq",default:!0,nodeClass:Mq.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return vse.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>Mq.YAMLSeq.from(e,t,r)};Lq.seq=$se});var wp=S(Uq=>{"use strict";var bse=vp(),_se={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,r,i){return t=Object.assign({actualString:!0},t),bse.stringifyString(e,t,r,i)}};Uq.string=_se});var ab=S(Zq=>{"use strict";var qq=Ot(),Fq={identify:e=>e==null,createNode:()=>new qq.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new qq.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Fq.test.test(e)?e:t.options.nullStr};Zq.nullTag=Fq});var _A=S(Bq=>{"use strict";var wse=Ot(),Vq={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new wse.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&Vq.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?r.options.trueStr:r.options.falseStr}};Bq.boolTag=Vq});var Cu=S(Kq=>{"use strict";function kse({format:e,minFractionDigits:t,tag:r,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=t-(o.length-s-1);for(;a-- >0;)o+="0"}return o}Kq.stringifyNumber=kse});var kA=S(cb=>{"use strict";var Sse=Ot(),wA=Cu(),xse={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:wA.stringifyNumber},Ise={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():wA.stringifyNumber(e)}},Pse={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Sse.Scalar(parseFloat(e)),r=e.indexOf(".");return r!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-r-1),t},stringify:wA.stringifyNumber};cb.float=Pse;cb.floatExp=Ise;cb.floatNaN=xse});var xA=S(lb=>{"use strict";var Gq=Cu(),ub=e=>typeof e=="bigint"||Number.isInteger(e),SA=(e,t,r,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),r);function Wq(e,t,r){let{value:i}=e;return ub(i)&&i>=0?r+i.toString(t):Gq.stringifyNumber(e)}var Tse={identify:e=>ub(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>SA(e,2,8,r),stringify:e=>Wq(e,8,"0o")},Ase={identify:ub,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>SA(e,0,10,r),stringify:Gq.stringifyNumber},Rse={identify:e=>ub(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>SA(e,2,16,r),stringify:e=>Wq(e,16,"0x")};lb.int=Ase;lb.intHex=Rse;lb.intOct=Tse});var Hq=S(Jq=>{"use strict";var Ese=Ou(),Ose=ab(),Nse=Nu(),Cse=wp(),zse=_A(),IA=kA(),PA=xA(),jse=[Ese.map,Nse.seq,Cse.string,Ose.nullTag,zse.boolTag,PA.intOct,PA.int,PA.intHex,IA.floatNaN,IA.floatExp,IA.float];Jq.schema=jse});var Qq=S(Xq=>{"use strict";var Dse=Ot(),Mse=Ou(),Lse=Nu();function Yq(e){return typeof e=="bigint"||Number.isInteger(e)}var db=({value:e})=>JSON.stringify(e),Use=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:db},{identify:e=>e==null,createNode:()=>new Dse.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:db},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:db},{identify:Yq,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>Yq(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:db}],qse={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Fse=[Mse.map,Lse.seq].concat(Use,qse);Xq.schema=Fse});var AA=S(e6=>{"use strict";var kp=Pm("buffer"),TA=Ot(),Zse=vp(),Vse={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof kp.Buffer=="function")return kp.Buffer.from(e,"base64");if(typeof atob=="function"){let r=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(r.length);for(let n=0;n<r.length;++n)i[n]=r.charCodeAt(n);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},i,n,o){if(!r)return"";let s=r,a;if(typeof kp.Buffer=="function")a=s instanceof kp.Buffer?s.toString("base64"):kp.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let u=0;u<s.length;++u)c+=String.fromCharCode(s[u]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=TA.Scalar.BLOCK_LITERAL),t!==TA.Scalar.QUOTE_DOUBLE){let c=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),u=Math.ceil(a.length/c),l=new Array(u);for(let d=0,f=0;d<u;++d,f+=c)l[d]=a.substr(f,c);a=l.join(t===TA.Scalar.BLOCK_LITERAL?`
|
|
67
|
+
`:" ")}return Zse.stringifyString({comment:e,type:t,value:a},i,n,o)}};e6.binary=Vse});var mb=S(pb=>{"use strict";var fb=qe(),RA=Fo(),Bse=Ot(),Kse=Bo();function t6(e,t){if(fb.isSeq(e))for(let r=0;r<e.items.length;++r){let i=e.items[r];if(!fb.isPair(i)){if(fb.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let n=i.items[0]||new RA.Pair(new Bse.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
|
|
68
|
+
${n.key.commentBefore}`:i.commentBefore),i.comment){let o=n.value??n.key;o.comment=o.comment?`${i.comment}
|
|
69
|
+
${o.comment}`:i.comment}i=n}e.items[r]=fb.isPair(i)?i:new RA.Pair(i)}}else t("Expected a sequence for this tag");return e}function r6(e,t,r){let{replacer:i}=r,n=new Kse.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){typeof i=="function"&&(s=i.call(t,String(o++),s));let a,c;if(Array.isArray(s))if(s.length===2)a=s[0],c=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let u=Object.keys(s);if(u.length===1)a=u[0],c=s[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=s;n.items.push(RA.createPair(a,c,r))}return n}var Gse={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:t6,createNode:r6};pb.createPairs=r6;pb.pairs=Gse;pb.resolvePairs=t6});var NA=S(OA=>{"use strict";var n6=qe(),EA=Mo(),Sp=Vo(),Wse=Bo(),i6=mb(),ca=class e extends Wse.YAMLSeq{constructor(){super(),this.add=Sp.YAMLMap.prototype.add.bind(this),this.delete=Sp.YAMLMap.prototype.delete.bind(this),this.get=Sp.YAMLMap.prototype.get.bind(this),this.has=Sp.YAMLMap.prototype.has.bind(this),this.set=Sp.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,r){if(!r)return super.toJSON(t);let i=new Map;r?.onCreate&&r.onCreate(i);for(let n of this.items){let o,s;if(n6.isPair(n)?(o=EA.toJS(n.key,"",r),s=EA.toJS(n.value,o,r)):o=EA.toJS(n,"",r),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(t,r,i){let n=i6.createPairs(t,r,i),o=new this;return o.items=n.items,o}};ca.tag="tag:yaml.org,2002:omap";var Jse={collection:"seq",identify:e=>e instanceof Map,nodeClass:ca,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=i6.resolvePairs(e,t),i=[];for(let{key:n}of r.items)n6.isScalar(n)&&(i.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new ca,r)},createNode:(e,t,r)=>ca.from(e,t,r)};OA.YAMLOMap=ca;OA.omap=Jse});var u6=S(CA=>{"use strict";var o6=Ot();function s6({value:e,source:t},r){return t&&(e?a6:c6).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var a6={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new o6.Scalar(!0),stringify:s6},c6={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new o6.Scalar(!1),stringify:s6};CA.falseTag=c6;CA.trueTag=a6});var l6=S(hb=>{"use strict";var Hse=Ot(),zA=Cu(),Yse={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:zA.stringifyNumber},Xse={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():zA.stringifyNumber(e)}},Qse={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Hse.Scalar(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let i=e.substring(r+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:zA.stringifyNumber};hb.float=Qse;hb.floatExp=Xse;hb.floatNaN=Yse});var f6=S(Ip=>{"use strict";var d6=Cu(),xp=e=>typeof e=="bigint"||Number.isInteger(e);function gb(e,t,r,{intAsBigInt:i}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return n==="-"?BigInt(-1)*s:s}let o=parseInt(e,r);return n==="-"?-1*o:o}function jA(e,t,r){let{value:i}=e;if(xp(i)){let n=i.toString(t);return i<0?"-"+r+n.substr(1):r+n}return d6.stringifyNumber(e)}var eae={identify:xp,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>gb(e,2,2,r),stringify:e=>jA(e,2,"0b")},tae={identify:xp,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>gb(e,1,8,r),stringify:e=>jA(e,8,"0")},rae={identify:xp,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>gb(e,0,10,r),stringify:d6.stringifyNumber},nae={identify:xp,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>gb(e,2,16,r),stringify:e=>jA(e,16,"0x")};Ip.int=rae;Ip.intBin=eae;Ip.intHex=nae;Ip.intOct=tae});var MA=S(DA=>{"use strict";var $b=qe(),yb=Fo(),vb=Vo(),ua=class e extends vb.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let r;$b.isPair(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new yb.Pair(t.key,null):r=new yb.Pair(t,null),vb.findPair(this.items,r.key)||this.items.push(r)}get(t,r){let i=vb.findPair(this.items,t);return!r&&$b.isPair(i)?$b.isScalar(i.key)?i.key.value:i.key:i}set(t,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let i=vb.findPair(this.items,t);i&&!r?this.items.splice(this.items.indexOf(i),1):!i&&r&&this.items.push(new yb.Pair(t))}toJSON(t,r){return super.toJSON(t,r,Set)}toString(t,r,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),r,i);throw new Error("Set items must all have null values")}static from(t,r,i){let{replacer:n}=i,o=new this(t);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof n=="function"&&(s=n.call(r,s,s)),o.items.push(yb.createPair(s,null,i));return o}};ua.tag="tag:yaml.org,2002:set";var iae={collection:"map",identify:e=>e instanceof Set,nodeClass:ua,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>ua.from(e,t,r),resolve(e,t){if($b.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new ua,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};DA.YAMLSet=ua;DA.set=iae});var UA=S(bb=>{"use strict";var oae=Cu();function LA(e,t){let r=e[0],i=r==="-"||r==="+"?e.substring(1):e,n=s=>t?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*n(60)+n(a),n(0));return r==="-"?n(-1)*o:o}function p6(e){let{value:t}=e,r=s=>s;if(typeof t=="bigint")r=s=>BigInt(s);else if(isNaN(t)||!isFinite(t))return oae.stringifyNumber(e);let i="";t<0&&(i="-",t*=r(-1));let n=r(60),o=[t%n];return t<60?o.unshift(0):(t=(t-o[0])/n,o.unshift(t%n),t>=60&&(t=(t-o[0])/n,o.unshift(t))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var sae={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>LA(e,r),stringify:p6},aae={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>LA(e,!1),stringify:p6},m6={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(m6.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,i,n,o,s,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,u=Date.UTC(r,i-1,n,o||0,s||0,a||0,c),l=t[8];if(l&&l!=="Z"){let d=LA(l,!1);Math.abs(d)<30&&(d*=60),u-=6e4*d}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};bb.floatTime=aae;bb.intTime=sae;bb.timestamp=m6});var y6=S(g6=>{"use strict";var cae=Ou(),uae=ab(),lae=Nu(),dae=wp(),fae=AA(),h6=u6(),qA=l6(),_b=f6(),pae=Q$(),mae=NA(),hae=mb(),gae=MA(),FA=UA(),yae=[cae.map,lae.seq,dae.string,uae.nullTag,h6.trueTag,h6.falseTag,_b.intBin,_b.intOct,_b.int,_b.intHex,qA.floatNaN,qA.floatExp,qA.float,fae.binary,pae.merge,mae.omap,hae.pairs,gae.set,FA.intTime,FA.floatTime,FA.timestamp];g6.schema=yae});var P6=S(BA=>{"use strict";var _6=Ou(),vae=ab(),w6=Nu(),$ae=wp(),bae=_A(),ZA=kA(),VA=xA(),_ae=Hq(),wae=Qq(),k6=AA(),Pp=Q$(),S6=NA(),x6=mb(),v6=y6(),I6=MA(),wb=UA(),$6=new Map([["core",_ae.schema],["failsafe",[_6.map,w6.seq,$ae.string]],["json",wae.schema],["yaml11",v6.schema],["yaml-1.1",v6.schema]]),b6={binary:k6.binary,bool:bae.boolTag,float:ZA.float,floatExp:ZA.floatExp,floatNaN:ZA.floatNaN,floatTime:wb.floatTime,int:VA.int,intHex:VA.intHex,intOct:VA.intOct,intTime:wb.intTime,map:_6.map,merge:Pp.merge,null:vae.nullTag,omap:S6.omap,pairs:x6.pairs,seq:w6.seq,set:I6.set,timestamp:wb.timestamp},kae={"tag:yaml.org,2002:binary":k6.binary,"tag:yaml.org,2002:merge":Pp.merge,"tag:yaml.org,2002:omap":S6.omap,"tag:yaml.org,2002:pairs":x6.pairs,"tag:yaml.org,2002:set":I6.set,"tag:yaml.org,2002:timestamp":wb.timestamp};function Sae(e,t,r){let i=$6.get(t);if(i&&!e)return r&&!i.includes(Pp.merge)?i.concat(Pp.merge):i.slice();let n=i;if(!n)if(Array.isArray(e))n=[];else{let o=Array.from($6.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)n=n.concat(o);else typeof e=="function"&&(n=e(n.slice()));return r&&(n=n.concat(Pp.merge)),n.reduce((o,s)=>{let a=typeof s=="string"?b6[s]:s;if(!a){let c=JSON.stringify(s),u=Object.keys(b6).map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return o.includes(a)||o.push(a),o},[])}BA.coreKnownTags=kae;BA.getTags=Sae});var WA=S(T6=>{"use strict";var KA=qe(),xae=Ou(),Iae=Nu(),Pae=wp(),kb=P6(),Tae=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,GA=class e{constructor({compat:t,customTags:r,merge:i,resolveKnownTags:n,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?kb.getTags(t,"compat"):t?kb.getTags(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=n?kb.coreKnownTags:{},this.tags=kb.getTags(r,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,KA.MAP,{value:xae.map}),Object.defineProperty(this,KA.SCALAR,{value:Pae.string}),Object.defineProperty(this,KA.SEQ,{value:Iae.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Tae:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};T6.Schema=GA});var R6=S(A6=>{"use strict";var Aae=qe(),JA=$p(),Tp=hp();function Rae(e,t){let r=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(r.push(c),i=!0):e.directives.docStart&&(i=!0)}i&&r.push("---");let n=JA.createStringifyContext(e,t),{commentString:o}=n.options;if(e.commentBefore){r.length!==1&&r.unshift("");let c=o(e.commentBefore);r.unshift(Tp.indentComment(c,""))}let s=!1,a=null;if(e.contents){if(Aae.isNode(e.contents)){if(e.contents.spaceBefore&&i&&r.push(""),e.contents.commentBefore){let l=o(e.contents.commentBefore);r.push(Tp.indentComment(l,""))}n.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>s=!0,u=JA.stringify(e.contents,n,()=>a=null,c);a&&(u+=Tp.lineComment(u,"",o(a))),(u[0]==="|"||u[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${u}`:r.push(u)}else r.push(JA.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let c=o(e.comment);c.includes(`
|
|
70
|
+
`)?(r.push("..."),r.push(Tp.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=e.comment;c&&s&&(c=c.replace(/^\n+/,"")),c&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Tp.indentComment(o(c),"")))}return r.join(`
|
|
71
|
+
`)+`
|
|
72
|
+
`}A6.stringifyDocument=Rae});var Ap=S(E6=>{"use strict";var Eae=pp(),zu=Z$(),kn=qe(),Oae=Fo(),Nae=Mo(),Cae=WA(),zae=R6(),HA=L$(),jae=eA(),Dae=mp(),YA=QT(),XA=class e{constructor(t,r,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,kn.NODE_TYPE,{value:kn.DOC});let n=null;typeof r=="function"||Array.isArray(r)?n=r:i===void 0&&r&&(i=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=o;let{version:s}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new YA.Directives({version:s}),this.setSchema(s,i),this.contents=t===void 0?null:this.createNode(t,n,i)}clone(){let t=Object.create(e.prototype,{[kn.NODE_TYPE]:{value:kn.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=kn.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){ju(this.contents)&&this.contents.add(t)}addIn(t,r){ju(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let i=HA.anchorNames(this);t.anchor=!r||i.has(r)?HA.findNewAnchor(r||"a",i):r}return new Eae.Alias(t.anchor)}createNode(t,r,i){let n;if(typeof r=="function")t=r.call({"":t},"",t),n=r;else if(Array.isArray(r)){let g=v=>typeof v=="number"||v instanceof String||v instanceof Number,y=r.filter(g).map(String);y.length>0&&(r=r.concat(y)),n=r}else i===void 0&&r&&(i=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:c,onTagObj:u,tag:l}=i??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=HA.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:u,replacer:n,schema:this.schema,sourceObjects:p},h=Dae.createNode(t,l,m);return a&&kn.isCollection(h)&&(h.flow=!0),f(),h}createPair(t,r,i={}){let n=this.createNode(t,null,i),o=this.createNode(r,null,i);return new Oae.Pair(n,o)}delete(t){return ju(this.contents)?this.contents.delete(t):!1}deleteIn(t){return zu.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):ju(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return kn.isCollection(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return zu.isEmptyPath(t)?!r&&kn.isScalar(this.contents)?this.contents.value:this.contents:kn.isCollection(this.contents)?this.contents.getIn(t,r):void 0}has(t){return kn.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return zu.isEmptyPath(t)?this.contents!==void 0:kn.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=zu.collectionFromPath(this.schema,[t],r):ju(this.contents)&&this.contents.set(t,r)}setIn(t,r){zu.isEmptyPath(t)?this.contents=r:this.contents==null?this.contents=zu.collectionFromPath(this.schema,Array.from(t),r):ju(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new YA.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new YA.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(i)this.schema=new Cae.Schema(Object.assign(i,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:r,mapAsMap:i,maxAliasCount:n,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},c=Nae.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:u,res:l}of a.anchors.values())o(l,u);return typeof s=="function"?jae.applyReviver(s,{"":c},"",c):c}toJSON(t,r){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:r})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let r=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return zae.stringifyDocument(this,t)}};function ju(e){if(kn.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}E6.Document=XA});var Op=S(Ep=>{"use strict";var Rp=class extends Error{constructor(t,r,i,n){super(),this.name=t,this.code=i,this.message=n,this.pos=r}},QA=class extends Rp{constructor(t,r,i){super("YAMLParseError",t,r,i)}},eR=class extends Rp{constructor(t,r,i){super("YAMLWarning",t,r,i)}},Mae=(e,t)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>t.linePos(a));let{line:i,col:n}=r.linePos[0];r.message+=` at line ${i}, column ${n}`;let o=n-1,s=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(s.substring(0,o))){let a=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
73
|
+
`),s=a+s}if(/[^ ]/.test(s)){let a=1,c=r.linePos[1];c?.line===i&&c.col>n&&(a=Math.max(1,Math.min(c.col-n,80-o)));let u=" ".repeat(o)+"^".repeat(a);r.message+=`:
|
|
74
|
+
|
|
75
|
+
${s}
|
|
76
|
+
${u}
|
|
77
|
+
`}};Ep.YAMLError=Rp;Ep.YAMLParseError=QA;Ep.YAMLWarning=eR;Ep.prettifyError=Mae});var Np=S(O6=>{"use strict";function Lae(e,{flow:t,indicator:r,next:i,offset:n,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,u=a,l=a,d="",f="",p=!1,m=!1,h=null,g=null,y=null,v=null,$=null,_=null,w=null;for(let C of e)switch(m&&(C.type!=="space"&&C.type!=="newline"&&C.type!=="comma"&&o(C.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(u&&C.type!=="comment"&&C.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),C.type){case"space":!t&&(r!=="doc-start"||i?.type!=="flow-collection")&&C.source.includes(" ")&&(h=C),l=!0;break;case"comment":{l||o(C,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=C.source.substring(1)||" ";d?d+=f+D:d=D,f="",u=!1;break}case"newline":u?d?d+=C.source:(!_||r!=="seq-item-ind")&&(c=!0):f+=C.source,u=!0,p=!0,(g||y)&&(v=C),l=!0;break;case"anchor":g&&o(C,"MULTIPLE_ANCHORS","A node can have at most one anchor"),C.source.endsWith(":")&&o(C.offset+C.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=C,w??(w=C.offset),u=!1,l=!1,m=!0;break;case"tag":{y&&o(C,"MULTIPLE_TAGS","A node can have at most one tag"),y=C,w??(w=C.offset),u=!1,l=!1,m=!0;break}case r:(g||y)&&o(C,"BAD_PROP_ORDER",`Anchors and tags must be after the ${C.source} indicator`),_&&o(C,"UNEXPECTED_TOKEN",`Unexpected ${C.source} in ${t??"collection"}`),_=C,u=r==="seq-item-ind"||r==="explicit-key-ind",l=!1;break;case"comma":if(t){$&&o(C,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),$=C,u=!1,l=!1;break}default:o(C,"UNEXPECTED_TOKEN",`Unexpected ${C.type} token`),u=!1,l=!1}let k=e[e.length-1],T=k?k.offset+k.source.length:n;return m&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(u&&h.indent<=s||i?.type==="block-map"||i?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:$,found:_,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:y,newlineAfterProp:v,end:T,start:w??T}}O6.resolveProps=Lae});var Sb=S(N6=>{"use strict";function tR(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
78
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(tR(t.key)||tR(t.value))return!0}return!1;default:return!0}}N6.containsNewline=tR});var rR=S(C6=>{"use strict";var Uae=Sb();function qae(e,t,r){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&Uae.containsNewline(t)&&r(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}C6.flowIndentCheck=qae});var nR=S(j6=>{"use strict";var z6=qe();function Fae(e,t,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let n=typeof i=="function"?i:(o,s)=>o===s||z6.isScalar(o)&&z6.isScalar(s)&&o.value===s.value;return t.some(o=>n(o.key,r))}j6.mapIncludes=Fae});var F6=S(q6=>{"use strict";var D6=Fo(),Zae=Vo(),M6=Np(),Vae=Sb(),L6=rR(),Bae=nR(),U6="All mapping items must start at the same column";function Kae({composeNode:e,composeEmptyNode:t},r,i,n,o){let s=o?.nodeClass??Zae.YAMLMap,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let c=i.offset,u=null;for(let l of i.items){let{start:d,key:f,sep:p,value:m}=l,h=M6.resolveProps(d,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0}),g=!h.found;if(g){if(f&&(f.type==="block-seq"?n(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==i.indent&&n(c,"BAD_INDENT",U6)),!h.anchor&&!h.tag&&!p){u=h.end,h.comment&&(a.comment?a.comment+=`
|
|
79
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Vae.containsNewline(f))&&n(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==i.indent&&n(c,"BAD_INDENT",U6);r.atKey=!0;let y=h.end,v=f?e(r,f,h,n):t(r,y,d,null,h,n);r.schema.compat&&L6.flowIndentCheck(i.indent,f,n),r.atKey=!1,Bae.mapIncludes(r,a.items,v)&&n(y,"DUPLICATE_KEY","Map keys must be unique");let $=M6.resolveProps(p??[],{indicator:"map-value-ind",next:m,offset:v.range[2],onError:n,parentIndent:i.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=$.end,$.found){g&&(m?.type==="block-map"&&!$.hasNewline&&n(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&h.start<$.found.offset-1024&&n(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=m?e(r,m,$,n):t(r,c,p,null,$,n);r.schema.compat&&L6.flowIndentCheck(i.indent,m,n),c=_.range[2];let w=new D6.Pair(v,_);r.options.keepSourceTokens&&(w.srcToken=l),a.items.push(w)}else{g&&n(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),$.comment&&(v.comment?v.comment+=`
|
|
80
|
+
`+$.comment:v.comment=$.comment);let _=new D6.Pair(v);r.options.keepSourceTokens&&(_.srcToken=l),a.items.push(_)}}return u&&u<c&&n(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,c,u??c],a}q6.resolveBlockMap=Kae});var V6=S(Z6=>{"use strict";var Gae=Bo(),Wae=Np(),Jae=rR();function Hae({composeNode:e,composeEmptyNode:t},r,i,n,o){let s=o?.nodeClass??Gae.YAMLSeq,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=i.offset,u=null;for(let{start:l,value:d}of i.items){let f=Wae.resolveProps(l,{indicator:"seq-item-ind",next:d,offset:c,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?n(f.end,"BAD_INDENT","All sequence items must start at the same column"):n(c,"MISSING_CHAR","Sequence item without - indicator");else{u=f.end,f.comment&&(a.comment=f.comment);continue}let p=d?e(r,d,f,n):t(r,f.end,l,null,f,n);r.schema.compat&&Jae.flowIndentCheck(i.indent,d,n),c=p.range[2],a.items.push(p)}return a.range=[i.offset,c,u??c],a}Z6.resolveBlockSeq=Hae});var Du=S(B6=>{"use strict";function Yae(e,t,r,i){let n="";if(e){let o=!1,s="";for(let a of e){let{source:c,type:u}=a;switch(u){case"space":o=!0;break;case"comment":{r&&!o&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let l=c.substring(1)||" ";n?n+=s+l:n=l,s="";break}case"newline":n&&(s+=c),o=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}t+=c.length}}return{comment:n,offset:t}}B6.resolveEnd=Yae});var J6=S(W6=>{"use strict";var Xae=qe(),Qae=Fo(),K6=Vo(),ece=Bo(),tce=Du(),G6=Np(),rce=Sb(),nce=nR(),iR="Block collections are not allowed within flow collections",oR=e=>e&&(e.type==="block-map"||e.type==="block-seq");function ice({composeNode:e,composeEmptyNode:t},r,i,n,o){let s=i.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?K6.YAMLMap:ece.YAMLSeq),u=new c(r.schema);u.flow=!0;let l=r.atRoot;l&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=i.offset+i.start.source.length;for(let g=0;g<i.items.length;++g){let y=i.items[g],{start:v,key:$,sep:_,value:w}=y,k=G6.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:$??_?.[0],offset:d,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!_&&!w){g===0&&k.comma?n(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<i.items.length-1&&n(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),k.comment&&(u.comment?u.comment+=`
|
|
81
|
+
`+k.comment:u.comment=k.comment),d=k.end;continue}!s&&r.options.strict&&rce.containsNewline($)&&n($,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)k.comma&&n(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(k.comma||n(k.start,"MISSING_CHAR",`Missing , between ${a} items`),k.comment){let T="";e:for(let C of v)switch(C.type){case"comma":case"space":break;case"comment":T=C.source.substring(1);break e;default:break e}if(T){let C=u.items[u.items.length-1];Xae.isPair(C)&&(C=C.value??C.key),C.comment?C.comment+=`
|
|
82
|
+
`+T:C.comment=T,k.comment=k.comment.substring(T.length+1)}}if(!s&&!_&&!k.found){let T=w?e(r,w,k,n):t(r,k.end,_,null,k,n);u.items.push(T),d=T.range[2],oR(w)&&n(T.range,"BLOCK_IN_FLOW",iR)}else{r.atKey=!0;let T=k.end,C=$?e(r,$,k,n):t(r,T,v,null,k,n);oR($)&&n(C.range,"BLOCK_IN_FLOW",iR),r.atKey=!1;let D=G6.resolveProps(_??[],{flow:a,indicator:"map-value-ind",next:w,offset:C.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(D.found){if(!s&&!k.found&&r.options.strict){if(_)for(let te of _){if(te===D.found)break;if(te.type==="newline"){n(te,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}k.start<D.found.offset-1024&&n(D.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source?.[0]===":"?n(w,"MISSING_CHAR",`Missing space after : in ${a}`):n(D.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let K=w?e(r,w,D,n):D.found?t(r,D.end,_,null,D,n):null;K?oR(w)&&n(K.range,"BLOCK_IN_FLOW",iR):D.comment&&(C.comment?C.comment+=`
|
|
83
|
+
`+D.comment:C.comment=D.comment);let V=new Qae.Pair(C,K);if(r.options.keepSourceTokens&&(V.srcToken=y),s){let te=u;nce.mapIncludes(r,te.items,C)&&n(T,"DUPLICATE_KEY","Map keys must be unique"),te.items.push(V)}else{let te=new K6.YAMLMap(r.schema);te.flow=!0,te.items.push(V);let Oe=(K??C).range;te.range=[C.range[0],Oe[1],Oe[2]],u.items.push(te)}d=K?K.range[2]:D.end}}let f=s?"}":"]",[p,...m]=i.end,h=d;if(p?.source===f)h=p.offset+p.source.length;else{let g=a[0].toUpperCase()+a.substring(1),y=l?`${g} must end with a ${f}`:`${g} in block collection must be sufficiently indented and end with a ${f}`;n(d,l?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1&&m.unshift(p)}if(m.length>0){let g=tce.resolveEnd(m,h,r.options.strict,n);g.comment&&(u.comment?u.comment+=`
|
|
84
|
+
`+g.comment:u.comment=g.comment),u.range=[i.offset,h,g.offset]}else u.range=[i.offset,h,h];return u}W6.resolveFlowCollection=ice});var Y6=S(H6=>{"use strict";var oce=qe(),sce=Ot(),ace=Vo(),cce=Bo(),uce=F6(),lce=V6(),dce=J6();function sR(e,t,r,i,n,o){let s=r.type==="block-map"?uce.resolveBlockMap(e,t,r,i,o):r.type==="block-seq"?lce.resolveBlockSeq(e,t,r,i,o):dce.resolveFlowCollection(e,t,r,i,o),a=s.constructor;return n==="!"||n===a.tagName?(s.tag=a.tagName,s):(n&&(s.tag=n),s)}function fce(e,t,r,i,n){let o=i.tag,s=o?t.directives.tagName(o.source,f=>n(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=i,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offset<m.offset)&&n(m,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===ace.YAMLMap.tagName&&a==="map"||s===cce.YAMLSeq.tagName&&a==="seq")return sR(e,t,r,n,s);let c=t.schema.tags.find(f=>f.tag===s&&f.collection===a);if(!c){let f=t.schema.knownTags[s];if(f?.collection===a)t.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?n(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):n(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),sR(e,t,r,n,s)}let u=sR(e,t,r,n,s,c),l=c.resolve?.(u,f=>n(o,"TAG_RESOLVE_FAILED",f),t.options)??u,d=oce.isNode(l)?l:new sce.Scalar(l);return d.range=u.range,d.tag=s,c?.format&&(d.format=c.format),d}H6.composeCollection=fce});var cR=S(X6=>{"use strict";var aR=Ot();function pce(e,t,r){let i=t.offset,n=mce(t,e.options.strict,r);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let o=n.mode===">"?aR.Scalar.BLOCK_FOLDED:aR.Scalar.BLOCK_LITERAL,s=t.source?hce(t.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=n.chomp==="+"&&s.length>0?`
|
|
85
|
+
`.repeat(Math.max(1,s.length-1)):"",g=i+n.length;return t.source&&(g+=t.source.length),{value:h,type:o,comment:n.comment,range:[i,g,g]}}let c=t.indent+n.indent,u=t.offset+n.length,l=0;for(let h=0;h<a;++h){let[g,y]=s[h];if(y===""||y==="\r")n.indent===0&&g.length>c&&(c=g.length);else{g.length<c&&r(u+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(c=g.length),l=h,c===0&&!e.atRoot&&r(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=g.length+y.length+1}for(let h=s.length-1;h>=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;h<l;++h)d+=s[h][0].slice(c)+`
|
|
86
|
+
`;for(let h=l;h<a;++h){let[g,y]=s[h];u+=g.length+y.length+1;let v=y[y.length-1]==="\r";if(v&&(y=y.slice(0,-1)),y&&g.length<c){let _=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;r(u-y.length-(v?2:1),"BAD_INDENT",_),g=""}o===aR.Scalar.BLOCK_LITERAL?(d+=f+g.slice(c)+y,f=`
|
|
87
|
+
`):g.length>c||y[0]===" "?(f===" "?f=`
|
|
88
|
+
`:!p&&f===`
|
|
89
|
+
`&&(f=`
|
|
90
|
+
|
|
91
|
+
`),d+=f+g.slice(c)+y,f=`
|
|
92
|
+
`,p=!0):y===""?f===`
|
|
93
|
+
`?d+=`
|
|
94
|
+
`:f=`
|
|
95
|
+
`:(d+=f+y,f=" ",p=!1)}switch(n.chomp){case"-":break;case"+":for(let h=a;h<s.length;++h)d+=`
|
|
96
|
+
`+s[h][0].slice(c);d[d.length-1]!==`
|
|
97
|
+
`&&(d+=`
|
|
98
|
+
`);break;default:d+=`
|
|
99
|
+
`}let m=i+n.length+t.source.length;return{value:d,type:o,comment:n.comment,range:[i,m,m]}}function mce({offset:e,props:t},r,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],o=n[0],s=0,a="",c=-1;for(let f=1;f<n.length;++f){let p=n[f];if(!a&&(p==="-"||p==="+"))a=p;else{let m=Number(p);!s&&m?s=m:c===-1&&(c=e+f)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let u=!1,l="",d=n.length;for(let f=1;f<t.length;++f){let p=t[f];switch(p.type){case"space":u=!0;case"newline":d+=p.source.length;break;case"comment":r&&!u&&i(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=p.source.length,l=p.source.substring(1);break;case"error":i(p,"UNEXPECTED_TOKEN",p.message),d+=p.source.length;break;default:{let m=`Unexpected token in block scalar header: ${p.type}`;i(p,"UNEXPECTED_TOKEN",m);let h=p.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:o,indent:s,chomp:a,comment:l,length:d}}function hce(e){let t=e.split(/\n( *)/),r=t[0],i=r.match(/^( *)/),o=[i?.[1]?[i[1],r.slice(i[1].length)]:["",r]];for(let s=1;s<t.length;s+=2)o.push([t[s],t[s+1]]);return o}X6.resolveBlockScalar=pce});var lR=S(eF=>{"use strict";var uR=Ot(),gce=Du();function yce(e,t,r){let{offset:i,type:n,source:o,end:s}=e,a,c,u=(f,p,m)=>r(i+f,p,m);switch(n){case"scalar":a=uR.Scalar.PLAIN,c=vce(o,u);break;case"single-quoted-scalar":a=uR.Scalar.QUOTE_SINGLE,c=$ce(o,u);break;case"double-quoted-scalar":a=uR.Scalar.QUOTE_DOUBLE,c=bce(o,u);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let l=i+o.length,d=gce.resolveEnd(s,l,t,r);return{value:c,type:a,comment:d.comment,range:[i,l,d.offset]}}function vce(e,t){let r="";switch(e[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}return r&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),Q6(e)}function $ce(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Q6(e.slice(1,-1)).replace(/''/g,"'")}function Q6(e){let t=/(.*?)\r?\n/sy,r=t.exec(e);if(!r)return e;let i,n;try{i=new RegExp("(?<![ ])[ ]+$"),n=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{i=/[ \t]+$/,n=/^[ \t]+|[ \t]+$/g}let o=r[1].replace(i,""),s=" ",a=t.lastIndex;for(;r=t.exec(e);){let u=r[1].replace(n,"");u===""?s===`
|
|
100
|
+
`?o+=s:s=`
|
|
101
|
+
`:(o+=s+u,s=" "),a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+s+(r?.[1]??"")}function bce(e,t){let r="";for(let i=1;i<e.length-1;++i){let n=e[i];if(!(n==="\r"&&e[i+1]===`
|
|
102
|
+
`))if(n===`
|
|
103
|
+
`){let{fold:o,offset:s}=_ce(e,i);r+=o,i=s}else if(n==="\\"){let o=e[++i],s=wce[o];if(s)r+=s;else if(o===`
|
|
104
|
+
`)for(o=e[i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="\r"&&e[i+1]===`
|
|
105
|
+
`)for(o=e[++i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=kce(e,i+1,a,t),i+=a}else{let a=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(n===" "||n===" "){let o=i,s=e[i+1];for(;s===" "||s===" ";)s=e[++i+1];s!==`
|
|
106
|
+
`&&!(s==="\r"&&e[i+2]===`
|
|
107
|
+
`)&&(r+=i>o?e.slice(o,i+1):n)}else r+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),r}function _ce(e,t){let r="",i=e[t+1];for(;(i===" "||i===" "||i===`
|
|
108
|
+
`||i==="\r")&&!(i==="\r"&&e[t+2]!==`
|
|
109
|
+
`);)i===`
|
|
110
|
+
`&&(r+=`
|
|
111
|
+
`),t+=1,i=e[t+1];return r||(r=" "),{fold:r,offset:t}}var wce={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
112
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function kce(e,t,r,i){let n=e.substr(t,r),s=n.length===r&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;try{return String.fromCodePoint(s)}catch{let a=e.substr(t-2,r+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}eF.resolveFlowScalar=yce});var nF=S(rF=>{"use strict";var la=qe(),tF=Ot(),Sce=cR(),xce=lR();function Ice(e,t,r,i){let{value:n,type:o,comment:s,range:a}=t.type==="block-scalar"?Sce.resolveBlockScalar(e,t,i):xce.resolveFlowScalar(t,e.options.strict,i),c=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null,u;e.options.stringKeys&&e.atKey?u=e.schema[la.SCALAR]:c?u=Pce(e.schema,n,c,r,i):t.type==="scalar"?u=Tce(e,n,t,i):u=e.schema[la.SCALAR];let l;try{let d=u.resolve(n,f=>i(r??t,"TAG_RESOLVE_FAILED",f),e.options);l=la.isScalar(d)?d:new tF.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);i(r??t,"TAG_RESOLVE_FAILED",f),l=new tF.Scalar(n)}return l.range=a,l.source=n,o&&(l.type=o),c&&(l.tag=c),u.format&&(l.format=u.format),s&&(l.comment=s),l}function Pce(e,t,r,i,n){if(r==="!")return e[la.SCALAR];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[la.SCALAR])}function Tce({atKey:e,directives:t,schema:r},i,n,o){let s=r.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(i))||r[la.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(i))??r[la.SCALAR];if(s.tag!==a.tag){let c=t.tagString(s.tag),u=t.tagString(a.tag),l=`Value may be parsed as either ${c} or ${u}`;o(n,"TAG_RESOLVE_FAILED",l,!0)}}return s}rF.composeScalar=Ice});var oF=S(iF=>{"use strict";function Ace(e,t,r){if(t){r??(r=t.length);for(let i=r-1;i>=0;--i){let n=t[i];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++i];n?.type==="space";)e+=n.source.length,n=t[++i];break}}return e}iF.emptyScalarPosition=Ace});var cF=S(fR=>{"use strict";var Rce=pp(),Ece=qe(),Oce=Y6(),sF=nF(),Nce=Du(),Cce=oF(),zce={composeNode:aF,composeEmptyNode:dR};function aF(e,t,r,i){let n=e.atKey,{spaceBefore:o,comment:s,anchor:a,tag:c}=r,u,l=!0;switch(t.type){case"alias":u=jce(e,t,i),(a||c)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=sF.composeScalar(e,t,c,i),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Oce.composeCollection(zce,e,t,r,i),a&&(u.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);i(t,"RESOURCE_EXHAUSTION",f)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",d),l=!1}}return u??(u=dR(e,t.offset,void 0,null,r,i)),a&&u.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!Ece.isScalar(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&i(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(u.spaceBefore=!0),s&&(t.type==="scalar"&&t.source===""?u.comment=s:u.commentBefore=s),e.options.keepSourceTokens&&l&&(u.srcToken=t),u}function dR(e,t,r,i,{spaceBefore:n,comment:o,anchor:s,tag:a,end:c},u){let l={type:"scalar",offset:Cce.emptyScalarPosition(t,r,i),indent:-1,source:""},d=sF.composeScalar(e,l,a,u);return s&&(d.anchor=s.source.substring(1),d.anchor===""&&u(s,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function jce({options:e},{offset:t,source:r,end:i},n){let o=new Rce.Alias(r.substring(1));o.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&n(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=t+r.length,a=Nce.resolveEnd(i,s,e.strict,n);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}fR.composeEmptyNode=dR;fR.composeNode=aF});var dF=S(lF=>{"use strict";var Dce=Ap(),uF=cF(),Mce=Du(),Lce=Np();function Uce(e,t,{offset:r,start:i,value:n,end:o},s){let a=Object.assign({_directives:t},e),c=new Dce.Document(void 0,a),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},l=Lce.resolveProps(i,{indicator:"doc-start",next:n??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});l.found&&(c.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!l.hasNewline&&s(l.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=n?uF.composeNode(u,n,l,s):uF.composeEmptyNode(u,l.end,i,null,l,s);let d=c.contents.range[2],f=Mce.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}lF.composeDoc=Uce});var mR=S(mF=>{"use strict";var qce=Pm("process"),Fce=QT(),Zce=Ap(),Cp=Op(),fF=qe(),Vce=dF(),Bce=Du();function zp(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r=="string"?r.length:1)]}function pF(e){let t="",r=!1,i=!1;for(let n=0;n<e.length;++n){let o=e[n];switch(o[0]){case"#":t+=(t===""?"":i?`
|
|
113
|
+
|
|
114
|
+
`:`
|
|
115
|
+
`)+(o.substring(1)||" "),r=!0,i=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),r=!1;break;default:r||(i=!0),r=!1}}return{comment:t,afterEmptyLine:i}}var pR=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,i,n,o)=>{let s=zp(r);o?this.warnings.push(new Cp.YAMLWarning(s,i,n)):this.errors.push(new Cp.YAMLParseError(s,i,n))},this.directives=new Fce.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:i,afterEmptyLine:n}=pF(this.prelude);if(i){let o=t.contents;if(r)t.comment=t.comment?`${t.comment}
|
|
116
|
+
${i}`:i;else if(n||t.directives.docStart||!o)t.commentBefore=i;else if(fF.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];fF.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${i}
|
|
117
|
+
${a}`:i}else{let s=o.commentBefore;o.commentBefore=s?`${i}
|
|
118
|
+
${s}`:i}}if(r){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:pF(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,r=!1,i=-1){for(let n of t)yield*this.next(n);yield*this.end(r,i)}*next(t){switch(qce.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(r,i,n)=>{let o=zp(t);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",i,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=Vce.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let r=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new Cp.YAMLParseError(zp(t),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Cp.YAMLParseError(zp(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let r=Bce.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
|
|
119
|
+
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Cp.YAMLParseError(zp(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),n=new Zce.Document(void 0,i);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,r,r],this.decorate(n,!1),yield n}}};mF.Composer=pR});var yF=S(xb=>{"use strict";var Kce=cR(),Gce=lR(),Wce=Op(),hF=vp();function Jce(e,t=!0,r){if(e){let i=(n,o,s)=>{let a=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(r)r(a,o,s);else throw new Wce.YAMLParseError([a,a+1],o,s)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Gce.resolveFlowScalar(e,t,i);case"block-scalar":return Kce.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function Hce(e,t){let{implicitKey:r=!1,indent:i,inFlow:n=!1,offset:o=-1,type:s="PLAIN"}=t,a=hF.stringifyString({type:s,value:e},{implicitKey:r,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:i,source:`
|
|
120
|
+
`}];switch(a[0]){case"|":case">":{let u=a.indexOf(`
|
|
121
|
+
`),l=a.substring(0,u),d=a.substring(u+1)+`
|
|
122
|
+
`,f=[{type:"block-scalar-header",offset:o,indent:i,source:l}];return gF(f,c)||f.push({type:"newline",offset:-1,indent:i,source:`
|
|
123
|
+
`}),{type:"block-scalar",offset:o,indent:i,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:c};default:return{type:"scalar",offset:o,indent:i,source:a,end:c}}}function Yce(e,t,r={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:o=!1,type:s}=r,a="indent"in e?e.indent:null;if(i&&typeof a=="number"&&(a+=2),!s)switch(e.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let u=e.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=hF.stringifyString({type:s,value:t},{implicitKey:n||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Xce(e,c);break;case'"':hR(e,c,"double-quoted-scalar");break;case"'":hR(e,c,"single-quoted-scalar");break;default:hR(e,c,"scalar")}}function Xce(e,t){let r=t.indexOf(`
|
|
124
|
+
`),i=t.substring(0,r),n=t.substring(r+1)+`
|
|
125
|
+
`;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,e.source=n}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];gF(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
|
|
126
|
+
`});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:n})}}function gF(e,t){if(t)for(let r of t)switch(r.type){case"space":case"comment":e.push(r);break;case"newline":return e.push(r),!0}return!1}function hR(e,t,r){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=r,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let o of i)o.offset+=n;delete e.props,Object.assign(e,{type:r,source:t,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
127
|
+
`};delete e.items,Object.assign(e,{type:r,source:t,end:[n]});break}default:{let i="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))o!=="type"&&o!=="offset"&&delete e[o];Object.assign(e,{type:r,indent:i,source:t,end:n})}}}xb.createScalarToken=Hce;xb.resolveAsScalar=Jce;xb.setScalarValue=Yce});var $F=S(vF=>{"use strict";var Qce=e=>"type"in e?Pb(e):Ib(e);function Pb(e){switch(e.type){case"block-scalar":{let t="";for(let r of e.props)t+=Pb(r);return t+e.source}case"block-map":case"block-seq":{let t="";for(let r of e.items)t+=Ib(r);return t}case"flow-collection":{let t=e.start.source;for(let r of e.items)t+=Ib(r);for(let r of e.end)t+=r.source;return t}case"document":{let t=Ib(e);if(e.end)for(let r of e.end)t+=r.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let r of e.end)t+=r.source;return t}}}function Ib({start:e,key:t,sep:r,value:i}){let n="";for(let o of e)n+=o.source;if(t&&(n+=Pb(t)),r)for(let o of r)n+=o.source;return i&&(n+=Pb(i)),n}vF.stringify=Qce});var kF=S(wF=>{"use strict";var gR=Symbol("break visit"),eue=Symbol("skip children"),bF=Symbol("remove item");function da(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),_F(Object.freeze([]),e,t)}da.BREAK=gR;da.SKIP=eue;da.REMOVE=bF;da.itemAtPath=(e,t)=>{let r=e;for(let[i,n]of t){let o=r?.[i];if(o&&"items"in o)r=o.items[n];else return}return r};da.parentCollection=(e,t)=>{let r=da.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],n=r?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function _F(e,t,r){let i=r(t,e);if(typeof i=="symbol")return i;for(let n of["key","value"]){let o=t[n];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=_F(Object.freeze(e.concat([[n,s]])),o.items[s],r);if(typeof a=="number")s=a-1;else{if(a===gR)return gR;a===bF&&(o.items.splice(s,1),s-=1)}}typeof i=="function"&&n==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}wF.visit=da});var Tb=S(Br=>{"use strict";var yR=yF(),tue=$F(),rue=kF(),vR="\uFEFF",$R="",bR="",_R="",nue=e=>!!e&&"items"in e,iue=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function oue(e){switch(e){case vR:return"<BOM>";case $R:return"<DOC>";case bR:return"<FLOW_END>";case _R:return"<SCALAR>";default:return JSON.stringify(e)}}function sue(e){switch(e){case vR:return"byte-order-mark";case $R:return"doc-mode";case bR:return"flow-error-end";case _R:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
128
|
+
`:case`\r
|
|
129
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Br.createScalarToken=yR.createScalarToken;Br.resolveAsScalar=yR.resolveAsScalar;Br.setScalarValue=yR.setScalarValue;Br.stringify=tue.stringify;Br.visit=rue.visit;Br.BOM=vR;Br.DOCUMENT=$R;Br.FLOW_END=bR;Br.SCALAR=_R;Br.isCollection=nue;Br.isScalar=iue;Br.prettyToken=oue;Br.tokenType=sue});var SR=S(xF=>{"use strict";var jp=Tb();function Kn(e){switch(e){case void 0:case" ":case`
|
|
130
|
+
`:case"\r":case" ":return!0;default:return!1}}var SF=new Set("0123456789ABCDEFabcdef"),aue=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ab=new Set(",[]{}"),cue=new Set(` ,[]{}
|
|
131
|
+
\r `),wR=e=>!e||cue.has(e),kR=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,r=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!r;let i=this.next??"stream";for(;i&&(r||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,r=this.buffer[t];for(;r===" "||r===" ";)r=this.buffer[++t];return!r||r==="#"||r===`
|
|
132
|
+
`?!0:r==="\r"?this.buffer[t+1]===`
|
|
133
|
+
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let r=this.buffer[t];if(this.indentNext>0){let i=0;for(;r===" ";)r=this.buffer[++i+t];if(r==="\r"){let n=this.buffer[i+t+1];if(n===`
|
|
134
|
+
`||!n&&!this.atEnd)return t+i+1}return r===`
|
|
135
|
+
`||i>=this.indentNext||!r&&!this.atEnd?t+i:-1}if(r==="-"||r==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&Kn(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
136
|
+
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===jp.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let r=t.length,i=t.indexOf("#");for(;i!==-1;){let o=t[i-1];if(o===" "||o===" "){r=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let o=t[r-1];if(o===" "||o===" ")r-=1;else break}let n=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-r),yield*this.pushNewline(),"stream"}return yield jp.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&Kn(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Kn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Kn(r)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(t[r]){case"#":yield*this.pushCount(t.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(wR),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,r,i=-1;do t=yield*this.pushNewline(),t>0?(r=yield*this.pushSpaces(!1),this.indentValue=i=r):r=0,r+=yield*this.pushSpaces(!0);while(t+r>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&Kn(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield jp.FLOW_END,yield*this.parseLineStart();let o=0;for(;n[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),n[o]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(wR),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||Kn(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),r=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let i=this.buffer.substring(0,r),n=i.indexOf(`
|
|
137
|
+
`,this.pos);if(n!==-1){for(;n!==-1;){let o=this.continueScalar(n+1);if(o===-1)break;n=i.indexOf(`
|
|
138
|
+
`,o)}n!==-1&&(r=n-(i[n-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let r=this.buffer[++t];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Kn(r)||r==="#")}*parseBlockScalar(){let t=this.pos-1,r=0,i;e:for(let o=this.pos;i=this.buffer[o];++o)switch(i){case" ":r+=1;break;case`
|
|
139
|
+
`:t=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
140
|
+
`)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(t+1);if(o===-1)break;t=this.buffer.indexOf(`
|
|
141
|
+
`,o)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
|
|
142
|
+
`;)i=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let o=t-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
|
|
143
|
+
`&&o>=this.pos&&o+1+r>a)t=o;else break}while(!0);return yield jp.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,r=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let o=this.buffer[i+1];if(Kn(o)||t&&Ab.has(o))break;r=i}else if(Kn(n)){let o=this.buffer[i+1];if(n==="\r"&&(o===`
|
|
144
|
+
`?(i+=1,n=`
|
|
145
|
+
`,o=this.buffer[i+1]):r=i),o==="#"||t&&Ab.has(o))break;if(n===`
|
|
146
|
+
`){let s=this.continueScalar(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(t&&Ab.has(n))break;r=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield jp.SCALAR,yield*this.pushToIndex(r+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,r){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(r&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(wR),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,i=this.charAt(1);if(Kn(i)||r&&Ab.has(i)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,r=this.buffer[t];for(;!Kn(r)&&r!==">";)r=this.buffer[++t];return yield*this.pushToIndex(r===">"?t+1:t,!1)}else{let t=this.pos+1,r=this.buffer[t];for(;r;)if(aue.has(r))r=this.buffer[++t];else if(r==="%"&&SF.has(this.buffer[t+1])&&SF.has(this.buffer[t+2]))r=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
|
147
|
+
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
148
|
+
`?yield*this.pushCount(2):0}*pushSpaces(t){let r=this.pos-1,i;do i=this.buffer[++r];while(i===" "||t&&i===" ");let n=r-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=r),n}*pushUntil(t){let r=this.pos,i=this.buffer[r];for(;!t(i);)i=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};xF.Lexer=kR});var IR=S(IF=>{"use strict";var xR=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let r=0,i=this.lineStarts.length;for(;r<i;){let o=r+i>>1;this.lineStarts[o]<t?r=o+1:i=o}if(this.lineStarts[r]===t)return{line:r+1,col:1};if(r===0)return{line:0,col:t};let n=this.lineStarts[r-1];return{line:r,col:t-n+1}}}};IF.LineCounter=xR});var TR=S(EF=>{"use strict";var uue=Pm("process"),PF=Tb(),lue=SR();function Ko(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function TF(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function RF(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Rb(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Mu(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Eb(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function AF(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ko(t.start,"explicit-key-ind")&&!Ko(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,RF(t.value)?t.value.end?Eb(t.value.end,t.sep):t.value.end=t.sep:Eb(t.start,t.sep),delete t.sep)}var PR=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new lue.Lexer,this.onNewLine=t}*parse(t,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,r))yield*this.next(i);r||(yield*this.end())}*next(t){if(this.source=t,uue.env.LOG_TOKENS&&console.log("|",PF.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let r=PF.tokenType(t);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let r=t??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let i=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in i?i.indent:0:r.type==="flow-collection"&&i.type==="document"&&(r.indent=0),r.type==="flow-collection"&&AF(r),i.type){case"document":i.value=r;break;case"block-scalar":i.props.push(r);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=r;else{Object.assign(n,{key:r,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:r}):n.value=r;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:r,sep:[]}):n.sep?n.value=r:Object.assign(n,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let n=r.items[r.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&TF(n.start)===-1&&(r.indent===0||n.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{TF(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let r=Rb(this.peek(2)),i=Mu(r),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
|
149
|
+
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
150
|
+
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Eb(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,n=i&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(n&&r.sep&&!r.value){let s=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>t.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":n||r.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):n||r.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ko(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(RF(r.key)&&!Ko(r.sep,"newline")){let s=Mu(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Ko(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=Mu(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||n?t.items.push({start:o,key:null,sep:[this.sourceToken]}):Ko(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);n||r.value?(t.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(t);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Ko(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(r.value){let i="end"in r.value?r.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Eb(n,r.start),n.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=t.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;r.value||Ko(r.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?t.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:n,sep:[]}):r.sep?this.stack.push(n):Object.assign(r,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=Rb(i),o=Mu(n);AF(t);let s=t.end.splice(1,t.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
|
|
151
|
+
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
152
|
+
`,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=Rb(t),i=Mu(r);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=Rb(t),i=Mu(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};EF.Parser=PR});var jF=S(Mp=>{"use strict";var OF=mR(),due=Ap(),Dp=Op(),fue=fA(),pue=qe(),mue=IR(),NF=TR();function CF(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new mue.LineCounter||null,prettyErrors:t}}function hue(e,t={}){let{lineCounter:r,prettyErrors:i}=CF(t),n=new NF.Parser(r?.addNewLine),o=new OF.Composer(t),s=Array.from(o.compose(n.parse(e)));if(i&&r)for(let a of s)a.errors.forEach(Dp.prettifyError(e,r)),a.warnings.forEach(Dp.prettifyError(e,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function zF(e,t={}){let{lineCounter:r,prettyErrors:i}=CF(t),n=new NF.Parser(r?.addNewLine),o=new OF.Composer(t),s=null;for(let a of o.compose(n.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Dp.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&r&&(s.errors.forEach(Dp.prettifyError(e,r)),s.warnings.forEach(Dp.prettifyError(e,r))),s}function gue(e,t,r){let i;typeof t=="function"?i=t:r===void 0&&t&&typeof t=="object"&&(r=t);let n=zF(e,r);if(!n)return null;if(n.warnings.forEach(o=>fue.warn(n.options.logLevel,o)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},r))}function yue(e,t,r){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let n=Math.round(r);r=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=r??t??{};if(!n)return}return pue.isDocument(e)&&!i?e.toString(r):new due.Document(e,i,r).toString(r)}Mp.parse=gue;Mp.parseAllDocuments=hue;Mp.parseDocument=zF;Mp.stringify=yue});var Kr=S(Xe=>{"use strict";var vue=mR(),$ue=Ap(),bue=WA(),AR=Op(),_ue=pp(),Go=qe(),wue=Fo(),kue=Ot(),Sue=Vo(),xue=Bo(),Iue=Tb(),Pue=SR(),Tue=IR(),Aue=TR(),Ob=jF(),DF=up();Xe.Composer=vue.Composer;Xe.Document=$ue.Document;Xe.Schema=bue.Schema;Xe.YAMLError=AR.YAMLError;Xe.YAMLParseError=AR.YAMLParseError;Xe.YAMLWarning=AR.YAMLWarning;Xe.Alias=_ue.Alias;Xe.isAlias=Go.isAlias;Xe.isCollection=Go.isCollection;Xe.isDocument=Go.isDocument;Xe.isMap=Go.isMap;Xe.isNode=Go.isNode;Xe.isPair=Go.isPair;Xe.isScalar=Go.isScalar;Xe.isSeq=Go.isSeq;Xe.Pair=wue.Pair;Xe.Scalar=kue.Scalar;Xe.YAMLMap=Sue.YAMLMap;Xe.YAMLSeq=xue.YAMLSeq;Xe.CST=Iue;Xe.Lexer=Pue.Lexer;Xe.LineCounter=Tue.LineCounter;Xe.Parser=Aue.Parser;Xe.parse=Ob.parse;Xe.parseAllDocuments=Ob.parseAllDocuments;Xe.parseDocument=Ob.parseDocument;Xe.stringify=Ob.stringify;Xe.visit=DF.visit;Xe.visitAsync=DF.visitAsync});import Ej from"node:process";var b={};Si(b,{$brand:()=>aw,$input:()=>Ak,$output:()=>Tk,INVALID:()=>$r,NEVER:()=>sw,TimePrecision:()=>jk,ZodAny:()=>WS,ZodArray:()=>XS,ZodBase64:()=>Ay,ZodBase64URL:()=>Ry,ZodBigInt:()=>Ic,ZodBigIntFormat:()=>Ny,ZodBoolean:()=>xc,ZodCIDRv4:()=>Py,ZodCIDRv6:()=>Ty,ZodCUID:()=>by,ZodCUID2:()=>_y,ZodCatch:()=>y0,ZodCodec:()=>Ad,ZodCompileAsyncError:()=>An,ZodCompileUnsupportedError:()=>Te,ZodCreditCard:()=>ZS,ZodCustom:()=>Rd,ZodCustomStringFormat:()=>Es,ZodDate:()=>Sd,ZodDefault:()=>d0,ZodDiscriminatedUnion:()=>e0,ZodE164:()=>Ey,ZodEmail:()=>gy,ZodEmoji:()=>vy,ZodEnum:()=>wc,ZodError:()=>nJ,ZodExactOptional:()=>jy,ZodFile:()=>a0,ZodFirstPartyTypeKind:()=>E0,ZodFunction:()=>P0,ZodGUID:()=>yy,ZodIBAN:()=>VS,ZodIPv4:()=>xy,ZodIPv6:()=>Iy,ZodISODate:()=>lo,ZodISODateTime:()=>uo,ZodISODuration:()=>po,ZodISOTime:()=>fo,ZodInstanceOf:()=>R0,ZodIntersection:()=>t0,ZodIssueCode:()=>sJ,ZodJWT:()=>Oy,ZodKSUID:()=>Sy,ZodLazy:()=>S0,ZodLiteral:()=>s0,ZodMAC:()=>FS,ZodMap:()=>i0,ZodNaN:()=>$0,ZodNanoID:()=>$y,ZodNever:()=>HS,ZodNonOptional:()=>Dy,ZodNull:()=>GS,ZodNullable:()=>l0,ZodNumber:()=>Sc,ZodNumberFormat:()=>Os,ZodObject:()=>xd,ZodOptional:()=>Ns,ZodPipe:()=>Td,ZodPrefault:()=>p0,ZodPreprocess:()=>b0,ZodPromise:()=>I0,ZodReadonly:()=>_0,ZodRealError:()=>Cr,ZodRecord:()=>_c,ZodSet:()=>o0,ZodString:()=>kc,ZodStringFormat:()=>tt,ZodSuccess:()=>g0,ZodSymbol:()=>BS,ZodTemplateLiteral:()=>k0,ZodTransform:()=>c0,ZodTuple:()=>r0,ZodType:()=>ge,ZodULID:()=>wy,ZodURL:()=>wd,ZodUUID:()=>ni,ZodUndefined:()=>KS,ZodUnion:()=>Id,ZodUnknown:()=>JS,ZodVoid:()=>YS,ZodXID:()=>ky,ZodXor:()=>QS,_ZodString:()=>hy,_default:()=>f0,_function:()=>Jz,any:()=>Rz,array:()=>ke,base64:()=>lz,base64url:()=>dz,bigint:()=>xz,boolean:()=>Tt,catch:()=>v0,check:()=>Hz,cidrv4:()=>cz,cidrv6:()=>uz,clone:()=>Fe,codec:()=>Bz,coerce:()=>N0,compile:()=>Nk,config:()=>xt,core:()=>En,creditCard:()=>pz,cuid:()=>ez,cuid2:()=>tz,currencyCode:()=>$z,custom:()=>My,date:()=>Oz,decode:()=>zS,decodeAsync:()=>DS,deepPartial:()=>cj,describe:()=>Yz,discriminatedUnion:()=>Pd,e164:()=>fz,email:()=>VC,emoji:()=>XC,encode:()=>CS,encodeAsync:()=>jS,endsWith:()=>lc,enum:()=>Gt,exactOptional:()=>u0,file:()=>qz,flattenError:()=>Tl,float32:()=>_z,float64:()=>wz,formatError:()=>Al,fromJSONSchema:()=>sj,function:()=>Jz,getDiscriminatedOption:()=>Sk,getErrorMap:()=>cJ,globalRegistry:()=>Bt,gt:()=>ti,gte:()=>en,guid:()=>BC,hash:()=>bz,hex:()=>vz,hostname:()=>yz,httpUrl:()=>YC,iban:()=>mz,includes:()=>cc,input:()=>lj,instanceof:()=>Qz,int:()=>py,int32:()=>kz,int64:()=>Iz,intersection:()=>Pc,invertCodec:()=>Kz,ipv4:()=>oz,ipv6:()=>az,iso:()=>Cs,json:()=>tj,jwt:()=>hz,keyof:()=>Nz,ksuid:()=>iz,lazy:()=>x0,length:()=>Ts,literal:()=>H,locales:()=>rc,looseObject:()=>Kt,looseRecord:()=>Dz,lowercase:()=>sc,lt:()=>ei,lte:()=>Qr,mac:()=>sz,map:()=>Mz,maxLength:()=>Ps,maxSize:()=>io,memoizer:()=>Kl,meta:()=>Xz,mime:()=>fc,minLength:()=>Ti,minSize:()=>ri,multipleOf:()=>no,nan:()=>Vz,nanoid:()=>QC,nativeEnum:()=>Uz,negative:()=>Hg,never:()=>Cy,nonnegative:()=>Xg,nonoptional:()=>h0,nonpositive:()=>Yg,normalize:()=>pc,null:()=>kd,nullable:()=>_d,nullish:()=>Fz,number:()=>Ze,object:()=>F,optional:()=>et,output:()=>dj,overwrite:()=>Rn,parse:()=>RS,parseAsync:()=>ES,partialRecord:()=>jz,pipe:()=>my,positive:()=>Jg,prefault:()=>m0,preprocess:()=>Ed,prettifyError:()=>fw,promise:()=>Wz,properties:()=>dc,property:()=>Qg,readonly:()=>w0,record:()=>rt,refine:()=>T0,regex:()=>oc,regexes:()=>Xr,registry:()=>wg,safeDecode:()=>LS,safeDecodeAsync:()=>qS,safeEncode:()=>MS,safeEncodeAsync:()=>US,safeParse:()=>OS,safeParseAsync:()=>NS,set:()=>Lz,setErrorMap:()=>aJ,size:()=>Is,slugify:()=>yc,startsWith:()=>uc,strictObject:()=>Cz,string:()=>A,stringFormat:()=>gz,stringbool:()=>ej,success:()=>Zz,superRefine:()=>A0,symbol:()=>Tz,templateLiteral:()=>Gz,toJSONSchema:()=>As,toLowerCase:()=>hc,toUpperCase:()=>gc,toZod:()=>bl,transform:()=>zy,treeifyError:()=>dw,trim:()=>mc,tuple:()=>n0,uint32:()=>Sz,uint64:()=>Pz,ulid:()=>rz,undefined:()=>Az,union:()=>Ye,unknown:()=>it,uppercase:()=>ac,url:()=>HC,util:()=>R,uuid:()=>KC,uuidv4:()=>GC,uuidv6:()=>WC,uuidv7:()=>JC,validate:()=>Ka,validateAsync:()=>Ga,void:()=>Ez,withParser:()=>kg,xid:()=>nz,xor:()=>zz});var En={};Si(En,{$ZodAny:()=>jh,$ZodArray:()=>qh,$ZodAsyncError:()=>Or,$ZodBase64:()=>bh,$ZodBase64URL:()=>wh,$ZodBigInt:()=>Ul,$ZodBigIntFormat:()=>Oh,$ZodBoolean:()=>Ha,$ZodCIDRv4:()=>gh,$ZodCIDRv6:()=>vh,$ZodCUID:()=>ch,$ZodCUID2:()=>uh,$ZodCatch:()=>og,$ZodCheck:()=>Qe,$ZodCheckBigIntFormat:()=>Xw,$ZodCheckEndsWith:()=>lk,$ZodCheckGreaterThan:()=>Gm,$ZodCheckIncludes:()=>ck,$ZodCheckLengthEquals:()=>ik,$ZodCheckLessThan:()=>Km,$ZodCheckLowerCase:()=>sk,$ZodCheckMaxLength:()=>rk,$ZodCheckMaxSize:()=>Qw,$ZodCheckMimeType:()=>pk,$ZodCheckMinLength:()=>nk,$ZodCheckMinSize:()=>ek,$ZodCheckMultipleOf:()=>Hw,$ZodCheckNumberFormat:()=>Yw,$ZodCheckOverwrite:()=>mk,$ZodCheckProperties:()=>fk,$ZodCheckProperty:()=>dk,$ZodCheckRegex:()=>ok,$ZodCheckSizeEquals:()=>tk,$ZodCheckStartsWith:()=>uk,$ZodCheckStringFormat:()=>Wa,$ZodCheckUpperCase:()=>ak,$ZodCodec:()=>Xa,$ZodCreditCard:()=>xh,$ZodCustom:()=>dg,$ZodCustomStringFormat:()=>Rh,$ZodCyclicError:()=>hg,$ZodDate:()=>Uh,$ZodDefault:()=>tg,$ZodDiscriminatedUnion:()=>Vh,$ZodE164:()=>kh,$ZodEmail:()=>th,$ZodEmoji:()=>sh,$ZodEncodeError:()=>to,$ZodEnum:()=>Jh,$ZodError:()=>lw,$ZodExactOptional:()=>Qh,$ZodFile:()=>Yh,$ZodFunction:()=>ug,$ZodGUID:()=>Qm,$ZodIBAN:()=>Ph,$ZodIPv4:()=>ph,$ZodIPv6:()=>mh,$ZodISODate:()=>bk,$ZodISODateTime:()=>$k,$ZodISODuration:()=>wk,$ZodISOTime:()=>_k,$ZodIntersection:()=>Bh,$ZodJWT:()=>Ah,$ZodKSUID:()=>fh,$ZodLazy:()=>Qa,$ZodLiteral:()=>Hh,$ZodMAC:()=>hh,$ZodMap:()=>Gh,$ZodNaN:()=>sg,$ZodNanoID:()=>ah,$ZodNever:()=>Mh,$ZodNonOptional:()=>ng,$ZodNull:()=>zh,$ZodNullable:()=>eg,$ZodNumber:()=>Ll,$ZodNumberFormat:()=>Eh,$ZodObject:()=>Fh,$ZodObjectJIT:()=>kk,$ZodOptional:()=>Fl,$ZodPipe:()=>Zl,$ZodPrefault:()=>rg,$ZodPreprocess:()=>xk,$ZodPromise:()=>lg,$ZodReadonly:()=>ag,$ZodRealError:()=>Nr,$ZodRecord:()=>Kh,$ZodRegistry:()=>_g,$ZodSet:()=>Wh,$ZodString:()=>ro,$ZodStringFormat:()=>We,$ZodSuccess:()=>ig,$ZodSymbol:()=>Nh,$ZodTemplateLiteral:()=>cg,$ZodTransform:()=>Xh,$ZodTuple:()=>ql,$ZodType:()=>ue,$ZodULID:()=>lh,$ZodURL:()=>oh,$ZodUUID:()=>eh,$ZodUndefined:()=>Ch,$ZodUnion:()=>Ya,$ZodUnknown:()=>Dh,$ZodVoid:()=>Lh,$ZodXID:()=>dh,$ZodXor:()=>Zh,$brand:()=>aw,$constructor:()=>x,$input:()=>Ak,$output:()=>Tk,Doc:()=>_s,INVALID:()=>$r,JSONSchema:()=>qC,JSONSchemaGenerator:()=>ly,NEVER:()=>sw,TimePrecision:()=>jk,URL_BAD_FORMAT:()=>yk,URL_UNPARSEABLE:()=>Cl,ZodCompileAsyncError:()=>An,ZodCompileUnsupportedError:()=>Te,_any:()=>Zg,_array:()=>qk,_base64:()=>dd,_base64url:()=>fd,_bigint:()=>Dg,_boolean:()=>jg,_catch:()=>BW,_check:()=>xC,_cidrv4:()=>ud,_cidrv6:()=>ld,_coercedBigint:()=>Lk,_coercedBoolean:()=>Mk,_coercedDate:()=>Uk,_coercedNumber:()=>Dk,_coercedString:()=>zk,_creditCard:()=>Tg,_cuid:()=>rd,_cuid2:()=>nd,_custom:()=>ty,_date:()=>Gg,_decode:()=>zm,_decodeAsync:()=>Dm,_default:()=>FW,_discriminatedUnion:()=>RW,_e164:()=>pd,_email:()=>Wl,_emoji:()=>ed,_encode:()=>Cm,_encodeAsync:()=>jm,_endsWith:()=>lc,_enum:()=>jW,_file:()=>ey,_float32:()=>Og,_float64:()=>Ng,_gt:()=>ti,_gte:()=>en,_guid:()=>Jl,_iban:()=>Ag,_includes:()=>cc,_int:()=>Eg,_int32:()=>Cg,_int64:()=>Mg,_intersection:()=>EW,_ipv4:()=>ad,_ipv6:()=>cd,_isoDate:()=>gd,_isoDateTime:()=>hd,_isoDuration:()=>vd,_isoTime:()=>yd,_jwt:()=>md,_ksuid:()=>sd,_lazy:()=>JW,_length:()=>Ts,_literal:()=>MW,_lowercase:()=>sc,_lt:()=>ei,_lte:()=>Qr,_mac:()=>Pg,_map:()=>CW,_max:()=>Qr,_maxLength:()=>Ps,_maxSize:()=>io,_mime:()=>fc,_min:()=>en,_minLength:()=>Ti,_minSize:()=>ri,_multipleOf:()=>no,_nan:()=>Wg,_nanoid:()=>td,_nativeEnum:()=>DW,_negative:()=>Hg,_never:()=>Bg,_nonnegative:()=>Xg,_nonoptional:()=>ZW,_nonpositive:()=>Yg,_normalize:()=>pc,_null:()=>Fg,_nullable:()=>qW,_number:()=>Rg,_optional:()=>UW,_overwrite:()=>Rn,_parse:()=>Ua,_parseAsync:()=>qa,_pipe:()=>KW,_positive:()=>Jg,_promise:()=>HW,_properties:()=>dc,_property:()=>Qg,_readonly:()=>GW,_record:()=>NW,_refine:()=>ry,_regex:()=>oc,_safeDecode:()=>Lm,_safeDecodeAsync:()=>qm,_safeEncode:()=>Mm,_safeEncodeAsync:()=>Um,_safeParse:()=>Fa,_safeParseAsync:()=>Va,_set:()=>zW,_size:()=>Is,_slugify:()=>yc,_startsWith:()=>uc,_string:()=>Ig,_stringFormat:()=>oo,_stringbool:()=>sy,_success:()=>VW,_superRefine:()=>ny,_symbol:()=>Ug,_templateLiteral:()=>WW,_toLowerCase:()=>hc,_toUpperCase:()=>gc,_transform:()=>LW,_trim:()=>mc,_tuple:()=>OW,_uint32:()=>zg,_uint64:()=>Lg,_ulid:()=>id,_undefined:()=>qg,_union:()=>TW,_unknown:()=>Vg,_uppercase:()=>ac,_url:()=>ic,_uuid:()=>Hl,_uuidv4:()=>Yl,_uuidv6:()=>Xl,_uuidv7:()=>Ql,_void:()=>Kg,_xid:()=>od,_xor:()=>AW,base64Charset:()=>$h,base64urlCharset:()=>Ml,canParseURL:()=>vk,clone:()=>Fe,compile:()=>Nk,compileFn:()=>Sg,config:()=>xt,createStandardJSONSchemaMethod:()=>vc,createToJSONSchemaMethod:()=>Zk,decode:()=>IO,decodeAsync:()=>TO,describe:()=>iy,encode:()=>xO,encodeAsync:()=>PO,extractDefs:()=>ao,finalize:()=>co,flattenError:()=>Tl,formatError:()=>Al,getDiscriminatedOption:()=>Sk,globalConfig:()=>qt,globalRegistry:()=>Bt,handleUnrepresentable:()=>jt,initializeContext:()=>so,isBackEdge:()=>yg,isRecursiveSchema:()=>gg,isValidBase64:()=>Dl,isValidBase64URL:()=>_h,isValidCIDRv6:()=>yh,isValidCreditCard:()=>Sh,isValidIBAN:()=>Ih,isValidIPv6:()=>jl,isValidJWT:()=>Th,locales:()=>rc,memoizer:()=>Kl,mergeValues:()=>Ja,meta:()=>oy,parse:()=>vs,parseAsync:()=>$s,parseURLObject:()=>XO,prettifyError:()=>fw,process:()=>He,processSchema:()=>He,regexes:()=>Xr,registry:()=>wg,safeDecode:()=>RO,safeDecodeAsync:()=>OO,safeEncode:()=>AO,safeEncodeAsync:()=>EO,safeParse:()=>Za,safeParseAsync:()=>Ba,standardProps:()=>Xm,stripTabAndNewline:()=>zl,toDotPath:()=>kO,toJSONSchema:()=>As,toZod:()=>bl,treeifyError:()=>dw,urlHostnameOk:()=>nh,urlProtocolOk:()=>ih,util:()=>R,validate:()=>Ka,validateAsync:()=>Ga,validateURL:()=>rh,version:()=>hk,withParser:()=>kg});var R={};Si(R,{BIGINT_FORMAT_RANGES:()=>Sl,CONSTANT_CATCH:()=>Om,Class:()=>J_,NUMBER_FORMAT_RANGES:()=>kl,aborted:()=>vr,allowsEval:()=>X_,assert:()=>lK,assertEqual:()=>sK,assertIs:()=>cK,assertNever:()=>uK,assertNotEqual:()=>aK,assignProp:()=>Vt,attachSchema:()=>Em,base64ToUint8Array:()=>yO,base64urlToUint8Array:()=>wK,cached:()=>ja,captureStackTrace:()=>Am,cleanEnum:()=>_K,cleanRegex:()=>Ii,clone:()=>Fe,cloneDef:()=>pK,codePointLength:()=>ys,constantCatch:()=>iw,createTransparentProxy:()=>$K,defineLazy:()=>H_,defineLazyInternal:()=>ve,derived:()=>IK,esc:()=>yr,escapeRegex:()=>dn,explicitlyAborted:()=>tw,extend:()=>dO,finalizeIssue:()=>Er,floatSafeRemainder:()=>_l,getElementAtPath:()=>mK,getEnumValues:()=>Ca,getLengthableOrigin:()=>Il,getParsedType:()=>vK,getSizableOrigin:()=>xl,hexToUint8Array:()=>SK,hide:()=>Pl,installLazyProp:()=>nw,isObject:()=>gs,isPlainObject:()=>ln,issue:()=>La,joinValues:()=>P,jsonStringifyReplacer:()=>za,members:()=>rw,merge:()=>mO,mergeDefs:()=>un,normalizeParams:()=>j,nullish:()=>Tm,numKeys:()=>yK,objectClone:()=>dK,omit:()=>lO,optionalKeys:()=>ew,own:()=>Qn,parsedType:()=>O,partial:()=>hO,pick:()=>uO,prefixIssues:()=>Rr,primitiveTypes:()=>Q_,promiseAllObject:()=>hK,propertyKeyTypes:()=>wl,randomString:()=>gK,rawShape:()=>Da,required:()=>gO,safeExtend:()=>pO,shallowClone:()=>Ma,slugify:()=>Y_,stringifyPrimitive:()=>E,toZod:()=>bl,uint8ArrayToBase64:()=>vO,uint8ArrayToBase64url:()=>kK,uint8ArrayToHex:()=>xK,unwrapMessage:()=>Na});function sK(e){return e}function aK(e){return e}function bl(){return e=>e}function cK(e){}function uK(e){throw new Error("Unexpected value in exhaustive check")}function lK(e){}function Ca(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function P(e,t="|"){return e.map(r=>E(r)).join(t)}function za(e,t){return typeof t=="bigint"?t.toString():t}var W_=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function ja(e){return new W_(e)}function Tm(e){return e==null}function Ii(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function _l(e,t){let r=e/t,i=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var sO=Symbol("evaluating");function H_(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==sO)return i===void 0&&(i=sO,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function dK(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Vt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Da(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function xi(e){return Da(e._zod.def)??e._zod.def.shape}function aO(e,t,r){Object.defineProperty(e,t,{get(){let i=r();return Vt(this,t,i),i},enumerable:!0,configurable:!0})}function cO(e,t,r){t in e?Vt(e,t,r):e[t]=r}function hs(e,t,r,i){let n=xi(t);for(let o of r){let s=Object.getOwnPropertyDescriptor(n,o);s.enumerable&&(s.get?aO(e,o,()=>{let a=t._zod.def.shape[o];return i?i(a,o):a}):cO(e,o,i?i(s.value,o):s.value))}}function fK(e,t){for(let r of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,r);i.enumerable&&(i.get?aO(e,r,()=>t[r]):cO(e,r,i.value))}}function un(...e){let t={};for(let r of e){let i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function pK(e){return un(e._zod.def)}function mK(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function hK(e){let t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{let n={};for(let o=0;o<t.length;o++)n[t[o]]=i[o];return n})}function gK(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function yr(e){return JSON.stringify(e)}function Y_(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Am="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var X_=ja(()=>{if(qt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ln(e){if(gs(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(gs(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ma(e){return ln(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function yK(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var vK=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}`)}},wl=new Set(["string","number","symbol"]),Q_=new Set(["string","number","bigint","boolean","symbol","undefined"]);function dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function j(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 $K(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function E(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ew(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var kl={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]},Sl={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function uO(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return hs(o,e,Rm(e,t)),Fe(e,un(r,{shape:o,checks:[]}))}function Rm(e,t){let r=xi(e),i=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&i.push(n)}return i}function lO(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(Rm(e,t)),s={};return hs(s,e,Reflect.ownKeys(xi(e)).filter(a=>!o.has(a))),Fe(e,un(r,{shape:s,checks:[]}))}function dO(e,t){if(!ln(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=xi(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Fe(e,un(e._zod.def,{shape:fO(e,t)}))}function fO(e,t){let r={};return hs(r,e,Reflect.ownKeys(xi(e))),fK(r,t),r}function pO(e,t){if(!ln(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Fe(e,un(e._zod.def,{shape:fO(e,t)}))}function mO(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};hs(r,e,Reflect.ownKeys(xi(e))),hs(r,t,Reflect.ownKeys(xi(t)));let i=un(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Fe(e,i)}function hO(e,t,r,i="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let a=r?new Set(Rm(t,r)):void 0,c={};return hs(c,t,Reflect.ownKeys(xi(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),Fe(t,un(t._zod.def,{shape:c,checks:[]}))}function gO(e,t,r){let i=r?new Set(Rm(t,r)):void 0,n={};return hs(n,t,Reflect.ownKeys(xi(t)),(o,s)=>i&&!i.has(s)?o:new e({type:"nonoptional",innerType:o})),Fe(t,un(t._zod.def,{shape:n}))}function vr(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 tw(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 Rr(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Na(e){return typeof e=="string"?e:e?.message}function Em(e,t,r){var i;for(let n=t;n<e.length;n++)(i=e[n]).schema??(i.schema=r)}function Er(e,t,r){var i;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Na(e.inst?._zod.def?.error?.(e))??Na(o?.(e))??Na(t?.error?.(e))??Na(r.customError?.(e))??Na(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function xl(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var bK=/[\uD800-\uDBFF]/;function ys(e){let t=e.length;if(!bK.test(e))return t;let r=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(r--,i++);return r}function Il(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function O(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 La(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function _K(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function yO(e){let t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function vO(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function wK(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return yO(t+r)}function kK(e){return vO(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function SK(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 i=0;i<t.length;i+=2)r[i/2]=Number.parseInt(t.slice(i,i+2),16);return r}function xK(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var J_=class{constructor(...t){}};function rw(e,t){for(let r in t){let i=Object.getOwnPropertyDescriptor(t,r);i.get?Object.defineProperty(e,r,{...i,enumerable:!1}):PK(e,r,i.value)}}function Qn(e,t,r,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:r}),r}function Pl(e,t,r){return Qn(e,t,r,!1)}function IK(e,t){for(let r in e){let i=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Qn(this,r,i(this))},set(n){Qn(this,r,n)}})}return t}function PK(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Qn(this,t,r.bind(this))},set(i){Qn(this,t,i)}})}function TK(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var G_,eo=!1,AK={configurable:!0,get(){eo=!0}};function ve(e,t,r){let i=Object.getPrototypeOf(e._zod);if(t in i&&G_!==e._zod){G_=void 0;return}G_=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,AK);let n=eo;eo=!1;try{let o=r(this);return eo?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),eo=eo||n,o}catch(o){throw delete this[t],eo=eo||n,o}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function nw(e,t,r,i){let n=TK(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=r(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}var Om="~constantCatch";function iw(e){let t=()=>e;return t[Om]=!0,t}var $O,sw=Object.freeze({status:"aborted"}),ow={value:void 0,enumerable:!1},bO="captureStackTrace"in Error?Error:null;function RK(e){let t=bO;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return bO=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function x(e,t,r,i){let n={};function o(f){this.def=f,this.constr=d,this.traits=new Set}o.prototype=n;let s=r,a=s&&new WeakSet;function c(f,p){if(f._zod){if(f._zod.traits.has(e))return}else{ow.value=new o(p);try{Object.defineProperty(f,"_zod",ow)}finally{ow.value=void 0}}if(f._zod.traits.add(e),t(f,p),a){let h=Object.getPrototypeOf(f),g=f._zod.constr.prototype,y=h;for(;y&&y!==g;)y=Object.getPrototypeOf(y);let v=y??h;a.has(v)||(a.add(v),rw(v,s))}let m=d.prototype;for(let h in m)Object.prototype.hasOwnProperty.call(m,h)&&(h in f||(f[h]=m[h].bind(f)))}let u=i?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(f){let p=i?.Parent?RK(l):this;c(p,f);let m=p._zod.deferred;if(m){for(let g of m)g();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>i?.Parent&&f instanceof i.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var aw=Symbol("zod_brand"),Or=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},to=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};($O=globalThis).__zod_globalConfig??($O.__zod_globalConfig={});var qt=globalThis.__zod_globalConfig;function xt(e){return e&&Object.assign(qt,e),qt}function EK(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,za,2)),e.message}function OK(e){this._zod.message=e}var NK={get:EK,set:OK,enumerable:!0,configurable:!0},uw={value:void 0,enumerable:!1},_O=new WeakSet([Object.prototype,Error.prototype]),wO=(e,t)=>{e.name="$ZodError",uw.value=t,Object.defineProperty(e,"issues",uw),uw.value=void 0,Object.defineProperty(e,"message",NK);let r=Object.getPrototypeOf(e);_O.has(r)||(_O.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},lw=x("$ZodError",wO),Nr=x("$ZodError",wO,void 0,{Parent:Error});function CK(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function Tl(e,t=r=>r.message){let r={},i=[];for(let n of e.issues)n.path.length>0?CK(r,n.path[0],()=>[]).push(t(n)):i.push(t(n));return{formErrors:i,fieldErrors:r}}function Al(e,t=r=>r.message){let r={_errors:[]},i=(n,o=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>i({issues:a},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let a=[...o,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[l];d&&f._errors.push(t(s)),c=f,u++}}}};return i(e),r}function dw(e,t=r=>r.message){let r={errors:[]},i=(n,o=[])=>{var s;for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>i({issues:c},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let c=[...o,...a.path];if(c.length===0){r.errors.push(t(a));continue}let u=r,l=0;for(;l<c.length;){let d=c[l],f=l===c.length-1;typeof d=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,d)||Object.defineProperty(u.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[d]):(u.items??(u.items=[]),(s=u.items)[d]??(s[d]={errors:[]}),u=u.items[d]),f&&u.errors.push(t(a)),l++}}};return i(e),r}function kO(e){let t=[],r=e.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function fw(e){let t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${kO(i.path)}`);return t.join(`
|
|
153
|
+
`)}function Nm(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ua=e=>{let t=(r,i,n,o)=>{let s=n?{...n,async:!1}:{async:!1},a=r._zod.run({value:i,issues:[]},s);if(a instanceof Promise)throw new Or;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map(u=>Er(u,s,xt())));throw Am(c,o?.callee??t),c}return a.value};return t},vs=Ua(Nr),qa=e=>{let t=async(r,i,n,o)=>{let s=n?{...n,async:!0}:{async:!0},a=r._zod.run({value:i,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??e)(a.issues.map(u=>Er(u,s,xt())));throw Am(c,o?.callee??t),c}return a.value};return t},$s=qa(Nr),Fa=e=>(t,r,i)=>{let n=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new Or;return o.issues.length?SO(e,o.issues,n):{success:!0,data:o.value}},Za=Fa(Nr);function SO(e,t,r){let i;return{success:!1,get error(){return i||(i=new e(t.map(n=>Er(n,r,xt()))),t=void 0,r=void 0),i},set error(n){i=n,t=void 0,r=void 0}}}var Va=e=>async(t,r,i)=>{let n=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?SO(e,o.issues,n):{success:!0,data:o.value}},Ba=Va(Nr),jK=Symbol.for("zod.compile.invalid"),DK=Symbol.for("zod.compile.fallback"),Ka=((e,t,r)=>{let i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==jK)return!0;if(i.definite===!0&&r===void 0)return!1}return MK(e,t,r)});function MK(e,t,r){let i=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,o;if(n?(i[DK]=!0,o=n({value:t,issues:[]},i)):o=e._zod.run({value:t,issues:[]},i),o instanceof Promise)throw new Or;return o.issues.length===0}var Ga=async(e,t,r)=>{let i=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length===0},Cm=e=>{let t=Ua(e),r=(i,n,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return t(i,n,a,Nm(r,s))};return r},xO=Cm(Nr),zm=e=>{let t=Ua(e),r=(i,n,o,s)=>t(i,n,o,Nm(r,s));return r},IO=zm(Nr),jm=e=>{let t=qa(e),r=async(i,n,o,s)=>{let a=o?{...o,direction:"backward"}:{direction:"backward"};return await t(i,n,a,Nm(r,s))};return r},PO=jm(Nr),Dm=e=>{let t=qa(e),r=async(i,n,o,s)=>await t(i,n,o,Nm(r,s));return r},TO=Dm(Nr),Mm=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Fa(e)(t,r,n)},AO=Mm(Nr),Lm=e=>(t,r,i)=>Fa(e)(t,r,i),RO=Lm(Nr),Um=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return Va(e)(t,r,n)},EO=Um(Nr),qm=e=>async(t,r,i)=>Va(e)(t,r,i),OO=qm(Nr);var Xr={};Si(Xr,{anyString:()=>Lw,base64:()=>Rw,base64url:()=>Ew,bigint:()=>qw,boolean:()=>Fw,browserEmail:()=>KK,cidrv4:()=>Tw,cidrv6:()=>Aw,creditCard:()=>Fm,cuid:()=>mw,cuid2:()=>hw,currencyCode:()=>zw,date:()=>jw,datetime:()=>Mw,domain:()=>Nw,duration:()=>_w,e164:()=>Cw,email:()=>kw,emoji:()=>Sw,extendedDuration:()=>LK,guid:()=>ww,hex:()=>Gw,hostname:()=>Ow,html5Email:()=>ZK,httpProtocol:()=>Rl,iban:()=>Zm,idnEmail:()=>BK,integer:()=>El,ipv4:()=>xw,ipv6:()=>Iw,ksuid:()=>vw,lowercase:()=>Bw,mac:()=>Pw,md5_base64:()=>HK,md5_base64url:()=>YK,md5_hex:()=>JK,nanoid:()=>$w,nanoidOfLength:()=>bw,null:()=>Zw,number:()=>Pi,rfc5322Email:()=>VK,sha1_base64:()=>QK,sha1_base64url:()=>e9,sha1_hex:()=>XK,sha256_base64:()=>r9,sha256_base64url:()=>n9,sha256_hex:()=>t9,sha384_base64:()=>o9,sha384_base64url:()=>s9,sha384_hex:()=>i9,sha512_base64:()=>c9,sha512_base64url:()=>u9,sha512_hex:()=>a9,string:()=>Uw,time:()=>Dw,ulid:()=>gw,undefined:()=>Vw,unicodeEmail:()=>NO,uppercase:()=>Kw,uuid:()=>bs,uuid4:()=>UK,uuid6:()=>qK,uuid7:()=>FK,xid:()=>yw});var mw=/^[cC][0-9a-z]{6,}$/,hw=/^[0-9a-z]+$/,gw=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,yw=/^[0-9a-vA-V]{20}$/,vw=/^[A-Za-z0-9]{27}$/,$w=/^[a-zA-Z0-9_-]{21}$/;function bw(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var _w=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,LK=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ww=/^([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})$/,bs=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)$/,UK=bs(4),qK=bs(6),FK=bs(7),kw=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ZK=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,VK=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,NO=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,BK=NO,KK=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,GK="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Sw(){return new RegExp(GK,"u")}var xw=/^(?:(?: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])$/,Iw=/^(([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}|:))$/,Pw=e=>{let t=dn(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Tw=/^((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])$/,Aw=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ew=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ow=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Nw=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Rl=/^https?$/,Cw=/^\+[1-9]\d{6,14}$/,Fm=/^\d(?:[ -]?\d){11,18}$/,zw=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Zm=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,CO="(?:(?:\\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])))";function WK(e){return new RegExp(`^${e}$`)}var jw=WK(CO);function pw(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Dw(e){return new RegExp(`^${pw(e)}$`)}function Mw(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${pw({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${r}|${pw({precision:e.precision})}`:r;return new RegExp(`^${CO}T(?:${i})$`)}var Lw=/^[\s\S]{0,}$/,Uw=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},qw=/^-?\d+n?$/,El=/^-?\d+$/,Pi=/^-?\d+(?:\.\d+)?$/,Fw=/^(?:true|false)$/i,Zw=/^null$/i;var Vw=/^undefined$/i;var Bw=/^[^A-Z]*$/,Kw=/^[^a-z]*$/,Gw=/^[0-9a-fA-F]*$/;function Ol(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Nl(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var JK=/^[0-9a-fA-F]{32}$/,HK=Ol(22,"=="),YK=Nl(22),XK=/^[0-9a-fA-F]{40}$/,QK=Ol(27,"="),e9=Nl(27),t9=/^[0-9a-fA-F]{64}$/,r9=Ol(43,"="),n9=Nl(43),i9=/^[0-9a-fA-F]{96}$/,o9=Ol(64,""),s9=Nl(64),a9=/^[0-9a-fA-F]{128}$/,c9=Ol(86,"=="),u9=Nl(86);var Qe=x("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ww=e=>{let t=e.value;return!Tm(t)&&t.size!==void 0},Jw=e=>{let t=e.value;return!Tm(t)&&t.length!==void 0},Vm={number:"number",bigint:"bigint",object:"date"},Km=x("$ZodCheckLessThan",(e,t)=>{Qe.init(e,t);let r=Vm[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:Vm[typeof i.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Gm=x("$ZodCheckGreaterThan",(e,t)=>{Qe.init(e,t);let r=Vm[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:Vm[typeof i.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hw=x("$ZodCheckMultipleOf",(e,t)=>{Qe.init(e,t),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"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):_l(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})}}),Yw=x("$ZodCheckNumberFormat",(e,t)=>{Qe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[n,o]=kl[t.format];e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}a<n&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Xw=x("$ZodCheckBigIntFormat",(e,t)=>{Qe.init(e,t);let[r,i]=Sl[t.format];e._zod.check=n=>{let o=n.value;o<r&&n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>i&&n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Qw=x("$ZodCheckMaxSize",(e,t)=>{var r;Qe.init(e,t),(r=e._zod.def).when??(r.when=Ww),e._zod.check=i=>{let n=i.value;n.size<=t.maximum||i.issues.push({origin:xl(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ek=x("$ZodCheckMinSize",(e,t)=>{var r;Qe.init(e,t),(r=e._zod.def).when??(r.when=Ww),e._zod.check=i=>{let n=i.value;n.size>=t.minimum||i.issues.push({origin:xl(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),tk=x("$ZodCheckSizeEquals",(e,t)=>{var r;Qe.init(e,t),(r=e._zod.def).when??(r.when=Ww),e._zod.check=i=>{let n=i.value,o=n.size;if(o===t.size)return;let s=o>t.size;i.issues.push({origin:xl(n),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),rk=x("$ZodCheckMaxLength",(e,t)=>{var r;Qe.init(e,t),(r=e._zod.def).when??(r.when=Jw),e._zod.check=i=>{let n=i.value,o=n.length;if((typeof n=="string"&&o>t.maximum?ys(n):o)<=t.maximum)return;let a=Il(n);i.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),nk=x("$ZodCheckMinLength",(e,t)=>{var r;Qe.init(e,t),(r=e._zod.def).when??(r.when=Jw),e._zod.check=i=>{let n=i.value,o=n.length;if((typeof n=="string"&&o>=t.minimum&&o<t.minimum*2?ys(n):o)>=t.minimum)return;let a=Il(n);i.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ik=x("$ZodCheckLengthEquals",(e,t)=>{var r;Qe.init(e,t),(r=e._zod.def).when??(r.when=Jw),e._zod.check=i=>{let n=i.value,o=n.length,s=typeof n=="string"&&o>=t.length&&o<=t.length*2?ys(n):o;if(s===t.length)return;let a=Il(n),c=s>t.length;i.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Wa=x("$ZodCheckStringFormat",(e,t)=>{var r,i;Qe.init(e,t),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})}):(i=e._zod).check??(i.check=()=>{})}),ok=x("$ZodCheckRegex",(e,t)=>{Wa.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})}}),sk=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Bw),Wa.init(e,t)}),ak=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Kw),Wa.init(e,t)}),ck=x("$ZodCheckIncludes",(e,t)=>{Qe.init(e,t);let r=dn(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=i,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})}}),uk=x("$ZodCheckStartsWith",(e,t)=>{Qe.init(e,t);let r=new RegExp(`^${dn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),lk=x("$ZodCheckEndsWith",(e,t)=>{Qe.init(e,t);let r=new RegExp(`.*${dn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function Bm(e,t,r){e.issues.length&&t.issues.push(...Rr(r,e.issues))}var dk=x("$ZodCheckProperty",(e,t)=>{Qe.init(e,t),e._zod.check=r=>{let i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>Bm(n,r,t.property));Bm(i,r,t.property)}}),fk=x("$ZodCheckProperties",(e,t)=>{Qe.init(e,t),Pl(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=i=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let n=i.value,o;for(let[s,a]of r){let c=a._zod.run({value:n[s],issues:[]},{});c instanceof Promise?(o??(o=[]),o.push(c.then(u=>Bm(u,i,s)))):Bm(c,i,s)}if(o)return Promise.all(o).then(()=>{})}}),pk=x("$ZodCheckMimeType",(e,t)=>{Qe.init(e,t);let r=new Set(t.mime);e._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),mk=x("$ZodCheckOverwrite",(e,t)=>{Qe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var _s=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
|
|
154
|
+
`).filter(s=>s),n=Math.min(...i.map(s=>s.length-s.trimStart().length)),o=i.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
155
|
+
${r.join(`
|
|
156
|
+
`)}
|
|
157
|
+
};`)(...Object.values(this.closed))}};var hk={major:4,minor:6,patch:5};var ue=x("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=hk;let i=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...i??[]]:i?.length?[...i]:[];for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,c,u)=>{if(a.memo)return a;let l=vr(a),d;for(let f of c){if(f._zod.def.when){if(tw(a)||!f._zod.def.when(a))continue}else if(l)continue;let p=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&u?.async===!1)throw new Or;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(Em(a.issues,p,e),l||(l=vr(a,p)))});else{if(a.issues.length===p)continue;Em(a.issues,p,e),l||(l=vr(a,p))}}return d?d.then(()=>a):a},s=(a,c,u)=>{if(vr(a))return a.aborted=!0,a;let l=o(c,n,u);if(l instanceof Promise){if(u.async===!1)throw new Or;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>s(d,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Or;return u.then(l=>o(l,n,c))}return o(u,n,c)}}},{get"~standard"(){return Pl(this,"~standard",Xm(this))},set"~standard"(e){Qn(this,"~standard",e)}}),YO=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Er(r,t,xt()))}:{value:e.value};async function l9(e,t){let r={async:!0};return YO(await e._zod.run({value:t,issues:[]},r),r)}function Xm(e){return{validate:t=>{let r={async:!1};try{let i=e._zod.run({value:t,issues:[]},r);if(!(i instanceof Promise))return YO(i,r)}catch{}return l9(e,t)},vendor:"zod",version:1}}var ro=x("$ZodString",(e,t)=>{ue.init(e,t),e._zod.pattern=t.pattern??Lw,e._zod.parse=(r,i)=>{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}}),We=x("$ZodStringFormat",(e,t)=>{Wa.init(e,t),ro.init(e,t)}),Qm=x("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ww),We.init(e,t)}),eh=x("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=bs(i))}else t.pattern??(t.pattern=bs());We.init(e,t)}),th=x("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kw),We.init(e,t)}),yk=1,Cl=2;function vk(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function rh(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?vk(e)||Cl:XO(e,t)}function XO(e,t){if(!t.normalize&&t.protocol?.source===Rl.source&&!/^https?:\/\//i.test(e))return yk;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Cl}return new URL(e)}catch{return Cl}}var d9=/[\t\n\r]/g;function zl(e){return e.replace(d9,"")}function nh(e,t){return t.lastIndex=0,t.test(e.hostname)}function ih(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var oh=x("$ZodURL",(e,t)=>{We.init(e,t),e._zod.check=r=>{try{let i=r.value.trim(),n=rh(i,t);if(n===yk){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Cl){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=zl(i);return}t.hostname&&!nh(n,t.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&&!ih(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:zl(i);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),sh=x("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Sw()),We.init(e,t)}),ah=x("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?$w:bw(t.length)),We.init(e,t)}),ch=x("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mw),We.init(e,t)}),uh=x("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hw),We.init(e,t)}),lh=x("$ZodULID",(e,t)=>{t.pattern??(t.pattern=gw),We.init(e,t)}),dh=x("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yw),We.init(e,t)}),fh=x("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=vw),We.init(e,t)}),$k=x("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Mw(t)),We.init(e,t)}),bk=x("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=jw),We.init(e,t)}),_k=x("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Dw(t)),We.init(e,t)}),wk=x("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_w),We.init(e,t)}),ph=x("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=xw),We.init(e,t)}),f9=/^[0-9a-fA-F:.]+$/;function jl(e){return f9.test(e)?vk(`http://[${e}]`):!1}var mh=x("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Iw),We.init(e,t),e._zod.check=r=>{jl(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),hh=x("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Pw(t.delimiter)),We.init(e,t)}),gh=x("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Tw),We.init(e,t)});function yh(e){let t=e.split("/");if(t.length!==2)return!1;let[r,i]=t;if(!i)return!1;let n=Number(i);return`${n}`!==i||n<0||n>128?!1:jl(r)}var vh=x("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Aw),We.init(e,t),e._zod.check=r=>{yh(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Dl(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var $h=/^[0-9a-zA-Z+/]*={0,2}$/,bh=x("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$h),We.init(e,t),e._zod.check=r=>{Dl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ml=/^[A-Za-z0-9_-]*$/;function _h(e){if(!Ml.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Dl(r)}var wh=x("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ml),We.init(e,t),e._zod.check=r=>{_h(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),kh=x("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cw),We.init(e,t)}),p9=/[- ]/g;function m9(e){let t=e.length,r=1,i=0;for(;t;){let n=e.charCodeAt(--t)-48;r^=1,i+=r?[0,2,4,6,8,1,3,5,7,9][n]:n}return i%10===0}function Sh(e){return Fm.test(e)?m9(e.replace(p9,"")):!1}var xh=x("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Fm),We.init(e,t),e._zod.check=r=>{Sh(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function h9(e){let t=0,r=e.length;for(let i=4;i<r;i++){let n=e.charCodeAt(i);t=(n>=65?t*100+(n-55):t*10+(n-48))%97}for(let i=0;i<4;i++){let n=e.charCodeAt(i);t=(n>=65?t*100+(n-55):t*10+(n-48))%97}return t===1}function Ih(e){return Zm.test(e)?h9(e):!1}var Ph=x("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Zm),We.init(e,t),e._zod.check=r=>{Ih(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function Th(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Ah=x("$ZodJWT",(e,t)=>{We.init(e,t),e._zod.check=r=>{Th(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Rh=x("$ZodCustomStringFormat",(e,t)=>{We.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Ll=x("$ZodNumber",(e,t)=>{ue.init(e,t),e._zod.pattern=Pi,e._zod.parse=(r,i)=>{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 o=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...o?{received:o}:{}}),r}}),Eh=x("$ZodNumberFormat",(e,t)=>{Yw.init(e,t),Ll.init(e,t)}),Ha=x("$ZodBoolean",(e,t)=>{ue.init(e,t),e._zod.pattern=Fw,e._zod.parse=(r,i)=>{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}}),Ul=x("$ZodBigInt",(e,t)=>{ue.init(e,t),e._zod.pattern=qw,e._zod.parse=(r,i)=>{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}}),Oh=x("$ZodBigIntFormat",(e,t)=>{Xw.init(e,t),Ul.init(e,t)}),Nh=x("$ZodSymbol",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Ch=x("$ZodUndefined",(e,t)=>{ue.init(e,t),e._zod.pattern=Vw,e._zod.values=new Set([void 0]),e._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),zh=x("$ZodNull",(e,t)=>{ue.init(e,t),e._zod.pattern=Zw,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),jh=x("$ZodAny",(e,t)=>{ue.init(e,t),e._zod.parse=r=>r}),Dh=x("$ZodUnknown",(e,t)=>{ue.init(e,t),e._zod.parse=r=>r}),Mh=x("$ZodNever",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Lh=x("$ZodVoid",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Uh=x("$ZodDate",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,o=n instanceof Date;return o&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:e}),r}});function jO(e,t,r){e.issues.length&&t.issues.push(...Rr(r,e.issues)),t.value[r]=e.value}var qh=x("$ZodArray",(e,t)=>{ue.init(e,t);let r=qt.memoizer;r?.attach(e),e._zod.parse=(i,n)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),i;i.value=r?r.alloc(e,i,Array(o.length),n):Array(o.length);let s=[],a=n?.abortEarly;for(let c=0;c<o.length;c++){let u=o[c],l=t.element._zod.run({value:u,issues:[]},n);if(l instanceof Promise)s.push(l.then(d=>jO(d,i,c)));else if(jO(l,i,c),a&&l.issues.length!==0&&vr(l))break}return s.length?Promise.all(s).then(()=>i):i}});function Ym(e,t,r,i,n,o){let s=r in i,a=o==="optional";if(!(!s&&a&&n==="optional")){if(e.issues.length){if(n!==void 0&&a&&!s)return;t.issues.push(...Rr(r,e.issues))}if(!s&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||n==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var g9=[];function QO(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),i=r.length?r:g9,n=i.length?[...t,...i]:t;for(let s of n)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let o=ew(e.shape);return{...e,allKeys:n,symbolKeys:i,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function eN(e,t,r,i,n,o,s){let a=[],c=n.keySet,u=n.catchall._zod,l=u.def.type,d=u.optin,f=u.optout,p=0;for(let m in t){if(s&&r.issues.length!==p){if(vr(r,p))break;p=r.issues.length}if(c.has(m))continue;if(m==="__proto__"){l==="never"&&a.push(m);continue}if(l==="never"){a.push(m);continue}let h=u.run({value:t[m],issues:[]},i);h instanceof Promise?e.push(h.then(g=>Ym(g,r,m,t,d,f))):Ym(h,r,m,t,d,f)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Fh=x("$ZodObject",(e,t)=>{ue.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),i=r?.get?r.get.raw:t.shape??{};if(i){let u=()=>{let l={...i};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=i,Object.defineProperty(t,"shape",{get:u})}let n=ja(()=>QO(t));ve(e,"propValues",u=>{let l=u.def.shape,d={};for(let f in l){let p=l[f]._zod;if(p.values){Object.prototype.hasOwnProperty.call(d,f)||Vt(d,f,new Set);for(let m of p.values)d[f].add(m);p.optin!==void 0&&d[f].add(void 0)}}return d});let o=gs,s=t.catchall,a,c=qt.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=n.value);let d=u.value;if(!o(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let f=[],p=a.shape,m=l?.abortEarly,h=u.issues.length;for(let g of a.allKeys){if(m&&u.issues.length!==h){if(vr(u,h))break;h=u.issues.length}if(g==="__proto__")continue;let y=p[g],v=y._zod.optin,$=y._zod.optout,_=y._zod.run({value:d[g],issues:[]},l);_ instanceof Promise?f.push(_.then(w=>Ym(w,u,g,d,v,$))):Ym(_,u,g,d,v,$)}return s?eN(f,d,u,l,n.value,e,m===!0):f.length?Promise.all(f).then(()=>u):u}}),kk=x("$ZodObjectJIT",(e,t)=>{Fh.init(e,t);let r=e._zod.parse,i=ja(()=>QO(t)),n=qt.memoizer,o=p=>{let m=i.value,h=m.symbolKeys,g=new _s(["payload","ctx"],{shape:p,inst:e,memo:n,syms:h}),y=w=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,v=(w,k)=>`
|
|
158
|
+
let ${w}_ab = false;
|
|
159
|
+
for (let i = 0; i < ${w}.issues.length; i++) {
|
|
160
|
+
const iss = ${w}.issues[i];
|
|
161
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
162
|
+
payload.issues.push(iss);
|
|
163
|
+
if (iss.continue !== true) ${w}_ab = true;
|
|
164
|
+
}
|
|
165
|
+
if (${w}_ab && ctx && ctx.abortEarly) {
|
|
166
|
+
payload.value = newResult;
|
|
167
|
+
return payload;
|
|
168
|
+
}`;g.write("const input = payload.value;");let $=Object.create(null),_=0;for(let w of m.allKeys)$[w]=`key_${_++}`;g.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of m.allKeys){if(w==="__proto__")continue;let k=$[w],T=typeof w=="symbol"?`syms[${h.indexOf(w)}]`:yr(w),C=`${T} in input`,D=p[w],K=D?._zod?.optin,V=K!==void 0,te=D?._zod?.optout==="optional";if(g.write(`const ${k} = ${y(T)};`),V&&te){let Oe=K==="optional"?`${k}_present`:`${k}.value !== undefined || ${k}_present`;g.write(`
|
|
169
|
+
const ${k}_present = ${C};
|
|
170
|
+
if (!${k}.issues.length || ${k}_present) {
|
|
171
|
+
if (${k}.issues.length) {${v(k,T)}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (${Oe}) {
|
|
175
|
+
newResult[${T}] = ${k}.value;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
`)}else V?(g.write(`
|
|
180
|
+
if (${k}.issues.length) {${v(k,T)}
|
|
181
|
+
}
|
|
182
|
+
`),K==="defaulted"?g.write(`newResult[${T}] = ${k}.value;`):g.write(`
|
|
183
|
+
if (${k}.value !== undefined || ${C}) {
|
|
184
|
+
newResult[${T}] = ${k}.value;
|
|
185
|
+
}
|
|
186
|
+
`)):g.write(`
|
|
187
|
+
const ${k}_present = ${C};
|
|
188
|
+
if (${k}.issues.length) {${v(k,T)}
|
|
189
|
+
}
|
|
190
|
+
if (!${k}_present && !${k}.issues.length) {
|
|
191
|
+
payload.issues.push({
|
|
192
|
+
code: "invalid_type",
|
|
193
|
+
expected: "nonoptional",
|
|
194
|
+
input: undefined,
|
|
195
|
+
path: [${T}]
|
|
196
|
+
});
|
|
197
|
+
if (ctx && ctx.abortEarly) {
|
|
198
|
+
payload.value = newResult;
|
|
199
|
+
return payload;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (${k}_present) {
|
|
204
|
+
newResult[${T}] = ${k}.value;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
`)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},s,a=gs,c=!qt.jitless,l=c&&X_.value,d=t.catchall,f;e._zod.parse=(p,m)=>{f??(f=i.value);let h=p.value;return a(h)?c&&l&&m?.async===!1&&m.jitless!==!0?(s||(s=o(t.shape)),p=s(p,m),d?eN([],h,p,m,f,e,m?.abortEarly===!0):p):r(p,m):(p.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),p)}});function DO(e,t,r,i){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let n=e.filter(o=>!vr(o));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(o=>o.issues.map(s=>Er(s,i,xt())))}),t)}var Ya=x("$ZodUnion",(e,t)=>{ue.init(e,t),ve(e,"optin",i=>i.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":i.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),ve(e,"optout",i=>i.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ve(e,"values",i=>{if(i.def.options.every(n=>n._zod.values))return new Set(i.def.options.flatMap(n=>Array.from(n._zod.values)))}),ve(e,"pattern",i=>{if(i.def.options.every(n=>n._zod.pattern)){let n=i.def.options.map(o=>o._zod.pattern);return new RegExp(`^(${n.map(o=>Ii(o.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,n)=>{if(r)return r(i,n);let o=!1,s=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},n);if(c instanceof Promise)s.push(c),o=!0;else{if(c.issues.length===0)return c;s.push(c)}}return o?Promise.all(s).then(a=>DO(a,i,e,n)):DO(s,i,e,n)}});function MO(e,t,r,i){let n=[];for(let o=0;o<e.length;o++)e[o].issues.length===0&&n.push(o);return n.length===1?(t.value=e[n[0]].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(s=>Er(s,i,xt())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:n}),t)}var Zh=x("$ZodXor",(e,t)=>{Ya.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,n)=>{if(r)return r(i,n);let o=!1,s=[];for(let a of t.options){let c=a._zod.run({value:i.value,issues:[]},n);c instanceof Promise?(s.push(c),o=!0):s.push(c)}return o?Promise.all(s).then(a=>MO(a,i,e,n)):MO(s,i,e,n)}});function Sk(e,t){let r=e._zod,i=r.bag.optionsMap;i||(i=tN(r.def),r.bag.optionsMap=i);let n=i.get(t);if(n===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return n}function tN(e){let t=new Map;for(let r of e.options){let i=r._zod.propValues?.[e.discriminator];if(!i||i.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of i)if(t.has(n)){if(n!==void 0)throw new Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var Vh=x("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ya.init(e,t);let r=e._zod.parse;ve(e,"propValues",n=>{let o={},s=0;for(let a of n.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(a)}"`);c[n.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(o,u)||Vt(o,u,new Set);for(let d of l)o[u].add(d)}}return!n.def.unionFallback&&s>1&&o[n.def.discriminator]?.delete(void 0),o}),t.options.forEach((n,o)=>{let s=Da(n._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${o}"`)});let i=ja(()=>tN(t));e._zod.parse=(n,o)=>{let s=n.value;if(!gs(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=s?.[t.discriminator],c=i.value.get(a);return c&&(a!==void 0||o.direction!=="backward")?c._zod.run(n,o):t.unionFallback||o.direction==="backward"?r(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(i.value.keys()).filter(u=>i.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),n)}}),Bh=x("$ZodIntersection",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>{let n=r.value,o=t.left._zod.run({value:n,issues:[]},i),s=t.right._zod.run({value:n,issues:[]},i);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([c,u])=>LO(r,c,u)):LO(r,o,s)}});function Ja(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(ln(e)&&ln(t)){let r=Object.keys(t),i=Object.keys(e).filter(o=>r.indexOf(o)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let o of i){if(o==="__proto__")continue;let s=Ja(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n[o]=s.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 i=0;i<e.length;i++){let n=e[i],o=t[i],s=Ja(n,o);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function LO(e,t,r){let i=new Map,n,o=new Map,s=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let f=String(u.path[0]);o.has(f)||o.set(f,u),d=[f]}else return!1;for(let f of d)i.has(f)||i.set(f,{}),i.get(f)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let a=[...i].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=n?a.filter(l=>n.keys.includes(l)):[];u.length&&e.issues.push({...n,keys:u});for(let l of a)!u.includes(l)&&o.has(l)&&e.issues.push(o.get(l))}let c=Ja(t.value,r.value);if(!c.valid){if(vr(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ql=x("$ZodTuple",(e,t)=>{ue.init(e,t);let r=t.items,i=qt.memoizer;i?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=i?i.alloc(e,n,[],o):[];let a=[],c=UO(r,"optin"),u=UO(r,"optout");if(!t.rest){if(s.length<c)return n.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),n;s.length>r.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),d=t.rest?o?.abortEarly:void 0,f=!1;for(let p=0;p<r.length;p++){let m=r[p]._zod.run({value:s[p],issues:[]},o);m instanceof Promise?a.push(m.then(h=>{l[p]=h})):(l[p]=m,d&&!f&&m.issues.length&&(f=vr(m)))}if(t.rest&&!f){let p=r.length-1,m=s.slice(r.length),h=n.issues.length;for(let g of m){if(d&&n.issues.length!==h){if(vr(n,h))break;h=n.issues.length}p++;let y=t.rest._zod.run({value:g,issues:[]},o);y instanceof Promise?a.push(y.then(v=>qO(v,n,p))):qO(y,n,p)}}return a.length?Promise.all(a).then(()=>FO(l,n,r,s,u)):FO(l,n,r,s,u)}});function UO(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function qO(e,t,r){e.issues.length&&t.issues.push(...Rr(r,e.issues)),t.value[r]=e.value}function FO(e,t,r,i,n){for(let o=0;o<r.length;o++){let s=e[o],a=o<i.length;if(!a&&o>=n&&r[o]._zod.optin==="optional"){t.value.length=o;break}if(s.issues.length){if(!a&&o>=n){t.value.length=o;break}t.issues.push(...Rr(o,s.issues))}t.value[o]=s.value}for(let o=t.value.length-1;o>=i.length&&(r[o]._zod.optout==="optional"&&t.value[o]===void 0);o--)t.value.length=o;return t}var Kh=x("$ZodRecord",(e,t)=>{ue.init(e,t);let r=qt.memoizer;r?.attach(e),e._zod.parse=(i,n)=>{let o=i.value;if(!ln(o))return i.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),i;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){i.value=r?r.alloc(e,i,{},n):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(m=>Er(m,n,xt())),input:l,path:[l],inst:e});continue}let f=d.value;if(f==="__proto__")continue;let p=t.valueType._zod.run({value:o[l],issues:[]},n);p instanceof Promise?s.push(p.then(m=>{m.issues.length&&i.issues.push(...Rr(l,m.issues)),i.value[f]=m.value})):(p.issues.length&&i.issues.push(...Rr(l,p.issues)),i.value[f]=p.value)}let u;for(let l in o)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;i.value[l]=o[l]}else u=u??[],u.push(l);u&&u.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u,continue:!0})}else{i.value=r?r.alloc(e,i,{},n):{};let c;for(let u of Reflect.ownKeys(o)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Pi.test(u)&&l.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},n);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?i.value[u]=o[u]:a?(c=c??[],c.push(u)):i.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>Er(m,n,xt())),input:u,path:[u],inst:e});continue}let f=l.value;if(f==="__proto__")continue;let p=t.valueType._zod.run({value:o[u],issues:[]},n);p instanceof Promise?s.push(p.then(m=>{m.issues.length&&i.issues.push(...Rr(u,m.issues)),i.value[f]=m.value})):(p.issues.length&&i.issues.push(...Rr(u,p.issues)),i.value[f]=p.value)}c&&c.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>i):i}}),Gh=x("$ZodMap",(e,t)=>{ue.init(e,t);let r=qt.memoizer;r?.attach(e),e._zod.parse=(i,n)=>{let o=i.value;if(!(o instanceof Map))return i.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),i;let s=[];i.value=r?r.alloc(e,i,new Map,n):new Map;let a=n?.abortEarly,c=i.issues.length;for(let[u,l]of o){if(a&&i.issues.length!==c){if(vr(i,c))break;c=i.issues.length}let d=t.keyType._zod.run({value:u,issues:[]},n),f=t.valueType._zod.run({value:l,issues:[]},n);d instanceof Promise||f instanceof Promise?s.push(Promise.all([d,f]).then(([p,m])=>{ZO(p,m,i,u,o,e,n)})):ZO(d,f,i,u,o,e,n)}return s.length?Promise.all(s).then(()=>i):i}});function ZO(e,t,r,i,n,o,s){e.issues.length&&(wl.has(typeof i)?r.issues.push(...Rr(i,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:o,issues:e.issues.map(a=>Er(a,s,xt()))})),t.issues.length&&(wl.has(typeof i)?r.issues.push(...Rr(i,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:o,key:i,issues:t.issues.map(a=>Er(a,s,xt()))})),r.value.set(e.value,t.value)}var Wh=x("$ZodSet",(e,t)=>{ue.init(e,t);let r=qt.memoizer;r?.attach(e),e._zod.parse=(i,n)=>{let o=i.value;if(!(o instanceof Set))return i.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),i;let s=[];i.value=r?r.alloc(e,i,new Set,n):new Set;let a=n?.abortEarly,c=i.issues.length;for(let u of o){if(a&&i.issues.length!==c){if(vr(i,c))break;c=i.issues.length}let l=t.valueType._zod.run({value:u,issues:[]},n);l instanceof Promise?s.push(l.then(d=>VO(d,i))):VO(l,i)}return s.length?Promise.all(s).then(()=>i):i}});function VO(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Jh=x("$ZodEnum",(e,t)=>{ue.init(e,t);let r=Ca(t.entries),i=new Set(r);e._zod.values=i,ve(e,"pattern",n=>{let o=Ca(n.def.entries).filter(s=>wl.has(typeof s));return new RegExp(o.length?`^(${o.map(s=>dn(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;return i.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),Hh=x("$ZodLiteral",(e,t)=>{ue.init(e,t);let r=new Set(t.values);e._zod.values=r,ve(e,"pattern",i=>{let n=i.def.values;return new RegExp(n.length?`^(${n.map(o=>typeof o=="string"?dn(o):o?dn(o.toString()):String(o)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,n)=>{let o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),i}}),Yh=x("$ZodFile",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Xh=x("$ZodTransform",(e,t)=>{ue.init(e,t),e._zod.optin="optional",qt.memoizer?.guard(e),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new to(e.constructor.name);let n=t.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new Or;return r.value=n,r}});function BO(e,t){return e.value=t.issues.length?void 0:t.value,e}var Fl=x("$ZodOptional",(e,t)=>{ue.init(e,t),ve(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",ve(e,"values",r=>{let i=r.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),ve(e,"pattern",r=>{let i=r.def.innerType._zod.pattern;return i?new RegExp(`^(${Ii(i.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},i);return n instanceof Promise?n.then(o=>BO(r,o)):BO(r,n)}return t.innerType._zod.run(r,i)}}),Qh=x("$ZodExactOptional",(e,t)=>{Fl.init(e,t),ve(e,"values",r=>r.def.innerType._zod.values),ve(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,i)=>t.innerType._zod.run(r,i)}),eg=x("$ZodNullable",(e,t)=>{ue.init(e,t),ve(e,"optin",r=>r.def.innerType._zod.optin),ve(e,"optout",r=>r.def.innerType._zod.optout),ve(e,"pattern",r=>{let i=r.def.innerType._zod.pattern;return i?new RegExp(`^(${Ii(i.source)}|null)$`):void 0}),ve(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:t.innerType._zod.run(r,i)}),tg=x("$ZodDefault",(e,t)=>{ue.init(e,t),e._zod.optin="defaulted",ve(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>KO(o,t)):KO(n,t)}});function KO(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var rg=x("$ZodPrefault",(e,t)=>{ue.init(e,t),e._zod.optin="defaulted",ve(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,i))}),ng=x("$ZodNonOptional",(e,t)=>{ue.init(e,t),ve(e,"values",r=>{let i=r.def.innerType._zod.values;return i?new Set([...i].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,i)=>{let n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>GO(o,e)):GO(n,e)}});function GO(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 ig=x("$ZodSuccess",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new to("ZodSuccess");let n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.issues.length===0,r)):(r.value=n.issues.length===0,r)}});function WO(e,t,r,i){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>Er(n,i,xt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var og=x("$ZodCatch",(e,t)=>{ue.init(e,t),ve(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ve(e,"optout",r=>r.def.innerType._zod.optout),ve(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);let n=t.innerType._zod.run({value:r.value,issues:[]},i);return n instanceof Promise?n.then(o=>WO(r,o,t,i)):WO(r,n,t,i)}}),sg=x("$ZodNaN",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Zl=x("$ZodPipe",(e,t)=>{ue.init(e,t),ve(e,"values",r=>r.def.in._zod.values),ve(e,"optin",r=>r.def.in._zod.optin),ve(e,"optout",r=>r.def.out._zod.optout),ve(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){let o=t.out._zod.run(r,i);return o instanceof Promise?o.then(s=>Wm(s,t.in,i)):Wm(o,t.in,i)}let n=t.in._zod.run(r,i);return n instanceof Promise?n.then(o=>Wm(o,t.out,i)):Wm(n,t.out,i)}});function Wm(e,t,r){return e.issues.some(i=>i.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Xa=x("$ZodCodec",(e,t)=>{ue.init(e,t),ve(e,"values",r=>r.def.in._zod.values),ve(e,"optin",r=>r.def.in._zod.optin),ve(e,"optout",r=>r.def.out._zod.optout),ve(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,i)=>{if((i.direction||"forward")==="forward"){let o=t.in._zod.run(r,i);return o instanceof Promise?o.then(s=>Jm(s,t,i)):Jm(o,t,i)}else{let o=t.out._zod.run(r,i);return o instanceof Promise?o.then(s=>Jm(s,t,i)):Jm(o,t,i)}}});function Jm(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);return n instanceof Promise?n.then(o=>Hm(e,o,t.out,r)):Hm(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(o=>Hm(e,o,t.in,r)):Hm(e,n,t.in,r)}}function Hm(e,t,r,i){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},i)}var xk=x("$ZodPreprocess",(e,t)=>{Zl.init(e,t)}),ag=x("$ZodReadonly",(e,t)=>{ue.init(e,t),ve(e,"propValues",r=>r.def.innerType._zod.propValues),ve(e,"values",r=>r.def.innerType._zod.values),ve(e,"optin",r=>r.def.innerType?._zod?.optin),ve(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);let n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(JO):JO(n)}});function JO(e){return e.memo||(e.value=Object.freeze(e.value)),e}function y9(e){let t=e._zod.def,r=t.pattern,i=!!t.format?.includes("int"),n,o;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(r=c.pattern),i||(i=!!c.format?.includes("int"));let u=c.minimum??c.length,l=c.maximum??c.length;u!==void 0&&(n===void 0||u>n)&&(n=u),l!==void 0&&(o===void 0||l<o)&&(o=l)}if(r)return r.source;if(n!==void 0&&o!==void 0&&n>o)return"(?!)";if(n!==void 0||o!==void 0)return Uw({minimum:n,maximum:o}).source;let s=e._zod.pattern;return(i&&s===Pi?El:s)?.source}function gk(e){let t=e._zod.def,r=e._zod.pattern?.source,i=t.innerType??e._zod.innerType;if(i){let n=i._zod.pattern?.source,o=gk(i);return r&&n&&o&&o!==n?r.replace(Ii(n),()=>Ii(o)):r}if(t.options){let n=t.options.map(gk);if(n.every(Boolean))return`^(${n.map(o=>Ii(o)).join("|")})$`}return y9(e)}var cg=x("$ZodTemplateLiteral",(e,t)=>{ue.init(e,t);let r=[];for(let i of t.parts)if(typeof i=="object"&&i!==null){let n=gk(i);if(!n)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);r.push(Ii(n))}else if(i===null||Q_.has(typeof i))r.push(dn(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:e,expected:"string",code:"invalid_type"}),i):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),i)}),ug=x("$ZodFunction",(e,t)=>(ue.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...i){let n=e._def.input?vs(e._def.input,i):i,o=Reflect.apply(r,this,n);return e._def.output?vs(e._def.output,o):o},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...i){let n=e._def.input?await $s(e._def.input,i):i,o=await Reflect.apply(r,this,n);return e._def.output?await $s(e._def.output,o):o},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,i)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let i=e.constructor;return Array.isArray(r[0])?new i({type:"function",input:new ql({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new i({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let i=e.constructor;return new i({type:"function",input:e._def.input,output:r})},e)),lg=x("$ZodPromise",(e,t)=>{ue.init(e,t),e._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},i))}),Qa=x("$ZodLazy",(e,t)=>{ue.init(e,t),H_(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),ve(e,"pattern",r=>r.innerType?._zod?.pattern),ve(e,"propValues",r=>r.innerType?._zod?.propValues),ve(e,"optin",r=>r.innerType?._zod?.optin??void 0),ve(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,i)=>e._zod.innerType._zod.run(r,i)}),dg=x("$ZodCustom",(e,t)=>{Qe.init(e,t),ue.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{let i=r.value,n=t.fn(i);if(n instanceof Promise)return n.then(o=>HO(o,r,i,e));HO(n,r,i,e)}});function HO(e,t,r,i){if(!e){let n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),t.issues.push(La(n))}}var hg=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Pk="~memo",nN=[];function iN(e){return e!==null&&typeof e=="object"}function Ik(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var oN=new WeakMap,ec=0,mg=1,Vl=2;function Bl(e,t,r){let i=oN.get(e);if(i!==void 0)return i?Vl:ec;if(t.has(e))return Vl;t.add(e);let n=ec,o=l=>{if(n!==Vl&&l?._zod){let d=Bl(l,t,r);d>n&&(n=d)}},s=(l,d)=>{let f=ec;for(let p of Reflect.ownKeys(l)){let m=Object.getOwnPropertyDescriptor(l,p);if(d&&!m.enumerable)continue;let h=m.get?mg:m.value?._zod?Bl(m.value,t,r):ec;h>f&&(f=h)}return f},a=l=>{l>n&&(n=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Da(c);a(l?s(l,!0):mg),o(c.catchall);break}case"array":o(c.element);break;case"tuple":for(let l of c.items)o(l);o(c.rest);break;case"record":case"map":o(c.keyType),o(c.valueType);break;case"set":o(c.valueType);break;case"union":for(let l of c.options)o(l);break;case"intersection":o(c.left),o(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(c.innerType);break;case"pipe":o(c.in),o(c.out);break;case"function":o(c.input),o(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?Bl(l,t,!1):mg);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let f=d.value;if(!(!f||typeof f!="object")){if(f._zod)o(f);else if(Array.isArray(f))for(let p of f)o(p)}}}return t.delete(e),v9(e,n)}function v9(e,t){return t!==mg&&oN.set(e,t===Vl),t}function gg(e){return Bl(e,new Set,!0)!==ec}function $9(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var fg,pg=[],b9={alloc(e,t,r){let i=fg;if(!i)return r;fg=void 0;let n={value:r,issues:null};return i.set(t.value,n),pg.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,i=(n,o)=>{if(o.direction!=="backward"&&yg(o,n.value))throw new hg;return r(n,o)};e._zod.parse=i,e._zod.run===r&&(e._zod.run=i)})},attach(e){var t;let r,i=!1,n,o;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(r===void 0){let y=Bl(e,new Set,!1);if(y===ec)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);y===Vl||i?r=!0:i=!0}let l=c.value;if(!iN(l))return s(c,u);let d=u[Pk];d||(d={buckets:new WeakMap,backEdges:void 0},u[Pk]=d);let f;n===u?f=o:(f=$9(d,e),n=u,o=f);let p=f.get(l);if(p)return c.value=p.value,p.issues?p.issues.length&&c.issues.push(...Ik(p.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),c;fg=f;let m=pg.length,h=s(c,u);fg=void 0;let g=pg.length>m?pg.pop():void 0;return h instanceof Promise?h.then(y=>(g&&(g.issues=y.issues.length?Ik(y.issues):nN),y)):(g&&(g.issues=h.issues.length?Ik(h.issues):nN),h)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function Kl(){return b9}function yg(e,t){let r=e[Pk]?.backEdges;return r!==void 0&&iN(t)&&r.has(t)}var rc={};Si(rc,{ar:()=>sN,az:()=>aN,be:()=>uN,bg:()=>lN,bn:()=>dN,ca:()=>fN,ckb:()=>pN,cs:()=>mN,da:()=>hN,de:()=>gN,el:()=>yN,en:()=>vg,eo:()=>vN,es:()=>$N,fa:()=>bN,fi:()=>_N,fr:()=>wN,frCA:()=>kN,gu:()=>SN,he:()=>xN,hi:()=>IN,hr:()=>PN,hu:()=>TN,hy:()=>RN,id:()=>EN,is:()=>ON,it:()=>NN,ja:()=>CN,ka:()=>zN,kh:()=>jN,km:()=>$g,kn:()=>DN,ko:()=>MN,lt:()=>UN,mk:()=>qN,ms:()=>FN,ne:()=>ZN,nl:()=>VN,nn:()=>BN,no:()=>KN,ota:()=>GN,pl:()=>JN,ps:()=>WN,pt:()=>HN,ptBR:()=>YN,ro:()=>XN,ru:()=>eC,sk:()=>tC,sl:()=>rC,sv:()=>nC,ta:()=>iC,tg:()=>oC,th:()=>sC,tk:()=>aC,tr:()=>cC,ua:()=>uC,uk:()=>bg,ur:()=>lC,uz:()=>dC,vi:()=>fC,yo:()=>hC,zhCN:()=>pC,zhTW:()=>mC});var _9=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},map:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(n){return e[n]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",mac:"\u0639\u0646\u0648\u0627\u0646 MAC",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",credit_card:"\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646",currency_code:"\u0631\u0645\u0632 \u0627\u0644\u0639\u0645\u0644\u0629",iban:"IBAN",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${o}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${E(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${n.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${r[o.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${P(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function sN(){return{localeError:_9()}}var w9=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"},map:{unit:"element",verb:"olmal\u0131d\u0131r"}};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",credit_card:"kredit kart\u0131 n\xF6mr\u0259si",currency_code:"valyuta kodu",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${o}, daxil olan ${a}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${E(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${o}${n.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[o.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function aN(){return{localeError:w9()}}function cN(e,t,r,i){let n=Math.abs(e),o=n%10,s=n%100;return s>=11&&s<=19?i:o===1?t:o>=2&&o<=4?r:i}var k9=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},map:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(n){return e[n]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",mac:"MAC \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",credit_card:"\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",iban:"IBAN",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},i={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${o}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${E(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=cN(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${n.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=cN(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${n.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${P(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function uN(){return{localeError:k9()}}var S9=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},map:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",mac:"MAC \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430",currency_code:"\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${E(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${o}${n.minimum.toString()} ${s.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;if(o.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${o.prefix}"`;if(o.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${o.suffix}"`;if(o.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${o.includes}"`;if(o.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${o.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return o.format==="emoji"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="datetime"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="date"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),o.format==="time"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),o.format==="duration"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${s} ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${P(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function lN(){return{localeError:S9()}}var x9=()=>{let e={string:{unit:"\u0985\u0995\u09CD\u09B7\u09B0",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},file:{unit:"\u09AC\u09BE\u0987\u099F",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},array:{unit:"\u0986\u0987\u099F\u09C7\u09AE",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},set:{unit:"\u0986\u0987\u099F\u09C7\u09AE",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"},map:{unit:"\u098F\u09A8\u09CD\u099F\u09CD\u09B0\u09BF",verb:"\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7"}};function t(n){return e[n]??null}let r={regex:"\u0987\u09A8\u09AA\u09C1\u099F",email:"\u0987\u09AE\u09C7\u0987\u09B2 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",url:"URL",emoji:"\u0987\u09AE\u09CB\u099C\u09BF",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u09A4\u09BE\u09B0\u09BF\u0996 \u0993 \u09B8\u09AE\u09AF\u09BC",date:"ISO \u09A4\u09BE\u09B0\u09BF\u0996",time:"ISO \u09B8\u09AE\u09AF\u09BC",duration:"ISO \u09B8\u09AE\u09AF\u09BC\u0995\u09BE\u09B2",ipv4:"IPv4 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",ipv6:"IPv6 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",mac:"MAC \u09A0\u09BF\u0995\u09BE\u09A8\u09BE",cidrv4:"IPv4 \u09B0\u09C7\u099E\u09CD\u099C",cidrv6:"IPv6 \u09B0\u09C7\u099E\u09CD\u099C",base64:"base64-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",base64url:"base64url-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",json_string:"JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982",e164:"E.164 \u09A8\u09AE\u09CD\u09AC\u09B0",credit_card:"\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0",currency_code:"\u09AE\u09C1\u09A6\u09CD\u09B0\u09BE \u0995\u09CB\u09A1",iban:"IBAN",jwt:"JWT",template_literal:"\u0987\u09A8\u09AA\u09C1\u099F"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return`\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${o}, \u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4 ${a}`}case"invalid_value":return n.values.length===1?`\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${E(n.values[0])}`:`\u0985\u09AC\u09C8\u09A7 \u0985\u09AA\u09B6\u09A8: ${P(n.values," | ")} \u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7 \u098F\u0995\u099F\u09BF \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${n.origin??"\u09AE\u09BE\u09A8"} ${o}${n.maximum.toString()} ${s.unit??"\u098F\u09B2\u09BF\u09AE\u09C7\u09A8\u09CD\u099F"} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${n.origin??"\u09AE\u09BE\u09A8"} ${o}${n.maximum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${n.origin} ${o}${n.minimum.toString()} ${s.unit} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${n.origin} ${o}${n.minimum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${o.prefix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C1\u09B0\u09C1 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:o.format==="ends_with"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${o.suffix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C7\u09B7 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`:o.format==="includes"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${o.includes}" \u0985\u09A8\u09CD\u09A4\u09B0\u09CD\u09AD\u09C1\u0995\u09CD\u09A4 \u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7`:o.format==="regex"?`\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: ${o.pattern} \u09AA\u09CD\u09AF\u09BE\u099F\u09BE\u09B0\u09CD\u09A8 \u09AE\u09BF\u09B2\u09A4\u09C7 \u09B9\u09AC\u09C7`:`\u0985\u09AC\u09C8\u09A7 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0985\u09AC\u09C8\u09A7 \u09A8\u09AE\u09CD\u09AC\u09B0: ${n.divisor} \u098F\u09B0 \u0997\u09C1\u09A3\u09BF\u09A4\u0995 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`;case"unrecognized_keys":return`\u0985\u099A\u09C7\u09A8\u09BE \u0995\u09C0${n.keys.length>1?"\u0997\u09C1\u09B2\u09CB":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u0995\u09C0`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0985\u09AC\u09C8\u09A7 \u09A1\u09BF\u09B8\u0995\u09CD\u09B0\u09BF\u09AE\u09BF\u09A8\u09C7\u099F\u09B0 \u09AE\u09BE\u09A8\u0964 \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F";case"invalid_element":return`${n.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u09AE\u09BE\u09A8`;default:return"\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F"}}};function dN(){return{localeError:x9()}}var I9=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"},map:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",mac:"adre\xE7a MAC",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",credit_card:"n\xFAmero de targeta de cr\xE8dit",currency_code:"codi de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${o}, s'ha rebut ${a}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${E(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${P(n.values," o ")}`;case"too_big":{let o=n.inclusive?"com a m\xE0xim":"menys de",s=t(n.origin);return s?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${o} ${n.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=t(n.origin);return s?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${o} ${n.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${r[o.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}};function fN(){return{localeError:I9()}}var P9=()=>{let e={string:{unit:"\u067E\u06CC\u062A",verb:"\u0628\u06CE\u062A"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u0628\u06CE\u062A"},array:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"},set:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"},map:{unit:"\u062F\u0627\u0646\u06D5",verb:"\u0628\u06CE\u062A"}};function t(n){return e[n]??null}let r={regex:"regex",email:"\u0626\u06CC\u0645\u06D5\u06CC\u06B5",url:"\u0628\u06D5\u0633\u062A\u06D5\u0631 (URL)",emoji:"\u0626\u06CC\u0645\u06C6\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0695\u06CE\u06A9\u06D5\u0648\u062A \u0648 \u06A9\u0627\u062A",date:"\u0695\u06CE\u06A9\u06D5\u0648\u062A",time:"\u06A9\u0627\u062A",duration:"\u0645\u0627\u0648\u06D5",ipv4:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv4",ipv6:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv6",mac:"\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC MAC",cidrv4:"\u0645\u06D5\u0648\u062F\u0627\u06CC IPv4",cidrv6:"\u0645\u06D5\u0648\u062F\u0627\u06CC IPv6",base64:"\u062F\u06D5\u0642\u06CC base64",base64url:"\u062F\u06D5\u0642\u06CC base64url",json_string:"\u062F\u06D5\u0642\u06CC JSON",e164:"\u0698\u0645\u0627\u0631\u06D5\u06CC E.164",credit_card:"\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A",currency_code:"\u06A9\u06C6\u062F\u06CC \u062F\u0631\u0627\u0648",iban:"IBAN",jwt:"JWT",template_literal:"\u062A\u06CE\u06A9\u0631\u062F\u06D5"},i={nan:"NaN",string:"\u0646\u0648\u0648\u0633\u06CC\u0646",number:"\u0698\u0645\u0627\u0631\u06D5",boolean:"boolean",array:"array",object:"object",date:"\u0695\u06CE\u06A9\u06D5\u0648\u062A",integer:"\u0698\u0645\u0627\u0631\u06D5",float:"\u0698\u0645\u0627\u0631\u06D5",null:"null",undefined:"undefined",function:"function",symbol:"symbol",unknown:"unknown",promise:"promise",void:"void",never:"never",map:"map",set:"set"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s,c=["\u0627","\u0648","\u06C6","\u0648\u0648","\u06D5","\u06CC","\u06CE"].some(l=>a.endsWith(l))?"\u06CC\u06D5":"\u06D5",u=/^[a-zA-Z]+$/.test(a);return s==="null"||s==="undefined"?"\u062F\u0627\u0648\u0627\u06A9\u0631\u0627\u0648\u06D5":`\u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${o} \u0628\u06CE\u062A\u060C \u0628\u06D5\u06B5\u0627\u0645 ${a}${u?"":c}`}case"invalid_value":return n.values.length===1?`\u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0648\u0633\u062A\u06D5: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${E(n.values[0])} \u0628\u06CE\u062A`:`\u0647\u06D5\u06B5\u0628\u0698\u0627\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 \u06CC\u06D5\u06A9\u06CE\u06A9 \u0628\u06CE\u062A \u0644\u06D5 ${P(n.values,"|")}`;case"too_big":{let o=t(n.origin);return o?`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${n.maximum.toString()} ${o.unit} ${o.verb}`:`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${n.maximum.toString()} \u0628\u06CE\u062A`}case"too_small":{let o=t(n.origin);return o?`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${n.minimum.toString()} ${o.unit} ${o.verb}`:`\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${n.minimum.toString()} \u0628\u06CE\u062A`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u062F\u06D5\u0633\u062A\u067E\u06CE\u0628\u06A9\u0627\u062A \u0628\u06D5 "${o.prefix}"`:o.format==="ends_with"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u06A9\u06C6\u062A\u0627\u06CC\u06CC\u0628\u06CE\u062A \u0628\u06D5 "${o.suffix}"`:o.format==="includes"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 "${o.includes}" \u0644\u06D5\u062E\u06C6\u0628\u06AF\u0631\u06CE\u062A`:o.format==="regex"?`\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0644\u06D5\u06AF\u06D5\u06B5 \u067E\u0627\u062A\u06CE\u0631\u0646\u06CC ${o.pattern} \u0628\u06AF\u0648\u0646\u062C\u06CE\u062A`:`\u0628\u06D5\u0647\u0627\u06CC ${r[o.format]??n.format} \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`}case"not_multiple_of":return`\u0698\u0645\u0627\u0631\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u062F\u06D5\u0628\u06CE\u062A \u0686\u06D5\u0646\u062F \u0647\u06CE\u0646\u062F\u06D5 \u0628\u06CE\u062A \u0628\u06C6 ${n.divisor}`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u0644\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648: ${P(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u0644\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A \u0644\u06D5 ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0628\u06D5\u0647\u0627\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648 \u0647\u06D5\u06CC\u06D5. \u0628\u06D5\u0647\u0627\u06CC \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648: ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u06CC\u06D5\u06A9\u06AF\u0631\u062A\u0646\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A";case"invalid_element":return`${n.origin} \u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`;default:return"\u062A\u06CE\u06A9\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A"}}};function pN(){return{localeError:P9()}}var T9=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"},map:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(n){return e[n]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",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:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",credit_card:"\u010D\xEDslo kreditn\xED karty",currency_code:"k\xF3d m\u011Bny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},i={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${o}, obdr\u017Eeno ${a}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${E(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${o}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${o}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${r[o.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${P(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function mN(){return{localeError:T9()}}var A9=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"},map:{unit:"elementer",verb:"indeholdt"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-mailadresse",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 dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kreditkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${a}`:`Ugyldigt input: forventede ${o}, fik ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${E(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin),a=i[n.origin]??n.origin;return s?`For stor: forventede ${a??"value"} ${s.verb} ${o} ${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin),a=i[n.origin]??n.origin;return s?`For lille: forventede ${a} ${s.verb} ${o} ${n.minimum.toString()} ${s.unit}`:`For lille: forventede ${a} havde ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: skal starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: skal ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: skal indeholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${n.origin}`;default:return"Ugyldigt input"}}};function hN(){return{localeError:A9()}}var R9=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"},map:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",mac:"MAC-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",credit_card:"Kreditkartennummer",currency_code:"W\xE4hrungscode",iban:"IBAN",jwt:"JWT",template_literal:"Eingabe"},i={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${o}, erhalten ${a}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${E(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ist`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ist`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${r[o.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}};function gN(){return{localeError:R9()}}var E9=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(n){return e[n]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",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 \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",credit_card:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2",currency_code:"\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03BD\u03BF\u03BC\u03AF\u03C3\u03BC\u03B1\u03C4\u03BF\u03C2",iban:"IBAN",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return typeof n.expected=="string"&&/^[A-Z]/.test(n.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${n.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return n.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${E(n.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${n.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${o}${n.minimum.toString()} ${s.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${n.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${o.prefix}"`:o.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${o.suffix}"`:o.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${o.includes}"`:o.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${o.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[o.format]??n.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${n.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${n.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${n.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${P(n.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${n.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${n.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function yN(){return{localeError:E9()}}var O9=()=>{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(o){return e[o]??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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};function n(o,s){return o==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):i[o]??o}return o=>{switch(o.code){case"invalid_type":{let s=n(o.expected),a=O(o.input),c=n(a,o.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${E(o.values[0])}`:`Invalid option: expected one of ${P(o.values,"|")}`;case"too_big":{let s=o.exact?"exactly ":o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.exact?"exactly ":o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;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]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${P(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(a=>`'${a}'`).join(" | ")}`:o.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function vg(){return{localeError:O9()}}var N9=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"},map:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",mac:"MAC-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",credit_card:"kreditkarta numero",currency_code:"valuta kodo",iban:"IBAN",jwt:"JWT",template_literal:"enigo"},i={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${o}, ricevi\u011Dis ${a}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${E(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()} ${s.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${o}${n.minimum.toString()} ${s.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${o.prefix}"`:o.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${o.suffix}"`:o.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${o.includes}"`:o.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${o.pattern}`:`Nevalida ${r[o.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function vN(){return{localeError:N9()}}var C9=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",mac:"direcci\xF3n MAC",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",credit_card:"n\xFAmero de tarjeta de cr\xE9dito",currency_code:"c\xF3digo de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},i={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${o}, recibido ${a}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${E(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin),a=i[n.origin]??n.origin;return s?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${o}${n.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin),a=i[n.origin]??n.origin;return s?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${o}${n.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${r[o.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${i[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${i[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}};function $N(){return{localeError:C9()}}var z9=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},map:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(n){return e[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",mac:"MAC \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",credit_card:"\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC",currency_code:"\u06A9\u062F \u0627\u0631\u0632",iban:"IBAN",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${o} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${E(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${P(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[o.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${P(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function bN(){return{localeError:z9()}}var j9=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},map:{unit:"alkiota",subject:"kuvauksen"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(n){return e[n]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",mac:"MAC-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",credit_card:"luottokortin numero",currency_code:"valuuttakoodi",iban:"IBAN",jwt:"JWT",template_literal:"templaattimerkkijono"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${o}, oli ${a}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${E(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${o}${n.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${o}${n.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${r[o.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${P(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function _N(){return{localeError:j9()}}var D9=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"expression r\xE9guli\xE8re",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne de caract\xE8res encod\xE9e en base64",base64url:"cha\xEEne de caract\xE8res encod\xE9e en base64url",json_string:"cha\xEEne de caract\xE8res JSON",e164:"num\xE9ro au format E.164",credit_card:"num\xE9ro de carte de cr\xE9dit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entr\xE9e"},i={string:"cha\xEEne de caract\xE8res",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"record",map:"map",set:"ensemble",file:"fichier",nonoptional:"non optionnel",nan:"NaN",function:"fonction"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instance de ${n.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${o} attendu, ${a} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${E(n.values[0])} attendu`:`Option invalide : une valeur parmi ${P(n.values,"|")} attendue`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Trop grand : ${i[n.origin]??"valeur"} doit ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${i[n.origin]??"valeur"} doit \xEAtre ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Trop petit : ${i[n.origin]??"valeur"} doit ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Trop petit : ${i[n.origin]??"valeur"} doit \xEAtre ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cha\xEEne de caract\xE8res invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne de caract\xE8res invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne de caract\xE8res invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne de caract\xE8res invalide : doit correspondre au motif ${o.pattern}`:`${r[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${P(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function wN(){return{localeError:D9()}}var M9=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"},map:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"entr\xE9e",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",credit_card:"num\xE9ro de carte de cr\xE9dit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entr\xE9e"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${o}, re\xE7u ${a}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${E(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"\u2264":"<",s=t(n.origin);return s?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${o}${n.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"\u2265":">",s=t(n.origin);return s?`Trop petit : attendu que ${n.origin} ait ${o}${n.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${n.origin} soit ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${r[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${P(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};function kN(){return{localeError:M9()}}var L9=()=>{let e={string:{unit:"\u0A85\u0A95\u0ACD\u0AB7\u0AB0",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},file:{unit:"\u0AAC\u0ABE\u0AAF\u0A9F",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},array:{unit:"\u0A86\u0A87\u0A9F\u0AAE",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},set:{unit:"\u0A86\u0A87\u0A9F\u0AAE",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"},map:{unit:"\u0A8F\u0AA8\u0ACD\u0A9F\u0ACD\u0AB0\u0AC0",verb:"\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F"}};function t(n){return e[n]??null}let r={regex:"\u0A87\u0AA8\u0AAA\u0AC1\u0A9F",email:"\u0A88\u0AAE\u0AC7\u0A87\u0AB2 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",url:"URL",emoji:"\u0A87\u0AAE\u0ACB\u0A9C\u0AC0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96 \u0A85\u0AA8\u0AC7 \u0AB8\u0AAE\u0AAF",date:"ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96",time:"ISO \u0AB8\u0AAE\u0AAF",duration:"ISO \u0A85\u0AB5\u0AA7\u0ABF",ipv4:"IPv4 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",ipv6:"IPv6 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",mac:"MAC \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8",cidrv4:"IPv4 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0",cidrv6:"IPv6 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0",base64:"base64-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",base64url:"base64url-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",json_string:"JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97",e164:"E.164 \u0AA8\u0A82\u0AAC\u0AB0",credit_card:"\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0",currency_code:"\u0A9A\u0AB2\u0AA3 \u0A95\u0ACB\u0AA1",iban:"IBAN",jwt:"JWT",template_literal:"\u0A87\u0AA8\u0AAA\u0AC1\u0A9F"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${o}, \u0AAA\u0ACD\u0AB0\u0ABE\u0AAA\u0ACD\u0AA4 ${a}`}case"invalid_value":return n.values.length===1?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${E(n.values[0])}`:`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB5\u0ABF\u0A95\u0AB2\u0ACD\u0AAA: ${P(n.values," | ")} \u0AAE\u0ABE\u0AA7\u0ACD\u0AAF\u0AAE\u0AA5\u0AC0 \u0A8F\u0A95 \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${n.origin??"\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${o}${n.maximum.toString()} ${s.unit??"\u0A8F\u0AB2\u0ABF\u0AAE\u0AC7\u0AA8\u0ACD\u0A9F"} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${n.origin??"\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${o}${n.maximum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${n.origin} ${o}${n.minimum.toString()} ${s.unit} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${n.origin} ${o}${n.minimum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${o.prefix}" \u0AA5\u0AC0 \u0AB6\u0AB0\u0AC2 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:o.format==="ends_with"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${o.suffix}" \u0AAA\u0AB0 \u0AB8\u0AAE\u0ABE\u0AAA\u0ACD\u0AA4 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:o.format==="includes"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${o.includes}" \u0AB6\u0ABE\u0AAE\u0AC7\u0AB2 \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:o.format==="regex"?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: \u0AAA\u0AC7\u0A9F\u0AB0\u0ACD\u0AA8 ${o.pattern} \u0AB8\u0ABE\u0AA5\u0AC7 \u0AAE\u0AC7\u0AB3 \u0A96\u0ABE\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`:`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA8\u0A82\u0AAC\u0AB0: ${n.divisor} \u0AA8\u0ACB \u0A97\u0AC1\u0AA3\u0ABE\u0A82\u0A95 \u0AB9\u0ACB\u0AB5\u0ACB \u0A9C\u0ACB\u0A88\u0A8F`;case"unrecognized_keys":return`\u0A93\u0AB3\u0A96\u0AC0 \u0AB6\u0A95\u0ABE\u0AA4\u0ABE \u0AA8\u0AB9\u0AC0\u0A82 \u0AA4\u0AC7 \u0A95\u0AC0${n.keys.length>1?"\u0A93":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A95\u0AC0`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA1\u0ABF\u0AB8\u0ACD\u0A95\u0ACD\u0AB0\u0ABF\u0AAE\u0ABF\u0AA8\u0AC7\u0A9F\u0AB0 \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF. \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F";case"invalid_element":return`${n.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF`;default:return"\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F"}}};function SN(){return{localeError:L9()}}var U9=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=u=>u?e[u]:void 0,i=u=>{let l=r(u);return l?l.label:u??e.unknown.label},n=u=>`\u05D4${i(u)}`,o=u=>(r(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",s=u=>u?t[u]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},uuidv4:{label:"UUIDv4",gender:"m"},uuidv6:{label:"UUIDv6",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},mac:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA MAC",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},credit_card:{label:"\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9",gender:"m"},currency_code:{label:"\u05E7\u05D5\u05D3 \u05DE\u05D8\u05D1\u05E2",gender:"m"},iban:{label:"IBAN",gender:"m"},jwt:{label:"JWT",gender:"m"},template_literal:{label:"\u05E7\u05DC\u05D8",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},c={nan:"NaN"};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,d=c[l??""]??i(l),f=O(u.input),p=c[f]??e[f]?.label??f;return/^[A-Z]/.test(u.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${u.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${p}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${E(u.values[0])}`;let l=u.values.map(p=>E(p));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let d=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let l=s(u.origin),d=n(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?"<=":"<",p=o(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.maximum.toString()}`}case"too_small":{let l=s(u.origin),d=n(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let m=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}`}if(u.origin==="array"||u.origin==="set"){let m=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let g=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${g}`}let h=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${m} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let f=u.inclusive?">=":">",p=o(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${p} ${f}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let d=a[l.format],f=d?.label??l.format,m=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${f} \u05DC\u05D0 ${m}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${P(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function xN(){return{localeError:U9()}}var q9=()=>{let e={string:{unit:"\u0905\u0915\u094D\u0937\u0930",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},file:{unit:"\u092C\u093E\u0907\u091F\u094D\u0938",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},array:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},set:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"},map:{unit:"\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F\u092F\u093E\u0901",verb:"\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F"}};function t(n){return e[n]??null}let r={regex:"\u0907\u0928\u092A\u0941\u091F",email:"\u0908\u092E\u0947\u0932 \u092A\u0924\u093E",url:"URL",emoji:"\u0907\u092E\u094B\u091C\u0940",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0924\u093F\u0925\u093F \u0914\u0930 \u0938\u092E\u092F",date:"ISO \u0924\u093F\u0925\u093F",time:"ISO \u0938\u092E\u092F",duration:"ISO \u0905\u0935\u0927\u093F",ipv4:"IPv4 \u092A\u0924\u093E",ipv6:"IPv6 \u092A\u0924\u093E",mac:"MAC \u092A\u0924\u093E",cidrv4:"IPv4 \u0936\u094D\u0930\u0947\u0923\u0940",cidrv6:"IPv6 \u0936\u094D\u0930\u0947\u0923\u0940",base64:"Base64-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",base64url:"Base64URL-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",json_string:"JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917",e164:"E.164 \u0938\u0902\u0916\u094D\u092F\u093E",credit_card:"\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E",currency_code:"\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",iban:"IBAN",jwt:"JWT",template_literal:"\u0907\u0928\u092A\u0941\u091F"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${o}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${a}`}case"invalid_value":return n.values.length===1?`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${E(n.values[0])}`:`\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u094B\u0902 \u092E\u0947\u0902 \u0938\u0947 \u090F\u0915 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin??"\u092E\u093E\u0928"} \u092E\u0947\u0902 ${o}${n.maximum} ${s.unit} \u0939\u094B\u0902`:`\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin??"\u092E\u093E\u0928"} ${o}${n.maximum} \u0939\u094B`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin} \u092E\u0947\u0902 ${o}${n.minimum} ${s.unit} \u0939\u094B\u0902`:`\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${n.origin} ${o}${n.minimum} \u0939\u094B`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${o.prefix}" \u0938\u0947 \u0936\u0941\u0930\u0942 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:o.format==="ends_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${o.suffix}" \u092A\u0930 \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:o.format==="includes"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u0907\u0938\u092E\u0947\u0902 "${o.includes}" \u0936\u093E\u092E\u093F\u0932 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:o.format==="regex"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u092A\u0948\u091F\u0930\u094D\u0928 ${o.pattern} \u0938\u0947 \u092E\u0947\u0932 \u0916\u093E\u0928\u093E \u091A\u093E\u0939\u093F\u090F`:`\u0905\u092E\u093E\u0928\u094D\u092F ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: \u092F\u0939 ${n.divisor} \u0915\u093E \u0917\u0941\u0923\u091C \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`;case"unrecognized_keys":return`\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u0902\u091C\u0940${n.keys.length>1?"\u092F\u093E\u0901":""}: ${P(n.keys,", ")}`;case"invalid_key":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u0902\u091C\u0940: ${n.origin} \u092E\u0947\u0902`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F";case"invalid_element":return`\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${n.origin} \u092E\u0947\u0902`;default:return"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"}}};function IN(){return{localeError:q9()}}var F9=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(n){return e[n]??null}let r={regex:"unos",email:"email adresa",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 datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",credit_card:"broj kreditne kartice",currency_code:"kod valute",iban:"IBAN",jwt:"JWT",template_literal:"unos"},i={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${o}, a primljeno je ${a}`}case"invalid_value":return n.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${E(n.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin),a=i[n.origin]??n.origin;return s?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${o}${n.maximum.toString()} ${s.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin),a=i[n.origin]??n.origin;return s?`Premalo: o\u010Dekivano da ${a} ima ${o}${n.minimum.toString()} ${s.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${o.prefix}"`:o.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${o.suffix}"`:o.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${o.includes}"`:o.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${o.pattern}`:`Neispravna ${r[o.format]??n.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${P(n.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${i[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${i[n.origin]??n.origin}`;default:return"Neispravan unos"}}};function PN(){return{localeError:F9()}}var Z9=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"},map:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}let r={regex:"bemenet",email:"email c\xEDm",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 id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",mac:"MAC c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",credit_card:"hitelk\xE1rtyasz\xE1m",currency_code:"p\xE9nznemk\xF3d",iban:"IBAN",jwt:"JWT",template_literal:"bemenet"},i={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${o}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${E(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${n.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${o}${n.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[o.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function TN(){return{localeError:Z9()}}function AN(e,t,r){return Math.abs(e)===1?t:r}function tc(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=e[e.length-1];return e+(t.includes(r)?"\u0576":"\u0568")}var V9=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},map:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(n){return e[n]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",mac:"MAC \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",credit_card:"\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580",currency_code:"\u0561\u0580\u056A\u0578\u0582\u0575\u0569\u056B \u056F\u0578\u0564",iban:"IBAN",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},i={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${n.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${o}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return n.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${E(n.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=AN(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${tc(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${n.maximum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${tc(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=AN(a,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${tc(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${o}${n.minimum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${tc(n.origin)} \u056C\u056B\u0576\u056B ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${o.prefix}"-\u0578\u057E`:o.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${o.suffix}"-\u0578\u057E`:o.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${o.includes}"`:o.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${o.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[o.format]??n.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${n.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${n.keys.length>1?"\u0576\u0565\u0580":""}. ${P(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${tc(n.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${tc(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function RN(){return{localeError:V9()}}var B9=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"},map:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",credit_card:"nomor kartu kredit",currency_code:"kode mata uang",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${o}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${E(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${o}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Terlalu kecil: diharapkan ${n.origin} memiliki ${o}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${r[o.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function EN(){return{localeError:B9()}}var K9=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"},map:{unit:"hluti",verb:"a\xF0 hafa"}};function t(n){return e[n]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",credit_card:"kreditkortan\xFAmer",currency_code:"gjaldmi\xF0ilsk\xF3\xF0i",iban:"IBAN",jwt:"JWT",template_literal:"gildi"},i={nan:"NaN",number:"n\xFAmer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${o}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${E(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${o}${n.maximum.toString()} ${s.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${o}${n.minimum.toString()} ${s.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${o.prefix}"`:o.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${o.suffix}"`:o.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${o.includes}"`:o.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${o.pattern}`:`Rangt ${r[o.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${P(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}};function ON(){return{localeError:K9()}}var G9=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"},map:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}let r={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",mac:"indirizzo MAC",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",credit_card:"numero di carta di credito",currency_code:"codice valuta",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${a}`:`Input non valido: atteso ${o}, ricevuto ${a}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${E(n.values[0])}`:`Opzione non valida: atteso uno tra ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Troppo grande: ${n.origin??"valore"} deve avere ${o}${n.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Troppo piccolo: ${n.origin} deve avere ${o}${n.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${n.origin} deve essere ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Input non valido: ${r[o.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${P(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function NN(){return{localeError:G9()}}var W9=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},map:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(n){return e[n]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",mac:"MAC\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",credit_card:"\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7",currency_code:"\u901A\u8CA8\u30B3\u30FC\u30C9",iban:"IBAN",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},i={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${o}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${E(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${P(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=t(n.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=t(n.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[o.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${P(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function CN(){return{localeError:W9()}}var J9=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},map:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(n){return e[n]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",mac:"MAC \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",credit_card:"\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",currency_code:"\u10D5\u10D0\u10DA\u10E3\u10E2\u10D8\u10E1 \u10D9\u10DD\u10D3\u10D8",iban:"IBAN",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},i={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${E(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${P(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.prefix}"-\u10D8\u10D7`:o.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${o.suffix}"-\u10D8\u10D7`:o.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${o.includes}"-\u10E1`:o.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${o.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${P(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function zN(){return{localeError:J9()}}var H9=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},map:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(n){return e[n]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",mac:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 MAC",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",credit_card:"\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793",currency_code:"\u1780\u17BC\u178A\u179A\u17BC\u1794\u17B7\u1799\u1794\u17D0\u178E\u17D2\u178E",iban:"IBAN",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},i={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${E(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${o} ${n.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${P(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function $g(){return{localeError:H9()}}function jN(){return $g()}var Y9=()=>{let e={string:{unit:"\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},file:{unit:"\u0CAC\u0CC8\u0C9F\u0CCD\u200C\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},array:{unit:"\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},set:{unit:"\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"},map:{unit:"entries",verb:"\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1"}};function t(n){return e[n]??null}let r={regex:"\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD",email:"email \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",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 \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95\u0CA6 \u0CB8\u0CAE\u0CAF",date:"ISO \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95",time:"ISO \u0CB8\u0CAE\u0CAF",duration:"ISO \u0C85\u0CB5\u0CA7\u0CBF",ipv4:"IPv4 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",ipv6:"IPv6 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",mac:"MAC \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8",cidrv4:"IPv4 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF",cidrv6:"IPv6 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF",base64:"base64-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",base64url:"base64url-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",json_string:"JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD",e164:"E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",credit_card:"\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6",currency_code:"\u0C95\u0CB0\u0CC6\u0CA8\u0CCD\u0CB8\u0CBF \u0C95\u0CCB\u0CA1\u0CCD",iban:"IBAN",jwt:"JWT",template_literal:"\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${o}, \u0CB8\u0CCD\u0CB5\u0CC0\u0C95\u0CB0\u0CBF\u0CB8\u0CBF\u0CA6\u0CA8\u0CC1 ${a}`}case"invalid_value":return n.values.length===1?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${E(n.values[0])}`:`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C86\u0CAF\u0CCD\u0C95\u0CC6: \u0C87\u0CB5\u0CC1\u0C97\u0CB3\u0CB2\u0CCD\u0CB2\u0CBF \u0C92\u0C82\u0CA6\u0CA8\u0CCD\u0CA8\u0CC1 \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin??"value"} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${o}${n.maximum.toString()} ${s.unit??"\u0C85\u0C82\u0CB6\u0C97\u0CB3\u0CC1"}`:`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin??"value"} \u0C8E\u0C82\u0CA6\u0CC1 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${o}${n.minimum.toString()} ${s.unit}`:`\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.origin} \u0C8E\u0C82\u0CA6\u0CC1 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0CAA\u0CCD\u0CB0\u0CBE\u0CB0\u0C82\u0CAD\u0CBF\u0CB8\u0CAC\u0CC7\u0C95\u0CC1 "${o.prefix}"`:o.format==="ends_with"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0C95\u0CCA\u0CA8\u0CC6\u0C97\u0CCA\u0CB3\u0CCD\u0CB3\u0CAC\u0CC7\u0C95\u0CC1 "${o.suffix}"`:o.format==="includes"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C92\u0CB3\u0C97\u0CCA\u0C82\u0CA1\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 "${o.includes}"`:o.format==="regex"?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0CAE\u0CBE\u0CA6\u0CB0\u0CBF\u0C97\u0CC6 \u0CB9\u0CCA\u0C82\u0CA6\u0CBF\u0C95\u0CC6\u0CAF\u0CBE\u0C97\u0CAC\u0CC7\u0C95\u0CC1 ${o.pattern}`:`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6: \u0CAC\u0CB9\u0CC1\u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6\u0CAF\u0CBE\u0C97\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 ${n.divisor}`;case"unrecognized_keys":return`\u0C97\u0CC1\u0CB0\u0CC1\u0CA4\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CA6 \u0C95\u0CC0 ${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0C95\u0CC0 \u0C87\u0CA8\u0CCD ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CA4\u0CBE\u0CB0\u0CA4\u0CAE\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF. \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD";case"invalid_element":return`\u0CB0\u0CB2\u0CCD\u0CB2\u0CBF \u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF ${n.origin}`;default:return"\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD"}}};function DN(){return{localeError:Y9()}}var X9=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"},map:{unit:"\uAC1C",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",mac:"MAC \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",credit_card:"\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638",currency_code:"\uD1B5\uD654 \uCF54\uB4DC",iban:"IBAN",jwt:"JWT",template_literal:"\uC785\uB825"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${o}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${E(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${P(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),c=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${c} ${o}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${o}${s}`}case"too_small":{let o=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),c=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${c} ${o}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${o}${s}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[o.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${P(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function MN(){return{localeError:X9()}}var Gl=e=>e.charAt(0).toUpperCase()+e.slice(1);function LN(e){let t=Math.abs(e),r=t%10,i=t%100;return i>=11&&i<=19||r===0?"many":r===1?"one":"few"}var Q9=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(n,o,s,a){let c=e[n]??null;return c===null?c:{unit:c.unit[o],verb:c.verb[a][s?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",mac:"MAC adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",credit_card:"kredito kortel\u0117s numeris",currency_code:"valiutos kodas",iban:"IBAN",jwt:"JWT",template_literal:"\u012Fvestis"},i={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${o}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${E(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${P(n.values,"|")} pasirinkim\u0173`;case"too_big":{let o=i[n.origin]??n.origin,s=t(n.origin,LN(Number(n.maximum)),n.inclusive??!1,"smaller");if(s?.verb)return`${Gl(o??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.maximum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Gl(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.maximum.toString()} ${s?.unit}`}case"too_small":{let o=i[n.origin]??n.origin,s=t(n.origin,LN(Number(n.minimum)),n.inclusive??!1,"bigger");if(s?.verb)return`${Gl(o??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.minimum.toString()} ${s.unit??"element\u0173"}`;let a=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Gl(o??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.minimum.toString()} ${s?.unit}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${o.prefix}"`:o.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${o.suffix}"`:o.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${o.includes}"`:o.format==="regex"?`Eilut\u0117 privalo atitikti ${o.pattern}`:`Neteisingas ${r[o.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${P(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let o=i[n.origin]??n.origin;return`${Gl(o??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function UN(){return{localeError:Q9()}}var eG=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},map:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(n){return e[n]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",mac:"MAC \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",credit_card:"\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430",currency_code:"\u043A\u043E\u0434 \u043D\u0430 \u0432\u0430\u043B\u0443\u0442\u0430",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},i={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${E(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${n.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${P(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function qN(){return{localeError:eG()}}var tG=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"},map:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",credit_card:"nombor kad kredit",currency_code:"kod mata wang",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${a}`:`Input tidak sah: dijangka ${o}, diterima ${a}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${E(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${r[o.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${P(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function FN(){return{localeError:tG()}}var rG=()=>{let e={string:{unit:"\u0905\u0915\u094D\u0937\u0930",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},file:{unit:"\u092C\u093E\u0907\u091F",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},array:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},set:{unit:"\u0924\u0924\u094D\u0935",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"},map:{unit:"\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F",verb:"\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B"}};function t(n){return e[n]??null}let r={regex:"\u0907\u0928\u092A\u0941\u091F",email:"\u0907\u092E\u0947\u0932 \u0920\u0947\u0917\u093E\u0928\u093E",url:"URL",emoji:"\u0907\u092E\u094B\u091C\u0940",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u092E\u093F\u0924\u093F \u0930 \u0938\u092E\u092F",date:"ISO \u092E\u093F\u0924\u093F",time:"ISO \u0938\u092E\u092F",duration:"ISO \u0905\u0935\u0927\u093F",ipv4:"IPv4 \u0920\u0947\u0917\u093E\u0928\u093E",ipv6:"IPv6 \u0920\u0947\u0917\u093E\u0928\u093E",mac:"MAC \u0920\u0947\u0917\u093E\u0928\u093E",cidrv4:"IPv4 \u0926\u093E\u092F\u0930\u093E",cidrv6:"IPv6 \u0926\u093E\u092F\u0930\u093E",base64:"base64-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919",base64url:"base64url-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919",json_string:"JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919",e164:"E.164 \u0928\u092E\u094D\u092C\u0930",credit_card:"\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930",currency_code:"\u092E\u0941\u0926\u094D\u0930\u093E \u0915\u094B\u0921",iban:"IBAN",jwt:"JWT",template_literal:"\u0907\u0928\u092A\u0941\u091F"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${o}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${a}`}case"invalid_value":return n.values.length===1?`\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${E(n.values[0])}`:`\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u0939\u0930\u0942 \u092E\u0927\u094D\u092F\u0947 \u090F\u0915 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${n.origin??"\u092E\u093E\u0928"} \u092E\u093E ${o}${n.maximum.toString()} ${s.unit} ${s.verb}`:`\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${n.origin??"\u092E\u093E\u0928"} ${o}${n.maximum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${n.origin} \u092E\u093E ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${n.origin} ${o}${n.minimum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${o.prefix}" \u092C\u093E\u091F \u0938\u0941\u0930\u0941 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:o.format==="ends_with"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${o.suffix}" \u092E\u093E \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:o.format==="includes"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${o.includes}" \u0938\u092E\u093E\u0935\u0947\u0936 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`:o.format==="regex"?`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: \u0922\u093E\u0901\u091A\u093E ${o.pattern} \u0938\u0901\u0917 \u092E\u0947\u0932 \u0916\u093E\u0928\u0941\u092A\u0930\u094D\u091B`:`\u0905\u092E\u093E\u0928\u094D\u092F ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: ${n.divisor} \u0915\u094B \u0917\u0941\u0923\u091C \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`;case"unrecognized_keys":return`\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u091E\u094D\u091C\u0940${n.keys.length>1?"\u0939\u0930\u0942":""}: ${P(n.keys,", ")}`;case"invalid_key":return`\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u091E\u094D\u091C\u0940: ${n.origin} \u092E\u093E`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${n.options.map(s=>`'${s}'`).join(" | ")}`:"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F";case"invalid_element":return`\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${n.origin} \u092E\u093E`;default:return"\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"}}};function ZN(){return{localeError:rG()}}var nG=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"},map:{unit:"elementen",verb:"heeft"}};function t(n){return e[n]??null}let r={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",mac:"MAC-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",credit_card:"creditcardnummer",currency_code:"valutacode",iban:"IBAN",jwt:"JWT",template_literal:"invoer"},i={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${o}, ontving ${a}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${E(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin),a=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return s?`Te ${a}: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} is`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin),a=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return s?`Te ${a}: verwacht dat ${n.origin} ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Te ${a}: verwacht dat ${n.origin} ${o}${n.minimum.toString()} is`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${r[o.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function VN(){return{localeError:nG()}}var iG=()=>{let e={string:{unit:"teikn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"element",verb:"\xE5 innehalde"},set:{unit:"element",verb:"\xE5 innehalde"},map:{unit:"element",verb:"\xE5 innehalde"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varigheit",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkoda streng",base64url:"base64url-enkoda streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"tal",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventa instanceof ${n.expected}, fekk ${a}`:`Ugyldig input: forventa ${o}, fekk ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventa ${E(n.values[0])}`:`Ugyldig val: forventa eitt av ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`For stor(t): forventa ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()} ${s.unit??"element"}`:`For stor(t): forventa ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`For lite(n): forventa ${n.origin} til \xE5 ha ${o}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventa ${n.origin} til \xE5 ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 slutte med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 innehalde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldig tal: m\xE5 vere eit multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjende n\xF8klar":"Ukjend n\xF8kkel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function BN(){return{localeError:iG()}}var oG=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"},map:{unit:"elementer",verb:"\xE5 inneholde"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${a}`:`Ugyldig input: forventet ${o}, fikk ${a}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${E(n.values[0])}`:`Ugyldig valg: forventet en av ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`For lite(n): forventet ${n.origin} til \xE5 ha ${o}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${r[o.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function KN(){return{localeError:oG()}}var sG=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"},map:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}let r={regex:"giren",email:"epostag\xE2h",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 heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",mac:"MAC ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",credit_card:"i'tib\xE2r kart\u0131 numaras\u0131",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"giren"},i={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${o}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${E(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${o}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${o}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${o}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${o}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=n;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[o.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function GN(){return{localeError:sG()}}var aG=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},map:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(n){return e[n]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",mac:"\u062F MAC \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",credit_card:"\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647",currency_code:"\u062F \u0627\u0633\u0639\u0627\u0631\u0648 \u06A9\u0648\u0689",iban:"IBAN",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},i={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${o} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${E(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${P(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[o.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${P(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function WN(){return{localeError:aG()}}var cG=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"},map:{unit:"element\xF3w",verb:"mie\u0107"}};function t(n){return e[n]??null}let r={regex:"wyra\u017Cenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",mac:"adres MAC",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",credit_card:"numer karty kredytowej",currency_code:"kod waluty",iban:"IBAN",jwt:"JWT",template_literal:"wej\u015Bcie"},i={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${o}, otrzymano ${a}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${E(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${n.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${n.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[o.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${P(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function JN(){return{localeError:cG()}}var uG=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function t(s){return e[s]??null}let r={regex:"a entrada",email:"o endere\xE7o de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a dura\xE7\xE3o ISO",ipv4:"o endere\xE7o IPv4",ipv6:"o endere\xE7o IPv6",mac:"o endere\xE7o MAC",cidrv4:"o intervalo de endere\xE7os IPv4",cidrv6:"o intervalo de endere\xE7os IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o n\xFAmero E.164",credit_card:"o n\xFAmero de cart\xE3o de cr\xE9dito",currency_code:"o c\xF3digo de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},i={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},n={string:{name:"texto",articles:i.masculine},number:{name:"n\xFAmero",articles:i.masculine},int:{name:"n\xFAmero inteiro",articles:i.masculine},boolean:{name:"valor booleano",articles:i.masculine},bigint:{name:"n\xFAmero bigint",articles:i.masculine},symbol:{name:"s\xEDmbolo",articles:i.masculine},undefined:{name:'valor "undefined"',articles:i.masculine},null:{name:'valor "nulo"',articles:i.masculine},never:{name:'valor "never"',articles:i.masculine},void:{name:'valor "void"',articles:i.masculine},date:{name:"data",articles:i.feminine},array:{name:"vetor",articles:i.masculine},object:{name:"objeto",articles:i.masculine},tuple:{name:"tuplo",articles:i.masculine},record:{name:"registo",articles:i.masculine},map:{name:"mapa",articles:i.masculine},set:{name:"conjunto",articles:i.masculine},file:{name:"ficheiro",articles:i.masculine},nonoptional:{name:"valor n\xE3o opcional",articles:i.masculine},nan:{name:'valor "NaN"',articles:i.masculine},function:{name:"fun\xE7\xE3o",articles:i.feminine}};function o(s,a){let c=n[s]??{name:`valor "${s}"`,articles:i.masculine};return`${c.articles[a]} ${c.name}`}return s=>{switch(s.code){case"invalid_type":{let a=o(s.expected,"indefinite"),c=O(s.input),u=o(c,"indefinite");return`Entrada inv\xE1lida: esperava ${a}, recebeu ${u}`}case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: esperava ${E(s.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${P(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=t(s.origin);return c?`Demasiado grande: esperava que ${o(s.origin,"definite")} tivesse ${a} ${s.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: esperava que ${o(s.origin,"definite")} fosse ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=t(s.origin);return c?`Demasiado pequeno: esperava que ${o(s.origin,"definite")} tivesse ${a} ${s.minimum.toString()} ${c.unit??"elementos"}`:`Demasiado pequeno: esperava que ${o(s.origin,"definite")} fosse ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar por "${a.prefix}"`:a.format==="ends_with"?`Texto inv\xE1lido: deve terminar em "${a.suffix}"`:a.format==="includes"?`Texto inv\xE1lido: deve incluir "${a.includes}"`:a.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${a.pattern}`:`Formato d${r[a.format]??s.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":{let a=s.keys.length>1?"s":"";return`Chave${a} inv\xE1lida${a}: ${P(s.keys,", ")}`}case"invalid_key":return`Entrada inv\xE1lida n${o(s.origin,"definite")}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${s.options.map(c=>`'${c}'`).join(" | ")}`:"Entrada inv\xE1lida";case"invalid_element":return`Entrada inv\xE1lida n${o(s.origin,"definite")}`;default:return"Entrada inv\xE1lida"}}};function HN(){return{localeError:uG()}}var lG=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function t(s){return e[s]??null}let r={regex:"a entrada",email:"o endere\xE7o de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a dura\xE7\xE3o ISO",ipv4:"o endere\xE7o IPv4",ipv6:"o endere\xE7o IPv6",mac:"o endere\xE7o MAC",cidrv4:"a faixa de endere\xE7os IPv4",cidrv6:"a faixa de endere\xE7os IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o n\xFAmero E.164",credit_card:"o n\xFAmero de cart\xE3o de cr\xE9dito",currency_code:"o c\xF3digo de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},i={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},n={string:{name:"texto",articles:i.masculine},number:{name:"n\xFAmero",articles:i.masculine},int:{name:"n\xFAmero inteiro",articles:i.masculine},boolean:{name:"valor booleano",articles:i.masculine},bigint:{name:"n\xFAmero bigint",articles:i.masculine},symbol:{name:"s\xEDmbolo",articles:i.masculine},undefined:{name:'valor "undefined"',articles:i.masculine},null:{name:'valor "nulo"',articles:i.masculine},never:{name:'valor "never"',articles:i.masculine},void:{name:'valor "void"',articles:i.masculine},date:{name:"data",articles:i.feminine},array:{name:"vetor",articles:i.masculine},object:{name:"objeto",articles:i.masculine},tuple:{name:"tupla",articles:i.feminine},record:{name:"registro",articles:i.masculine},map:{name:"mapa",articles:i.masculine},set:{name:"conjunto",articles:i.masculine},file:{name:"arquivo",articles:i.masculine},nonoptional:{name:"valor n\xE3o opcional",articles:i.masculine},nan:{name:'valor "NaN"',articles:i.masculine},function:{name:"fun\xE7\xE3o",articles:i.feminine}};function o(s,a){let c=n[s]??{name:`valor "${s}"`,articles:i.masculine};return`${c.articles[a]} ${c.name}`}return s=>{switch(s.code){case"invalid_type":{let a=o(s.expected,"indefinite"),c=O(s.input),u=o(c,"indefinite");return`Entrada inv\xE1lida: esperava ${a}, recebeu ${u}`}case"invalid_value":return s.values.length===1?`Entrada inv\xE1lida: esperava ${E(s.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${P(s.values,"|")}`;case"too_big":{let a=s.inclusive?"<=":"<",c=t(s.origin);return c?`Grande demais: esperava que ${o(s.origin,"definite")} tivesse ${a} ${s.maximum.toString()} ${c.unit??"elementos"}`:`Grande demais: esperava que ${o(s.origin,"definite")} fosse ${a} ${s.maximum.toString()}`}case"too_small":{let a=s.inclusive?">=":">",c=t(s.origin);return c?`Pequeno demais: esperava que ${o(s.origin,"definite")} tivesse ${a} ${s.minimum.toString()} ${c.unit??"elementos"}`:`Pequeno demais: esperava que ${o(s.origin,"definite")} fosse ${a} ${s.minimum.toString()}`}case"invalid_format":{let a=s;return a.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${a.prefix}"`:a.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${a.suffix}"`:a.format==="includes"?`Texto inv\xE1lido: deve incluir "${a.includes}"`:a.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${a.pattern}`:`Formato d${r[a.format]??s.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${s.divisor}`;case"unrecognized_keys":{let a=s.keys.length>1?"s":"";return`Chave${a} inv\xE1lida${a}: ${P(s.keys,", ")}`}case"invalid_key":return`Entrada inv\xE1lida n${o(s.origin,"definite")}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${s.options.map(c=>`'${c}'`).join(" | ")}`:"Entrada inv\xE1lida";case"invalid_element":return`Entrada inv\xE1lida n${o(s.origin,"definite")}`;default:return"Entrada inv\xE1lida"}}};function YN(){return{localeError:lG()}}var dG=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(n){return e[n]??null}let r={regex:"intrare",email:"adres\u0103 de email",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:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",credit_card:"num\u0103r de card de credit",currency_code:"cod valutar",iban:"IBAN",jwt:"JWT",template_literal:"intrare"},i={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${o}, primit ${a}`}case"invalid_value":return n.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${E(n.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Prea mic: a\u0219teptat ca ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Prea mic: a\u0219teptat ca ${n.origin} s\u0103 fie ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${o.prefix}"`:o.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${o.suffix}"`:o.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${o.includes}"`:o.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${o.pattern}`:`Format invalid: ${r[o.format]??n.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${P(n.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${n.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${n.origin}`;default:return"Intrare invalid\u0103"}}};function XN(){return{localeError:dG()}}function QN(e,t,r,i){let n=Math.abs(e),o=n%10,s=n%100;return s>=11&&s<=19?i:o===1?t:o>=2&&o<=4?r:i}var fG=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},map:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",mac:"MAC \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u044B",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${o}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${E(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),c=QN(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${n.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),c=QN(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${n.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${P(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function eC(){return{localeError:fG()}}var pG=()=>{let e={string:{unit:"znakov",verb:"ma\u0165"},file:{unit:"bajtov",verb:"ma\u0165"},array:{unit:"prvkov",verb:"ma\u0165"},set:{unit:"prvkov",verb:"ma\u0165"},map:{unit:"polo\u017Eiek",verb:"ma\u0165"}};function t(n){return e[n]??null}let r={regex:"regul\xE1rny v\xFDraz",email:"e-mailov\xE1 adresa",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:"d\xE1tum a \u010Das vo form\xE1te ISO",date:"d\xE1tum vo form\xE1te ISO",time:"\u010Das vo form\xE1te ISO",duration:"doba trvania ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64",base64url:"re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64url",json_string:"re\u0165azec vo form\xE1te JSON",e164:"\u010D\xEDslo E.164",credit_card:"\u010D\xEDslo kreditnej karty",currency_code:"k\xF3d meny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},i={nan:"NaN",number:"\u010D\xEDslo",string:"re\u0165azec",function:"funkcia",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 instanceof ${n.expected}, obdr\u017Ean\xE9 ${a}`:`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${o}, obdr\u017Ean\xE9 ${a}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${E(n.values[0])}`:`Neplatn\xFD vstup: o\u010Dak\xE1van\xE1 jedna z hodn\xF4t ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${n.origin??"hodnota"} mus\xED ma\u0165 ${o}${n.maximum.toString()} ${s.unit??"prvkov"}`:`Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${n.origin??"hodnota"} mus\xED by\u0165 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Hodnota je pr\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED ma\u0165 ${o}${n.minimum.toString()} ${s.unit??"prvkov"}`:`Hodnota je pr\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED by\u0165 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neplatn\xFD re\u0165azec: mus\xED za\u010D\xEDna\u0165 na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD re\u0165azec: mus\xED kon\u010Di\u0165 na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD re\u0165azec: mus\xED obsahova\u0165 "${o.includes}"`:o.format==="regex"?`Neplatn\xFD re\u0165azec: mus\xED zodpoveda\u0165 vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${r[o.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED by\u0165 n\xE1sobkom ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1me kl\xFA\u010De: ${P(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xFA\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};function tC(){return{localeError:pG()}}var mG=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"},map:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}let r={regex:"vnos",email:"e-po\u0161tni naslov",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 datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",mac:"MAC naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",credit_card:"\u0161tevilka kreditne kartice",currency_code:"koda valute",iban:"IBAN",jwt:"JWT",template_literal:"vnos"},i={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${o}, prejeto ${a}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${E(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${o}${n.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${o}${n.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${r[o.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${P(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function rC(){return{localeError:mG()}}var hG=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"},map:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(n){return e[n]??null}let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-adress",ipv6:"IPv6-adress",mac:"MAC-adress",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",credit_card:"kreditkortsnummer",currency_code:"valutakod",iban:"IBAN",jwt:"JWT",template_literal:"mall-literal"},i={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${o}, fick ${a}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${E(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${r[o.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${P(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function nC(){return{localeError:hG()}}var gG=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},map:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(n){return e[n]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",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 \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",mac:"MAC \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",credit_card:"\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD",currency_code:"\u0BA8\u0BBE\u0BA3\u0BAF\u0B95\u0BCD \u0B95\u0BC1\u0BB1\u0BBF\u0BAF\u0BC0\u0B9F\u0BC1",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${E(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${P(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${n.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${o}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${o}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function iC(){return{localeError:gG()}}var yG=()=>{let e={string:{unit:"\u0430\u043B\u043E\u043C\u0430\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},file:{unit:"\u0431\u0430\u0439\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},array:{unit:"\u0443\u043D\u0441\u0443\u0440",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},set:{unit:"\u0443\u043D\u0441\u0443\u0440",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"},map:{unit:"\u0441\u0430\u0431\u0442",verb:"\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0443\u0440\u0443\u0434",email:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 email",url:"URL",emoji:"\u044D\u043C\u043E\u04B7\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0441\u0430\u043D\u0430\u0432\u0443 \u0432\u0430\u049B\u0442\u0438 ISO",date:"\u0441\u0430\u043D\u0430\u0438 ISO",time:"\u0432\u0430\u049B\u0442\u0438 ISO",duration:"\u0434\u0430\u0432\u043E\u043C\u043D\u043E\u043A\u0438\u0438 ISO",ipv4:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv4",ipv6:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 IPv6",mac:"\u0441\u0443\u0440\u043E\u0493\u0430\u0438 MAC",cidrv4:"\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv4",cidrv6:"\u043C\u0430\u04B3\u0434\u0443\u0434\u0430\u0438 IPv6",base64:"\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64",base64url:"\u0441\u0430\u0442\u0440\u0438 \u0434\u0430\u0440 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 base64url",json_string:"\u0441\u0430\u0442\u0440\u0438 JSON",e164:"\u0440\u0430\u049B\u0430\u043C\u0438 E.164",credit_card:"\u0440\u0430\u049B\u0430\u043C\u0438 \u043A\u043E\u0440\u0442\u0438 \u043A\u0440\u0435\u0434\u0438\u0442\u04E3",currency_code:"\u0440\u0430\u043C\u0437\u0438 \u0430\u0441\u044A\u043E\u0440",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0443\u0440\u0443\u0434"},i={nan:"NaN",number:"\u0440\u0430\u049B\u0430\u043C",string:"\u0441\u0430\u0442\u0440",array:"\u043C\u0430\u0441\u0441\u0438\u0432",object:"\u043E\u0431\u044A\u0435\u043A\u0442",date:"\u0441\u0430\u043D\u0430"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return`\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${o} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442, ${a} \u0433\u0438\u0440\u0438\u0444\u0442\u0430 \u0448\u0443\u0434`}case"invalid_value":return n.values.length===1?`\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: ${E(n.values[0])} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`:`\u0418\u043D\u0442\u0438\u0445\u043E\u0431\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u044F\u043A\u0435 \u0430\u0437 ${P(n.values,"|")} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${n.origin??"\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${o}${n.maximum.toString()} ${s.unit} ${s.verb}`:`\u0425\u0435\u043B\u0435 \u043A\u0430\u043B\u043E\u043D: ${n.origin??"\u049B\u0438\u043C\u0430\u0442"} \u0431\u043E\u044F\u0434 ${o}${n.maximum.toString()} \u0431\u043E\u0448\u0430\u0434`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${n.origin} \u0431\u043E\u044F\u0434 ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`\u0425\u0435\u043B\u0435 \u0445\u0443\u0440\u0434: ${n.origin} \u0431\u043E\u044F\u0434 ${o}${n.minimum.toString()} \u0431\u043E\u0448\u0430\u0434`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${o.prefix}" \u043E\u0493\u043E\u0437 \u0448\u0430\u0432\u0430\u0434`:o.format==="ends_with"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u043E "${o.suffix}" \u0430\u043D\u04B7\u043E\u043C \u0451\u0431\u0430\u0434`:o.format==="includes"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 "${o.includes}"-\u0440\u043E \u0434\u0430\u0440 \u0431\u0430\u0440 \u0433\u0438\u0440\u0430\u0434`:o.format==="regex"?`\u0421\u0430\u0442\u0440\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 \u043D\u0430\u043C\u0443\u043D\u0430\u0438 ${o.pattern} \u043C\u0443\u0432\u043E\u0444\u0438\u049B\u0430\u0442 \u043A\u0443\u043D\u0430\u0434`:`${r[o.format]??n.format}-\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442`}case"not_multiple_of":return`\u0420\u0430\u049B\u0430\u043C\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442: \u0431\u043E\u044F\u0434 \u0431\u0430 ${n.divisor} \u0431\u0435 \u0431\u0430\u049B\u0438\u044F \u0442\u0430\u049B\u0441\u0438\u043C \u0448\u0430\u0432\u0430\u0434`;case"unrecognized_keys":return`\u041A\u0430\u043B\u0438\u0434${n.keys.length>1?"\u04B3\u043E\u0438":"\u0438"} \u043D\u043E\u043C\u0430\u044A\u043B\u0443\u043C: ${P(n.keys,", ")}`;case"invalid_key":return`\u041A\u0430\u043B\u0438\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442\u0438 \u0434\u0438\u0441\u043A\u0440\u0438\u043C\u0438\u043D\u0430\u0442\u043E\u0440: ${n.options.map(s=>`'${s}'`).join(" | ")} \u0438\u043D\u0442\u0438\u0437\u043E\u0440 \u043C\u0435\u0440\u0430\u0444\u0442`:"\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442";case"invalid_element":return`\u049A\u0438\u043C\u0430\u0442\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442 \u0434\u0430\u0440 ${n.origin}`;default:return"\u0412\u0443\u0440\u0443\u0434\u0438 \u043D\u043E\u0434\u0443\u0440\u0443\u0441\u0442"}}};function oC(){return{localeError:yG()}}var vG=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},map:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(n){return e[n]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",mac:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",credit_card:"\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15",currency_code:"\u0E23\u0E2B\u0E31\u0E2A\u0E2A\u0E01\u0E38\u0E25\u0E40\u0E07\u0E34\u0E19",iban:"IBAN",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},i={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${o} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${E(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[o.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${P(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function sC(){return{localeError:vG()}}var $G=()=>{let e={string:{unit:"simwol",verb:"bolmaly"},file:{unit:"ba\xFDt",verb:"bolmaly"},array:{unit:"elementler",verb:"bolmaly"},set:{unit:"elementler",verb:"bolmaly"},map:{unit:"elementler",verb:"bolmaly"}};function t(n){return e[n]??null}let r={regex:"giri\u015F",email:"e-po\xE7ta salgysy",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 sene we wagt",date:"ISO sene",time:"ISO wagt",duration:"ISO wagt aralygy",ipv4:"IPv4 salgysy",ipv6:"IPv6 salgysy",mac:"MAC salgysy",cidrv4:"IPv4 aralygy",cidrv6:"IPv6 aralygy",base64:"base64 bilen \u015Fifrlenen setir",base64url:"base64url bilen \u015Fifrlenen setir",json_string:"JSON setiri",e164:"E.164 nomeri",credit_card:"kredit kartyny\u0148 nomeri",currency_code:"wal\xFDuta kody",iban:"IBAN",jwt:"JWT",template_literal:"\u015Fablon"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return`N\xE4dogry baha: gara\u015Fylan ${o} \xFDerine ${a} alyndy`}case"invalid_value":return n.values.length===1?`N\xE4dogry baha: ${E(n.values[0])} bolmaly`:`N\xE4dogry sa\xFDlaw: a\u015Fakdakylardan biri bolmaly: ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Has uly: gara\u015Fyl\xFDan ${n.origin??"baha"} ${o} ${n.maximum.toString()} ${s.unit??"element"}`:`Has uly: gara\u015Fyl\xFDan ${n.origin??"baha"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Has ki\xE7i: gara\u015Fyl\xFDan ${n.origin} ${o} ${n.minimum.toString()} ${s.unit}`:`Has ki\xE7i: gara\u015Fyl\xFDan ${n.origin} ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`N\xE4dogry setir: "${o.prefix}" bilen ba\u015Flamaly`:o.format==="ends_with"?`N\xE4dogry setir: "${o.suffix}" bilen gutarmaly`:o.format==="includes"?`N\xE4dogry setir: "${o.includes}" saklamaly`:o.format==="regex"?`N\xE4dogry setir: ${o.pattern} nusga la\xFDyk bolmaly`:`N\xE4dogry ${r[o.format]??n.format}`}case"not_multiple_of":return`N\xE4dogry san: ${n.divisor} bilen galyndysyz b\xF6l\xFCnmeli`;case"unrecognized_keys":return`Tanalma\xFDan a\xE7ar${n.keys.length>1?"lar":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde n\xE4dogry a\xE7ar`;case"invalid_union":return"N\xE4dogry baha";case"invalid_element":return`${n.origin} i\xE7inde n\xE4dogry baha`;default:return"N\xE4dogry baha"}}};function aC(){return{localeError:$G()}}var bG=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},map:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(n){return e[n]??null}let r={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",mac:"MAC adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",credit_card:"kredi kart\u0131 numaras\u0131",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"\u015Eablon dizesi"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${o}, al\u0131nan ${a}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${E(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ge\xE7ersiz metin: "${o.prefix}" ile ba\u015Flamal\u0131`:o.format==="ends_with"?`Ge\xE7ersiz metin: "${o.suffix}" ile bitmeli`:o.format==="includes"?`Ge\xE7ersiz metin: "${o.includes}" i\xE7ermeli`:o.format==="regex"?`Ge\xE7ersiz metin: ${o.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[o.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function cC(){return{localeError:bG()}}var _G=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},map:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(n){return e[n]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",mac:"\u0430\u0434\u0440\u0435\u0441\u0430 MAC",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",credit_card:"\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438",currency_code:"\u043A\u043E\u0434 \u0432\u0430\u043B\u044E\u0442\u0438",iban:"IBAN",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},i={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${o}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${E(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${P(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function bg(){return{localeError:_G()}}function uC(){return bg()}var wG=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},map:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(n){return e[n]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",mac:"\u0627\u06CC\u0645 \u0627\u06D2 \u0633\u06CC \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",credit_card:"\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631",currency_code:"\u06A9\u0631\u0646\u0633\u06CC \u06A9\u0648\u0688",iban:"IBAN",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},i={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${o} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${E(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${P(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${o}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${o}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${P(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function lC(){return{localeError:wG()}}var kG=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(n){return e[n]??null}let r={regex:"kirish",email:"elektron pochta manzili",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 sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",credit_card:"kredit karta raqami",currency_code:"valyuta kodi",iban:"IBAN",jwt:"JWT",template_literal:"kirish"},i={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${o}, qabul qilingan ${a}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${E(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Juda katta: kutilgan ${n.origin??"qiymat"} ${o}${n.maximum.toString()} ${s.unit} ${s.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Juda kichik: kutilgan ${n.origin} ${o}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Juda kichik: kutilgan ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${o.prefix}" bilan boshlanishi kerak`:o.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${o.suffix}" bilan tugashi kerak`:o.format==="includes"?`Noto\u2018g\u2018ri satr: "${o.includes}" ni o\u2018z ichiga olishi kerak`:o.format==="regex"?`Noto\u2018g\u2018ri satr: ${o.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[o.format]??n.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${n.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${n.keys.length>1?"lar":""}: ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${n.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function dC(){return{localeError:kG()}}var SG=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},map:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(n){return e[n]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",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:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",mac:"\u0111\u1ECBa ch\u1EC9 MAC",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",credit_card:"s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng",currency_code:"m\xE3 ti\u1EC1n t\u1EC7",iban:"IBAN",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},i={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${o}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${E(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${r[o.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${P(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function fC(){return{localeError:SG()}}var xG=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"},map:{unit:"\u9879",verb:"\u5305\u542B"}};function t(n){return e[n]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",mac:"MAC\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",credit_card:"\u4FE1\u7528\u5361\u53F7",currency_code:"\u8D27\u5E01\u4EE3\u7801",iban:"IBAN",jwt:"JWT",template_literal:"\u8F93\u5165"},i={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${o}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${E(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${o}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${r[o.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${P(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function pC(){return{localeError:xG()}}var IG=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},map:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(n){return e[n]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",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 \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",mac:"MAC \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",credit_card:"\u4FE1\u7528\u5361\u865F",currency_code:"\u8CA8\u5E63\u4EE3\u78BC",iban:"IBAN",jwt:"JWT",template_literal:"\u8F38\u5165"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${o}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${E(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${o}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${o}${n.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${r[o.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${P(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function mC(){return{localeError:IG()}}var PG=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"},map:{unit:"nkan",verb:"n\xED"}};function t(n){return e[n]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",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:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",mac:"\xE0d\xEDr\u1EB9\u0301s\xEC MAC",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",credit_card:"n\u1ECDmba kaadi gbese",currency_code:"koodu ow\xF3",iban:"IBAN",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},i={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=O(n.input),a=i[s]??s;return/^[A-Z]/.test(n.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${o}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${E(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${P(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${s.verb} ${o}${n.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${n.maximum}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${s.verb} ${o}${n.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${o}${n.minimum}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${o.prefix}"`:o.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${o.suffix}"`:o.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${o.includes}"`:o.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${o.pattern}`:`A\u1E63\xEC\u1E63e: ${r[o.format]??n.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${n.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${P(n.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function hC(){return{localeError:PG()}}var gC,Tk=Symbol("ZodOutput"),Ak=Symbol("ZodInput"),_g=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let i=r[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.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 i={...this.get(r)??{}};delete i.id;let n={...i,...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 wg(){return new _g}(gC=globalThis).__zod_globalRegistry??(gC.__zod_globalRegistry=wg());var Bt=globalThis.__zod_globalRegistry;var $r=Symbol.for("zod.compile.invalid"),yC=Symbol.for("zod.compile.fallback"),An=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Te=class extends Error{constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};function AG(e,t){try{return Sg(e,{assertOnly:!0})}catch{return t}}function Nk(e,t){try{let r=Sg(e),i=kg(e,r);return i._zod.bag.validator=AG(e,r),i}catch(r){if(t?.strict)throw r;return e}}function kg(e,t){if(gg(e))throw new Te("a schema whose subtree contains a reference cycle");let r=Fe(e),i=e._zod.run,n=i.__originalRun??i,o=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[yC]||a&&yg(a,s.value))return n(s,a);let c=t(s.value);return c!==$r?(s.value=c,s):(a&&(a[yC]=!0),n(s,a))};return o.__originalRun=n,r._zod.bag.fallbackRun=n,r._zod.bag.validator=t,r._zod.run=o,i.__originalRun||RG(r,e,t),r}function RG(e,t,r){let i=e,n=t;if(typeof n.safeParse=="function"){let o=n.safeParse;i.safeParse=(s,a)=>{let c=r(s);return c!==$r?{success:!0,data:c}:o(s,a)}}if(typeof n.parse=="function"){let o=n.parse;i.parse=(s,a)=>{let c=r(s);return c!==$r?c:o(s,a)}}}function Sg(e,t){let r=!0;try{r=gg(e)}catch{}if(r)throw new Te("a schema whose subtree contains a reference cycle");let i={constants:new Map,constantCounter:0,varCounter:0,definite:!0},n=new _s(["input"]),o=gt(n,i,e,"input",!t?.assertOnly);n.write(o===null?"return true;":`return ${o};`);let s=["INVALID",...i.constants.keys()],a=[$r,...i.constants.values()],c=n.content.join(`
|
|
208
|
+
`),u=t?.debug?s.length>0?`// Constants: ${s.join(", ")}
|
|
209
|
+
${c}`:c:"",l=Function,d=`return (input) => {
|
|
210
|
+
${c}
|
|
211
|
+
}`,f;try{f=new l(...s,d)(...a)}catch(p){throw new Te(`this schema (generated code failed to evaluate: ${p.message})`)}return t?.debug&&(f.code=u),f.definite=i.definite,f}function se(e,t){for(let[i,n]of e.constants)if(n===t)return i;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function Ss(e,t){return e.definite=!1,se(e,t)}function re(e){return`v${e.varCounter++}`}function EG(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return $r;let i=r;return i.issues.length===0?i.value:$r}function rr(e,t,r,i,n=!0){let o=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return gt(e,t,r,i,n)}catch(u){if(!(u instanceof Te)||!u.islandable)throw u;if(e.content.length=o,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let d of l)t.constants.delete(d)}return t.constantCounter=a,t.varCounter=c,OG(e,t,r,i)}}function OG(e,t,r,i){t.definite=!1;let n=se(t,r),o=se(t,EG),s=re(t);return e.write(`const ${s} = ${o}(${n}, ${i});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var NG=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function CG(e,t,r,i){let n=r._zod.def.checks;if(!n||n.length===0)return i;let o=i;for(let s of n){let a=s._zod.def;if(a.when&&!NG.has(a.check))throw new Te('check with a custom "when" condition');switch(a.check){case"greater_than":zG(e,t,a,o);break;case"less_than":jG(e,t,a,o);break;case"multiple_of":DG(e,t,a,o);break;case"number_format":kC(e,a,o);break;case"min_length":{let c=ws(a.minimum,"min_length"),u=Rk(e,t,o,`${o}.length >= ${c} && ${o}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=ws(a.maximum,"max_length"),u=Rk(e,t,o,`${o}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=ws(a.length,"length_equals"),u=Rk(e,t,o,`${o}.length >= ${c} && ${o}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${o}.size < ${ws(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${o}.size > ${ws(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${o}.size !== ${ws(a.size,"size_equals")}) return INVALID;`);break;case"string_format":o=SC(e,t,a,o);break;case"custom":o=ZG(e,t,s,o);break;case"bigint_format":MG(e,a,o);break;case"mime_type":LG(e,t,a,o);break;case"property":qG(e,t,a,o);break;case"properties":UG(e,t,a,o);break;case"overwrite":{let c=re(t);FG(e,t,s,o,c),o=c;break}default:throw new Te(`check type ${a.check}`)}}return o}function Rk(e,t,r,i){let n=se(t,ys),o=re(t);return e.write(`const ${o} = typeof ${r} === "string" && ${i} ? ${n}(${r}) : ${r}.length;`),o}function ws(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Te(`${t} bound of type ${typeof e}`);return`${e}`}function wC(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Te("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Te("comparison check with Invalid Date bound");return se(e,t)}throw new Te(`comparison check bound of type ${typeof t}`)}function zG(e,t,r,i){let n=r.inclusive?"<":"<=";e.write(`if (${i} ${n} ${wC(t,r.value)}) return INVALID;`)}function jG(e,t,r,i){let n=r.inclusive?">":">=";e.write(`if (${i} ${n} ${wC(t,r.value)}) return INVALID;`)}function DG(e,t,r,i){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Te("multiple_of check with a zero divisor");e.write(`if (${i} % ${r.value}n !== 0n) return INVALID;`)}else{let n=se(t,_l);e.write(`if (${n}(${i}, ${ws(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function kC(e,t,r){let i=t.format;switch(i){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new Te(`number format ${i}`)}}function MG(e,t,r){let i=t.format;if(i)switch(i){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new Te(`bigint format ${i}`)}}function LG(e,t,r,i){let n=r.mime;if(n&&n.length>0){let o=se(t,new Set(n));e.write(`if (!${o}.has(${i}.type)) return INVALID;`)}}function UG(e,t,r,i){if(r.when)throw new Te('check with a custom "when" condition');e.write(`if (${i} == null) return INVALID;`);let n=r.shape;for(let o of Reflect.ownKeys(n)){let s=typeof o=="symbol"?se(t,o):yr(o),a=re(t);e.write(`const ${a} = ${i}[${s}];`),rr(e,t,n[o],a,!1)}}function qG(e,t,r,i){let n=`${i}[${JSON.stringify(r.property)}]`;gt(e,t,r.schema,n)}function FG(e,t,r,i,n){let o=r._zod.def.tx;if(!o)throw new Te("overwrite check without a transform function");if(xs(o))throw new An("z.compile: async overwrite transforms are not supported");let s=se(t,o);e.write(`const ${n} = ${s}(${i});`)}function Ek(){throw new Or}function Ck(e){this.issues.push(e)}function ZG(e,t,r,i){let n=r._zod.def;if(n.fn){if(xs(n.fn))throw new An("z.compile: async .refine() predicates are not supported");let o=Ss(t,n.fn),s=se(t,Ek),a=re(t);return e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),i}if(r._zod.check){if(xs(r._zod.check))throw new An("z.compile: async .superRefine() / check functions are not supported");let o=r._zod.check,a=Ss(t,u=>{let l={value:u,issues:[],addIssue:Ck};return o(l)instanceof Promise&&Ek(),l.issues.length===0?l.value:$r}),c=re(t);return e.write(`const ${c} = ${a}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new Te("custom check without a predicate or check function")}var VG=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function SC(e,t,r,i,n=!0){let o=r.format;if(o==="base64"){let u=se(t,Dl);return e.write(`if (!${u}(${i})) return INVALID;`),i}if(o==="base64url"){let u=se(t,_h);return e.write(`if (!${u}(${i})) return INVALID;`),i}if(o==="jwt"){let u=se(t,Th),l=se(t,r.alg??null);return e.write(`if (!${u}(${i}, ${l})) return INVALID;`),i}if(o==="ipv6"){let u=se(t,jl);return e.write(`if (!${u}(${i})) return INVALID;`),i}if(o==="cidrv6"){let u=se(t,yh);return e.write(`if (!${u}(${i})) return INVALID;`),i}if(o==="credit_card"){let u=se(t,Sh);return e.write(`if (!${u}(${i})) return INVALID;`),i}if(o==="iban"){let u=se(t,Ih);return e.write(`if (!${u}(${i})) return INVALID;`),i}let s=r;if(o==="url"||o==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=se(t,rh),l=se(t,r),d=re(t),f=re(t);if(e.write(`const ${d} = ${i}.trim();`),e.write(`const ${f} = ${u}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),s.hostname!==void 0){let h=se(t,nh);e.write(`if (!${h}(${f}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let h=se(t,ih);e.write(`if (!${h}(${f}, ${l}.protocol)) return INVALID;`)}if(!n)return null;let p=re(t),m=s.normalize?`${f}.href`:`${se(t,zl)}(${d})`;return e.write(`const ${p} = ${m};`),p}let a=r.fn;if(a){if(xs(a))throw new Te(`async string format ${o}`);let u=se(t,a);return e.write(`if (!${u}(${i})) return INVALID;`),i}if(VG.has(o)&&r.pattern){let u=se(t,r.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${i})) return INVALID;`),i}let c=r.format;switch(c){case"regex":throw new Te("regex format without a pattern");case"lowercase":e.write(`if (${i} !== ${i}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${i} !== ${i}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${i}.includes(${yr(r.includes)})) return INVALID;`);break;case"starts_with":{let u=r.prefix;e.write(`if (${i}.slice(0, ${u.length}) !== ${yr(u)}) return INVALID;`);break}case"ends_with":{let u=r.suffix;e.write(`if (${i}.slice(-${u.length}) !== ${yr(u)}) return INVALID;`);break}default:throw new Te(`string format ${c}`)}return i}function gt(e,t,r,i,n=!0){let o=r._zod.def,s=o.type;if(o.coerce)throw new Te(`coercion (z.coerce.${s}())`);let a=n||!!o.checks?.length,c;switch(s){case"string":c=BG(e,t,r,i,a);break;case"number":c=KG(e,r,i);break;case"boolean":c=GG(e,i);break;case"bigint":c=WG(e,r,i);break;case"symbol":c=JG(e,i);break;case"undefined":c=HG(e,i);break;case"null":c=YG(e,i);break;case"any":case"unknown":c=i;break;case"never":e.write("return INVALID;"),c=i;break;case"void":c=XG(e,i);break;case"nan":c=QG(e,i);break;case"date":c=eW(e,i);break;case"object":c=tW(e,t,r,i,a);break;case"optional":c=rW(e,t,r,i,a);break;case"nullable":c=oW(e,t,r,i,a);break;case"array":c=sW(e,t,r,i,a);break;case"literal":c=aW(e,t,r,i);break;case"enum":c=cW(e,t,r,i);break;case"readonly":{let u=$C(e,t,r,i),l=re(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":$C(e,t,r,i),c="true";break;case"default":case"prefault":c=uW(e,t,r,i);break;case"nonoptional":c=lW(e,t,r,i);break;case"tuple":c=dW(e,t,r,i);break;case"union":c=fW(e,t,r,i);break;case"intersection":c=hW(e,t,r,i);break;case"record":c=gW(e,t,r,i);break;case"map":c=vW(e,t,r,i);break;case"set":c=$W(e,t,r,i);break;case"file":c=bW(e,i);break;case"template_literal":c=_W(e,t,r,i);break;case"lazy":c=wW(e,t,r,i);break;case"pipe":c=kW(e,t,r,i);break;case"custom":c=SW(e,t,r,i);break;case"transform":c=PW(e,t,r,i);break;case"catch":c=IW(e,t,r,i);break;default:throw new Te(`schema type ${s}`)}return c===null?null:CG(e,t,r,c)}function BG(e,t,r,i,n=!0){e.write(`if (typeof ${i} !== "string") return INVALID;`);let o=r._zod.def;return o.format===void 0?i:SC(e,t,o,i,n)}function KG(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let i=t._zod.def;return i.check==="number_format"&&i.format&&kC(e,{format:i.format},r),r}function GG(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function WG(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let i=t._zod.def;if(i.format)switch(i.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function JG(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function HG(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function YG(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function XG(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function QG(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function eW(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function tW(e,t,r,i,n=!0){let o=r._zod.def;e.write(`if (typeof ${i} !== "object" || ${i} === null || Array.isArray(${i})) return INVALID;`);let s=o.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=v=>typeof v=="symbol"?se(t,v):yr(v),d=v=>typeof v=="symbol"?`[${l(v)}]`:yr(v),f=s;if(a.includes("__proto__"))throw new Te('object shape key "__proto__"');let p=new Map;for(let v of u){let $=f[v],_=l(v),w=re(t);if(e.write(`const ${w} = ${i}[${_}];`),$._zod.optin!==void 0){let k=re(t);e.write(`let ${k} = (() => {`),e.indented(T=>{let C=rr(T,t,$,w);T.write(`return ${C};`)}),e.write("})();"),$._zod.optout==="optional"?(e.write(`if (${k} === INVALID) {`),e.indented(T=>{T.write(`if (${_} in ${i}) return INVALID;`),T.write(`${k} = undefined;`)}),e.write("}")):e.write(`if (${k} === INVALID) return INVALID;`),p.set(v,k)}else{iW($)&&e.write(`if (!(${_} in ${i})) return INVALID;`);let k=rr(e,t,$,w,n);k!==null&&p.set(v,k)}}let m=o.catchall,h="none";if(m){let v=m._zod.def.type;if(v==="never"){let $=a.map(_=>`k !== ${yr(_)}`).join(" && ")||"true";e.write(`for (const k in ${i}) {`),e.indented(_=>{_.write(`if (${$}) return INVALID;`)}),e.write("}")}else(v==="unknown"||v==="any")&&!m._zod.def.checks?.length?h="passthrough":h="schema"}let g=re(t),y=u.some(v=>vC(f[v])||Ok(f[v]));if(!n){if(h==="schema"){let v=a.length>0?se(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented($=>{$.write('if (k === "__proto__") continue;'),v&&$.write(`if (${v}.has(k)) continue;`);let _=re(t);$.write(`const ${_} = ${i}[k];`),rr($,t,m,_,!1)}),e.write("}")}return null}if(y){e.write(`const ${g} = {};`);for(let v of u){let $=l(v),_=p.get(v);Ok(f[v])?e.write(`if (${$} in ${i}) ${g}[${$}] = ${_};`):vC(f[v])?e.write(`if (${_} !== undefined || ${$} in ${i}) ${g}[${$}] = ${_};`):e.write(`${g}[${$}] = ${_};`)}}else{let v=u.map($=>`${d($)}: ${p.get($)}`).join(", ");e.write(`const ${g} = { ${v} };`)}if(h!=="none"){let v=a.length>0?se(t,new Set(a)):null;e.write(`for (const k in ${i}) {`),e.indented($=>{if($.write('if (k === "__proto__") continue;'),v&&$.write(`if (${v}.has(k)) continue;`),h==="passthrough")$.write(`${g}[k] = ${i}[k];`);else{let _=re(t);$.write(`const ${_} = ${i}[k];`);let w=rr($,t,m,_);$.write(`${g}[k] = ${w};`)}}),e.write("}")}return g}function rW(e,t,r,i,n=!0){let o=r._zod.def;if(nW(r))return gt(e,t,o.innerType,i,n);if(o.innerType._zod.optin==="defaulted"){let a=re(t),c=re(t);return e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let d=gt(l,t,o.innerType,i);l.write(`return ${d};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=gt(u,t,o.innerType,i);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=n?re(t):null;return s&&e.write(`let ${s};`),e.write(`if (${i} !== undefined) {`),e.indented(a=>{let c=gt(a,t,o.innerType,i,n);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function nW(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function iW(e){return e._zod.optin===void 0&&ks(e)}function ks(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?ks(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?ks(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(ks):!0;case"intersection":return!t.left||!t.right?!0:ks(t.left)&&ks(t.right);case"pipe":return t.in?ks(t.in):!0;default:return!0}}function Ok(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function vC(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&nc(e)}function nc(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?nc(t.innerType):!0;case"union":return t.options?t.options.some(nc):!0;case"intersection":return!t.left||!t.right||nc(t.left)||nc(t.right);case"pipe":return t.out?nc(t.out):!0;default:return!0}}function oW(e,t,r,i,n=!0){let o=r._zod.def,s=n?re(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${i} !== null) {`),e.indented(a=>{let c=gt(a,t,o.innerType,i,n);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function sW(e,t,r,i,n=!0){let o=r._zod.def;e.write(`if (!Array.isArray(${i})) return INVALID;`);let s=n?re(t):null,a=re(t),c=re(t);return s&&e.write(`const ${s} = new Array(${i}.length);`),e.write(`for (let ${a} = 0; ${a} < ${i}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${i}[${a}];`);let l=rr(u,t,o.element,c,n);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function aW(e,t,r,i){let o=r._zod.def.values;if(o.length!==1){let a=se(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}let s=o[0];if(typeof s=="number"&&Number.isNaN(s)){let a=se(t,new Set(o));return e.write(`if (!${a}.has(${i})) return INVALID;`),i}if(typeof s=="string")e.write(`if (${i} !== ${yr(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${i} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${i} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${i} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${i} !== ${s}n) return INVALID;`);else throw new Te(`literal type ${typeof s}`);return i}function cW(e,t,r,i){let n=r._zod.values;if(!n)throw new Te("enum schema without enumerated values");let o=se(t,n);return e.write(`if (!${o}.has(${i})) return INVALID;`),i}function $C(e,t,r,i){let n=r._zod.def;return gt(e,t,n.innerType,i)}function uW(e,t,r,i){let n=r._zod.def,s=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!s)return gt(e,t,n.innerType,i);let c=se(t,s),u=re(t);return e.write(`let ${u} = ${i};`),e.write(`if (${i} === undefined) ${u} = ${c}();`),gt(e,t,n.innerType,u)}let a=re(t);if(s){let c=se(t,s),u=se(t,Ma);e.write(`let ${a};`),e.write(`if (${i} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let d=gt(l,t,n.innerType,i);l.write(`${a} = ${d} === undefined ? ${u}(${c}()) : ${d};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${i} !== undefined) {`),e.indented(c=>{let u=gt(c,t,n.innerType,i);c.write(`${a} = ${u};`)}),e.write("}");return a}function lW(e,t,r,i){let n=r._zod.def,o=gt(e,t,n.innerType,i),s=re(t);return e.write(`const ${s} = ${o};`),e.write(`if (${s} === undefined) return INVALID;`),s}function dW(e,t,r,i){let n=r._zod.def,o=n.items,s=n.rest;e.write(`if (!Array.isArray(${i})) return INVALID;`);let a=bC(o,"optin"),c=bC(o,"optout");s?e.write(`if (${i}.length < ${a}) return INVALID;`):e.write(`if (${i}.length < ${a} || ${i}.length > ${o.length}) return INVALID;`);let u=re(t);e.write(`const ${u} = [];`);for(let l=0;l<o.length;l++){let d=o[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${i}.length) {`),f.indented(p=>{let m=re(t);p.write(`const ${m} = ${i}[${l}];`);let h=rr(p,t,d,m);p.write(`${u}[${l}] = ${h};`)}),f.write("} else {"),f.indented(p=>{if(Ok(d)){p.write(`${u}.length = ${l};`);return}let m=re(t),h=re(t);p.write(`const ${m} = undefined;`),p.write(`const ${h} = (() => {`),p.indented(g=>{let y=rr(g,t,d,m);g.write(`return ${y};`)}),p.write("})();"),p.write(`if (${h} === INVALID || ${h} === undefined) ${u}.length = ${l};`),p.write(`else ${u}[${l}] = ${h};`)}),f.write("}")}),e.write("}");else{let f=re(t);e.write(`const ${f} = ${i}[${l}];`);let p=rr(e,t,d,f);e.write(`${u}[${l}] = ${p};`)}}if(s){let l=re(t),d=re(t);e.write(`for (let ${l} = ${o.length}; ${l} < ${i}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${i}[${l}];`);let p=rr(f,t,s,d);f.write(`${u}[${l}] = ${p};`)}),e.write("}")}return u}function bC(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function fW(e,t,r,i){let n=r._zod.def,o=n.options;if(n.discriminator)return pW(e,t,n,i);if(n.inclusive===!1)throw new Te("exclusive unions (z.xor)");if(o.length===0)return e.write("return INVALID;"),i;if(o.length===1)return gt(e,t,o[0],i);if(o.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(o.flatMap(l=>l._zod.def.values)),u=se(t,c);return e.write(`if (!${u}.has(${i})) return INVALID;`),i}let a=re(t);e.write(`let ${a};`);for(let c=0;c<o.length;c++){let u=o[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let d=gt(l,t,u,i);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function pW(e,t,r,i){if(r.unionFallback)throw new Te("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),i;let n=re(t),o=re(t);e.write(`const ${n} = ${i}?.[${yr(r.discriminator)}];`),e.write(`let ${o};`);let s=!0,a=new Set;for(let c of r.options){let u=c._zod.propValues?.[r.discriminator];if(!u||u.size===0)throw new Te("discriminated union option without static discriminator values");for(let f of u){if(a.has(f))throw new Te(`duplicate discriminator value ${String(f)}`);a.add(f)}let l=Array.from(u,f=>mW(t,n,f)),d=s?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{let p=gt(f,t,c,i);f.write(`${o} = ${p};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),o}function mW(e,t,r){if(typeof r=="string")return`${t} === ${yr(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let i=se(e,r);return`${t} === ${i}`}throw new Te(`literal discriminator value ${String(r)}`)}function hW(e,t,r,i){let n=r._zod.def;t.definite=!1;let o=rr(e,t,n.left,i),s=rr(e,t,n.right,i),a=se(t,Ja),c=re(t);return e.write(`const ${c} = ${a}(${o}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function gW(e,t,r,i){let n=r._zod.def,o=se(t,ln);e.write(`if (!${o}(${i})) return INVALID;`);let s=re(t),a=re(t),c=re(t);e.write(`const ${s} = {};`);let u=n,l=u.partial?void 0:n.keyType._zod.values;if(l){let p=[];for(let h of l){if(!(typeof h=="string"||typeof h=="number"||typeof h=="symbol"))throw new Te(`record key value ${String(h)}`);let g=typeof h=="number"?h.toString():h;if(g==="__proto__")throw new Te('record key "__proto__"');p.push(g);let y=se(t,h),v=gt(e,t,n.keyType,y),$=re(t);e.write(`const ${$} = ${i}[${yW(t,g)}];`);let _=rr(e,t,n.valueType,$);e.write(`${s}[${v}] = ${_};`)}let m=se(t,new Set(p));return e.write(`for (const ${a} in ${i}) {`),e.indented(h=>{h.write(`if (${m}.has(${a})) continue;`),u.mode==="loose"?h.write(`if (${a} !== "__proto__") ${s}[${a}] = ${i}[${a}];`):h.write("return INVALID;")}),e.write("}"),s}let d=n.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let p=n.mode==="loose",m=Sg(n.keyType);m.definite===!1&&(t.definite=!1);let h=se(t,m),g=se(t,Pi),y=re(t);return _C(e,t,i,a,v=>{v.write(`let ${y} = ${h}(${a});`),v.write(`if (${y} === INVALID && typeof ${a} === "string" && ${g}.test(${a})) ${y} = ${h}(Number(${a}));`),p?v.write(`if (${y} === INVALID) { ${s}[${a}] = ${i}[${a}]; continue; }`):v.write(`if (${y} === INVALID) return INVALID;`),v.write(`if (${y} === "__proto__") continue;`);let $=re(t);v.write(`const ${$} = ${i}[${a}];`);let _=rr(v,t,n.valueType,$);v.write(`${s}[${y}] = ${_};`)}),s}return _C(e,t,i,a,p=>{p.write(`const ${c} = ${i}[${a}];`);let m=rr(p,t,n.valueType,c);p.write(`${s}[${a}] = ${m};`)},"return INVALID;"),s}function _C(e,t,r,i,n,o){let s=se(t,Object.prototype.propertyIsEnumerable),a=re(t),c=re(t),u=re(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${c} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${i} = ${c}[${u}];`),l.write(`if (${i} === "__proto__" || !${s}.call(${r}, ${i})) continue;`),n(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${i} = ${a}[${u}];`),l.write(`if (!${s}.call(${r}, ${i})) continue;`),o?l.write(o):n(l)}),e.write("}")}function yW(e,t){return typeof t=="string"?yr(t):se(e,t)}function vW(e,t,r,i){let n=r._zod.def;e.write(`if (!(${i} instanceof Map)) return INVALID;`);let o=re(t),s=re(t),a=re(t);return e.write(`const ${o} = new Map();`),e.write(`for (const [${s}, ${a}] of ${i}) {`),e.indented(c=>{let u=gt(c,t,n.keyType,s),l=gt(c,t,n.valueType,a);c.write(`${o}.set(${u}, ${l});`)}),e.write("}"),o}function $W(e,t,r,i){let n=r._zod.def;e.write(`if (!(${i} instanceof Set)) return INVALID;`);let o=re(t),s=re(t);return e.write(`const ${o} = new Set();`),e.write(`for (const ${s} of ${i}) {`),e.indented(a=>{let c=gt(a,t,n.valueType,s);a.write(`${o}.add(${c});`)}),e.write("}"),o}function bW(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function _W(e,t,r,i){e.write(`if (typeof ${i} !== "string") return INVALID;`);let n=r._zod.pattern;if(n){let o=se(t,n);e.write(`${o}.lastIndex = 0;`),e.write(`if (!${o}.test(${i})) return INVALID;`)}return i}function wW(e,t,r,i){let n=r._zod.def,o=Ss(t,n.getter),s=se(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${o}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=re(t);return e.write(`const ${a} = ${s}.parser(${i});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function kW(e,t,r,i){let n=r._zod.def,o=gt(e,t,n.in,i);if(n.transform){if(xs(n.transform))throw new An("z.compile: async transforms in pipes are not supported");let s=n.transform,c=Ss(t,l=>{let d={value:l,issues:[],addIssue:Ck},f=s(l,d);return f instanceof Promise?$r:d.issues.length===0?f:$r}),u=re(t);return e.write(`const ${u} = ${c}(${o});`),e.write(`if (${u} === INVALID) return INVALID;`),gt(e,t,n.out,u)}else return gt(e,t,n.out,o)}function xs(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function SW(e,t,r,i){let n=r._zod.def;if(n.fn){if(xs(n.fn))throw new An("z.compile: async custom predicates are not supported");let o=Ss(t,n.fn),s=se(t,Ek),a=re(t);e.write(`const ${a} = ${o}(${i});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new Te("custom schema without a predicate function");return i}function xW(e,t,r){let i=e._zod.run({value:r,issues:[]},{});if(i&&typeof i.then=="function")return $r;let n=i;return n.issues.length===0?n.value:t()}function IW(e,t,r,i){let n=r._zod.def;if(!n.catchValue[Om])throw new Te("catch with a callback (only a constant catch value compiles)",!1);let o=re(t);e.write(`let ${o} = (() => {`),e.indented(u=>{let l=rr(u,t,n.innerType,i);u.write(`return ${l};`)}),e.write("})();");let s=se(t,n.innerType),a=Ss(t,n.catchValue),c=se(t,xW);return e.write(`if (${o} === INVALID) {`),e.indented(u=>{u.write(`${o} = ${c}(${s}, ${a}, ${i});`),u.write(`if (${o} === INVALID) return INVALID;`)}),e.write("}"),o}function PW(e,t,r,i){let n=r._zod.def;if(n.transform){if(xs(n.transform))throw new An("z.compile: async transforms are not supported");let o=n.transform,a=Ss(t,u=>{let l={value:u,issues:[],addIssue:Ck},d=o(u,l);return d instanceof Promise?$r:l.issues.length===0?d:$r}),c=re(t);return e.write(`const ${c} = ${a}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return i}function xg(e){return e.checks&&(e.checks=[...e.checks]),e}function Ig(e,t){return new e(xg({type:"string",...j(t)}))}function zk(e,t){return new e(xg({type:"string",coerce:!0,...j(t)}))}function Wl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...j(t)})}function Jl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...j(t)})}function Hl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...j(t)})}function Yl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...j(t)})}function Xl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...j(t)})}function Ql(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...j(t)})}function ic(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...j(t)})}function ed(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...j(t)})}function td(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...j(t)})}function rd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...j(t)})}function nd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...j(t)})}function id(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...j(t)})}function od(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...j(t)})}function sd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...j(t)})}function ad(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...j(t)})}function cd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...j(t)})}function Pg(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...j(t)})}function ud(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...j(t)})}function ld(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...j(t)})}function dd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...j(t)})}function fd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...j(t)})}function pd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...j(t)})}function Tg(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...j(t)})}function Ag(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...j(t)})}function md(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...j(t)})}var jk={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function hd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...j(t)})}function gd(e,t){return new e({type:"string",format:"date",check:"string_format",...j(t)})}function yd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...j(t)})}function vd(e,t){return new e({type:"string",format:"duration",check:"string_format",...j(t)})}function Rg(e,t){return new e(xg({type:"number",checks:[],...j(t)}))}function Dk(e,t){return new e(xg({type:"number",coerce:!0,checks:[],...j(t)}))}function Eg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...j(t)})}function Og(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...j(t)})}function Ng(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...j(t)})}function Cg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...j(t)})}function zg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...j(t)})}function jg(e,t){return new e({type:"boolean",...j(t)})}function Mk(e,t){return new e({type:"boolean",coerce:!0,...j(t)})}function Dg(e,t){return new e({type:"bigint",...j(t)})}function Lk(e,t){return new e({type:"bigint",coerce:!0,...j(t)})}function Mg(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...j(t)})}function Lg(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...j(t)})}function Ug(e,t){return new e({type:"symbol",...j(t)})}function qg(e,t){return new e({type:"undefined",...j(t)})}function Fg(e,t){return new e({type:"null",...j(t)})}function Zg(e){return new e({type:"any"})}function Vg(e){return new e({type:"unknown"})}function Bg(e,t){return new e({type:"never",...j(t)})}function Kg(e,t){return new e({type:"void",...j(t)})}function Gg(e,t){return new e({type:"date",...j(t)})}function Uk(e,t){return new e({type:"date",coerce:!0,...j(t)})}function Wg(e,t){return new e({type:"nan",...j(t)})}function ei(e,t){return new Km({check:"less_than",...j(t),value:e,inclusive:!1})}function Qr(e,t){return new Km({check:"less_than",...j(t),value:e,inclusive:!0})}function ti(e,t){return new Gm({check:"greater_than",...j(t),value:e,inclusive:!1})}function en(e,t){return new Gm({check:"greater_than",...j(t),value:e,inclusive:!0})}function Jg(e){return ti(0,e)}function Hg(e){return ei(0,e)}function Yg(e){return Qr(0,e)}function Xg(e){return en(0,e)}function no(e,t){return new Hw({check:"multiple_of",...j(t),value:e})}function io(e,t){return new Qw({check:"max_size",...j(t),maximum:e})}function ri(e,t){return new ek({check:"min_size",...j(t),minimum:e})}function Is(e,t){return new tk({check:"size_equals",...j(t),size:e})}function Ps(e,t){return new rk({check:"max_length",...j(t),maximum:e})}function Ti(e,t){return new nk({check:"min_length",...j(t),minimum:e})}function Ts(e,t){return new ik({check:"length_equals",...j(t),length:e})}function oc(e,t){return new ok({check:"string_format",format:"regex",...j(t),pattern:e})}function sc(e){return new sk({check:"string_format",format:"lowercase",...j(e)})}function ac(e){return new ak({check:"string_format",format:"uppercase",...j(e)})}function cc(e,t){return new ck({check:"string_format",format:"includes",...j(t),includes:e})}function uc(e,t){return new uk({check:"string_format",format:"starts_with",...j(t),prefix:e})}function lc(e,t){return new lk({check:"string_format",format:"ends_with",...j(t),suffix:e})}function Qg(e,t,r){return new dk({check:"property",property:e,schema:t,...j(r)})}function dc(e,t){return new fk({check:"properties",shape:e,...j(t)})}function fc(e,t){return new pk({check:"mime_type",mime:e,...j(t)})}function Rn(e){return new mk({check:"overwrite",tx:e})}function pc(e){return Rn(t=>t.normalize(e))}function mc(){return Rn(e=>e.trim())}function hc(){return Rn(e=>e.toLowerCase())}function gc(){return Rn(e=>e.toUpperCase())}function yc(){return Rn(e=>Y_(e))}function qk(e,t,r){return new e({type:"array",element:t,...j(r)})}function TW(e,t,r){return new e({type:"union",options:t,...j(r)})}function AW(e,t,r){return new e({type:"union",options:t,inclusive:!1,...j(r)})}function RW(e,t,r,i){return new e({type:"union",options:r,discriminator:t,...j(i)})}function EW(e,t,r){return new e({type:"intersection",left:t,right:r})}function OW(e,t,r,i){let n=r instanceof ue,o=n?i:r,s=n?r:null;return new e({type:"tuple",items:t,rest:s,...j(o)})}function NW(e,t,r,i){return new e({type:"record",keyType:t,valueType:r,...j(i)})}function CW(e,t,r,i){return new e({type:"map",keyType:t,valueType:r,...j(i)})}function zW(e,t,r){return new e({type:"set",valueType:t,...j(r)})}function jW(e,t,r){let i=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:i,...j(r)})}function DW(e,t,r){return new e({type:"enum",entries:t,...j(r)})}function MW(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...j(r)})}function ey(e,t){return new e({type:"file",...j(t)})}function LW(e,t){return new e({type:"transform",transform:t})}function UW(e,t){return new e({type:"optional",innerType:t})}function qW(e,t){return new e({type:"nullable",innerType:t})}function FW(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Ma(r)}})}function ZW(e,t,r){return new e({type:"nonoptional",innerType:t,...j(r)})}function VW(e,t){return new e({type:"success",innerType:t})}function BW(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:iw(r)})}function KW(e,t,r){return new e({type:"pipe",in:t,out:r})}function GW(e,t){return new e({type:"readonly",innerType:t})}function WW(e,t,r){return new e({type:"template_literal",parts:t,...j(r)})}function JW(e,t){return new e({type:"lazy",getter:t})}function HW(e,t){return new e({type:"promise",innerType:t})}function ty(e,t,r){let i=j(r);return i.abort??(i.abort=!0),new e({type:"custom",check:"custom",fn:t,...i})}function ry(e,t,r){return new e({type:"custom",check:"custom",fn:t,...j(r)})}function ny(e,t){let r=xC(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(La(n,i.value,r._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=i.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),i.issues.push(La(o))}},e(i.value,i)),t);return r}function xC(e,t){let r=new Qe({check:"custom",...j(t)});return r._zod.check=e,r}function iy(e){let t=new Qe({check:"describe"});return t._zod.onattach=[r=>{let i=Bt.get(r)??{};Bt.add(r,{...i,description:e})}],t._zod.check=()=>{},t}function oy(e){let t=new Qe({check:"meta"});return t._zod.onattach=[r=>{let i=Bt.get(r)??{};Bt.add(r,{...i,...e})}],t._zod.check=()=>{},t}function sy(e,t){let r=j(t),i=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(i=i.map(p=>typeof p=="string"?p.toLowerCase():p),n=n.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(i),s=new Set(n),a=e.Codec??Xa,c=e.Boolean??Ha,u=e.String??ro,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new a({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:s.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?i[0]||"true":n[0]||"false"),error:r.error});return f._zod.bag.truthy=i,f._zod.bag.falsy=n,f._zod.bag.case=r.case??"insensitive",f}function oo(e,t,r,i={}){let n=j(i),o={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:a=>r.test(a),...n};return r instanceof RegExp&&(o.pattern=r),new e(o)}function $d(e,...t){for(let r of t)for(let i of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,i)&&Vt(e,i,r[i]);return e}function so(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??Bt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function jt(e,t,r,i,n){let o=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:n}):t.unrepresentable;if(o==="any")return!1;if(o===void 0||o==="throw")throw new Error(n);return Object.assign(r,o),!0}function He(e,t,r={path:[],schemaPath:[]}){var i;let n=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let f=s.schema,p=t.processors[n.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);p(e,t,f,l)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),He(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&$d(s.schema,c),t.io==="input"&&br(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function IC(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ao(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let i=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=i.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,s[0])}}let n=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,f=e.external.uri??(m=>m);if(d)return{ref:f(d)};let p=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${IC(p)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+IC(l)}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=n(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
212
|
+
|
|
213
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}a.count>1&&e.reused==="ref"&&o(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function AC(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let i of t){if(!i||typeof i!="object")return;AC(i);let n=Object.keys(i);if(n.length!==1||n[0]!=="type")return;let o=i.type;for(let s of Array.isArray(o)?o:[o]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var RC=new Set(["type","properties","required","additionalProperties"]),PC=["oneOf","anyOf"];function TC(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Fk(e){let t=[];for(let o of e){if(typeof o!="object"||o.type!=="object")return null;for(let s in o)if(!RC.has(s))return null;t.push(o)}let r={},i=new Set;for(let o of t){for(let s in o.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??TC(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:Fk(a)??{allOf:a};Vt(r,s,c)}for(let s of o.required??[])i.add(s)}let n={type:"object",properties:r};if(i.size&&(n.required=[...i]),t.every(o=>o.additionalProperties===!1))n.additionalProperties=!1;else{let o=[];for(let s of t){let a=TC(s);a&&!o.some(c=>JSON.stringify(c)===JSON.stringify(a))&&o.push(a)}o.length===1?n.additionalProperties=o[0]:o.length>1&&(n.additionalProperties={allOf:o})}return n}function YW(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of RC)if(n in e)return;let r=t.filter(n=>PC.some(o=>Array.isArray(n[o]))),i=null;if(!r.length)i=Fk(t);else{let n=r[0],o=PC.find(c=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let s=t.filter(c=>c!==n),a=n[o].map(c=>Fk([...s,c]));if(a.some(c=>!c))return;i={[o]:a}}i&&(delete e.allOf,$d(e,i))}function co(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){i(d);let p=e.seen.get(d),m=p.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):$d(u,m),$d(u,l),a._zod.parent===d)for(let g in u)g==="$ref"||g==="allOf"||g in l||delete u[g];if(m.$ref&&p.def)for(let g in u)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(u[g])===JSON.stringify(p.def[g])&&delete u[g]}let f=a._zod.parent;if(f&&f!==d){i(f);let p=e.seen.get(f);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let m in u)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(u[m])===JSON.stringify(p.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())i(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())AC(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])YW(u)}}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)}$d(n,r.defId?r.schema:r.def??r.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&n.id===o&&delete n.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,Vt(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?n.$defs=s:n.definitions=s);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:vc(t,"input",e.processors),output:vc(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function br(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return br(i.element,r);if(i.type==="set")return br(i.valueType,r);if(i.type==="lazy")return br(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return br(i.innerType,r);if(i.type==="intersection")return br(i.left,r)||br(i.right,r);if(i.type==="record"||i.type==="map")return br(i.keyType,r)||br(i.valueType,r);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:br(i.in,r)||br(i.out,r);if(i.type==="object"){for(let n in i.shape)if(br(i.shape[n],r))return!0;return!1}if(i.type==="union"){for(let n of i.options)if(br(n,r))return!0;return!1}if(i.type==="tuple"){for(let n of i.items)if(br(n,r))return!0;return!!(i.rest&&br(i.rest,r))}return!1}var Zk=(e,t={})=>r=>{let i=so({...r,processors:t});return He(e,i),ao(i,e),co(i,e)},vc=(e,t,r={})=>i=>{let{libraryOptions:n,target:o}=i??{},s=so({...n??{},target:o,io:t,processors:r});return He(e,s),ao(s,e),co(s,e)};var $c=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},bc=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},EC=(e,t)=>{$c(e,"minimum",t),bc(e,"maximum",t)},zC=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},jC=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},DC=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},MC=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},OC=(e,t)=>$c(e,"minimum",t.minimum),NC=(e,t)=>bc(e,"maximum",t.maximum),CC=e=>(t,r)=>{MC(t,r.format);let[i,n]=e[r.format];$c(t,"minimum",i),bc(t,"maximum",n)},XW={greater_than:(e,t)=>$c(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>bc(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>zC(e,t.value),number_format:CC(kl),bigint_format:CC(Sl),min_length:OC,max_length:NC,length_equals:(e,t)=>EC(e,t.length),min_size:OC,max_size:NC,size_equals:(e,t)=>EC(e,t.size),string_format:(e,t)=>{MC(e,t.format),t.pattern&&jC(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>DC(e,t.mime)};function Dt(e){let t={},r=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let o of i)XW[o._zod.def.check]?.(t,o._zod.def);let n=e._zod.bag;n.minimum!==void 0&&$c(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&$c(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&bc(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&bc(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&zC(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&DC(t,n.mime);for(let o of n.patterns??[])jC(t,o);return t}var QW={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},eJ=new Map([[$h,Rw],[Ml,Ew]]),LC=e=>eJ.get(e)??e,Kk=(e,t,r,i)=>{let n=r;n.type="string";let{minimum:o,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=Dt(e);if(typeof o=="number"&&(n.minLength=o),typeof s=="number"&&(n.maxLength=s),a&&(n.format=QW[a]??a,n.format===""&&delete n.format,(a==="time"||l)&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let d=[...c].map(LC);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Gk=(e,t,r,i)=>{let n=r,{minimum:o,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Dt(e);n.type=l?"integer":"number";let d=typeof u=="number"&&u>=(o??Number.NEGATIVE_INFINITY),f=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d?p?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof o=="number"&&(n.minimum=o),f?p?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:typeof s=="number"&&(n.maximum=s),a){let m=new Set;for(let y of a)Number.isFinite(y)&&y!==0?m.add(Math.abs(y)):jt(e,t,n,i,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[h,...g]=m;h!==void 0&&(n.multipleOf=h),g.length&&(n.allOf=[...n.allOf??[],...g.map(y=>({multipleOf:y}))])}},Wk=(e,t,r,i)=>{r.type="boolean"},Jk=(e,t,r,i)=>{jt(e,t,r,i,"BigInt cannot be represented in JSON Schema")},Hk=(e,t,r,i)=>{jt(e,t,r,i,"Symbols cannot be represented in JSON Schema")},Yk=(e,t,r,i)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Xk=(e,t,r,i)=>{jt(e,t,r,i,"Undefined cannot be represented in JSON Schema")},Qk=(e,t,r,i)=>{jt(e,t,r,i,"Void cannot be represented in JSON Schema")},eS=(e,t,r,i)=>{r.not={}},tS=(e,t,r,i)=>{},rS=(e,t,r,i)=>{},nS=(e,t,r,i)=>{jt(e,t,r,i,"Date cannot be represented in JSON Schema")},iS=(e,t,r,i)=>{let n=e._zod.def,o=Ca(n.entries);if(o.length===0){r.not={};return}o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},oS=(e,t,r,i)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let o=[];for(let s of n.values)if(s===void 0){if(jt(e,t,r,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(jt(e,t,r,i,"BigInt literals cannot be represented in JSON Schema"))return;o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},sS=(e,t,r,i)=>{jt(e,t,r,i,"NaN cannot be represented in JSON Schema")},aS=(e,t,r,i)=>{let n=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=o.source},cS=(e,t,r,i)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:o,maximum:s,mime:a}=Dt(e);o!==void 0&&(n.minLength=o),s!==void 0&&(n.maxLength=s),a&&(a.length===0?n.not={}:a.length===1?n.contentMediaType=a[0]:n.anyOf=a.map(c=>({contentMediaType:c})))},uS=(e,t,r,i)=>{r.type="boolean"},lS=(e,t,r,i)=>{jt(e,t,r,i,"Custom types cannot be represented in JSON Schema")},dS=(e,t,r,i)=>{jt(e,t,r,i,"Function types cannot be represented in JSON Schema")},fS=(e,t,r,i)=>{jt(e,t,r,i,"Transforms cannot be represented in JSON Schema")},pS=(e,t,r,i)=>{jt(e,t,r,i,"Map cannot be represented in JSON Schema")},mS=(e,t,r,i)=>{jt(e,t,r,i,"Set cannot be represented in JSON Schema")},hS=(e,t,r,i)=>{let n=r,o=e._zod.def,{minimum:s,maximum:a}=Dt(e);typeof s=="number"&&(n.minItems=s),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=He(o.element,t,{...i,path:[...i.path,"items"]})};function bd(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?bd(t.out):t.type==="catch"?bd(t.innerType):e._zod.optin}var gS=(e,t,r,i)=>{let n=r,o=e._zod.def,s=o.shape;if(Object.getOwnPropertySymbols(s).length&&jt(e,t,n,i,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in s)Vt(n.properties,u,He(s[u],t,{...i,path:[...i.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=o.shape[u];(t.io==="input"?bd(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(n.required=c),o.catchall?._zod.def.type==="never"?n.additionalProperties=!1:o.catchall?o.catchall&&(n.additionalProperties=He(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},cy=(e,t,r,i)=>{let n=e._zod.def,o=n.inclusive===!1,s=n.options.map((a,c)=>He(a,t,{...i,path:[...i.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=s:r.anyOf=s},yS=(e,t,r,i)=>{let n=e._zod.def,o=He(n.left,t,{...i,path:[...i.path,"allOf",0]}),s=He(n.right,t,{...i,path:[...i.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},vS=(e,t,r,i)=>{let n=r,o=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((h,g)=>He(h,t,{...i,path:[...i.path,s,g]})),u=o.rest?He(o.rest,t,{...i,path:[...i.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null,l=o.items.length;for(;l>0;){let h=o.items[l-1];if(!(t.io==="input"?bd(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=o.items.length,f=!o.rest;t.target==="draft-2020-12"?(n.prefixItems=c,f?n.items=!1:u&&(n.items=u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):t.target==="openapi-3.0"?(n.items={anyOf:c},u&&n.items.anyOf.push(u),l>0&&(n.minItems=l),f&&(n.maxItems=d)):(n.items=c,f?n.additionalItems=!1:u&&(n.additionalItems=u),l>0&&(n.minItems=l),f&&(n.maxItems=d));let{minimum:p,maximum:m}=Dt(e);typeof p=="number"&&(n.minItems=p),typeof m=="number"&&(n.maxItems=m)};function Vk(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let h=Vk(e,m,r);return h===m?t:h}for(let m of["anyOf","oneOf"]){let h=t[m];if(!Array.isArray(h))continue;let g=h.map(y=>Vk(e,y,r));g.some((y,v)=>y!==h[v])&&(t={...t,[m]:g})}let i=Array.isArray(t.type)?t.type:[t.type],n=!i.includes("string")&&i.some(m=>m==="number"||m==="integer"),o=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!o?.some(m=>typeof m=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(m=>typeof m=="number"?String(m):m):typeof p.const=="number"&&(p.const=String(p.const)),n&&(p.type="string",o||(p.pattern=(i.includes("number")?Pi:El).source)),p}var Bk=new WeakMap;function tJ(e){let t=new Map;for(let i of e.seen.values())i.def&&!t.has(i.schema)&&t.set(i.schema,i);let r=new Map;for(let i of Bk.get(e)??[]){let n=e.seen.get(i),o=(n?.def??n?.schema)?.propertyNames;if(!o||o===!0||r.has(o))continue;let s=Vk(t,o,new Set);s!==o&&r.set(o,s)}if(r.size)for(let i of e.seen.values())for(let n of[i.schema,i.def]){let o=n&&r.get(n.propertyNames);o&&(n.propertyNames=o)}}var $S=(e,t,r,i)=>{let n=r,o=e._zod.def;n.type="object";let s=o.keyType,a=Dt(s).patterns;if(o.mode==="loose"&&a&&a.size>0){let l=He(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});n.patternProperties={};for(let d of a)Vt(n.patternProperties,LC(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=He(o.keyType,t,{...i,path:[...i.path,"propertyNames"]});let l=Bk.get(t);l||(l=[],Bk.set(t,l),t.deferred.push(()=>tJ(t))),l.push(e)}n.additionalProperties=He(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&bd(o.valueType)!==void 0;if(c&&!o.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l.map(String))}},bS=(e,t,r,i)=>{let n=e._zod.def,o=He(n.innerType,t,i),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},_S=(e,t,r,i)=>{let n=e._zod.def;He(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType},wS=Symbol();function UC(e,t,r,i,n){let o=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(o=!0,null));return o?(jt(t,r,i,n,"BigInt defaults cannot be represented in JSON Schema"),wS):JSON.parse(s)}var kS=(e,t,r,i)=>{let n=e._zod.def;He(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType;let s=UC(n.defaultValue,e,t,r,i);s!==wS&&(r.default=s)},SS=(e,t,r,i)=>{let n=e._zod.def;He(n.innerType,t,i);let o=t.seen.get(e);if(o.ref=n.innerType,t.io!=="input")return;let s=UC(n.defaultValue,e,t,r,i);s!==wS&&(r._prefault=s)},xS=(e,t,r,i)=>{let n=e._zod.def;He(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{jt(e,t,r,i,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},IS=(e,t,r,i)=>{let n=e._zod.def,o=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?o?n.out:n.in:n.out;He(s,t,i);let a=t.seen.get(e);a.ref=s},PS=(e,t,r,i)=>{let n=e._zod.def;He(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType,r.readOnly=!0},TS=(e,t,r,i)=>{let n=e._zod.def;He(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType},uy=(e,t,r,i)=>{let n=e._zod.def;He(n.innerType,t,i);let o=t.seen.get(e);o.ref=n.innerType},AS=(e,t,r,i)=>{let n=e._zod.innerType;He(n,t,i);let o=t.seen.get(e);o.ref=n},ay={string:Kk,number:Gk,boolean:Wk,bigint:Jk,symbol:Hk,null:Yk,undefined:Xk,void:Qk,never:eS,any:tS,unknown:rS,date:nS,enum:iS,literal:oS,nan:sS,template_literal:aS,file:cS,success:uS,custom:lS,function:dS,transform:fS,map:pS,set:mS,array:hS,object:gS,union:cy,intersection:yS,tuple:vS,record:$S,nullable:bS,nonoptional:_S,default:kS,prefault:SS,catch:xS,pipe:IS,readonly:PS,promise:TS,optional:uy,lazy:AS};function As(e,t){if("_idmap"in e){let i=e,n=so({...t,processors:ay}),o={};for(let c of i._idmap.entries()){let[u,l]=c;He(l,n)}let s={},a={registry:i,uri:t?.uri,defs:o};n.external=a;for(let c of i._idmap.entries()){let[u,l]=c;ao(n,l),Vt(s,u,co(n,l))}if(Object.keys(o).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:o}}return{schemas:s}}let r=so({...t,processors:ay});return He(e,r),ao(r,e),co(r,e)}var ly=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=so({processors:ay,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return He(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,ao(this.ctx,t);let i=co(this.ctx,t),{"~standard":n,...o}=i;return o}};var qC={};var Tc={};Si(Tc,{ZodAny:()=>WS,ZodArray:()=>XS,ZodBase64:()=>Ay,ZodBase64URL:()=>Ry,ZodBigInt:()=>Ic,ZodBigIntFormat:()=>Ny,ZodBoolean:()=>xc,ZodCIDRv4:()=>Py,ZodCIDRv6:()=>Ty,ZodCUID:()=>by,ZodCUID2:()=>_y,ZodCatch:()=>y0,ZodCodec:()=>Ad,ZodCreditCard:()=>ZS,ZodCustom:()=>Rd,ZodCustomStringFormat:()=>Es,ZodDate:()=>Sd,ZodDefault:()=>d0,ZodDiscriminatedUnion:()=>e0,ZodE164:()=>Ey,ZodEmail:()=>gy,ZodEmoji:()=>vy,ZodEnum:()=>wc,ZodExactOptional:()=>jy,ZodFile:()=>a0,ZodFunction:()=>P0,ZodGUID:()=>yy,ZodIBAN:()=>VS,ZodIPv4:()=>xy,ZodIPv6:()=>Iy,ZodISODate:()=>lo,ZodISODateTime:()=>uo,ZodISODuration:()=>po,ZodISOTime:()=>fo,ZodInstanceOf:()=>R0,ZodIntersection:()=>t0,ZodJWT:()=>Oy,ZodKSUID:()=>Sy,ZodLazy:()=>S0,ZodLiteral:()=>s0,ZodMAC:()=>FS,ZodMap:()=>i0,ZodNaN:()=>$0,ZodNanoID:()=>$y,ZodNever:()=>HS,ZodNonOptional:()=>Dy,ZodNull:()=>GS,ZodNullable:()=>l0,ZodNumber:()=>Sc,ZodNumberFormat:()=>Os,ZodObject:()=>xd,ZodOptional:()=>Ns,ZodPipe:()=>Td,ZodPrefault:()=>p0,ZodPreprocess:()=>b0,ZodPromise:()=>I0,ZodReadonly:()=>_0,ZodRecord:()=>_c,ZodSet:()=>o0,ZodString:()=>kc,ZodStringFormat:()=>tt,ZodSuccess:()=>g0,ZodSymbol:()=>BS,ZodTemplateLiteral:()=>k0,ZodTransform:()=>c0,ZodTuple:()=>r0,ZodType:()=>ge,ZodULID:()=>wy,ZodURL:()=>wd,ZodUUID:()=>ni,ZodUndefined:()=>KS,ZodUnion:()=>Id,ZodUnknown:()=>JS,ZodVoid:()=>YS,ZodXID:()=>ky,ZodXor:()=>QS,_ZodString:()=>hy,_default:()=>f0,_function:()=>Jz,any:()=>Rz,array:()=>ke,base64:()=>lz,base64url:()=>dz,bigint:()=>xz,boolean:()=>Tt,catch:()=>v0,check:()=>Hz,cidrv4:()=>cz,cidrv6:()=>uz,codec:()=>Bz,creditCard:()=>pz,cuid:()=>ez,cuid2:()=>tz,currencyCode:()=>$z,custom:()=>My,date:()=>Oz,describe:()=>Yz,discriminatedUnion:()=>Pd,e164:()=>fz,email:()=>VC,emoji:()=>XC,enum:()=>Gt,exactOptional:()=>u0,file:()=>qz,float32:()=>_z,float64:()=>wz,function:()=>Jz,guid:()=>BC,hash:()=>bz,hex:()=>vz,hostname:()=>yz,httpUrl:()=>YC,iban:()=>mz,instanceof:()=>Qz,int:()=>py,int32:()=>kz,int64:()=>Iz,intersection:()=>Pc,invertCodec:()=>Kz,ipv4:()=>oz,ipv6:()=>az,json:()=>tj,jwt:()=>hz,keyof:()=>Nz,ksuid:()=>iz,lazy:()=>x0,literal:()=>H,looseObject:()=>Kt,looseRecord:()=>Dz,mac:()=>sz,map:()=>Mz,meta:()=>Xz,nan:()=>Vz,nanoid:()=>QC,nativeEnum:()=>Uz,never:()=>Cy,nonoptional:()=>h0,null:()=>kd,nullable:()=>_d,nullish:()=>Fz,number:()=>Ze,object:()=>F,optional:()=>et,partialRecord:()=>jz,pipe:()=>my,prefault:()=>m0,preprocess:()=>Ed,promise:()=>Wz,readonly:()=>w0,record:()=>rt,refine:()=>T0,set:()=>Lz,strictObject:()=>Cz,string:()=>A,stringFormat:()=>gz,stringbool:()=>ej,success:()=>Zz,superRefine:()=>A0,symbol:()=>Tz,templateLiteral:()=>Gz,transform:()=>zy,tuple:()=>n0,uint32:()=>Sz,uint64:()=>Pz,ulid:()=>rz,undefined:()=>Az,union:()=>Ye,unknown:()=>it,url:()=>HC,uuid:()=>KC,uuidv4:()=>GC,uuidv6:()=>WC,uuidv7:()=>JC,void:()=>Ez,xid:()=>nz,xor:()=>zz});var dy={};Si(dy,{endsWith:()=>lc,gt:()=>ti,gte:()=>en,includes:()=>cc,length:()=>Ts,lowercase:()=>sc,lt:()=>ei,lte:()=>Qr,maxLength:()=>Ps,maxSize:()=>io,mime:()=>fc,minLength:()=>Ti,minSize:()=>ri,multipleOf:()=>no,negative:()=>Hg,nonnegative:()=>Xg,nonpositive:()=>Yg,normalize:()=>pc,overwrite:()=>Rn,positive:()=>Jg,properties:()=>dc,property:()=>Qg,regex:()=>oc,size:()=>Is,slugify:()=>yc,startsWith:()=>uc,toLowerCase:()=>hc,toUpperCase:()=>gc,trim:()=>mc,uppercase:()=>ac});var FC=new WeakSet([Object.prototype,Error.prototype]);function fy(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let i=r(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}var ZC=(e,t)=>{lw.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);FC.has(r)||(FC.add(r),fy(r,"format",i=>n=>Al(i,n)),fy(r,"flatten",i=>n=>Tl(i,n)),fy(r,"addIssue",i=>n=>{i.issues.push(n),i.message=JSON.stringify(i.issues,za,2)}),fy(r,"addIssues",i=>n=>{i.issues.push(...n),i.message=JSON.stringify(i.issues,za,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},nJ=x("ZodError",ZC),Cr=x("ZodError",ZC,void 0,{Parent:Error});var RS=Ua(Cr),ES=qa(Cr),OS=Fa(Cr),NS=Va(Cr),CS=Cm(Cr),zS=zm(Cr),jS=jm(Cr),DS=Dm(Cr),MS=Mm(Cr),LS=Lm(Cr),US=Um(Cr),qS=qm(Cr);function oJ(){qt.localeError||xt(vg())}function Rs(){qt.memoizer||xt({memoizer:Kl()})}var ge=x("ZodType",(e,t)=>(oJ(),ue.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(R.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(T0(e,t))},superRefine(e,t){return this.check(A0(e,t))},overwrite(e){return this.check(Rn(e))},optional(){return et(this)},exactOptional(){return u0(this)},nullable(){return _d(this)},nullish(){return et(_d(this))},nonoptional(e){return h0(this,e)},array(){return ke(this)},or(e){return Ye([this,e])},and(e){return Pc(this,e)},transform(e){return my(this,zy(e))},default(e){return f0(this,e)},prefault(e){return m0(this,e)},catch(e){return v0(this,e)},pipe(e){return my(this,e)},readonly(){return w0(this)},describe(e){let t=this.clone();return Bt.add(t,{description:e}),t},meta(...e){if(e.length===0)return Bt.get(this);let t=this.clone();return Bt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return R.hide(this,"~standard",{...Xm(this),jsonSchema:{input:vc(this,"input"),output:vc(this,"output")}})},set"~standard"(e){R.own(this,"~standard",e)},parse:function e(t,r){return RS(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await ES(this,t,r,{callee:e})},safeParse(e,t){return OS(this,e,t)},async safeParseAsync(e,t){return NS(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){R.own(this,"spa",e)},validate(e,t){return Ka(this,e,t)},validateAsync(e,t){return Ga(this,e,t)},encode:function e(t,r){return CS(this,t,r,{callee:e})},decode:function e(t,r){return zS(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await jS(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await DS(this,t,r,{callee:e})},safeEncode(e,t){return MS(this,e,t)},safeDecode(e,t){return LS(this,e,t)},async safeEncodeAsync(e,t){return US(this,e,t)},async safeDecodeAsync(e,t){return qS(this,e,t)},toJSONSchema(e){return Zk(this,{})(e)},get description(){return Bt.get(this)?.description},get _def(){return this._zod.def}}),hy=x("_ZodString",(e,t)=>{ro.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Kk(e,r,i,n)},R.derived({format:e=>Dt(e).format??null,minLength:e=>Dt(e).minimum??null,maxLength:e=>Dt(e).maximum??null},{regex(...e){return this.check(oc(...e))},includes(...e){return this.check(cc(...e))},startsWith(...e){return this.check(uc(...e))},endsWith(...e){return this.check(lc(...e))},min(...e){return this.check(Ti(...e))},max(...e){return this.check(Ps(...e))},length(...e){return this.check(Ts(...e))},nonempty(...e){return this.check(Ti(1,...e))},lowercase(e){return this.check(sc(e))},uppercase(e){return this.check(ac(e))},trim(){return this.check(mc())},normalize(...e){return this.check(pc(...e))},toLowerCase(){return this.check(hc())},toUpperCase(){return this.check(gc())},slugify(){return this.check(yc())}})),kc=x("ZodString",(e,t)=>{ro.init(e,t),hy.init(e,t)},{email(e){return this.check(Wl(gy,e))},url(e){return this.check(ic(wd,e))},jwt(e){return this.check(md(Oy,e))},emoji(e){return this.check(ed(vy,e))},guid(e){return this.check(Jl(yy,e))},uuid(e){return this.check(Hl(ni,e))},uuidv4(e){return this.check(Yl(ni,e))},uuidv6(e){return this.check(Xl(ni,e))},uuidv7(e){return this.check(Ql(ni,e))},nanoid(e){return this.check(td($y,e))},cuid(e){return this.check(rd(by,e))},cuid2(e){return this.check(nd(_y,e))},ulid(e){return this.check(id(wy,e))},base64(e){return this.check(dd(Ay,e))},base64url(e){return this.check(fd(Ry,e))},xid(e){return this.check(od(ky,e))},ksuid(e){return this.check(sd(Sy,e))},ipv4(e){return this.check(ad(xy,e))},ipv6(e){return this.check(cd(Iy,e))},cidrv4(e){return this.check(ud(Py,e))},cidrv6(e){return this.check(ld(Ty,e))},e164(e){return this.check(pd(Ey,e))},datetime(e){return this.check(hd(uo,e))},date(e){return this.check(gd(lo,e))},time(e){return this.check(yd(fo,e))},duration(e){return this.check(vd(po,e))}});function A(e){return Ig(kc,e)}var tt=x("ZodStringFormat",(e,t)=>{We.init(e,t),hy.init(e,t)}),uo=x("ZodISODateTime",(e,t)=>{$k.init(e,t),tt.init(e,t)}),lo=x("ZodISODate",(e,t)=>{bk.init(e,t),tt.init(e,t)}),fo=x("ZodISOTime",(e,t)=>{_k.init(e,t),tt.init(e,t)}),po=x("ZodISODuration",(e,t)=>{wk.init(e,t),tt.init(e,t)}),gy=x("ZodEmail",(e,t)=>{th.init(e,t),tt.init(e,t)});function VC(e){return Wl(gy,e)}var yy=x("ZodGUID",(e,t)=>{Qm.init(e,t),tt.init(e,t)});function BC(e){return Jl(yy,e)}var ni=x("ZodUUID",(e,t)=>{eh.init(e,t),tt.init(e,t)});function KC(e){return Hl(ni,e)}function GC(e){return Yl(ni,e)}function WC(e){return Xl(ni,e)}function JC(e){return Ql(ni,e)}var wd=x("ZodURL",(e,t)=>{oh.init(e,t),tt.init(e,t)});function HC(e){return ic(wd,e)}function YC(e){return ic(wd,{protocol:Rl,hostname:Nw,...R.normalizeParams(e)})}var vy=x("ZodEmoji",(e,t)=>{sh.init(e,t),tt.init(e,t)});function XC(e){return ed(vy,e)}var $y=x("ZodNanoID",(e,t)=>{ah.init(e,t),tt.init(e,t)});function QC(e){return td($y,e)}var by=x("ZodCUID",(e,t)=>{ch.init(e,t),tt.init(e,t)});function ez(e){return rd(by,e)}var _y=x("ZodCUID2",(e,t)=>{uh.init(e,t),tt.init(e,t)});function tz(e){return nd(_y,e)}var wy=x("ZodULID",(e,t)=>{lh.init(e,t),tt.init(e,t)});function rz(e){return id(wy,e)}var ky=x("ZodXID",(e,t)=>{dh.init(e,t),tt.init(e,t)});function nz(e){return od(ky,e)}var Sy=x("ZodKSUID",(e,t)=>{fh.init(e,t),tt.init(e,t)});function iz(e){return sd(Sy,e)}var xy=x("ZodIPv4",(e,t)=>{ph.init(e,t),tt.init(e,t)});function oz(e){return ad(xy,e)}var FS=x("ZodMAC",(e,t)=>{hh.init(e,t),tt.init(e,t)});function sz(e){return Pg(FS,e)}var Iy=x("ZodIPv6",(e,t)=>{mh.init(e,t),tt.init(e,t)});function az(e){return cd(Iy,e)}var Py=x("ZodCIDRv4",(e,t)=>{gh.init(e,t),tt.init(e,t)});function cz(e){return ud(Py,e)}var Ty=x("ZodCIDRv6",(e,t)=>{vh.init(e,t),tt.init(e,t)});function uz(e){return ld(Ty,e)}var Ay=x("ZodBase64",(e,t)=>{bh.init(e,t),tt.init(e,t)});function lz(e){return dd(Ay,e)}var Ry=x("ZodBase64URL",(e,t)=>{wh.init(e,t),tt.init(e,t)});function dz(e){return fd(Ry,e)}var Ey=x("ZodE164",(e,t)=>{kh.init(e,t),tt.init(e,t)});function fz(e){return pd(Ey,e)}var ZS=x("ZodCreditCard",(e,t)=>{xh.init(e,t),tt.init(e,t)});function pz(e){return Tg(ZS,e)}var VS=x("ZodIBAN",(e,t)=>{Ph.init(e,t),tt.init(e,t)});function mz(e){return Ag(VS,e)}var Oy=x("ZodJWT",(e,t)=>{Ah.init(e,t),tt.init(e,t)});function hz(e){return md(Oy,e)}var Es=x("ZodCustomStringFormat",(e,t)=>{Rh.init(e,t),tt.init(e,t)});function gz(e,t,r={}){return oo(Es,e,t,r)}function yz(e){return oo(Es,"hostname",Ow,e)}function vz(e){return oo(Es,"hex",Gw,e)}function $z(e){return oo(Es,"currency_code",zw,e)}function bz(e,t){let r=t?.enc??"hex",i=`${e}_${r}`,n=Xr[i];if(!n)throw new Error(`Unrecognized hash format: ${i}`);return oo(Es,i,n,t)}var Sc=x("ZodNumber",(e,t)=>{Ll.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Gk(e,r,i,n),e.isFinite=!0},R.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Dt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Dt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Dt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Dt(e).format??null},{gt(e,t){return this.check(ti(e,t))},gte(e,t){return this.check(en(e,t))},min(e,t){return this.check(en(e,t))},lt(e,t){return this.check(ei(e,t))},lte(e,t){return this.check(Qr(e,t))},max(e,t){return this.check(Qr(e,t))},int(e){return this.check(py(e))},safe(e){return this.check(py(e))},positive(e){return this.check(ti(0,e))},nonnegative(e){return this.check(en(0,e))},negative(e){return this.check(ei(0,e))},nonpositive(e){return this.check(Qr(0,e))},multipleOf(e,t){return this.check(no(e,t))},step(e,t){return this.check(no(e,t))},finite(){return this}}));function Ze(e){return Rg(Sc,e)}var Os=x("ZodNumberFormat",(e,t)=>{Eh.init(e,t),Sc.init(e,t)});function py(e){return Eg(Os,e)}function _z(e){return Og(Os,e)}function wz(e){return Ng(Os,e)}function kz(e){return Cg(Os,e)}function Sz(e){return zg(Os,e)}var xc=x("ZodBoolean",(e,t)=>{Ha.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Wk(e,r,i,n)});function Tt(e){return jg(xc,e)}var Ic=x("ZodBigInt",(e,t)=>{Ul.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Jk(e,r,i,n)},R.derived({minValue:e=>Dt(e).minimum??null,maxValue:e=>Dt(e).maximum??null,format:e=>Dt(e).format??null},{gte(e,t){return this.check(en(e,t))},min(e,t){return this.check(en(e,t))},gt(e,t){return this.check(ti(e,t))},lt(e,t){return this.check(ei(e,t))},lte(e,t){return this.check(Qr(e,t))},max(e,t){return this.check(Qr(e,t))},positive(e){return this.check(ti(BigInt(0),e))},negative(e){return this.check(ei(BigInt(0),e))},nonpositive(e){return this.check(Qr(BigInt(0),e))},nonnegative(e){return this.check(en(BigInt(0),e))},multipleOf(e,t){return this.check(no(e,t))}}));function xz(e){return Dg(Ic,e)}var Ny=x("ZodBigIntFormat",(e,t)=>{Oh.init(e,t),Ic.init(e,t)});function Iz(e){return Mg(Ny,e)}function Pz(e){return Lg(Ny,e)}var BS=x("ZodSymbol",(e,t)=>{Nh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Hk(e,r,i,n)});function Tz(e){return Ug(BS,e)}var KS=x("ZodUndefined",(e,t)=>{Ch.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Xk(e,r,i,n)});function Az(e){return qg(KS,e)}var GS=x("ZodNull",(e,t)=>{zh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Yk(e,r,i,n)});function kd(e){return Fg(GS,e)}var WS=x("ZodAny",(e,t)=>{jh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>tS(e,r,i,n)});function Rz(){return Zg(WS)}var JS=x("ZodUnknown",(e,t)=>{Dh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>rS(e,r,i,n)});function it(){return Vg(JS)}var HS=x("ZodNever",(e,t)=>{Mh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>eS(e,r,i,n)});function Cy(e){return Bg(HS,e)}var YS=x("ZodVoid",(e,t)=>{Lh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>Qk(e,r,i,n)});function Ez(e){return Kg(YS,e)}var Sd=x("ZodDate",(e,t)=>{Uh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>nS(e,r,i,n),e.min=(r,i)=>e.check(en(r,i)),e.max=(r,i)=>e.check(Qr(r,i))},R.derived({minDate:e=>{let{minimum:t}=Dt(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Dt(e);return t?new Date(t):null}},{}));function Oz(e){return Gg(Sd,e)}var XS=x("ZodArray",(e,t)=>{Rs(),qh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>hS(e,r,i,n),e.element=t.element},{min(e,t){return this.check(Ti(e,t))},nonempty(e){return this.check(Ti(1,e))},max(e,t){return this.check(Ps(e,t))},length(e,t){return this.check(Ts(e,t))},unwrap(){return this.element}});function ke(e,t){return qk(XS,e,t)}function Nz(e){let t=e._zod.def.shape;return Gt(Object.keys(t))}var xd=x("ZodObject",(e,t)=>{Rs(),kk.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>gS(e,r,i,n),R.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Gt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(R.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(R.mergeDefs(this._zod.def,{catchall:it()}))},loose(){return this.clone(R.mergeDefs(this._zod.def,{catchall:it()}))},strict(){return this.clone(R.mergeDefs(this._zod.def,{catchall:Cy()}))},strip(){return this.clone(R.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return R.extend(this,e)},safeExtend(e){return R.safeExtend(this,e)},merge(e){return R.merge(this,e)},pick(e){return R.pick(this,e)},omit(e){return R.omit(this,e)},partial(...e){return R.partial(Ns,this,e[0])},exactPartial(...e){return R.partial(jy,this,e[0],"exactPartial")},required(...e){return R.required(Dy,this,e[0])}});function F(e,t){let r={type:"object",shape:e??{},...R.normalizeParams(t)};return new xd(r)}function Cz(e,t){return new xd({type:"object",shape:e,catchall:Cy(),...R.normalizeParams(t)})}function Kt(e,t){return new xd({type:"object",shape:e,catchall:it(),...R.normalizeParams(t)})}var Id=x("ZodUnion",(e,t)=>{Ya.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>cy(e,r,i,n),e.options=t.options});function Ye(e,t){return new Id({type:"union",options:e,...R.normalizeParams(t)})}var QS=x("ZodXor",(e,t)=>{Id.init(e,t),Zh.init(e,t),e._zod.processJSONSchema=(r,i,n)=>cy(e,r,i,n),e.options=t.options});function zz(e,t){return new QS({type:"union",options:e,inclusive:!1,...R.normalizeParams(t)})}var e0=x("ZodDiscriminatedUnion",(e,t)=>{Id.init(e,t),Vh.init(e,t)});function Pd(e,t,r){return new e0({type:"union",options:t,discriminator:e,...R.normalizeParams(r)})}var t0=x("ZodIntersection",(e,t)=>{Bh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>yS(e,r,i,n)});function Pc(e,t){return new t0({type:"intersection",left:e,right:t})}var r0=x("ZodTuple",(e,t)=>{Rs(),ql.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>vS(e,r,i,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Ns({type:"optional",innerType:t}))})}});function n0(e,t,r){let i=t instanceof ue,n=i?r:t,o=i?t:null;return new r0({type:"tuple",items:e,rest:o,...R.normalizeParams(n)})}var _c=x("ZodRecord",(e,t)=>{Rs(),Kh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>$S(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType});function rt(e,t,r){return!t||!t._zod?new _c({type:"record",keyType:A(),valueType:e,...R.normalizeParams(t)}):new _c({type:"record",keyType:e,valueType:t,...R.normalizeParams(r)})}function jz(e,t,r){return new _c({type:"record",keyType:e,valueType:t,...R.normalizeParams(r),partial:!0})}function Dz(e,t,r){return new _c({type:"record",keyType:e,valueType:t,mode:"loose",...R.normalizeParams(r)})}var i0=x("ZodMap",(e,t)=>{Rs(),Gh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>pS(e,r,i,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(ri(...r)),e.nonempty=r=>e.check(ri(1,r)),e.max=(...r)=>e.check(io(...r)),e.size=(...r)=>e.check(Is(...r))});function Mz(e,t,r){return new i0({type:"map",keyType:e,valueType:t,...R.normalizeParams(r)})}var o0=x("ZodSet",(e,t)=>{Rs(),Wh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>mS(e,r,i,n),e.min=(...r)=>e.check(ri(...r)),e.nonempty=r=>e.check(ri(1,r)),e.max=(...r)=>e.check(io(...r)),e.size=(...r)=>e.check(Is(...r))});function Lz(e,t){return new o0({type:"set",valueType:e,...R.normalizeParams(t)})}var wc=x("ZodEnum",(e,t)=>{Jh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(i,n,o)=>iS(e,i,n,o),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(i,n)=>{let o={};for(let s of i)if(r.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new wc({...t,checks:[],...R.normalizeParams(n),entries:o})},e.exclude=(i,n)=>{let o={...t.entries};for(let s of i)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new wc({...t,checks:[],...R.normalizeParams(n),entries:o})}});function Gt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new wc({type:"enum",entries:r,...R.normalizeParams(t)})}function Uz(e,t){return new wc({type:"enum",entries:e,...R.normalizeParams(t)})}var s0=x("ZodLiteral",(e,t)=>{Hh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>oS(e,r,i,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 H(e,t){return new s0({type:"literal",values:Array.isArray(e)?e:[e],...R.normalizeParams(t)})}var a0=x("ZodFile",(e,t)=>{Yh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>cS(e,r,i,n),e.min=(r,i)=>e.check(ri(r,i)),e.max=(r,i)=>e.check(io(r,i)),e.mime=(r,i)=>e.check(fc(Array.isArray(r)?r:[r],i))});function qz(e){return ey(a0,e)}var c0=x("ZodTransform",(e,t)=>{Rs(),Xh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>fS(e,r,i,n),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new to(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(R.issue(o,r.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(R.issue(s))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(o=>(r.value=o,r)):(r.value=n,r)}});function zy(e){return new c0({type:"transform",transform:e})}var Ns=x("ZodOptional",(e,t)=>{Fl.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>uy(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function et(e){return new Ns({type:"optional",innerType:e})}var jy=x("ZodExactOptional",(e,t)=>{Qh.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>uy(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function u0(e){return new jy({type:"optional",innerType:e})}var l0=x("ZodNullable",(e,t)=>{eg.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>bS(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function _d(e){return new l0({type:"nullable",innerType:e})}function Fz(e){return et(_d(e))}var d0=x("ZodDefault",(e,t)=>{tg.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>kS(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function f0(e,t){return new d0({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():R.shallowClone(t)}})}var p0=x("ZodPrefault",(e,t)=>{rg.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>SS(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function m0(e,t){return new p0({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():R.shallowClone(t)}})}var Dy=x("ZodNonOptional",(e,t)=>{ng.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>_S(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function h0(e,t){return new Dy({type:"nonoptional",innerType:e,...R.normalizeParams(t)})}var g0=x("ZodSuccess",(e,t)=>{ig.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>uS(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Zz(e){return new g0({type:"success",innerType:e})}var y0=x("ZodCatch",(e,t)=>{og.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>xS(e,r,i,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function v0(e,t){return new y0({type:"catch",innerType:e,catchValue:typeof t=="function"?t:R.constantCatch(t)})}var $0=x("ZodNaN",(e,t)=>{sg.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>sS(e,r,i,n)});function Vz(e){return Wg($0,e)}var Td=x("ZodPipe",(e,t)=>{Zl.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>IS(e,r,i,n),e.in=t.in,e.out=t.out});function my(e,t){return new Td({type:"pipe",in:e,out:t})}var Ad=x("ZodCodec",(e,t)=>{Td.init(e,t),Xa.init(e,t)});function Bz(e,t,r){return new Ad({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function Kz(e){let t=e._zod.def;return new Ad({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var b0=x("ZodPreprocess",(e,t)=>{Td.init(e,t),xk.init(e,t)}),_0=x("ZodReadonly",(e,t)=>{ag.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>PS(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function w0(e){return new _0({type:"readonly",innerType:e})}var k0=x("ZodTemplateLiteral",(e,t)=>{cg.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>aS(e,r,i,n)});function Gz(e,t){return new k0({type:"template_literal",parts:e,...R.normalizeParams(t)})}var S0=x("ZodLazy",(e,t)=>{Qa.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>AS(e,r,i,n),e.unwrap=()=>e._zod.def.getter()});function x0(e){return new S0({type:"lazy",getter:e})}var I0=x("ZodPromise",(e,t)=>{lg.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>TS(e,r,i,n),e.unwrap=()=>e._zod.def.innerType});function Wz(e){return new I0({type:"promise",innerType:e})}var P0=x("ZodFunction",(e,t)=>{ug.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>dS(e,r,i,n)});function Jz(e){return new P0({type:"function",input:Array.isArray(e?.input)?n0(e?.input):e?.input??ke(it()),output:e?.output??it()})}var Rd=x("ZodCustom",(e,t)=>{dg.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,i,n)=>lS(e,r,i,n)});function Hz(e){let t=new Qe({check:"custom"});return t._zod.check=e,t}function My(e,t){return ty(Rd,e??(()=>!0),t)}function T0(e,t={}){return ry(Rd,e,t)}function A0(e,t){return ny(e,t)}var Yz=iy,Xz=oy,R0=x("ZodInstanceOf",(e,t)=>{Rd.init(e,t)},{properties(e,t){return this.check(dc(e,t))}});function Qz(e,t={}){let r=new R0({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...R.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:r,path:[...r._zod.def.path??[]]})},r}var ej=(...e)=>sy({Codec:Ad,Boolean:xc,String:kc},...e);function tj(e){let t=x0(()=>Ye([A(e),Ze(),Tt(),kd(),ke(t),rt(A(),t)]));return t}function Ed(e,t){return new b0({type:"pipe",in:zy(e),out:t})}var sJ={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"};function aJ(e){xt({customError:e})}function cJ(){return xt().customError}var E0;E0||(E0={});var Cs={};Si(Cs,{ZodISODate:()=>lo,ZodISODateTime:()=>uo,ZodISODuration:()=>po,ZodISOTime:()=>fo,date:()=>lJ,datetime:()=>uJ,duration:()=>fJ,time:()=>dJ});function uJ(e){return hd(uo,e)}function lJ(e){return gd(lo,e)}function dJ(e){return yd(fo,e)}function fJ(e){return vd(po,e)}var q={...Tc,...dy,iso:Cs},pJ=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function mJ(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function rj(e,t){return e.map((r,i)=>i<t?r:r.optional())}function hJ(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function gJ(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===i){let n=r[1]===void 0?void 0:hJ(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function yJ(e,t){return q.transform(i=>i).check(i=>{let n=i.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let o=Object.getOwnPropertyNames(n);if(t.minProperties!==void 0&&o.length<t.minProperties&&i.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:n,inst:e,continue:!0}),t.maxProperties!==void 0&&o.length>t.maxProperties&&i.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:n,inst:e,continue:!0}),t.keySchema)for(let s of o){let a=t.keySchema.safeParse(s);a.success||i.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function O0(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let i=String(e);return`${r[0]}${i.length}:${i}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let o=[];for(let s of e){let a=O0(s,t);if(a===null)return null;o.push(a)}return`a${o.length}:[${o.join(",")}]`}let i=Object.keys(e).sort(),n=[];for(let o of i){let s=O0(e[o],t);if(s===null)return null;n.push(`${o.length}:${o}=${s}`)}return`o${n.length}:{${n.join(",")}}`}finally{t.delete(e)}}var vJ=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),$J=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Od(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Od):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>vJ.has(t)?Od(r):!$J.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Od))}function nj(e){return e===1?"element":"elements"}function bJ(e,t){return q.transform(i=>i).check(i=>{let n=i.value;if(Array.isArray(n)){if(t.uniqueItems===!0){let o=new Map;for(let s=0;s<n.length;s++){let a=O0(n[s],new Set);if(a===null)continue;let c=o.get(a);if(c===void 0){o.set(a,s);continue}i.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:n,path:[s],continue:!0})}}if(t.containsSchema){let o=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of n)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<o&&i.issues.push({code:"custom",message:`Array must contain at least ${o} matching ${nj(o)}; found ${a}`,input:n,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&i.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${nj(t.maxContains)}`,input:n,continue:!0})}}}).pipe(e)}function ij(e,t){if(e!==!1)return e===void 0||e===!0?q.any():_r(e,t)}var _J=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function oj(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return q.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return q.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let o=gJ(n,t),s=_r(o,t);return t.refs.set(n,s),t.processing.delete(n),s}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return q.null();if(n.length===0)return q.never();if(n.length===1)return q.literal(n[0]);if(n.every(s=>typeof s=="string"))return q.enum(n);let o=n.map(s=>q.literal(s));return o.length<2?o[0]:q.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return q.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(o=>{let s={...e,type:o};return oj(s,t)});return n.length===0?q.never():n.length===1?n[0]:q.union(n)}if(!r)return q.any();let i;switch(r){case"string":{let n=q.string();if(e.format){let o=e.format;o==="email"?n=n.check(q.email()):o==="uri"||o==="uri-reference"?n=n.check(q.url()):o==="uuid"||o==="guid"?n=n.check(q.uuid()):o==="date-time"?n=n.check(q.iso.datetime({offset:!0})):o==="date"?n=n.check(q.iso.date()):o==="time"?n=n.check(q.regex(_J)):o==="duration"?n=n.check(q.iso.duration()):o==="hostname"?n=n.check(q.hostname()):o==="ipv4"?n=n.check(q.ipv4()):o==="ipv6"?n=n.check(q.ipv6()):o==="mac"?n=n.check(q.mac()):o==="cidr"?n=n.check(q.cidrv4()):o==="cidr-v6"?n=n.check(q.cidrv6()):o==="base64"?n=n.check(q.base64()):o==="base64url"?n=n.check(q.base64url()):o==="e164"?n=n.check(q.e164()):o==="credit_card"?n=n.check(q.creditCard()):o==="iban"?n=n.check(q.iban()):o==="jwt"?n=n.check(q.jwt()):o==="emoji"?n=n.check(q.emoji()):o==="nanoid"?n=n.check(q.nanoid()):o==="cuid"?n=n.check(q.cuid()):o==="cuid2"?n=n.check(q.cuid2()):o==="ulid"?n=n.check(q.ulid()):o==="xid"?n=n.check(q.xid()):o==="ksuid"&&(n=n.check(q.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),i=n;break}case"number":case"integer":{let n=r==="integer"?q.number().int():q.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),i=n;break}case"boolean":{i=q.boolean();break}case"null":{i=q.null();break}case"object":{let n={},o=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?_r(e.additionalProperties,t):void 0;for(let[d,f]of Object.entries(o)){let p=_r(f,t);Vt(n,d,s.has(d)?p:p.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),p=[];for(let h of f){let g=_r(d[h],t),y=q.string().regex(new RegExp(h));p.push(q.looseRecord(y,g))}let m=[];if(Object.keys(n).length>0&&m.push(q.object(n).passthrough()),m.push(...p),m.length===0)i=q.object({}).passthrough();else if(m.length===1)i=m[0];else{let h=q.intersection(m[0],m[1]);for(let g=2;g<m.length;g++)h=q.intersection(h,m[g]);i=h}if(e.additionalProperties===!1){let h=Object.keys(n),g=f.map(v=>new RegExp(v)),y=i;i=i.check(v=>{if(!ln(v.value))return;let $=[];for(let _ of Object.keys(v.value))h.includes(_)||g.some(w=>w.test(_))||$.push(_);$.length&&v.issues.push({code:"unrecognized_keys",keys:$,input:v.value,inst:y})})}}else{let d=q.object(n);e.additionalProperties===!1?i=d.strict():a?i=d.catchall(a):i=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let d;if(c){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=_r(f,t)}i=yJ(i,{keySchema:d,minProperties:u,maxProperties:l})}break}case"array":{let n=e.prefixItems,o=e.items;if(n&&Array.isArray(n)){let s=typeof e.minItems=="number"?e.minItems:0,a=n.map(d=>_r(d,t)),c=rj(a,s),u=Array.isArray(o)?void 0:ij(o,t),l=q.tuple(c);i=u?l.rest(u):l,typeof e.minItems=="number"&&(i=i.check(q.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(q.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(d=>_r(d,t)),c=rj(a,s),u=ij(e.additionalItems,t),l=q.tuple(c);i=u?l.rest(u):l,typeof e.minItems=="number"&&(i=i.check(q.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(q.maxLength(e.maxItems)))}else if(o!==void 0){let s=_r(o,t),a=q.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),i=a}else i=q.array(q.any());(e.uniqueItems===!0||e.contains!==void 0)&&(i=bJ(i,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?_r(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return i}function _r(e,t){if(typeof e=="boolean")return e?q.any():q.never();let r=oj(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>_r(u,t)),c=q.union(a);r=i?q.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>_r(u,t)),c=q.xor(a);r=i?q.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=i?r:q.any();else{let a=i?r:_r(e.allOf[0],t),c=i?0:1;for(let u=c;u<e.allOf.length;u++)a=q.intersection(a,_r(e.allOf[u],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=q.nullable(r)),e.readOnly===!0&&(r=q.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(n[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(n[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Od(e.propertyNames)&&(n.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(n[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Od(e.contains)&&(n.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(n[a]=e[a])}for(let a of Object.keys(e))pJ.has(a)||Vt(n,a,e[a]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function sj(e,t){if(typeof e=="boolean")return e?q.any():q.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=mJ(r,t?.defaultTarget),n=r.$defs||r.definitions||{},o={version:i,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Bt};return _r(r,o)}var aj=Symbol("z.visit/resolving");function Nd(e,t){let r=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},i=new Map;function n(s){let a=i.get(s);if(a===aj)return new Qa({type:"lazy",getter:()=>i.get(s)});if(a!==void 0)return a;i.set(s,aj);let c=o(s),u=r(c,c!==s);return i.set(s,u),u}function o(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),d=!1,f={};for(let m of l){let h=n(u[m]);h!==u[m]&&(d=!0),f[m]=h}let p=a.catchall;return a.catchall&&(p=n(a.catchall),p!==a.catchall&&(d=!0)),d?Fe(s,{...a,shape:f,catchall:p}):s}case"array":{let u=n(a.element);return u===a.element?s:Fe(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,d=[];for(let p of u){let m=n(p);m!==p&&(l=!0),d.push(m)}let f=a.rest;return a.rest&&(f=n(a.rest),f!==a.rest&&(l=!0)),l?Fe(s,{...a,items:d,rest:f}):s}case"record":case"map":{let u=n(a.keyType),l=n(a.valueType);return u===a.keyType&&l===a.valueType?s:Fe(s,{...a,keyType:u,valueType:l})}case"set":{let u=n(a.valueType);return u===a.valueType?s:Fe(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,d=[];for(let f of u){let p=n(f);p!==f&&(l=!0),d.push(p)}return l?Fe(s,{...a,options:d}):s}case"intersection":{let u=n(a.left),l=n(a.right);return u===a.left&&l===a.right?s:Fe(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=n(a.innerType);return u===a.innerType?s:Fe(s,{...a,innerType:u})}case"pipe":{let u=n(a.in),l=n(a.out);return u===a.in&&l===a.out?s:Fe(s,{...a,in:u,out:l})}case"function":{let u=n(a.input),l=n(a.output);return u===a.input&&l===a.output?s:Fe(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...d}=a;return Fe(s,{...d,getter:()=>n(u())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return s;default:return s}}return n(e)}function cj(e){return Nd(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:Ye(r.options)}})}function wJ(e,t){if(!t?.length)return e;let r=e._zod.def;return Fe(e,un(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function uj(e){return wJ(e.out,e.checks)}function kJ(e){return e.in._zod.traits.has("$ZodTransform")?uj(e):e.in}function lj(e){return Nd(e,{pipe:t=>kJ(t._zod.def),default:(t,r)=>r?et(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function dj(e){return Nd(e,{pipe:t=>uj(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var N0={};Si(N0,{bigint:()=>PJ,boolean:()=>IJ,date:()=>TJ,number:()=>xJ,string:()=>SJ});function SJ(e){return zk(kc,e)}function xJ(e){return Dk(Sc,e)}function IJ(e){return Mk(xc,e)}function PJ(e){return Lk(Ic,e)}function TJ(e){return Uk(Sd,e)}var z0="2025-11-25";var fj=[z0,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],mo="io.modelcontextprotocol/related-task",Uy="2.0",Mt=My(e=>e!==null&&(typeof e=="object"||typeof e=="function")),pj=Ye([A(),Ze().int()]),mj=A(),M$e=Kt({ttl:Ze().optional(),pollInterval:Ze().optional()}),AJ=F({ttl:Ze().optional()}),RJ=F({taskId:A()}),j0=Kt({progressToken:pj.optional(),[mo]:RJ.optional()}),tn=F({_meta:j0.optional()}),Cd=tn.extend({task:AJ.optional()}),hj=e=>Cd.safeParse(e).success,Wt=F({method:A(),params:tn.loose().optional()}),fn=F({_meta:j0.optional()}),pn=F({method:A(),params:fn.loose().optional()}),Jt=Kt({_meta:j0.optional()}),qy=Ye([A(),Ze().int()]),gj=F({jsonrpc:H(Uy),id:qy,...Wt.shape}).strict(),D0=e=>gj.safeParse(e).success,yj=F({jsonrpc:H(Uy),...pn.shape}).strict(),vj=e=>yj.safeParse(e).success,M0=F({jsonrpc:H(Uy),id:qy,result:Jt}).strict(),zd=e=>M0.safeParse(e).success;var ne;(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"})(ne||(ne={}));var L0=F({jsonrpc:H(Uy),id:qy.optional(),error:F({code:Ze().int(),message:A(),data:it().optional()})}).strict();var $j=e=>L0.safeParse(e).success;var bj=Ye([gj,yj,M0,L0]),L$e=Ye([M0,L0]),Fy=Jt.strict(),EJ=fn.extend({requestId:qy.optional(),reason:A().optional()}),Zy=pn.extend({method:H("notifications/cancelled"),params:EJ}),OJ=F({src:A(),mimeType:A().optional(),sizes:ke(A()).optional(),theme:Gt(["light","dark"]).optional()}),jd=F({icons:ke(OJ).optional()}),Ac=F({name:A(),title:A().optional()}),_j=Ac.extend({...Ac.shape,...jd.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),NJ=Pc(F({applyDefaults:Tt().optional()}),rt(A(),it())),CJ=Ed(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Pc(F({form:NJ.optional(),url:Mt.optional()}),rt(A(),it()).optional())),zJ=Kt({list:Mt.optional(),cancel:Mt.optional(),requests:Kt({sampling:Kt({createMessage:Mt.optional()}).optional(),elicitation:Kt({create:Mt.optional()}).optional()}).optional()}),jJ=Kt({list:Mt.optional(),cancel:Mt.optional(),requests:Kt({tools:Kt({call:Mt.optional()}).optional()}).optional()}),DJ=F({experimental:rt(A(),Mt).optional(),sampling:F({context:Mt.optional(),tools:Mt.optional()}).optional(),elicitation:CJ.optional(),roots:F({listChanged:Tt().optional()}).optional(),tasks:zJ.optional(),extensions:rt(A(),Mt).optional()}),MJ=tn.extend({protocolVersion:A(),capabilities:DJ,clientInfo:_j}),U0=Wt.extend({method:H("initialize"),params:MJ});var LJ=F({experimental:rt(A(),Mt).optional(),logging:Mt.optional(),completions:Mt.optional(),prompts:F({listChanged:Tt().optional()}).optional(),resources:F({subscribe:Tt().optional(),listChanged:Tt().optional()}).optional(),tools:F({listChanged:Tt().optional()}).optional(),tasks:jJ.optional(),extensions:rt(A(),Mt).optional()}),UJ=Jt.extend({protocolVersion:A(),capabilities:LJ,serverInfo:_j,instructions:A().optional()}),q0=pn.extend({method:H("notifications/initialized"),params:fn.optional()});var Vy=Wt.extend({method:H("ping"),params:tn.optional()}),qJ=F({progress:Ze(),total:et(Ze()),message:et(A())}),FJ=F({...fn.shape,...qJ.shape,progressToken:pj}),By=pn.extend({method:H("notifications/progress"),params:FJ}),ZJ=tn.extend({cursor:mj.optional()}),Dd=Wt.extend({params:ZJ.optional()}),Md=Jt.extend({nextCursor:mj.optional()}),VJ=Gt(["working","input_required","completed","failed","cancelled"]),Ld=F({taskId:A(),status:VJ,ttl:Ye([Ze(),kd()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:et(Ze()),statusMessage:et(A())}),Rc=Jt.extend({task:Ld}),BJ=fn.merge(Ld),Ud=pn.extend({method:H("notifications/tasks/status"),params:BJ}),Ky=Wt.extend({method:H("tasks/get"),params:tn.extend({taskId:A()})}),Gy=Jt.merge(Ld),Wy=Wt.extend({method:H("tasks/result"),params:tn.extend({taskId:A()})}),U$e=Jt.loose(),Jy=Dd.extend({method:H("tasks/list")}),Hy=Md.extend({tasks:ke(Ld)}),Yy=Wt.extend({method:H("tasks/cancel"),params:tn.extend({taskId:A()})}),wj=Jt.merge(Ld),kj=F({uri:A(),mimeType:et(A()),_meta:rt(A(),it()).optional()}),Sj=kj.extend({text:A()}),F0=A().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),xj=kj.extend({blob:F0}),qd=Gt(["user","assistant"]),Ec=F({audience:ke(qd).optional(),priority:Ze().min(0).max(1).optional(),lastModified:Cs.datetime({offset:!0}).optional()}),Ij=F({...Ac.shape,...jd.shape,uri:A(),description:et(A()),mimeType:et(A()),size:et(Ze()),annotations:Ec.optional(),_meta:et(Kt({}))}),KJ=F({...Ac.shape,...jd.shape,uriTemplate:A(),description:et(A()),mimeType:et(A()),annotations:Ec.optional(),_meta:et(Kt({}))}),Xy=Dd.extend({method:H("resources/list")}),GJ=Md.extend({resources:ke(Ij)}),Qy=Dd.extend({method:H("resources/templates/list")}),WJ=Md.extend({resourceTemplates:ke(KJ)}),Z0=tn.extend({uri:A()}),JJ=Z0,ev=Wt.extend({method:H("resources/read"),params:JJ}),HJ=Jt.extend({contents:ke(Ye([Sj,xj]))}),YJ=pn.extend({method:H("notifications/resources/list_changed"),params:fn.optional()}),XJ=Z0,QJ=Wt.extend({method:H("resources/subscribe"),params:XJ}),eH=Z0,tH=Wt.extend({method:H("resources/unsubscribe"),params:eH}),rH=fn.extend({uri:A()}),nH=pn.extend({method:H("notifications/resources/updated"),params:rH}),iH=F({name:A(),description:et(A()),required:et(Tt())}),oH=F({...Ac.shape,...jd.shape,description:et(A()),arguments:et(ke(iH)),_meta:et(Kt({}))}),tv=Dd.extend({method:H("prompts/list")}),sH=Md.extend({prompts:ke(oH)}),aH=tn.extend({name:A(),arguments:rt(A(),A()).optional()}),rv=Wt.extend({method:H("prompts/get"),params:aH}),V0=F({type:H("text"),text:A(),annotations:Ec.optional(),_meta:rt(A(),it()).optional()}),B0=F({type:H("image"),data:F0,mimeType:A(),annotations:Ec.optional(),_meta:rt(A(),it()).optional()}),K0=F({type:H("audio"),data:F0,mimeType:A(),annotations:Ec.optional(),_meta:rt(A(),it()).optional()}),cH=F({type:H("tool_use"),name:A(),id:A(),input:rt(A(),it()),_meta:rt(A(),it()).optional()}),uH=F({type:H("resource"),resource:Ye([Sj,xj]),annotations:Ec.optional(),_meta:rt(A(),it()).optional()}),lH=Ij.extend({type:H("resource_link")}),G0=Ye([V0,B0,K0,lH,uH]),dH=F({role:qd,content:G0}),fH=Jt.extend({description:A().optional(),messages:ke(dH)}),pH=pn.extend({method:H("notifications/prompts/list_changed"),params:fn.optional()}),mH=F({title:A().optional(),readOnlyHint:Tt().optional(),destructiveHint:Tt().optional(),idempotentHint:Tt().optional(),openWorldHint:Tt().optional()}),hH=F({taskSupport:Gt(["required","optional","forbidden"]).optional()}),Pj=F({...Ac.shape,...jd.shape,description:A().optional(),inputSchema:F({type:H("object"),properties:rt(A(),Mt).optional(),required:ke(A()).optional()}).catchall(it()),outputSchema:F({type:H("object"),properties:rt(A(),Mt).optional(),required:ke(A()).optional()}).catchall(it()).optional(),annotations:mH.optional(),execution:hH.optional(),_meta:rt(A(),it()).optional()}),nv=Dd.extend({method:H("tools/list")}),gH=Md.extend({tools:ke(Pj)}),iv=Jt.extend({content:ke(G0).default([]),structuredContent:rt(A(),it()).optional(),isError:Tt().optional()}),q$e=iv.or(Jt.extend({toolResult:it()})),yH=Cd.extend({name:A(),arguments:rt(A(),it()).optional()}),Oc=Wt.extend({method:H("tools/call"),params:yH}),vH=pn.extend({method:H("notifications/tools/list_changed"),params:fn.optional()}),F$e=F({autoRefresh:Tt().default(!0),debounceMs:Ze().int().nonnegative().default(300)}),Fd=Gt(["debug","info","notice","warning","error","critical","alert","emergency"]),$H=tn.extend({level:Fd}),W0=Wt.extend({method:H("logging/setLevel"),params:$H}),bH=fn.extend({level:Fd,logger:A().optional(),data:it()}),_H=pn.extend({method:H("notifications/message"),params:bH}),wH=F({name:A().optional()}),kH=F({hints:ke(wH).optional(),costPriority:Ze().min(0).max(1).optional(),speedPriority:Ze().min(0).max(1).optional(),intelligencePriority:Ze().min(0).max(1).optional()}),SH=F({mode:Gt(["auto","required","none"]).optional()}),xH=F({type:H("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:ke(G0).default([]),structuredContent:F({}).loose().optional(),isError:Tt().optional(),_meta:rt(A(),it()).optional()}),IH=Pd("type",[V0,B0,K0]),Ly=Pd("type",[V0,B0,K0,cH,xH]),PH=F({role:qd,content:Ye([Ly,ke(Ly)]),_meta:rt(A(),it()).optional()}),TH=Cd.extend({messages:ke(PH),modelPreferences:kH.optional(),systemPrompt:A().optional(),includeContext:Gt(["none","thisServer","allServers"]).optional(),temperature:Ze().optional(),maxTokens:Ze().int(),stopSequences:ke(A()).optional(),metadata:Mt.optional(),tools:ke(Pj).optional(),toolChoice:SH.optional()}),AH=Wt.extend({method:H("sampling/createMessage"),params:TH}),Zd=Jt.extend({model:A(),stopReason:et(Gt(["endTurn","stopSequence","maxTokens"]).or(A())),role:qd,content:IH}),J0=Jt.extend({model:A(),stopReason:et(Gt(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:qd,content:Ye([Ly,ke(Ly)])}),RH=F({type:H("boolean"),title:A().optional(),description:A().optional(),default:Tt().optional()}),EH=F({type:H("string"),title:A().optional(),description:A().optional(),minLength:Ze().optional(),maxLength:Ze().optional(),format:Gt(["email","uri","date","date-time"]).optional(),default:A().optional()}),OH=F({type:Gt(["number","integer"]),title:A().optional(),description:A().optional(),minimum:Ze().optional(),maximum:Ze().optional(),default:Ze().optional()}),NH=F({type:H("string"),title:A().optional(),description:A().optional(),enum:ke(A()),default:A().optional()}),CH=F({type:H("string"),title:A().optional(),description:A().optional(),oneOf:ke(F({const:A(),title:A()})),default:A().optional()}),zH=F({type:H("string"),title:A().optional(),description:A().optional(),enum:ke(A()),enumNames:ke(A()).optional(),default:A().optional()}),jH=Ye([NH,CH]),DH=F({type:H("array"),title:A().optional(),description:A().optional(),minItems:Ze().optional(),maxItems:Ze().optional(),items:F({type:H("string"),enum:ke(A())}),default:ke(A()).optional()}),MH=F({type:H("array"),title:A().optional(),description:A().optional(),minItems:Ze().optional(),maxItems:Ze().optional(),items:F({anyOf:ke(F({const:A(),title:A()}))}),default:ke(A()).optional()}),LH=Ye([DH,MH]),UH=Ye([zH,jH,LH]),qH=Ye([UH,RH,EH,OH]),FH=Cd.extend({mode:H("form").optional(),message:A(),requestedSchema:F({type:H("object"),properties:rt(A(),qH),required:ke(A()).optional()})}),ZH=Cd.extend({mode:H("url"),message:A(),elicitationId:A(),url:A().url()}),VH=Ye([FH,ZH]),BH=Wt.extend({method:H("elicitation/create"),params:VH}),KH=fn.extend({elicitationId:A()}),GH=pn.extend({method:H("notifications/elicitation/complete"),params:KH}),Nc=Jt.extend({action:Gt(["accept","decline","cancel"]),content:Ed(e=>e===null?void 0:e,rt(A(),Ye([A(),Ze(),Tt(),ke(A())])).optional())}),WH=F({type:H("ref/resource"),uri:A()});var JH=F({type:H("ref/prompt"),name:A()}),HH=tn.extend({ref:Ye([JH,WH]),argument:F({name:A(),value:A()}),context:F({arguments:rt(A(),A()).optional()}).optional()}),ov=Wt.extend({method:H("completion/complete"),params:HH});function Tj(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Aj(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var YH=Jt.extend({completion:Kt({values:ke(A()).max(100),total:et(Ze().int()),hasMore:et(Tt())})}),XH=F({uri:A().startsWith("file://"),name:A().optional(),_meta:rt(A(),it()).optional()}),QH=Wt.extend({method:H("roots/list"),params:tn.optional()}),H0=Jt.extend({roots:ke(XH)}),Y0=pn.extend({method:H("notifications/roots/list_changed"),params:fn.optional()}),Z$e=Ye([Vy,U0,ov,W0,rv,tv,Xy,Qy,ev,QJ,tH,Oc,nv,Ky,Wy,Jy,Yy]),V$e=Ye([Zy,By,q0,Y0,Ud]),B$e=Ye([Fy,Zd,J0,Nc,H0,Gy,Hy,Rc]),K$e=Ye([Vy,AH,BH,QH,Ky,Wy,Jy,Yy]),G$e=Ye([Zy,By,_H,nH,YJ,vH,pH,Ud,GH]),W$e=Ye([Fy,UJ,YH,fH,sH,GJ,WJ,HJ,iv,gH,Gy,Hy,Rc]),Y=class e extends Error{constructor(t,r,i){super(`MCP error ${t}: ${r}`),this.code=t,this.data=i,this.name="McpError"}static fromError(t,r,i){if(t===ne.UrlElicitationRequired&&i){let n=i;if(n.elicitations)return new C0(n.elicitations,r)}return new e(t,r,i)}},C0=class extends Y{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(ne.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};var e3=10*1024*1024,sv=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??e3}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
214
|
+
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),t3(r)}clear(){this._buffer=void 0}};function t3(e){return bj.parse(JSON.parse(e))}function Rj(e){return JSON.stringify(e)+`
|
|
215
|
+
`}var av=class{constructor(t=Ej.stdin,r=Ej.stdout,i){this._stdin=t,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new sv({maxBufferSize:i?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let i=Rj(t);this._stdout.write(i)?r():this._stdout.once("drain",r)})}};var X0=["claude-code","antigravity"],Oj=e=>X0.includes(e);function r3(e,t){return e==="antigravity"?`/bk-${t}`:`/bk:${t}`}function Q0(e,t){return e.replace(/\{\{bk:([a-z][a-z-]*)\}\}/g,(r,i)=>r3(t,i))}var Ne;(function(e){e.assertEqual=n=>{};function t(n){}e.assertIs=t;function r(n){throw new Error}e.assertNever=r,e.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},e.getValidEnumValues=n=>{let o=e.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of o)s[a]=n[a];return e.objectValues(s)},e.objectValues=n=>e.objectKeys(n).map(function(o){return n[o]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},e.find=(n,o)=>{for(let s of n)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(Ne||(Ne={}));var Nj;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Nj||(Nj={}));var Z=Ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ai=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.unknown}};var z=Ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var rn=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},i={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)i._errors.push(r(s));else{let a=i,c=0;for(;c<s.path.length;){let u=s.path[c],l=c===s.path.length-1;if(u==="_errors"){l&&a._errors.push(r(s)),c++;continue}Object.prototype.hasOwnProperty.call(a,u)||(u==="__proto__"?Object.defineProperty(a,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):a[u]={_errors:[]}),a=a[u],l&&a._errors.push(r(s)),c++}}};return n(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),i=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];r[o]=r[o]||[],r[o].push(t(n))}else i.push(t(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};rn.create=e=>new rn(e);var n3=(e,t)=>{let r;switch(e.code){case z.invalid_type:e.received===Z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ne.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ne.joinValues(e.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ne.joinValues(e.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${Ne.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ne.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case z.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case z.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ne.assertNever(e)}return{message:r}},ho=n3;var i3=ho;function Vd(){return i3}var cv=e=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let a="",c=i.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...n,path:o,message:a}};function U(e,t){let r=Vd(),i=cv({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ho?void 0:ho].filter(n=>!!n)});e.common.issues.push(i)}var nr=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let i=[];for(let n of r){if(n.status==="aborted")return ae;n.status==="dirty"&&t.dirty(),i.push(n.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,r){let i=[];for(let n of r){let o=await n.key,s=await n.value;i.push({key:o,value:s})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,r){let i={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return ae;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(i[o.value]=s.value)}return{status:t.value,value:i}}},ae=Object.freeze({status:"aborted"}),Cc=e=>({status:"dirty",value:e}),wr=e=>({status:"valid",value:e}),ex=e=>e.status==="aborted",tx=e=>e.status==="dirty",zs=e=>e.status==="valid",Bd=e=>typeof Promise<"u"&&e instanceof Promise;var W;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(W||(W={}));var mn=class{constructor(t,r,i,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Cj=(e,t)=>{if(zs(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new rn(e.common.issues);return this._error=r,this._error}}};function ye(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??i??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:n}}var Se=class{get description(){return this._def.description}_getType(t){return Ai(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ai(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nr,ctx:{common:t.parent.common,data:t.data,parsedType:Ai(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Bd(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let i=this.safeParse(t,r);if(i.success)return i.data;throw i.error}safeParse(t,r){let i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ai(t)},n=this._parseSync({data:t,path:i.path,parent:i});return Cj(i,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ai(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:r});return zs(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(i=>zs(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(t,r){let i=await this.safeParseAsync(t,r);if(i.success)return i.data;throw i.error}async safeParseAsync(t,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ai(t)},n=this._parse({data:t,path:i.path,parent:i}),o=await(Bd(n)?n:Promise.resolve(n));return Cj(i,o)}refine(t,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let s=t(n),a=()=>o.addIssue({code:z.custom,...i(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((i,n)=>t(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(t){return new Nn({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return On.create(this,this._def)}nullable(){return Oi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yo.create(this)}promise(){return js.create(this,this._def)}or(t){return Lc.create([this,t],this._def)}and(t){return Uc.create(this,t,this._def)}transform(t){return new Nn({...ye(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Bc({...ye(this._def),innerType:this,defaultValue:r,typeName:M.ZodDefault})}brand(){return new uv({typeName:M.ZodBranded,type:this,...ye(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Kc({...ye(this._def),innerType:this,catchValue:r,typeName:M.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return lv.create(this,t)}readonly(){return Gc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},o3=/^c[^\s-]{8,}$/i,s3=/^[0-9a-z]+$/,a3=/^[0-9A-HJKMNP-TV-Z]{26}$/i,c3=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,u3=/^[a-z0-9_-]{21}$/i,l3=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,d3=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,f3=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,p3="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",rx,m3=/^(?:(?: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])$/,h3=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,g3=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,y3=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,v3=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$3=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zj="((\\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])))",b3=new RegExp(`^${zj}$`);function jj(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function _3(e){return new RegExp(`^${jj(e)}$`)}function w3(e){let t=`${zj}T${jj(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function k3(e,t){return!!((t==="v4"||!t)&&m3.test(e)||(t==="v6"||!t)&&g3.test(e))}function S3(e,t){if(!l3.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function x3(e,t){return!!((t==="v4"||!t)&&h3.test(e)||(t==="v6"||!t)&&y3.test(e))}var jc=class e extends Se{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){let o=this._getOrReturnCtx(t);return U(o,{code:z.invalid_type,expected:Z.string,received:o.parsedType}),ae}let i=new nr,n;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(n=this._getOrReturnCtx(t,n),U(n,{code:z.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")t.data.length>o.value&&(n=this._getOrReturnCtx(t,n),U(n,{code:z.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(n=this._getOrReturnCtx(t,n),s?U(n,{code:z.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&U(n,{code:z.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")f3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"email",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")rx||(rx=new RegExp(p3,"u")),rx.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"emoji",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")c3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"uuid",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")u3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"nanoid",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")o3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"cuid",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")s3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"cuid2",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")a3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"ulid",code:z.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),U(n,{validation:"url",code:z.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"regex",code:z.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(t,n),U(n,{code:z.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(n=this._getOrReturnCtx(t,n),U(n,{code:z.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(n=this._getOrReturnCtx(t,n),U(n,{code:z.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?w3(o).test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{code:z.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?b3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{code:z.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?_3(o).test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{code:z.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?d3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"duration",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?k3(t.data,o.version)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"ip",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?S3(t.data,o.alg)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"jwt",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?x3(t.data,o.version)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"cidr",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?v3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"base64",code:z.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?$3.test(t.data)||(n=this._getOrReturnCtx(t,n),U(n,{validation:"base64url",code:z.invalid_string,message:o.message}),i.dirty()):Ne.assertNever(o);return{status:i.value,value:t.data}}_regex(t,r,i){return this.refinement(n=>t.test(n),{validation:r,code:z.invalid_string,...W.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...W.errToObj(t)})}url(t){return this._addCheck({kind:"url",...W.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...W.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...W.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...W.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...W.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...W.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...W.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...W.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...W.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...W.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...W.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...W.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...W.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...W.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...W.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...W.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...W.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...W.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...W.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...W.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...W.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...W.errToObj(r)})}nonempty(t){return this.min(1,W.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};jc.create=e=>new jc({checks:[],typeName:M.ZodString,coerce:e?.coerce??!1,...ye(e)});function I3(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}var Kd=class e extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Z.number){let o=this._getOrReturnCtx(t);return U(o,{code:z.invalid_type,expected:Z.number,received:o.parsedType}),ae}let i,n=new nr;for(let o of this._def.checks)o.kind==="int"?Ne.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),U(i,{code:z.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),U(i,{code:z.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),U(i,{code:z.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?I3(t.data,o.value)!==0&&(i=this._getOrReturnCtx(t,i),U(i,{code:z.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),U(i,{code:z.not_finite,message:o.message}),n.dirty()):Ne.assertNever(o);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,W.toString(r))}gt(t,r){return this.setLimit("min",t,!1,W.toString(r))}lte(t,r){return this.setLimit("max",t,!0,W.toString(r))}lt(t,r){return this.setLimit("max",t,!1,W.toString(r))}setLimit(t,r,i,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:i,message:W.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:W.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:W.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:W.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ne.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Kd.create=e=>new Kd({checks:[],typeName:M.ZodNumber,coerce:e?.coerce||!1,...ye(e)});var Gd=class e extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Z.bigint)return this._getInvalidInput(t);let i,n=new nr;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),U(i,{code:z.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),U(i,{code:z.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),U(i,{code:z.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):Ne.assertNever(o);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return U(r,{code:z.invalid_type,expected:Z.bigint,received:r.parsedType}),ae}gte(t,r){return this.setLimit("min",t,!0,W.toString(r))}gt(t,r){return this.setLimit("min",t,!1,W.toString(r))}lte(t,r){return this.setLimit("max",t,!0,W.toString(r))}lt(t,r){return this.setLimit("max",t,!1,W.toString(r))}setLimit(t,r,i,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:i,message:W.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:W.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Gd.create=e=>new Gd({checks:[],typeName:M.ZodBigInt,coerce:e?.coerce??!1,...ye(e)});var Wd=class extends Se{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){let i=this._getOrReturnCtx(t);return U(i,{code:z.invalid_type,expected:Z.boolean,received:i.parsedType}),ae}return wr(t.data)}};Wd.create=e=>new Wd({typeName:M.ZodBoolean,coerce:e?.coerce||!1,...ye(e)});var Jd=class e extends Se{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){let o=this._getOrReturnCtx(t);return U(o,{code:z.invalid_type,expected:Z.date,received:o.parsedType}),ae}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return U(o,{code:z.invalid_date}),ae}let i=new nr,n;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(n=this._getOrReturnCtx(t,n),U(n,{code:z.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(n=this._getOrReturnCtx(t,n),U(n,{code:z.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):Ne.assertNever(o);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:W.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:W.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Jd.create=e=>new Jd({checks:[],coerce:e?.coerce||!1,typeName:M.ZodDate,...ye(e)});var Hd=class extends Se{_parse(t){if(this._getType(t)!==Z.symbol){let i=this._getOrReturnCtx(t);return U(i,{code:z.invalid_type,expected:Z.symbol,received:i.parsedType}),ae}return wr(t.data)}};Hd.create=e=>new Hd({typeName:M.ZodSymbol,...ye(e)});var Dc=class extends Se{_parse(t){if(this._getType(t)!==Z.undefined){let i=this._getOrReturnCtx(t);return U(i,{code:z.invalid_type,expected:Z.undefined,received:i.parsedType}),ae}return wr(t.data)}};Dc.create=e=>new Dc({typeName:M.ZodUndefined,...ye(e)});var Mc=class extends Se{_parse(t){if(this._getType(t)!==Z.null){let i=this._getOrReturnCtx(t);return U(i,{code:z.invalid_type,expected:Z.null,received:i.parsedType}),ae}return wr(t.data)}};Mc.create=e=>new Mc({typeName:M.ZodNull,...ye(e)});var Yd=class extends Se{constructor(){super(...arguments),this._any=!0}_parse(t){return wr(t.data)}};Yd.create=e=>new Yd({typeName:M.ZodAny,...ye(e)});var go=class extends Se{constructor(){super(...arguments),this._unknown=!0}_parse(t){return wr(t.data)}};go.create=e=>new go({typeName:M.ZodUnknown,...ye(e)});var ii=class extends Se{_parse(t){let r=this._getOrReturnCtx(t);return U(r,{code:z.invalid_type,expected:Z.never,received:r.parsedType}),ae}};ii.create=e=>new ii({typeName:M.ZodNever,...ye(e)});var Xd=class extends Se{_parse(t){if(this._getType(t)!==Z.undefined){let i=this._getOrReturnCtx(t);return U(i,{code:z.invalid_type,expected:Z.void,received:i.parsedType}),ae}return wr(t.data)}};Xd.create=e=>new Xd({typeName:M.ZodVoid,...ye(e)});var yo=class e extends Se{_parse(t){let{ctx:r,status:i}=this._processInputParams(t),n=this._def;if(r.parsedType!==Z.array)return U(r,{code:z.invalid_type,expected:Z.array,received:r.parsedType}),ae;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(s||a)&&(U(r,{code:s?z.too_big:z.too_small,minimum:a?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(U(r,{code:z.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(U(r,{code:z.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>n.type._parseAsync(new mn(r,s,r.path,a)))).then(s=>nr.mergeArray(i,s));let o=[...r.data].map((s,a)=>n.type._parseSync(new mn(r,s,r.path,a)));return nr.mergeArray(i,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:W.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:W.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:W.toString(r)}})}nonempty(t){return this.min(1,t)}};yo.create=(e,t)=>new yo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...ye(t)});function zc(e){if(e instanceof nn){let t={};for(let r in e.shape){let i=e.shape[r];t[r]=On.create(zc(i))}return new nn({...e._def,shape:()=>t})}else return e instanceof yo?new yo({...e._def,type:zc(e.element)}):e instanceof On?On.create(zc(e.unwrap())):e instanceof Oi?Oi.create(zc(e.unwrap())):e instanceof Ei?Ei.create(e.items.map(t=>zc(t))):e}var nn=class e extends Se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Ne.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Z.object){let u=this._getOrReturnCtx(t);return U(u,{code:z.invalid_type,expected:Z.object,received:u.parsedType}),ae}let{status:i,ctx:n}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof ii&&this._def.unknownKeys==="strip"))for(let u in n.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],d=n.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new mn(n,d,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof ii){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:n.data[l]}});else if(u==="strict")a.length>0&&(U(n,{code:z.unrecognized_keys,keys:a}),i.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=n.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new mn(n,d,n.path,l)),alwaysSet:l in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>nr.mergeObjectSync(i,u)):nr.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(t){return W.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,i)=>{let n=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:W.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:M.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let i of Ne.objectKeys(t))t[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let i of Ne.objectKeys(this.shape))t[i]||(r[i]=this.shape[i]);return new e({...this._def,shape:()=>r})}deepPartial(){return zc(this)}partial(t){let r={};for(let i of Ne.objectKeys(this.shape)){let n=this.shape[i];t&&!t[i]?r[i]=n:r[i]=n.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let i of Ne.objectKeys(this.shape))if(t&&!t[i])r[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof On;)o=o._def.innerType;r[i]=o}return new e({...this._def,shape:()=>r})}keyof(){return Dj(Ne.objectKeys(this.shape))}};nn.create=(e,t)=>new nn({shape:()=>e,unknownKeys:"strip",catchall:ii.create(),typeName:M.ZodObject,...ye(t)});nn.strictCreate=(e,t)=>new nn({shape:()=>e,unknownKeys:"strict",catchall:ii.create(),typeName:M.ZodObject,...ye(t)});nn.lazycreate=(e,t)=>new nn({shape:e,unknownKeys:"strip",catchall:ii.create(),typeName:M.ZodObject,...ye(t)});var Lc=class extends Se{_parse(t){let{ctx:r}=this._processInputParams(t),i=this._def.options;function n(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new rn(a.ctx.common.issues));return U(r,{code:z.invalid_union,unionErrors:s}),ae}if(r.common.async)return Promise.all(i.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let c of i){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new rn(c));return U(r,{code:z.invalid_union,unionErrors:a}),ae}}get options(){return this._def.options}};Lc.create=(e,t)=>new Lc({options:e,typeName:M.ZodUnion,...ye(t)});var Ri=e=>e instanceof qc?Ri(e.schema):e instanceof Nn?Ri(e.innerType()):e instanceof Fc?[e.value]:e instanceof Zc?e.options:e instanceof Vc?Ne.objectValues(e.enum):e instanceof Bc?Ri(e._def.innerType):e instanceof Dc?[void 0]:e instanceof Mc?[null]:e instanceof On?[void 0,...Ri(e.unwrap())]:e instanceof Oi?[null,...Ri(e.unwrap())]:e instanceof uv||e instanceof Gc?Ri(e.unwrap()):e instanceof Kc?Ri(e._def.innerType):[],nx=class e extends Se{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.object)return U(r,{code:z.invalid_type,expected:Z.object,received:r.parsedType}),ae;let i=this.discriminator,n=r.data[i],o=this.optionsMap.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(U(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,i){let n=new Map;for(let o of r){let s=Ri(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(n.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);n.set(a,o)}}return new e({typeName:M.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...ye(i)})}};function ix(e,t){let r=Ai(e),i=Ai(t);if(e===t)return{valid:!0,data:e};if(r===Z.object&&i===Z.object){let n=Ne.objectKeys(t),o=Ne.objectKeys(e).filter(a=>n.indexOf(a)!==-1),s={...e,...t};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(let a of o){if(a==="__proto__")continue;let c=ix(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===Z.array&&i===Z.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=ix(s,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return r===Z.date&&i===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Uc=class extends Se{_parse(t){let{status:r,ctx:i}=this._processInputParams(t),n=(o,s)=>{if(ex(o)||ex(s))return ae;let a=ix(o.value,s.value);return a.valid?((tx(o)||tx(s))&&r.dirty(),{status:r.value,value:a.data}):(U(i,{code:z.invalid_intersection_types}),ae)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Uc.create=(e,t,r)=>new Uc({left:e,right:t,typeName:M.ZodIntersection,...ye(r)});var Ei=class e extends Se{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==Z.array)return U(i,{code:z.invalid_type,expected:Z.array,received:i.parsedType}),ae;if(i.data.length<this._def.items.length)return U(i,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&i.data.length>this._def.items.length&&(U(i,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...i.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new mn(i,s,i.path,a)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>nr.mergeArray(r,s)):nr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ei.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ei({items:e,typeName:M.ZodTuple,rest:null,...ye(t)})};var ox=class e extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==Z.object)return U(i,{code:z.invalid_type,expected:Z.object,received:i.parsedType}),ae;let n=[],o=this._def.keyType,s=this._def.valueType;for(let a in i.data)n.push({key:o._parse(new mn(i,a,i.path,a)),value:s._parse(new mn(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?nr.mergeObjectAsync(r,n):nr.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,i){return r instanceof Se?new e({keyType:t,valueType:r,typeName:M.ZodRecord,...ye(i)}):new e({keyType:jc.create(),valueType:t,typeName:M.ZodRecord,...ye(r)})}},Qd=class extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==Z.map)return U(i,{code:z.invalid_type,expected:Z.map,received:i.parsedType}),ae;let n=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,c],u)=>({key:n._parse(new mn(i,a,i.path,[u,"key"])),value:o._parse(new mn(i,c,i.path,[u,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return ae;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return ae;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};Qd.create=(e,t,r)=>new Qd({valueType:t,keyType:e,typeName:M.ZodMap,...ye(r)});var ef=class e extends Se{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.parsedType!==Z.set)return U(i,{code:z.invalid_type,expected:Z.set,received:i.parsedType}),ae;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(U(i,{code:z.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(U(i,{code:z.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return ae;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...i.data.values()].map((c,u)=>o._parse(new mn(i,c,i.path,u)));return i.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:W.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:W.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ef.create=(e,t)=>new ef({valueType:e,minSize:null,maxSize:null,typeName:M.ZodSet,...ye(t)});var sx=class e extends Se{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.function)return U(r,{code:z.invalid_type,expected:Z.function,received:r.parsedType}),ae;function i(a,c){return cv({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vd(),ho].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function n(a,c){return cv({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Vd(),ho].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof js){let a=this;return wr(async function(...c){let u=new rn([]),l=await a._def.args.parseAsync(c,o).catch(p=>{throw u.addIssue(i(c,p)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw u.addIssue(n(d,p)),u})})}else{let a=this;return wr(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new rn([i(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new rn([n(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ei.create(t).rest(go.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,i){return new e({args:t||Ei.create([]).rest(go.create()),returns:r||go.create(),typeName:M.ZodFunction,...ye(i)})}},qc=class extends Se{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};qc.create=(e,t)=>new qc({getter:e,typeName:M.ZodLazy,...ye(t)});var Fc=class extends Se{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return U(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}};Fc.create=(e,t)=>new Fc({value:e,typeName:M.ZodLiteral,...ye(t)});function Dj(e,t){return new Zc({values:e,typeName:M.ZodEnum,...ye(t)})}var Zc=class e extends Se{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),i=this._def.values;return U(r,{expected:Ne.joinValues(i),received:r.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),i=this._def.values;return U(r,{received:r.data,code:z.invalid_enum_value,options:i}),ae}return wr(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...r})}};Zc.create=Dj;var Vc=class extends Se{_parse(t){let r=Ne.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==Z.string&&i.parsedType!==Z.number){let n=Ne.objectValues(r);return U(i,{expected:Ne.joinValues(n),received:i.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(Ne.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let n=Ne.objectValues(r);return U(i,{received:i.data,code:z.invalid_enum_value,options:n}),ae}return wr(t.data)}get enum(){return this._def.values}};Vc.create=(e,t)=>new Vc({values:e,typeName:M.ZodNativeEnum,...ye(t)});var js=class extends Se{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.promise&&r.common.async===!1)return U(r,{code:z.invalid_type,expected:Z.promise,received:r.parsedType}),ae;let i=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return wr(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};js.create=(e,t)=>new js({type:e,typeName:M.ZodPromise,...ye(t)});var Nn=class extends Se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:i}=this._processInputParams(t),n=this._def.effect||null,o={addIssue:s=>{U(i,s),s.fatal?r.abort():r.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ae;let c=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return c.status==="aborted"?ae:c.status==="dirty"?Cc(c.value):r.value==="dirty"?Cc(c.value):c});{if(r.value==="aborted")return ae;let a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?ae:a.status==="dirty"?Cc(a.value):r.value==="dirty"?Cc(a.value):a}}if(n.type==="refinement"){let s=a=>{let c=n.refinement(a,o);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?ae:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?ae:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!zs(s))return ae;let a=n.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>zs(s)?Promise.resolve(n.transform(s.value,o)).then(a=>({status:r.value,value:a})):ae);Ne.assertNever(n)}};Nn.create=(e,t,r)=>new Nn({schema:e,typeName:M.ZodEffects,effect:t,...ye(r)});Nn.createWithPreprocess=(e,t,r)=>new Nn({schema:t,effect:{type:"preprocess",transform:e},typeName:M.ZodEffects,...ye(r)});var On=class extends Se{_parse(t){return this._getType(t)===Z.undefined?wr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};On.create=(e,t)=>new On({innerType:e,typeName:M.ZodOptional,...ye(t)});var Oi=class extends Se{_parse(t){return this._getType(t)===Z.null?wr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Oi.create=(e,t)=>new Oi({innerType:e,typeName:M.ZodNullable,...ye(t)});var Bc=class extends Se{_parse(t){let{ctx:r}=this._processInputParams(t),i=r.data;return r.parsedType===Z.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Bc.create=(e,t)=>new Bc({innerType:e,typeName:M.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ye(t)});var Kc=class extends Se{_parse(t){let{ctx:r}=this._processInputParams(t),i={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Bd(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new rn(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new rn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Kc.create=(e,t)=>new Kc({innerType:e,typeName:M.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ye(t)});var tf=class extends Se{_parse(t){if(this._getType(t)!==Z.nan){let i=this._getOrReturnCtx(t);return U(i,{code:z.invalid_type,expected:Z.nan,received:i.parsedType}),ae}return{status:"valid",value:t.data}}};tf.create=e=>new tf({typeName:M.ZodNaN,...ye(e)});var uv=class extends Se{_parse(t){let{ctx:r}=this._processInputParams(t),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}},lv=class e extends Se{_parse(t){let{status:r,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?ae:o.status==="dirty"?(r.dirty(),Cc(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?ae:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(t,r){return new e({in:t,out:r,typeName:M.ZodPipeline})}},Gc=class extends Se{_parse(t){let r=this._def.innerType._parse(t),i=n=>(zs(n)&&(n.value=Object.freeze(n.value)),n);return Bd(r)?r.then(n=>i(n)):i(r)}unwrap(){return this._def.innerType}};Gc.create=(e,t)=>new Gc({innerType:e,typeName:M.ZodReadonly,...ye(t)});var $be={object:nn.lazycreate},M;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(M||(M={}));var bbe=jc.create,_be=Kd.create,wbe=tf.create,kbe=Gd.create,Sbe=Wd.create,xbe=Jd.create,Ibe=Hd.create,Pbe=Dc.create,Tbe=Mc.create,Abe=Yd.create,Rbe=go.create,Ebe=ii.create,Obe=Xd.create,Nbe=yo.create,Mj=nn.create,Cbe=nn.strictCreate,zbe=Lc.create,jbe=nx.create,Dbe=Uc.create,Mbe=Ei.create,Lbe=ox.create,Ube=Qd.create,qbe=ef.create,Fbe=sx.create,Zbe=qc.create,Vbe=Fc.create,Bbe=Zc.create,Kbe=Vc.create,Gbe=js.create,Wbe=Nn.create,Jbe=On.create,Hbe=Oi.create,Ybe=Nn.createWithPreprocess,Xbe=lv.create;var T3=x("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");ue.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){Qn(this,"with",e)},parse(e,t){return vs(this,e,t,{callee:this.parse})},parseAsync(e,t){return $s(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Za(this,e,t)},safeParseAsync(e,t){return Ba(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return Fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}});var A3=x("ZodMiniObject",(e,t)=>{Fh.init(e,t),T3.init(e,t),nw(e,"shape",r=>r._zod.def.shape,!1)});function ax(e,t){let r={type:"object",shape:e??{},...j(t)};return new A3(r)}function oi(e){return!!e._zod}function Ds(e){let t=Object.values(e);if(t.length===0)return ax({});let r=t.every(oi),i=t.every(n=>!oi(n));if(r)return ax(e);if(i)return Mj(e);throw new Error("Mixed Zod versions detected in object shape.")}function vo(e,t){return oi(e)?Za(e,t):e.safeParse(t)}async function dv(e,t){return oi(e)?await Ba(e,t):await e.safeParseAsync(t)}function $o(e){if(!e)return;let t;if(oi(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Wc(e){if(e){if(typeof e=="object"){let t=e,r=e;if(!t._def&&!r._zod){let i=Object.values(e);if(i.length>0&&i.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return Ds(e)}}if(oi(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function E3(e){return e.length===0?"object root":e.reduce((t,r,i)=>i===0?String(r):typeof r=="number"?`${t}[${r}]`:`${t}.${r}`,"")}function fv(e){if(e&&typeof e=="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map(t=>t.path?.length?`${t.message} at ${E3(t.path)}`:t.message).join(`
|
|
216
|
+
`);if("message"in e&&typeof e.message=="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function Lj(e){return e.description}function Uj(e){if(oi(e))return e._zod?.def?.type==="optional";let t=e;return typeof e.isOptional=="function"?e.isOptional():t._def?.typeName==="ZodOptional"}function Jc(e){if(oi(e)){let o=e._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let i=e.value;if(i!==void 0)return i}function bo(e){return e==="completed"||e==="failed"||e==="cancelled"}var Fj=Symbol("Let zodToJsonSchema decide on which parser to use");var qj={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Zj=e=>typeof e=="string"?{...qj,name:e}:{...qj,...e};var Vj=e=>{let t=Zj(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};function cx(e,t,r,i){i?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function Ce(e,t,r,i,n){e[t]=r,cx(e,t,i,n)}var pv=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function yt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?pv(t,e.currentPath):t.join("/")}}function Bj(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==M.ZodAny&&(r.items=ce(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Ce(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Ce(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Ce(r,"minItems",e.exactLength.value,e.exactLength.message,t),Ce(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function Kj(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"min":t.target==="jsonSchema7"?i.inclusive?Ce(r,"minimum",i.value,i.message,t):Ce(r,"exclusiveMinimum",i.value,i.message,t):(i.inclusive||(r.exclusiveMinimum=!0),Ce(r,"minimum",i.value,i.message,t));break;case"max":t.target==="jsonSchema7"?i.inclusive?Ce(r,"maximum",i.value,i.message,t):Ce(r,"exclusiveMaximum",i.value,i.message,t):(i.inclusive||(r.exclusiveMaximum=!0),Ce(r,"maximum",i.value,i.message,t));break;case"multipleOf":Ce(r,"multipleOf",i.value,i.message,t);break}return r}function Gj(){return{type:"boolean"}}function mv(e,t){return ce(e.type._def,t)}var Wj=(e,t)=>ce(e.innerType._def,t);function ux(e,t,r){let i=r??t.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,o)=>ux(e,t,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return O3(e,t)}}var O3=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let i of e.checks)switch(i.kind){case"min":Ce(r,"minimum",i.value,i.message,t);break;case"max":Ce(r,"maximum",i.value,i.message,t);break}return r};function Jj(e,t){return{...ce(e.innerType._def,t),default:e.defaultValue()}}function Hj(e,t){return t.effectStrategy==="input"?ce(e.schema._def,t):yt(t)}function Yj(e){return{type:"string",enum:Array.from(e.values)}}var N3=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Xj(e,t){let r=[ce(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ce(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),i=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(o=>{if(N3(o))n.push(...o.allOf),o.unevaluatedProperties===void 0&&(i=void 0);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;s=c}else i=void 0;n.push(s)}}),n.length?{allOf:n,...i}:void 0}function Qj(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var lx,Cn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(lx===void 0&&(lx=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),lx),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function hv(e,t){let r={type:"string"};if(e.checks)for(let i of e.checks)switch(i.kind){case"min":Ce(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,i.value):i.value,i.message,t);break;case"max":Ce(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"email":switch(t.emailStrategy){case"format:email":zn(r,"email",i.message,t);break;case"format:idn-email":zn(r,"idn-email",i.message,t);break;case"pattern:zod":kr(r,Cn.email,i.message,t);break}break;case"url":zn(r,"uri",i.message,t);break;case"uuid":zn(r,"uuid",i.message,t);break;case"regex":kr(r,i.regex,i.message,t);break;case"cuid":kr(r,Cn.cuid,i.message,t);break;case"cuid2":kr(r,Cn.cuid2,i.message,t);break;case"startsWith":kr(r,RegExp(`^${dx(i.value,t)}`),i.message,t);break;case"endsWith":kr(r,RegExp(`${dx(i.value,t)}$`),i.message,t);break;case"datetime":zn(r,"date-time",i.message,t);break;case"date":zn(r,"date",i.message,t);break;case"time":zn(r,"time",i.message,t);break;case"duration":zn(r,"duration",i.message,t);break;case"length":Ce(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,i.value):i.value,i.message,t),Ce(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"includes":{kr(r,RegExp(dx(i.value,t)),i.message,t);break}case"ip":{i.version!=="v6"&&zn(r,"ipv4",i.message,t),i.version!=="v4"&&zn(r,"ipv6",i.message,t);break}case"base64url":kr(r,Cn.base64url,i.message,t);break;case"jwt":kr(r,Cn.jwt,i.message,t);break;case"cidr":{i.version!=="v6"&&kr(r,Cn.ipv4Cidr,i.message,t),i.version!=="v4"&&kr(r,Cn.ipv6Cidr,i.message,t);break}case"emoji":kr(r,Cn.emoji(),i.message,t);break;case"ulid":{kr(r,Cn.ulid,i.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{zn(r,"binary",i.message,t);break}case"contentEncoding:base64":{Ce(r,"contentEncoding","base64",i.message,t);break}case"pattern:zod":{kr(r,Cn.base64,i.message,t);break}}break}case"nanoid":kr(r,Cn.nanoid,i.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function dx(e,t){return t.patternStrategy==="escape"?z3(e):e}var C3=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function z3(e){let t="";for(let r=0;r<e.length;r++)C3.has(e[r])||(t+="\\"),t+=e[r];return t}function zn(e,t,r,i){e.format||e.anyOf?.some(n=>n.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&i.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&i.errorMessages&&{errorMessage:{format:r}}})):Ce(e,"format",t,r,i)}function kr(e,t,r,i){e.pattern||e.allOf?.some(n=>n.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&i.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:e1(t,i),...r&&i.errorMessages&&{errorMessage:{pattern:r}}})):Ce(e,"pattern",e1(t,i),r,i)}function e1(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=r.i?e.source.toLowerCase():e.source,n="",o=!1,s=!1,a=!1;for(let c=0;c<i.length;c++){if(o){n+=i[c],o=!1;continue}if(r.i){if(s){if(i[c].match(/[a-z]/)){a?(n+=i[c],n+=`${i[c-2]}-${i[c]}`.toUpperCase(),a=!1):i[c+1]==="-"&&i[c+2]?.match(/[a-z]/)?(n+=i[c],a=!0):n+=`${i[c]}${i[c].toUpperCase()}`;continue}}else if(i[c].match(/[a-z]/)){n+=`[${i[c]}${i[c].toUpperCase()}]`;continue}}if(r.m){if(i[c]==="^"){n+=`(^|(?<=[\r
|
|
217
|
+
]))`;continue}else if(i[c]==="$"){n+=`($|(?=[\r
|
|
218
|
+
]))`;continue}}if(r.s&&i[c]==="."){n+=s?`${i[c]}\r
|
|
219
|
+
`:`[${i[c]}\r
|
|
220
|
+
]`;continue}n+=i[c],i[c]==="\\"?o=!0:s&&i[c]==="]"?s=!1:!s&&i[c]==="["&&(s=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function gv(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===M.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((i,n)=>({...i,[n]:ce(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??yt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:ce(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===M.ZodString&&e.keyType._def.checks?.length){let{type:i,...n}=hv(e.keyType._def,t);return{...r,propertyNames:n}}else{if(e.keyType?._def.typeName===M.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===M.ZodBranded&&e.keyType._def.type._def.typeName===M.ZodString&&e.keyType._def.type._def.checks?.length){let{type:i,...n}=mv(e.keyType._def,t);return{...r,propertyNames:n}}}return r}function t1(e,t){if(t.mapStrategy==="record")return gv(e,t);let r=ce(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||yt(t),i=ce(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||yt(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,i],minItems:2,maxItems:2}}}function r1(e){let t=e.values,i=Object.keys(e.values).filter(o=>typeof t[t[o]]!="number").map(o=>t[o]),n=Array.from(new Set(i.map(o=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:i}}function n1(e){return e.target==="openAi"?void 0:{not:yt({...e,currentPath:[...e.currentPath,"not"]})}}function i1(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var rf={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function s1(e,t){if(t.target==="openApi3")return o1(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(i=>i._def.typeName in rf&&(!i._def.checks||!i._def.checks.length))){let i=r.reduce((n,o)=>{let s=rf[o._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:i.length>1?i:i[0]}}else if(r.every(i=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=r.reduce((n,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(o._def.value===null)return[...n,"null"];default:return n}},[]);if(i.length===r.length){let n=i.filter((o,s,a)=>a.indexOf(o)===s);return{type:n.length>1?n:n[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every(i=>i._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((i,n)=>[...i,...n._def.values.filter(o=>!i.includes(o))],[])};return o1(e,t)}var o1=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,n)=>ce(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(i=>!!i&&(!t.strictUnions||typeof i=="object"&&Object.keys(i).length>0));return r.length?{anyOf:r}:void 0};function a1(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:rf[e.innerType._def.typeName],nullable:!0}:{type:[rf[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let i=ce(e.innerType._def,{...t,currentPath:[...t.currentPath]});return i&&"$ref"in i?{allOf:[i],nullable:!0}:i&&{...i,nullable:!0}}let r=ce(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function c1(e,t){let r={type:"number"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"int":r.type="integer",cx(r,"type",i.message,t);break;case"min":t.target==="jsonSchema7"?i.inclusive?Ce(r,"minimum",i.value,i.message,t):Ce(r,"exclusiveMinimum",i.value,i.message,t):(i.inclusive||(r.exclusiveMinimum=!0),Ce(r,"minimum",i.value,i.message,t));break;case"max":t.target==="jsonSchema7"?i.inclusive?Ce(r,"maximum",i.value,i.message,t):Ce(r,"exclusiveMaximum",i.value,i.message,t):(i.inclusive||(r.exclusiveMaximum=!0),Ce(r,"maximum",i.value,i.message,t));break;case"multipleOf":Ce(r,"multipleOf",i.value,i.message,t);break}return r}function u1(e,t){let r=t.target==="openAi",i={type:"object",properties:{}},n=[],o=e.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let u=D3(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=ce(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});l!==void 0&&(i.properties[a]=l,u||n.push(a))}n.length&&(i.required=n);let s=j3(e,t);return s!==void 0&&(i.additionalProperties=s),i}function j3(e,t){if(e.catchall._def.typeName!=="ZodNever")return ce(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function D3(e){try{return e.isOptional()}catch{return!0}}var l1=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return ce(e.innerType._def,t);let r=ce(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:yt(t)},r]}:yt(t)};var d1=(e,t)=>{if(t.pipeStrategy==="input")return ce(e.in._def,t);if(t.pipeStrategy==="output")return ce(e.out._def,t);let r=ce(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=ce(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,i].filter(n=>n!==void 0)}};function f1(e,t){return ce(e.type._def,t)}function p1(e,t){let i={type:"array",uniqueItems:!0,items:ce(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Ce(i,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Ce(i,"maxItems",e.maxSize.value,e.maxSize.message,t),i}function m1(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,i)=>ce(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[]),additionalItems:ce(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,i)=>ce(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[])}}function h1(e){return{not:yt(e)}}function g1(e){return yt(e)}var y1=(e,t)=>ce(e.innerType._def,t);var v1=(e,t,r)=>{switch(t){case M.ZodString:return hv(e,r);case M.ZodNumber:return c1(e,r);case M.ZodObject:return u1(e,r);case M.ZodBigInt:return Kj(e,r);case M.ZodBoolean:return Gj();case M.ZodDate:return ux(e,r);case M.ZodUndefined:return h1(r);case M.ZodNull:return i1(r);case M.ZodArray:return Bj(e,r);case M.ZodUnion:case M.ZodDiscriminatedUnion:return s1(e,r);case M.ZodIntersection:return Xj(e,r);case M.ZodTuple:return m1(e,r);case M.ZodRecord:return gv(e,r);case M.ZodLiteral:return Qj(e,r);case M.ZodEnum:return Yj(e);case M.ZodNativeEnum:return r1(e);case M.ZodNullable:return a1(e,r);case M.ZodOptional:return l1(e,r);case M.ZodMap:return t1(e,r);case M.ZodSet:return p1(e,r);case M.ZodLazy:return()=>e.getter()._def;case M.ZodPromise:return f1(e,r);case M.ZodNaN:case M.ZodNever:return n1(r);case M.ZodEffects:return Hj(e,r);case M.ZodAny:return yt(r);case M.ZodUnknown:return g1(r);case M.ZodDefault:return Jj(e,r);case M.ZodBranded:return mv(e,r);case M.ZodReadonly:return y1(e,r);case M.ZodCatch:return Wj(e,r);case M.ZodPipeline:return d1(e,r);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return(i=>{})(t)}};function ce(e,t,r=!1){let i=t.seen.get(e);if(t.override){let a=t.override?.(e,t,i,r);if(a!==Fj)return a}if(i&&!r){let a=M3(i,t);if(a!==void 0)return a}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let o=v1(e,e.typeName,t),s=typeof o=="function"?ce(o(),t):o;if(s&&L3(e,t,s),t.postProcess){let a=t.postProcess(s,e,t);return n.jsonSchema=s,a}return n.jsonSchema=s,s}var M3=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:pv(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,i)=>t.currentPath[i]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),yt(t)):t.$refStrategy==="seen"?yt(t):void 0}},L3=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);var fx=(e,t)=>{let r=Vj(t),i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:ce(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??yt(r)}),{}):void 0,n=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=ce(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??yt(r),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(o.title=s),r.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[r.openAiAnyTypeName]||(i[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=n===void 0?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]:o}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function U3(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function px(e,t){return oi(e)?As(e,{target:U3(t?.target),io:t?.pipeStrategy??"input"}):fx(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function mx(e){let r=$o(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let i=Jc(r);if(typeof i!="string")throw new Error("Schema method literal must be a string");return i}function hx(e,t){let r=vo(e,t);if(!r.success)throw r.error;return r.data}var q3=6e4,yv=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Zy,r=>{this._oncancel(r)}),this.setNotificationHandler(By,r=>{this._onprogress(r)}),this.setRequestHandler(Vy,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ky,async(r,i)=>{let n=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!n)throw new Y(ne.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Wy,async(r,i)=>{let n=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,i.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,f=new Y(d.error.code,d.error.message,d.error.data);l(f)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:i.requestId})}}let s=await this._taskStore.getTask(o,i.sessionId);if(!s)throw new Y(ne.InvalidParams,`Task not found: ${o}`);if(!bo(s.status))return await this._waitForTaskUpdate(o,i.signal),await n();if(bo(s.status)){let a=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[mo]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(Jy,async(r,i)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,i.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new Y(ne.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Yy,async(r,i)=>{try{let n=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!n)throw new Y(ne.InvalidParams,`Task not found: ${r.params.taskId}`);if(bo(n.status))throw new Y(ne.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!o)throw new Y(ne.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(n){throw n instanceof Y?n:new Y(ne.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,i,n,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let i=Date.now()-r.startTime;if(r.maxTotalTimeout&&i>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),Y.fromError(ne.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:i});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let i=this.transport?.onerror;this._transport.onerror=o=>{i?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{n?.(o,s),zd(o)||$j(o)?this._onresponse(o):D0(o)?this._onrequest(o,s):vj(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let i of this._timeoutInfo.values())clearTimeout(i.timeoutId);this._timeoutInfo.clear();for(let i of this._requestHandlerAbortControllers.values())i.abort();this._requestHandlerAbortControllers.clear();let r=Y.fromError(ne.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let i of t.values())i(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t,r){let i=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,n=this._transport,o=t.params?._meta?.[mo]?.taskId;if(i===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:ne.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);let a=hj(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,n?.sessionId):void 0,u={signal:s.signal,sessionId:n?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(s.signal.aborted)return;let d={relatedRequestId:t.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(s.signal.aborted)throw new Y(ne.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:t.id};o&&!p.relatedTask&&(p.relatedTask={taskId:o});let m=p.relatedTask?.taskId??o;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,p)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>i(t,u)).then(async l=>{if(s.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:ne.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===s&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...i}=t.params,n=Number(r),o=this._progressHandlers.get(n);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let s=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(c);return}o(i)}_onresponse(t){let r=Number(t.id),i=this._requestResolvers.get(r);if(i){if(this._requestResolvers.delete(r),zd(t))i(t);else{let s=new Y(t.error.code,t.error.message,t.error.data);i(s)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(zd(t)&&t.result&&typeof t.result=="object"){let s=t.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),zd(t))n(t);else{let s=Y.fromError(t.error.code,t.error.message,t.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,i){let{task:n}=i??{};if(!n){try{yield{type:"result",result:await this.request(t,r,i)}}catch(s){yield{type:"error",error:s instanceof Y?s:new Y(ne.InternalError,String(s))}}return}let o;try{let s=await this.request(t,Rc,i);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new Y(ne.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:a},bo(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,i)}:a.status==="failed"?yield{type:"error",error:new Y(ne.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new Y(ne.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,i)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),i?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof Y?s:new Y(ne.InternalError,String(s))}}}request(t,r,i){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:c}=i??{};return new Promise((u,l)=>{let d=v=>{l(v)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(v){d(v);return}i?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};i?.onprogress&&(this._progressHandlers.set(f,i.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),a&&(p.params={...p.params,task:a}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[mo]:c}});let m=v=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(v)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(_=>this._onerror(new Error(`Failed to send cancellation: ${_}`)));let $=v instanceof Y?v:new Y(ne.RequestTimeout,String(v));l($)};this._responseHandlers.set(f,v=>{if(!i?.signal?.aborted){if(v instanceof Error)return l(v);try{let $=vo(r,v.result);$.success?u($.data):l($.error)}catch($){l($)}}}),i?.signal?.addEventListener("abort",()=>{m(i?.signal?.reason)});let h=i?.timeout??q3,g=()=>m(Y.fromError(ne.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,i?.maxTotalTimeout,g,i?.resetTimeoutOnProgress??!1);let y=c?.taskId;if(y){let v=$=>{let _=this._responseHandlers.get(f);_?_($):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,v),this._enqueueTaskMessage(y,{type:"request",message:p,timestamp:Date.now()}).catch($=>{this._cleanupTimeout(f),l($)})}else this._transport.send(p,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(v=>{this._cleanupTimeout(f),l(v)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Gy,r)}async getTaskResult(t,r,i){return this.request({method:"tasks/result",params:t},r,i)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Hy,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},wj,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let i=r?.relatedTask?.taskId;if(i){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[mo]:r.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[mo]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[mo]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(t,r){let i=mx(t);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(n,o)=>{let s=hx(t,n);return Promise.resolve(r(s,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let i=mx(t);this._notificationHandlers.set(i,n=>{let o=hx(t,n);return Promise.resolve(r(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,i){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,i,n)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let i=await this._taskMessageQueue.dequeueAll(t,r);for(let n of i)if(n.type==="request"&&D0(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);s?(s(new Y(ne.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let i=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(t);n?.pollInterval&&(i=n.pollInterval)}catch{}return new Promise((n,o)=>{if(r.aborted){o(new Y(ne.InvalidRequest,"Request cancelled"));return}let s=setTimeout(n,i);r.addEventListener("abort",()=>{clearTimeout(s),o(new Y(ne.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let i=this._taskStore;if(!i)throw new Error("No task store configured");return{createTask:async n=>{if(!t)throw new Error("No request provided");return await i.createTask(n,t.id,{method:t.method,params:t.params},r)},getTask:async n=>{let o=await i.getTask(n,r);if(!o)throw new Y(ne.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await i.storeTaskResult(n,o,s,r);let a=await i.getTask(n,r);if(a){let c=Ud.parse({method:"notifications/tasks/status",params:a});await this.notification(c),bo(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>i.getTaskResult(n,r),updateTaskStatus:async(n,o,s)=>{let a=await i.getTask(n,r);if(!a)throw new Y(ne.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(bo(a.status))throw new Y(ne.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(n,o,s,r);let c=await i.getTask(n,r);if(c){let u=Ud.parse({method:"notifications/tasks/status",params:c});await this.notification(u),bo(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>i.listTasks(n,r)}}};function $1(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function b1(e,t){let r={...e};for(let i in t){let n=i,o=t[n];if(o===void 0)continue;let s=r[n];$1(s)&&$1(o)?r[n]={...s,...o}:r[n]=o}return r}var N4=gr(oL(),1),C4=gr(O4(),1);function Gie(){let e=new N4.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,C4.default)(e),e}var R$=class{constructor(t){this._ajv=t??Gie()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return i=>r(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var E$=class{constructor(t){this._server=t}requestStream(t,r,i){return this._server.requestStream(t,r,i)}createMessageStream(t,r){let i=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!i?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(s){if(o.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(f=>f.type==="tool_use").map(f=>f.id)),d=new Set(o.filter(f=>f.type==="tool_result").map(f=>f.toolUseId));if(l.size!==d.size||![...l].every(f=>d.has(f)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Zd,r)}elicitInputStream(t,r){let i=this._server.getClientCapabilities(),n=t.mode??"form";switch(n){case"url":{if(!i?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!i?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=n==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:o},Nc,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,i){return this._server.getTaskResult({taskId:t},r,i)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function z4(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function j4(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var O$=class extends yv{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Fd.options.map((i,n)=>[i,n])),this.isMessageIgnored=(i,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new R$,this.setRequestHandler(U0,i=>this._oninitialize(i)),this.setNotificationHandler(q0,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(W0,async(i,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=i.params,a=Fd.safeParse(s);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new E$(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=b1(this._capabilities,t)}setRequestHandler(t,r){let n=$o(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let o=Jc(n);if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let a=async(c,u)=>{let l=vo(Oc,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new Y(ne.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let m=vo(Rc,f);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new Y(ne.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let p=vo(iv,f);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new Y(ne.InvalidParams,`Invalid tools/call result: ${m}`)}return p.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){j4(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&z4(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:fj.includes(r)?r:z0,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Fy)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],n=Array.isArray(i.content)?i.content:[i.content],o=n.some(u=>u.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some(u=>u.type==="tool_use");if(o){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},J0,r):this.request({method:"sampling/createMessage",params:t},Zd,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=t;return this.request({method:"elicitation/create",params:n},Nc,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=t.mode==="form"?t:{...t,mode:"form"},o=await this.request({method:"elicitation/create",params:n},Nc,r);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!a.valid)throw new Y(ne.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(s){throw s instanceof Y?s:new Y(ne.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},H0,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var M4=Symbol.for("mcp.completable");function KT(e){return!!e&&typeof e=="object"&&M4 in e}function L4(e){return e[M4]?.complete}var D4;(function(e){e.Completable="McpCompletable"})(D4||(D4={}));var Wie=/^[A-Za-z0-9._-]{1,128}$/;function Jie(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Wie.test(e)){let r=e.split("").filter(i=>!/[A-Za-z0-9._-]/.test(i)).filter((i,n,o)=>o.indexOf(i)===n);return t.push(`Tool name contains invalid characters: ${r.map(i=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function Hie(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function GT(e){let t=Jie(e);return Hie(e,t.warnings),t.isValid}var N$=class{constructor(t){this._mcpServer=t}registerToolTask(t,r,i){let n={taskSupport:"required",...r.execution};if(n.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,n,r._meta,i)}};var C$=class{constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new O$(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new N$(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(jo(nv)),this.server.assertCanSetRequestHandler(jo(Oc)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(nv,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let i={name:t,title:r.title,description:r.description,inputSchema:(()=>{let n=Wc(r.inputSchema);return n?px(n,{strictUnions:!0,pipeStrategy:"input"}):Yie})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let n=Wc(r.outputSchema);n&&(i.outputSchema=px(n,{strictUnions:!0,pipeStrategy:"output"}))}return i})})),this.server.setRequestHandler(Oc,async(t,r)=>{try{let i=this._registeredTools[t.params.name];if(!i)throw new Y(ne.InvalidParams,`Tool ${t.params.name} not found`);if(!i.enabled)throw new Y(ne.InvalidParams,`Tool ${t.params.name} disabled`);let n=!!t.params.task,o=i.execution?.taskSupport,s="createTask"in i.handler;if((o==="required"||o==="optional")&&!s)throw new Y(ne.InternalError,`Tool ${t.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!n)throw new Y(ne.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!n&&s)return await this.handleAutomaticTaskPolling(i,t,r);let a=await this.validateToolInput(i,t.params.arguments,t.params.name),c=await this.executeToolHandler(i,a,r);return n||await this.validateToolOutput(i,c,t.params.name),c}catch(i){if(i instanceof Y&&i.code===ne.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,i){if(!t.inputSchema)return;let o=Wc(t.inputSchema)??t.inputSchema,s=await dv(o,r);if(!s.success){let a="error"in s?s.error:"Unknown error",c=fv(a);throw new Y(ne.InvalidParams,`Input validation error: Invalid arguments for tool ${i}: ${c}`)}return s.data}async validateToolOutput(t,r,i){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new Y(ne.InvalidParams,`Output validation error: Tool ${i} has an output schema but no structured content was provided`);let n=Wc(t.outputSchema),o=await dv(n,r.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",a=fv(s);throw new Y(ne.InvalidParams,`Output validation error: Invalid structured content for tool ${i}: ${a}`)}}async executeToolHandler(t,r,i){let n=t.handler;if("createTask"in n){if(!i.taskStore)throw new Error("No task store provided.");let s={...i,taskStore:i.taskStore};if(t.inputSchema){let a=n;return await Promise.resolve(a.createTask(r,s))}else{let a=n;return await Promise.resolve(a.createTask(s))}}if(t.inputSchema){let s=n;return await Promise.resolve(s(r,i))}else{let s=n;return await Promise.resolve(s(i))}}async handleAutomaticTaskPolling(t,r,i){if(!i.taskStore)throw new Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(t,r.params.arguments,r.params.name),o=t.handler,s={...i,taskStore:i.taskStore},a=n?await Promise.resolve(o.createTask(n,s)):await Promise.resolve(o.createTask(s)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(f=>setTimeout(f,l));let d=await i.taskStore.getTask(c);if(!d)throw new Y(ne.InternalError,`Task ${c} not found during polling`);u=d}return await i.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(jo(ov)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ov,async t=>{switch(t.params.ref.type){case"ref/prompt":return Tj(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Aj(t),this.handleResourceCompletion(t,t.params.ref);default:throw new Y(ne.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let i=this._registeredPrompts[r.name];if(!i)throw new Y(ne.InvalidParams,`Prompt ${r.name} not found`);if(!i.enabled)throw new Y(ne.InvalidParams,`Prompt ${r.name} disabled`);if(!i.argsSchema)return cp;let o=$o(i.argsSchema)?.[t.params.argument.name];if(!KT(o))return cp;let s=L4(o);if(!s)return cp;let a=await s(t.params.argument.value,t.params.context);return q4(a)}async handleResourceCompletion(t,r){let i=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!i){if(this._registeredResources[r.uri])return cp;throw new Y(ne.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let n=i.resourceTemplate.completeCallback(t.params.argument.name);if(!n)return cp;let o=await n(t.params.argument.value,t.params.context);return q4(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(jo(Xy)),this.server.assertCanSetRequestHandler(jo(Qy)),this.server.assertCanSetRequestHandler(jo(ev)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Xy,async(t,r)=>{let i=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(r);for(let a of s.resources)n.push({...o.metadata,...a})}return{resources:[...i,...n]}}),this.server.setRequestHandler(Qy,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,i])=>({name:r,uriTemplate:i.resourceTemplate.uriTemplate.toString(),...i.metadata}))})),this.server.setRequestHandler(ev,async(t,r)=>{let i=new URL(t.params.uri),n=this._registeredResources[i.toString()];if(n){if(!n.enabled)throw new Y(ne.InvalidParams,`Resource ${i} disabled`);return n.readCallback(i,r)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(i.toString());if(s)return o.readCallback(i,s,r)}throw new Y(ne.InvalidParams,`Resource ${i} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(jo(tv)),this.server.assertCanSetRequestHandler(jo(rv)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(tv,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?Xie(r.argsSchema):void 0}))})),this.server.setRequestHandler(rv,async(t,r)=>{let i=this._registeredPrompts[t.params.name];if(!i)throw new Y(ne.InvalidParams,`Prompt ${t.params.name} not found`);if(!i.enabled)throw new Y(ne.InvalidParams,`Prompt ${t.params.name} disabled`);if(i.argsSchema){let n=Wc(i.argsSchema),o=await dv(n,t.params.arguments);if(!o.success){let c="error"in o?o.error:"Unknown error",u=fv(c);throw new Y(ne.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${u}`)}let s=o.data,a=i.callback;return await Promise.resolve(a(s,r))}else{let n=i.callback;return await Promise.resolve(n(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...i){let n;typeof i[0]=="object"&&(n=i.shift());let o=i[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,void 0,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,void 0,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,r,i,n){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(t,i.title,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let o=this._createRegisteredResourceTemplate(t,i.title,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(t,r,i,n,o){let s={name:t,title:r,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==i&&(delete this._registeredResources[i],a.uri&&(this._registeredResources[a.uri]=s)),typeof a.name<"u"&&(s.name=a.name),typeof a.title<"u"&&(s.title=a.title),typeof a.metadata<"u"&&(s.metadata=a.metadata),typeof a.callback<"u"&&(s.readCallback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[i]=s,s}_createRegisteredResourceTemplate(t,r,i,n,o){let s={resourceTemplate:i,title:r,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==t&&(delete this._registeredResourceTemplates[t],u.name&&(this._registeredResourceTemplates[u.name]=s)),typeof u.title<"u"&&(s.title=u.title),typeof u.template<"u"&&(s.resourceTemplate=u.template),typeof u.metadata<"u"&&(s.metadata=u.metadata),typeof u.callback<"u"&&(s.readCallback=u.callback),typeof u.enabled<"u"&&(s.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=s;let a=i.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!i.completeCallback(u))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,i,n,o){let s={title:r,description:i,argsSchema:n===void 0?void 0:Ds(n),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==t&&(delete this._registeredPrompts[t],a.name&&(this._registeredPrompts[a.name]=s)),typeof a.title<"u"&&(s.title=a.title),typeof a.description<"u"&&(s.description=a.description),typeof a.argsSchema<"u"&&(s.argsSchema=Ds(a.argsSchema)),typeof a.callback<"u"&&(s.callback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=s,n&&Object.values(n).some(c=>{let u=c instanceof Ns?c._def?.innerType:c;return KT(u)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,r,i,n,o,s,a,c,u){GT(t);let l={title:r,description:i,inputSchema:U4(n),outputSchema:U4(o),annotations:s,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(typeof d.name=="string"&>(d.name),delete this._registeredTools[t],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=Ds(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Ds(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let i,n,o,s;if(typeof r[0]=="string"&&(i=r.shift()),r.length>1){let c=r[0];if(WT(c))n=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!WT(r[0])&&(s=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let a=r[0];return this._createRegisteredTool(t,void 0,i,n,o,s,{taskSupport:"forbidden"},void 0,a)}registerTool(t,r,i){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:n,description:o,inputSchema:s,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(t,n,o,s,a,c,{taskSupport:"forbidden"},u,i)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let i;typeof r[0]=="string"&&(i=r.shift());let n;r.length>1&&(n=r.shift());let o=r[0],s=this._createRegisteredPrompt(t,void 0,i,n,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,r,i){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:n,description:o,argsSchema:s}=r,a=this._createRegisteredPrompt(t,n,o,s,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Yie={type:"object",properties:{}};function F4(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function Z4(e){return"_def"in e||"_zod"in e||F4(e)}function WT(e){return typeof e!="object"||e===null||Z4(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(F4)}function U4(e){if(e){if(WT(e))return Ds(e);if(!Z4(e))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}}function Xie(e){let t=$o(e);return t?Object.entries(t).map(([r,i])=>{let n=Lj(i),o=Uj(i);return{name:r,description:n,required:!o}}):[]}function jo(e){let r=$o(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let i=Jc(r);if(typeof i=="string")return i;throw new Error("Schema method literal must be a string")}function q4(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var cp={completion:{values:[],hasMore:!1}};import{existsSync as Qie,readFileSync as eoe}from"node:fs";import{dirname as V4,join as B4}from"node:path";import{fileURLToPath as toe}from"node:url";function JT(e=toe(import.meta.url)){let t=V4(e);for(;;){if(Qie(B4(t,"package.json")))return t;let r=V4(t);if(r===t)throw new Error(`No package.json above ${e}`);t=r}}function K4(){return JSON.parse(eoe(B4(JT(),"package.json"),"utf8")).version??"0.0.0"}function Do(e,t,r){if(t==="off"){let a=r.filter(c=>!c.passed&&c.warnOnly);return{gate:e,mode:t,outcome:a.length>0?"warned":"skipped",blocking:[],warnings:a}}let i=r.filter(a=>!a.passed),n=t==="block"?i.filter(a=>!a.warnOnly):[],o=i.filter(a=>!n.includes(a)),s=n.length>0?"blocked":o.length>0?"warned":"passed";return{gate:e,mode:t,outcome:s,blocking:n,warnings:o}}var roe=new Set(["parent-approved","parent-pinned","link-approved"]);function J4(e,t){let r=s=>roe.has(s.id)&&s.about!==void 0&&t.has(s.about),i=e.blocking.filter(s=>!r(s)),n=e.warnings.filter(s=>!r(s)),o=e.outcome==="skipped"?"skipped":i.length>0?"blocked":n.length>0?"warned":"passed";return{...e,outcome:o,blocking:i,warnings:n}}function on(e,t){if(e.outcome==="passed"||e.outcome==="skipped")return"";let r=[],i=n=>n.forEach((o,s)=>{r.push(`${s+1}. ${o.message}`),o.remedy&&r.push(` To fix: ${o.remedy}`)});return e.outcome==="blocked"?(r.push(`${G4(t)} refused by the ${e.gate} gate: ${W4(e.blocking.length,"check")} failed.`),i(e.blocking),e.warnings.length>0&&(r.push("Also:"),i(e.warnings))):(r.push(`${G4(t)} goes ahead with ${W4(e.warnings.length,"warning")} from the ${e.gate} gate:`),i(e.warnings)),r.join(`
|
|
221
|
+
`)}var G4=e=>e.charAt(0).toUpperCase()+e.slice(1),W4=(e,t)=>`${e} ${t}${e===1?"":"s"}`;var Nb=gr(Kr(),1);import{existsSync as Rue,readFileSync as Eue}from"node:fs";var N=(e,t=[])=>({ok:!0,value:e,problems:t}),I=(...e)=>({ok:!1,problems:e}),ie=e=>`{{bk:${e}}}`;function Tr(e,t,r){return e.map(i=>{let n=i.path.length>0?Oue(i.path):"(top level)";return{code:r,path:t,message:`${t}: ${n} ${Nue(i)}.`}})}function Oue(e){return e.map((t,r)=>typeof t=="number"?`[${t}]`:`${r>0?".":""}${String(t)}`).join("")}function Nue(e){return e.code==="invalid_type"?/received undefined/.test(e.message)?"is required":`must be ${{object:"a set of named fields",array:"a list",boolean:"true or false",string:"text",number:"a number",int:"a whole number"}[e.expected]??e.expected}`:Cue(e.message)}var Cue=e=>e.charAt(0).toLowerCase()+e.slice(1).replace(/\.$/,"");function Lu(e,t,r,i){if(!Rue(e))return I({code:`${i}-missing`,path:t,message:`${t} was not found at ${e}.`});let n;try{n=(0,Nb.parse)(Eue(e,"utf8"))}catch(s){let a=s instanceof Nb.YAMLParseError?s.message.split(`
|
|
222
|
+
`)[0]:String(s);return I({code:`${i}-unreadable`,path:t,message:`${t} is not valid YAML: ${a}`})}let o=r.safeParse(n??{});return o.success?N(o.data):I(...Tr(o.error.issues,t,`${i}-invalid`))}var pa=[{type:"idea",dir:"ideas",file:"idea.md",parent:"none"},{type:"epic",dir:"epics",file:"epic.md",parent:"required"},{type:"story",dir:"stories",file:"story.md",parent:"required"},{type:"task",dir:"tasks",file:"task.md",parent:"required"},{type:"bug",dir:"bugs",file:"bug.md",parent:"optional"},{type:"adhoc",dir:"adhoc",file:"adhoc.md",parent:"none"}],tr=["task","story","bug","adhoc"],ee={type:"test-plan",dir:"test-plan",file:"plan.md",idSuffix:"-TP"},fa={type:"design",dir:"design",file:"design.md",idSuffix:"-DD"},Cb=[{type:ee.type,dir:ee.dir,file:ee.file,suffix:"TP"},{type:fa.type,dir:fa.dir,file:fa.file,suffix:"DD"}],Uu=["versions","approvals","completions","repins"];var qu=gr(Kr(),1);import{createHash as zue}from"node:crypto";var Up="versions",Gn="approvals",ma="onboard.md",gi="sources",Zi=(e,t)=>`${e}/${Up}/v${t}.md`,Vi=(e,t)=>`${e}/${Gn}/v${t}.yaml`,qp=(e,t)=>`${e}/${Gn}/v${t}-pending.yaml`,LF=e=>`${e}/${ma}`,ha=e=>`${e}/${gi}`,Fu=/^v(0|[1-9][0-9]*)\.yaml$/,Zu=/^v(0|[1-9][0-9]*)-pending\.yaml$/,UF=/^v(0|[1-9][0-9]*)\.md$/,MF=b.string().regex(/^sha256:[0-9a-f]{64}$/,"must be sha256: followed by 64 hex digits"),Lp=b.number().int().nonnegative(),jue=b.object({artifact:b.string().min(1),version:Lp,hash:MF,approvedBy:b.string().min(1),approvedAt:b.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),template:b.object({type:b.string().min(1),version:b.number().int().positive(),source:b.enum(["tree","org","built-in"]),org:b.string().min(1).optional()}).optional(),onboarded:b.literal(!0).optional(),baseline:b.record(b.string(),b.string().regex(/^[0-9a-f]{7,64}$/,"must be a commit ID")).optional(),sources:b.record(b.string(),MF).optional(),empty:b.array(b.string().min(1)).optional(),completes:Lp.optional(),parent:b.string().min(1).optional(),pins:b.record(b.string(),Lp).optional(),related:b.record(b.string(),Lp).optional(),changes:b.record(b.string(),Lp).optional(),draftId:b.string().min(1).optional()}).superRefine((e,t)=>{let r=(i,n)=>t.addIssue({code:"custom",path:[i],message:n});if(e.version===0){e.onboarded!==!0&&r("onboarded","must be true: version 0 describes code as it was before BuildKeel"),e.completes!==void 0&&r("completes","is for a version after version 0");return}e.onboarded!==void 0&&r("onboarded","is only for version 0"),e.template||r("template","is required for every version after version 0");for(let i of["baseline","sources","empty"])e[i]!==void 0&&r(i,"is only for version 0");e.completes!==void 0&&e.completes>=e.version&&r("completes",`must name a version before ${e.version}`)});function yi(e){return`sha256:${zue("sha256").update(e.replace(/\r\n/g,`
|
|
223
|
+
`),"utf8").digest("hex")}`}function RR(e){let{template:t}=e,r={artifact:e.artifact,version:e.version,hash:e.hash,approvedBy:e.approvedBy,approvedAt:e.approvedAt,...t?{template:{type:t.type,version:t.version,source:t.source,...t.org?{org:t.org}:{}}}:{},...e.onboarded?{onboarded:!0}:{},...e.baseline&&Object.keys(e.baseline).length>0?{baseline:e.baseline}:{},...e.sources&&Object.keys(e.sources).length>0?{sources:e.sources}:{},...e.empty&&e.empty.length>0?{empty:e.empty}:{},...e.completes!==void 0?{completes:e.completes}:{},...e.parent?{parent:e.parent}:{},...e.pins&&Object.keys(e.pins).length>0?{pins:e.pins}:{},...e.related&&Object.keys(e.related).length>0?{related:e.related}:{},...e.changes&&Object.keys(e.changes).length>0?{changes:e.changes}:{},...e.draftId?{draftId:e.draftId}:{}};return(0,qu.stringify)(r,{lineWidth:0})}function ga(e,t){let r;try{r=(0,qu.parse)(e)}catch(n){let o=n instanceof qu.YAMLParseError?n.message.split(`
|
|
224
|
+
`)[0]:String(n);return I({code:"record-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=jue.safeParse(r??{});return i.success?N(i.data):I(...Tr(i.error.issues,t,"record-invalid"))}var Mb=["approve","start","done","lock"],Due=["block","warn","off"],jb="buildkeel.yaml",zb=e=>pa.find(t=>t.type===e)?.dir??e,Db=[{type:"idea",name:"business idea",prefix:"BI",width:2,core:!0,dir:zb("idea"),requires:[]},{type:"epic",name:"epic",prefix:"EP",width:2,core:!0,dir:zb("epic"),requires:["design"]},{type:"story",name:"user story",prefix:"US",width:3,core:!0,dir:zb("story"),requires:["test-plan"]},{type:"task",name:"task",prefix:"TK",width:3,core:!0,dir:zb("task"),requires:[]}],Mue=["idea","epic","story"],Lue={"test-plan":"test plan",design:"design document"},ZF=Cb.map(e=>({...e,name:Lue[e.type]??e.type,builtIn:!0})),VF=new Set(["bug","adhoc",...Cb.map(e=>e.type)]),Uue=new Set([...pa.map(e=>e.dir),"templates",...Cb.map(e=>e.dir)]),vt={chain:Db.map(e=>({...e,requires:[...e.requires]})),bug:{type:"bug",name:"bug",prefix:"BUG",width:3},adhoc:{type:"adhoc",name:"ad-hoc unit",prefix:"AH",width:3},documents:ZF.map(e=>({...e})),gates:{approve:"block",start:"block",done:"block",lock:"block"},onboardedLetter:"E"},BF=b.string().regex(/^[A-Z][A-Z0-9]{0,7}$/,"must be 1 to 8 capital letters or digits, starting with a letter"),KF=b.number().int().min(1).max(6),Fp=b.string().regex(/^[a-z][a-z0-9-]*$/,"must be lowercase letters, digits and hyphens"),que=b.object({type:Fp,name:b.string().min(1).optional(),prefix:BF.optional(),width:KF.optional(),dir:Fp.optional(),requires:b.array(Fp).optional()}),Fue=b.object({type:Fp,name:b.string().min(1).optional(),suffix:b.string().regex(/^[A-Z]{2,4}$/,"must be 2 to 4 capital letters").optional(),dir:Fp.optional()}),qF=b.object({name:b.string().min(1).optional(),prefix:BF.optional(),width:KF.optional()}),Zue=b.object({chain:b.array(que).min(1).optional(),bug:qF.optional(),adhoc:qF.optional(),documents:b.array(Fue).optional(),gates:b.record(b.string(),b.unknown()).optional(),onboarded:b.object({letter:b.string().regex(/^[A-Z]$/,"must be one capital letter, such as E")}).optional()});function FF(e,t){if(e.input===void 0||e.input===null)return{};let r=e.file===jb?"process.":"",i=Zue.safeParse(e.input);if(!i.success){let n=`${e.file}: `;return t.push(...Tr(i.error.issues,e.file,"process-invalid").map(o=>({...o,message:o.message.startsWith(n)?`${n}${r}${o.message.slice(n.length)}`:o.message}))),{}}for(let[n,o]of Object.entries(i.data.gates??{})){let s=a=>t.push({code:"process-invalid",path:e.file,message:`${e.file}: ${r}gates${a}`});/^stale(ness)?$/.test(n)?s(`.${n}: a spec tree that is behind its remote only ever warns, so it has no mode.`):Mb.includes(n)?Due.includes(o)||s(`.${n} must be block, warn or off, not ${JSON.stringify(o)}.`):s(` has no gate called ${n}. The gates are ${Mb.join(", ")}.`)}return i.data}function Zp(e,t){if(e==null&&!t)return N(structuredClone(vt));let r=[],i=FF({input:e,file:jb},r),n=t?FF(t,r):{};if(r.length>0)return I(...r);let o=i.chain||!t||!n.chain?jb:t.file,s=k=>r.push({code:"process-invalid",path:o,message:`${o}: ${k}`}),a=new Map(Db.map(k=>[k.type,k])),c=i.chain??n.chain??Db.map(k=>({type:k.type})),u=[],l=new Set;for(let k of c){if(l.has(k.type)){s(`the process lists the ${k.type} stage twice.`);continue}l.add(k.type);let T=a.get(k.type);if(!T&&VF.has(k.type)){s(`${k.type} is not a stage: bugs, ad-hoc units, test plans and design documents sit outside the chain.`);continue}let C=k.prefix??T?.prefix;if(!C){s(`the ${k.type} stage needs a prefix for its IDs.`);continue}T&&k.dir&&k.dir!==T.dir&&s(`the ${k.type} stage keeps its directory, ${T.dir}; only stages a team adds choose one.`),u.push({type:k.type,name:k.name??T?.name??k.type,prefix:C,width:k.width??T?.width??3,core:T!==void 0,dir:T?.dir??k.dir??k.type,requires:[...k.requires??T?.requires??[]]})}for(let k of Mue)l.has(k)||s(`the process has no ${a.get(k)?.name} stage. Business idea, epic and user story are required; they can be renamed but not removed.`);let d=u.filter(k=>k.core).map(k=>k.type),f=Db.map(k=>k.type).filter(k=>d.includes(k));if(d.join()!==f.join())s(`the core stages must stay in the order ${f.join(", ")}; added stages can go between them.`);else{let k=T=>u.findIndex(C=>C.type===T);for(let[T,C]of u.entries())C.core||T>k("idea")&&T<k("story")||s(`the ${C.type} stage must sit between the business idea and the user story. Work is done on stories and tasks, so nothing is added below a story.`)}let p=new Map;for(let k of u.filter(T=>!T.core)){let T=p.get(k.dir);Uue.has(k.dir)?s(`the ${k.type} stage cannot use the directory ${k.dir}, which BuildKeel uses for something else. Set its dir to another name.`):T?s(`the ${T} and ${k.type} stages both use the directory ${k.dir}. Each stage needs its own.`):p.set(k.dir,k.type)}let m=k=>{let T=i[k]??n[k]??{},C=vt[k];return{type:k,name:T.name??C.name,prefix:T.prefix??C.prefix,width:T.width??C.width}},h={...vt.gates,...n.gates,...i.gates},g=i.documents||!t||!n.documents?jb:t.file,y=Vue(i.documents??n.documents??[],u,k=>r.push({code:"process-invalid",path:g,message:`${g}: ${k}`})),v=i.onboarded?.letter??n.onboarded?.letter??vt.onboardedLetter,$={chain:u,bug:m("bug"),adhoc:m("adhoc"),documents:y,gates:h,onboardedLetter:v},_=new Set(y.map(k=>k.type));for(let k of u){let T=new Set;for(let C of k.requires)T.has(C)?s(`the ${k.type} stage requires ${C} twice.`):_.has(C)||s(`the ${k.type} stage requires ${C}, which is not a document type. The document types are ${[..._].join(", ")}.`),T.add(C)}let w=new Map;for(let k of[...$.chain,$.bug,$.adhoc]){let T=w.get(k.prefix);T?s(`the ${T} and ${k.name} types both use the prefix ${k.prefix}. Each type needs its own.`):w.set(k.prefix,k.name)}return r.length>0?I(...r):N($)}function Vue(e,t,r){let i=ZF.map(a=>({...a})),n=new Set;for(let a of e){if(n.has(a.type)){r(`the process lists the ${a.type} document twice.`);continue}n.add(a.type);let c=i.find(l=>l.builtIn&&l.type===a.type);if(c){a.suffix&&a.suffix!==c.suffix&&r(`the ${a.type} document keeps its suffix, ${c.suffix}; only documents a team adds choose one.`),a.dir&&a.dir!==c.dir&&r(`the ${a.type} document keeps its directory, ${c.dir}; only documents a team adds choose one.`),a.name&&(c.name=a.name);continue}if(VF.has(a.type)||t.some(l=>l.type===a.type)){r(`${a.type} cannot be a document type: a stage, bugs or ad-hoc units already use the name.`);continue}if(!a.suffix){r(`the ${a.type} document needs a suffix for its IDs, such as ${a.type.slice(0,2).toUpperCase()}.`);continue}let u=a.dir??a.type;if(Uu.includes(u)||u===gi){r(`the ${a.type} document cannot use the directory ${u}, which holds an artifact's records. Set its dir to another name.`);continue}i.push({type:a.type,name:a.name??a.type.replace(/-/g," "),suffix:a.suffix,dir:u,file:`${a.type}.md`,builtIn:!1})}let o=new Map,s=new Map;for(let a of i){let c=o.get(a.suffix),u=s.get(a.dir);c?r(`the ${c} and ${a.type} documents both use the suffix ${a.suffix}. Each document needs its own.`):o.set(a.suffix,a.type),u?r(`the ${u} and ${a.type} documents both use the directory ${a.dir}. Each document needs its own.`):s.set(a.dir,a.type)}return i}var Lb=(e,t)=>e.documents.find(r=>r.type===t);function ya(e,t,r=""){return`${e.prefix}-${r}${String(t).padStart(e.width,"0")}`}function Vp(e,t){let r=e.chain.findIndex(i=>i.type===t);return r>0?e.chain[r-1]??null:null}var Ub=(e,t)=>e.chain.some(r=>r.type===t&&!r.core);import{existsSync as ple,statSync as mle}from"node:fs";import{join as hle}from"node:path";import{existsSync as Bue}from"node:fs";import{homedir as Kue}from"node:os";import{isAbsolute as GF,join as JF,resolve as ER}from"node:path";function Wo(e=process.env){return e.BUILDKEEL_HOME?ER(e.BUILDKEEL_HOME):JF(Kue(),".buildkeel")}var WF="paths.yaml",Gue=b.object({specs:b.record(b.string(),b.string().min(1)).default({}),repos:b.record(b.string(),b.string().min(1)).default({})});function qb(e=Wo()){let t=JF(e,WF);if(!Bue(t))return N({specs:{},repos:{}});let r=Lu(t,`~/.buildkeel/${WF}`,Gue,"machine-paths");if(!r.ok)return r;for(let[i,n]of Object.entries(r.value.specs))GF(n)||(r.value.specs[i]=ER(e,n));for(let[i,n]of Object.entries(r.value.repos))GF(n)||(r.value.repos[i]=ER(e,n));return r}import{join as Wue}from"node:path";var wt="buildkeel.yaml",HF=1e4,Jue=b.object({name:b.string().min(1),remote:b.string().min(1).optional(),baseline:b.string().regex(/^[0-9a-f]{7,64}$/,"must be a commit ID").optional()}),Hue=b.object({source:b.string().min(1),version:b.union([b.string(),b.number()]).transform(String).optional()}),Yue=b.object({autoPush:b.boolean().default(!1),idsBranch:b.string().min(1).default("buildkeel/ids"),contextBudget:b.number().int().positive().default(HF)}),Xue=b.object({format:b.number().int("must be a whole number").positive("must be 1 or higher"),name:b.string().min(1).optional(),process:b.record(b.string(),b.unknown()).optional(),templates:b.object({org:Hue.optional()}).optional(),repos:b.array(Jue).default([]).superRefine((e,t)=>{let r=new Set;e.forEach((i,n)=>{r.has(i.name)&&t.addIssue({code:"custom",path:[n,"name"],message:`repeats the repo name "${i.name}"`}),r.add(i.name)})}),settings:Yue.default({autoPush:!1,idsBranch:"buildkeel/ids",contextBudget:HF})});function Jo(e){return Lu(Wue(e,wt),wt,Xue,"spec-config")}var Vb=gr(Kr(),1);import{execFileSync as Que}from"node:child_process";import{createHash as ele,randomBytes as tle}from"node:crypto";import{existsSync as zR,mkdirSync as rle,readFileSync as nle,renameSync as ile,rmSync as YF}from"node:fs";import{isAbsolute as ole,join as Fb,resolve as sle}from"node:path";var Bp="templates",QF="process.yaml",ale="org-templates",cle=new Set(["latest","head","main","master","trunk","develop"]),XF=3e4,ule=6e4,lle=e=>!/^[a-z][a-z0-9+.-]*:\/\//i.test(e)&&!/^[^/\\]+@[^/\\]+:/.test(e)&&!/^[a-z0-9.-]+:[^\\]/i.test(e),jR=(e,t)=>lle(t)&&!ole(t)?sle(e,t):t,eZ=(e,t)=>`${e}@${t}`;function dle(e){let t=e.version?.trim()??"",r="Set templates.org.version in buildkeel.yaml to one of the organization's release tags, such as v1.2.0, and change it only to move to another release.";return t===""?{code:"org-unpinned",path:"buildkeel.yaml",message:`buildkeel.yaml: templates.org names ${e.source} with no version. Organization templates are always pinned to a tag, so that they change only when the team changes the version.`,remedy:r}:cle.has(t.toLowerCase())?{code:"org-unpinned",path:"buildkeel.yaml",message:`buildkeel.yaml: templates.org.version is ${t}, which follows whatever is newest. Organization templates are pinned to a fixed tag.`,remedy:r}:null}function DR(e,t,r){let i=ele("sha256").update(t).digest("hex").slice(0,16);return Fb(e,ale,i,r.replace(/[^A-Za-z0-9._-]/g,"_"))}var OR=new Map;function NR(e,t){try{return{ok:!0,stdout:Que("git",e,{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"],timeout:XF,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}}catch(r){let i=r;return{ok:!1,stderr:i.signal==="SIGTERM"?`timed out after ${XF/1e3} seconds`:String(i.stderr??r)}}}function MR(e,t,r,i){let n=dle(r);if(n)return I(n);let o=r.version.trim(),s=jR(t,r.source),a=eZ(r.source,o),c=DR(e,s,o);if(zR(c))return N({source:r.source,version:o,dir:c,label:a});let u=OR.get(c);if(u&&(!i.fetch||Date.now()-u.at<ule))return I(u.problem);if(!i.fetch)return I({code:"org-unavailable",path:"buildkeel.yaml",message:`The organization templates ${a} are not on this machine yet.`,remedy:"They are fetched the next time BuildKeel's server works in this project with a connection to the source."});let l=fle(s,o,c,r.source);return l.ok?(OR.delete(c),N({source:r.source,version:o,dir:c,label:a})):(OR.set(c,{at:Date.now(),problem:l.problems[0]}),l)}function fle(e,t,r,i){let n=eZ(i,t),o=Fb(r,"..");rle(o,{recursive:!0});let s=Fb(o,`.fetch-${tle(4).toString("hex")}`),a=(d,f)=>(YF(s,{recursive:!0,force:!0,maxRetries:5,retryDelay:100}),I({code:"org-unavailable",path:"buildkeel.yaml",message:d,remedy:f})),c=NR(["init","-q",s],o);if(!c.ok)return a(`BuildKeel could not prepare a copy of the organization templates ${n}: ${CR(c.stderr)}`,"Check that git works on this machine, then try again.");let u=NR(["fetch","-q","--depth","1","--no-tags",e,`+refs/tags/${t}:refs/tags/${t}`],s);if(!u.ok)return/couldn't find remote ref|not our ref|no such ref/i.test(u.stderr)?a(`${t} is not a tag in the organization's template source ${i}. Organization templates are pinned to a tag, never a branch.`,"Set templates.org.version in buildkeel.yaml to one of the organization's release tags."):a(`BuildKeel could not fetch the organization templates ${n}: ${CR(u.stderr)}`,"Check the source and your access to it; they are fetched once per machine, when there is a connection, and kept.");let l=NR(["-c","advice.detachedHead=false","checkout","-q",`refs/tags/${t}`],s);if(!l.ok)return a(`BuildKeel could not check out the organization templates ${n}: ${CR(l.stderr)}`,"Try again; if it keeps failing, remove the folder and try again.");try{ile(s,r)}catch(d){if(!zR(r))return a(`BuildKeel could not keep the organization templates ${n}: ${String(d)}`,"Try again.");YF(s,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}return N(!0)}var CR=e=>e.trim().split(`
|
|
225
|
+
`).find(t=>t.trim()!=="")?.replace(/^(fatal|error): /,"")??"no output";function Bb(e){let t=Fb(e.dir,QF);if(!zR(t))return N(void 0);try{return N((0,Vb.parse)(nle(t,"utf8"))??void 0)}catch(r){let i=r instanceof Vb.YAMLParseError?r.message.split(`
|
|
226
|
+
`)[0]:String(r);return I({code:"org-process-unreadable",path:Zb(e),message:`${Zb(e)} is not valid YAML: ${i}`})}}var Zb=e=>`${QF} in ${e.label}`;var LR=new Map,tZ=new Map;function rZ(e,t,r){LR.set(e,r);let i=t.templates?.org;i&&MR(r,e,i,{fetch:!0})}var nZ=e=>LR.get(e)??Wo();function Gr(e){let t=LR.get(e)??Wo(),r="missing";try{let f=mle(hle(e,wt));r=`${f.mtimeMs}:${f.ctimeMs}:${f.size}`}catch{}let i=`${t}
|
|
227
|
+
${r}`,n=tZ.get(e);if(n&&n.key===i&&(n.orgDir===null||n.setup.org?.ok===ple(n.orgDir)))return n.setup;let o=Jo(e),s=o.ok?o.value.templates?.org:void 0,a=s?MR(t,e,s,{fetch:!1}):null,c=gle(o.ok?o.value.process:void 0,a),u=[...pa,...c.ok?yle(c.value):[]],l={process:c,org:a,types:u},d=s?.version?DR(t,jR(e,s.source),String(s.version).trim()):null;return tZ.set(e,{key:i,orgDir:d,setup:l}),l}function gle(e,t){if(!t)return Zp(e);if(!t.ok)return I(...t.problems);let r=Bb(t.value);return r.ok?Zp(e,{input:r.value,file:Zb(t.value)}):r}function yle(e){return e.chain.filter(t=>!t.core).map(t=>({type:t.type,dir:t.dir,file:`${t.type}.md`,parent:"required"}))}function $t(e){let{process:t}=Gr(e);return t.ok?t.value:vt}var Et=e=>Gr(e.root).process;var iZ={idea:"business idea",epic:"epic",story:"story",task:"task",bug:"bug",adhoc:"ad-hoc unit","test-plan":"test plan",design:"design document"};function Vu(e){let t=r=>{let i=e.chain.find(o=>o.type===r);if(i){let o=vt.chain.find(s=>s.type===r)?.name;return i.core&&i.name===o?iZ[r]??i.name:i.name}if(r==="bug"||r==="adhoc")return e[r].name;let n=e.documents.find(o=>o.type===r);return n?n.name:iZ[r]??r};return{one:t,many:r=>Kb(t(r)),a:r=>Kp(t(r))}}var _e=e=>Vu($t(e));function Kb(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}function Kp(e){return`${/^(a|e|i|o|u(?!s|ni|r[aeiou]))/i.test(e)?"an":"a"} ${e}`}function UR(e){let t=$t(e),r=a=>vt.chain.find(c=>c.type===a),i=(a,c,u)=>!u||u.name!==a||u.prefix!==c,n=[t.bug,t.adhoc].filter(a=>i(a.name,a.prefix,vt[a.type]));if(!(t.chain.length!==vt.chain.length||t.chain.some(a=>i(a.name,a.prefix,r(a.type))))&&n.length===0)return null;let s=(a,c,u,l)=>{let d=l?", added by the team":u&&u!==a?`, the ${u}`:"";return`${a} (${c}${d})`};return[...t.chain.map(a=>s(a.name,a.prefix,r(a.type)?.name,!a.core)),...n.map(a=>s(a.name,a.prefix,vt[a.type].name,!1))].join(", ")}function oZ(e){if(UR(e)===null)return[];let t=$t(e),r=s=>{let a=vt.chain.find(c=>c.type===s.type);return a!==void 0&&a.name===s.name&&a.prefix===s.prefix},i=Vu(t),n=[];for(let[s,a]of t.chain.entries()){let c=t.chain[s-1];if(!c||a.type==="task"||r(a)&&r(c)&&c.type===vt.chain[s-1]?.type)continue;let u=ya(c,1);n.push(`${i.one(a.type)} ${u}`,`${i.many(a.type)} from ${u}`)}let o=t.chain.find(s=>s.type==="story");return o&&n.push(`test-plan ${ya(o,1)}`),n}var Bu=gr(Kr(),1);var sZ=/^---[ \t]*\r?\n?$/,vle=/^## +(.*?)[ \t]*#*[ \t]*\r?\n?$/,$le=/^ {0,3}(`{3,}|~{3,})/;function ble(e){return e.match(/[^\n]*\n|[^\n]+$/g)??[]}function dr(e,t){let r=t?`${t}: `:"",i=(d,f)=>({code:d,message:r+f,...t?{path:t}:{}}),n=ble(e);if(n.length===0||!sZ.test(n[0]??""))return I(i("artifact-no-frontmatter","the file must start with a frontmatter block (---)."));let o=n.findIndex((d,f)=>f>0&&sZ.test(d));if(o===-1)return I(i("artifact-no-frontmatter","the frontmatter block is not closed with ---."));let s=n.slice(0,o+1).join(""),a;try{a=(0,Bu.parse)(n.slice(1,o).join(""))??{}}catch(d){let f=d instanceof Bu.YAMLParseError?d.message.split(`
|
|
228
|
+
`)[0]:String(d);return I(i("artifact-bad-frontmatter",`the frontmatter is not valid YAML: ${f}`))}if(typeof a!="object"||a===null||Array.isArray(a))return I(i("artifact-bad-frontmatter","the frontmatter must be a set of named fields."));let c="",u=[],l=null;for(let d of n.slice(o+1)){let f=$le.exec(d);if(f?.[1]){let m=f[1];l===null?l=m:m[0]===l[0]&&m.length>=l.length&&(l=null)}let p=l===null&&!f?vle.exec(d):null;if(p)u.push({name:p[1]??"",headingLine:d,body:""});else if(u.length>0){let m=u[u.length-1];m.body+=d}else c+=d}return N({frontmatterBlock:s,frontmatter:a,preamble:c,sections:u})}function fr(e){return e.frontmatterBlock+e.preamble+e.sections.map(t=>t.headingLine+t.body).join("")}function Bi(e,t){let r=t.trim().toLowerCase();return e.sections.find(i=>i.name.trim().toLowerCase()===r)}function Sn(e,t){let r=e.frontmatterBlock.includes(`\r
|
|
229
|
+
`)?`\r
|
|
230
|
+
`:`
|
|
231
|
+
`,i=e.frontmatterBlock.replace(/^---[ \t]*\r?\n/,"").replace(/---[ \t]*\r?\n?$/,""),n=(0,Bu.parseDocument)(i),o={...e.frontmatter};for(let[a,c]of Object.entries(t))c===void 0?(n.delete(a),delete o[a]):(n.set(a,c),o[a]=c);let s=n.toString().replace(/\r?\n/g,r);return{...e,frontmatterBlock:`---${r}${s}---${r}`,frontmatter:o}}import{existsSync as FR,realpathSync as bZ}from"node:fs";import{dirname as _Z,join as wZ,resolve as kZ}from"node:path";import{existsSync as aZ}from"node:fs";import{dirname as _le,join as cZ,resolve as wle}from"node:path";var Nt=".buildkeel.yaml";function Gp(e){let t=wle(e);for(;;){if(aZ(cZ(t,Nt)))return t;if(aZ(cZ(t,".git")))return null;let r=_le(t);if(r===t)return null;t=r}}import{execFile as kle,execFileSync as Sle,spawn as xle}from"node:child_process";import{copyFileSync as Ile,existsSync as dZ,rmSync as Ple}from"node:fs";import{isAbsolute as fZ,join as Tle,relative as Ale,resolve as pZ,sep as Rle}from"node:path";import{promisify as Ele}from"node:util";var Ole=Ele(kle),Ku=class extends Error{constructor(r,i){super(`git ${r.join(" ")} failed: ${i.trim()||"no output"}`);this.args=r;this.stderr=i}args;stderr};function at(e,t,r){return Ho(e,t,r).trim()}function Ho(e,t,r){try{return Sle("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","pipe"],maxBuffer:256*1024*1024,...r?{env:{...process.env,...r}}:{}})}catch(i){throw new Ku(t,String(i.stderr??i))}}function de(e,t){try{return at(e,t)}catch{return null}}function Ft(e,t,r={}){return new Promise(i=>{let n=r.input,o=xle("git",t,{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"},stdio:[n===void 0?"ignore":"pipe","pipe","pipe"]}),s="",a="";o.stdout?.on("data",u=>s+=u.toString("utf8")),o.stderr?.on("data",u=>a+=u.toString("utf8"));let c=r.timeoutMs?setTimeout(()=>{a+=`timed out after ${r.timeoutMs} ms`,o.kill()},r.timeoutMs):null;o.on("error",u=>{c&&clearTimeout(c),i({code:-1,stdout:s,stderr:a||u.message})}),o.on("close",u=>{c&&clearTimeout(c),i({code:u??-1,stdout:s.trim(),stderr:a.trim()})}),o.stdin&&(o.stdin.on("error",()=>{}),o.stdin.end(n))})}var Gb=e=>de(e,["rev-parse","--show-toplevel"]);function xn(e){let t=de(e,["var","GIT_COMMITTER_IDENT"]);return(t?/^(.*<[^>]*>)/.exec(t):null)?.[1]?.trim()??null}function Ct(e,t,r){let i=[...new Set(t)].filter(n=>dZ(Tle(e,n))||de(e,["ls-files","--",n]));if(i.length===0)return I({code:"git-nothing-to-commit",message:"There is nothing to commit."});try{return at(e,["add","--all","--",...i]),at(e,["commit","--quiet","--only","--message",r,"--",...i]),N(at(e,["rev-parse","HEAD"]))}catch(n){let o=n instanceof Ku?n.stderr.trim():String(n);return I({code:"git-commit-failed",message:`Could not commit: ${o}`})}}var va=e=>de(e,["symbolic-ref","--quiet","--short","HEAD"]);function Wb(e){let t=(de(e,["for-each-ref","--format=%(refname) %(symref)","refs/remotes/origin/HEAD","refs/heads/"])??"").split(`
|
|
232
|
+
`).map(s=>s.split(" ")),r=t.find(([s])=>s==="refs/remotes/origin/HEAD")?.[1],i=r?r.replace(/^refs\/remotes\//,""):null,n=new Set(t.map(([s])=>s??"").filter(s=>s.startsWith("refs/heads/")).map(s=>s.slice(11)));return[i?.replace(/^origin\//,""),"main","master"].filter(s=>!!s).find(s=>n.has(s))??i}function Yo(e,t){let r=Ale(e,pZ(e,t));return r===""||r.startsWith("..")||fZ(r)?null:r.split(Rle).join("/")}var uZ=new Map;function Nle(e){let t=uZ.get(e);if(t)return t;let r=de(e,["rev-parse","--git-path","index"]);if(!r)return null;let i=fZ(r)?r:pZ(e,r);return uZ.set(e,i),i}function mZ(e,t=[]){let r=de(e,["rev-parse","--verify","--quiet","HEAD"]),i=Nle(e);if(!i)return{commit:r,tree:null};let n=`${i}.buildkeel-${process.pid}`;try{dZ(i)&&Ile(i,n);let o={GIT_INDEX_FILE:n};return at(e,["add","--all","--","."],o),t.length>0&&at(e,["rm","-r","--cached","--quiet","--ignore-unmatch","--",...t],o),{commit:r,tree:at(e,["write-tree"],o)}}catch{return{commit:r,tree:null}}finally{Ple(n,{force:!0})}}var Jb=e=>de(e,["rev-parse","--abbrev-ref","--symbolic-full-name","@{upstream}"]),Gu=e=>(de(e,["remote"])??"").split(`
|
|
233
|
+
`).filter(Boolean);function $a(e){let t=Cle(e)?de(e,["log","--format=%s","HEAD","--not","--remotes"]):null;if(t===null)return{approvals:null,completions:null};let r=t.split(`
|
|
234
|
+
`);return{approvals:r.filter(i=>i.startsWith("approve: ")).length,completions:r.filter(i=>i.startsWith("done: ")).length}}var lZ=new Set;function Cle(e){if(lZ.has(e))return!0;let t=Gu(e).length>0;return t&&lZ.add(e),t}var Hb=e=>$a(e).approvals,Yb=e=>$a(e).completions;function hZ(e){let t=Jb(e);if(t)return t;let r=Gu(e),i=r.includes("origin")?"origin":r[0];if(!i)return null;let n=de(e,["symbolic-ref","--quiet","--short",`refs/remotes/${i}/HEAD`]);for(let o of[n,`${i}/main`,`${i}/master`])if(o&&de(e,["rev-parse","--verify","--quiet",`refs/remotes/${o}`]))return o;return null}async function vi(e){let t=va(e);if(!t)return I({code:"git-push-failed",message:"Cannot push: the repo is not on a branch."});let r=Jb(e)?["push","--quiet"]:["push","--quiet","--set-upstream","origin",t];try{return await Ole("git",r,{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),N(void 0)}catch(i){let n=String(i.stderr??i).trim();return I({code:"git-push-failed",message:`The push was rejected: ${n.split(`
|
|
235
|
+
`)[0]}`})}}var Ju=gr(Kr(),1);import{existsSync as Dle,readdirSync as Mle,readFileSync as Lle}from"node:fs";import{join as qR}from"node:path";import{existsSync as vZ,readdirSync as zle,readFileSync as gZ}from"node:fs";import{dirname as jle,join as Xb}from"node:path";var Pe=e=>jle(e.path);function yZ(e,t){return vZ(e)?zle(e).map(r=>t.exec(r)?.[1]).filter(r=>r!==void 0).map(Number):[]}function oe(e,t){let r=Xb(e,Pe(t)),i=Xb(r,Gn),n=yZ(i,Fu),o=n.includes(0),s=t.onboard!==void 0&&!o,a=t.path===t.onboard?.path;if(n.length===0){let f=yZ(i,Zu).length>0;return{state:f?"pending":"draft",approvedVersion:null,draftOpen:!1,onboardOpen:s&&!f,onboardOnly:a,onboarded:o}}let c=Math.max(...n),u=Xb(r,Up,`v${c}.md`),l=Xb(e,t.path),d=!a&&(!vZ(u)||gZ(u,"utf8")!==gZ(l,"utf8"));return{state:"approved",approvedVersion:c,draftOpen:d,onboardOpen:s,onboardOnly:a,onboarded:o}}function Wu(e){let t=e.onboardOpen?", v0 in draft":"";return e.state==="draft"?e.onboardOnly?"v0 in draft":`draft${t}`:e.state==="pending"?"approved, number pending":`approved v${e.approvedVersion}${e.draftOpen?`, v${(e.approvedVersion??0)+1} in draft`:""}${t}`}var Qb="completions",Ule=["passed","failed","not run","stale","no test"],$Z=b.object({id:b.string().regex(/^[0-9a-f]{7,64}$/),subject:b.string()}),qle=b.object({unit:b.string().min(1),version:b.number().int().nonnegative().optional(),ancestors:b.array(b.string()).default([]),documents:b.record(b.string(),b.number().int().nonnegative()).optional(),repo:b.string().min(1),branch:b.string().min(1).optional(),commits:b.array($Z.extend({by:b.enum(["trailer","branch","key"])})).default([]),onboarded:b.literal(!0).optional(),keys:b.array(b.string().min(1)).optional(),excluded:b.array($Z).default([]),merged:b.string().nullable().default(null),files:b.array(b.string()).default([]),tests:b.object({ranAt:b.string().nullable().default(null),plans:b.array(b.string()).default([]),cases:b.record(b.string(),b.object({result:b.enum(Ule),tests:b.array(b.string()).optional(),note:b.string().optional()})).default({})}).default({ranAt:null,plans:[],cases:{}}),children:b.array(b.object({unit:b.string().min(1),version:b.number().int().nonnegative().optional(),record:b.string().min(1)})).optional(),finishedBy:b.string().min(1),finishedAt:b.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"}),host:b.string().min(1)});function Xo(e,t){let r=e.replace(/[-:]/g,"").replace(/\.\d+Z$/,"Z"),n=(t.replace(/<[^>]*>/,"").trim()||t).toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"unknown";return`${r}-${n}.yaml`}var Hu=(e,t)=>`${Pe(e)}/${Qb}/${t}`;function Yu(e){let t={unit:e.unit,...e.version!==void 0?{version:e.version}:{},ancestors:e.ancestors,...e.documents&&Object.keys(e.documents).length>0?{documents:e.documents}:{},repo:e.repo,...e.onboarded?{onboarded:!0}:{},...e.keys&&e.keys.length>0?{keys:e.keys}:{},...e.branch?{branch:e.branch}:{},commits:e.commits.map(r=>({id:r.id,subject:r.subject,by:r.by})),excluded:e.excluded.map(r=>({id:r.id,subject:r.subject})),merged:e.merged,files:e.files,tests:{ranAt:e.tests.ranAt,plans:e.tests.plans,cases:Object.fromEntries(Object.entries(e.tests.cases).map(([r,i])=>[r,{result:i.result,...i.tests?{tests:i.tests}:{},...i.note?{note:i.note}:{}}]))},...e.children?{children:e.children.map(r=>({unit:r.unit,...r.version!==void 0?{version:r.version}:{},record:r.record}))}:{},finishedBy:e.finishedBy,finishedAt:e.finishedAt,host:e.host};return(0,Ju.stringify)(t,{lineWidth:0})}function Fle(e,t){let r;try{r=(0,Ju.parse)(e)}catch(n){let o=n instanceof Ju.YAMLParseError?n.message.split(`
|
|
236
|
+
`)[0]:String(n);return I({code:"record-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=qle.safeParse(r??{});return i.success?N(i.data):I(...Tr(i.error.issues,t,"record-invalid"))}function Wn(e,t){let r=`${Pe(t)}/${Qb}`;if(!Dle(qR(e,r)))return{completions:[],problems:[]};let i=[],n=[];for(let o of Mle(qR(e,r)).filter(s=>s.endsWith(".yaml")).sort()){let s=`${r}/${o}`,a=Fle(Lle(qR(e,s),"utf8"),s);a.ok?i.push({path:s,record:a.value}):n.push(...a.problems)}return{completions:i,problems:n}}function kt(e,t,r){let{completions:i}=Wn(e,t);return i.filter(n=>r===null?!0:n.record.version===r).at(-1)??null}var Zle=/^[ \t]*BuildKeel-Unit:[ \t]*([A-Za-z0-9][A-Za-z0-9-]*)[ \t]*$/gim;function VR(e){return[...new Set([...e.matchAll(Zle)].map(t=>t[1]))]}var Vle=process.platform==="win32",Wp=e=>Vle?e.toLowerCase():e,xZ=(e,t)=>{try{return Wp(bZ.native(e))===Wp(bZ.native(t))}catch{return Wp(kZ(e))===Wp(kZ(t))}},SZ=e=>Wp(e.trim().replace(/\\/g,"/").replace(/\.git\/?$/,"").replace(/\/+$/,""));function Ble(e,t){return SZ(e)===SZ(t)?!0:FR(e)&&FR(t)&&xZ(e,t)}function Kle(e,t){if(!FR(e))return!1;let r=de(e,["rev-parse","--show-toplevel"]);if(!r||!xZ(r,e))return!1;if(!t)return!0;let i=de(e,["remote","get-url","origin"]);return i!==null&&Ble(i,t)}function BR(e,t,r){let i=e.config.repos.map(s=>({name:s.name,...s.remote?{remote:s.remote}:{},...s.baseline?{baseline:s.baseline}:{}}));i.some(s=>s.name===t.repo)||i.unshift({name:t.repo});let n=qb(r),o=n.ok?n.value.repos:{};return i.map(s=>{if(s.name===t.repo)return{...s,dir:t.codeRoot};let c=[o[s.name],wZ(_Z(t.codeRoot),s.name),wZ(_Z(e.root),s.name)].filter(u=>!!u).find(u=>Kle(u,s.remote));return{...s,dir:c??null}})}function Qu(e,t){let r=/(?:^|\/)bk\/(.+)$/.exec(e)?.[1];return r?t.filter(n=>r===n||r.startsWith(`${n}-`)).sort((n,o)=>o.length-n.length)[0]??null:null}var IZ="",ZR="",PZ="";function Gle(e,t){let r=[];for(let i of e.split(IZ)){let n=i.indexOf(PZ);if(n<0)continue;let[o,s,a]=i.slice(0,n).split(ZR);if(!o||a===void 0)continue;let c=i.slice(n+1).split(`
|
|
237
|
+
`).map(l=>l.trim()).filter(Boolean),u=t?c.filter(l=>!l.startsWith(`${t}/`)):c;c.length>0&&u.length===0||r.push({id:o,subject:a.split(`
|
|
238
|
+
`)[0]?.trim()??"",units:VR(a),files:u,time:Number(s)})}return r}var Wle=`--format=${IZ}%H${ZR}%ct${ZR}%B${PZ}`,Xu=new Map,Jle=16;function KR(e,t,r,i={}){let n=i.specRoot?Yo(t,i.specRoot):null,o=de(t,["show-ref","--head"]),s=JSON.stringify([e,i.baseline??null,n,i.idsBranch??null,r]),a=Xu.get(t);if(o!==null&&a?.key===s&&a.refs===o)return a.repo;let c=Hle(e,t,r,o??"",n,i);return Xu.delete(t),o!==null&&Xu.set(t,{key:s,refs:o,repo:c}),Xu.size>Jle&&Xu.delete(Xu.keys().next().value),c}function Hle(e,t,r,i,n,o){let s=i.split(`
|
|
239
|
+
`).map(_=>_.slice(_.indexOf(" ")+1)),a=o.baseline&&de(t,["rev-parse","--verify","--quiet",`${o.baseline}^{commit}`]),c={name:e,dir:t,baseline:o.baseline?{commit:o.baseline,found:!!a}:null,commits:new Map,units:new Map,branches:new Map,branchCommits:new Map},u=a?["--not",a]:[],l=s.includes("HEAD")?["HEAD"]:[],d=o.idsBranch,f=[...d?[`--exclude=${d}`]:[],"--branches",...d?[`--exclude=*/${d}`]:[],"--remotes"],p=de(t,["-c","core.quotePath=false","log",...l,...f,"--no-merges","--no-renames","--date-order",Wle,"--name-only",...u]);for(let _ of Gle(p??"",n))c.commits.set(_.id,_);let m=(_,w,k)=>{let T=c.units.get(_)??[];T.some(C=>C.id===w.id)||T.push({...w,by:k}),c.units.set(_,T)};for(let _ of c.commits.values())for(let w of _.units)m(w,_,"trailer");let h=new Map(i.split(`
|
|
240
|
+
`).map(_=>[_.slice(_.indexOf(" ")+1),_.slice(0,_.indexOf(" "))])),g=_=>_.replace(/^refs\/(heads|remotes)\//,""),y=s.filter(_=>(_.startsWith("refs/heads/bk/")||_.startsWith("refs/remotes/"))&&Qu(g(_),r)!==null),v=new Set(y.map(_=>Qu(g(_),r)));for(let _ of y){let w=g(_),k=Qu(w,r);c.branches.set(k,[...c.branches.get(k)??[],w]);let T=v.size>1?(de(t,["for-each-ref","--format=%(refname)",`--merged=${_}`,...y])??"").split(`
|
|
241
|
+
`).filter(D=>D!==""&&Qu(g(D),r)!==k&&h.get(D)!==h.get(_)):[],C=de(t,["log",_,"--no-merges","--format=%H","--not","--exclude=bk/*","--branches","--exclude=*/bk/*","--remotes",...T,...a?[a]:[]]);for(let D of(C??"").split(`
|
|
242
|
+
`).filter(Boolean)){let K=c.commits.get(D);if(!K)continue;let V=c.branchCommits.get(k)??[];V.includes(D)||c.branchCommits.set(k,[...V,D]),K.units.length===0&&m(k,K,"branch")}}let $=new Map([...c.commits.keys()].map((_,w)=>[_,w]));for(let _ of c.units.values())_.sort((w,k)=>k.time-w.time||($.get(w.id)??0)-($.get(k.id)??0));return c}var Yle=new Set([Nt,".gitignore"]);function GR(e){let t=new Set([...e.branchCommits.values()].flat());return[...e.commits.values()].filter(r=>r.units.length===0&&!t.has(r.id)&&!r.files.every(i=>Yle.has(i)))}function Ki(e,t,r,i){let n=[...t.artifacts.values()].filter(a=>tr.includes(a.type)).map(a=>a.id),o=[],s=[];for(let a of BR(e,r,i)){if(!a.dir){s.push(a.name);continue}o.push(KR(a.name,a.dir,n,{...a.baseline?{baseline:a.baseline}:{},specRoot:e.root,idsBranch:e.config.settings.idsBranch}))}return{repos:o,missing:s}}function el(e,t,r,i){let n=t.artifacts.get(i),o=n?Wn(e,n).completions.map(l=>l.record):[],s=new Set(o.flatMap(l=>l.excluded.map(d=>d.id))),a=new Map,c=l=>{let d=a.get(l);if(d)return d;let f={commits:[],files:new Set};return a.set(l,f),f};for(let l of r.repos)for(let d of l.units.get(i)??[]){if(s.has(d.id))continue;let f=c(l.name);f.commits.push({id:d.id,subject:d.subject,by:d.by});for(let p of d.files)f.files.add(p)}for(let l of o){let d=c(l.repo);for(let f of l.commits)d.commits.some(p=>p.id===f.id)||d.commits.push(f);for(let f of l.files)d.files.add(f)}return{repos:[...a.entries()].filter(([,l])=>l.commits.length>0||l.files.size>0).map(([l,d])=>({repo:l,commits:d.commits,files:[...d.files].sort()})).sort((l,d)=>l.repo.localeCompare(d.repo)),missing:[...r.missing].sort()}}var Qo=e=>e.replace(/<!--[\s\S]*?-->/g,""),e_=e=>Qo(e).trim()==="",Xle=/^[-*+] +(.*)$/,Qle=/^\*\*([A-Za-z0-9][A-Za-z0-9-]*)\*\*\s*(.*)$/,ede=/^### +(.*?)\s*$/,tde=/^([A-Za-z0-9]+(?:-[A-Za-z0-9]+)+)\b\s*(.*)$/,rde=/^covers:\s*(.*)$/i;function t_(e,t){let r=Qo(e).split(/\r?\n/);return t==="list"?nde(r):ide(r)}function nde(e){let t=[];for(let r of e){let i=Xle.exec(r);if(i){let n=i[1]??"",o=Qle.exec(n);t.push({id:o?.[1]??null,text:(o?o[2]:n)?.trim()??"",raw:r,covers:null})}else if(t.length>0&&/^\s+\S/.test(r)){let n=t[t.length-1];n.raw+=`
|
|
243
|
+
${r}`,n.text=`${n.text} ${r.trim()}`.trim()}}return t}function ide(e){let t=[];for(let r of e){let i=ede.exec(r);if(i){let s=tde.exec(i[1]??"");t.push({id:s?.[1]??null,text:(s?s[2]:i[1])?.trim()??"",raw:r,covers:null});continue}let n=t[t.length-1];if(!n)continue;n.raw+=`
|
|
244
|
+
${r}`;let o=rde.exec(r.trim());o&&(n.covers=ode(o[1]??""))}return t}function ode(e){return e.replace(/^\[|\]$/g,"").split(",").map(t=>t.trim()).filter(t=>t.length>0)}var Jn="{{new}}";function ba(e){return Object.entries(e.sections).flatMap(([t,r])=>r.items?[{section:t,prefix:r.items.prefix,style:r.items.style}]:[])}var WR=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function In(e,t,r){let i=[];for(let{section:n,prefix:o,style:s}of ba(t)){let a=Bi(e,n)?.body;if(!a)continue;let c=new RegExp(`^${WR(r)}-${o}([1-9][0-9]*)$`);for(let u of t_(a,s)){let l=u.id?c.exec(u.id):null;l&&u.id&&i.push({...u,id:u.id,prefix:o,number:Number(l[1]),section:n})}}return i}function r_(e,t,r){let i=new Map;for(let n of e)for(let o of In(n,t,r))i.set(o.prefix,Math.max(i.get(o.prefix)??0,o.number));return i}function AZ(e,t,r,i){let n=[],o=e;for(let{prefix:s}of ba(t)){let a=i.get(s)??0;o=o.replace(new RegExp(`${WR(r)}-${s}${WR(Jn)}`,"g"),()=>{let c=`${r}-${s}${++a}`;return n.push(c),c})}return{text:o,assigned:n}}var TZ=e=>`${e.text.replace(/\s+/g," ").trim()}|${(e.covers??[]).join(",")}`;function RZ(e,t,r,i){let n=[],o=new Map,s=new Map;for(let{version:a,items:c}of e){let u=new Set(c.map(l=>l.id));for(let[l]of o)!u.has(l)&&!s.has(l)&&s.set(l,a);for(let l of c)o.set(l.id,{item:l,version:a}),s.delete(l.id)}for(let a of t){let c=s.get(a.id),u=o.get(a.id);c===void 0||!u||TZ(u.item)===TZ(a)||n.push({code:"item-reused",path:r,message:`${r}: ${a.id} was removed in v${c} and cannot be used again for a different entry.`,remedy:`Write the new entry as ${i}-${a.prefix}${Jn}, and BuildKeel gives it the next number when it is saved.`})}return n}import{existsSync as n_,readdirSync as lde,readFileSync as dde}from"node:fs";import{join as Jp}from"node:path";var sde=b.object({required:b.boolean().default(!1),type:b.enum(["text","list","link"]).default("text"),tracked:b.boolean().default(!1)}),ade=b.object({prefix:b.string().regex(/^[A-Z]{1,4}$/,"must be 1 to 4 capital letters"),style:b.enum(["list","heading"]),covers:b.enum(["required","optional"]).optional()}),cde=b.object({required:b.boolean().default(!1),tracked:b.boolean().default(!1),items:ade.optional(),offered:b.string().min(1).optional()}),ude=b.object({template:b.string().regex(/^[a-z][a-z0-9-]*$/),version:b.number().int().positive(),description:b.string().optional(),fields:b.record(b.string(),sde).default({}),sections:b.record(b.string(),cde).default({})});function EZ(e,t){let r=dr(e,t);if(!r.ok)return r;let i=ude.safeParse(r.value.frontmatter);if(!i.success)return I(...Tr(i.error.issues,t,"template-invalid"));let n=c=>r.value.sections.some(u=>u.name.toLowerCase()===c.toLowerCase()),o=Object.entries(i.data.sections),s=o.filter(([c,u])=>u.offered===void 0&&!n(c)).map(([c])=>c);if(s.length>0)return I({code:"template-invalid",path:t,message:`${t}: the template declares ${s.map(c=>`"${c}"`).join(", ")} but its body has no such section.`,remedy:'Add the section to the body, or mark it offered with a line saying what goes in it, such as offered: "How it is released and undone".'});let a=o.flatMap(([c,u])=>u.offered===void 0?[]:u.required?[`"${c}" is offered, so it cannot be required: an offered section is added only when it applies.`]:n(c)?[`"${c}" is offered, so it stays out of the body: an offered section is added only when it applies.`]:[]);return a.length>0?I(...a.map(c=>({code:"template-invalid",path:t,message:`${t}: ${c}`}))):N({type:i.data.template,version:i.data.version,...i.data.description?{description:i.data.description}:{},fields:i.data.fields,sections:i.data.sections,skeleton:r.value})}var fde=Jp(JT(),"templates"),es="templates";function lt(e,t){let r=`${e}.md`,i=Jp(t,es,r);if(n_(i))return JR(e,i,`${es}/${r}`,"tree");let{org:n}=Gr(t);if(n&&!n.ok)return n;if(n){let s=Jp(n.value.dir,Bp,r);if(n_(s))return JR(e,s,`${Bp}/${r} in ${n.value.label}`,"org",n.value.label)}let o=Jp(fde,r);return n_(o)?JR(e,o,o,"built-in"):I({code:"template-missing",message:`There is no template for the artifact type ${e}.`,remedy:`Add one as ${es}/${r} in the spec tree${n?" or in the organization's templates":""}: copy a built-in template such as epic.md, set template: ${e}, and change its fields and sections.`})}function JR(e,t,r,i,n){let o=EZ(dde(t,"utf8"),r);return o.ok?o.value.type!==e?I({code:"template-invalid",path:r,message:`${r} says it is the template for ${o.value.type}, not ${e}.`}):N({template:o.value,source:i,path:r,file:t,...n?{org:n}:{}}):o}function OZ(e){let t=Jp(e,es);return n_(t)?lde(t).filter(r=>r.endsWith(".md")).map(r=>r.slice(0,-3)).sort():[]}function Hp(e){return e.source==="tree"?`the spec tree's own template (${e.path})`:e.source==="org"?`the organization's templates (${e.org})`:"BuildKeel's built-in template"}import{existsSync as HR,readdirSync as mde,readFileSync as NZ}from"node:fs";import{join as i_}from"node:path";var pde=/^([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)(?:@v(0|[1-9][0-9]*))?$/;function sn(e){let t=pde.exec(e.trim());return t?.[1]?t[2]?{id:t[1],version:Number(t[2])}:{id:t[1]}:null}function It(e){return e.version===void 0?e.id:`${e.id}@v${e.version}`}var ts=["related","changes"];function rs(e,t){let r=e[t];if(r==null||r==="")return{ids:[],invalid:[]};let i=Array.isArray(r)?r:[r],n=[],o=[];for(let s of i){let a=typeof s=="string"?sn(s):null;a?n.push(a.id):o.push(s)}return{ids:[...new Set(n)],invalid:o}}var _a=e=>/^(?:[A-Za-z][A-Za-z0-9]*-)?draft-[a-z0-9]+$/.test(e);function Je(e,t){let r=i_(e,Pe(t),Gn);return HR(r)?mde(r).map(i=>Fu.exec(i)?.[1]).filter(i=>i!==void 0).map(Number).sort((i,n)=>i-n):[]}function an(e,t,r){let i=Vi(Pe(t),r);if(!HR(i_(e,i)))return null;let n=ga(NZ(i_(e,i),"utf8"),i);return n.ok?n.value:null}function Ar(e,t,r){if(r===void 0)return{document:t.document,version:null,label:`the draft of ${t.id}`};let i=i_(e,Zi(Pe(t),r));if(!HR(i))return null;let n=dr(NZ(i,"utf8"),i);return n.ok?{document:n.value,version:r,label:`${t.id} v${r}`}:null}function Pn(e,t){let r=Je(e,t),i=r[r.length-1];return Ar(e,t,i)}function hde(e,t){let r=typeof t.document.frontmatter.parent=="string"?sn(t.document.frontmatter.parent):null,i=t.document.frontmatter.title;return{id:e.id,type:e.type,path:e.path,document:t.document,...typeof i=="string"?{title:i}:{},...r?{parent:r}:{},...e.owner!==void 0?{owner:e.owner}:{}}}function fe(e,t){let r=Je(e,t).at(-1);if(r===void 0)return null;let i=Ar(e,t,r);return i?{...hde(t,i),version:r}:null}var gde=["idea","epic","story","task"];function jZ(e){let t=$t(e),r=_e(e),i=t.chain.map(n=>r.a(n.type));return`${i.slice(0,-1).join(", ")} or ${i.at(-1)}`}function Gi(e,t){return gde.includes(t)?t:Ub($t(e),t)?"epic":null}var wa={idea:"end-to-end test plan",epic:"integration test plan",story:"test plan",task:"test plan"},Ut=e=>e.slice(0,-ee.idSuffix.length);function tl(e,t,r){if(!r)return[];let i=lt(t.type,e);return i.ok?In(r.document,i.value.template,t.id):[]}var YR=(e,t,r)=>Ar(e,t,r)??Ar(e,t);function Yp(e,t,r){let i=[],n=new Set([t.id]),o=s=>{for(let a of e.artifacts.values())a.parent?.id!==s||n.has(a.id)||a.owner!==void 0||(n.add(a.id),a.type===r?i.push(a):o(a.id))};return o(t.id),i}function CZ(e,t,r,i,n){let o=Je(e,t).at(-1)??i,s=oe(e,t).draftOpen?o+1:o;if(s<=i)return;let a=new Set(tl(e,t,{document:t.document,version:null,label:""}).map(u=>u.id).filter(u=>!n.has(u))),c=s>o?`the draft of ${t.id} v${s}`:`${t.id} v${s}`;return{items:a,story:t,pinnedBy:r,label:c,version:s}}function ns(e,t,r){let i=t.artifacts.get(Ut(r.id)),n=i?Gi(e,i.type):null;if(!i||!n)return null;let o=_e(e),s=new Map,a={plan:r,owner:i,level:n,allowed:s,required:[],informational:[],describe:"",against:""};if(n==="story"){let c=YR(e,i,r.parent?.version);for(let u of tl(e,i,c))s.set(u.id,u.text),a.required.push({id:u.id,text:u.text});if(a.describe=`a criterion of ${c?.label??i.id}`,a.against=c?.label??i.id,r.parent?.version!==void 0){a.newer=CZ(e,i,r,r.parent.version,s);let u=Je(e,i).at(-1);if(u!==void 0&&u>r.parent.version)for(let l of tl(e,i,Ar(e,i,u)))s.has(l.id)||a.required.push({id:l.id,text:l.text,addedIn:u})}}else if(n==="task"){s.set(i.id,i.title??`the ${o.one("task")}`);let c=i.parent?t.artifacts.get(i.parent.id):void 0,u=c?YR(e,c,i.parent?.version):null;if(c)for(let l of tl(e,c,u))s.set(l.id,l.text);c&&i.parent?.version!==void 0&&(a.newer=CZ(e,c,i,i.parent.version,s)),a.describe=`${i.id} or a criterion of ${u?.label??i.parent?.id??`its ${o.one("story")}`}`,a.against=u?.label??i.parent?.id??`its ${o.one("story")}`}else if(n==="epic"){for(let c of Yp(t,i,"story")){s.set(c.id,c.title??c.id);for(let u of tl(e,c,Pn(e,c)))s.set(u.id,u.text)}a.describe=`${o.a("story")} under ${i.id} or one of their criteria`,a.against=`the latest version of each ${o.one("story")} under ${i.id}`}else{for(let u of Yp(t,i,"epic"))s.set(u.id,u.title??u.id);let c=YR(e,i,r.parent?.version);for(let u of tl(e,i,c))s.set(u.id,u.text),a.informational.push({id:u.id,text:u.text});a.describe=`${o.a("epic")} under ${i.id} or a goal of ${c?.label??i.id}`,a.against=c?.label??i.id}return a}function St(e,t,r=t.document){let i=lt(ee.type,e);return i.ok?In(r,i.value.template,Ut(t.id)):[]}function o_(e,t){let r=[];for(let i of t)for(let n of i.covers??[]){if(e.allowed.has(n))continue;let o=e.newer?.items.has(n)?e.newer:void 0,s=o?`${n} is in ${o.label}. Once v${o.version} is approved, save ${o.pinnedBy.id} with parent ${o.story.id}@v${o.version}.`:void 0;r.push({code:"covers-unknown",path:e.plan.path,message:`${e.plan.path}: ${i.id} covers ${n}, which is not ${e.describe}.`,remedy:s??`Correct the covers line of ${i.id}, then save the plan again.`})}return r}function Xp(e,t){let r=new Map(e.map(i=>[i.id,[]]));for(let i of t)for(let n of i.covers??[])r.get(n)?.push(i.id);return r}function Qp(e,t){let r=Xp(e.required,t);return e.required.filter(i=>(r.get(i.id)??[]).length===0)}function DZ(e,t){return Qp(e,t).map(r=>({code:"coverage-gap",path:e.plan.path,message:`${r.id} is not covered by any test case in ${e.plan.id}: "${r.text}"`,remedy:XR(e.plan.id,e.owner.id,r,`add a test case to ${e.plan.id} with "covers: [${r.id}]", then save the plan again`)}))}function XR(e,t,r,i){return r.addedIn===void 0?`${i.charAt(0).toUpperCase()}${i.slice(1)}.`:`${r.id} was added in ${t} v${r.addedIn}. Save ${e} with parent ${t}@v${r.addedIn} and a test case that covers it, then approve the new version.`}var zZ=(e,t)=>({id:e.id,title:e.title??"regression test",covers:[],plan:e.id,version:null,own:t,regression:!0}),QR=(e,t,r)=>[...t.artifacts.values()].filter(i=>i.type==="bug"&&i.parent?.id===r.id&&kt(e,i,null)!==null);function Wi(e,t,r){let i=t.artifacts.get(r);if(!i)return[];if(i.type==="bug"){let a=i.document.frontmatter.testCase,c=typeof a=="string"&&i.parent?Wi(e,t,i.parent.id).find(u=>u.id===a):void 0;return[zZ(i,!0),...c?[{...c,own:!1}]:[]]}let n=i.type==="task"&&i.parent?t.artifacts.get(i.parent.id):void 0,o=[i,...n?[n]:[]],s=[];for(let a of o){let c=a===i,u=t.artifacts.get(`${a.id}${ee.idSuffix}`),l=u?Pn(e,u):null;if(u&&l)for(let d of St(e,u,l.document))s.push({id:d.id,title:d.text,covers:d.covers??[],plan:u.id,version:l.version,own:c});for(let d of QR(e,t,a))s.push(zZ(d,c))}return s}import{existsSync as yde,readFileSync as MZ,writeFileSync as vde}from"node:fs";import{join as eE}from"node:path";var is=".buildkeel",tE="hook-cache.json",$de="context.md",rE=e=>eE(e,is,$de);function nE(e){return eE(e,is,tE)}function Ke(e){try{return JSON.parse(MZ(nE(e),"utf8"))}catch{return null}}var bde=`${is}/`;function LZ(e){let t=eE(e,".gitignore"),r=yde(t)?MZ(t,"utf8"):"";if(r.split(/\r?\n/).some(s=>["/.buildkeel/",".buildkeel/","/.buildkeel",".buildkeel"].includes(s.trim())))return!1;let n=r.includes(`\r
|
|
245
|
+
`)?`\r
|
|
246
|
+
`:`
|
|
247
|
+
`,o=r===""||r.endsWith(`
|
|
248
|
+
`)?"":n;return vde(t,`${r}${o}${bde}${n}`),!0}import{mkdirSync as _de,renameSync as wde,writeFileSync as kde}from"node:fs";import{join as UZ}from"node:path";function $i(e,t){let r=Et(e);return r.ok?r.value.gates[t]:"block"}function Sde(e){return[...e.artifacts.values()].flatMap(t=>{let r=oe(e.root,t);return r.state==="pending"?[t.path,...t.onboard?[t.onboard.path]:[]]:r.state==="approved"&&!r.draftOpen?[t.path]:[]}).sort()}function xde(e){return[...e.artifacts.values()].filter(t=>{let r=oe(e.root,t);return r.onboarded||r.state==="pending"&&t.onboard!==void 0}).map(t=>ha(Pe(t))).sort()}function s_(e,t,r=new Date){let i=Ke(e),n={...i,version:1,specRoot:t.root,lockedDirs:[...Uu],lockedFiles:Sde(t),lockedSources:xde(t),activeUnit:i?.activeUnit??null,scope:i?.scope??[],lockMode:$i(t,"lock"),stages:UR(t.root),stageExamples:oZ(t.root),documents:Object.fromEntries($t(t.root).documents.map(o=>[o.dir,o.suffix])),updatedAt:r.toISOString()};return qZ(e,n)?n:null}function Hn(e,t,r=new Date){let i=Ke(e);if(!i)return null;let n={...i,...t,updatedAt:r.toISOString()};return qZ(e,n)?n:null}function qZ(e,t){let r=UZ(e,is);try{_de(r)}catch(n){let o=n.code;if(o==="ENOENT")return!1;if(o!=="EEXIST")throw n}let i=UZ(r,`.${tE}.${process.pid}.tmp`);return kde(i,`${JSON.stringify(t,null,2)}
|
|
249
|
+
`),wde(i,nE(e)),!0}import{readFileSync as Vde}from"node:fs";import{join as Bde}from"node:path";import{randomBytes as Ide}from"node:crypto";import{mkdirSync as Pde,renameSync as Tde,rmSync as Ade,writeFileSync as Rde}from"node:fs";import{dirname as FZ,join as Ede}from"node:path";var iE=e=>Ede(FZ(e),`.${Ide(6).toString("hex")}.bk-tmp`);function cn(e,t,r){Pde(FZ(e),{recursive:!0});let i=iE(e);try{Rde(i,t,{flag:"wx",...r!==void 0?{mode:r}:{}}),Tde(i,e)}catch(n){throw Ade(i,{force:!0}),n}}var Ode=/\[([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)\]/g;function ZZ(e){return[...new Set([...`${e.name} ${e.classname}`.matchAll(Ode)].map(t=>t[1]))]}var a_=e=>e.classname&&!e.name.includes(e.classname)?`${e.classname} > ${e.name}`:e.name,Nde={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};function Cde(e){return e.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z]+);/gi,(t,r)=>r.startsWith("#x")||r.startsWith("#X")?String.fromCodePoint(parseInt(r.slice(2),16)):r.startsWith("#")?String.fromCodePoint(Number(r.slice(1))):Nde[r]??t)}function*zde(e){let t=0,r=(i,n)=>{let o=e.indexOf(i,n);return o<0?e.length:o+i.length};for(;(t=e.indexOf("<",t))>=0;)if(e.startsWith("<!--",t))t=r("-->",t+4);else if(e.startsWith("<![CDATA[",t))t=r("]]>",t+9);else if(e.startsWith("<?",t))t=r("?>",t+2);else if(e.startsWith("<!",t)){let i=0,n=t+2;for(;n<e.length;n++){let o=e[n];if(o==="[")i++;else if(o==="]")i--;else if(o===">"&&i<=0)break}t=n+1}else{let i=t+1,n=null;for(;i<e.length;i++){let l=e[i];if(n)l===n&&(n=null);else if(l==='"'||l==="'")n=l;else if(l===">")break}if(i>=e.length)throw new Error("a tag is not closed");let o=e.slice(t+1,i).trim();if(t=i+1,o.startsWith("/")){yield{kind:"close",name:o.slice(1).trim(),attrs:{}};continue}let s=o.endsWith("/"),a=s?o.slice(0,-1):o,c=/^[^\s/>]+/.exec(a)?.[0]??"",u={};for(let l of a.slice(c.length).matchAll(/([^\s=]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g))u[l[1]]=Cde(l[2]??l[3]??"");yield{kind:s?"empty":"open",name:c,attrs:u}}}var jde=e=>e.slice(e.indexOf(":")+1);function VZ(e,t){let r=[],i=null,n=!1;try{for(let o of zde(e)){let s=jde(o.name);if((s==="testsuites"||s==="testsuite")&&(n=!0),o.kind==="close"){s==="testcase"&&i&&(r.push(i),i=null);continue}if(s==="testcase"){let a={name:o.attrs.name??"",classname:o.attrs.classname??o.attrs.class??"",outcome:"passed"};o.kind==="empty"?r.push(a):i=a}else i&&(s==="failure"||s==="error")?i.outcome="failed":i&&s==="skipped"&&i.outcome!=="failed"&&(i.outcome="skipped")}}catch(o){return I({code:"report-unreadable",path:t,message:`${t} is not valid XML: ${o.message}.`})}return i&&r.push(i),n?N(r):I({code:"report-not-junit",path:t,message:`${t} is not a JUnit XML report: it has no testsuite element.`,remedy:"Run the tests with a JUnit XML reporter, such as --reporter=junit for Vitest or --junitxml for pytest, and pass that file."})}var rl=gr(Kr(),1);import{existsSync as KZ,readdirSync as Dde,readFileSync as Mde}from"node:fs";import{join as oE}from"node:path";var sE="matches",Lde=(e,t)=>`${Pe(e)}/${sE}/${t}.yaml`,Ude=b.object({testCase:b.string().min(1),tests:b.array(b.string().min(1)).min(1),matchedBy:b.string().min(1),matchedAt:b.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"})});function GZ(e){return(0,rl.stringify)({testCase:e.testCase,tests:e.tests,matchedBy:e.matchedBy,matchedAt:e.matchedAt},{lineWidth:0})}function qde(e,t){let r;try{r=(0,rl.parse)(e)}catch(n){let o=n instanceof rl.YAMLParseError?n.message.split(`
|
|
250
|
+
`)[0]:String(n);return I({code:"match-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=Ude.safeParse(r??{});return i.success?N(i.data):I(...Tr(i.error.issues,t,"match-invalid"))}function Yn(e,t){let r=new Map,i=[];for(let n of t.artifacts.values()){if(n.type!==ee.type)continue;let o=oE(e,Pe(n),sE);if(!KZ(o))continue;let s=Pn(e,n),a=new Set(s?St(e,n,s.document).map(c=>c.id):[]);for(let c of Dde(o).filter(u=>u.endsWith(".yaml")).sort()){let u=`${Pe(n)}/${sE}/${c}`,l=qde(Mde(oE(e,u),"utf8"),u);if(!l.ok){i.push(...l.problems);continue}let{testCase:d}=l.value;if(c!==`${d}.yaml`||!a.has(d)){i.push({code:"match-unknown-case",path:u,message:`${u} matches tests to ${d}, which is not a test case of ${n.id}${c!==`${d}.yaml`?` (and the file is not named ${d}.yaml)`:""}.`,remedy:`Match the tests again to a test case of ${n.id}, or remove ${u}.`});continue}r.set(d,{path:u,plan:n.id,match:l.value})}}return{matches:r,problems:i}}function Fde(e,t,r){for(let i of t.artifacts.values()){if(i.type!==ee.type)continue;let n=Pn(e,i);if(n&&St(e,i,n.document).some(o=>o.id===r))return i}return null}function WZ(e,t){let r=Fde(e.root,e.index,t.testCase);if(!r)return I({code:"match-unknown-case",message:`There is no test case ${t.testCase} in any test plan.`});let i=[...new Set(t.tests.map(s=>s.trim()).filter(Boolean))],n=Lde(r,t.testCase);if(i.length===0){if(!KZ(oE(e.root,n)))return I({code:"match-not-found",message:`${t.testCase} has no recorded match to drop.`});let s=e.writer.remove(n);if(!s.ok)return s}else{let s=e.writer.writeFile(n,GZ({testCase:t.testCase,tests:i,matchedBy:t.by,matchedAt:t.at}));if(!s.ok)return s}let o=Ct(e.root,[n],`match: ${t.testCase}${i.length===0?" dropped":""}`);return N({testCase:t.testCase,path:n,tests:i,commit:o})}var Zde=e=>e.replace(/\s*\[[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+\]/g,"").trim(),BZ=e=>e.includes(" > ")?e.slice(0,e.indexOf(" > ")):null;function JZ(e,t,r){let{matches:i}=Yn(e.root,e.index),n=new Set(r),o=[],s=[];for(let a of t){let c=i.get(a.id),u=a.tests.filter(h=>h.includes(`[${a.id}]`));if(!c||u.length===0)continue;let l=new Set(u.map(Zde)),d=new Set(u.map(BZ)),f=c.match.tests.filter(h=>l.has(h)||!n.has(h)&&d.has(BZ(h)));if(f.length===0)continue;let p=c.match.tests.filter(h=>!f.includes(h)),m=p.length===0?e.writer.remove(c.path):e.writer.writeFile(c.path,GZ({...c.match,tests:p}));if(!m.ok)return m;o.push({testCase:a.id,tests:f,path:c.path}),s.push(c.path)}return N({dropped:o,paths:s})}var Kde="test-results.json",YZ=e=>Bde(e,is,Kde);function Ji(e){try{let t=JSON.parse(Vde(YZ(e),"utf8"));return t?.version===1&&t.cases&&typeof t.cases=="object"?t:{version:1,cases:{}}}catch{return{version:1,cases:{}}}}function XZ(e,t){let r=Yo(e,t);return[is,...r?[r]:[]]}var nl=(e,t)=>mZ(e,XZ(e,t));function aE(e,t){let r=new Map;for(let i of t.artifacts.values()){if(i.type==="bug"&&r.set(i.id,{plan:i.id,planVersion:null}),i.type!==ee.type)continue;let n=Pn(e,i);if(n)for(let o of St(e,i,n.document))r.set(o.id,{plan:i.id,planVersion:n.version})}return r}var Gde=/-TC[1-9][0-9]*$/;function QZ(e){let t=aE(e.root,e.index),r=new Map;for(let[f,{match:p}]of Yn(e.root,e.index).matches)if(t.has(f))for(let m of p.tests)r.set(m,[...r.get(m)??[],f]);let i=new Map,n=new Set,o=new Set,s=0,a=0;for(let f of e.tests){let p=ZZ(f),m=p.filter(g=>t.has(g));for(let g of p)!t.has(g)&&Gde.test(g)&&o.add(g);for(let g of m)n.add(g);let h=(r.get(a_(f))??[]).filter(g=>!m.includes(g));m.length===0&&s++,m.length===0&&h.length>0&&a++;for(let g of[...m,...h])i.set(g,[...i.get(g)??[],f])}let c=nl(e.codeRoot,e.specRoot),u=(e.now??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),l=Ji(e.codeRoot),d=new Map;for(let[f,p]of i){let m=p.some(v=>v.outcome==="failed")?"failed":p.some(v=>v.outcome==="passed")?"passed":"not run",{plan:h,planVersion:g}=t.get(f),y={outcome:m,tests:p.map(a_),...n.has(f)?{}:{matched:!0},commit:c.commit,tree:c.tree,plan:h,planVersion:g,report:e.report,at:u};l.cases[f]=y,d.set(f,y)}return l.latest={report:e.report,at:u,tests:e.tests.map(a_)},cn(YZ(e.codeRoot),`${JSON.stringify(l,null,2)}
|
|
251
|
+
`),{total:e.tests.length,recorded:d,unknown:[...o].sort(),untagged:s,matched:a,state:c}}function cE(e,t,r){if(r.length===0)return new Set;let i=r.flatMap(s=>["-e",`[${s}]`]),n=XZ(e,t).map(s=>`:(exclude)${s}`),o=de(e,["grep","--untracked","-I","-F","-o","-h",...i,"--",".",...n]);return new Set((o??"").split(`
|
|
252
|
+
`).map(s=>s.trim().slice(1,-1)).filter(s=>r.includes(s)))}function il(e){let t=Wi(e.root,e.index,e.unitId);if(t.length===0)return[];let r=cE(e.codeRoot,e.specRoot,t.map(s=>s.id)),{matches:i}=Yn(e.root,e.index),n=e.state??nl(e.codeRoot,e.specRoot),o=Ji(e.codeRoot).cases;return t.map(s=>{let a=i.get(s.id)?.match.tests,c={id:s.id,title:s.title,plan:s.plan,planVersion:s.version,own:s.own,...s.regression?{regression:s.regression}:{},...a?{matched:a}:{}},u=o[s.id],l=!u||u.tree===null||u.tree!==n.tree,d=!!u&&u.planVersion!==s.version,f=!!u&&!l&&!d;if(!r.has(s.id)&&!a&&!f)return{...c,status:"no test",tests:[]};if(!u)return{...c,status:"not run",tests:[]};if(!f){let p=d?`the result was for ${s.plan} ${u.planVersion===null?"in draft":`v${u.planVersion}`}, and ${s.version===null?"its draft":`v${s.version}`} applies now`:"the code has changed since the tests ran";return{...c,status:"stale",tests:u.tests,detail:p}}return{...c,status:u.outcome,tests:u.tests,...u.matched?{viaMatch:!0}:{}}})}var HZ=e=>e.includes(" > ")?e.slice(0,e.indexOf(" > ")):null;function c_(e,t,r){let i=Ji(r).latest;if(!i)return[];let n=new Set(i.tests),o=new Set(i.tests.map(HZ)),s=[];for(let[a,{path:c,match:u}]of Yn(e,t).matches)for(let l of u.tests.filter(d=>!n.has(d)&&o.has(HZ(d))))s.push({code:"match-broken",path:c,message:`${a} is matched to "${l}", which is not in the latest test report (${i.report}, ${i.at}): the test was renamed or removed since it was matched.`,remedy:`Tag the test with [${a}] in its name, match ${a} again to the test as the report names it now, or drop the match.`});return s}import{existsSync as em,readdirSync as Wde,readFileSync as eV}from"node:fs";import{dirname as Jde,join as ol,relative as Hde,sep as Yde}from"node:path";function J(e){let t=Gr(e),r=t.process.ok?t.process.value.documents:vt.documents;return Xde(e,t.types,r)}function Xde(e,t,r){let i={root:e,artifacts:new Map,problems:[]},n=o=>Hde(e,o).split(Yde).join("/");for(let o of t){let s=ol(e,o.dir);if(em(s))for(let a of Wde(s,{withFileTypes:!0})){if(!a.isDirectory()||a.name.startsWith("."))continue;let c=ol(s,a.name),u=tV(i,n,ol(c,o.file),a.name,o.type,o.parent);if(u)for(let l of r){let d=ol(c,l.dir,l.file);if(!em(d)&&!em(ol(c,l.dir,ma)))continue;let f=tV(i,n,d,`${u.id}-${l.suffix}`,l.type,"required",u.id),p=l.name??l.type;f&&(o.type==="bug"||o.type==="adhoc")&&i.problems.push({code:"plan-not-allowed",path:f.path,message:`${f.path}: ${u.id} is ${o.type==="bug"?"a bug":"an ad-hoc unit"}, which has no ${p}. Attached documents belong to the stages of the process, from the business idea down.`}),f?.parent&&f.parent.id!==u.id&&i.problems.push({code:"plan-parent-mismatch",path:f.path,message:`${f.path}: the ${p} sits under ${u.id} but declares ${It(f.parent)} as its parent.`,remedy:`Set parent to ${u.id} pinned to the version the ${p} was written against.`})}}}for(let o of i.artifacts.values())o.parent&&!i.artifacts.has(o.parent.id)&&i.problems.push({code:"parent-not-found",path:o.path,message:`${o.id} declares ${It(o.parent)} as its parent, but no artifact ${o.parent.id} exists.`});return i}function tV(e,t,r,i,n,o,s){let a=ol(Jde(r),ma),c=em(a),u=em(r)?r:c?a:null;if(!u)return e.problems.push({code:"artifact-file-missing",path:t(r),message:`${t(r)} is missing for ${i}.`}),null;let l=t(u),d=dr(eV(u,"utf8"),l);if(!d.ok)return e.problems.push(...d.problems),null;let f=d.value.frontmatter,p;if(u===a)p={path:l,document:d.value};else if(c){let y=dr(eV(a,"utf8"),t(a));y.ok?p={path:t(a),document:y.value}:e.problems.push(...y.problems)}for(let y of s===void 0?[{path:l,fields:f},...p&&p.path!==l?[{path:p.path,fields:p.document.frontmatter}]:[]]:[])y.fields.id!==i&&e.problems.push({code:"id-mismatch",path:y.path,message:`${y.path}: the id field is ${JSON.stringify(y.fields.id??null)} but the artifact's directory is ${i}.`,remedy:`Set id to ${i}.`});let m;if(f.parent!==void 0&&f.parent!==null){let y=typeof f.parent=="string"?sn(f.parent):null;y?m=y:e.problems.push({code:"bad-link",path:l,message:`${l}: parent ${JSON.stringify(f.parent)} is not an artifact ID. Links use IDs such as US-012@v1, never file paths.`})}else o==="required"&&e.problems.push({code:"missing-parent",path:l,message:`${i} must declare a parent but has none.`});m&&o==="none"&&e.problems.push({code:"unexpected-parent",path:l,message:`${i} is a ${n}, which has no parent, but declares ${It(m)}.`});let h={id:i,type:n,path:l,document:d.value,...typeof f.title=="string"?{title:f.title}:{},...m?{parent:m}:{},...s!==void 0?{owner:s}:{},...p?{onboard:p}:{}},g=e.artifacts.get(i);return g?(e.problems.push({code:"duplicate-id",path:l,message:`${i} exists twice: ${g.path} and ${l}.`}),null):(e.artifacts.set(i,h),h)}var Qde=["task","story"];function sl(e,t,r,i={}){let n=typeof r.testCase=="string"&&r.testCase.trim()!==""?r.testCase.trim():void 0,o=_e(e);if(r.parent===void 0||r.parent===null||r.parent==="")return n?I({code:"bug-test-case-without-parent",message:`testCase ${n} names a test case, but the bug has no parent. A test case belongs to the unit where the bug was found.`,remedy:`Set parent to the ${o.one("task")} or ${o.one("story")} whose test case found the bug, or leave testCase out for a standalone bug.`}):N({});let s=typeof r.parent=="string"?sn(r.parent):null;if(!s)return I({code:"bug-bad-parent",message:`parent ${JSON.stringify(r.parent)} is not an artifact ID such as TK-001.`});let a=t.artifacts.get(s.id);if(!a)return I({code:"bug-parent-not-found",message:`There is no artifact ${s.id} to attach the bug to.`});if(!Qde.includes(a.type))return I({code:"bug-parent-type",message:`${s.id} is ${o.a(a.type)}. A bug is attached to the ${o.one("task")} or ${o.one("story")} where it was found.`,remedy:`Set parent to ${o.a("task")} or ${o.a("story")}, or leave it out for a standalone bug.`});let c=oe(e,a);if(i.version0)return N({parent:s,...n?{testCase:n}:{}});if(c.state!=="approved")return I({code:"bug-parent-not-approved",message:`${s.id} is not approved, so no work on it can have found a bug.`,remedy:"Leave parent out to record a standalone bug, or record the problem in the draft itself."});let u={id:a.id,version:s.version??c.approvedVersion};if(n){let l=Wi(e,t,a.id).map(d=>d.id);if(!l.includes(n))return I({code:"bug-test-case-unknown",message:`${n} is not a test case of ${It(u)}.`,remedy:l.length>0?`Use one of ${l.join(", ")}, or leave testCase out.`:`${a.id} has no test cases; leave testCase out.`})}return N({parent:u,...n?{testCase:n}:{}})}function tm(e,t){let r=t;for(let i=0;r&&i<3;i++){if(r.type==="story")return r;if(r.type==="adhoc"||!r.parent)return null;r=e.artifacts.get(r.parent.id)}return null}import{existsSync as efe,readdirSync as tfe,readFileSync as rfe}from"node:fs";import{join as rV}from"node:path";var Wr="@v0";function Zt(e){let t=e.trim();return t.endsWith(Wr)?{id:t.slice(0,-Wr.length),v0:!0}:{id:t,v0:!1}}function ka(e){if(!e.onboard)return null;let{document:t,path:r}=e.onboard,i=typeof t.frontmatter.parent=="string"?sn(t.frontmatter.parent):null,n=t.frontmatter.title;return{id:e.id,type:e.type,path:r,document:t,onboard:e.onboard,...typeof n=="string"?{title:n}:{},...i?{parent:i}:{},...e.owner!==void 0?{owner:e.owner}:{}}}function u_(e,t){if(t.path!==t.onboard?.path)return t.path;let r=t.owner!==void 0?$t(e).documents.find(i=>i.type===t.type)?.file:Gr(e).types.find(i=>i.type===t.type)?.file;return`${Pe(t)}/${r??`${t.type}.md`}`}function Sa(e,t){return Object.entries(t.sections).filter(([,r])=>r.required).map(([r])=>r).filter(r=>{let i=e.sections.find(n=>n.name.trim().toLowerCase()===r.toLowerCase());return!i||e_(i.body)})}function os(e,t){let r=rV(e,t,gi);return efe(r)?tfe(r,{withFileTypes:!0}).filter(i=>i.isFile()&&!i.name.startsWith(".")).map(i=>i.name).sort():[]}function nV(e,t){return Object.fromEntries(os(e,t).map(r=>[r,yi(rfe(rV(e,t,gi,r),"utf8"))]))}function iV(e){return Object.fromEntries(e.repos.flatMap(t=>t.baseline?[[t.name,t.baseline]]:[]))}function l_(e,t){let r=Je(e,t);if(!r.includes(0))return null;let i=an(e,t,0);return i?{by:i.approvedBy.replace(/\s*<[^>]*>\s*$/,"")||i.approvedBy,on:i.approvedAt.slice(0,10),sources:Object.keys(i.sources??{}),empty:i.empty??[],inForce:r.at(-1)===0}:null}function oV(e,t){let r=l_(e,t);return r?.inForce?`code as it was before BuildKeel, reviewed by ${r.by} on ${r.on}`:null}function al(e){let t=e.frontmatter.scope;return typeof t=="string"?t.trim()?[t.trim()]:[]:Array.isArray(t)?t.filter(r=>typeof r=="string"&&r.trim()!=="").map(r=>r.trim()):[]}function ss(e){let t=e.document.frontmatter.completes;return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function sV(e,t){if(t.document.frontmatter.completes===void 0)return[];let r=ss(t),i=oe(e,t),n=`Remove the completes field from ${t.id}, and save it again with save_draft (id ${t.id}).`;return r===null?[{id:"completes",passed:!1,message:`${t.id} has completes ${JSON.stringify(t.document.frontmatter.completes)}, which is not a version number such as 1.`,remedy:n}]:i.onboarded?r!==i.approvedVersion?[{id:"completes",passed:!1,message:`${t.id} says it completes v${r}, but v${i.approvedVersion} is in force.`,remedy:`If this version only completes v${i.approvedVersion} with what version 0 describes, set completes to ${i.approvedVersion}; if it changes behavior, remove the completes field. Then save it again with save_draft (id ${t.id}).`}]:[]:[{id:"completes",passed:!1,about:t.id,message:`${t.id} says it completes v${r}, but it has no approved version 0: a version only completes another with what version 0 describes, or fills in what version 0 left empty.`,remedy:`Approve ${t.id}${Wr} first, or ${n.charAt(0).toLowerCase()}${n.slice(1)}`}]}function bi(e,t){return t.some(r=>r.endsWith("/")?e.startsWith(r):e===r||e.startsWith(`${r}/`))}function aV(e){let t=e.split("/"),r=t.at(-1)??"";return t.slice(0,-1).some(i=>["test","tests","__tests__","spec"].includes(i))||/[._-](test|spec)\.[^.]+$/.test(r)||/^test_.*\.py$/.test(r)}var _i=e=>e.trim().replace(/\\/g,"/").replace(/^\.\//,"");function rm(e,t,r){let i=fe(e,t);if(!i)return null;let n=i.document.frontmatter.repo;if(typeof n=="string"&&n.trim()!==""&&n.trim()!==r)return null;let o=al(i.document).map(_i);return o.length>0?{record:t,version:i.version,paths:o}:null}function nm(e,t,r,i){let n=[],o=[];for(let a of t.artifacts.values()){if(a.owner!==void 0)continue;let c=rm(e,a,i);if(c&&n.push(c),!tr.includes(a.type))continue;let u=el(e,t,r,a.id).repos.find(l=>l.repo===i);u&&u.files.length>0&&o.push({record:a,commits:u.commits,files:new Set(u.files)})}let s=(a,c)=>a.record.id.localeCompare(c.record.id,"en",{numeric:!0});return{repo:i,scopes:n.sort(s),units:o.sort(s)}}function cV(e,t){let r=e.scopes.flatMap(i=>{let n=i.paths.filter(o=>bi(t,[o]));return n.length>0?[{...i,covering:n}]:[]});return{file:t,scopes:r,units:e.units.filter(i=>i.files.has(t))}}var uE=(e,t)=>e.scopes.some(r=>bi(t,r.paths))||e.units.some(r=>r.files.has(t));function uV(e,t,r,i,n){let o=new Set(n),s=new Map,a=(d,f)=>{d===i||!o.has(f)||s.set(d,(s.get(d)??new Set).add(f))};for(let[d,f]of r.units)for(let p of f)for(let m of p.files)a(d,m);for(let d of t.artifacts.values())if(tr.includes(d.type)){for(let{record:f}of Wn(e,d).completions)if(f.repo===r.name)for(let p of f.files)a(d.id,p)}let c=new Map,u=d=>c.get(d.id)??{story:d,files:[],via:[],scopes:[]};for(let[d,f]of s){let p=t.artifacts.get(d),m=p?tm(t,p):null;if(!p||!m)continue;let h=u(m);h.files=[...new Set([...h.files,...f])].sort(),h.via.push({unit:p,files:[...f].sort()}),c.set(m.id,h)}for(let d of t.artifacts.values()){if(d.type!=="story"&&d.type!=="task"||d.id===i)continue;let f=rm(e,d,r.name),p=f?tm(t,d):null,m=f?n.filter(g=>bi(g,f.paths)):[];if(!f||!p||m.length===0)continue;let h=u(p);h.files=[...new Set([...h.files,...m])].sort(),h.scopes.push({record:d,paths:f.paths.filter(g=>m.some(y=>bi(y,[g]))),files:m}),c.set(p.id,h)}let l=(d,f)=>f.files.length-d.files.length;return[...c.values()].map(d=>({...d,via:d.via.sort((f,p)=>l(f,p)||f.unit.id.localeCompare(p.unit.id,"en",{numeric:!0}))})).sort((d,f)=>l(d,f)||d.story.id.localeCompare(f.story.id,"en",{numeric:!0}))}var nfe=(e,t)=>`${e}-${t.suffix}`;function im(e,t,r,i){let n=r.chain.find(o=>o.type===i.type);return n?n.requires.flatMap(o=>{let s=r.documents.find(u=>u.type===o);if(!s)return[];let a=nfe(i.id,s),c=t.artifacts.get(a);return[{owner:i,kind:s,id:a,...c?{record:c}:{},approved:c?fe(e,c):null}]}):[]}function d_(e,t,r,i){let n={};for(let o of i)for(let s of im(e,t,r,o))s.kind.type!=="test-plan"&&s.approved&&(n[s.id]=s.approved.version);return n}function f_(e,t){return[...e.artifacts.values()].filter(r=>r.owner===t.id).sort((r,i)=>r.id.localeCompare(i.id))}function p_(e){let t=n=>e.documents.find(o=>o.type===n)?.name??n,r=e.chain.map(n=>{let o=n.requires.map(t),s=`${n.prefix}-${"1".padStart(n.width,"0")}`;return`| ${n.name}${n.core?"":" (added)"} | ${s} | ${o.length>0?o.join(", "):"nothing"} |`}),i=e.documents.map(n=>n.name);return["| Stage | First ID | Requires before work under it starts |","|---|---|---|",...r,`Documents that can be attached at any stage: ${i.slice(0,-1).join(", ")}${i.length>1?" and ":""}${i.at(-1)??""}.`]}var om=gr(Kr(),1);import{createHash as ife}from"node:crypto";import{existsSync as fV,mkdirSync as ofe,readdirSync as sfe,readFileSync as afe,realpathSync as lE,rmSync as pV,writeFileSync as lV}from"node:fs";import{join as fE}from"node:path";var dV=new Map;function pE(e){let t=dV.get(e);if(t===void 0)try{t=at(e,["remote","get-url","origin"]),dV.set(e,t)}catch{t=lE(e)}return ife("sha256").update(t).digest("hex").slice(0,16)}var cl=(e,t)=>fE(e,"claims",pE(t)),mE=(e,t)=>fE(e,`${t}.yaml`),hE=e=>fV(e.workingTree);function m_(e){try{let t=(0,om.parse)(afe(e,"utf8"));return typeof t?.unit=="string"&&typeof t.workingTree=="string"?t:null}catch{return null}}function as(e,t,r){let i=m_(mE(cl(e,t),r));return i&&hE(i)?i:null}function h_(e,t){let r=cl(e,t);return fV(r)?sfe(r).filter(i=>i.endsWith(".yaml")).map(i=>m_(fE(r,i))).filter(i=>i!==null&&hE(i)).sort((i,n)=>i.unit.localeCompare(n.unit,"en",{numeric:!0})):[]}var dE=(e,t)=>{try{return lE(e)===lE(t)}catch{return e===t}};function mV(e,t,r,i){let n=as(e,t,r);return n&&!dE(n.workingTree,i)?n:null}function hV(e,t,r,i=new Date){let n=cl(e,t);ofe(n,{recursive:!0});let o=mE(n,r.unit),s={...r,claimedAt:i.toISOString().replace(/\.\d{3}Z$/,"Z")};for(let c=0;c<3;c++)try{return lV(o,(0,om.stringify)(s),{flag:"wx"}),{held:s,ours:!0}}catch(u){if(u.code!=="EEXIST")throw u;let l=m_(o);if(l&&hE(l)){if(!dE(l.workingTree,r.workingTree))return{held:l,ours:!1};let d={...l,branch:r.branch,host:r.host};return lV(o,(0,om.stringify)(d)),{held:d,ours:!0}}pV(o,{force:!0})}let a=m_(o);return a?{held:a,ours:dE(a.workingTree,r.workingTree)}:{held:s,ours:!1}}function gE(e,t,r){pV(mE(cl(e,t),r),{force:!0})}function gV(e,t,r){let i=as(e,t,r);if(!i)return null;gE(e,t,r);let n=Ke(i.workingTree)?.activeUnit===r;return n&&Hn(i.workingTree,{activeUnit:null,activeBranch:null,scope:[]}),{claim:i,cleared:n}}var cfe=2e4,g_=e=>e.toISOString().replace(/\.\d{3}Z$/,"Z");async function yV(e,t=()=>new Date){let r=hZ(e);if(!r)return{status:"no-remote",checkedAt:g_(t())};let i=r.split("/")[0],n=await Ft(e,["fetch","--quiet","--no-tags",i],{timeoutMs:cfe});if(n.code!==0)return{status:"failed",reason:n.stderr.split(`
|
|
253
|
+
`)[0]||"the fetch did not finish",checkedAt:g_(t())};let o=await Ft(e,["rev-list","--count",`HEAD..${r}`,"--","."]),s=o.code===0?Number(o.stdout):0;return s>0?{status:"behind",behind:s,upstream:r,checkedAt:g_(t())}:{status:"current",checkedAt:g_(t())}}function ul(e){return e?e.status==="behind"?`The spec tree is ${e.behind} commit${e.behind===1?"":"s"} behind ${e.upstream} (checked ${e.checkedAt}). Pull the spec repo to see the latest approvals.`:e.status==="failed"?`Could not check whether the spec tree is up to date (${e.reason}). Work continues with the local copy.`:null:null}import{readFileSync as ope}from"node:fs";import{dirname as spe,isAbsolute as NE,join as ape,posix as T_,relative as A_,sep as cpe}from"node:path";import{isAbsolute as ufe,posix as lfe,relative as dfe,sep as ffe}from"node:path";function ll(e,t,r){let i=new Map,n=dfe(e,t);if(n.startsWith("..")||ufe(n))return i;let o=n.split(ffe).join("/"),a=[...r.artifacts.values()].filter(u=>tr.includes(u.type)).map(u=>u.id),c=(de(e,["for-each-ref","--format=%(refname:short)","refs/heads/bk/"])??"").split(`
|
|
254
|
+
`).filter(Boolean);for(let u of c){let l=Qu(u,a),d=l?r.artifacts.get(l):void 0;if(!d||i.has(d.id))continue;let f=fe(r.root,d)?.version??null;if(kt(r.root,d,f))continue;let p=lfe.join(o,Pe(d),Qb);(de(e,["ls-tree","--name-only",u,"--",`${p}/`])??"").split(`
|
|
255
|
+
`).filter(Boolean).some(g=>f===null||new RegExp(`^version: ${f}$`,"m").test(de(e,["show",`${u}:${g}`])??""))&&i.set(d.id,u)}return i}import{existsSync as VV,readdirSync as Ufe,readFileSync as x_}from"node:fs";import{basename as qfe,dirname as S_,join as Ta}from"node:path";var $V=gr(Kr(),1);import{existsSync as pfe,readFileSync as mfe}from"node:fs";import{join as vV}from"node:path";function hfe(e){let t=n=>n.trim().replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^[-.]+|[-.]+$/g,"").slice(0,60),r=t(e.source).toLowerCase()||"source",i=t(e.key??"")||t(e.title??"").toLowerCase();return`${r}${i?`-${i}`:""}.md`}function bV(e,t,r,i,n){let o=[],s=[];for(let a of i){if(!a.source.trim())return I({code:"source-unnamed",message:"Each source needs a name for where it came from, such as Jira or Confluence."});let c=`${r}/${gi}/${hfe(a)}`;if(a.drop){if(!pfe(vV(t,c)))return I({code:"source-not-found",message:`There is no kept source ${c} to drop.`});let f=e.remove(c);if(!f.ok)return f;s.push(c);continue}if(a.text===void 0||a.text.trim()==="")return I({code:"source-empty",message:`The source ${a.source}${a.key?` ${a.key}`:""} has no text. Keep what was read, exactly as it was read.`});let u={source:a.source.trim(),...a.key?{key:a.key.trim()}:{},...a.title?{title:a.title.trim()}:{},...a.link?{link:a.link.trim()}:{},readAt:n.readAt,readBy:n.readBy},l=a.text.endsWith(`
|
|
256
|
+
`)?a.text:`${a.text}
|
|
257
|
+
`,d=e.writeFile(c,`---
|
|
258
|
+
${(0,$V.stringify)(u,{lineWidth:0})}---
|
|
259
|
+
|
|
260
|
+
${l}`);if(!d.ok)return d;o.push(c)}return N({written:o,dropped:s})}function dl(e,t){return os(e,t).map(r=>{let i=dr(mfe(vV(e,t,gi,r),"utf8")),n=i.ok?i.value.frontmatter:{},o=l=>typeof n[l]=="string"||typeof n[l]=="number"?String(n[l]):void 0,s=o("source")??r.replace(/\.md$/,""),a=o("key"),c=o("link"),u=o("title");return{file:r,source:s,...a?{key:a}:{},...c?{link:c}:{},...u?{title:u}:{}}})}var yE="Sources";function y_(e,t){let r=e.frontmatterBlock.includes(`\r
|
|
261
|
+
`)?`\r
|
|
262
|
+
`:`
|
|
263
|
+
`,i=e.sections.filter(a=>a.name.trim().toLowerCase()!==yE.toLowerCase());if(t.length===0)return{...e,sections:i};let n=i.at(-1);n&&!n.body.endsWith(`${r}${r}`)&&(i[i.length-1]={...n,body:n.body.endsWith(r)?`${n.body}${r}`:`${n.body}${r}${r}`});let o=a=>`- ${[a.source,a.key,a.title?`"${a.title}"`:void 0].filter(Boolean).join(" ")}${a.link?`: ${a.link}`:""} (${gi}/${a.file})`,s={name:yE,headingLine:`## ${yE}${r}`,body:`${r}Kept as read, beside this version 0. Written by BuildKeel.${r}${r}${t.map(o).join(r)}${r}`};return{...e,preamble:e.sections.length===0&&!e.preamble.endsWith(r)?`${e.preamble}${r}`:e.preamble,sections:[...i,s]}}var _V="",wV="",kV="",gfe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),yfe=(e,t)=>new RegExp(`(?<![A-Za-z0-9-])${gfe(t)}(?![0-9])`).test(e);function vfe(e,t,r){let i=[];for(let n of BR(e,{codeRoot:t.codeRoot,repo:t.repo},t.home)){if(!n.dir||!n.baseline)continue;let o=de(n.dir,["rev-parse","--verify","--quiet",`${n.baseline}^{commit}`]);if(!o)continue;let s=Yo(n.dir,e.root),a=r.flatMap(d=>["--grep",d]),c=de(n.dir,["-c","core.quotePath=false","log",o,"--no-merges","--no-renames","--fixed-strings",...a,`--format=${_V}%H${wV}%B${kV}`,"--name-only"]),u=[],l=new Set;for(let d of(c??"").split(_V)){let f=d.indexOf(kV);if(f<0)continue;let[p,m=""]=d.slice(0,f).split(wV);if(!(!p||!r.some(h=>yfe(m,h)))){u.push({id:p,subject:m.split(`
|
|
264
|
+
`)[0]?.trim()??""});for(let h of d.slice(f+1).split(`
|
|
265
|
+
`).map(g=>g.trim()).filter(Boolean))(!s||!h.startsWith(`${s}/`))&&l.add(h)}}u.length>0&&i.push({repo:n.name,commits:u,files:[...l].sort()})}return i}function $fe(e,t){return[...new Set(dl(e,Pe(t)).flatMap(r=>r.key?[r.key]:[]))].sort()}function SV(e,t,r,i,n,o){let s=$fe(e.root,n);if(s.length===0)return null;let a=vfe(e,i,s),c=[];for(let p=fe(e.root,n)?.parent;p;){let m=r.artifacts.get(p.id),h=m?fe(e.root,m):null;if(!m||!h||c.includes(`${m.id}@v${h.version}`))break;c.push(`${m.id}@v${h.version}`),p=h.parent}let u=a.length>0?a:[{repo:i.repo,commits:[],files:[]}],l=Xo(o.approvedAt,o.approvedBy).replace(/\.yaml$/,""),d=[];for(let p of u){let m={unit:n.id,version:0,ancestors:c,repo:p.repo,onboarded:!0,keys:s,commits:p.commits.map(y=>({...y,by:"key"})),excluded:[],merged:null,files:p.files,tests:{ranAt:null,plans:[],cases:{}},finishedBy:o.approvedBy,finishedAt:o.approvedAt,host:i.host},h=Hu(n,`${l}${u.length>1?`-${p.repo}`:""}.yaml`),g=t.createRecord(h,Yu(m));if(!g.ok)return{keys:s,records:d,commit:g};d.push({path:h,record:m})}let f=Ct(e.root,d.map(p=>p.path),`done: ${n.id} v0 (onboarded)`);return{keys:s,records:d,commit:f}}var vE=e=>{let t=e.records.flatMap(i=>i.record.commits.map(n=>({...n,repo:i.record.repo})));if(t.length===0)return`No commit made before the baseline names ${e.keys.join(" or ")}, so it is recorded as done with no commits; the paths in its scope stand as its link to the code.`;let r=[...new Set(t.map(i=>i.repo))];return`${t.length===1?"1 commit":`${t.length} commits`} made before the baseline name ${e.keys.join(" or ")}, in ${r.join(" and ")}: ${t.map(i=>`${i.id.slice(0,7)} ${i.subject}`).join("; ")}. They count as its code.`};import{existsSync as Ife}from"node:fs";import{join as Pfe}from"node:path";var fl=gr(Kr(),1);import{existsSync as bfe,readFileSync as _fe}from"node:fs";import{join as wfe}from"node:path";var Tn="onboarding/map.yaml",kfe=b.object({name:b.string().trim().min(1),repo:b.string().trim().min(1),paths:b.array(b.string().trim().min(1)).min(1),summary:b.string().trim().min(1).optional()}),Sfe=b.object({areas:b.array(kfe)}).superRefine((e,t)=>{let r=new Set;e.areas.forEach((i,n)=>{let o=i.name.toLowerCase();r.has(o)&&t.addIssue({code:"custom",path:["areas",n,"name"],message:`repeats the area name "${i.name}"`}),r.add(o),i.paths.forEach((s,a)=>{(s.startsWith("/")||s.split("/").includes(".."))&&t.addIssue({code:"custom",path:["areas",n,"paths",a],message:`must be a path inside the repo, not ${s}`})})})});function xfe(e){let t=e.areas.map(r=>({name:r.name,repo:r.repo,paths:r.paths,...r.summary?{summary:r.summary}:{}}));return`# The capability areas of the code, for documenting it area by area. Written by BuildKeel's onboarding.
|
|
266
|
+
${(0,fl.stringify)({areas:t},{lineWidth:0})}`}function xV(e,t=Tn){let r;try{r=(0,fl.parse)(e)}catch(n){let o=n instanceof fl.YAMLParseError?n.message.split(`
|
|
267
|
+
`)[0]:String(n);return I({code:"map-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=Sfe.safeParse(r??{});return i.success?N(i.data):I(...Tr(i.error.issues,t,"map-invalid"))}function xa(e){let t=wfe(e,Tn);return bfe(t)?xV(_fe(t,"utf8")):N(null)}var sm=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function IV(e,t){let r=xa(e.root);if(!r.ok)return r;let i=r.value?.areas??[],n=f=>i.findIndex(p=>p.name.toLowerCase()===f.trim().toLowerCase()),o=f=>({code:"map-no-area",message:`The map has no area called "${f}".${i.length>0?` Its areas are ${sm(i.map(p=>p.name))}.`:""}`}),s=f=>({name:f.name.trim(),repo:f.repo?.trim()||e.defaultRepo,paths:[...new Set(f.paths.map(_i).filter(Boolean))],...f.summary?.trim()?{summary:f.summary.trim()}:{}}),a,c;switch(t.op){case"set":a=t.areas.map(s),c=`map of ${a.length} area${a.length===1?"":"s"}`;break;case"merge":{let f=t.names.map(n),p=t.names.filter((v,$)=>f[$]===-1);if(p.length>0)return I(...p.map(o));if(t.names.length<2)return I({code:"map-merge-one",message:"Name at least two areas to merge."});let m=f.map(v=>i[v]),h=[...new Set(m.map(v=>v.repo))];if(h.length>1)return I({code:"map-merge-repos",message:`${sm(t.names)} are in different repos (${sm(h)}); an area is in one repo.`});let g={name:t.to.trim(),repo:h[0],paths:[...new Set(m.flatMap(v=>v.paths))]},y=Math.min(...f);a=i.flatMap((v,$)=>$===y?[g]:f.includes($)?[]:[v]),c=`merge ${sm(m.map(v=>v.name))} into ${g.name}`;break}case"split":{let f=n(t.name);if(f===-1)return I(o(t.name));let p=t.areas.map(m=>s({...m,repo:m.repo??i[f].repo}));a=[...i.slice(0,f),...p,...i.slice(f+1)],c=`split ${i[f].name} into ${sm(p.map(m=>m.name))}`;break}case"rename":{let f=n(t.name);if(f===-1)return I(o(t.name));a=i.map((p,m)=>m===f?{...p,name:t.to.trim()}:p),c=`rename ${i[f].name} to ${t.to.trim()}`;break}}let u=xfe({areas:a}),l=xV(u);if(!l.ok)return l;let d=e.writer.writeFile(Tn,u);return d.ok?N({map:l.value,summary:c,commit:Ct(e.root,[Tn],`onboard: ${c}`)}):d}function PV(e,t){let r=[...e.artifacts.values()].filter(n=>n.type===ee.type);if(t===void 0)return r;let i=new Set([t]);for(let n=!0;n;){n=!1;for(let o of e.artifacts.values())o.parent&&i.has(o.parent.id)&&!i.has(o.id)&&o.owner===void 0&&(i.add(o.id),n=!0)}return r.filter(n=>i.has(Ut(n.id)))}function v_(e,t,r,i){let n=i.flatMap(l=>{let d=Pn(e,l);return d?St(e,l,d.document).map(f=>({id:f.id,title:f.text,plan:l.id,covers:f.covers??[]})):[]}),{matches:o}=Yn(e,t),s=cE(r,e,n.map(l=>l.id)),a=n.filter(l=>!s.has(l.id)&&!o.has(l.id)),c=Ji(r).latest,u=null;if(c){let l=aE(e,t),d=new Set([...o.values()].flatMap(p=>p.match.tests)),f=p=>[...p.matchAll(/\[([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)\]/g)].some(m=>l.has(m[1]));u=c.tests.filter(p=>!d.has(p)&&!f(p))}return{total:n.length,untested:a,unmatched:u,report:c?{report:c.report,at:c.at}:null}}var TV=e=>[...e.artifacts.values()].filter(t=>{if(t.type!==ee.type)return!1;let r=e.artifacts.get(Ut(t.id));return oe(e.root,t).onboarded||r!==void 0&&oe(e.root,r).onboarded});function Tfe(e){return Ife(Pfe(e.root,Tn))||[...e.artifacts.values()].some(t=>oe(e.root,t).onboarded)}function AV(e,t){let r;try{r=Ho(e,["-c","core.quotePath=false","ls-files","-z"])}catch{return[]}let i=Yo(e,t);return r.split("\0").filter(Boolean).filter(n=>!aV(n)&&n!==Nt&&n!==".gitignore"&&!(i&&n.startsWith(`${i}/`)))}function RV(e,t,r,i){if(!Tfe(e))return null;let n=nm(e.root,e,t,i),o=AV(r,e.root),s=TV(e),a=v_(e.root,e,r,s);return{repo:i,described:o.filter(c=>uE(n,c)).length,total:o.length,tests:s.length>0?{withTest:a.total-a.untested.length,total:a.total}:null,unmatched:a.unmatched?.length??null}}function $E(e,t){if(t===0)return"0%";let r=Math.round(e/t*100);return r===0&&e>0?"under 1%":`${r}%`}var Afe=(e,t)=>bi(e,t)||t.some(r=>bi(r,[e]));function $_(e,t,r,i,n){let o=nm(e.root,e,t,i),s=AV(r,e.root),a=[...e.artifacts.values()].flatMap(c=>{let u=oe(e.root,c).onboardOpen?c.onboard:void 0;if(!u)return[];let l=u.document.frontmatter.repo,d=typeof l=="string"&&l.trim()!==""?l.trim():null;return[{id:c.id,repo:d,paths:al(u.document).map(_i)}]});return n.areas.map(c=>{if(c.repo!==i)return{area:c,state:"elsewhere",files:0,described:0,drafts:[]};let u=s.filter(p=>bi(p,c.paths)),l=u.filter(p=>uE(o,p)).length,d=a.filter(p=>(p.repo===null||p.repo===c.repo)&&p.paths.some(m=>Afe(m,c.paths))).map(p=>p.id),f=d.length>0?"drafted":u.length===0?"no code":l===u.length?"onboarded":l>0?"partly":"not started";return{area:c,state:f,files:u.length,described:l,drafts:d}})}var b_=e=>e.find(t=>t.state==="drafted"||t.state==="partly"||t.state==="not started")??null;function EV(e,t){let r=Je(e,t);if(!r.includes(0))return!1;let i=r.at(-1);for(;i>0;){let n=an(e,t,i)?.completes;if(n===void 0)return!1;i=n}return!0}function OV(e){let t=[];for(let r of e.artifacts.values()){if(!EV(e.root,r))continue;let i=fe(e.root,r),n=lt(r.type,e.root);if(!i||!n.ok)continue;let o=Sa(i.document,n.value.template);o.length>0&&t.push({record:r,version:i.version,empty:o})}return t.sort((r,i)=>r.record.id.localeCompare(i.record.id,"en",{numeric:!0}))}function pl(e,t,r){let i=oe(e,t);if(!(i.draftOpen?ss(t)===i.approvedVersion:i.state==="approved")||!EV(e,t))return r;let o=fe(e,t),s=lt(t.type,e);if(!o||!s.ok)return r;let a=Sa(o.document,s.value.template),c=u=>(u.code==="section-missing"||u.code==="section-empty")&&a.some(l=>u.message.includes(`"${l}"`));return r.filter(u=>!c(u))}function am(e,t,r){let i=[],n=(s,a,c)=>i.push({code:s,path:r.path,message:`${r.path}: ${a}`,...c?{remedy:c}:{}});for(let[s,a]of Object.entries(t.fields)){let c=e.frontmatter[s];if(c==null||c===""||Array.isArray(c)&&c.length===0){a.required&&n("field-missing",`the ${s} field is required.`);continue}a.type==="text"&&typeof c!="string"&&typeof c!="number"?n("field-malformed",`the ${s} field must be a line of text.`):a.type==="list"&&!(Array.isArray(c)&&c.every(l=>typeof l=="string"))?n("field-malformed",`the ${s} field must be a list, such as [src/reset/, src/email/].`):a.type==="link"&&!(typeof c=="string"&&sn(c))&&n("field-malformed",`the ${s} field must be an artifact ID such as EP-01@v1, not ${JSON.stringify(c)}.`)}let o=new Map;for(let s of e.sections){let a=s.name.trim().toLowerCase();o.set(a,[...o.get(a)??[],s])}for(let[s,a]of Object.entries(t.sections)){let c=o.get(s.toLowerCase())??[];c.length>1&&n("section-duplicate",`the "${s}" section appears ${c.length} times.`);let u=c[0];if(!u){a.required&&n("section-missing",`the "${s}" section is missing.`,`Add a "## ${s}" section.`);continue}if(e_(u.body)){a.required&&n("section-empty",`the "${s}" section is empty.`);continue}if(!a.items)continue;let l=t_(u.body,a.items.style),d=new RegExp(`^${Rfe(r.itemOwner)}-${a.items.prefix}([1-9][0-9]*)$`),f=`${r.itemOwner}-${a.items.prefix}1`;l.length===0&&a.required&&n("section-empty",`the "${s}" section has no entries. Each entry starts with its ID, such as ${f}.`);let p=new Set;for(let m of l){if(!m.id||!d.test(m.id)){n("item-malformed",`in "${s}", "${m.raw.split(`
|
|
268
|
+
`)[0]?.trim()}" does not start with an ID such as ${f}.`);continue}p.has(m.id)&&n("item-duplicate",`in "${s}", ${m.id} is used twice.`),p.add(m.id),a.items.covers==="required"&&(m.covers===null||m.covers.length===0)&&n("covers-missing",`${m.id} does not say what it covers.`,'Add a line such as "covers: [US-001-AC1]" under it.')}}return i}var Rfe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var Ia=e=>e.type===ee.type?Ut(e.id):e.id;function cs(e,t,r,i){let n=i.template,o=Ia(r),s=am(r.document,n,{itemOwner:o,path:r.path}),a=Je(e,r).flatMap(c=>{let u=Ar(e,r,c);return u?[{version:c,items:In(u.document,n,o)}]:[]});s.push(...RZ(a,In(r.document,n,o),r.path,o));for(let c of ts){let{ids:u,invalid:l}=rs(r.document.frontmatter,c),d=c==="related"?"related: [EP-01]":"changes: [EP-01-DD]";for(let f of l)s.push({code:"link-malformed",path:r.path,message:`${r.path}: ${c} must list artifact IDs, such as ${d}, not ${JSON.stringify(f)}.`});for(let f of u)f===r.id?s.push({code:"link-unknown",path:r.path,message:`${r.path}: ${r.id} names itself in ${c}.`}):t.artifacts.has(f)||s.push({code:"link-unknown",path:r.path,message:`${r.path}: ${c} names ${f}, which does not exist.`})}if(r.owner!==void 0&&r.document.frontmatter.id!==void 0){let c=r.type===ee.type?"a test plan":"an attached document";s.push({code:"plan-has-id",path:r.path,message:`${r.path}: ${c} has no id field; ${r.id} is named after the artifact it ${r.type===ee.type?"tests":"belongs to"}.`,remedy:`Remove the id line, keeping parent, and save the ${r.type===ee.type?"plan":"document"} again.`})}if(r.type===ee.type){let c=ns(e,t,r);if(c){let u=St(e,r);s.push(...o_(c,u),...DZ(c,u))}}return s}function NV(e,t,r){let i=Ia(t),n=[t.document,...Je(e,t).flatMap(s=>Ar(e,t,s)?.document??[])],o=r_(n,r.template,i);return ba(r.template).map(({prefix:s})=>`${i}-${s}${(o.get(s)??0)+1}`)}function bE(e,t){let r=new Map;for(let i of t){let n=e.artifacts.get(i),o=/^(.+)-[A-Z]{1,4}[1-9][0-9]*$/.exec(i)?.[1],s=n??(o?e.artifacts.get(o):void 0);if(!s)continue;let a=r.get(s.id)??{target:s,items:[]};a.items=n||a.items===null?null:[...a.items,i],r.set(s.id,a)}return[...r.values()]}function CV(e,t,r,i){let n=t.artifacts.get(Ut(r.id)),o=new Set([n?.id,n?.parent?.id]),s={};for(let a of St(e,r,i))for(let{target:c}of bE(t,a.covers??[])){let u=Je(e,c).at(-1);!o.has(c.id)&&u!==void 0&&(s[c.id]=u)}return Object.fromEntries(Object.entries(s).sort(([a],[c])=>a.localeCompare(c,"en",{numeric:!0})))}var w_=gr(Kr(),1);var jV="ids.yaml",__=2e4,zV=10;function k_(e,t){let r=Gu(e),i=Jb(e)?.split("/")[0],n=i&&r.includes(i)?i:r.includes("origin")?"origin":r[0]??null;return{repo:e,branch:t,remote:n}}function wE(e){let t=e?(0,w_.parse)(e):null;return{last:{...t?.last??{}},assigned:{...t?.assigned??{}}}}function Efe(e){return`# BuildKeel number counters. Written by BuildKeel when artifacts are approved; do not edit.
|
|
269
|
+
${(0,w_.stringify)(e)}`}var Pa=e=>e.remote?`refs/remotes/${e.remote}/${e.branch}`:`refs/heads/${e.branch}`;async function cm(e,t){for(let r=0;r<zV;r++){let i=await Ofe(e);if(!i.ok)return i;let n=wE(i.value?await kE(e.repo,i.value):null),o=n.assigned[t.draftId];if(o)return N(o);let s=Math.max(n.last[t.type]??0,t.floor)+1,a=t.format(s);n.last[t.type]=s,n.assigned[t.draftId]=a;let c=await Nfe(e.repo,Efe(n),i.value,`Reserve ${a} for ${t.draftId}`);if(!c.ok)return c;let u=await Cfe(e,c.value,i.value);if(!u.ok)return u;if(u.value)return N(a)}return I({code:"counter-busy",message:`The number counter kept changing under us after ${zV} tries.`})}async function DV(e,t){let r=await Ft(e.repo,["rev-parse","--verify","--quiet",Pa(e)]);return r.code!==0?null:wE(await kE(e.repo,r.stdout)).assigned[t]??null}async function MV(e,t){let r=await Ft(e.repo,["rev-parse","--verify","--quiet",Pa(e)]);return r.code!==0?0:wE(await kE(e.repo,r.stdout)).last[t]??0}var _E=(e,t)=>I({code:"counter-unreachable",message:`The number counter on ${e.remote} (branch ${e.branch}) could not be reached: ${t.split(`
|
|
270
|
+
`)[0]||"no reason given"}`});async function Ofe(e){if(!e.remote){let n=await Ft(e.repo,["rev-parse","--verify","--quiet",Pa(e)]);return N(n.code===0?n.stdout:null)}let t=await Ft(e.repo,["ls-remote","--heads",e.remote,`refs/heads/${e.branch}`],{timeoutMs:__});if(t.code!==0)return _E(e,t.stderr);if(t.stdout==="")return N(null);let r=await Ft(e.repo,["fetch","--quiet","--no-tags",e.remote,`+refs/heads/${e.branch}:${Pa(e)}`],{timeoutMs:__});if(r.code!==0)return _E(e,r.stderr);let i=await Ft(e.repo,["rev-parse","--verify","--quiet",Pa(e)]);return N(i.code===0?i.stdout:null)}async function kE(e,t){let r=await Ft(e,["cat-file","-p",`${t}:${jV}`]);return r.code===0?r.stdout:null}async function Nfe(e,t,r,i){let n=await Ft(e,["hash-object","-w","--stdin"],{input:t}),o=n.code===0?await Ft(e,["mktree"],{input:`100644 blob ${n.stdout} ${jV}
|
|
271
|
+
`}):n,s=o.code===0?await Ft(e,["commit-tree",o.stdout,...r?["-p",r]:[],"-m",i]):o;return s.code!==0?I({code:"counter-write-failed",message:`Could not write the number counter: ${s.stderr}`}):N(s.stdout)}async function Cfe(e,t,r){if(!e.remote){let s=await Ft(e.repo,["update-ref",Pa(e),t,r??""]);return N(s.code===0)}let i=await Ft(e.repo,["push","--quiet",e.remote,`${t}:refs/heads/${e.branch}`],{timeoutMs:__});if(i.code===0)return await Ft(e.repo,["update-ref",Pa(e),t]),N(!0);let n=await Ft(e.repo,["ls-remote","--heads",e.remote,`refs/heads/${e.branch}`],{timeoutMs:__});return n.code!==0?_E(e,n.stderr):(n.stdout.split(/\s/)[0]||null)!==r?N(!1):I({code:"counter-push-refused",message:`The remote ${e.remote} refused the number counter branch ${e.branch}: ${i.stderr.split(`
|
|
272
|
+
`)[0]}`,remedy:"Allow pushes to that branch, or set settings.idsBranch in buildkeel.yaml to a branch you may push to."})}function LV({index:e,record:t,conformance:r,typeName:i,process:n,version0:o=!1}){let s=[],a=`Fix the draft and save it again with save_draft (id ${t.id}${o?", version 0":""}).`,c=jfe(e,t,i,n,a,o);s.push(...c.checks);for(let u of e.problems.filter(l=>l.path===t.path))s.push({id:"tree",passed:!1,message:u.message,remedy:u.remedy??a});for(let u of r){let l=u.code==="coverage-gap"?"coverage-gap":u.code==="covers-unknown"?"covers":u.code.startsWith("link-")?"link":"template";s.push({id:l,passed:!1,message:u.message,remedy:u.remedy??a})}return s.push(...zfe(e,t,i)),{checks:s,...c.parent?{parent:c.parent}:{}}}function zfe(e,t,r){return ts.flatMap(i=>rs(t.document.frontmatter,i).ids.flatMap(n=>{let o=e.artifacts.get(n);if(!o||o.id===t.id)return[];let s=oe(e.root,o);return s.state==="approved"?[]:[{id:"link-approved",passed:!1,about:o.id,message:`${t.id} names ${r(o.type)} ${o.id} in ${i}, but ${o.id} ${s.state==="pending"?"is waiting for its number":"is still a draft"}, so there is no version to link to.`,remedy:`Approve ${o.id} first with ${ie("approve")} ${o.id}.`}]}))}function jfe(e,t,r,i,n,o){let s=[],a=t.parent;if(!a)return{checks:s};let c=e.artifacts.get(a.id);if(!c)return s.push({id:"parent-exists",passed:!1,message:`The parent ${a.id} of ${t.id} does not exist.`,remedy:n}),{checks:s,parent:a};let u=SE(i,t,c);if(u)return s.push({id:"parent-stage",passed:!1,message:u.message,remedy:u.remedy??n}),{checks:s,parent:a};let l=r(c.type),d=oe(e.root,c);if(d.state==="draft")return s.push({id:"parent-approved",passed:!1,about:c.id,message:`The parent ${l} ${c.id}${c.title?` "${c.title}"`:""} is still a draft.`,remedy:`Approve ${c.id} first with ${ie("approve")} ${c.id}.`}),{checks:s,parent:a};if(d.state==="pending")return s.push({id:"parent-approved",passed:!1,about:c.id,message:`The parent ${l} ${c.id} is approved, but its number is still pending.`,remedy:`Approve again when the spec repo's remote can be reached; ${c.id} gets its number first.`}),{checks:s,parent:a};let f=d.approvedVersion;return o&&a.version!==void 0&&Je(e.root,c).includes(a.version)?{checks:s,parent:a}:a.version!==void 0&&a.version!==f?(s.push({id:"parent-pinned",passed:!1,about:c.id,message:`${t.id} is pinned to ${It(a)}, but the current approved version of ${c.id} is v${f}.`,remedy:`Check ${t.id} against ${c.id} v${f}, then save it with parent ${c.id}@v${f}.`}),{checks:s,parent:a}):{checks:s,parent:{id:c.id,version:f}}}function SE(e,t,r){let i=Vp(e,t.type);if(!i||r.type===i.type)return null;let n=Vu(e),s=Vp(e,i.type)?.type===r.type?`; if it has none yet, draft one under ${r.id} with ${ie("new")} ${i.name} ${r.id}`:"";return{code:"parent-stage",path:t.path,message:`${t.id} sits under ${r.id}, ${n.a(r.type)}, but in this process ${n.a(t.type)} sits under ${n.a(i.type)}.`,remedy:`Save ${t.id} with its parent set to the ${n.one(i.type)} it belongs to${s}.`}}import{readdirSync as Dfe,readFileSync as Mfe}from"node:fs";import{join as qV}from"node:path";var UV=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Lfe(e,t,r,i){let o=/^---[ \t]*\r?\n[\s\S]*?\r?\n---[ \t]*(\r?\n|$)/.exec(e)?.[0]??"",s=o.replace(new RegExp(`^(parent:[ \\t]*)${UV(t)}([ \\t]*)$`,"m"),`$1${r}@v${i}$2`),a=new RegExp(`(?<![A-Za-z0-9-])${UV(t)}(?![A-Za-z0-9])`,"g");return(s+e.slice(o.length)).replace(a,r)}function FV(e,t){return Dfe(qV(e,t),{withFileTypes:!0}).flatMap(r=>r.isDirectory()?FV(e,`${t}/${r.name}`):[`${t}/${r.name}`])}function xE(e,t,r,i){let n=Pe(t),o=`${n.slice(0,n.lastIndexOf("/")+1)}${r}`,s=l=>l.startsWith(`${n}/`)?`${o}${l.slice(n.length)}`:l,a=FV(e.root,n).map(l=>({from:l,to:s(l)})),c=new Set([...e.artifacts.values()].flatMap(l=>[l.path,...l.onboard?[l.onboard.path]:[]])),u=[];for(let l of c){let d=Mfe(qV(e.root,l),"utf8"),f=Lfe(d,t.id,r,i);f!==d&&u.push({path:s(l),before:d,after:f})}return{from:t.id,to:r,dirFrom:n,dirTo:o,moved:a,rewrites:u}}function ZV(e,t){let r=e.move(t.dirFrom,t.dirTo);if(!r.ok)return r;let i=[];for(let n of t.rewrites){let o=e.writeFile(n.path,n.after);if(!o.ok){for(let s of i)e.writeFile(s.path,s.before);return e.move(t.dirTo,t.dirFrom),I(...o.problems)}i.push(n)}return N(t)}var Ffe=e=>(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z");function BV(e){if(!e.access.writable)return I(e.access.problem);let t=Et(e);if(!t.ok)return t;let r=Gb(e.root);if(!r)return I({code:"approve-not-git",message:`The spec tree at ${e.root} is not in a git repository. Each approval is committed, so it needs one.`,remedy:"Run git init in the spec tree (or the repository holding it), then approve again."});let i=xn(e.root);if(!i)return I({code:"approve-no-identity",message:"Git has no name and email set for the spec repo, so the approver cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then approve again.'});let n;return N({process:t.value,repo:r,approver:i,location:()=>n??=k_(e.root,e.config.settings.idsBranch)})}function um(e,t){let r=Lb(e,t);return r?r.name:t==="bug"||t==="adhoc"?e[t].name:e.chain.find(i=>i.type===t)?.name??t}function Zfe(e,t,r){let i={};for(let n of ts){let o=rs(r.document.frontmatter,n).ids.flatMap(s=>{let a=t.artifacts.get(s),c=a?oe(e,a).approvedVersion:null;return c!==null?[[s,c]]:[]});o.length>0&&(i[n]=Object.fromEntries(o))}return i}function PE(e,t,r=""){let i=new RegExp(`-${r}([0-9]+)$`),n=0;for(let o of e.artifacts.values()){if(o.type!==t||_a(o.id))continue;let s=i.exec(o.id)?.[1];s&&(n=Math.max(n,Number(s)))}return n}function KV(e,t,r,i){let n=e.chain.find(s=>s.type===r)??(r==="bug"&&i?e.bug:void 0);if(!n)return null;let o=i?e.onboardedLetter:"";return{key:i?`${r}:${o}`:r,floor:PE(t,r,o),format:s=>ya(n,s,o)}}function IE(e,t,r,i,n=!1){let o=lt(i.type,e.root);if(!o.ok)return o;let{checks:s,parent:a}=LV({index:r,record:i,conformance:n?[]:pl(e.root,i,cs(e.root,r,i,o.value)),typeName:u=>um(t,u),process:t,version0:n});n||s.push(...sV(e.root,i));let c=Do("approve",$i(e,"approve"),s);return N({template:o.value,gate:c,...a?{parent:a}:{}})}var GV=e=>e.state==="draft"&&!e.onboardOnly||e.state==="approved"&&e.draftOpen;function WV(e){let t=Et(e);if(!t.ok)return t;let r=J(e.root),i=[];for(let n of r.artifacts.values()){if(n.type==="adhoc")continue;let o=oe(e.root,n);if(o.state==="pending")continue;let s=o.onboardOpen?ka(n):null;if(s){let c=IE(e,t.value,r,s,!0);c.ok&&i.push({record:s,version:0,target:o.onboardOnly?n.id:`${n.id}${Wr}`,gate:c.value.gate})}if(n.type==="bug"||!GV(o))continue;let a=IE(e,t.value,r,n);a.ok&&i.push({record:n,version:(o.approvedVersion??0)+1,target:n.id,gate:a.value.gate})}return N(i.sort((n,o)=>n.record.id.localeCompare(o.record.id,"en",{numeric:!0})||n.version-o.version))}function Jr(e,t){let r=Et(e);return r.ok?um(r.value,t):t}async function lm(e,t){let r=BV(e.tree);if(!r.ok)return r;let{process:i,approver:n,location:o}=r.value,s=Zt(t.id),a=J(e.tree.root),c=a.artifacts.get(s.id);if(!c)return I({code:"approve-not-found",message:`There is no artifact ${s.id}.`});let u=oe(e.tree.root,c),l=s.v0||u.onboardOnly;if(c.type==="adhoc"||c.type==="bug"&&!l)return I({code:"approve-not-approvable",message:`${s.id} is a ${um(i,c.type)}. Bugs and ad-hoc units are not approved.`});if(u.state==="pending")return t.apply?N({kind:"assigned",pending:await I_(e)}):I({code:"approve-pending",message:`${s.id} is already approved; its number is pending until the number counter can be reached.`,remedy:"Call approve again with apply=true to try to assign it now."});if(l&&u.onboarded)return I({code:"approve-v0-exists",message:`${s.id} already has an approved version 0. An artifact has one version 0 at most.`,remedy:`To change what ${s.id} says, save the changes with save_draft (id ${s.id}); that opens its next version.`});if(l&&!u.onboardOpen)return I({code:"approve-no-v0-draft",message:`${s.id} has no draft of version 0 waiting.`,remedy:`Draft it with save_draft (id ${s.id}, version 0), then approve ${s.id}${Wr}.`});if(!l&&u.state==="approved"&&!u.draftOpen){let Ge=u.onboardOpen?` Its version 0 is waiting: approve ${s.id}${Wr}.`:"";return I({code:"approve-nothing-new",message:`${s.id} v${u.approvedVersion} is approved and no new version is open.${Ge}`,remedy:`To change it, save the changes with save_draft (id ${s.id}); that opens v${(u.approvedVersion??0)+1}, which is then approved the same way.`})}let d=t.apply?await I_(e):{assigned:[],problems:[]};d.assigned.length>0&&(a=J(e.tree.root));let f=a.artifacts.get(s.id)??c,p=l?ka(f)??f:f,m=IE(e.tree,i,a,p,l);if(!m.ok)return m;let{template:h,parent:g}=m.value,y=t.first&&!t.apply?J4(m.value.gate,t.first):m.value.gate,v=l?0:(u.approvedVersion??0)+1,$=Math.max(v,u.approvedVersion??0),_=um(i,p.type);if(y.outcome==="blocked")return N({kind:"refused",id:p.id,gate:y});let w=p.owner===void 0&&u.approvedVersion===null&&_a(p.id),k=KV(i,a,p.type,l);if(w&&!k)return I({code:"approve-no-stage",message:`The process has no ${p.type} stage, so ${p.id} cannot be numbered.`});let T=l?{sources:os(e.tree.root,Pe(p)),empty:Sa(p.document,h.template)}:void 0;if(!t.apply){let Ge,Pt=[],Ea;if(w&&k){Ge=await DV(o(),p.id)??k.format(Math.max(await MV(o(),k.key),k.floor)+1);let Oa=xE(a,p,Ge,v);Ea=Oa.dirTo,Pt=Oa.rewrites.map(ps=>ps.path).filter(ps=>S_(ps)!==Oa.dirTo)}return N({kind:"preview",id:p.id,name:_,...p.title?{title:p.title}:{},version:v,...Ge?{likelyId:Ge}:{},...Ea?{dirTo:Ea}:{},references:Pt,...g?{parent:It(g)}:{},approver:n,autoPush:e.tree.config.settings.autoPush,gate:y,...T?{version0:T}:{},inForce:$})}let C=[],D=p.document;if(g&&g.version!==void 0&&p.parent?.version===void 0&&(D=Sn(D,{parent:It(g)})),l&&(D=y_(D,dl(e.tree.root,Pe(p)))),fr(D)!==fr(p.document)){let Ge=e.writer.writeFile(p.path,fr(D));if(!Ge.ok)return Ge;C.push(p.path),a=J(e.tree.root)}let K=a.artifacts.get(p.id)??f,V=l?ka(K)??p:K,te={approvedBy:n,approvedAt:Ffe(e),...l?{onboarded:!0,baseline:iV(e.tree.config),sources:nV(e.tree.root,Pe(V)),empty:T?.empty??[]}:{template:{type:h.template.type,version:h.template.version,source:h.source,...h.org?{org:h.org}:{}},...ss(V)!==null?{completes:ss(V)}:{}},...g?{parent:It(g)}:{},...V.type===ee.type?{pins:CV(e.tree.root,a,V,V.document)}:{},...Zfe(e.tree.root,a,V)},Oe=null;if(w&&k){let Ge=await cm(o(),{type:k.key,draftId:p.id,floor:k.floor,format:k.format});if(!Ge.ok)return Ge.problems.some(Pt=>Pt.code.startsWith("counter-"))?N(await Vfe(e,V,v,te,C,Ge.problems,y,d)):Ge;Oe=Ge.value}let _t=HV(e,a,V,v,te,Oe);if(!_t.ok)return _t;let le=Oe??p.id,G=Ct(e.tree.root,[...C,..._t.value.paths],`approve: ${le} v${v}`),{pushed:dt,unpushed:mr}=G.ok?await YV(e):{pushed:null,unpushed:null},Yr=G.ok&&v===0?JV(e,le,te):null,Xn=J(e.tree.root),hr=[...Xn.artifacts.values()].filter(Ge=>Ge.owner===le).filter(Ge=>{let Pt=oe(e.tree.root,Ge);return Pt.state==="draft"||Pt.onboardOpen||Pt.state==="approved"&&Pt.draftOpen}).map(Ge=>({id:Ge.id,name:um(i,Ge.type)})).sort((Ge,Pt)=>Ge.id.localeCompare(Pt.id)),ki=Xn.artifacts.get(le);return N({kind:"approved",id:le,version:v,...Oe?{draftId:p.id}:{},frozen:_t.value.frozen,approval:_t.value.approval,hash:_t.value.hash,references:_t.value.references,commit:G,push:dt,unpushed:mr,gate:y,documents:hr,pending:d,...T?{version0:T}:{},inForce:$,nextOpen:ki?GV(oe(e.tree.root,ki)):!1,...Yr?{onboardedWork:Yr}:{}})}function JV(e,t,r){if(!e.code)return null;let i=J(e.tree.root),n=i.artifacts.get(t);return!n||n.type!=="task"&&n.type!=="bug"?null:SV(e.tree,e.writer,i,e.code,n,r)}function HV(e,t,r,i,n,o){let s=r.path,a=[],c=[],u=qfe(u_(e.tree.root,r));if(o){let g=xE(t,r,o,i),y=ZV(e.writer,g);if(!y.ok)return y;s=`${g.dirTo}${r.path.slice(g.dirFrom.length)}`,a.push(...g.moved.flatMap(v=>[v.from,v.to]),...g.rewrites.map(v=>v.path)),c=g.rewrites.map(v=>v.path).filter(v=>S_(v)!==S_(s))}let l=x_(Ta(e.tree.root,s),"utf8"),d=S_(s),f=yi(l),p={artifact:o??r.id,version:i,hash:f,...n,...o?{draftId:r.id}:{}},m=e.writer.createRecord(Zi(d,i),l);if(!m.ok)return m;let h=e.writer.createRecord(Vi(d,i),RR(p));if(!h.ok)return h;if(a.push(s,m.value,h.value),i===0){a.push(...os(e.tree.root,d).map(v=>`${ha(d)}/${v}`));let g=`${d}/${u}`;if(!VV(Ta(e.tree.root,g))){let v=e.writer.writeFile(g,l);if(!v.ok)return v;a.push(g)}let y=e.writer.remove(s);if(!y.ok)return y}return N({frozen:m.value,approval:h.value,hash:f,references:c,paths:a})}async function YV(e){return{pushed:e.tree.config.settings.autoPush?await vi(e.tree.root):null,unpushed:Hb(e.tree.root)}}async function Vfe(e,t,r,i,n,o,s,a){let c=x_(Ta(e.tree.root,t.path),"utf8"),u=qp(Pe(t),r),l=e.writer.createRecord(u,RR({artifact:t.id,version:r,hash:yi(c),...i}));if(!l.ok)return{kind:"pending",draftId:t.id,version:r,record:u,reason:[...o,...l.problems],commit:l,gate:s,pending:a};let d=Ct(e.tree.root,[...n,t.path,u],`approve: ${t.id} v${r} (number pending)`);return d.ok&&await YV(e),{kind:"pending",draftId:t.id,version:r,record:u,reason:o,commit:d,gate:s,pending:a}}function Bfe(e,t){let r=Pe(t),n=(VV(Ta(e,r,Gn))?Ufe(Ta(e,r,Gn)):[]).map(o=>Zu.exec(o)?.[1]).find(o=>o!==void 0);return n===void 0?null:{version:Number(n),path:qp(r,Number(n))}}async function I_(e){let t={assigned:[],problems:[]},r=null;for(;;){let i=J(e.tree.root),n=[...i.artifacts.values()].find(v=>oe(e.tree.root,v).state==="pending"&&!t.problems.some($=>$.path===v.path));if(!n||(r??=BV(e.tree),!r.ok))return t;let{process:o,location:s}=r.value,a=Bfe(e.tree.root,n);if(!a)return t;let{version:c,path:u}=a,l=c===0?ka(n)??n:n,d=ga(x_(Ta(e.tree.root,u),"utf8"),u),f=x_(Ta(e.tree.root,l.path),"utf8");if(!d.ok||d.value.hash!==yi(f)){t.problems.push({code:"pending-altered",path:n.path,message:`${l.id} cannot be numbered: ${d.ok?`${l.path} was changed after it was approved`:`${u} cannot be read`}.`,remedy:`Restore ${l.path} from git history, then approve again.`});continue}let p=KV(o,i,l.type,c===0);if(!p){t.problems.push({code:"approve-no-stage",path:n.path,message:`The process has no ${l.type} stage, so ${l.id} cannot be numbered.`});continue}let m=await cm(s(),{type:p.key,draftId:l.id,floor:p.floor,format:p.format});if(!m.ok)return t.problems.push(...m.problems),t;let h={...d.value};for(let v of["artifact","version","hash","draftId"])delete h[v];let g=HV(e,i,l,c,h,m.value);if(!g.ok){t.problems.push(...g.problems.map(v=>({...v,path:n.path})));continue}let y=Ct(e.tree.root,[u,...g.value.paths],`approve: ${m.value} v${c}`);y.ok&&c===0&&JV(e,m.value,h),t.assigned.push({from:l.id,to:m.value,version:c,commit:y})}}var ml=gr(Kr(),1);import{existsSync as Kfe,readdirSync as Gfe,readFileSync as Wfe}from"node:fs";import{join as TE}from"node:path";var XV="repins",Jfe=b.object({target:b.string().min(1),testCase:b.string().min(1).optional(),from:b.number().int().nonnegative(),to:b.number().int().nonnegative(),decidedBy:b.string().min(1),decidedAt:b.string().datetime({message:"must be a UTC time such as 2026-10-01T08:12:57Z"})});function QV(e){let t=(e.testCase??e.target).toLowerCase().replace(/[^a-z0-9]+/g,"-");return Xo(e.decidedAt,e.decidedBy).replace(/\.yaml$/,`-${t}.yaml`)}var e2=(e,t)=>`${Pe(e)}/${XV}/${t}`;function t2(e){let t={target:e.target,...e.testCase?{testCase:e.testCase}:{},from:e.from,to:e.to,decidedBy:e.decidedBy,decidedAt:e.decidedAt};return(0,ml.stringify)(t,{lineWidth:0})}function Hfe(e,t){let r;try{r=(0,ml.parse)(e)}catch(n){let o=n instanceof ml.YAMLParseError?n.message.split(`
|
|
273
|
+
`)[0]:String(n);return I({code:"record-unreadable",path:t,message:`${t} is not valid YAML: ${o}`})}let i=Jfe.safeParse(r??{});return i.success?N(i.data):I(...Tr(i.error.issues,t,"record-invalid"))}function hl(e,t){let r=`${Pe(t)}/${XV}`;if(!Kfe(TE(e,r)))return{repins:[],problems:[]};let i=[],n=[];for(let o of Gfe(TE(e,r)).filter(s=>s.endsWith(".yaml")).sort()){let s=`${r}/${o}`,a=Hfe(Wfe(TE(e,s),"utf8"),s);a.ok?i.push({path:s,record:a.value}):n.push(...a.problems)}return{repins:i,problems:n}}function us(e,t,r,i){return t.map(n=>n.record).filter(n=>n.target===r&&n.testCase===i).reduce((n,o)=>Math.max(n,o.to),e)}var RE=e=>e.replace(/\s+/g," ").trim(),r2=e=>e?.raw.trim(),n2=e=>RE(e.raw.replace(/^\s*[-*+] +/,""));function i2(e,t){let r=Bi(e,t)?.body,i=r===void 0?"":Qo(r).trim();return i===""?void 0:i}function o2(e){if(!(e==null||e===""||Array.isArray(e)&&e.length===0))return Array.isArray(e)?`[${e.map(String).join(", ")}]`:typeof e=="object"?JSON.stringify(e):String(e)}function AE(e,t,r,i){return{...e,change:t===void 0?"added":r===void 0?"removed":i?"unchanged":"changed",...t!==void 0?{before:t}:{},...r!==void 0?{after:r}:{}}}function Yfe(e,t,r,i){let n=[];for(let[a,c]of Object.entries(e.fields)){if(!c.tracked)continue;let[u,l]=[o2(r.frontmatter[a]),o2(i.frontmatter[a])];(u!==void 0||l!==void 0)&&n.push(AE({id:a,kind:"field"},u,l,JSON.stringify(r.frontmatter[a])===JSON.stringify(i.frontmatter[a])))}let o=In(r,e,t),s=In(i,e,t);for(let[a,c]of Object.entries(e.sections)){if(!c.tracked)continue;if(!c.items){let[m,h]=[i2(r,a),i2(i,a)];(m!==void 0||h!==void 0)&&n.push(AE({id:a,kind:"section"},m,h,RE(m??"")===RE(h??"")));continue}let u=m=>new Map(m.filter(h=>h.section===a).map(h=>[h.id,h])),[l,d]=[u(o),u(s)],f=[...new Set([...l.keys(),...d.keys()])],p=m=>(d.get(m)??l.get(m))?.number??0;for(let m of f.sort((h,g)=>p(h)-p(g))){let[h,g]=[l.get(m),d.get(m)];n.push(AE({id:m,kind:"entry",section:a},r2(h),r2(g),!!h&&!!g&&n2(h)===n2(g)))}}return n}function EE(e,t,r,i){let n=lt(t.type,e);if(!n.ok)return n;let o=Ar(e,t,r),s=i===null?Ar(e,t):Ar(e,t,i),a=o?s?null:i:r;return!o||!s?I({code:"version-missing",message:`${t.id} v${a} cannot be read: its frozen copy is missing or is not a valid artifact file.`}):N({id:t.id,from:o.label,to:s.label,items:Yfe(n.value.template,Ia(t),o.document,s.document)})}function s2(e,t){let r=[],i=[],n=new Map,o=l=>{let d=n.get(l.id);if(!d){let f=hl(e,l);i.push(...f.problems),d=f.repins,n.set(l.id,d)}return d},s=l=>l.type==="bug"?l:fe(e,l);for(let l of t.artifacts.values()){if(l.type===ee.type)continue;let d=s(l)?.parent,f=d?t.artifacts.get(d.id):void 0;if(!d||d.version===void 0||!f)continue;let p=us(d.version,o(l),f.id);r.push({id:l.id,kind:"artifact",holder:l,...l.title?{title:l.title}:{},target:f,pinned:p,items:null})}let a=new Map(h_(nZ(e),e).map(l=>[l.unit,l]));for(let l of t.artifacts.values()){if(!tr.includes(l.type))continue;let d=l.type==="bug"||l.type==="adhoc"?null:fe(e,l)?.version??null,f=l.type==="bug"||l.type==="adhoc"||d!==null?kt(e,l,d):null,p=f?f.record.documents:a.get(l.id)?.documents;for(let[m,h]of Object.entries(p??{})){let g=t.artifacts.get(m);g&&r.push({id:l.id,kind:"artifact",holder:l,...l.title?{title:l.title}:{},target:g,pinned:us(h,o(l),m),items:null})}}for(let l of t.artifacts.values()){let d=Je(e,l),f=d.at(-1);if(f===void 0)continue;let p=an(e,l,f)?.related??{};for(let[m,h]of Object.entries(p)){let g=t.artifacts.get(m);if(!g||(r.push({id:l.id,kind:"artifact",holder:l,...l.title?{title:l.title}:{},target:g,pinned:us(h,o(l),m),items:null}),Je(e,g).length===0))continue;let y=f;for(let v of[...d].reverse().slice(1)){if(an(e,l,v)?.related?.[m]===void 0)break;y=v}r.push({id:g.id,kind:"artifact",holder:g,...g.title?{title:g.title}:{},target:l,pinned:us(y,o(g),l.id),items:null})}}for(let l of t.artifacts.values()){if(l.type!==ee.type)continue;let d=fe(e,l),f=t.artifacts.get(Ut(l.id));if(!d||!f)continue;let p=new Map(Object.entries(an(e,l,d.version)?.pins??{}));d.parent?.id===f.id&&d.parent.version!==void 0&&p.set(f.id,d.parent.version);let m=f.type==="task"?fe(e,f)?.parent:void 0;m?.version!==void 0&&p.set(m.id,m.version);for(let h of St(e,l,d.document))for(let{target:g,items:y}of bE(t,h.covers??[])){let v=p.get(g.id);if(v===void 0)continue;let $=us(v,o(l),g.id,h.id);r.push({id:h.id,kind:"test-case",holder:l,...h.text?{title:h.text}:{},target:g,pinned:$,items:y})}}let c=new Map,u=(l,d)=>{let f=`${l.id}@${d}`,p=c.get(f);if(p===void 0){p=d;for(let m of Je(e,l).filter(h=>h>d)){if(an(e,l,m)?.completes!==p)break;p=m}c.set(f,p)}return p};return{dependencies:r.map(l=>({...l,pinned:u(l.target,l.pinned)})),problems:i}}function Xfe(e,t){if(t.kind!=="artifact")return{};let r=t.holder,i=kt(e,r,r.type==="bug"?null:fe(e,r)?.version??null);if(!i)return{};let{repo:n,commits:o,files:s}=i.record;return{finished:{record:i.path,repo:n,commits:o.map(a=>({id:a.id,subject:a.subject})),files:s}}}function Qfe(e,t){return e.change==="unchanged"?!1:t===null||t.includes(e.id)&&e.change!=="added"}function a2(e,t,r){let i=[...t.problems],n=new Map,o=[];for(let s of t.dependencies){let a=r(s);if(a===void 0)continue;let c=`${s.target.id}@${s.pinned}..${a??"draft"}`;if(!n.has(c)){let d=EE(e,s.target,s.pinned,a);d.ok||i.push(...d.problems),n.set(c,d.ok?d.value:null)}let u=n.get(c),l=u?u.items.filter(d=>Qfe(d,s.items)):[];u&&l.length===0||o.push({...s,target:s.target.id,current:a,changes:l,...Xfe(e,s)})}return o.sort((s,a)=>s.target.localeCompare(a.target,"en",{numeric:!0})||s.id.localeCompare(a.id,"en",{numeric:!0})),{suspects:o,problems:i}}function pr(e,t){return a2(e,s2(e,t),r=>{let i=Je(e,r.target).at(-1);return i!==void 0&&i>r.pinned?i:void 0})}function c2(e,t,r){let i=Je(e,r).at(-1);if(i===void 0)return null;let n=ss(r)===i,o=a2(e,s2(e,t),c=>c.target.id===r.id&&!(n&&c.pinned===i)?null:void 0),s=r.type==="story"?EE(e,r,i,null):null;s&&!s.ok&&o.problems.push(...s.problems);let a=s?.ok?s.value.items.filter(c=>c.kind==="entry"&&c.change==="added"):[];return{...o,from:i,gaps:a}}function Aa(e){let t=e.current===null?"its draft":`v${e.current}`;return e.changes.length===0?`built against ${e.target} v${e.pinned}, which cannot be compared with ${t}`:`built against ${e.target} v${e.pinned}, and ${t} changes ${e.changes.map(r=>r.id).join(", ")}`}var OE=tr,epe=new Set(["bug","adhoc"]);function P_(e){let{tree:t,index:r,unitId:i}=e,n=t.root,o=r.artifacts.get(i);if(!o)return I({code:"start-not-found",message:`There is no artifact ${i}.`});let s=h=>Jr(t,h),a=_e(n),c=h=>`${s(h.type)} ${h.id}${h.title?` "${h.title}"`:""}`;if(!OE.includes(o.type))return I({code:"start-not-startable",message:`${o.id} is ${a.a(o.type)}, which is not worked on directly. Start one of the ${a.many("story")} or ${a.many("task")} under it.`});if(o.type==="story"){let h=[...r.artifacts.values()].filter(g=>g.type==="task"&&g.parent?.id===o.id).map(g=>g.id).sort();if(h.length>0)return I({code:"start-story-has-tasks",message:`${o.id} is built through its ${a.many("task")}: ${h.join(", ")}. Start one of them instead.`,remedy:`Start ${a.a("task")} with ${ie("start")} ${h[0]}.`})}if(oe(n,o).onboardOnly)return I({code:"start-onboard-draft",message:`${o.id} is a draft of version 0: it describes code as it was before BuildKeel, and is not worked on.`,remedy:`Approve it with ${ie("approve")} ${o.id}; new work on what it describes is then drafted with ${ie("new")}.`});let u=fe(n,o)?.version??null,l=kt(n,o,u);if(l)return I({code:"start-finished",message:`${o.id}${u!==null?` v${u}`:""} was finished on ${l.record.finishedAt.slice(0,10)} by ${l.record.finishedBy} (${l.path}).`,remedy:u===null?`Record the follow-up as a bug with ${ie("new")} bug, or as an ad-hoc unit with ${ie("adhoc")}.`:`Save a change to ${o.id} with save_draft and approve the new version with ${ie("approve")} ${o.id}; then it can be started and finished again. Or record the follow-up as a bug with ${ie("new")} bug, or as an ad-hoc unit with ${ie("adhoc")}.`});if(u===0)return I({code:"start-onboarded",message:`${o.id} is at version 0: it describes code as it was before BuildKeel, which counts as done.`,remedy:`To change it, save the change with save_draft (id ${o.id}) and approve v1 with ${ie("approve")} ${o.id}; v1 is then started and finished like any other. Or record new work under it with ${ie("new")}.`});let d=[],f=tpe(n,r,o);epe.has(o.type)||(d.push(...npe(n,o,f,c)),d.push(...ipe(n,r,$t(n),o,f,a))),d.push(...rpe(e.suspects??pr(n,r).suspects,o,f,c));let p=mV(e.home,n,o.id,e.workingTree);p&&d.push({id:"claimed",passed:!1,message:`${o.id} is being worked on in another working tree on this machine: ${p.workingTree}${p.branch?` (branch ${p.branch})`:""}, since ${p.claimedAt}.`,remedy:`Carry on with ${o.id} in that working tree, or pick another unit.`});let m=ul(e.freshness);return m&&e.freshness?.status==="behind"&&d.push({id:"stale",passed:!1,warnOnly:!0,message:m,remedy:"Pull the spec repo, then start again to be sure nothing changed."}),N({unit:o,gate:Do("start",$i(t,"start"),d)})}function tpe(e,t,r){let i=[],n=new Set([r.id]),o=fe(e,r)??r;for(;o.parent&&!n.has(o.parent.id);){let s=t.artifacts.get(o.parent.id);if(!s)break;n.add(s.id),i.push(s),o=fe(e,s)??s}return i}function rpe(e,t,r,i){let n=new Map([t,...r].map(o=>[o.id,o]));return e.filter(o=>o.kind==="artifact"&&n.has(o.id)).map(o=>{let s=n.get(o.id);return{id:o.id===t.id?"unit-suspect":"ancestor-suspect",passed:!1,message:o.id===t.id?`The ${i(s)} is suspect: ${Aa(o)}.`:`The ${i(s)}, above ${t.id}, is suspect: ${Aa(o)}.`,remedy:`Review it with ${ie("impact")} ${o.id}, and record whether it is still valid or needs change.`}})}function npe(e,t,r,i){let n=[],o=(a,c)=>{let u=oe(e,a);return u.state==="approved"?null:u.state==="pending"?{id:c?"unit-numbered":"ancestor-approved",passed:!1,message:`The ${i(a)} is approved, but its permanent number is still pending.`,remedy:`Approve again with ${ie("approve")} ${a.id} when the spec repo's remote can be reached; it gets its number first.`}:{id:c?"unit-approved":"ancestor-approved",passed:!1,message:c?`The ${i(a)} is not approved${_a(a.id)?" and has no permanent number yet":""}.`:`The ${i(a)}, above ${t.id}, is not approved.`,remedy:`Approve ${a.id} with ${ie("approve")} ${a.id}.`}},s=o(t,!0);s&&n.push(s);for(let a of r){let c=o(a,!1);c&&n.push(c)}return n}function ipe(e,t,r,i,n,o){let s=[],a=new Set;for(let c of[i,...n])for(let u of im(e,t,r,c)){a.add(u.id);let l=u.kind.type===ee.type,d=l?"test-plan":"required-document";if(!u.record){let p=l?"test-plan":u.kind.name;s.push({id:d,passed:!1,message:l?`${c.id} has no ${u.kind.name}, so there is nothing to check the work against.`:`${c.id} has no ${u.kind.name}, which this process requires of ${o.a(c.type)} before work ${c===i?"on it":"under it"} starts.`,remedy:`Draft one with ${ie("new")} ${p} ${c.id}, then approve it with ${ie("approve")} ${u.id}.`});continue}if(!u.approved){s.push({id:d,passed:!1,message:`The ${u.kind.name} ${u.id} is not approved.`,remedy:`Approve it with ${ie("approve")} ${u.id}.`});continue}if(!l)continue;let f=ns(e,t,u.approved);for(let p of f?Qp(f,St(e,u.approved,u.approved.document)):[])s.push({id:"test-plan-gap",passed:!1,message:`${p.id} is not covered by any test case in ${u.id} v${u.approved.version}: "${p.text}"`,remedy:XR(u.id,c.id,p,`add a test case that covers it to ${u.id} and approve the new version`)})}for(let c of f_(t,i)){if(a.has(c.id)||fe(e,c))continue;let u=o.one(c.type);s.push({id:c.type===ee.type?"test-plan":"required-document",passed:!1,message:`${i.id} has its own ${u}, ${c.id}, which is not approved.`,remedy:`Approve it with ${ie("approve")} ${c.id}.`})}return s}var dm=e=>e.split(cpe).join("/");function upe(e){let t=(e.title??"").toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),r=t.slice(0,41),i=t.length<=40?t:r.includes("-")?r.replace(/-[^-]*$/,""):t.slice(0,40);return i?`bk/${e.id}-${i}`:`bk/${e.id}`}function l2(e,t){let r=A_(e,t);return r!==""&&!r.startsWith("..")&&!NE(r)?`${dm(r)}/`:null}function fm(e,t,r){if(r===Nt)return!0;if(r===".gitignore")return lpe(e);let i=l2(e,t);return i!==null&&(r===`${i}${wt}`||r.startsWith(`${i}${es}/`))}function lpe(e){let t=o=>[".buildkeel/","/.buildkeel/",".buildkeel","/.buildkeel"].includes(o.trim());if(!de(e,["ls-files","--",".gitignore"]))return(de(e,["show",":.gitignore"])??dpe(ape(e,".gitignore"))).split(/\r?\n/).filter(s=>s.trim()!=="").every(t);let n=Ho(e,["diff","HEAD","--unified=0","--",".gitignore"]).split(/\r?\n/).filter(o=>/^[+-](?![+-]{2} )/.test(o));return n.length>0&&n.every(o=>o.startsWith("+")&&t(o.slice(1)))}var dpe=e=>{try{return ope(e,"utf8")}catch{return""}};function CE(e,t){let i=Ho(e,["status","--porcelain=v1","-z","--untracked-files=all"]).split("\0").filter(Boolean),n=[];for(let s=0;s<i.length;s++){let a=i[s],c=a.slice(0,2);n.push(a.slice(3)),(c.startsWith("R")||c.startsWith("C"))&&s++}let o=l2(e,t);return n.filter(s=>!s.startsWith(".buildkeel/")&&(!o||!s.startsWith(o)||fm(e,t,s)))}function fpe(e,t){try{let r=Number(at(e,["rev-list","--count",`${t}..${t}@{upstream}`]));return r>0?`${t} is ${r} commit${r===1?"":"s"} behind its remote as of the last fetch; pull it if you want the latest code.`:void 0}catch{return}}function ppe(e,t,r,i){let n=T_.join(dm(A_(e,t)),T_.dirname(r.path)),o=at(e,["log","--format=%H","--reverse",`${i}..HEAD`,"--",n]).split(`
|
|
274
|
+
`).filter(Boolean);return o.length===0?null:o.every(a=>at(e,["show","--name-only","--format=",a]).split(`
|
|
275
|
+
`).filter(Boolean).every(c=>c.startsWith(`${n}/`)))?o:null}function mpe(e,t,r,i){let n=A_(e,t);return n.startsWith("..")||NE(n)?!0:at(e,["ls-tree","--name-only",i,"--",T_.join(dm(n),r.path)])!==""}function u2(e,t,r,i,n){let o=A_(e,t);if(o.startsWith("..")||NE(o))return[];let s=[];for(let l=i;l;l=l.parent?r.artifacts.get(l.parent.id):void 0)s.push(T_.join(dm(o),spe(l.path)));let a=l=>new Set(at(e,["ls-tree","-r","--name-only",l,"--",...s]).split(`
|
|
276
|
+
`).filter(d=>/\/approvals\/[^/]+\.yaml$/.test(d))),c=a(n),u=new Map($t(t).documents.map(l=>[l.dir,l.suffix]));return[...a("HEAD")].filter(l=>!c.has(l)).sort().map(l=>{let d=l.slice(o===""?0:dm(o).length+1).split("/"),f=d.length===5?u.get(d[2]??""):void 0;return`${d[1]}${f?`-${f}`:""} ${(d.at(-1)??"").replace(/\.yaml$/,"")}`})}function hpe(e,t,r,i,n,o=!1){try{let s=`bk/${i.id}`;if(n&&(_=>_===s||_.startsWith(`${s}-`))(n))return N({kind:"kept",branch:n});let c=n??"this commit",u=(_,w,k)=>I({code:"start-approvals-elsewhere",message:`${i.id} is approved here, on ${c}, but ${w} does not have these approvals yet: ${_.join(", ")}.`,remedy:k}),l=n?.startsWith("bk/")??!1,d=Wb(e),f=at(e,["for-each-ref","--format=%(refname:short)",`refs/heads/${s}`,`refs/heads/${s}-*`]).split(`
|
|
277
|
+
`).filter(Boolean);if(f[0]){let _=u2(e,t,r,i,f[0]);return _.length>0?u(_,`its branch ${f[0]}`,l&&d?`Merge ${c} into ${d}, for example through its pull request, then merge ${d} into ${f[0]}, and start ${i.id} again.`:`Merge ${c} into ${f[0]}, then start ${i.id} again.`):(at(e,["switch","--quiet",f[0]]),N({kind:"switched",branch:f[0]}))}let p=o&&l,m=l&&!p?d??"HEAD":n??"HEAD",h=[];if(m!==(n??"HEAD")&&(i.type==="bug"||i.type==="adhoc")&&!mpe(e,t,i,m)){let _=ppe(e,t,i,m);if(!_)return I({code:"start-unit-elsewhere",message:`${i.id} was recorded here, on ${c}, but ${m}, where its branch would start, does not have it yet.`,remedy:`Merge ${c} into ${m}, for example through its pull request, then start ${i.id} again.`});h=_}let g=m===(n??"HEAD")?[]:u2(e,t,r,i,m);if(g.length>0)return u(g,`${m}, where its branch would start,`,`Merge ${c} into ${m}, for example through its pull request, then start ${i.id} again.`);let y=upe(i);if(at(e,["switch","--quiet","-c",y,m]),h.length>0)try{at(e,["cherry-pick",...h])}catch(_){throw de(e,["cherry-pick","--abort"]),at(e,["switch","--quiet",n??"-"]),de(e,["branch","-D",y]),_}let v=h.map(_=>at(e,["log","-1","--format=%s",_])),$=l&&!p?fpe(e,m):void 0;return N({kind:"created",branch:y,base:m,...$?{baseNote:$}:{},...v.length>0?{carried:v}:{},...p?{stacked:p}:{}})}catch(s){let a=s instanceof Ku?s.stderr.trim():String(s);return I({code:"start-branch-failed",message:`Could not switch to the unit's branch: ${a}`})}}function zE(e,t,r){let i=[],n=new Set([r.id]),o=fe(e,r)??r;for(;o.parent&&!n.has(o.parent.id);){let s=t.artifacts.get(o.parent.id);if(!s)break;n.add(s.id),i.push(s),o=fe(e,s)??s}return i}function d2(e){let{tree:t,codeRoot:r}=e,i=J(t.root),n=Ke(r),o=P_({tree:t,index:i,unitId:e.unitId,workingTree:r,home:e.home,freshness:n?.freshness});if(!o.ok)return o;let{unit:s,gate:a}=o.value,c=ll(r,t.root,i).get(s.id);if(c)return I({code:"start-finished-elsewhere",message:`${s.id} was finished on its branch ${c}, which is not merged yet, so this branch does not show it as done.`,remedy:`Merge ${c}, for example through its pull request. For more work, record the follow-up as a bug with ${ie("new")} bug, or as an ad-hoc unit with ${ie("adhoc")}.`});if(a.outcome==="blocked")return N({kind:"refused",unitId:s.id,gate:a});let u=n?.activeUnit??null,l=CE(r,t.root);if(l.length>0)return N({kind:"uncommitted",unitId:s.id,files:l,activeUnit:u,gate:a});let d=va(r),f=hpe(r,t.root,i,s,d,e.stack);if(!f.ok)return f;let p;try{let v=d_(t.root,i,$t(t.root),[s,...zE(t.root,i,s)]);p=hV(e.home,t.root,{unit:s.id,workingTree:r,branch:f.value.branch,host:e.host,...Object.keys(v).length>0?{documents:v}:{}})}catch(v){return f.value.kind!=="kept"&&d&&(de(r,["switch","--quiet",d]),f.value.kind==="created"&&de(r,["branch","-D",f.value.branch])),I({code:"start-claim-failed",message:`${s.id} was not started: its claim could not be written in ${cl(e.home,t.root)} (${v instanceof Error?v.message:String(v)}).`,remedy:`BuildKeel keeps claims in ${e.home}, which must be writable by the BuildKeel tools. Call them through the host, never from a terminal or a script, then start ${s.id} again.`})}let{held:m,ours:h}=p;if(!h)return I({code:"start-claimed",message:`${s.id} was just claimed by another working tree: ${m.workingTree}.`});let g=(fe(t.root,s)??s).document.frontmatter.scope,y=Array.isArray(g)?g.filter(v=>typeof v=="string"):[];return n||s_(r,i),Hn(r,{activeUnit:s.id,activeBranch:f.value.branch,scope:y,untrackedSince:null}),N({kind:"started",unit:s,previous:u,branch:f.value,claim:m,gate:a})}var jE=5,DE="run the tests with a JUnit XML report and record it with the BuildKeel test_results tool";function gpe(e){let t=`${e.id} "${e.title}"`,r=(i,n)=>({id:`test-case-${e.status.replace(" ","-")}`,passed:!1,message:i,remedy:n});switch(e.status){case"passed":return null;case"no test":return e.own?e.regression?r(`${e.id} has no regression test: no test is tagged [${e.id}].`,`Write a test that fails without the fix and passes with it, with [${e.id}] in its name, then ${DE}.`):r(`${t} has no test tagged [${e.id}].`,`Write a test for it with [${e.id}] in its name, then ${DE}.`):null;case"not run":return r(e.matched?`${t} is matched to ${e.matched.join("; ")}, which has no result.`:`${t} has a tagged test but no result.`,"Run the tests with a JUnit XML report and record it with the BuildKeel test_results tool.");case"stale":return r(`The result of ${t} is stale: ${e.detail??"it no longer matches the code"}.`,"Run the tests again with a JUnit XML report and record it with the BuildKeel test_results tool.");case"failed":return r(`${t} fails${e.tests.length>0?`: ${e.tests.join("; ")}`:""}.`,`Fix the code or the test, then ${DE}.`)}}function f2(e){let{tree:t,unit:r,codeRoot:i}=e,n=[],o=CE(i,t.root);if(o.length>0){let u=o.slice(0,jE).join(", "),l=o.length>jE?` and ${o.length-jE} more`:"",d=o.filter(f=>fm(i,t.root,f));n.push({id:"clean",passed:!1,message:`The working tree has uncommitted changes: ${u}${l}.`,remedy:d.length===o.length?`${d.join(", ")} ${d.length===1?"sets":"set"} BuildKeel up: commit ${d.length===1?"it":"them"} on ${d.length===1?"its":"their"} own, with no BuildKeel-Unit line, then finish again.`:`Commit them with "BuildKeel-Unit: ${r.id}" at the end of the message${d.length>0?`, apart from ${d.join(", ")}, which set BuildKeel up and are committed on their own with no such line`:""}, or set them aside with git stash, then finish again.`})}let s=va(i);e.branch&&s!==e.branch&&n.push({id:"on-branch",passed:!1,message:`The working tree is on ${s??"a detached HEAD"}, not on ${r.id}'s branch ${e.branch}.`,remedy:`Switch back with git switch ${e.branch}, then finish again.`});let a=il({root:t.root,index:e.index,unitId:r.id,codeRoot:i,specRoot:t.root,...e.state?{state:e.state}:{}});for(let u of a){let l=gpe(u);l&&n.push(l)}if(r.type==="task"&&!a.some(u=>u.status==="passed")&&!n.some(u=>u.id.startsWith("test-case-"))){let u=_e(t.root);n.push({id:"tested",passed:!1,message:`${r.id} has no passing test case: it has no test plan of its own, and no test is tagged with one of its ${u.one("story")}'s test cases. Nothing shows its work is tested.`,remedy:`Give ${r.id} a test plan whose test cases cover ${r.id} (draft it with ${ie("new")} test-plan ${r.id} and approve it), or tag a test with the ${u.one("story")} test case it delivers; then run the tests and record the report with the BuildKeel test_results tool.`})}let c=ul(e.freshness);return c&&e.freshness?.status==="behind"&&n.push({id:"stale",passed:!1,warnOnly:!0,message:c,remedy:"Pull the spec repo, then finish again to be sure the test plans did not change."}),{gate:Do("done",$i(t,"done"),n),cases:a}}var ME=(e,t)=>t.type==="epic"||Ub($t(e.root),t.type)||t.type==="story"&&[...e.artifacts.values()].some(r=>r.type==="task"&&r.parent?.id===t.id),ype=new Set([...tr,"story"]);function pm(e,t){let r=[],i=new Set([t.id]),n=o=>{for(let s of e.artifacts.values())s.parent?.id!==o||s.owner!==void 0||i.has(s.id)||(i.add(s.id),ype.has(s.type)&&r.push(s),n(s.id))};return n(t.id),r.sort((o,s)=>o.id.localeCompare(s.id,"en",{numeric:!0}))}function vpe(e){let{tree:t,index:r,parent:i}=e,n=t.root,o=y=>`${Jr(t,y.type)} ${y.id}${y.title?` "${y.title}"`:""}`,s=[],a=pm(r,i).map(y=>{let v=fe(n,y)?.version??null,_=y.type==="bug"||oe(n,y).state==="approved"?kt(n,y,y.type==="bug"&&v===null?null:v):null;return{unit:y,version:v,done:_,onboarded:v===0,claim:as(e.home,n,y.id)}});for(let y of a.filter(v=>!v.done&&!v.onboarded))s.push($pe(n,r,y,i,o));let c=`${i.id}${ee.idSuffix}`,u=r.artifacts.get(c);u&&!fe(n,u)&&s.push({id:"test-plan",passed:!1,message:`The test plan ${c} is not approved.`,remedy:`Approve it with ${ie("approve")} ${c}.`});let l=bpe(n,a,e.repo),d=il({root:n,index:r,unitId:i.id,codeRoot:e.codeRoot,specRoot:n}).map(y=>{let v=y.status==="no test"?l.get(y.id):void 0;return v?{...y,status:"passed",tests:v.tests,from:v.from}:y});for(let y of d){let v=_pe(y);v&&s.push(v)}let f=fe(n,i),p=f?an(n,i,f.version)?.changes??{}:{};for(let[y,v]of Object.entries(p)){let $=r.artifacts.get(y),_=$?Je(n,$).at(-1):void 0;_!==void 0&&_>v||s.push({id:"changes",passed:!1,message:`${i.id} is linked as changing ${$?o($):y}, which has no newer approved version than v${v}, the one in force when the link was made.`,remedy:`Update ${y} to describe how it works now: save the change with save_draft (id ${y}) and approve it with ${ie("approve")} ${y}; then finish ${i.id} again.`})}let m=new Set([i.id,...a.map(y=>y.unit.id)]);for(let y of pr(n,r).suspects){let v=y.kind==="test-case"?Ut(y.holder.id):y.id;if(!m.has(v)||y.kind==="artifact"&&y.id===i.id)continue;let $=y.kind==="test-case"?`The test case ${y.id} in ${y.holder.id}`:`The ${o(y.holder)}, under ${i.id},`;s.push({id:"suspect",passed:!1,message:`${$} is suspect: ${Aa(y)}.`,remedy:`Review it with ${ie("impact")} ${y.id}, and record whether it is still valid or needs change; then finish ${i.id} again.`})}let h=Ke(e.codeRoot)?.freshness,g=ul(h);return g&&h?.status==="behind"&&s.push({id:"stale",passed:!1,warnOnly:!0,message:g,remedy:"Pull the spec repo, then finish again to be sure nothing under it changed."}),{gate:Do("done",$i(t,"done"),s),children:a,cases:d}}function $pe(e,t,r,i,n){let{unit:o}=r,s=oe(e,o),a=(u,l)=>({id:"child-open",passed:!1,message:u,remedy:l});if(o.type!=="bug"&&s.state!=="approved")return a(`The ${n(o)}, under ${i.id}, is not approved${s.state==="pending"?" (its number is pending)":""}, so it is not done.`,`Approve it with ${ie("approve")} ${o.id} and build it; if it is no longer needed, delete its draft from the spec tree.`);if(r.claim)return a(`The ${n(o)}, under ${i.id}, is in progress in ${r.claim.workingTree}${r.claim.branch?` (branch ${r.claim.branch})`:""}.`,`Finish it there with ${ie("done")}, then finish ${i.id} again.`);let c=r.version!==null?kt(e,o,null):null;return c&&r.version!==null?a(`The ${n(o)}, under ${i.id}, is not finished at v${r.version}; v${c.record.version??"?"} was finished on ${c.record.finishedAt.slice(0,10)}.`,`Start it with ${ie("start")} ${o.id} and finish v${r.version} with ${ie("done")}.`):a(`The ${n(o)}, under ${i.id}, is not finished.`,ME(t,o)?`Finish its own units, then finish it with ${ie("done")} ${o.id}.`:`Start it with ${ie("start")} ${o.id} and finish it with ${ie("done")}.`)}function bpe(e,t,r){let i=new Map;for(let n of t)for(let{path:o,record:s}of Wn(e,n.unit).completions)if(s.repo!==r)for(let[a,c]of Object.entries(s.tests.cases))c.result==="passed"&&!i.has(a)&&i.set(a,{tests:c.tests??[],from:{unit:s.unit,repo:s.repo,path:o}});return i}function _pe(e){let t=`${e.id} "${e.title}"`,r=(n,o)=>({id:`test-case-${e.status.replace(" ","-")}`,passed:!1,message:n,remedy:o}),i="run the tests with a JUnit XML report and record it with the BuildKeel test_results tool";switch(e.status){case"passed":return null;case"no test":return r(`${t} has no test tagged [${e.id}] in this repo, and no unit under it that was finished in another repo recorded it as passed.`,`Write a test for it with [${e.id}] in its name in the repo that delivers it, then ${i}.`);case"not run":return r(`${t} has a tagged test but no result here.`,"Run the tests with a JUnit XML report and record it with the BuildKeel test_results tool.");case"stale":return r(`The result of ${t} is stale: ${e.detail??"it no longer matches the code"}.`,"Run the tests again, then record the report with the BuildKeel test_results tool.");case"failed":return r(`${t} fails${e.tests.length>0?`: ${e.tests.join("; ")}`:""}.`,`Fix the code or the test, then ${i}.`)}}async function p2(e,t){let{tree:r,parent:i,index:n}=e,o=fe(r.root,i);if(!o)return I({code:"finish-not-approved",message:`${i.id} is not approved, so there is nothing finished to record.`,remedy:`Approve it with ${ie("approve")} ${i.id}.`});if(o.version===0)return I({code:"finish-onboarded",message:`${i.id} is at version 0: it describes code as it was before BuildKeel, which counts as done. From version 1 it is finished like any other.`});let s=kt(r.root,i,o.version);if(s)return I({code:"finish-already",message:`${i.id} v${o.version} was already finished on ${s.record.finishedAt.slice(0,10)} by ${s.record.finishedBy} (${s.path}). It is finished once per approved version.`});let a=xn(r.root);if(!a)return I({code:"finish-no-identity",message:"Git has no name and email set for the spec repo, so who finished it cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then finish again.'});let{gate:c,children:u,cases:l}=vpe({tree:r,index:n,parent:i,codeRoot:e.codeRoot,repo:e.repo,home:e.home});if(c.outcome==="blocked")return N({kind:"parent-refused",unit:i,gate:c,children:u,cases:l});if(!e.apply)return N({kind:"parent-preview",unit:i,version:o.version,ancestors:t,gate:c,children:u,cases:l,autoPush:r.config.settings.autoPush});let d=nl(e.codeRoot,r.root),f=(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),p={unit:i.id,version:o.version,ancestors:t,repo:e.repo,commits:[],excluded:[],merged:null,files:[],tests:{ranAt:d.commit,plans:[...new Set(l.filter(v=>!v.regression).map(v=>v.planVersion===null?v.plan:`${v.plan}@v${v.planVersion}`))],cases:Object.fromEntries(l.map(v=>[v.id,{result:v.status,...v.tests.length>0?{tests:v.tests}:{},...v.from?{note:`passed in ${v.from.repo}, recorded by ${v.from.unit} (${v.from.path})`}:{}}]))},children:u.flatMap(v=>v.done?[{unit:v.unit.id,...v.done.record.version!==void 0?{version:v.done.record.version}:{},record:v.done.path}]:v.onboarded?[{unit:v.unit.id,version:0,record:Vi(Pe(v.unit),0)}]:[]),finishedBy:a,finishedAt:f,host:e.host},m=Hu(i,Xo(f,a)),h=e.writer.createRecord(m,Yu(p));if(!h.ok)return h;let g=Ct(r.root,[m],`done: ${i.id} v${o.version}`),y=g.ok&&r.config.settings.autoPush?await vi(r.root):null;return N({kind:"parent-finished",unit:i,record:p,path:m,commit:g,push:y,unpushed:g.ok?Yb(r.root):null,gate:c,children:u,cases:l})}var wpe=e=>e.toISOString().replace(/\.\d{3}Z$/,"Z");function LE(e,t,r){let i=[],n=new Set([r.id]),o=fe(e,r)??r;for(;o.parent&&!n.has(o.parent.id);){let s=t.artifacts.get(o.parent.id);if(!s)break;n.add(s.id);let a=fe(e,s);i.push(a?`${s.id}@v${a.version}`:s.id),o=a??s}return i}function kpe(e,t,r,i,n){if(!r)return null;if(t&&de(e,["merge-base","--is-ancestor",t,r])!==null)return(de(e,["rev-list","--first-parent",r])??"").split(`
|
|
278
|
+
`).includes(t)?t:(de(e,["rev-list","--first-parent","--ancestry-path","--reverse",`${t}..${r}`])??"").split(`
|
|
279
|
+
`).filter(Boolean)[0]??null;let o=de(e,["log",r,"--format=%H%x1f%B%x1e","-i","-F",`--grep=BuildKeel-Unit: ${i}`,...n?["--not",n]:[]])??"";for(let s of o.split("")){let[a,c]=s.trim().split("");if(a&&c!==void 0&&VR(c).includes(i))return a}return null}function Spe(e,t,r,i){let n=[...t.artifacts.values()].filter(g=>tr.includes(g.type)).map(g=>g.id),o=e.tree.config.repos.find(g=>g.name===e.repo)?.baseline,s=KR(e.repo,e.codeRoot,n,{...o?{baseline:o}:{},specRoot:e.tree.root,idsBranch:e.tree.config.settings.idsBranch}),a=s.units.get(r)??[],c=a.filter(g=>g.by==="branch"),u=[];for(let g of e.exclude??[]){let y=c.filter(v=>v.id.startsWith(g.trim()));if(g.trim().length<4||y.length!==1)return I({code:"finish-exclude-unknown",message:`${g} is not one of the commits on ${r}'s branch without a BuildKeel-Unit line${y.length>1?" (it matches more than one; give more of the ID)":""}.`,remedy:`Leave out only commits from that list${c.length>0?`: ${c.map(v=>v.id.slice(0,7)).join(", ")}`:"; there are none"}.`});u.includes(y[0])||u.push(y[0])}let l=a.filter(g=>!u.includes(g)),d=(s.branchCommits.get(r)??[]).map(g=>s.commits.get(g)).filter(g=>!!g&&g.units.length>0&&!g.units.includes(r)),f=Wb(e.codeRoot),p=i?de(e.codeRoot,["rev-parse","--verify","--quiet",i]):null,m=f&&f!==i?kpe(e.codeRoot,p,f,r,i&&p?i:null):null,h=[...new Set(l.flatMap(g=>g.files))].sort();return N({code:{branch:i,commits:l,unstamped:c,otherUnits:d,excluded:u,files:h,merged:m,defaultBranch:f},repo:s})}async function m2(e){let{tree:t,codeRoot:r}=e;if(!t.access.writable)return I(t.access.problem);if(e.unitId){let G=J(t.root),dt=G.artifacts.get(e.unitId);if(dt&&ME(G,dt)){let{writer:mr,repo:Yr,home:Xn,host:hr,apply:ki,now:Ge}=e;return p2({tree:t,writer:mr,codeRoot:r,repo:Yr,home:Xn,host:hr,parent:dt,index:G,apply:ki,...Ge?{now:Ge}:{}},LE(t.root,G,dt))}if(dt&&dt.owner===void 0&&!tr.includes(dt.type)){let mr=_e(t.root);return I({code:"finish-not-finishable",message:`${dt.id} is ${mr.a(dt.type)}, which is not finished itself; the ${mr.many("epic")} under it are.`})}}let i=Ke(r),n=i?.activeUnit??null,o=e.unitId??n;if(!o)return I({code:"finish-no-active-unit",message:"There is no active unit in this working tree, so there is nothing to finish here.",remedy:`Start the unit with ${ie("start")} <ID> (it switches to the unit's branch), then finish it.`});if(o!==n)return I({code:"finish-not-active",message:`${o} is not the active unit in this working tree${n?`; ${n} is`:""}.`,remedy:`Start ${o} again with ${ie("start")} ${o} (it switches to its branch), run its tests, then finish it.`});let s=J(t.root),a=s.artifacts.get(o);if(!a)return I({code:"finish-not-found",message:`There is no artifact ${o}.`});let c=fe(t.root,a)?.version??null,u=kt(t.root,a,c);if(u)return I({code:"finish-already",message:`${o}${c?` v${c}`:""} was already finished on ${u.record.finishedAt.slice(0,10)} by ${u.record.finishedBy} (${u.path}). A unit is finished once per approved version.`,remedy:`Save a change to ${o} with save_draft and approve the new version with ${ie("approve")} ${o}; then it can be started and finished again.`});let l=xn(t.root);if(!l)return I({code:"finish-no-identity",message:"Git has no name and email set for the spec repo, so who finished the unit cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then finish again.'});let d=i?.activeBranch??null,f=nl(r,t.root),{gate:p,cases:m}=f2({tree:t,index:s,unit:a,codeRoot:r,branch:d,freshness:i?.freshness,state:f});if(p.outcome==="blocked")return N({kind:"refused",unit:a,gate:p,cases:m});let h=Spe(e,s,o,d);if(!h.ok)return h;let g=h.value.code,y=a.type==="bug"&&!a.parent;if(!e.apply){let G=y?uV(t.root,s,h.value.repo,o,g.files):[];return N({kind:"preview",unit:a,version:c,ancestors:LE(t.root,s,a),gate:p,cases:m,code:g,autoPush:t.config.settings.autoPush,suggestions:G})}let v=[],$=null;if(e.attach){if(!y)return I({code:"finish-attach-not-standalone",message:a.type==="bug"?`${o} is already attached to ${a.parent?.id}.`:`${o} is not a bug; only a standalone bug is attached as it is finished.`});let G=sl(t.root,s,{parent:e.attach});if(!G.ok)return G;let dt=It(G.value.parent),mr=e.writer.writeFile(a.path,fr(Sn(a.document,{parent:dt})));if(!mr.ok)return mr;v.push(a.path),$=dt,s=J(t.root),a=s.artifacts.get(o)??a}let _=LE(t.root,s,a),w=as(e.home,t.root,o)?.documents??d_(t.root,s,$t(t.root),[a,...zE(t.root,s,a)]),k=[...new Set(m.filter(G=>!G.regression).map(G=>G.planVersion===null?G.plan:`${G.plan}@v${G.planVersion}`))],T=wpe(e.now?.()??new Date),C={unit:o,...c!==null?{version:c}:{},ancestors:_,...Object.keys(w).length>0?{documents:w}:{},repo:e.repo,...d?{branch:d}:{},commits:g.commits.map(G=>({id:G.id,subject:G.subject,by:G.by})),excluded:g.excluded.map(G=>({id:G.id,subject:G.subject})),merged:g.merged,files:g.files,tests:{ranAt:f.commit,plans:k,cases:Object.fromEntries(m.map(G=>[G.id,{result:G.status,...G.tests.length>0?{tests:G.tests}:{},...!G.own&&G.status==="no test"?{note:"left for the story"}:{}}]))},finishedBy:l,finishedAt:T,host:e.host},D=Ji(r).latest?.tests??[],K=a.type==="bug"&&a.parent?Wi(t.root,s,a.parent.id).filter(G=>!m.some(dt=>dt.id===G.id)):[],V=JZ({root:t.root,writer:e.writer,index:s},[...m,...K.map(G=>({id:G.id,tests:D}))],D);if(!V.ok)return V;v.push(...V.value.paths);let te=Hu(a,Xo(T,l)),Oe=e.writer.createRecord(te,Yu(C));if(!Oe.ok)return Oe;let _t=Ct(t.root,[...v,te],`done: ${o}${c!==null?` v${c}`:""}`),le=_t.ok&&t.config.settings.autoPush?await vi(t.root):null;return gE(e.home,t.root,o),Hn(r,{activeUnit:null,activeBranch:null,scope:[]}),N({kind:"finished",unit:a,record:C,path:te,commit:_t,push:le,unpushed:_t.ok?Yb(t.root):null,gate:p,cases:m,code:g,attached:$,droppedMatches:V.value.dropped})}function ls(e,t={}){if(!e)return[];let{behind:r=!0,suspects:i=!0,unpushed:n=!0}=t,o=[],s=e.freshness;s?.status==="behind"&&r&&o.push(`- The spec tree was ${s.behind} commit${s.behind===1?"":"s"} behind ${s.upstream} at the last check (${s.checkedAt}). Pull the spec repo to see the latest approvals; work can continue meanwhile.`),s?.status==="failed"&&o.push(`- The last check of whether the spec tree is up to date failed (${s.reason}); work continues with the local copy.`);let a=e.suspects??[];if(i&&a.length>0){let l=a.slice(0,5).join(", "),d=a.length>5?`, and ${a.length-5} more`:"";o.push(`- ${a.length} ${a.length===1?"item is":"items are"} suspect, built against an older version of something that has changed: ${l}${d}. Review them with {{bk:impact}}; work under a suspect artifact cannot start.`)}let c=e.unpushedApprovals??0,u=e.unpushedCompletions??0;if(n&&c+u>0){let l=[...c?[`${c} approval${c===1?"":"s"}`]:[],...u?[`${u} completion${u===1?"":"s"}`]:[]],d=c+u;o.push(`- ${l.join(" and ")} ${d===1?"is":"are"} committed in the spec repo but not pushed. Push it to share ${d===1?"it":"them"}.`)}return o.length>0?["","Also in the spec tree:",...o]:[]}function B(e,t){return[e,...t.flatMap(r=>[`- ${r.message}`,...r.remedy?[` To fix: ${r.remedy}`]:[]])].join(`
|
|
280
|
+
`)}function R_(e,t,r=()=>"",i=()=>null){let n=Et(e),o=new Map([[ee.type,"test plan"]]);if(n.ok){for(let p of n.value.chain)o.set(p.type,p.name);o.set("bug",n.value.bug.name),o.set("adhoc",n.value.adhoc.name);for(let p of n.value.documents)p.type!==ee.type&&o.set(p.type,p.name)}let s=new Map,a=[];for(let p of t.artifacts.values()){let m=p.parent&&t.artifacts.has(p.parent.id)?p.parent.id:null;m?s.set(m,[...s.get(m)??[],p]):a.push(p)}let c=p=>{if(p.type!==ee.type)return o.get(p.type)??p.type;let m=t.artifacts.get(Ut(p.id))?.type??"",h=Gi(e.root,m);return h?wa[h]:"test plan"},u=p=>{let m=i(p);if(m)return m;let h=oe(e.root,p),g=oV(e.root,p);if(p.type!=="bug"&&p.type!=="adhoc"||h.onboarded||h.onboardOpen)return`${Wu(h)}${g?` (${g})`:""}`;let y=kt(e.root,p,null);return y?`done on ${y.record.finishedAt.slice(0,10)}`:"open"},l=(p,m)=>p.id.localeCompare(m.id,"en",{numeric:!0}),d=[],f=(p,m)=>{let h=p.title?` "${p.title}"`:"";d.push(`${" ".repeat(m)}${p.id} ${c(p)}${h}: ${u(p)}${r(p)}`);for(let g of(s.get(p.id)??[]).sort(l))f(g,m+1)};for(let p of a.sort(l))f(p,0);return d}function ds(e,t){let{tree:r,resolved:i}=e,n=J(r.root),o=Ke(i.codeRoot),s=o?.activeUnit??null,a=[...n.artifacts.values()].filter(f=>OE.includes(f.type)).filter(f=>f.type!=="story"||![...n.artifacts.values()].some(p=>p.type==="task"&&p.parent?.id===f.id)).sort((f,p)=>f.id.localeCompare(p.id,"en",{numeric:!0})),c=f=>`${f.id} ${Jr(r,f.type)}${f.title?` "${f.title}"`:""}`,u={units:a,ready:[],waiting:[],finished:[]},l=ll(i.codeRoot,r.root,n),d=pr(r.root,n).suspects;for(let f of a){let p=l.get(f.id);if(p){u.finished.push(`- ${c(f)}: finished on its branch ${p}, not merged yet`);continue}let m=fe(r.root,f)?.version??null;if(m===0){u.finished.push(`- ${c(f)}: v0, describing code as it was before BuildKeel; counts as done until a v1 changes it`);continue}let h=kt(r.root,f,m);if(h){u.finished.push(`- ${c(f)}: finished${m!==null?` v${m}`:""} on ${h.record.finishedAt.slice(0,10)}`);continue}let g=P_({tree:r,index:n,unitId:f.id,workingTree:i.codeRoot,home:t,freshness:o?.freshness,suspects:d});if(g.ok)if(f.id===s)u.ready.unshift(`- ${c(f)}: the active unit here`);else if(g.value.gate.outcome!=="blocked")u.ready.push(`- ${c(f)}`);else{let[y,...v]=g.value.gate.blocking;u.waiting.push(`- ${c(f)}: ${y?.message??""}${v.length>0?` (and ${v.length} more)`:""}`)}}return u}import{existsSync as xpe,readFileSync as Ipe}from"node:fs";import{isAbsolute as Ppe,relative as Tpe,resolve as Ape,sep as Rpe}from"node:path";var bt=e=>e;var g2=bt({name:"test_results",title:"Record test results",description:"Read a JUnit XML test report and record, for this working tree, each test case's local result: tests are matched to test cases by the ID in square brackets in their name, such as [US-001-TC2], or by a recorded match naming an existing test that has no tag yet. Run the tests with a JUnit XML reporter first (for example vitest --reporter=junit --outputFile=<file>, pytest --junitxml=<file>, node --test --test-reporter=junit --test-reporter-destination=<file>) and pass the file's path. Returns where every test case of the active unit stands: passed, failed, not run, stale (the code or the plan changed since the run) or no tagged test. Leave out path to see where they stand without reading a report.",inputSchema:{path:b.string().optional().describe("The JUnit XML report, relative to the repository root or absolute.")},readOnly:!1,run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let{tree:i,resolved:n}=r.value,{codeRoot:o}=n,s=J(i.root),a=[],c;if(t.path){let m=Ape(o,t.path);if(!xpe(m))return`There is no file at ${m}. Run the tests with a JUnit XML reporter first, then pass the report's path.`;let h=VZ(Ipe(m,"utf8"),t.path);if(!h.ok)return B("The report could not be read.",h.problems);let g=Tpe(o,m),y=g.startsWith("..")||Ppe(g)?m:g.split(Rpe).join("/"),v=QZ({root:i.root,index:s,codeRoot:o,specRoot:i.root,report:y,tests:h.value});c=v.state;let $=h.value.length-v.untagged;a.push(`Read ${y}: ${h2(h.value.length,"test")}, ${$} tagged with a test case${v.matched>0?`, ${v.matched} matched to one by a recorded match`:""}. Results are recorded for this working tree only (local results).`),v.unknown.length>0&&a.push(`Tags that are not test cases in any plan: ${v.unknown.map(_=>`[${_}]`).join(", ")}. Check them for typos.`)}let u=Ke(o)?.activeUnit??null;if(u&&e.refreshHookCache(r.value),!u)return a.push(...a.length>0?[""]:[],"There is no active unit in this working tree, so no unit's test cases are shown. Start one with {{bk:start}}."),a.join(`
|
|
281
|
+
`);let l=il({root:i.root,index:s,unitId:u,codeRoot:o,specRoot:i.root,...c?{state:c}:{}}),d=l.filter(m=>m.status==="passed").length,f=l.filter(m=>m.status==="failed").length,p=l.length-d-f;return l.length>0&&a.unshift(`${u}: ${d} of ${h2(l.length,"test case")} ${d===1?"passes":"pass"}${f>0?`, ${f} ${f===1?"fails":"fail"}`:""}${p>0?`, ${p} without a current passing or failing result`:""}.`),a.length>0&&a.push(""),a.push(...E_(u,l,_e(i.root).one("story"))),a.join(`
|
|
282
|
+
`)}}),h2=(e,t)=>`${e} ${t}${e===1?"":"s"}`,Epe={passed:"passed",failed:"failed","not run":"not run: tagged in the code, but not in any report since",stale:"stale","no test":"no tagged test"};function E_(e,t,r="story"){if(t.length===0)return[`No test cases apply to ${e}.`];let i=[`Test cases of ${e} (local results):`],n=o=>{let s=o.regression?" (regression test)":o.own?"":` (from ${o.plan})`,a=o.status==="stale"?`: ${o.detail}`:o.status==="failed"&&o.tests.length>0?`: ${o.tests.join("; ")}`:"",c=!o.own&&o.status==="no test"?`, left for the ${r}`:"",u=o.matched&&o.status==="not run"?`not run: matched to ${o.matched.join("; ")}, which is not in any report since`:Epe[o.status],l=o.viaMatch?", through its recorded match":"";return`- ${o.id} ${o.title}${s}: ${u}${a}${l}${c}`};return i.push(...t.filter(o=>o.own).map(n),...t.filter(o=>!o.own).map(n)),i}var $2=bt({name:"finish_work",title:"Finish the active unit",description:"Finish the active unit of this working tree, or, with id, a story built through tasks or an epic. Runs the done gate: a clean working tree on the unit's branch; every test case of the unit's own plan with a tagged test and a current passing local result (recorded with test_results); a test case inherited from the story must pass once a test is tagged with it, and is otherwise left for the story. Call it first without apply: it checks and says what finishing will write, and lists commits on the unit's branch that have no BuildKeel-Unit line. Show that to the user and ask whether to count those commits for the unit (the default) or leave some out. Then call again with apply=true, passing the IDs of commits to leave out in exclude, to write the completion record (commits, files, test results, the versions it was built against, who and when), commit it alone in the spec repo, release the claim and clear the active unit. For a standalone bug, the check also says which stories its changes belong to: ask the user whether to attach the bug there, and pass the chosen story or task in attach. A story built through tasks, an epic, or a stage the team added, is finished once every unit under it is done and its own test cases pass, here or in the completion records of units finished in other repos; it needs no active unit.",inputSchema:{id:b.string().optional().describe("The unit to finish. Defaults to the active unit, and must be it; or a story built through tasks, an epic, or a stage the team added."),apply:b.boolean().default(!1).describe("false: only check and describe. true: finish."),exclude:b.array(b.string()).optional().describe("apply: commits on the unit's branch without a BuildKeel-Unit line to leave out, by ID."),attach:b.string().optional().describe("apply, for a standalone bug: the story or task to attach it to, such as US-001.")},readOnly:!1,async run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let{tree:i,resolved:n}=r.value,o=t.id??Ke(n.codeRoot)?.activeUnit??null,s=o?as(e.home,i.root,o)?.claimedAt:void 0,a=await m2({tree:i,writer:e.writer(r.value),codeRoot:n.codeRoot,repo:n.pointer.repo,home:e.home,host:e.host,apply:t.apply,...t.id?{unitId:t.id}:{},...t.exclude?{exclude:t.exclude}:{},...t.attach?{attach:t.attach}:{}});if(!a.ok)return B(`${t.id??"The active unit"} cannot be finished.`,a.problems);let c=a.value;if((c.kind==="refused"||c.kind==="parent-refused")&&e.gateUsage(r.value,c.gate,c.unit.id,!1),c.kind==="finished"||c.kind==="parent-finished"){e.gateUsage(r.value,c.gate,c.unit.id,!0);let d=s?Math.max(0,Math.round((Date.parse(c.record.finishedAt)-Date.parse(s))/1e3)):void 0,f=c.record.version;e.usage(r.value,{event:"finish",unit:c.unit.id,type:c.unit.type,...f!==void 0?{version:f}:{},...d!==void 0?{seconds:d}:{}})}a.value.kind==="finished"&&e.refreshHookCache(r.value);let u=ls(Ke(n.codeRoot),{behind:!1,unpushed:!1}),l=a.value.kind==="finished"?Ope(r.value,e.home,a.value.unit,a.value.code.branch):[];return[Lpe(a.value,_e(r.value.tree.root).one("story")),...l,...u].join(`
|
|
283
|
+
`)}});function Ope(e,t,r,i){let n=r.parent?.id;if(!n)return[];let o=new Set([...J(e.tree.root).artifacts.values()].filter(u=>u.parent?.id===n&&u.id!==r.id).map(u=>u.id)),s=ds(e,t).ready.find(u=>o.has(/^- (\S+) /.exec(u)?.[1]??""));if(!s)return[];let a=/^- (\S+) /.exec(s)?.[1],c=i?`; started from here, its branch is stacked on ${i}, so it has this work before it is merged`:"";return["",`Next under ${n}: ${s.slice(2)} is ready to start. Offer to start it with start_work (id ${a}, stack=true)${c}.`]}var O_=e=>e.slice(0,7),Ra=(e,t)=>`${e} ${t}${e===1?"":"s"}`,UE=e=>`- ${O_(e.id)} ${e.subject}`;function Npe(e,t){let r=[],i=e.commits.filter(o=>o.by==="trailer"),n=e.unstamped.filter(o=>!e.excluded.includes(o));if(r.push(`Commits for the unit in ${t}: ${e.commits.length}.`),i.length>0&&r.push("Stamped with its BuildKeel-Unit line:",...i.map(UE)),e.unstamped.length>0){let o=e.unstamped.length===1;r.push("",`${Ra(e.unstamped.length,"commit")} on ${e.branch} ${o?"has":"have"} no BuildKeel-Unit line. ${o?"It counts":"They count"} for the unit unless the user leaves ${o?"it":"them"} out:`),r.push(...e.unstamped.map(s=>`${UE(s)}${e.excluded.includes(s)?" (left out)":""}`)),n.length!==e.unstamped.length&&r.push(`${Ra(e.excluded.length,"commit")} left out.`)}return e.otherUnits.length>0&&(r.push("","Stamped with another unit, so left with it:"),r.push(...e.otherUnits.map(o=>`${UE(o)} [${o.units.join(", ")}]`))),r.push("",`Files: ${e.files.join(", ")||"none"}`),r.push(e.merged?`Already merged into ${e.defaultBranch}: ${O_(e.merged)}.`:`Not merged into ${e.defaultBranch??"the default branch"} yet; the record is written before the merge and stays valid after a squash.`),r}function Cpe(e,t){if(t.length===0)return[`${e} is standalone, and none of the files it changed belongs to other work or to an artifact's scope, so there is nowhere to suggest attaching it.`];let r=[`${e} is standalone. The files it changed also belong to:`];for(let n of t){let o=n.via.map(c=>`${c.unit.id}${c.unit.title?` "${c.unit.title}"`:""}`).join(", "),s=n.scopes.map(c=>`${c.record.id===n.story.id?"its":`${c.record.id}'s`} scope ${c.paths.join(", ")}`).join(" and "),a=[...o?[`through ${o}`]:[],...s?[`under ${s}`]:[]].join(", and ");r.push(`- ${n.story.id}${n.story.title?` "${n.story.title}"`:""}: ${Ra(n.files.length,"file")} (${n.files.join(", ")}), ${a}`)}let[i]=t;return r.push(`Ask the user whether to attach ${e} to ${i?.story.id} (the default), to one of the units listed, or leave it standalone; to attach, pass attach with the chosen ID when calling finish_work with apply=true. Its regression test then counts among that unit's test cases.`),r}function y2(e,t){let r=e.filter(o=>!o.own&&o.status==="no test");if(r.length===0)return[];let i=r[0]?.plan??"",n=i.replace(/-TP$/,"");return[`Left for the ${t}: ${r.map(o=>o.id).join(", ")} ${r.length===1?"has":"have"} no test yet; ${n} cannot be finished until every test case in ${i} passes.`]}var zpe=e=>{let t=e.from?`passed in ${e.from.repo}, recorded by ${e.from.unit}`:e.status==="no test"?"no tagged test here":e.status==="stale"?`stale: ${e.detail}`:e.status;return`- ${e.id} ${e.title}${e.regression?" (regression test)":""}: ${t}`};function jpe(e){let t=`${e.unit.id}${e.unit.title?` "${e.unit.title}"`:""}`;if(!e.done)return e.onboarded?`- ${t}: v0, describing code as it was before BuildKeel; counts as done`:`- ${t}: not done`;let r=e.done.record.version!==void 0?` v${e.done.record.version}`:"";return`- ${t}: finished${r} on ${e.done.record.finishedAt.slice(0,10)} in ${e.done.record.repo}`}function v2(e){let t=[e.children.length>0?`Units under ${e.unit.id}:`:`There are no units under ${e.unit.id}.`,...e.children.map(jpe)];return t.push("",e.cases.length>0?`Test cases of ${e.unit.id} (local results here, and completion records from other repos):`:`${e.unit.id} has no test cases of its own.`),t.push(...e.cases.map(zpe)),t}function Dpe(e){let t=`${e.unit.id}${e.unit.title?` "${e.unit.title}"`:""}`;switch(e.kind){case"parent-refused":return[on(e.gate,`finish of ${e.unit.id}`),"",...v2(e),"","Nothing was written."].join(`
|
|
284
|
+
`);case"parent-preview":{let r=[`${t} v${e.version} can be finished: everything under it is done. Finishing will:`];return r.push(`- write its completion record in the spec tree${e.ancestors.length>0?`, built against ${e.ancestors.join(", ")}`:""}, listing the units under it and its test results`),r.push(`- commit only that file in the spec repo as "done: ${e.unit.id} v${e.version}"${e.autoPush?", then push it":", without pushing"}`),e.gate.outcome==="warned"&&r.push("",on(e.gate,"the finish")),r.push("",...v2(e),"",`Nothing has been written yet. Show this to the user, and call finish_work again with id ${e.unit.id} and apply=true only if they confirm.`),r.join(`
|
|
285
|
+
`)}case"parent-finished":{let r=e.record.version!==void 0?` v${e.record.version}`:"",i=[`Finished ${t}${r}: everything under it is done, and its completion record lists each unit and where its test cases passed.`,`- Completion record: ${e.path}`];return e.commit.ok?(i.push(`- Committed as "done: ${e.unit.id}${r}" (${O_(e.commit.value)}) in the spec repo, with only that file.`),e.push?i.push(e.push.ok?"- Pushed.":`- Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):e.unpushed===null?i.push("- Not pushed: the spec repo has no remote. Add one and push it to share the record."):e.unpushed>0&&i.push(`- Not pushed: ${Ra(e.unpushed,"completion")} in the spec repo ${e.unpushed===1?"is":"are"} not pushed yet. Push it to share ${e.unpushed===1?"it":"them"}.`)):i.push(`- The record is written but was not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),e.gate.outcome==="warned"&&i.push("",on(e.gate,"the finish")),i.join(`
|
|
286
|
+
`)}}}var Mpe=e=>e.kind.startsWith("parent-");function Lpe(e,t="story"){return Mpe(e)?Dpe(e):Upe(e,t)}function Upe(e,t){let r=[],i=`${e.unit.id}${e.unit.title?` "${e.unit.title}"`:""}`;switch(e.kind){case"refused":return r.push(on(e.gate,`finish of ${e.unit.id}`),"",...E_(e.unit.id,e.cases,t),"","Nothing was written."),r.join(`
|
|
287
|
+
`);case"preview":{let n=e.version!==null?` v${e.version}`:"";r.push(`${i}${n} can be finished. Finishing will:`),r.push(`- write its completion record in the spec tree${e.ancestors.length>0?`, built against ${e.ancestors.join(", ")}`:""}`),r.push(`- commit only that file in the spec repo as "done: ${e.unit.id}${n}"${e.autoPush?", then push it":", without pushing"}`),r.push("- release its claim on this machine and clear the active unit here; the code branch is left as it is"),e.gate.outcome==="warned"&&r.push("",on(e.gate,"the finish")),r.push("",...Npe(e.code,"this repo")),r.push("",...E_(e.unit.id,e.cases,t));let o=y2(e.cases,t);return o.length>0&&r.push("",...o),e.unit.type==="bug"&&!e.unit.parent&&r.push("",...Cpe(e.unit.id,e.suggestions)),r.push("",e.code.unstamped.length>0?`Nothing has been written yet. Show this to the user and ask about the ${Ra(e.code.unstamped.length,"commit")} without a BuildKeel-Unit line: count them all for ${e.unit.id} (the default), or leave some out. Then call finish_work again with apply=true, and exclude listing any left out.`:"Nothing has been written yet. Show this to the user, and call finish_work again with apply=true only if they confirm."),r.join(`
|
|
288
|
+
`)}case"finished":{let n=e.record.version!==void 0?` v${e.record.version}`:"";r.push(`Finished ${i}${n}: its completion record keeps what was built, against which approved versions, and with which test results.`),e.attached&&r.push(`- Attached to ${e.attached}: its regression test now counts among ${e.attached.split("@")[0]}'s test cases.`),r.push(`- Completion record: ${e.path}`),r.push(`- ${e.record.commits.length} commit${e.record.commits.length===1?"":"s"} and ${Ra(e.record.files.length,"file")} recorded${e.record.excluded.length>0?`, ${e.record.excluded.length} left out`:""}.`);for(let s of e.droppedMatches)r.push(`- Dropped the recorded match of ${s.testCase} to ${s.tests.join("; ")}: the test now carries [${s.testCase}] in its name.`);if(e.commit.ok){let s=[...e.attached?["the bug's own file"]:[],...e.droppedMatches.length>0?["the matches dropped"]:[]];r.push(`- Committed as "done: ${e.unit.id}${n}" (${O_(e.commit.value)}) in the spec repo, with only ${s.length>0?`that file and ${s.join(" and ")}`:"that file"}.`),e.push?r.push(e.push.ok?"- Pushed.":`- Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):e.unpushed===null?r.push("- Not pushed: the spec repo has no remote. Add one and push it to share the record."):e.unpushed>0&&r.push(`- Not pushed: ${Ra(e.unpushed,"completion")} in the spec repo ${e.unpushed===1?"is":"are"} not pushed yet. Push it to share ${e.unpushed===1?"it":"them"}.`)}else r.push(`- The record is written but was not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`);r.push("- The claim is released and there is no active unit in this working tree now."),e.code.branch&&r.push(`- The branch ${e.code.branch} is unchanged: push it and open a pull request as usual.`),e.gate.outcome==="warned"&&r.push("",on(e.gate,"the finish"));let o=y2(e.cases,t);return o.length>0&&r.push("",...o),r.join(`
|
|
289
|
+
`)}}}var mm=e=>`${e.record.id} ${e.version===null?"(draft)":`v${e.version}`}`;function qE(e){if(e.version!==0)return null;let t=al(e.record.document);return`${e.record.id} v0 describes the code as it was before BuildKeel${t.length>0?`, in ${t.join(", ")}`:""}.`}var FE=e=>`${mm(e)}${e.record.title?` "${e.record.title}"`:""}`,gl=e=>Qo(e).replace(/\s+/g," ").trim(),b2=e=>gl(e).replace(/\|/g,"\\|"),qpe=new Set(["id","title","parent"]);function k2(e,t){let r=fe(e,t);return r?{record:r,version:r.version}:{record:t,version:null}}function _2(e,t,r){if(!r.parent)return null;let i=t.artifacts.get(r.parent.id);return i?k2(e,i):null}function N_(e,t){let r=lt(t,e);return r.ok?r.value.template:null}function Fpe(e,t){if(!t)return null;let r=Object.keys(t.fields).filter(i=>!qpe.has(i)).flatMap(i=>{let n=e.record.document.frontmatter[i];return n==null||n===""?[]:[`${i} ${Array.isArray(n)?n.join(", "):String(n)}`]});return r.length>0?r.join(" \xB7 "):null}function w2(e,t){if(!t)return[];let r=new Set(ba(t).map(n=>n.section.toLowerCase())),i=Object.entries(t.sections).filter(([n,o])=>o.tracked&&!r.has(n.toLowerCase())).flatMap(([n])=>{let o=Bi(e.record.document,n)?.body,s=o?Qo(o).trim():"";return s?[{name:n,text:s}]:[]});return i.length===1?[i[0]?.text??""]:i.flatMap(({name:n,text:o})=>[`### ${n}`,o])}function Zpe(e,t){if(!t)return[];let r=new Set(ba(t).map(i=>i.section.toLowerCase()));return Object.entries(t.sections).filter(([i,n])=>n.tracked&&!r.has(i.toLowerCase())).map(([i])=>i).filter(i=>ZE(e,i)!==null)}function Vpe(e,t,r){return r.flatMap(i=>{let n=t.artifacts.get(`${i.id}${ee.idSuffix}`),o=n?fe(e,n):null,s=o&&n?St(e,o,o.document).map(c=>({...c,plan:n.id})):[],a=QR(e,t,i).map(c=>({id:c.id,text:c.title??"",covers:[],plan:c.id,regression:!0}));return[...s,...a]})}function Bpe(e,t,r){return f_(t,r).flatMap(i=>{if(i.type===ee.type)return[];let n=fe(e,i);return n?[{record:n,version:n.version}]:[]})}function ZE(e,t){let r=Bi(e.record.document,t)?.body;return(r?gl(r):"")||null}function Kpe(e){let t=[];for(let r of e)if(r.record.type!=="task"&&r.record.type!=="story"||(t.push(r.record),r.record.type==="story"))break;return t}function Gpe(e,t,r,i){let n=new Set([r.id,...i?[i.id]:[]]);return[...t.artifacts.values()].filter(o=>o.type==="bug"&&o.id!==r.id&&o.parent&&n.has(o.parent.id)&&kt(e,o,null)===null).sort((o,s)=>o.id.localeCompare(s.id,"en",{numeric:!0}))}function yl(e,t,r,i){let n=e.root,o=t.artifacts.get(r);if(!o)return I({code:"context-not-found",message:`There is no artifact ${r}.`});let s=k2(n,o),a=[s],c=new Set([s.record.id]);for(let D=_2(n,t,s.record);D&&!c.has(D.record.id);D=_2(n,t,D.record))a.push(D),c.add(D.record.id);let[,u,...l]=a,d=[s,u].find(D=>D?.record.type==="story"),f=s.record.type==="task"&&d?[s.record,d.record]:s.record.type==="bug"?[s.record,...Kpe(a.slice(1))]:[s.record],p=Vpe(n,t,f),m=[];if(m.push(`# ${i.active?"Active unit":"Unit"}: ${FE(s)}`),m.push([...a].reverse().map(mm).join(" \u203A ")),i.active){m.push(`Commits: end every message with "BuildKeel-Unit: ${s.record.id}".`);let D=`Record each run's JUnit XML report with test_results, and finish with ${ie("done")}.`;if(s.record.type==="bug"){let te=s.record.document.frontmatter.testCase,Oe=typeof te=="string"&&te!==""?` ${te}, which found it, must pass too.`:"";m.push(`Tests: write a regression test with [${s.record.id}] in its name, which fails without the fix and passes with it.${Oe} ${D}`)}else{let te=p[0]?`, such as [${p[0].id}]`:"";m.push(`Tests: put the test case ID in the test's name${te}. ${D}`)}let{matches:K}=Yn(n,t),V=p.flatMap(te=>(K.get(te.id)?.match.tests??[]).map(Oe=>`${Oe} (${te.id})`));V.length>0&&m.push(`Matched without a tag: ${V.join("; ")}. When you change one of these tests, add its test case ID to its name; the match is dropped when ${s.record.id} is finished.`)}for(let[D,K]of a.entries()){let V=a[D+1],te=K.record.parent?.version,Oe=te===void 0||!V?te:us(te,hl(n,K.record).repins,V.record.id);V?.version!=null&&Oe!==void 0&&Oe<V.version&&m.push(`Note: ${K.record.id} was approved against ${V.record.id} v${Oe}; ${V.record.id} v${V.version} is now approved. Check whether ${K.record.id} still holds.`)}let h=N_(n,s.record.type);m.push("",`## What to build: ${mm(s)}`);let g=Fpe(s,h);g&&m.push(g),m.push(...w2(s,h));let y=d?Ype(n,d,p):{lines:[],covered:new Set};if(d===s&&m.push("",...y.lines),u){m.push("",`## Why: ${FE(u)}`);let D=qE(u);D&&m.push(D),m.push(...w2(u,N_(n,u.record.type))),d===u&&m.push("",...y.lines)}let v=p.filter(D=>!y.covered.has(D.id));if(v.length>0){let D=K=>`${K.id} ${gl(K.text)} (${K.regression?"regression test of a fixed bug":`covers ${(K.covers??[]).join(", ")||"nothing"}`})`;m.push("",`Also tested: ${v.map(D).join("; ")}`)}let $=_e(n),_=a.map(D=>({owner:D.record,docs:Bpe(n,t,D.record)})),w=_.flatMap(({owner:D,docs:K})=>K.filter(V=>V.record.type===fa.type).map(V=>({owner:D,doc:V})))[0];if(w){m.push("",`## How it is built: ${mm(w.doc)}, the ${$.one(fa.type)} of ${w.owner.id}`);let D=qE(w.doc);D&&m.push(D);let K=ZE(w.doc,"Summary");K&&m.push(K);for(let V of Zpe(w.doc,N_(n,fa.type))){let te=Qo(Bi(w.doc.record.document,V)?.body??"").trim().replace(/^(#{1,5}) /gm,"#$1 ");m.push(`### ${V}`,te)}}let k=_.flatMap(({owner:D,docs:K})=>K.filter(V=>V!==w?.doc).map(V=>({owner:D,doc:V})));if(l.length>0||k.length>0){m.push("","## Background");for(let D of l){let K=Bi(D.record.document,"Summary")?.body,V=qE(D);m.push(`- ${FE(D)}${K?`: ${gl(K)}`:""}${V?` (${V.replace(/\.$/,"")})`:""}`)}for(let{owner:D,doc:K}of k){let V=ZE(K,"Summary");m.push(`- ${mm(K)}, the ${$.one(K.record.type)} of ${D.id}${V?`: ${V}`:""}`)}}m.push("",...Hpe(i.code,Gpe(n,t,s.record,u?.record)));let T=`${m.join(`
|
|
290
|
+
`)}
|
|
291
|
+
`,C=e.config.settings.contextBudget;return T.length<=C?N(T):N(`${T}
|
|
292
|
+
Note: this context is ${T.length.toLocaleString("en")} characters, over the budget of ${C.toLocaleString("en")} (settings.contextBudget in buildkeel.yaml). Nothing was left out; consider shortening ${s.record.id} or splitting it.
|
|
293
|
+
`)}var Wpe=7;function Jpe(e){let t=e.document.frontmatter.testCase;return`- ${e.id}${e.title?` "${gl(e.title)}"`:""} in ${e.parent?.id??"nothing"}${typeof t=="string"&&t!==""?`, found by ${t}`:""}`}function Hpe(e,t){let r=!e||e.repos.length===0&&e.missing.length===0;if(t.length===0&&r)return["## Open bugs: none \xB7 Linked code: none yet"];let i=t.length===0?["## Open bugs: none"]:["## Open bugs",...t.map(Jpe)];if(!e||r)return[...i,"","## Linked code: none yet"];i.push("","## Linked code"),e.repos.length===0&&i.push("None yet.");for(let n of e.repos){let o=n.commits.map(a=>a.id.slice(0,Wpe)).join(", "),s=(n.pullRequests??[]).map(a=>`#${a.number} "${gl(a.title)}" (${a.state})`).join(", ");i.push(`- ${n.repo}: commits ${o||"none"} \xB7 files ${n.files.join(", ")||"none"}${s?` \xB7 pull requests ${s}`:""}`)}return e.missing.length>0&&i.push(`- Not on this machine, so not searched: ${e.missing.join(", ")}`),i}function Ype(e,t,r){let i=N_(e,"story"),n=i?In(t.record.document,i,t.record.id):[],o=new Set;return n.length===0?{lines:[],covered:o}:{lines:["| Criterion | Must hold | Tested by |","|---|---|---|",...n.map(a=>{let c=r.filter(l=>(l.covers??[]).includes(a.id));for(let l of c)o.add(l.id);let u=c.length>0?c.map(l=>`${l.id} ${b2(l.text)}`).join("; "):"not covered";return`| ${a.id} | ${b2(a.text)} | ${u} |`})],covered:o}}var S2=bt({name:"get_context",title:"Get a unit's context",description:"The compact context for a unit of work, built from approved versions: what to build, why (its parent, with the story's acceptance criteria and the test case for each), summaries further up, and the code already linked to it (commits and files in every code repo on this machine, and the pull requests holding them where the repo is on GitHub and its gh tool is installed), with every version shown. Leave out id for the active unit of this working tree.",inputSchema:{id:b.string().optional().describe("The unit, such as TK-001. Defaults to the active unit.")},readOnly:!0,async run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let i=Ke(r.value.resolved.codeRoot)?.activeUnit??null,n=t.id??i;if(!n)return"There is no active unit in this working tree. Give the id of a unit, or start one with {{bk:start}}.";let o=n===i?e.refreshHookCache(r.value):J(r.value.tree.root),s=await e.unitCodeWithPullRequests(r.value,o,n),a=yl(r.value.tree,o,n,{active:n===i,code:s});return a.ok&&e.usage(r.value,{event:"context",unit:n}),a.ok?a.value.trimEnd():B(`There is no context for ${n}.`,a.problems)}});import{readFileSync as ime}from"node:fs";import{randomBytes as Xpe}from"node:crypto";import{existsSync as Qpe}from"node:fs";import{dirname as x2,join as eme}from"node:path";var tme=e=>e.charAt(0).toUpperCase()+e.slice(1),wi="{{id}}";function rme(e,t){for(;;){let r=`${t}-draft-${BigInt(`0x${Xpe(4).toString("hex")}`).toString(36).slice(0,4).padStart(4,"0")}`;if(!e.artifacts.has(r))return r}}function nme(e,t){let r=Et(e),{chain:i,bug:n,adhoc:o}=r.ok?r.value:vt;return[...i,n,o].find(s=>s.type===t)?.prefix??t.toUpperCase()}function hm(e,t){let r=t.trim().toLowerCase().replace(/\s+/g," ");if(r==="bug"||r==="adhoc"||r===ee.type)return r;if(r==="test plan")return ee.type;let i=Et(e),{chain:n,documents:o}=i.ok?i.value:vt,s=l=>l.map(d=>d.toLowerCase()).some(d=>d===r||Kb(d)===r||d.replace(/-/g," ")===r),a=l=>[l.type,l.name,vt.chain.find(d=>d.type===l.type)?.name??l.type],c=n.find(l=>s(a(l)));if(c)return c.type;let u=l=>vt.documents.find(d=>d.type===l)?.name??l;return o.find(l=>s([l.type,l.name,u(l.type),...l.type==="design"?["design doc"]:[]]))?.type??null}function I2(e,t,r){let i=hm(e,r.type);if(!i)return I({code:"draft-unknown-type",message:`There is no artifact type "${r.type}".`});let n=r.version===0;if(n&&i==="adhoc")return I({code:"draft-not-draftable",message:"An ad-hoc unit has no version 0: it is work done in BuildKeel, never code from before it."});if(r.sources&&r.sources.length>0&&!n)return I({code:"draft-sources-not-v0",message:"Sources are kept with version 0 only: what describes code as it was before BuildKeel. Save with version 0, or put what matters from them into the draft itself."});if((i==="bug"||i==="adhoc")&&!r.id&&!n)return I({code:"draft-not-draftable",message:`A ${i==="bug"?"bug":"ad-hoc unit"} gets its permanent ID when it is created, so it is not drafted.`});let o=J(e.root),s=Et(e),a=s.ok?s.value:vt,c=Lb(a,i),u,l,d,f,p,m=null,h=!1,g,y=dr(r.content.replaceAll(wi,"PLACEHOLDER"));if(!y.ok)return y;let v=y.value.frontmatter.parent;if(i==="bug"){let le=sl(e.root,o,y.value.frontmatter,{version0:n});if(!le.ok)return le}if(v!=null){let le=typeof v=="string"?sn(v):null;if(!le)return I({code:"draft-bad-parent",message:`parent ${JSON.stringify(v)} is not an artifact ID such as EP-01.`});p=le}if(r.id){if(g=o.artifacts.get(r.id),!g)return I({code:"draft-not-found",message:`There is no artifact ${r.id} to update.`});if(g.type!==i){let G=_e(e.root);return I({code:"draft-wrong-type",message:`${r.id} is ${G.a(g.type)}, not ${G.a(i)}.`})}let le=oe(e.root,g);if(le.state==="pending")return I({code:"draft-pending",message:`${r.id} is approved and waiting for its number, so it cannot be changed yet.`,remedy:`Approve again with ${ie("approve")} ${r.id} when the spec repo's remote can be reached; it gets its number, and then a new version can be drafted.`});if(n&&le.onboarded)return I({code:"draft-v0-exists",message:`${r.id} already has an approved version 0, and an artifact has one at most.`,remedy:`To change what ${r.id} says, save the whole changed file with id ${r.id} and no version; that opens its next version.`});le.state==="approved"&&!n&&(m=(le.approvedVersion??0)+1),h=!n&&le.state==="approved"&&typeof y.value.frontmatter.completes=="number"&&y.value.frontmatter.completes!==le.approvedVersion,u=g.id,l=i===ee.type?g.owner??u.slice(0,-ee.idSuffix.length):u,d=n?LF(Pe(g)):u_(e.root,g),f=n?!le.onboardOpen:!Qpe(eme(e.root,d))}else if(c){let le=c.name;if(!p)return I({code:"draft-missing-parent",message:`${Kp(le)} needs a parent: the artifact it belongs to.`});let G=o.artifacts.get(p.id);if(!G)return I({code:"draft-parent-not-found",message:`There is no artifact ${p.id} to attach ${Kp(le)} to.`});if(!Gi(e.root,G.type))return I({code:"draft-plan-not-allowed",message:`${G.id} is ${_e(e.root).a(G.type)}, which has no ${le}. ${tme(Kb(le))} belong to ${jZ(e.root)}.`});if(u=`${G.id}-${c.suffix}`,o.artifacts.has(u))return I({code:"draft-plan-exists",message:`${G.id} already has ${Kp(le)}, ${u}. Update it by passing id ${u}${n?" and version 0":""}.`});l=i===ee.type?G.id:u,d=`${x2(G.path)}/${c.dir}/${n?ma:c.file}`,f=!0}else{let le=Gr(e.root).types.find(G=>G.type===i);if(!le)return I({code:"draft-unknown-type",message:`There is no artifact type "${r.type}".`});u=rme(o,nme(e,i)),l=u,d=`${le.dir}/${u}/${n?ma:le.file}`,f=!0}let $=lt(i,e.root),_=r.content.replaceAll(wi,l),w=[];if($.ok&&_.includes(Jn)){let le=dr(_,d),G=g?[g.document,...g.onboard?[g.onboard.document]:[]]:[],dt=g?[...Je(e.root,g).flatMap(Yr=>Ar(e.root,g,Yr)?.document??[]),...G]:[],mr=r_([...le.ok?[le.value]:[],...dt],$.value.template,l);({text:_,assigned:w}=AZ(_,$.value.template,l,mr))}let k=dr(_,d);if(!k.ok)return k;let T=[],C={};if(!c&&k.value.frontmatter.id!==u&&(C.id=u),h&&(C.completes=void 0,T.push({code:"draft-completes-dropped",path:d,message:`The completes field was left out: it said which version an earlier version completed, and v${m} is a version of its own. Set completes to v${(m??1)-1}'s number only if this version just completes it with what version 0 describes.`})),p){let le=o.artifacts.get(p.id);if(!le)T.push({code:"draft-parent-not-found",path:d,message:`The parent ${p.id} does not exist yet.`});else{let G=oe(e.root,le);G.state==="approved"&&p.version===void 0?(p={id:p.id,version:G.approvedVersion},C.parent=It(p)):G.state==="draft"&&T.push({code:"draft-parent-draft",path:d,message:`The parent ${p.id} is still a draft. This draft can be approved once ${p.id} is.`,remedy:`Approve ${p.id} first with ${ie("approve")}.`})}}let D=Object.keys(C).length>0?Sn(k.value,C):k.value,K;if(n){let le=x2(d),G=bV(t,e.root,le,r.sources??[],{readBy:xn(e.root)??"unknown",readAt:new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});if(!G.ok)return G;let dt=dl(e.root,le);D=y_(D,dt),K={kept:dt,...G.value}}_.includes(Jn)&&T.push({code:"draft-unnumbered",path:d,message:`Some entries still read ${Jn}: only entries written as ${l}-<letters>${Jn} in a numbered section are numbered.`});let V=t.writeFile(d,fr(D));if(!V.ok)return V;if(!$.ok)return T.push(...$.problems),N({id:u,type:i,path:d,created:f,notes:T,assigned:w});if(n)return N({id:u,type:i,path:d,created:f,notes:T,assigned:w,empty:Sa(D,$.value.template),...K?{sources:K}:{}});let te=J(e.root),Oe=te.artifacts.get(u);Oe&&T.push(...pl(e.root,Oe,cs(e.root,te,Oe,$.value)));let _t=m!==null&&g?oe(e.root,g).draftOpen:!1;return N({id:u,type:i,path:d,created:f,notes:T,assigned:w,...m!==null?{nextVersion:m,opened:_t}:{}})}var P2=bt({name:"get_template",title:"Get a template",description:"The template for an artifact type (idea, epic, story, task, test-plan, or a stage the team added): the fields and sections it needs, which are required, and the skeleton to fill in. The spec tree's own template is used when it has one, then the organization's when the tree takes templates from one.",inputSchema:{type:b.string().describe("The artifact type, such as story, or a stage's name such as user story.")},readOnly:!0,run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let{root:i}=r.value.tree,n=hm(r.value.tree,t.type);if(!n)return`There is no artifact type "${t.type}".`;let o=lt(n,i);if(!o.ok)return B(`There is no usable template for ${n}.`,o.problems);let s=Object.entries(o.value.template.sections).filter(([,a])=>a.offered!==void 0);return[`Template for ${ome(_e(i).one(n),n)}, version ${o.value.template.version}, from ${Hp(o.value)}:`,"",ime(o.value.file,"utf8").trimEnd(),...s.length>0?["",'Offered sections, not in the skeleton: add one, as a "## <name>" section, only when the work needs it.',...s.map(([a,c])=>`- ${a}: ${c.offered}`)]:[],"","Fill each section from what the user gave you: the conversation, a document, or content from their tools, keeping its meaning. Put what fits no section in the section for further material, such as Notes. Ask the user for each required section the material does not cover, one question at a time; never invent one."].join(`
|
|
294
|
+
`)}}),ome=(e,t)=>e===t?t:`${e} (type ${t})`;var sme="Each stays suspect until the user decides, one at a time: still valid (it is kept as it is and counts as built against the new version) or needs change (a new draft of it, or of its test plan, to update and approve).",T2=bt({name:"impact",title:"Change impact",description:"What a change to an approved artifact affects. Without id: every suspect in the spec tree, that is every task, story, epic, bug or test case built against an older version of something whose tracked content it relies on has changed since, with the old and new text of each change and, for finished units, the commits and files to review. With the id of an artifact that has an open draft of a new version: a preview of what approving it would make suspect and which coverage gaps it would open. With another id: the suspects it causes or is one of. Changes nothing.",inputSchema:{id:b.string().optional().describe("An artifact such as US-001, or a test case such as US-001-TC2. Leave it out for every suspect.")},readOnly:!0,run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let i=r.value.tree,n=J(i.root),o=t.id?n.artifacts.get(t.id):void 0;if(o&&oe(i.root,o).draftOpen){let l=c2(i.root,n,o);if(l)return ame(i,n,o.id,l)}let s=pr(i.root,n),a=t.id,c=a?s.suspects.filter(l=>l.target===a||l.id===a||l.holder.id===a):s.suspects,u=[];if(c.length===0)a&&!o&&!s.suspects.some(l=>l.id===a)?u.push(`There is no artifact ${a}, and no suspect test case with that ID.`):u.push(a?`Nothing involving ${a} is suspect.`:"Nothing is suspect: everything is built against the versions in force, or is unaffected by what changed since.");else{let l=a?` involving ${a}`:"";u.push(`${C_(c.length,"item")}${l} ${c.length===1?"is":"are"} suspect: built against an older version of something that has changed since in what ${c.length===1?"it relies":"they rely"} on.`),u.push(...A2(i,n,c,"Suspect"),"",sme)}return s.problems.length>0&&u.push("",B("Some records could not be read, so what relies on them is listed as suspect:",s.problems)),u.join(`
|
|
295
|
+
`)}});function ame(e,t,r,i){let n=`v${i.from+1}`,o=[];if(i.suspects.length===0?o.push(`Approving the draft of ${r} as ${n} would make nothing suspect: nothing built against ${r} relies on what the draft changes.`):(o.push(`Approving the draft of ${r} as ${n} would make ${C_(i.suspects.length,"item")} suspect. Nothing is marked until the draft is approved.`),o.push(...A2(e,t,i.suspects,"Would become suspect"))),i.gaps.length>0){o.push("",`It would open ${C_(i.gaps.length,"coverage gap")}:`);for(let s of i.gaps)o.push(`- ${s.id} is new. No test case can cover it until a version of ${r}-TP written against ${r} ${n} does, and no work under ${r} can start until then.`)}return i.problems.length>0&&o.push("",B("Some records could not be read, so what relies on them is listed as suspect:",i.problems)),o.join(`
|
|
296
|
+
`)}function A2(e,t,r,i){let n=new Map;for(let s of r){let a=`${s.target}\0${s.pinned}\0${s.current??"draft"}`;n.set(a,[...n.get(a)??[],s])}let o=[];for(let s of n.values()){let a=s[0],c=t.artifacts.get(a.target),u=a.current===null?"the draft":`v${a.current}`,l=new Map;for(let d of s)for(let f of d.changes)l.set(f.id,f);o.push("",`${a.target}${c?.title?` "${c.title}"`:""}, from v${a.pinned} to ${u}:`),l.size===0&&o.push("- These versions could not be compared, so everything built against it needs review.");for(let d of l.values())o.push(...cme(d));o.push(`${i} (${s.length}):`),s.forEach((d,f)=>o.push(...ume(e,d,f+1)))}return o}function cme(e){let t=(r,i)=>{if(i===void 0)return[];let n=i.split(`
|
|
297
|
+
`);return n.length===1?[` ${r}: ${i}`]:[` ${r}:`,...n.map(o=>` ${o}`)]};return[`- ${e.id} ${e.change}`,...t("was",e.before),...t("now",e.after)]}function ume(e,t,r){let i=t.title?` "${t.title}"`:"",n=[];if(t.kind==="test-case"){let s=Je(e.root,t.holder).at(-1),a=t.items?t.items.join(", "):`all of ${t.target}`;n.push(`${r}. Test case ${t.id}${i} in ${t.holder.id}${s?` v${s}`:""}: covers ${a}.`)}else{let s=Jr(e,t.holder.type);n.push(`${r}. ${s.charAt(0).toUpperCase()}${s.slice(1)} ${t.id}${i}: any change to ${t.target} affects it.`)}let o=t.finished;if(o){let s=o.commits.map(a=>`${a.id.slice(0,7)} ${a.subject}`).join("; ");n.push(` Finished (${o.record}): ${C_(o.commits.length,"commit")} in ${o.repo}${s?`: ${s}`:""}.`),o.files.length>0&&n.push(` Files: ${o.files.join(", ")}.`)}return n}var C_=(e,t)=>`${e} ${t}${e===1?"":"s"}`;var ym=gr(Kr(),1);import{existsSync as vl,mkdirSync as mme,readdirSync as C2,readFileSync as hme,realpathSync as gme}from"node:fs";import{basename as z2,isAbsolute as M_,join as Xi,relative as L_,resolve as $l,sep as yme}from"node:path";var Hi=1;function z_(e,t=Hi){return e===t?{writable:!0}:e<t?{writable:!1,reason:"older-format",problem:{code:"format-older",message:`This spec tree uses format ${e}; this version of BuildKeel uses format ${t}. The tree is read-only until it is migrated.`,remedy:`Run ${ie("migrate")} to upgrade it in one reviewable commit.`,path:"buildkeel.yaml"}}:{writable:!1,reason:"newer-format",problem:{code:"format-newer",message:`This spec tree uses format ${e}, which is newer than this version of BuildKeel supports (format ${t}). You can read it, but not change it.`,remedy:"Update the BuildKeel plugin, then start a new session.",path:"buildkeel.yaml"}}}import{existsSync as VE,readFileSync as R2}from"node:fs";import{isAbsolute as lme,join as j_,resolve as dme}from"node:path";var E2="# BuildKeel commit-msg hook",BE=`unit=$(sed -n 's/^ *"activeUnit": *"\\([^"]*\\)".*/\\1/p' .buildkeel/hook-cache.json 2>/dev/null)
|
|
298
|
+
if [ -n "$unit" ] && ! grep -q '^BuildKeel-Unit:' "$1"; then
|
|
299
|
+
git interpret-trailers --in-place --trailer "BuildKeel-Unit: $unit" "$1"
|
|
300
|
+
fi`,fme=`#!/bin/sh
|
|
301
|
+
${E2}: adds "BuildKeel-Unit: <id>" to commits made while a unit is active.
|
|
302
|
+
${BE}
|
|
303
|
+
`;function D_(e){let t=at(e,["rev-parse","--git-path","hooks"]);return lme(t)?t:dme(e,t)}function O2(e){let t=pme(e,"core.hooksPath");if(t)return`core.hooksPath (${t})`;let r=[[".husky","husky"],["lefthook.yml","lefthook"],["lefthook.yaml","lefthook"],[".lefthook.yml","lefthook"],[".pre-commit-config.yaml","pre-commit"],[".overcommit.yml","overcommit"]];for(let[o,s]of r)if(VE(j_(e,o)))return s;let i=j_(e,"package.json");if(VE(i)){let o=R2(i,"utf8");if(/"simple-git-hooks"\s*:/.test(o))return"simple-git-hooks"}let n=j_(D_(e),"commit-msg");return VE(n)&&!R2(n,"utf8").includes(E2)?"an existing commit-msg hook":null}function pme(e,t){try{return at(e,["config","--get",t])||null}catch{return null}}function N2(e){let t=j_(D_(e),"commit-msg");return cn(t,fme,493),t}var Yi=e=>e.split(yme).join("/");function M2(e){let t;try{t=at(e.cwd,["rev-parse","--show-toplevel"])}catch{return I({code:"init-not-git",message:`${e.cwd} is not inside a git repository.`,remedy:"Run git init first, then set up BuildKeel."})}if(t=$l(t),vl(Xi(t,Nt)))return I({code:"init-already",message:`This repository is already set up: ${Nt} exists.`,remedy:`To point it at a different spec tree, edit ${Nt}.`});let r=e.process!==void 0&&e.process!==null;if(r&&e.location==="existing")return I({code:"init-process-existing",message:"An existing spec tree keeps its own process; setting up a repository with it does not change it.",remedy:"Set up without a process, then change the process section of the spec tree's buildkeel.yaml if the team agrees."});let i=e.location==="existing"?null:r?Zp(e.process):N(vt);if(i&&!i.ok)return i;let n=i?{process:i.value,adjusted:r}:void 0,o=gm(t,["remote","get-url","origin"]),s=e.repoName??(o?z2(o).replace(/\.git$/,""):z2(t)),a=gm(t,["rev-parse","--verify","--quiet","HEAD"]),c=[],u=[],l=`this repo registered as "${s}"${a?`, with commits up to ${a.slice(0,7)} treated as existing work`:""}`,d,f,p;if(e.location==="this-repo"){let m=e.path??"specs";d=$l(t,m);let h=L_(t,d);if(M_(m)||h===""||h.startsWith(".."))return I({code:"init-bad-path",message:`The spec folder must be inside this repository, such as specs; got ${m}.`});if(vl(Xi(d,wt)))return I({code:"init-tree-exists",message:`${Yi(h)}/ already holds a spec tree.`,remedy:"Set up again choosing the existing spec tree."});if(vl(d)&&C2(d).length>0)return I({code:"init-folder-in-use",message:`${Yi(h)}/ already exists and is not empty. Choose another folder.`});let g=D2(s,o,a,r?e.process:void 0);u.push({path:Xi(d,wt),content:g}),c.push({display:`${Yi(h)}/${wt}`,what:`new spec tree settings: format ${Hi}, ${l}, ${j2(r)}`}),f={specs:`./${Yi(h)}`}}else if(e.location==="new-repo"){if(!e.path)return I({code:"init-bad-path",message:"Give the folder for the new spec repository: an empty folder, a new one, or an empty repository you cloned."});d=$l(t,e.path);let m=L_(t,d);if(m===""||!m.startsWith("..")&&!M_(m))return I({code:"init-bad-path",message:`${d} is inside this repository. A new spec repository needs a folder of its own, outside it.`,remedy:"Give a folder next to this repository, such as ../specs, or choose to keep the spec tree in this repository."});if(vl(Xi(d,wt)))return I({code:"init-tree-exists",message:`${d} already holds a spec tree.`,remedy:"Set up again choosing the existing spec tree."});let h=vl(d)?gm(d,["rev-parse","--show-toplevel"]):null;if(!vl(d))p=d;else{if(h&&!bme(h,d))return I({code:"init-bad-path",message:`${d} is inside the git repository ${h}. Give an empty folder, or the top folder of an empty repository.`});if(!h){if(C2(d).length>0)return I({code:"init-folder-in-use",message:`${d} is not empty and is not a git repository. Give an empty folder, or an empty repository you cloned.`});p=d}}let g=D2(s,o,a,r?e.process:void 0);u.push({path:Xi(d,wt),content:g}),p&&c.push({display:d,what:"a new git repository for the spec tree (git init)"}),c.push({display:Xi(d,wt),what:`new spec tree settings: format ${Hi}, ${l}, ${j2(r)}`});let y=h?gm(d,["remote","get-url","origin"]):null;f={specs:M_(m)?Yi(d):Yi(m),...y?{remote:y}:{}}}else{if(!e.path)return I({code:"init-bad-path",message:"Give the path of the existing spec tree."});d=$l(t,e.path);let m=Jo(d);if(!m.ok)return I({code:"init-no-tree",message:`There is no spec tree at ${d}: ${m.problems[0]?.message??""}`,remedy:"Check the path, or clone the spec repository first."});let h=z_(m.value.format);if(!h.writable)return I(h.problem);let g=Xi(d,wt);m.value.repos.some($=>$.name===s)?c.push({display:g,what:`no change: "${s}" is already registered in this spec tree`}):(u.push({path:g,content:$me(hme(g,"utf8"),s,o,a)}),c.push({display:g,what:`in the spec tree: ${l}`}));let y=gm(d,["remote","get-url","origin"]),v=L_(t,d);f={specs:M_(v)?Yi(d):Yi(v),...y?{remote:y}:{}}}return vme({codeRoot:t,specRoot:d,repoName:s,baseline:a,changes:c,writes:u,pointer:f,options:e,...p?{gitInit:p}:{},...n?{process:n}:{}})}var j2=e=>e?"and the process as the team adjusted it":"and the default process";function vme(e){let{codeRoot:t,specRoot:r,repoName:i,baseline:n,changes:o,writes:s,pointer:a,options:c}=e,u=["# Which BuildKeel spec tree this repository uses.",`specs: ${a.specs}`,...a.remote?[`remote: ${a.remote}`]:[],`repo: ${i}`,""].join(`
|
|
304
|
+
`);s.push({path:Xi(t,Nt),content:u}),o.push({display:Nt,what:`points this repo at ${a.specs}`}),o.push({display:".gitignore",what:"ignores .buildkeel/, where BuildKeel keeps local state that is never committed (added only if missing)"});let l={kind:"declined"};if(c.stampCommits){let d=O2(t);if(d)l={kind:"manual",manager:d,lines:BE},o.push({display:"(git hooks)",what:`nothing installed: this repo uses ${d}. Add the commit-msg lines shown below to it.`});else{let f=Xi(D_(t),"commit-msg");l={kind:"install",hookPath:f},o.push({display:Yi(L_(t,f)),what:"a commit-msg hook that adds the active unit to commits you make yourself"})}}return N({codeRoot:t,specRoot:r,repoName:i,baseline:n,changes:o,stamping:l,writes:s,...e.gitInit?{gitInit:e.gitInit}:{},...e.process?{process:e.process}:{}})}function L2(e){try{e.gitInit&&(mme(e.gitInit,{recursive:!0}),at(e.gitInit,["init","--quiet"]));for(let t of e.writes)cn(t.path,t.content);LZ(e.codeRoot),e.stamping.kind==="install"&&N2(e.codeRoot)}catch(t){return I({code:"init-write-failed",message:`Setup stopped part way: ${t.message}`})}return N(e)}function D2(e,t,r,i){let n=(0,ym.parseDocument)(`format: ${Hi}
|
|
305
|
+
repos: []
|
|
306
|
+
`);return n.commentBefore=" BuildKeel spec tree settings.",n.set("repos",n.createNode([KE(e,t,r)])),i!==void 0&&n.set("process",n.createNode(i)),n.toString()}function $me(e,t,r,i){let n=(0,ym.parseDocument)(e),o=n.get("repos"),s=n.createNode(KE(t,r,i));return o instanceof ym.YAMLSeq?o.add(s):n.set("repos",n.createNode([KE(t,r,i)])),n.toString()}var KE=(e,t,r)=>({name:e,...t?{remote:t}:{},...r?{baseline:r}:{}}),bme=(e,t)=>{try{let r=i=>gme.native(i);return process.platform==="win32"?r(e).toLowerCase()===r(t).toLowerCase():r(e)===r(t)}catch{return $l(e)===$l(t)}};function gm(e,t){try{return at(e,t)||null}catch{return null}}import{homedir as Tme}from"node:os";import{resolve as Ame}from"node:path";var q2=gr(Kr(),1);import{readFileSync as U2}from"node:fs";import{join as U_}from"node:path";var _me=[];function F2(e,t={}){let r=t.migrations??_me,i=t.target??Hi,n=e.config.format;if(n===i)return I({code:"migrate-current",message:`The spec tree is already in format ${i}, the one this version of BuildKeel uses; there is nothing to migrate.`});if(n>i)return I({code:"migrate-newer",message:`The spec tree is in format ${n}, newer than this version of BuildKeel knows (format ${i}).`,remedy:"Update the BuildKeel plugin; a tree is never migrated back."});let o=[];for(let u=n;u<i;){let l=r.find(d=>d.from===u);if(!l)return I({code:"migrate-unknown",message:`This version of BuildKeel has no migration from format ${u}.`,remedy:"Update the BuildKeel plugin, then migrate again."});o.push(l),u=l.to}let s=J(e.root),a=[];for(let u of s.artifacts.values()){let l=U2(U_(e.root,u.path),"utf8"),d=o.reduce((f,p)=>p.workingFile?.(u.type,f)??f,l);d!==l&&a.push({path:u.path,text:d})}let c=(0,q2.parseDocument)(U2(U_(e.root,wt),"utf8"));for(let u of o)u.config?.(c);return c.set("format",i),N({from:n,to:i,steps:o,files:a.sort((u,l)=>u.path.localeCompare(l.path)),config:c.toString()})}function Z2(e,t){try{for(let r of t.files)cn(U_(e.root,r.path),r.text);cn(U_(e.root,wt),t.config)}catch(r){return I({code:"migrate-write-failed",message:`The migration stopped part way: ${r.message}`,remedy:"Restore the spec tree with git checkout, then migrate again."})}return Ct(e.root,[wt,...t.files.map(r=>r.path)],`migrate: format ${t.from} to ${t.to}`)}import{appendFileSync as wme,copyFileSync as kme,existsSync as V2,mkdirSync as GE,readdirSync as Sme,readFileSync as B2,rmSync as xme,writeFileSync as Ime}from"node:fs";import{dirname as K2,join as vm}from"node:path";var Pme="usage",G2="settings.json",fs=e=>vm(e,Pme),WE=(e,t)=>vm(fs(e),`${pE(t)}.jsonl`);function $m(e){try{return JSON.parse(B2(vm(fs(e),G2),"utf8")).recording!==!1}catch{return!0}}function JE(e,t){GE(fs(e),{recursive:!0}),Ime(vm(fs(e),G2),`${JSON.stringify({recording:t},null,2)}
|
|
307
|
+
`)}function W2(e,t,r,i,n=new Date){try{if(!$m(e))return;let o=WE(e,t);GE(K2(o),{recursive:!0});let s={at:n.toISOString().replace(/\.\d{3}Z$/,"Z"),host:r,...i};wme(o,`${JSON.stringify(s)}
|
|
308
|
+
`)}catch{}}function J2(e,t){let r;try{r=B2(WE(e,t),"utf8")}catch{return[]}return r.split(`
|
|
309
|
+
`).flatMap(i=>{if(!i.trim())return[];try{let n=JSON.parse(i);return typeof n.event=="string"&&typeof n.at=="string"?[n]:[]}catch{return[]}})}function H2(e){let t=fs(e);if(!V2(t))return 0;let r=Sme(t).filter(i=>i.endsWith(".jsonl"));for(let i of r)xme(vm(t,i),{force:!0});return r.length}function Y2(e,t,r){let i=WE(e,t);return V2(i)?(GE(K2(r),{recursive:!0}),kme(i,r),!0):!1}var Q2=bt({name:"manage",title:"Set up and maintain BuildKeel",description:"Setup and housekeeping. action=init sets up this repository: a new spec tree in a folder of this repo (location=this-repo), a pointer to an existing spec tree (location=existing, path=<spec tree>), or a new spec repository of its own outside this repo (location=new-repo, path=<folder>: an empty folder, a new one, or an empty clone). Call it first without apply to get the list of everything it will add, show that to the user, and call again with apply=true only after the user agrees. action=release with id releases the claim on a unit held by a working tree on this machine, before it is finished, only when the user asks for it; it stops being the active unit there, and its branch and commits stay as they are. action=usage changes the usage record kept on this machine: usage=off stops recording, usage=on starts it again, usage=delete deletes the record, and usage=export writes this spec tree's record to path, all only on the user's request; nothing is ever sent anywhere. action=migrate upgrades a spec tree in an older format to the one this version of BuildKeel uses: without apply it lists what changes, and with apply=true, only after the user agrees, it rewrites working files and buildkeel.yaml in one commit; frozen versions and records are never changed. action=untracked, only when the user has said to go ahead without a unit after being offered one: lets files be changed in this working tree with no active unit until a unit is started; those changes belong to no unit, and their commits are listed by the status overview. action=map writes the map of the code's capability areas that onboarding goes through, only once the user agreed to it or asked for the change: map=set with areas (each with a name, its paths, and its repo when the tree serves several), map=merge, map=split or map=rename. action=match with id (a test case, such as US-E001-TC1) and tests records which existing tests implement it, without changing the code: name each test exactly as the latest JUnit report names it (query view=untested lists them), replacing what was matched before; tests empty drops the match. Matches are for tests that existed before BuildKeel; a new test carries the test case ID in its name instead.",inputSchema:{action:b.enum(["init","release","untracked","usage","migrate","match","map"]).describe("What to do."),map:b.enum(["set","merge","split","rename"]).optional().describe("map: set writes the whole map (areas); merge joins the areas named in merge into one called to; split replaces area with areas; rename renames area to to."),areas:b.array(b.object({name:b.string(),repo:b.string().optional(),paths:b.array(b.string()),summary:b.string().optional()})).optional().describe("map set or split: each area's name, the paths it covers (such as src/reset/), its repo when the tree serves several, and one line on what it does."),area:b.string().optional().describe("map split or rename: the area, by name."),merge:b.array(b.string()).optional().describe("map merge: the areas to join, by name."),to:b.string().optional().describe("map merge or rename: the new name."),tests:b.array(b.string()).optional().describe("match: the existing tests that implement the test case, each as a JUnit report names it, such as test/reset.test.ts > emails a reset link."),usage:b.enum(["off","on","delete","export"]).optional().describe("usage: what to do with the usage record."),id:b.string().optional().describe("release: the unit whose claim to release, such as TK-001. match: the test case, such as US-E001-TC1."),location:b.enum(["this-repo","existing","new-repo"]).optional().describe("init: where the spec tree lives."),path:b.string().optional().describe("init: this-repo: folder for the new spec tree (default specs). existing: the spec tree's path. new-repo: the new spec repository's folder. usage=export: the file to write, such as ~/buildkeel-usage.jsonl."),repoName:b.string().optional().describe("init: this repository's name in the spec tree. Defaults to the remote's name."),stampCommits:b.boolean().optional().describe("init: add the active unit to commits the user makes by hand, through a git hook."),process:b.record(b.string(),b.unknown()).optional().describe("init, for a new spec tree, only when the user adjusts the default process: the process section of buildkeel.yaml, such as { chain: [{ type: idea }, { type: epic, requires: [] }, { type: story, name: feature, requires: [test-plan, design] }, { type: task }] }. Stages: rename with name, add one between idea and story with type, prefix and dir; requires lists the documents (test-plan, design) each stage needs approved before work under it starts. documents renames a built-in document or adds the team's own with type, name and suffix."),apply:b.boolean().default(!1).describe("false: only list what would change. true: make the changes.")},readOnly:!1,run(e,t){if(t.action==="release")return zme(e.home,e.workspace(),t.id);if(t.action==="untracked")return Cme(e.workspace());if(t.action==="migrate")return Eme(e.workspace(),t.apply);if(t.action==="map"){let s=e.workspace();if(!s.ok)return B("BuildKeel cannot read a spec tree here.",s.problems);let a=Ome(s.value,e.writer(s.value),t);e.flushWrites();let c=xa(s.value.tree.root);return c.ok&&c.value&&a.startsWith("The map now has")&&e.usage(s.value,{event:"map",areas:c.value.areas.length}),a}if(t.action==="match"){let s=e.workspace();if(!s.ok)return B("BuildKeel cannot read a spec tree here.",s.problems);let a=Nme(s.value,e.writer(s.value),t.id,t.tests);return e.flushWrites(),a}if(t.action==="usage")return Rme(e.home,e.workspace(),t.usage,t.path,e.cwd);if(!t.location||t.stampCommits===void 0)return"To set up, ask the user where the spec tree should live (in this repo, an existing spec tree, or a new spec repository of its own) and whether to stamp their own commits, then call manage again with location and stampCommits.";let r={cwd:e.cwd,location:t.location,stampCommits:t.stampCommits,...t.path?{path:t.path}:{},...t.repoName?{repoName:t.repoName}:{},...t.process?{process:t.process}:{}},i=M2(r);if(!i.ok)return B("BuildKeel cannot set up this repository.",i.problems);if(!t.apply)return[`BuildKeel will set up ${i.value.codeRoot}:`,...X2(i.value),"",i.value.process?"Nothing has been written yet. Show this list and the process to the user, as they are, and ask whether to set up with this process, adjust it, or stop. To adjust, ask one question at a time, call manage again without apply with the process, and show the new table; call manage with the same choices and apply=true only when the user agrees.":"Nothing has been written yet. Show this list to the user and ask them to confirm; then call manage again with the same choices and apply=true."].join(`
|
|
310
|
+
`);let n=L2(i.value);if(!n.ok)return B("Setup did not finish.",n.problems);let o=e.workspace();return o.ok&&e.refreshHookCache(o.value),[`BuildKeel is set up in ${i.value.codeRoot}: from now on, code changes here follow the team's process, and conversation stays free. Changed:`,...X2(i.value),"","Nothing was committed. Review the changes and commit them; if the spec tree is in another repository, commit and push it there too, so the team sees this repo registered.",...i.value.gitInit?[`The new spec repository at ${i.value.gitInit} has no remote yet: add one and push it, so other code repositories and teammates can use it.`]:[],...i.value.baseline?["This repository already holds code: it is documented as work touches it, with a version 0 of what each change touches, or all at once with {{bk:onboard}}, whenever you choose."]:[],"Next: talk through what you want to build, as you would without BuildKeel. When you want it planned, {{bk:capture}} turns the conversation into the artifacts your process needs, and {{bk:new}} drafts one artifact at a time."].join(`
|
|
311
|
+
`)}});function Rme(e,t,r,i,n){if(r==="off")return JE(e,!1),`Usage recording is off on this machine: nothing new is recorded, and everything else works as before. What was recorded stays in ${fs(e)} until you delete it.`;if(r==="on")return JE(e,!0),`Usage recording is on again on this machine, in ${fs(e)}. Nothing is sent anywhere.`;if(r==="delete"){let o=H2(e);return o===0?"There is no usage record on this machine to delete.":`Deleted the usage record on this machine: ${o} log${o===1?"":"s"}. ${$m(e)?"Recording carries on from now; turn it off with usage off.":"Recording stays off."}`}if(r==="export"){if(!t.ok)return B("BuildKeel cannot read a spec tree here.",t.problems);if(!i)return"Give the path of the file to write the usage record to.";let o=Ame(n,i.replace(/^~(?=$|[/\\])/,Tme()));return Y2(e,t.value.tree.root,o)?`Wrote this spec tree's usage record to ${o}: one JSON line per event, with IDs, types, outcomes and times, and no artifact text or code.`:"There is no usage record for this spec tree on this machine yet, so nothing was written."}return"Say what to do with the usage record: usage off, on, delete or export (with a path)."}function Eme(e,t){if(!e.ok)return B("BuildKeel cannot read a spec tree here.",e.problems);let{tree:r}=e.value,i=F2(r);if(!i.ok)return B("Nothing was migrated.",i.problems);let{from:n,to:o,steps:s,files:a}=i.value,c=[...s.map(l=>`- Format ${l.from} to ${l.to}: ${l.summary}`),`- buildkeel.yaml: format ${o}`,...a.map(l=>`- ${l.path}`)];if(!t)return[`Migrating the spec tree from format ${n} to ${o} rewrites ${a.length} working file${a.length===1?"":"s"} and buildkeel.yaml, in one commit. Frozen versions and records stay exactly as they are, so every approval still matches its hash.`,...c,"","Nothing has been written yet. Show this to the user, and call manage again with action migrate and apply=true only if they agree."].join(`
|
|
312
|
+
`);let u=Z2(r,i.value);return u.ok?[`Migrated the spec tree from format ${n} to ${o}: it can be changed again, and every approval still matches its hash. Committed as "migrate: format ${n} to ${o}" (${u.value.slice(0,7)}), with only these files:`,...c,"Push the spec repo so the team gets it; anyone on an older BuildKeel needs to update the plugin first."].join(`
|
|
313
|
+
`):B("The migration did not finish.",u.problems)}function Ome(e,t,r){let i=r.map==="set"&&r.areas?{op:"set",areas:r.areas}:r.map==="merge"&&r.merge&&r.to?{op:"merge",names:r.merge,to:r.to}:r.map==="split"&&r.area&&r.areas?{op:"split",name:r.area,areas:r.areas}:r.map==="rename"&&r.area&&r.to?{op:"rename",name:r.area,to:r.to}:"Say how to change the map: map set with areas, map merge with merge and to, map split with area and areas, or map rename with area and to.";if(typeof i=="string")return i;let{tree:n,resolved:o}=e,s=IV({root:n.root,writer:t,defaultRepo:o.pointer.repo},i);if(!s.ok)return B("The map was not changed.",s.problems);let{map:a,summary:c,commit:u}=s.value,l=u.ok?`committed as "onboard: ${c}" (${u.value.slice(0,7)})`:`written but not committed: ${u.problems[0]?.message??""}`;return[`The map now has ${a.areas.length} area${a.areas.length===1?"":"s"}, in ${Tn}, ${l}:`,"","| Area | Repo | Paths | What it does |","|---|---|---|---|",...a.areas.map(d=>`| ${d.name} | ${d.repo} | ${d.paths.join(", ")} | ${d.summary??""} |`)].join(`
|
|
314
|
+
`)}function Nme(e,t,r,i){if(!r||i===void 0)return"Give the test case's id and the tests that implement it, as the latest test report names them; no tests drops its match.";let{tree:n,resolved:o}=e,s=xn(n.root);if(!s)return'Git has no name and email set for the spec repo, so who matched the tests cannot be recorded. Set them with git config user.name "Your Name" and git config user.email you@example.com.';let a=J(n.root),c=WZ({root:n.root,writer:t,index:a},{testCase:r,tests:i,by:s,at:new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});if(!c.ok)return B("Nothing was matched.",c.problems);let{path:u,commit:l}=c.value,d=l.ok?`committed as "match: ${r}${c.value.tests.length===0?" dropped":""}" (${l.value.slice(0,7)}) in the spec repo`:`written but not committed: ${l.problems[0]?.message??""}`;if(c.value.tests.length===0)return`Dropped the match of ${r}: ${u} is removed, ${d}. ${r} counts as having a test again only once a test is tagged [${r}] or matched to it.`;let f=Ji(o.codeRoot).latest,p=f?c.value.tests.filter(m=>!f.tests.includes(m)):[];return[`Matched ${r} to ${c.value.tests.join("; ")} in ${u}, ${d}. The code is unchanged: results of ${c.value.tests.length===1?"that test":"those tests"} now count for ${r}.`,...p.length>0?[`Not in the latest test report (${f?.report}): ${p.join("; ")}. Check the names against the report; a match counts only when a report names the test the same way.`]:[]].join(`
|
|
315
|
+
`)}function Cme(e){if(!e.ok)return B("BuildKeel cannot read a spec tree here.",e.problems);let{codeRoot:t}=e.value.resolved,r=Ke(t);if(r?.activeUnit)return`${r.activeUnit} is the active unit in this working tree, so changes belong to it. Finish it, or start another unit, instead.`;let i=r?.untrackedSince??new Date().toISOString().replace(/\.\d{3}Z$/,"Z");return Hn(t,{untrackedSince:i})?[`Working without a unit in ${t} since ${i}: BuildKeel no longer holds edits here until a unit is started.`,"Changes made now belong to no unit. Commit them without a BuildKeel-Unit line; the status overview lists those commits under commits with no unit.","Starting a unit with {{bk:start}} <ID> ends this."].join(`
|
|
316
|
+
`):"BuildKeel has not prepared this working tree yet; call another BuildKeel tool first, then try again."}function zme(e,t,r){if(!t.ok)return B("BuildKeel cannot read a spec tree here.",t.problems);if(!r)return"Give the id of the unit whose claim to release.";let i=gV(e,t.value.tree.root,r);if(!i)return`${r} is not claimed on this machine, so there is nothing to release.`;let{claim:n,cleared:o}=i,s=[`Released the claim on ${r}, held by ${n.workingTree}${n.branch?` (branch ${n.branch})`:""} since ${n.claimedAt}. Any working tree can start it now.`];return o&&s.push(`${r} is no longer the active unit in ${n.workingTree}; its branch and commits are unchanged. Start it again with {{bk:start}} ${r} to carry on.`),s.join(`
|
|
317
|
+
`)}function X2(e){let t=e.changes.map(r=>`- ${r.display}: ${r.what}`);return e.process&&t.push("",e.process.adjusted?"The process, as adjusted:":"The process: BuildKeel's default, which the team can use as it is or adjust.","",...p_(e.process.process)),e.stamping.kind==="manual"&&t.push("",`To stamp your own commits, add these lines to the commit-msg hook managed by ${e.stamping.manager}:`,"","```sh",e.stamping.lines,"```"),t}import{readFileSync as kB}from"node:fs";import{join as SB,resolve as rhe}from"node:path";import{existsSync as jme,realpathSync as eB}from"node:fs";import{basename as dDe,dirname as tB,isAbsolute as Dme,join as Mme,relative as nB,resolve as fDe,sep as Lme}from"node:path";var pDe=process.platform==="win32";function iB(e,t){let r=rB(e,t);if(r!==null)return r;try{let i=t;for(;!jme(i)&&tB(i)!==i;)i=tB(i);let n=Mme(eB(i),nB(i,t));return rB(eB(e),n)}catch{return null}}function rB(e,t){let r=nB(e,t);return r===""||r.startsWith("..")||Dme(r)?null:r.split(Lme).join("/")}var oB=(e,t)=>e.artifacts.get(`${t.id}${ee.idSuffix}`),bm=e=>e.title?` "${e.title}"`:"";function aB(e,t,r){let i=t.artifacts.get(r.endsWith(ee.idSuffix)?Ut(r):r);if(!i)return`There is no artifact ${r}.`;let n=_e(e),o=Gi(e,i.type);if(!o)return`${i.id} is ${n.a(i.type)}, which has no test plan.`;if(o==="task")return Ume(e,t,i);let s=oB(t,i),a=[];if(!s)return a.push(`${i.id}${bm(i)} has no ${wa[o]} yet. Draft one with ${ie("new")} test-plan ${i.id}.`),a.join(`
|
|
318
|
+
`);let c=ns(e,t,s);if(!c)return`${s.id} cannot be read.`;let u=St(e,s),l=Wu(oe(e,s));if(a.push(`Coverage of ${i.id}${bm(i)} by its ${wa[o]} ${s.id} (${l}), checked against ${c.against}:`),o==="story"){let f=[...t.artifacts.values()].filter(g=>g.type==="task"&&g.parent?.id===i.id).flatMap(g=>{let y=oB(t,g);return y?St(e,y).map(v=>({...v,id:`${v.id} (${n.one("task")} ${g.id})`})):[]}),p=Xp(c.required,[...u,...f]),m=Xp(c.required,u);a.push(...sB(c.required,p));let h=c.required.filter(g=>(m.get(g.id)??[]).length===0);a.push("",h.length===0?`Every criterion is covered by ${s.id}.`:`${h.length} gap${h.length===1?"":"s"} in ${s.id}: ${h.map(g=>g.id).join(", ")}. A plan with a gap cannot be approved.`)}else if(o==="epic"){let f=Yp(t,i,"story");f.length===0&&a.push(`- No ${n.many("story")} under it yet.`);for(let p of f){let m=u.filter(h=>(h.covers??[]).some(g=>g===p.id||g.startsWith(`${p.id}-`)));a.push(`- ${p.id}${bm(p)} ${m.length>0?`covered by ${m.map(h=>h.id).join(", ")}`:"not covered"}`)}}else{let f=Yp(t,i,"epic");a.push(...sB(c.informational,Xp(c.informational,u)));for(let p of f){let m=u.filter(h=>(h.covers??[]).includes(p.id));a.push(`- ${p.id}${bm(p)} ${m.length>0?`covered by ${m.map(h=>h.id).join(", ")}`:"not covered"}`)}c.informational.length>0&&a.push("","Goals are not required to be covered; one that is not is listed for information.")}let d=o_(c,u);return d.length>0&&a.push("","Covers lines that name something the plan may not cover:",...d.map(f=>`- ${f.message}`)),a.join(`
|
|
319
|
+
`)}function sB(e,t){return e.map(r=>{let i=t.get(r.id)??[],n=r.addedIn!==void 0?`, added in v${r.addedIn}`:"";return`- ${r.id} (${r.text}${n}) ${i.length>0?`covered by ${i.join(", ")}`:"not covered"}`})}function Ume(e,t,r){let i=Wi(e,t,r.id),n=[`${i.length} test case${i.length===1?"":"s"} apply to ${r.id}${bm(r)}: its own and its ${_e(e).one("story")}'s.`],o=[...new Set(i.map(a=>a.plan))];for(let a of[`${r.id}${ee.idSuffix}`,...r.parent?[`${r.parent.id}${ee.idSuffix}`]:[]]){if(!t.artifacts.get(a)){n.push("",`${a}: none yet.`);continue}if(!o.includes(a))continue;let u=i.find(l=>l.plan===a)?.version;n.push("",`From ${a} (${u?`approved v${u}`:"draft"}):`);for(let l of i.filter(d=>d.plan===a))n.push(`- ${l.id} ${l.title} (covers ${l.covers.join(", ")||"nothing"})`)}let s=i.filter(a=>a.regression);return s.length>0&&n.push("","Regression tests of fixed bugs:",...s.map(a=>`- ${a.id} ${a.title}`)),n.join(`
|
|
320
|
+
`)}var qme=new Set(["test-plan-gap","coverage-gap"]);function cB(e,t){let r={events:0,finished:{},durations:[],gates:{},gapsCaught:0,suspectsRaised:0,resolved:{"still-valid":0,"needs-change":0},drafts:0,capturedDrafts:0,approvals:0,contextLoads:0,runStarts:0,onboarded:{area:0,work:0}};for(let i of e)if(!(t&&Date.parse(i.at)<t.getTime()))switch(r.events++,i.event){case"finish":r.finished[i.type]=(r.finished[i.type]??0)+1,typeof i.seconds=="number"&&r.durations.push(i.seconds);break;case"gate":{let n=r.gates[i.gate]??={passed:0,warned:0,blocked:0};n[i.outcome]++,i.outcome==="blocked"&&(r.gapsCaught+=i.checks.filter(o=>qme.has(o)).length);break}case"suspect":r.suspectsRaised++;break;case"resolve":r.resolved[i.decision]++;break;case"draft":r.drafts++,i.capture&&r.capturedDrafts++;break;case"approve":r.approvals++;break;case"context":r.contextLoads++;break;case"start":i.run&&r.runStarts++;break;case"onboard":r.onboarded[i.way]++;break}return r}function HE(e){if(e<60)return`${e} s`;let t=Math.round(e/60);if(t<60)return`${t} min`;let r=Math.floor(t/60);return r<48?`${r} h${t%60?` ${t%60} min`:""}`:`${Math.floor(r/24)} days${r%24?` ${r%24} h`:""}`}function uB(e){if(e.length===0)return null;let t=[...e].sort((i,n)=>i-n),r=Math.floor(t.length/2);return t.length%2===1?t[r]:Math.round((t[r-1]+t[r])/2)}var Qi=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`;function lB(e,t,r,i=new Date){let{tree:n}=e,o=J2(t,n.root),s=r?new Date(i.getTime()-r*864e5):null,a=r?`the last ${Qi(r,"day")} (since ${s?.toISOString().slice(0,10)})`:"all the time recorded",u=$m(t)?[]:["","Recording is off on this machine, so nothing new is added. Turn it back on with the BuildKeel manage tool, action usage, usage on."];if(o.length===0)return["There is nothing to show yet: BuildKeel has recorded no usage for this spec tree on this machine. It records as you draft, approve, start and finish work, and keeps the record on this machine only.",...u].join(`
|
|
321
|
+
`);let l=cB(o,s);if(l.events===0)return[`Nothing was recorded in ${a}. Ask for a longer period, or all of it.`,...u].join(`
|
|
322
|
+
`);let d=Vu($t(n.root)),f=Object.values(l.finished).reduce((_,w)=>_+w,0),p=Object.values(l.gates).reduce((_,w)=>_+w.blocked,0),m=l.resolved["still-valid"]+l.resolved["needs-change"],h=[];h.push(`In ${a}: ${Qi(f,"unit")} finished, the gates stopped work ${Qi(p,"time")} and caught ${Qi(l.gapsCaught,"coverage gap")}, and ${Qi(m,"suspect")} ${m===1?"was":"were"} decided.`),h.push(`Recorded on this machine only, for ${n.config.name??"this spec tree"}; nothing is sent anywhere.`),h.push("",`Units finished: ${f}${f>0?` (${Object.entries(l.finished).map(([_,w])=>`${d.one(_)} ${w}`).join(", ")})`:""}.`);let g=l.finished.adhoc??0;f>0&&h.push(`Recorded as ${d.many("adhoc")}: ${g} of ${f} (${Math.round(g/f*100)}%).`);let y=uB(l.durations);y!==null&&h.push(`Time from start to done: ${HE(y)} typically (the median), ${HE(Math.max(...l.durations))} at the longest.`);let v=Object.entries(l.gates);v.length>0&&h.push("","| Gate | Passed | Warned | Blocked |","|---|---|---|---|",...v.map(([_,w])=>`| ${_} | ${w.passed} | ${w.warned} | ${w.blocked} |`)),h.push("",`Coverage gaps caught by a gate: ${l.gapsCaught}.`),h.push(`Suspects: ${l.suspectsRaised} raised; ${l.resolved["still-valid"]} kept as still valid, ${l.resolved["needs-change"]} needing change.`),h.push(`Drafts: ${l.drafts} created${l.capturedDrafts>0?` (${l.capturedDrafts} captured from a conversation)`:""}; ${Qi(l.approvals,"approval")}.`),h.push(`Context loaded for a unit ${Qi(l.contextLoads,"time")}; ${Qi(l.runStarts,"unit")} started in a build run.`);let $=l.onboarded.area+l.onboarded.work;return $>0&&h.push(`Existing code documented: ${Qi($,"artifact")} approved as version 0, ${l.onboarded.area} area by area and ${l.onboarded.work} as work touched the code.`),h.push(...u),h.join(`
|
|
323
|
+
`)}import{realpathSync as _B}from"node:fs";import{existsSync as Fme}from"node:fs";import{join as Zme}from"node:path";function YE(e,t){let r=oe(e,t);return r.state!=="approved"||r.draftOpen||r.approvedVersion===null?null:an(e,t,r.approvedVersion)}var Vme=(e,t)=>e.type===t.template.type&&e.version===t.template.version&&e.source===t.source&&(e.org??null)===(t.org??null);function Bme(e){return`${e.source==="tree"?"the spec tree's own":e.source==="org"?`the organization's (${e.org??"unknown version"})`:"the built-in"} ${e.type} template v${e.version}`}function XE(e,t,r,i){let n=YE(e,t);if(!n||i.length===0||n.template&&Vme(n.template,r))return{problems:i,earlier:null};let o=new Set(am(t.document,r.template,{itemOwner:Ia(t),path:t.path}).map(c=>c.message));if(!n.template)return{problems:i.filter(c=>!o.has(c.message)),earlier:null};let s=i.filter(c=>o.has(c.message));if(s.length===0)return{problems:i,earlier:null};let a=c=>c.replace(`${t.path}: `,"").replace(/\.$/,"");return{problems:i.filter(c=>!o.has(c.message)),earlier:{code:"approved-under-earlier-template",path:t.path,message:`${t.id} v${n.version} was approved under ${Bme(n.template)}, and under the current one (v${r.template.version}, ${Hp(r)}) ${s.map(c=>a(c.message)).join("; ")}.`,remedy:`${t.id} stays approved; its next version is checked against the current template.`}}}function QE(e,t,r){let i=[],n=[];for(let o of t.artifacts.values()){let s=o.parent?t.artifacts.get(o.parent.id):void 0,a=s?SE(r,o,s):null;if(!a)continue;let c=YE(e,o);if(!c){i.push({...a,message:`${o.path}: ${a.message}`});continue}n.push({code:"approved-under-earlier-process",path:o.path,message:`${o.id} v${c.version} was approved before the process changed: ${a.message}`,remedy:`${o.id} stays approved; its next version must sit under ${_e(e).a(Vp(r,o.type)?.type??"")}.`})}return{problems:i,earlier:n}}function dB(e,t){let r=[],i=new Set;for(let n of[...t.chain.map(o=>o.type),"bug","adhoc",...t.documents.map(o=>o.type)]){let o=lt(n,e);o.ok||(i.add(n),!o.problems.some(s=>s.code==="org-unpinned"||s.code==="org-unavailable")&&r.push(...o.problems))}return{problems:r,failed:i}}function q_(e){let t=lt(ee.type,e);if(!t.ok)return null;let r=Object.entries(t.value.template.sections).filter(([,o])=>o.items);if(r.length>0&&r.every(([,o])=>o.items?.covers==="required"))return null;let i=_e(e),n=t.value.source==="tree"?t.value.path:Hp(t.value);return{code:"covers-optional",path:t.value.path,message:`The test plan template (${n}) makes the covers line optional. A test case without one is never marked suspect when what it tests changes, and covers no ${i.one("story")} criterion, so precise change impact and coverage gap detection are lost for it.`,remedy:t.value.source==="tree"?`Set covers: required on the test cases section of ${t.value.path}, and raise its version.`:"Override test-plan.md in the spec tree's templates/ folder with covers: required, or ask the organization's template maintainers to require it."}}function fB(e){let{org:t}=Gr(e);if(!t?.ok)return null;let r=_e(e),i=[];for(let l of OZ(e)){let d=Fme(Zme(t.value.dir,Bp,`${l}.md`));i.push(`- the ${r.one(l)} template: templates/${l}.md ${d?"overrides the organization's":"is the tree's own (the organization has none)"}`)}let n=Jo(e),o=n.ok?n.value.process??{}:{},s=Bb(t.value),a=s.ok&&s.value&&typeof s.value=="object"?s.value:{};for(let l of["chain","bug","adhoc"])o[l]!==void 0&&a[l]!==void 0&&i.push(`- process.${l} in buildkeel.yaml overrides the organization's`);let c=o.gates??{},u=a.gates??{};for(let l of Mb)c[l]!==void 0&&u[l]!==void 0&&c[l]!==u[l]&&i.push(`- the ${l} gate: ${String(c[l])} in buildkeel.yaml overrides the organization's ${String(u[l])}`);return{label:t.value.label,lines:i}}function pB(e,t,r){let i=QE(e,t,r).earlier,n=new Map;for(let o of t.artifacts.values()){if(!YE(e,o))continue;n.has(o.type)||n.set(o.type,lt(o.type,e));let s=n.get(o.type);if(!s?.ok)continue;let a=am(o.document,s.value.template,{itemOwner:Ia(o),path:o.path}),{earlier:c}=XE(e,o,s.value,a);c&&i.push(c)}return i}import{existsSync as mB,readdirSync as Kme,readFileSync as gB}from"node:fs";import{join as _m}from"node:path";function yB(e){let t=J(e.root),r=[...t.problems],{org:i}=Gr(e.root);i&&!i.ok&&r.push(...i.problems);let n=Et(e);!n.ok&&i?.ok!==!1&&r.push(...n.problems);let o=[],s=new Set;if(n.ok){let f=QE(e.root,t,n.value);r.push(...f.problems),o.push(...f.earlier);let p=dB(e.root,n.value);r.push(...p.problems),s=p.failed}let a=0,c=new Map;for(let f of t.artifacts.values()){let p=bB(e.root,f);a+=p.checked,c.set(f.id,p.versions),r.push(...p.problems)}let u=Yme(e.root,t,s);o.push(...u.earlier),r.push(...Jme(t,c),...Hme(t),...u.problems,...Qme(e.root,t),...Xme(e.root,t)),r.push(...Yn(e.root,t).problems);let l=new Set(r.map(f=>f.path));r.push(...$B(e.root).filter(f=>!l.has(f.path)));let d=q_(e.root);return{index:t,versionsChecked:a,problems:r,warnings:d?[d]:[],earlier:o,overrides:fB(e.root)}}var Gme=new Set(["frozen-altered","pending-altered","source-altered","source-missing","source-added"]);function vB(e,t=J(e)){let r=[...t.artifacts.values()].flatMap(n=>bB(e,n).problems.filter(o=>Gme.has(o.code))),i=new Set(r.map(n=>n.path));return[...r,...$B(e).filter(n=>!i.has(n.path))]}var hB=new RegExp(`^[^/]+/[^/]+/(?:[^/]+/)?(?:${Uu.join("|")})/[^/]+$`);function $B(e){let t=[],r=de(e,["diff","--name-only","--relative","HEAD","--","."]);for(let o of(r??"").split(`
|
|
324
|
+
`).filter(s=>hB.test(s)))t.push({code:"record-changed",path:o,message:`${o} has uncommitted changes. BuildKeel writes records once and never changes them.`,remedy:`Restore it with git restore -- ${o} in the spec repo.`});let i=new Set(t.map(o=>o.path)),n=de(e,["log","--format=%x1e%h %s","--name-only","--relative","--diff-filter=M","--","."]);for(let o of(n??"").split("").filter(Boolean)){let[s="",...a]=o.split(`
|
|
325
|
+
`).filter(Boolean);for(let c of a.filter(u=>hB.test(u)&&!i.has(u)))i.add(c),t.push({code:"record-changed",path:c,message:`${c} was changed after it was written, in commit ${s}. BuildKeel writes records once and never changes them.`,remedy:`Check that change with git show ${s.split(" ")[0]} in the spec repo, and restore the file as it was first written if it should not have changed.`})}return t}function bB(e,t){let r=Pe(t),i=[],n=d=>gB(_m(e,d),"utf8"),o=d=>mB(_m(e,r,d))?Kme(_m(e,r,d)):[],s=(d,f)=>d.map(p=>f.exec(p)?.[1]).filter(p=>p!==void 0).map(Number),a=o(Gn),c=new Set(s(a,Fu)),u=new Set(s(o(Up),UF)),l=0;for(let d of[...c].sort((f,p)=>f-p)){let f=Vi(r,d),p=ga(n(f),f);if(!p.ok){i.push(...p.problems);continue}let m=p.value;m.version!==d&&i.push({code:"record-version-mismatch",path:f,message:`${f} records version ${m.version}, but its file name says v${d}. Two approvals may claim the same version.`}),m.artifact!==t.id&&i.push({code:"record-artifact-mismatch",path:f,message:`${f} is the approval of ${m.artifact}, but it sits in the directory of ${t.id}.`});let h=Zi(r,d);if(!u.has(d)){i.push({code:"frozen-missing",path:h,message:`${t.id} v${d} is approved, but its frozen copy ${h} is missing.`});continue}l++,yi(n(h))!==m.hash&&i.push({code:"frozen-altered",path:h,message:`${t.id} v${d} was altered after approval: ${h} no longer matches the hash in ${f}.`,remedy:`Restore ${h} from git history. To change ${t.id}, save a new version as a draft and approve it.`}),d===0&&i.push(...Wme(e,t,r,m.sources??{},f))}c.has(0)&&t.onboard&&i.push({code:"onboard-after-approval",path:t.onboard.path,message:`${t.onboard.path} is a draft of version 0, but ${t.id} v0 is already approved, and an artifact has one version 0 at most.`,remedy:`Remove ${t.onboard.path}. To change what ${t.id} says, save a new version as a draft and approve it.`});for(let d of u)if(!c.has(d)){let f=Zi(r,d);i.push({code:"frozen-unrecorded",path:f,message:`${f} has no approval record (${Vi(r,d)}).`})}if(c.size===0)for(let d of s(a,Zu)){let f=qp(r,d),p=ga(n(f),f);if(!p.ok){i.push(...p.problems);continue}let m=d===0?t.onboard?.path??t.path:t.path;(!mB(_m(e,m))||yi(n(m))!==p.value.hash)&&i.push({code:"pending-altered",path:m,message:`${t.id} was changed after it was approved (its number is still pending): ${m} no longer matches the hash in ${f}.`,remedy:`Restore ${m} from git history.`})}return{checked:l,versions:c,problems:i}}function Wme(e,t,r,i,n){let o=[],s=new Set(os(e,r));for(let[a,c]of Object.entries(i)){let u=`${ha(r)}/${a}`;s.has(a)?yi(gB(_m(e,u),"utf8"))!==c&&o.push({code:"source-altered",path:u,message:`A source of ${t.id} v0 was altered after approval: ${u} no longer matches the hash in ${n}.`,remedy:`Restore ${u} from git history. Sources are kept as they were read, and frozen with version 0.`}):o.push({code:"source-missing",path:u,message:`${t.id} v0 was approved with the source ${a}, but ${u} is missing.`,remedy:`Restore ${u} from git history.`})}for(let a of s){if(Object.hasOwn(i,a))continue;let c=`${ha(r)}/${a}`;o.push({code:"source-added",path:c,message:`${c} was added after ${t.id} v0 was approved, so it is not one of the sources it was approved with.`,remedy:`Remove ${c}. What it says can go into a new version of ${t.id}, drafted and approved as usual.`})}return o}function Jme(e,t){let r=[];for(let i of e.artifacts.values()){let n=i.parent;!n||n.version===void 0||!e.artifacts.has(n.id)||t.get(n.id)?.has(n.version)||r.push({code:"pin-not-approved",path:i.path,message:`${i.id} is pinned to ${It(n)}, but ${n.id} has no approved version ${n.version}.`})}return r}function Hme(e){let t=[],r=new Map,i=new Map,n=[...e.artifacts.values()].sort((o,s)=>o.path<s.path?-1:o.path>s.path?1:0);for(let o of n){if(o.owner!==void 0)continue;let s=o.document.frontmatter.id;typeof s=="string"&&s!==""&&r.set(s,[...r.get(s)??[],o]);let a=_a(o.id)?null:/-([A-Z]?)([0-9]+)$/.exec(o.id);if(a){let c=`${o.type}:${a[1]??""}${Number(a[2])}`;i.set(c,[...i.get(c)??[],o])}}for(let[o,s]of r)s.length>1&&t.push({code:"duplicate-id",path:s[0]?.path??"",message:`${o} is used by ${s.length} artifacts: ${s.map(a=>a.path).join(" and ")}.`,remedy:"Keep one, and save the other as a new draft so it gets its own number when approved."});for(let[o,s]of i)s.length>1&&t.push({code:"duplicate-number",path:s[0]?.path??"",message:`${s.map(a=>a.id).join(" and ")} share the ${_e(e.root).one(o.split(":")[0])} number ${o.split(":")[1]?.replace(/^[A-Z]/,"")}${/^[A-Z]/.test(o.split(":")[1]??"")?" in the onboarded sequence":""}: ${s.map(a=>a.path).join(" and ")}.`,remedy:"Keep one, and save the other as a new draft so it gets its own number when approved."});return t}function Yme(e,t,r){let i=[],n=[],o=new Map,s=c=>(o.has(c)||o.set(c,lt(c,e)),o.get(c)),a=new Set(r);for(let c of t.artifacts.values()){if(c.path===c.onboard?.path)continue;let u=s(c.type);if(!u.ok){a.has(c.type)||i.push(...u.problems),a.add(c.type);continue}let l=XE(e,c,u.value,pl(e,c,cs(e,t,c,u.value)));i.push(...l.problems),l.earlier&&n.push(l.earlier)}return{problems:i,earlier:n}}function Xme(e,t){let r=[];for(let i of t.artifacts.values()){let{repins:n,problems:o}=hl(e,i);r.push(...o);for(let{path:s,record:a}of n){let c=i.type===ee.type;c&&a.testCase===void 0?r.push({code:"record-artifact-mismatch",path:s,message:`${s} sits in the test plan ${i.id} but names no test case.`}):!c&&a.testCase!==void 0&&r.push({code:"record-artifact-mismatch",path:s,message:`${s} is about the test case ${a.testCase}, but it sits in the directory of ${i.id}, not of a test plan.`})}}return r}function Qme(e,t){let r=[];for(let i of t.artifacts.values()){let{completions:n,problems:o}=Wn(e,i);r.push(...o);for(let{path:s,record:a}of n)a.unit!==i.id&&r.push({code:"record-artifact-mismatch",path:s,message:`${s} is the completion record of ${a.unit}, but it sits in the directory of ${i.id}.`})}return r}var eO=5,Hr=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,ehe=(e,t)=>{try{return _B(e)===_B(t)}catch{return e===t}};function the(e){if(!e)return"not checked yet in this session";switch(e.status){case"current":return`up to date at the last check (${e.checkedAt})`;case"behind":return`${Hr(e.behind,"commit")} behind ${e.upstream} at the last check (${e.checkedAt}); pull it to see the latest approvals`;case"failed":return`the last check failed (${e.reason}); work continues with the local copy`;case"no-remote":return"it has no remote to compare with"}}function wB(e,t){let{tree:r,resolved:i}=e,{root:n}=r,o=J(n),s=Ke(i.codeRoot),a=L=>`${L.id} ${Jr(r,L.type)}${L.title?` "${L.title}"`:""}`,c=h_(t,n),u=ll(i.codeRoot,n,o),l=L=>`finished on ${u.get(L)}, not merged yet`,d=new Map(c.map(L=>[L.unit,L])),f=L=>ehe(L,i.codeRoot),p=pr(n,o).suspects,m=new Set(p.filter(L=>L.kind==="artifact").map(L=>L.id)),h=$t(n),g=[...o.artifacts.values()].filter(L=>h.chain.some(he=>he.type===L.type)&&oe(n,L).state==="approved"),y=new Map(g.map(L=>[L.id,im(n,o,h,L)])),v=[`BuildKeel status: ${r.config.name?`${r.config.name}, `:""}spec tree ${n} (format ${r.config.format}${r.access.writable?"":", read-only"})`,""],$=s?.activeUnit?o.artifacts.get(s.activeUnit):void 0;v.push(s?.activeUnit?`Active unit here: ${$?a($):s.activeUnit}${s.activeBranch?` on branch ${s.activeBranch}`:""}.`:s?.untrackedSince?`No active unit in this working tree: working without one since ${s.untrackedSince}, as the user chose. Starting a unit ends this.`:"No active unit in this working tree.");let _=$a(n),w=_.approvals??0,k=_.completions??0,T=[...w?[Hr(w,"approval")]:[],...k?[Hr(k,"completion")]:[]],C=w+k===1?"it":"them";v.push(`Spec repo: ${the(s?.freshness)}.${T.length>0?` Not pushed yet: ${T.join(" and ")}; push the spec repo to share ${C}.`:""}`);let D=[];try{D=Ho(n,["status","--porcelain=v1","-z","--untracked-files=all","--",wt,es]).split("\0").filter(Boolean).map(L=>L.slice(3))}catch{}D.length>0&&v.push(`Spec tree settings not committed: ${D.join(", ")}. Commit them, on their own, so everyone works to the same process and templates.`);let K=q_(n);K&&v.push("",B("Warning:",[K]));let V=L=>{let he=[],nt=d.get(L.id);if(nt)he.push(f(nt.workingTree)?"in progress here":`in progress in ${nt.workingTree}`);else if(u.has(L.id))L.type!=="bug"&&L.type!=="adhoc"&&he.push(l(L.id));else if(L.type!=="bug"&&L.type!=="adhoc"){let zt=fe(n,L)?.version,ms=zt!==void 0?kt(n,L,zt):null;ms&&he.push(`done on ${ms.record.finishedAt.slice(0,10)}`)}for(let zt of y.get(L.id)??[])zt.record||he.push(`no ${zt.kind.name}`);return m.has(L.id)&&he.push("suspect"),he.map(zt=>` \xB7 ${zt}`).join("")},te=L=>(L.type==="bug"||L.type==="adhoc")&&u.has(L.id)?l(L.id):null;if(v.push("",...o.artifacts.size===0?["No artifacts yet."]:R_(r,o,V,te)),c.length>0){v.push("",`Claims on this machine (${c.length}):`);for(let L of c)v.push(`- ${L.unit}: ${f(L.workingTree)?"this working tree":L.workingTree}${L.branch?`, branch ${L.branch}`:""}, since ${L.claimedAt}`);v.push("A claim is released when its unit is finished. One whose work has stopped can be released sooner, on request.")}let Oe=[],_t=[];for(let L of g)for(let he of y.get(L.id)??[]){let nt=he.kind.type===ee.type;he.record?!nt&&!he.approved&&_t.push(`- ${he.id} ${he.kind.name} is not approved yet, so no work under ${L.id} can start.`):(nt?Oe:_t).push(`- ${a(L)} has no ${he.kind.name}, so no work under it can start.`)}for(let L of g.filter(he=>he.type==="story")){let he=`${L.id}${ee.idSuffix}`,nt=o.artifacts.get(he);if(!nt)continue;let zt=fe(n,nt),ms=ns(n,o,zt??nt),iO=Pn(n,nt),oO=ms&&iO?Qp(ms,St(n,nt,iO.document)):[];oO.length>0?Oe.push(`- ${he}${zt?` v${zt.version}`:" (draft)"} leaves ${oO.map(QB=>QB.id).join(", ")} uncovered.`):zt||Oe.push(`- ${he} is not approved yet, so no work under ${L.id} can start.`)}if(Oe.length>0&&v.push("","Coverage gaps:",...Oe),_t.length>0&&v.push("","Documents still needed:",..._t),p.length>0){v.push("",`Suspect (${p.length}), each built against an older version of something that has changed:`);for(let L of p){let he=L.kind==="test-case"?`${L.id} test case${L.title?` "${L.title}"`:""} in ${L.holder.id}`:a(L.holder);v.push(`- ${he}: ${Aa(L)}`)}v.push("Review them with {{bk:impact}}: each is still valid, or needs change. Work under a suspect artifact cannot start.")}let le=Et(r),G=le.ok?pB(n,o,le.value):[];if(G.length>0){let L=[...new Set(G.map(he=>he.message.split(" ")[0]))];v.push("",`Approved under earlier rules (${L.length}): ${L.join(", ")}. ${L.length===1?"It stays":"They stay"} approved, and each is checked against the current template and process at its next version; validation lists what each lacks.`)}let dt=[...o.artifacts.values()].filter(L=>oe(n,L).state==="pending");dt.length>0&&(v.push("",`Approved, number pending (${dt.length}):`,...dt.map(L=>`- ${a(L)}`)),v.push("They get their numbers the next time the spec repo's remote can be reached; approving one again tries straight away."));let mr=[...o.artifacts.values()].filter(L=>L.type==="adhoc");if(mr.length>0){let L=mr.filter(nt=>!kt(n,nt,null)&&!u.has(nt.id)),he=le.ok?le.value.adhoc.name:"ad-hoc unit";v.push("",`Ad-hoc work: ${Hr(L.length,`open ${he}`)}, ${mr.length-L.length} done.`),v.push(...L.map(nt=>`- ${nt.id}${nt.title?` "${nt.title}"`:""}${d.has(nt.id)?", in progress":""}`))}let Yr=Ki(r,o,{codeRoot:i.codeRoot,repo:i.pointer.repo},t),Xn=[];for(let L of Yr.repos){L.baseline&&!L.baseline.found&&Xn.push(`- ${L.name}: its baseline ${L.baseline.commit} is not in its history, so every commit counts.`);let he=GR(L);if(he.length===0)continue;let nt=he.slice(0,eO).map(zt=>`${zt.id.slice(0,7)} "${zt.subject}"`);Xn.push(`- ${L.name}: ${Hr(he.length,"commit")}: ${nt.join(", ")}${he.length>eO?`, and ${he.length-eO} more`:""}`)}Yr.missing.length>0&&Xn.push(`- Not on this machine, so not checked: ${Yr.missing.join(", ")}`),v.push("",...Xn.length>0?["Commits with no unit, after each repo's baseline:",...Xn]:["Commits with no unit: none after the baselines."]);let hr=RV(o,Yr,i.codeRoot,i.pointer.repo);if(hr){v.push("",`Existing code (${hr.repo}):`,`- Described: ${hr.described} of ${Hr(hr.total,"file")} (${$E(hr.described,hr.total)}), by the paths artifacts cover and the commits of their work; tests and the spec tree are left out.`);let L=xa(n);if(L.ok&&L.value&&L.value.areas.length>0){let he=$_(o,Yr,i.codeRoot,i.pointer.repo,L.value),nt=b_(he),zt=he.filter(ms=>ms.state==="onboarded").length;v.push(`- Areas: ${zt} of ${Hr(he.length,"area")} onboarded, from the map in ${Tn}${nt?`; next: ${nt.area.name}`:""}.`)}if(hr.tests){let{withTest:he,total:nt}=hr.tests,zt=hr.unmatched===null?"":`; ${Hr(hr.unmatched,"test")} in the latest report ${hr.unmatched===1?"matches":"match"} no test case`;v.push(`- Tests: ${he} of ${Hr(nt,"onboarded test case")} (${$E(he,nt)}) ${he===1?"has":"have"} a test, tagged or matched${zt}.`)}}let ki=vB(n,o);ki.length>0&&v.push("",B("Changed outside BuildKeel:",ki));let Ge=c_(n,o,i.codeRoot);Ge.length>0&&v.push("",B("Broken test matches:",Ge));let Pt=ds(e,t);Pt.ready.length>0?v.push("",`Ready to start (${Pt.ready.length}):`,...Pt.ready):Pt.units.length>0&&v.push("","Nothing is ready to start."),Pt.waiting.length>0&&v.push(`Not ready yet: ${Pt.waiting.length}; {{bk:start}} lists them with the reason.`);let Ea=[...e.notices,...le.ok?[]:le.problems,...o.problems];Ea.length>0&&v.push("",B("Problems with the tree:",Ea));let Oa=Yr.repos.reduce((L,he)=>L+GR(he).length,0),ps=Oe.length+_t.length,XB=[s?.activeUnit?`${s.activeUnit} is in progress here`:"no unit is active here",Pt.ready.length>0?`${Hr(Pt.ready.length,"unit")} ${Pt.ready.length===1?"is":"are"} ready to start`:"nothing is ready to start",...p.length>0?[`${Hr(p.length,"item")} ${p.length===1?"is":"are"} suspect`]:[],...ps>0?[`${ps} ${ps===1?"gap":"gaps"} in coverage or required documents`]:[],...T.length>0?[`${T.join(" and ")} not pushed`]:[],...Oa>0?[`${Hr(Oa,"commit")} with no unit`]:[],...ki.length>0?[`${Hr(ki.length,"record")} changed outside BuildKeel`]:[],...Ge.length>0?[`${Hr(Ge.length,"broken test match","broken test matches")}`]:[]];return v.splice(1,0,`In short: ${XB.join("; ")}.`),v.join(`
|
|
326
|
+
`)}var IB=bt({name:"query",title:"Query the spec tree",description:"Read the BuildKeel spec tree. view=tree lists every artifact as a hierarchy with its state (draft, approved, approved with the number pending, new version in draft), plus any problems with the tree. view=artifact with id returns one artifact's full text and state (with version, one of its approved versions as frozen). view=startable lists the units that can be worked on (tasks, stories without tasks, bugs, ad-hoc units), split into ready to start, not ready yet with the first reason, and done, and marks the active unit. view=drafts lists everything waiting for approval (drafts and new versions in draft), split into ready to approve and not ready yet, with the first reason for each. view=coverage with id shows test coverage: for a story, each acceptance criterion with the test cases that cover it and any gaps; for a task, every test case that applies to it (its own and its story's); for an epic, each story under it; for a business idea, its goals and epics. view=process is the team's process: each stage with how its IDs look and the documents it requires before work under it starts, and the documents that can be attached. view=stats is the user's own usage over the last days days (all of it when days is left out), from the record kept on this machine only: units finished, time from start to done, gate outcomes, coverage gaps caught, suspects and how they were decided. view=describes with paths names, for each file of this code repo, the artifacts that describe it: those whose scope covers it, and the units whose commits changed it; a file nothing describes is code no artifact covers yet. view=untested, for an artifact (id) and everything under it or for the whole tree, lists the test cases no test implements (no test in this repo tagged with them, none matched to them) and the tests in the latest test report recorded here that implement no test case, by tag or by match. view=onboarding is where documenting existing code stands: each area of the map with how much of its code is described (onboarded, drafts waiting, partly done by earlier onboarding or by work that touched it, not started), the next area, and the artifacts still as onboarding left them with required sections empty. view=status is the overview: the tree with each artifact's state and the work on each unit (done, in progress), the active unit, claims on this machine, coverage gaps, suspects (built against an older version of something that has changed since), numbers pending, the spec repo's freshness and unpushed records, ad-hoc work, commits with no unit after each repo's baseline, records changed outside BuildKeel, and what can be started next.",inputSchema:{view:b.enum(["tree","artifact","coverage","drafts","startable","process","stats","status","describes","untested","onboarding"]).default("tree").describe("What to show."),paths:b.array(b.string()).optional().describe("view=describes: files in this code repo, relative to its root, such as src/reset/token.ts."),days:b.number().int().positive().optional().describe("view=stats: the period, in days back from now, such as 30. All of the record when left out."),id:b.string().optional().describe("view=artifact, coverage or untested: the artifact's ID, such as US-001, US-draft-k3x9 or US-001-TP."),version:b.number().int().nonnegative().optional().describe("view=artifact: an approved version to show instead of the current file, such as 2 to compare with the draft of v3, or 0 for version 0.")},readOnly:!0,run(e,t){let r=e.workspace();return r.ok?t.view==="artifact"?PB(r.value,t.id,t.version):t.view==="drafts"?che(r.value):t.view==="startable"?uhe(r.value,e.home):t.view==="status"?wB(r.value,e.home):t.view==="process"?she(r.value):t.view==="stats"?lB(r.value,e.home,t.days):t.view==="describes"?ohe(r.value,e.home,t.paths??[]):t.view==="untested"?ihe(r.value,t.id):t.view==="onboarding"?nhe(r.value,e.home):t.view==="coverage"?t.id?aB(r.value.tree.root,J(r.value.tree.root),t.id):"Give the id of the artifact whose coverage to show.":ahe(r.value):B("BuildKeel cannot read a spec tree here.",r.problems)}});function PB(e,t,r){if(!t)return"Give the id of the artifact to show.";let{root:i}=e.tree,n=Zt(t),o=n.id,s=J(i).artifacts.get(o);if(!s)return`There is no artifact ${o}.`;if(n.v0&&r===void 0)return s.onboard&&!oe(i,s).onboarded?[`${s.id} version 0 (${_e(i).one(s.type)}, draft, describing code as it was before BuildKeel) at ${s.onboard.path}:`,"",fr(s.onboard.document).trimEnd()].join(`
|
|
327
|
+
`):PB(e,o,0);if(r!==void 0){let p=Je(i,s);if(!p.includes(r))return`${s.id} has no approved version ${r}.${p.length>0?` Its approved versions are ${p.map(g=>`v${g}`).join(", ")}.`:""}`;let m=Zi(Pe(s),r),h=r===0?l_(i,s):null;return[`${s.id} v${r} (${_e(i).one(s.type)}, approved, frozen) at ${m}:`,...h?[xB(s.id,h)]:[],"",kB(SB(i,m),"utf8").trimEnd()].join(`
|
|
328
|
+
`)}let a=oe(i,s),c=Wu(a),u=lt(s.type,i),l=u.ok?NV(i,s,u.value):[],d=l_(i,s),f=a.onboardOnly;return[`${s.id} (${_e(i).one(s.type)}, ${c}) at ${s.path}:`,...d?[xB(s.id,d)]:[],...f?["This is the draft of version 0: it describes code as it was before BuildKeel, and is held to no template."]:[],...a.onboardOpen&&!f?[`A draft of version 0 waits at ${s.onboard?.path}: read it with id ${s.id}@v0.`]:[],"",kB(SB(i,s.path),"utf8").trimEnd(),...l.length>0&&!f?["",`Next entry numbers: ${l.join(", ")}. Numbers of removed entries are never reused.`]:[]].join(`
|
|
329
|
+
`)}function xB(e,t){let r=t.sources.length>0?`, from ${t.sources.length===1?"1 source":`${t.sources.length} sources`} kept beside it`:"",i=t.empty.length>0?` It leaves empty: ${t.empty.join(", ")}.`:"";return t.inForce?`${e} v0 describes the code as it was before BuildKeel: reviewed and approved by ${t.by} on ${t.on}${r}.${i}`:`${e} v0, before the version in force, describes the code as it was before BuildKeel: reviewed and approved by ${t.by} on ${t.on}${r}.`}function nhe(e,t){let{tree:r,resolved:i}=e,n=J(r.root),o=i.pointer.repo,s=_e(r.root),a=[],c=xa(r.root);if(!c.ok)return B("The map of areas cannot be read.",c.problems);if(!c.value||c.value.areas.length===0)a.push("There is no map of the code yet. {{bk:onboard}} proposes one: the code's capability areas, each with its paths, to adjust before anything is drafted.");else{let l=$_(n,Ki(r,n,{codeRoot:i.codeRoot,repo:o},t),i.codeRoot,o,c.value),d=l.filter(m=>m.state==="onboarded").length;a.push(`Onboarding: ${d} of ${l.length} area${l.length===1?"":"s"} onboarded, from the map in ${Tn}.`,"","| Area | Paths | Where it stands |","|---|---|---|");let f=m=>{let h=`${m.described} of ${m.files} file${m.files===1?"":"s"} described`;switch(m.state){case"onboarded":return`onboarded: ${h}`;case"drafted":return`drafts waiting for approval: ${m.drafts.join(", ")}; ${h}`;case"partly":return`partly done: ${h}`;case"not started":return m.files===1?"not started: its one file is not described":`not started: none of its ${m.files} files are described`;case"no code":return"no code files at these paths";case"elsewhere":return`in ${m.area.repo}: open that repository to work on it`}};a.push(...l.map(m=>`| ${m.area.name} | ${m.area.paths.join(", ")} | ${f(m)} |`));let p=b_(l);a.push("",p?`Next area: ${p.area.name}.${p.state==="partly"?" Part of it is described already: draft only what is not.":p.state==="drafted"?" Its drafts wait for approval.":""}`:"Every area in this repository is onboarded.")}let u=OV(n);if(u.length>0){a.push("",`Still as onboarding left them, with required sections empty (${u.length}):`);for(let l of u)a.push(`- ${l.record.id} ${s.one(l.record.type)}${l.record.title?` "${l.record.title}"`:""} v${l.version}: ${l.empty.join(", ")}`);a.push("Filling one in drafts its next version, which only completes it: nothing built on it becomes suspect.")}return a.join(`
|
|
330
|
+
`)}function ihe(e,t){let{tree:r,resolved:i}=e,n=J(r.root),o=t?n.artifacts.get(t):void 0;if(t&&!o)return`There is no artifact ${t}.`;let s=o?`under ${o.id}${o.title?` "${o.title}"`:""}`:"in the spec tree",a=v_(r.root,n,i.codeRoot,PV(n,o?.id)),c=[a.total===0?`There are no test cases ${s}.`:`${a.total-a.untested.length} of ${a.total} test case${a.total===1?"":"s"} ${s} ${a.total-a.untested.length===1?"has":"have"} a test, tagged with its ID or matched to it.`];if(a.untested.length>0){c.push("",`No test yet (${a.untested.length}):`);for(let u of a.untested)c.push(`- ${u.id} ${u.title} (${u.plan}${u.covers.length>0?`, covers ${u.covers.join(", ")}`:""})`)}return a.report?a.unmatched&&a.unmatched.length>0?c.push("",`Tests in the latest report (${a.report.report}) that match no test case (${a.unmatched.length}), anywhere in the tree:`,...a.unmatched.map(u=>`- ${u}`)):c.push("",`Every test in the latest report (${a.report.report}) carries a test case's ID or is matched to one.`):c.push("","No test report has been recorded in this working tree yet, so the tests that match no test case are not known. Run the tests with a JUnit XML report and record it with test_results."),c.join(`
|
|
331
|
+
`)}function ohe(e,t,r){if(r.length===0)return"Give the paths of the files, relative to the code repo's root, such as src/reset/token.ts.";let{tree:i,resolved:n}=e,o=J(i.root),s=n.pointer.repo,a=nm(i.root,o,Ki(i,o,{codeRoot:n.codeRoot,repo:s},t),s),c=_e(i.root),u=[],l=[];for(let d of r){let f=(iB(n.codeRoot,rhe(n.codeRoot,d))??_i(d)).replace(/\/$/,""),p=cV(a,f);if(p.scopes.length===0&&p.units.length===0){l.push(f);continue}u.push(`${f} in ${s} is described by:`);for(let m of p.scopes){let h=m.version===0?", describing code as it was before BuildKeel":"";u.push(`- ${m.record.id} ${c.one(m.record.type)}${m.record.title?` "${m.record.title}"`:""} v${m.version}${h}: its scope covers ${m.covering.join(", ")}`)}for(let m of p.units){let h=m.commits.slice(0,3).map(g=>`${g.id.slice(0,7)} ${g.subject}`);u.push(`- ${m.record.id} ${c.one(m.record.type)}${m.record.title?` "${m.record.title}"`:""}: its work changed it${h.length>0?` (${h.join("; ")}${m.commits.length>3?`, and ${m.commits.length-3} more`:""})`:""}`)}}return l.length>0&&u.unshift(`Nothing describes ${l.join(", ")} in ${s} yet: no artifact's scope covers ${l.length===1?"it":"them"}, and no unit's commits changed ${l.length===1?"it":"them"}.`,...u.length>0?[""]:[]),u.join(`
|
|
332
|
+
`)}function she(e){let t=Et(e.tree);return t.ok?[`The process of this spec tree${e.tree.config.name?`, ${e.tree.config.name}`:""}, from the business idea down:`,"",...p_(t.value)].join(`
|
|
333
|
+
`):B("The process definition has problems, so BuildKeel uses its default one until they are fixed.",t.problems)}function ahe(e){let{tree:t}=e,r=J(t.root),i=Et(t),n=[`Spec tree: ${t.root} (format ${t.config.format}${t.access.writable?"":", read-only"})`];r.artifacts.size===0?n.push("","No artifacts yet."):n.push("",...R_(t,r));let o=[...e.notices,...i.ok?[]:i.problems,...r.problems];return o.length>0&&n.push("",B("Problems:",o)),n.join(`
|
|
334
|
+
`)}function che(e){let{tree:t}=e,r=WV(t);if(!r.ok)return B("BuildKeel cannot read the process definition.",r.problems);if(r.value.length===0)return"Nothing is waiting for approval.";let i=J(t.root),n=({record:u,target:l})=>{let d=u.type===ee.type?i.artifacts.get(Ut(u.id))?.type:void 0,f=d?Gi(t.root,d):null,p=f?wa[f]:Jr(t,u.type);return`${l} ${p}${u.title?` "${u.title}"`:""}`},o=u=>u===0?"v0, describing code as it was before BuildKeel":u===1?"v1":`v${u} (v${u-1} is approved)`,s=r.value.filter(u=>u.gate.outcome!=="blocked"),a=r.value.filter(u=>u.gate.outcome==="blocked"),c=[`Waiting for approval: ${r.value.length}.`];if(s.length>0){c.push("",`Ready to approve (${s.length}):`);for(let u of s)c.push(`- ${n(u)}: ${o(u.version)}${u.gate.outcome==="warned"?`, with ${u.gate.warnings.length} warning(s)`:""}`)}if(a.length>0){c.push("",`Not ready yet (${a.length}):`);for(let u of a){let[l,...d]=u.gate.blocking;c.push(`- ${n(u)}: ${l?.message??""}${d.length>0?` (and ${d.length} more)`:""}`)}}return c.join(`
|
|
335
|
+
`)}function uhe(e,t){let{units:r,ready:i,waiting:n,finished:o}=ds(e,t);if(r.length===0){let a=_e(e.tree.root);return`There is nothing to work on yet: no ${a.many("task")}, ${a.many("story")}, ${a.many("bug")} or ${a.many("adhoc")}.`}let s=[];return i.length>0&&s.push(`Ready to start (${i.length}):`,...i),n.length>0&&s.push(...s.length>0?[""]:[],`Not ready yet (${n.length}):`,...n),o.length>0&&s.push(...s.length>0?[""]:[],`Done (${o.length}):`,...o),s.join(`
|
|
336
|
+
`)}async function TB(e){let{tree:t,id:r}=e;if(!t.access.writable)return I(t.access.problem);let i=J(t.root),n=pr(t.root,i).suspects.filter(a=>a.id===r);if(n.length===0)return I({code:"resolve-not-suspect",message:`${r} is not suspect: ${i.artifacts.has(r)?"it is built against the versions in force, or what changed since does not affect it":"there is no artifact or suspect test case with that ID"}.`,remedy:"See what is suspect with the BuildKeel impact tool."});let o=n.find(a=>a.current===null||a.changes.length===0);if(o)return I({code:"resolve-unreadable",message:`${r} cannot be resolved: ${o.target} v${o.pinned} and the version after it could not be compared, so its review would be blind.`,remedy:"Run the BuildKeel validate tool to find the record or frozen copy that cannot be read, and restore it from git history."});let s=n[0].holder;return e.decision==="still-valid"?lhe(e,n):dhe(e,n,s)}async function lhe(e,t){let{tree:r,writer:i,id:n}=e,o=xn(r.root);if(!o)return I({code:"resolve-no-identity",message:"Git has no name and email set for the spec repo, so who decided cannot be recorded.",remedy:'Set them with git config user.name "Your Name" and git config user.email you@example.com, then decide again.'});let s=(e.now?.()??new Date).toISOString().replace(/\.\d{3}Z$/,"Z"),a=[];for(let d of t){let f={target:d.target,...d.kind==="test-case"?{testCase:d.id}:{},from:d.pinned,to:d.current,decidedBy:o,decidedAt:s},p=i.createRecord(e2(d.holder,QV(f)),t2(f));if(!p.ok)return p;a.push(p.value)}let c=t.map(d=>`${d.target} v${d.current}`).join(", "),u=Ct(r.root,a,`repin: ${n} to ${c}`),l=u.ok&&r.config.settings.autoPush?await vi(r.root):null;return N({kind:"still-valid",resolved:t,records:a,commit:u,push:l})}function dhe(e,t,r){let{tree:i,writer:n}=e,o=t.find(c=>c.target===r.parent?.id&&(r.parent.version??0)<c.current),s=null;if(o){s=`${o.target}@v${o.current}`;let c=n.writeFile(r.path,fr(Sn(r.document,{parent:s})));if(!c.ok)return c}let a=J(i.root).artifacts.get(r.id)??r;return N({kind:"needs-change",resolved:t,holder:r,repinned:s,draftOpen:oe(i.root,a).draftOpen})}var AB=bt({name:"resolve_suspect",title:"Decide on a suspect",description:`Record the user's decision on a suspect found by the impact tool, only once the user has made it; never decide for them. "still-valid" keeps it as it is: a permanent re-pin record says it was reviewed against the new version, committed alone in the spec repo, and it is no longer suspect. "needs-change" opens its next version (or, for a test case, its plan's) as a draft written against the new version, to update with save_draft and approve; it stays suspect until then.`,inputSchema:{id:b.string().describe("The suspect: an artifact such as TK-001, or a test case such as US-001-TC2."),decision:b.enum(["still-valid","needs-change"]).describe("The user's decision.")},readOnly:!1,async run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let i=r.value.tree,n=await TB({tree:i,writer:e.writer(r.value),id:t.id,decision:t.decision});if(!n.ok)return B(`Nothing was recorded for ${t.id}.`,n.problems);e.usage(r.value,{event:"resolve",id:t.id,decision:t.decision});let o=pr(i.root,J(i.root)).suspects.length,s=o===0?"Nothing else is suspect.":`${phe(o,"item")} ${o===1?"is":"are"} still suspect; see them with {{bk:impact}}.`;return[...fhe(n.value,i.root),"",s].join(`
|
|
337
|
+
`)}});function fhe(e,t){let r=e.resolved[0].id,i=e.resolved.map(a=>`${a.target} v${a.current}`).join(" and ");if(e.kind==="still-valid"){let a=[`Recorded that ${r} is still valid against ${i}, so it is no longer suspect. The decision is kept in:`,...e.records.map(c=>`- ${c}`)];return e.commit.ok?(a.push(`Committed as "repin: ${r} to ${e.resolved.map(c=>`${c.target} v${c.current}`).join(", ")}" (${e.commit.value.slice(0,7)}) in the spec repo, with only ${e.records.length===1?"that file":"those files"}.`),e.push?a.push(e.push.ok?"Pushed.":`Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):Gu(t).length===0?a.push("Not pushed: the spec repo has no remote. Add one and push it to share the decision."):a.push("Not pushed. Push the spec repo to share the decision.")):a.push(`The record is written but was not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),a}let n=e.holder,o=`save it with save_draft and approve it with {{bk:approve}} ${n.id}`;if(n.type==="bug")return[`${r} now names ${e.repinned??"the new version"} as where it was found. Update its description to match with save_draft if the change affects it.`];if(n.id===r)return[e.repinned?`${r} needs change: its next version is open as a draft, with parent ${e.repinned}. Update it to match ${i}, then ${o}. It stays suspect until that version is approved.`:`${r} needs change: update it to match ${i}, then ${o}. It stays suspect until its new version is approved.`];let s=e.repinned?`the next version of ${n.id} is open as a draft, written against ${e.repinned}`:e.draftOpen?`the next version of ${n.id} is open as a draft`:`changing it in ${n.id} opens the plan's next version`;return[`${r} needs change: ${s}. Change ${r} to match ${i}, adding test cases for any new criteria, then ${o}. ${r} stays suspect until that version is approved.`]}var phe=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function RB(e,t){let r=[],i=new Map;for(let g of t){let y=Zt(g),v=e.artifacts.get(y.id);if(!v){r.push({code:"approve-not-found",message:`There is no artifact ${y.id}.`});continue}let $=oe(e.root,v),_=y.v0||$.onboardOnly,w=_?`${y.id}${Wr}`:y.id;i.has(w)||(v.type==="adhoc"||v.type==="bug"&&!_?r.push({code:"approve-not-approvable",message:`${y.id} is a bug or an ad-hoc unit, which is not approved.`}):_&&$.onboarded?r.push({code:"approve-v0-exists",message:`${y.id} already has an approved version 0.`}):_&&!$.onboardOpen?r.push({code:"approve-no-v0-draft",message:`${y.id} has no draft of version 0 waiting.`}):!_&&$.state==="approved"&&!$.draftOpen?r.push({code:"approve-nothing-new",message:`${y.id} v${$.approvedVersion} is approved and no new version is open.`}):i.set(w,{record:_?ka(v)??v:v,artifact:y.id,v0:_}))}if(r.length>0)return I(...r);let n=g=>g===void 0?[]:[`${g}${Wr}`,g].filter(y=>i.has(y)),o=new Map;for(let[g,y]of i){let v=ts.flatMap(w=>rs(y.record.document.frontmatter,w).ids),$=[y.record.owner,y.record.parent?.id,...v].filter(w=>w!==y.artifact).flatMap(n),_=y.v0?[]:n(y.artifact).filter(w=>w!==g);o.set(g,[...new Set([..._,...$])])}let s=new Map;for(let g of i.values())s.has(g.artifact)||s.set(g.artifact,g.record);let a=new Map,c=g=>t.findIndex(y=>Zt(y).id===g.id),u=g=>g.owner??g.parent?.id,l=g=>[...s.values()].filter(y=>u(y)===g||g===void 0&&!s.has(u(y)??"")).sort((y,v)=>+(v.owner!==void 0)-+(y.owner!==void 0)||c(y)-c(v)),d=new Set,f=g=>{if(!d.has(g.id)){d.add(g.id);for(let y of n(g.id))a.set(y,a.size);for(let y of l(g.id))f(y)}};for(let g of l(void 0))f(g);for(let g of s.values())f(g);let p=[],m=new Set,h=[...i.keys()].sort((g,y)=>(a.get(g)??0)-(a.get(y)??0));for(;h.length>0;){let g=h.findIndex(v=>(o.get(v)??[]).every($=>m.has($)));if(g<0)return I({code:"approve-set-cycle",message:`${h.join(", ")} each need another of them approved first, through their parents or links, so none can go first.`});let[y]=h.splice(g,1);m.add(y),p.push({id:y,record:i.get(y).record,needs:o.get(y)??[]})}return N(p)}async function EB(e,t){let r=J(e.tree.root),i=RB(r,t);if(!i.ok)return i;let n=[],o=new Map,s=new Map;for(let a of i.value){let c=await lm(e,{id:a.id,apply:!1,first:new Set(a.needs.map(p=>Zt(p).id))});if(!c.ok)return c;let u=c.value;if(u.kind!=="preview"&&u.kind!=="refused")return I({code:"approve-set-pending",message:`${a.id} is already approved, with its number pending.`});let l=u.gate,d=a.needs.find(p=>o.has(p));d?o.set(a.id,o.get(d)):l.outcome==="blocked"&&o.set(a.id,a.id);let f=Zt(a.id);if(u.kind==="preview"&&!f.v0&&i.value.some(p=>p.id===`${f.id}${Wr}`)&&(delete u.likelyId,delete u.dirTo,u.references=[]),u.kind==="preview"&&u.likelyId){let p=/^(.*?)(\d+)$/.exec(u.likelyId);if(p){let[,m,h]=p,g=Math.max(Number(h),(s.get(m)??0)+1);s.set(m,g),u.likelyId=`${m}${String(g).padStart(h.length,"0")}`}}n.push({member:a,preview:u,gate:l,...d?{waitsFor:o.get(d)}:{}})}return N(n)}async function OB(e,t){let r=RB(J(e.tree.root),t);if(!r.ok)return r;let i=new Map,n=c=>{let{id:u,v0:l}=Zt(c);for(let[d,f]of i){if(u===d)return`${f}${l?Wr:""}`;if(u.startsWith(`${d}-`))return`${f}${u.slice(d.length)}${l?Wr:""}`}return c},o=new Map,s=new Map,a=[];for(let c of r.value){let u=c.needs.find(h=>{let g=o.get(h);return g!==void 0&&g.kind!=="approved"});if(u){let h={kind:"waiting",on:n(u)};o.set(c.id,h),a.push({member:c,finalId:n(c.id),outcome:h});continue}let l=n(c.id),d=mhe(e,l,s);if(!d.ok){let h={kind:"failed",problems:d.problems};o.set(c.id,h),a.push({member:c,finalId:l,outcome:h});continue}let f=await lm(e,{id:l,apply:!0}),p,m=l;if(!f.ok)p={kind:"failed",problems:f.problems};else if(f.value.kind==="approved"){p={kind:"approved",result:f.value};let h=Zt(l);m=`${f.value.id}${h.v0?Wr:""}`,f.value.id!==h.id&&i.set(h.id,f.value.id),s.set(f.value.id,Math.max(f.value.version,s.get(f.value.id)??0))}else f.value.kind==="pending"?p={kind:"pending",result:f.value}:f.value.kind==="refused"?p={kind:"refused",gate:f.value.gate}:p={kind:"failed",problems:[{code:"approve-set-pending",message:`${l} is already approved, with its number pending.`}]};o.set(c.id,p),a.push({member:c,finalId:m,outcome:p})}return N(a)}function mhe(e,t,r){let i=Zt(t);if(i.v0)return N(void 0);let n=J(e.tree.root).artifacts.get(i.id),o=n?.parent,s=o?r.get(o.id):void 0;if(!n||!o||s===void 0||o.version===void 0||o.version>=s)return N(void 0);let a=e.writer.writeFile(n.path,fr(Sn(n.document,{parent:`${o.id}@v${s}`})));return a.ok?N(void 0):a}var CB=bt({name:"approve",title:"Approve an artifact",description:"Approve one version of one artifact (id, such as US-draft-k3x9, US-001 or US-001-TP), or a set of them in one review (ids, such as everything a capture drafted). For version 0, the description of code as it was before BuildKeel, add @v0 (US-005@v0); an artifact whose only draft is its version 0 can be named without it. Approval is the user's decision: call it first without apply to run the approve gate and get what approval will do, show that to the user, and call again with the same id or ids and apply=true only after the user confirms. On apply it freezes the version, records the approval, gives a draft its permanent number, rewrites references to the draft ID, and commits exactly those files in the spec repo. A set is approved in order, parents and their documents before children, each through its own gate with its own record and commit; when one is refused, what needs it stays a draft.",inputSchema:{id:b.string().optional().describe("The artifact to approve: a draft ID, a permanent ID, or a document's ID such as US-001-TP or EP-01-DD; with @v0 for its version 0."),ids:b.array(b.string()).optional().describe("A set to approve in one review, in any order: such as the drafts a capture made."),apply:b.boolean().default(!1).describe("false: only check and describe. true: approve."),onboard:b.boolean().optional().describe("true when approving an area's drafts in the onboard command, documenting existing code area by area.")},readOnly:!1,async run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let{resolved:i}=r.value,n={tree:r.value.tree,writer:e.writer(r.value),code:{codeRoot:i.codeRoot,repo:i.pointer.repo,home:e.home,host:e.host}},o=va(r.value.tree.root),s=o?.startsWith("bk/")?o:null,a=t.ids??(t.id?[t.id]:[]);if(a.length===0)return"Give the id of the artifact to approve, or ids for a set.";if(t.ids&&t.ids.length>1){if(!t.apply){let p=await EB(n,a);if(!p.ok)return B("The set cannot be approved.",p.problems);for(let m of p.value)m.waitsFor||e.gateUsage(r.value,m.gate,m.member.id,!1);return[ghe(p.value,m=>Jr(r.value.tree,m),s),...ls(Ke(r.value.resolved.codeRoot),{suspects:!1,unpushed:!1})].join(`
|
|
338
|
+
`)}let f=await OB(n,a);if(!f.ok)return B("The set cannot be approved.",f.problems);for(let p of f.value)NB(e,r.value,p.member.record.type,p.member.id,p.outcome.kind==="waiting"||p.outcome.kind==="failed"?null:p.outcome.kind==="refused"?{kind:"refused",gate:p.outcome.gate}:p.outcome.result,t.onboard);return e.flushWrites(),[yhe(f.value,r.value,e,s),...ls(Ke(r.value.resolved.codeRoot),{unpushed:!1})].join(`
|
|
339
|
+
`)}let c=a[0],u=J(r.value.tree.root).artifacts.get(Zt(c).id)?.type??"",l=await lm(n,{id:c,apply:t.apply});if(!l.ok)return B(`${c} cannot be approved.`,l.problems);NB(e,r.value,u,c,l.value,t.onboard),t.apply&&e.flushWrites();let d=ls(Ke(r.value.resolved.codeRoot),t.apply?{unpushed:!1}:{suspects:!1,unpushed:!1});return[vhe(l.value,s),...d].join(`
|
|
340
|
+
`)}});function NB(e,t,r,i,n,o){n&&(n.kind==="refused"||n.kind==="preview"?e.gateUsage(t,n.gate,i,!1):n.kind==="approved"?(e.gateUsage(t,n.gate,n.id,!0),e.usage(t,{event:"approve",artifact:n.id,type:r,version:n.version}),n.version===0&&e.usage(t,{event:"onboard",artifact:n.id,type:r,way:o?"area":"work"})):n.kind==="pending"&&(e.gateUsage(t,n.gate,n.draftId,!0),e.usage(t,{event:"approve",artifact:n.draftId,type:r,version:n.version})))}var hhe=(e,t,r)=>`${e} ${t}${r?` "${r}"`:""}`,wm=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function ghe(e,t,r){let i=e.filter(a=>a.gate.outcome!=="blocked"&&!a.waitsFor),n=e.filter(a=>a.gate.outcome==="blocked"&&!a.waitsFor),o=[];o.push(i.length===e.length?`Ready to approve all ${e.length} in one review, parents and their documents first, each with its own approval record and commit.`:`Ready to approve ${i.length} of ${e.length} in one review, each with its own approval record and commit. ${wm(n.map(a=>a.member.id))} would not pass, so ${n.length===1?"it stays a draft":"they stay drafts"}, with what needs ${n.length===1?"it":"them"}.`);let s=new Map(e.flatMap(a=>a.preview.kind==="preview"&&a.preview.likelyId?[[Zt(a.member.id).id,a.preview.likelyId]]:[]));o.push("","In order:");for(let[a,c]of e.entries()){let{member:u,preview:l}=c,d=`${a+1}. ${hhe(u.id,t(u.record.type),u.record.title)}`;if(c.waitsFor){o.push(`${d}: stays a draft, because ${c.waitsFor} would not pass.`);continue}if(c.gate.outcome==="blocked"){o.push(`${d}: would not pass.`);for(let g of c.gate.blocking)o.push(` - ${g.message}`,...g.remedy?[` To fix: ${g.remedy}`]:[]);continue}if(l.kind!=="preview")continue;let f=u.record.owner,p=Zt(u.id).id,m=l.likelyId??(p!==u.id||!s.has(p)?void 0:s.get(p))??(f&&s.has(f)?`${s.get(f)}${p.slice(f.length)}`:void 0),h=l.version===0?"as v0, describing the code as it was before BuildKeel":`as v${l.version}`;o.push(`${d} ${h}${m?`: becomes ${m}${l.likelyId?" unless someone else approves one first":""}`:""}`),l.version0&&l.version0.empty.length>0&&o.push(` - Left empty: ${l.version0.empty.join(", ")}`);for(let g of c.gate.warnings)o.push(` - Warning: ${g.message}`)}return r&&o.push("",`These approvals are committed on ${r}, a unit's branch: units started from another branch, such as your main branch, will not see them until ${r} is merged into it.`),o.push("","Nothing has been written yet. Show this to the user, and call approve again with the same ids and apply=true only if they confirm."),o.join(`
|
|
341
|
+
`)}function yhe(e,t,r,i){let n=e.filter(p=>p.outcome.kind==="approved"),o=e.filter(p=>p.outcome.kind==="refused"||p.outcome.kind==="failed"),s=e.filter(p=>p.outcome.kind==="pending"),a=e.filter(p=>p.outcome.kind==="waiting"),c=[],u=[n.length===e.length?`Approved all ${e.length} in one review: ${wm(n.map(p=>p.finalId))}.`:`Approved ${n.length} of ${e.length}${n.length>0?`: ${wm(n.map(p=>p.finalId))}`:""}.`];for(let p of o){let m=p.outcome.kind==="refused"?p.outcome.gate.blocking[0]?.message:p.outcome.kind==="failed"?p.outcome.problems[0]?.message:"",h=a.filter(g=>g.outcome.kind==="waiting"&&g.outcome.on===p.finalId).map(g=>g.finalId);u.push(`${p.finalId} stays a draft: ${(m??"it was refused").replace(/\.$/,"")}${h.length>0?`; ${wm(h)} ${h.length===1?"waits":"wait"} for it`:""}.`)}s.length>0&&u.push(`${wm(s.map(p=>p.finalId))} ${s.length===1?"is":"are"} approved with the number pending, so what is under ${s.length===1?"it waits":"them waits"}.`),c.push(u.join(" "));let l=J(t.tree.root),d=new Set(n.flatMap(p=>{let m=l.artifacts.get(p.finalId);return m?[m.id,...pm(l,m).map(h=>h.id)]:[]})),f=ds(t,r.home).ready.filter(p=>d.has(/^- (\S+) /.exec(p)?.[1]??""));c.push(f.length>0?"Ready to start now:":"Nothing in it can start yet; {{bk:start}} lists what is waiting and why.",...f),c.push("","Each approval, in order:");for(let p of e){let m=p.outcome;if(m.kind==="approved"){let h=m.result,g=h.commit.ok?`committed as "approve: ${h.id} v${h.version}" (${km(h.commit.value)})`:`written but not committed: ${h.commit.problems[0]?.message??""}`;c.push(`- ${h.id} v${h.version}${Zt(p.member.id).id!==h.id?` (was ${Zt(p.member.id).id})`:""}: ${g}.${h.onboardedWork?` ${vE(h.onboardedWork)}`:""}`)}else if(m.kind==="pending")c.push(`- ${m.result.draftId} v${m.result.version}: approved, number pending: ${m.result.reason.map(h=>h.message).join(" ")}`);else if(m.kind==="refused"){c.push(`- ${p.finalId}: refused by the approve gate.`);for(let h of m.gate.blocking)c.push(` - ${h.message}`,...h.remedy?[` To fix: ${h.remedy}`]:[])}else m.kind==="failed"?c.push(`- ${p.finalId}: not approved: ${m.problems.map(h=>h.message).join(" ")}`):c.push(`- ${p.finalId}: not approved, because ${m.on} was not.`)}if(n.length>0){let p=Hb(t.tree.root);t.tree.config.settings.autoPush?c.push("","Pushed after each approval, as the spec tree is set to."):p===null?c.push("","Not pushed: the spec repo has no remote. Add one and push it when you are ready to share the approvals."):p>0&&c.push("",`Not pushed: the spec repo has ${p} approval${p===1?"":"s"} not yet pushed. Push it when you are ready to share ${p===1?"it":"them"}.`)}return i&&n.length>0&&c.push(`These approvals are committed on ${i}, a unit's branch: units started from another branch, such as your main branch, will not see them until ${i} is merged into it.`),c.join(`
|
|
342
|
+
`)}var km=e=>e.slice(0,7);function tO(e){let t=[];for(let i of e.assigned)t.push(i.commit.ok?`${i.from}, approved earlier with its number pending, is now ${i.to}; committed as "approve: ${i.to} v${i.version}" (${km(i.commit.value)}).`:`${i.from}, approved earlier with its number pending, is now ${i.to}, but the commit failed: ${i.commit.problems[0]?.message??""}`);let r=e.problems.filter(i=>!i.code.startsWith("counter-"));return r.length>0&&t.push(B("Some pending approvals could not be numbered:",r)),t}function vhe(e,t=null){let r=[],i=t?`This approval is committed on ${t}, a unit's branch: units started from another branch, such as your main branch, will not see it until ${t} is merged into it.`:null,n=o=>o.outcome==="warned"?["",on(o,"approval")]:[];switch(e.kind){case"refused":return[on(e.gate,`approval of ${e.id}`),"","Nothing was written."].join(`
|
|
343
|
+
`);case"preview":{let o=`${e.name} ${e.id}${e.title?` "${e.title}"`:""}`,s=e.version0;return r.push(s?`Ready to approve version 0 of ${o}: it describes the code as it was before BuildKeel, so it is held to no template; a person reads it before it is approved. Approving will:`:`Ready to approve ${o} as v${e.version}. Approving will:`),e.likelyId&&(r.push(`- give it its permanent number: the next ${s?`onboarded ${e.name}`:e.name} number, ${e.likelyId} unless someone else approves one first; its directory becomes ${e.dirTo}/`),e.references.length>0&&r.push(`- rewrite references to ${e.id} in: ${e.references.join(", ")}`)),e.parent&&r.push(`- record it against its parent ${e.parent}`),s?(r.push(`- freeze v0 and record the approval by ${e.approver}, ${s.sources.length===0?"with no sources kept beside it":`with its ${s.sources.length===1?"source":`${s.sources.length} sources`} frozen with it: ${s.sources.join(", ")}`}`),s.empty.length>0&&r.push(`- record what it leaves empty, for a later version to fill in: ${s.empty.join(", ")}`),e.inForce>0&&r.push(`- leave v${e.inForce} in force: version 0 goes before it in the history, and nothing becomes suspect`)):r.push(`- freeze v${e.version} and record the approval by ${e.approver}`),r.push(`- commit only those files in the spec repo as "approve: ${e.likelyId??e.id} v${e.version}"${e.autoPush?", then push it":", without pushing"}`),t&&r.push("",`${i} To have it on your main branch straight away, switch to it before approving.`),r.push(...n(e.gate)),r.push("","Nothing has been written yet. Show this to the user, and call approve again with apply=true only if they confirm."),r.join(`
|
|
344
|
+
`)}case"approved":{r.push(...tO(e.pending)),r.length>0&&r.push("");let o=e.draftId?` (was ${e.draftId})`:"",s=e.version0;if(!s)r.push(`Approved ${e.id} v${e.version}${o}. It is locked now: a change opens v${e.version+1}, and v${e.version} stays in force until then.`);else{let a=e.inForce===0?e.nextOpen?"It is in force and locked; the draft of v1 that builds on it is waiting for approval.":"It is in force and locked now: a change opens v1.":`v${e.inForce} stays in force; version 0 comes before it in the history, and nothing became suspect.`;r.push(`Approved ${e.id} v0${o}: it describes the code as it was before BuildKeel. ${a}`)}if(r.push(`- Frozen copy: ${e.frozen}`),r.push(`- Approval record: ${e.approval}`),s&&s.sources.length>0&&r.push(`- Sources frozen with it: ${s.sources.join(", ")}`),s&&s.empty.length>0&&r.push(`- Left empty, for a later version to fill in: ${s.empty.join(", ")}`),e.onboardedWork){let a=e.onboardedWork;r.push(`- Done before BuildKeel: ${vE(a)}`),r.push(a.commit.ok?`- Completion record: ${a.records.map(c=>c.path).join(", ")}, committed as "done: ${e.id} v0 (onboarded)" (${km(a.commit.value)}).`:`- Completion record: ${a.records.map(c=>c.path).join(", ")}, written but not committed: ${a.commit.problems[0]?.message??""}`)}e.references.length>0&&r.push(`- References to ${e.draftId} rewritten in: ${e.references.join(", ")}`),e.commit.ok?(r.push(`Committed as "approve: ${e.id} v${e.version}" (${km(e.commit.value)}) in the spec repo, with only these files.`),e.push?r.push(e.push.ok?"Pushed.":`Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):e.unpushed===null?r.push("Not pushed: the spec repo has no remote. Add one and push it when you are ready to share the approval."):e.unpushed>0&&r.push(`Not pushed: the spec repo has ${e.unpushed} approval${e.unpushed===1?"":"s"} not yet pushed. Push it when you are ready to share ${e.unpushed===1?"it":"them"}.`)):r.push(`The files are written but were not committed: ${e.commit.problems[0]?.message??""} Commit them in the spec repo yourself.`),i&&r.push(i),r.push(...n(e.gate));for(let a of e.documents)r.push("",`${e.id}'s ${a.name} ${a.id} has a draft waiting for approval; it can be approved next.`);return r.join(`
|
|
345
|
+
`)}case"pending":{r.push(...tO(e.pending)),r.length>0&&r.push(""),r.push(`Approved ${e.draftId} v${e.version}, but its number is pending: ${e.reason.map(s=>s.message).join(" ")}`),r.push(`- Approval recorded in ${e.record}`),r.push(e.commit.ok?`- Committed as "approve: ${e.draftId} v${e.version} (number pending)" (${km(e.commit.value)}).`:`- Not committed: ${e.commit.problems[0]?.message??""}`),i&&r.push(i),r.push("It gets its number the next time the counter can be reached: the next approval, or the next session. Until then it cannot be changed, and work cannot start on it.");let o=e.reason.map(s=>s.remedy).filter(Boolean);return o.length>0&&r.push(`To fix: ${o.join(" ")}`),r.push(...n(e.gate)),r.join(`
|
|
346
|
+
`)}case"assigned":{let o=tO(e.pending);return e.pending.assigned.length===0?[`The number is still pending: ${e.pending.problems.map(a=>a.message).join(" ")||"the number counter could not be reached."}`,...o].join(`
|
|
347
|
+
`):o.join(`
|
|
348
|
+
`)}}}import{randomBytes as $he}from"node:crypto";function bhe(e,t){for(;;){let r=BigInt(`0x${$he(5).toString("hex")}`).toString(36).slice(-4).padStart(4,"0"),i=`${t}-${r}`;if(/[a-z]/.test(r)&&!e.artifacts.has(i))return i}}async function zB(e,t){let{tree:r}=e;if(!r.access.writable)return I(r.access.problem);let i=Et(r);if(!i.ok)return i;if(!Gb(r.root))return I({code:"unit-not-git",message:`The spec tree at ${r.root} is not in a git repository, and a new ${i.value[t.type].name} is committed there.`,remedy:"Run git init in the spec tree (or the repository holding it), then try again."});let n=i.value[t.type],o=pa.find(T=>T.type===t.type);if(!o)return I({code:"unit-unknown-type",message:`There is no artifact type "${t.type}".`});let s=J(r.root),a=dr(t.content.replaceAll(wi,"PLACEHOLDER"));if(!a.ok)return a;let c=a.value.frontmatter,u={};if(t.type==="bug"){let T=sl(r.root,s,c);if(!T.ok)return T;u=T.value}else if(c.parent!==void 0&&c.parent!==null){let T=/^[aeiou]/i.test(n.name)?"An":"A";return I({code:"unit-unexpected-parent",message:`${T} ${n.name} has no parent, but the file names ${String(c.parent)}.`,remedy:"Remove the parent line."})}let l=bhe(s,n.prefix),d=await cm(k_(r.root,r.config.settings.idsBranch),{type:t.type,draftId:l,floor:PE(s,t.type),format:T=>ya(n,T)});if(!d.ok&&!d.problems.some(T=>T.code.startsWith("counter-")))return d;let f=d.ok?d.value:l,p=`${o.dir}/${f}/${o.file}`,m=dr(t.content.replaceAll(wi,f),p);if(!m.ok)return m;let h={id:f};u.parent&&(h.parent=It(u.parent));let g=e.writer.writeFile(p,fr(Sn(m.value,h)));if(!g.ok)return g;let y=J(r.root),v=y.artifacts.get(f),$=lt(t.type,r.root),_=$.ok?v?cs(r.root,y,v,$.value):[]:$.problems,w=Ct(r.root,[p],`new: ${f}`),k=w.ok&&r.config.settings.autoPush?await vi(r.root):null;return N({id:f,type:t.type,name:n.name,...v?.title?{title:v.title}:{},path:p,numbered:d.ok,offline:d.ok?[]:d.problems,attachment:u,notes:_,commit:w,push:k})}var jB=bt({name:"save_draft",title:"Save a draft",description:`Create a new draft artifact, or update an existing draft (pass its id). content is the whole artifact file: frontmatter and sections, following the type's template, with guidance comments removed. Write ${wi} wherever the artifact's own ID goes (id: ${wi}). Write each new numbered entry with ${Jn} as its number (**${wi}-AC${Jn}**, ### ${wi}-TC${Jn}); BuildKeel numbers them and never reuses a removed entry's number. Keep the IDs of entries that already have one. For a test plan, set parent to the artifact it tests, and give every test case a covers line: a story's plan covers its criteria (all of them), a task's plan covers the task's own ID or its story's criteria, an epic's plan covers stories under it or their criteria, a business idea's plan covers epics under it or its goals. Set parent to the parent's ID; BuildKeel pins it to the parent's approved version. A design document, or another document attached to an artifact, has parent set to that artifact and no id field (EP-01-DD is the design document of EP-01). When the content comes from a document, an issue tracker or the conversation, keep its meaning, put what fits no section in the section for further material (such as Notes), and leave out a required section the source does not cover rather than invent it: BuildKeel names what is missing, for you to ask the user. To change an approved artifact, pass its id with the whole changed file: that opens its next version as a draft, and the approved version stays in force. Saving never approves anything. type bug or adhoc creates a bug or an ad-hoc unit at once, with its permanent ID and its own commit in the spec repo: neither is drafted or approved, and it can be started straight away. A bug found in work on a task or story has that unit as parent and, when a test case found it, testCase set to that test case's ID; a bug with no known home has no parent. Pass the id of an existing bug or ad-hoc unit to change its file.`,inputSchema:{type:b.string().describe("The artifact type: idea, epic, story, task, test-plan, design, bug or adhoc, or a stage or document the team added; its name works too, such as design document."),id:b.string().optional().describe("To update an existing draft, bug or ad-hoc unit, its ID. Leave out to create a new one."),content:b.string().describe("The whole artifact file."),capture:b.boolean().optional().describe("true when the draft is part of a plan captured from the conversation (the capture command)."),sources:b.array(b.object({source:b.string().describe("Where it came from: Jira, Azure DevOps, Confluence, a file's name, or the user."),key:b.string().optional().describe("Its key there, such as PAY-12."),link:b.string().optional().describe("A link to it."),title:b.string().optional(),text:b.string().optional().describe("The text exactly as read, not summarized: for a tracker entry, its description, fields and comments. Attachments, images and history stay behind the link."),drop:b.boolean().optional().describe("true to remove a source kept earlier, named by the same source and key (or title).")})).optional().describe("With version 0 only: each source it is drafted from, kept beside it exactly as read, with when and by whom. A source saved again with the same source and key replaces the earlier copy. BuildKeel lists them in the draft's Sources section; they are frozen with version 0 when it is approved. Code is never copied: the baseline commit names it."),version:b.literal(0).optional().describe("0 to draft version 0: what describes code as it was before BuildKeel, from the code and the sources the user brings. It follows the template's form but is held to no template; leave a section the sources do not support empty. With id, it adds version 0 to an existing artifact, beside any draft of its next version.")},readOnly:!1,async run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let{tree:i}=r.value,n=hm(i,t.type);if(!t.id&&t.version!==0&&(n==="bug"||n==="adhoc")){let $=await zB({tree:i,writer:e.writer(r.value)},{type:n,content:t.content});return $.ok?(e.usage(r.value,{event:n==="bug"?"bug":"adhoc",unit:$.value.id}),She($.value)):B(`The ${n==="bug"?"bug":"ad-hoc unit"} was not created.`,$.problems)}let o=I2(i,e.writer(r.value),{type:t.type,content:t.content,...t.id?{id:t.id}:{},...t.version===0?{version:0}:{},...t.sources?{sources:t.sources.map(whe)}:{}});if(!o.ok)return B("The draft was not saved.",o.problems);let{id:s,path:a,created:c,notes:u,nextVersion:l,opened:d}=o.value;if(c&&e.usage(r.value,{event:"draft",artifact:s,type:o.value.type,...t.capture?{capture:!0}:{}}),o.value.empty)return khe(o.value,_e(r.value.tree.root).one(o.value.type));let f=o.value.type==="bug"||o.value.type==="adhoc",p=u.find($=>$.code==="draft-parent-draft"),m=u.filter($=>$.code==="draft-completes-dropped"),h=u.filter($=>$!==p&&!m.includes($)),g=p?`, once its parent ${/^The parent (\S+)/.exec(p.message)?.[1]??""} is approved`:"",y=h.length===0?f?" It follows its template.":` It follows its template and has everything it needs for approval${g}.`:"",v=l===void 0?[f?`Updated ${s} at ${a}.${y}`:`${c?"Created":"Updated"} draft ${s} (${_e(r.value.tree.root).one(o.value.type)}) at ${a}.${y}`]:d?[`Saved ${s} v${l} as a draft at ${a}. v${l-1} stays approved and in force until v${l} is approved.${y}`]:[`Saved ${s} at ${a}, but it matches the approved v${l-1}, so no new version is open.`];if(h.length>0&&(v[0]=`${v[0]} It is saved; ${h.length===1?"one thing stands":`${h.length} things stand`} in the way of approval, listed below.`),o.value.assigned.length>0&&v.push(`New entries numbered: ${o.value.assigned.join(", ")}.`),v.push(...m.map($=>$.message)),h.length>0){v.push("",B(f?"Still missing:":"Before it can be approved:",u.filter(_=>!m.includes(_))));let $=u.filter(_=>["section-missing","section-empty","field-missing"].includes(_.code));$.length>0&&v.push("",`Ask the user for ${$.length===1?"what is missing":"each missing part, one at a time"}, unless it is in what they gave you; never invent it.`)}return v.join(`
|
|
349
|
+
`)}}),_he=e=>e.slice(0,7);function whe({source:e,key:t,link:r,title:i,text:n,drop:o}){return{source:e,...t?{key:t}:{},...r?{link:r}:{},...i?{title:i}:{},...n!==void 0?{text:n}:{},...o?{drop:o}:{}}}function khe(e,t){let{id:r,path:i,created:n,notes:o,empty:s=[],sources:a}=e,c=[`${n?"Created":"Updated"} the draft of version 0 of ${r} (${t}) at ${i}: it describes the code as it was before BuildKeel, and is held to no template.`+(s.length===0?" Every section the template asks for has content.":` Left empty: ${s.join(", ")}. That does not stop its approval; a later version can fill ${s.length===1?"it":"them"} in.`)];if(a&&a.kept.length>0){let d=[...a.written.map(f=>`kept ${f}`),...a.dropped.map(f=>`dropped ${f}`)];c.push(`Sources kept beside it, as read: ${a.kept.map(f=>f.file).join(", ")}${d.length>0?` (${d.join("; ")})`:""}. They are listed in its Sources section, and frozen with it when it is approved.`)}else a&&a.dropped.length>0&&c.push(`Dropped ${a.dropped.join(", ")}; no sources are kept beside it now.`);let u=o.find(d=>d.code==="draft-parent-draft");u&&c.push(u.message);let l=o.filter(d=>d!==u);return l.length>0&&c.push("",B("Worth knowing:",l)),c.push("",`It is approved as ${r}@v0, after a person has read it.`),c.join(`
|
|
350
|
+
`)}function She(e){let t=e.attachment.parent?`, attached to ${It(e.attachment.parent)}${e.attachment.testCase?`, where ${e.attachment.testCase} found it`:""}`:e.type==="bug"?", standalone":"",r=[`Created ${e.name} ${e.id}${e.title?` "${e.title}"`:""} at ${e.path}${t}.`];return e.numbered||r.push(`- The number counter could not be reached (${e.offline[0]?.message??"no reason given"}), so ${e.id} has an ID that needs no counter. It is permanent: commits are stamped with it.`),e.commit.ok?(r.push(`- Committed alone as "new: ${e.id}" (${_he(e.commit.value)}) in the spec repo.`),e.push?r.push(e.push.ok?"- Pushed.":`- Not pushed: ${e.push.problems[0]?.message??""} Push the spec repo when you can.`):r.push("- Not pushed: push the spec repo to share it.")):r.push(`- Written but not committed: ${e.commit.problems[0]?.message??""} Commit it in the spec repo yourself.`),e.type==="bug"&&r.push(`- Finishing it needs a regression test with [${e.id}] in its name, passing.`),e.notes.length>0&&r.push("",B("Still missing (fix it with save_draft and its id):",e.notes)),r.push("",`Start it with {{bk:start}} ${e.id}.`),r.join(`
|
|
351
|
+
`)}var DB=bt({name:"start_work",title:"Start work on a unit",description:"Start work on a task, a story built without tasks, a bug or an ad-hoc unit, in this working tree. Runs the start gate (the unit and its ancestors approved, permanently numbered, the documents the process requires approved, a test plan with no gaps, not being worked on in another working tree), then switches to the unit's branch bk/<ID>-<slug>, claims the unit on this machine, makes it the active unit and returns its context. Refuses while the working tree has uncommitted changes, listing them; it never commits or discards anything itself. With stack=true, as in a build run or for the next unit after finishing one, a new branch starts from the branch checked out, the branch of the unit just finished, so the unit has that work before it is merged.",inputSchema:{id:b.string().describe("The unit to start, such as TK-001."),stack:b.boolean().default(!1).describe("true in a build run, or for the next unit offered after finishing one: branch from the branch of the unit just finished instead of the default branch."),run:b.boolean().default(!1).describe("true for every unit a build run starts, the first included. It only marks the start in the user's own usage record.")},readOnly:!1,run(e,t){let r=e.workspace();if(!r.ok)return B("BuildKeel cannot read a spec tree here.",r.problems);let{tree:i,resolved:n}=r.value,o=d2({tree:i,codeRoot:n.codeRoot,home:e.home,host:e.host,unitId:t.id,stack:t.stack});if(!o.ok)return B(`${t.id} cannot be started.`,o.problems);let s=o.value;if(s.kind==="refused"&&e.gateUsage(r.value,s.gate,s.unitId,!1),s.kind==="refused")return[on(s.gate,`start of ${s.unitId}`),"","Nothing was changed."].join(`
|
|
352
|
+
`);if(s.kind==="uncommitted"){let l=s.files.filter(p=>fm(n.codeRoot,i.root,p)),d=s.files.filter(p=>!l.includes(p)),f=[`${s.unitId} was not started: the working tree has uncommitted changes, and every change must belong to exactly one unit.`,...s.files.map(p=>`- ${p}`),""];if(l.length>0){let p=l.length===1;f.push(`${l.join(", ")} ${p?"sets":"set"} BuildKeel up rather than being anyone's work: with the user's agreement, commit ${p?"it":"them"} on ${p?"its":"their"} own, as setting BuildKeel up, with no BuildKeel-Unit line${d.length===0?", then start again":""}.`)}return d.length>0&&f.push(s.activeUnit?`The active unit is ${s.activeUnit}. Commit ${l.length>0?"the other":"these"} changes to it (ending the message with "BuildKeel-Unit: ${s.activeUnit}"), or set them aside with git stash if the user confirms they should not be kept with it; then start again.`:`There is no active unit. Ask the user which unit ${l.length>0?"the other":"these"} changes belong to and commit them with that unit's BuildKeel-Unit line, or set them aside with git stash if the user confirms; then start again.`),f.push("Nothing was changed."),f.join(`
|
|
353
|
+
`)}e.gateUsage(r.value,s.gate,s.unit.id,!0),e.usage(r.value,{event:"start",unit:s.unit.id,type:s.unit.type,...s.branch.kind==="created"&&s.branch.stacked?{stacked:!0}:{},...t.run?{run:!0}:{}});let a=e.refreshHookCache(r.value),c=yl(i,a,s.unit.id,{active:!0,code:e.unitCode(r.value,a,s.unit.id)}),u=[`Started ${s.unit.id}${s.unit.title?` "${s.unit.title}"`:""} in ${n.codeRoot}: it is the active unit here, so the changes and commits made now belong to it.`];return u.push(`- ${xhe(s.branch)}`),u.push(`- Claimed on this machine: other working trees cannot start ${s.unit.id} until it is finished or released.`),s.previous&&s.previous!==s.unit.id&&u.push(`- ${s.previous} is no longer the active unit here; its claim stays until it is finished.`),s.gate.outcome==="warned"&&u.push("",on(s.gate,"the start")),u.push(...ls(Ke(n.codeRoot),{behind:!1})),u.push("",c.ok?c.value.trimEnd():B("The context could not be built.",c.problems)),u.join(`
|
|
354
|
+
`)}});function xhe(e){if(e.kind==="kept")return`Already on its branch ${e.branch}.`;if(e.kind==="switched")return`Switched to its branch ${e.branch}.`;let t=e.carried?.length?` ${e.base} does not have the unit's record yet, so its branch brings along ${e.carried.map(i=>`"${i}"`).join(", ")}; it changes only the unit's own file, and merges cleanly with the branch it came from.`:"",r=e.stacked?` It is stacked on ${e.base}, so it has that unit's work before it is merged; merge the branches in order, or review the run in one pull request from the last branch.`:"";return`Created its branch ${e.branch} from ${e.base}.${r}${t}${e.baseNote?` ${e.baseNote}`:""}`}var MB=bt({name:"validate",title:"Validate the spec tree",description:"Check the whole BuildKeel spec tree: the process definition and the organization template source, every artifact against its template, links between artifacts and the stage of each parent, duplicate IDs and numbers, and every approved version against the hash in its approval record (which shows files changed after approval, for example in another editor), and every existing test matched to a test case against the latest test report read here. Also lists approved artifacts that do not meet a template or process changed since (they stay approved), what the tree overrides from its organization's templates, and warnings about what its own setup gives up. Changes nothing.",inputSchema:{},readOnly:!0,run(e){let t=e.workspace();if(!t.ok)return B("BuildKeel cannot read a spec tree here.",t.problems);let r=yB(t.value.tree),i=c_(t.value.tree.root,r.index,t.value.resolved.codeRoot),n=[...t.value.notices,...r.problems,...i],o=`${r.versionsChecked} approved version${r.versionsChecked===1?"":"s"}`,s=[`Checked ${r.index.artifacts.size} artifacts in ${t.value.tree.root}, and ${o} against their recorded hashes.`];s.push(...n.length===0?["No problems found."]:["",B(`Found ${n.length} problem${n.length===1?"":"s"}:`,n)]);for(let a of r.warnings)s.push("",B("Warning:",[a]));if(r.earlier.length>0){let a=r.earlier.length;s.push("",B(`Approved under earlier rules (${a}): ${a===1?"it stays":"they stay"} approved, and each is checked against the current template and process at its next version.`,r.earlier))}if(r.overrides){let{label:a,lines:c}=r.overrides,u=`Templates and process come from the organization's templates ${a}.`;s.push("",...c.length>0?[`${u} Overridden locally:`,...c]:[`${u} Nothing is overridden locally.`])}return s.join(`
|
|
355
|
+
`)}});var rO=[S2,IB,P2,jB,MB,CB,DB,$2,g2,Q2,T2,AB],LB=15,Ihe=b.string().optional().describe("The absolute path of the project folder this call is for: the repository with .buildkeel.yaml, or the one being set up. Always pass it; one BuildKeel server can serve several projects.");function UB(e){if(rO.length>LB)throw new Error(`BuildKeel exposes ${rO.length} tools; the limit is ${LB}.`);let t=new C$({name:"buildkeel",version:K4()});for(let r of rO)t.registerTool(r.name,{title:r.title,description:r.description,inputSchema:{...r.inputSchema,workspace:Ihe},annotations:{readOnlyHint:r.readOnly,openWorldHint:!1}},async({workspace:i,...n})=>{let o=await e.forCall(typeof i=="string"?i:void 0);if(!o.ok)return{isError:!0,content:[{type:"text",text:Q0(B("BuildKeel cannot tell which project this call is for.",o.problems),e.host)}]};try{let s=await r.run(o.value,n);return o.value.flushWrites(),{content:[{type:"text",text:Q0(s,e.host)}]}}catch(s){try{o.value.flushWrites()}catch{}return{isError:!0,content:[{type:"text",text:`BuildKeel failed: ${s instanceof Error?s.message:String(s)}`}]}}});return t}import{rmSync as Fhe,statSync as Zhe}from"node:fs";import{isAbsolute as Vhe}from"node:path";import{existsSync as Phe}from"node:fs";import{join as qB,resolve as The}from"node:path";var Ahe=b.object({specs:b.string().min(1),remote:b.string().min(1).optional(),repo:b.string().min(1)});function FB(e,t=Wo()){let r=Gp(e);if(!r)return I({code:"pointer-missing",message:`This repo is not set up for BuildKeel: no ${Nt} was found.`,remedy:`Run ${ie("init")} to create a spec tree or point this repo at an existing one.`});let i=Lu(qB(r,Nt),Nt,Ahe,"pointer");if(!i.ok)return i;let n=qb(t);if(!n.ok)return n;let o=i.value.remote?n.value.specs[i.value.remote]:void 0,s=o??The(r,i.value.specs);if(!Phe(qB(s,wt))){let a=o?`the local override in ~/.buildkeel/paths.yaml (${s})`:s,c=[...i.value.remote?[`clone ${i.value.remote} to ${s}`]:[],`correct "specs" in ${Nt}`,"set where the spec repo is checked out on this machine in ~/.buildkeel/paths.yaml"];return I({code:"spec-tree-not-found",path:Nt,message:`${Nt} points to a spec tree at ${a}, but there is no ${wt} there.`,remedy:`Either ${c.join(", or ")}.`})}return N({codeRoot:r,pointer:i.value,specRoot:s,overridden:o!==void 0})}import{spawn as Rhe}from"node:child_process";var Ehe=1e4,Ohe=10,Nhe=(e,t,r)=>new Promise(i=>{let n="",o=Rhe(e,t,{cwd:r,env:{...process.env,GH_PROMPT_DISABLED:"1",GIT_TERMINAL_PROMPT:"0"},stdio:["ignore","pipe","ignore"]}),s=setTimeout(()=>o.kill(),Ehe);o.stdout?.on("data",a=>n+=a.toString("utf8")),o.on("error",a=>{clearTimeout(s),i(a.code==="ENOENT"?null:{code:-1,stdout:n})}),o.on("close",a=>{clearTimeout(s),i({code:a??-1,stdout:n})})}),Che=/^(?:https?:\/\/(?:[^@/]+@)?github\.com\/|(?:ssh:\/\/)?git@github\.com[:/])([^/\s]+\/[^/\s]+?)(?:\.git)?\/?$/i;function zhe(e=Nhe){return{repository:t=>Che.exec(t.trim())?.[1]??null,async find(t,r,i){let n=new Map;for(let o of i.slice(0,Ohe)){let s=await e("gh",["api",`repos/${t}/commits/${o}/pulls`],r);if(s===null)return null;if(s.code===0)for(let a of jhe(s.stdout))n.set(a.number,a)}return[...n.values()].sort((o,s)=>o.number-s.number)}}}function jhe(e){try{let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(r=>typeof r.number=="number"&&typeof r.title=="string"?[{number:r.number,title:r.title,state:r.merged_at?"merged":String(r.state??"open"),url:String(r.html_url??"")}]:[]):[]}catch{return[]}}var F_=[zhe()];async function Dhe(e,t,r,i=F_){if(!e||r.length===0)return[];for(let n of i){let o=n.repository(e);if(o)return await n.find(o,t,r)??[]}return[]}async function ZB(e,t,r=F_){for(let i of e.repos){let n=t.repos.find(s=>s.name===i.repo)?.dir;if(!n)continue;let o=await Dhe(de(n,["remote","get-url","origin"]),n,i.commits.map(s=>s.id),r);o.length>0&&(i.pullRequests=o)}return e}var VB=e=>e.includes("/")?e.slice(0,e.lastIndexOf("/")+1):e;function BB(e,t,r,i,n){let o=t.artifacts.get(n);if(!o)return[];let s=new Set,a=(fe(e,o)??o).document.frontmatter.scope;for(let d of Array.isArray(a)?a:[])typeof d=="string"&&d.trim()!==""&&s.add(_i(d));let c=tm(t,o);if(c&&c!==o)for(let d of rm(e,c,i)?.paths??[])s.add(d);let u=new Map([o,...c?[c,...pm(t,c)]:[]].map(d=>[d.id,d])),l=r.repos.find(d=>d.name===i);for(let d of u.values()){for(let f of l?.units.get(d.id)??[])for(let p of f.files)s.add(VB(p));for(let{record:f}of Wn(e,d).completions)if(f.repo===i)for(let p of f.files)s.add(VB(p))}return[...s].sort()}function KB(e,t=Hi,r={}){let i=Jo(e);if(!i.ok)return i;r.home&&rZ(e,i.value,r.home);let n=z_(i.value.format,t);return N({root:e,config:i.value,access:n},n.writable?[]:[n.problem])}import{existsSync as Mhe,linkSync as Lhe,mkdirSync as GB,renameSync as Uhe,rmSync as nO,writeFileSync as qhe}from"node:fs";import{dirname as WB,isAbsolute as JB,relative as Sm,resolve as xm,sep as Z_}from"node:path";var V_=class{constructor(t){this.tree=t}tree;listeners=[];onWrite(t){this.listeners.push(t)}writeFile(t,r){return this.write(t,r,"replace")}createRecord(t,r){return this.write(t,r,"create")}remove(t){let r=this.refusal(t);if(r)return I(r);let i=xm(this.tree.root,t),n=Sm(this.tree.root,i).split(Z_).join("/");try{nO(i,{force:!0})}catch(o){return I({code:"write-failed",path:n,message:`Could not remove ${n}: ${o.message}`})}for(let o of this.listeners)o([n]);return N(n)}move(t,r){let i=this.refusal(t)??this.refusal(r);if(i)return I(i);let n=xm(this.tree.root,t),o=xm(this.tree.root,r),s=Sm(this.tree.root,o).split(Z_).join("/");if(Mhe(o))return I({code:"move-target-exists",path:s,message:`Cannot rename ${t} to ${s}: ${s} already exists.`});try{GB(WB(o),{recursive:!0}),Uhe(n,o)}catch(a){return I({code:"write-failed",path:s,message:`Could not rename ${t} to ${s}: ${a.message}`})}for(let a of this.listeners)a([Sm(this.tree.root,n).split(Z_).join("/"),s]);return N(s)}write(t,r,i){let n=this.refusal(t);if(n)return I(n);let o=xm(this.tree.root,t),s=Sm(this.tree.root,o).split(Z_).join("/"),a=iE(o);try{i==="create"?(GB(WB(o),{recursive:!0}),qhe(a,r,{flag:"wx"}),Lhe(a,o),nO(a)):cn(o,r)}catch(c){nO(a,{force:!0});let u=c.code;return i==="create"&&u==="EEXIST"?I({code:"record-exists",path:s,message:`${s} already exists. Records are written once and never changed.`}):I({code:"write-failed",path:s,message:`Could not write ${s}: ${c.message}`})}for(let c of this.listeners)c([s]);return N(s)}refusal(t){if(!this.tree.access.writable)return this.tree.access.problem;let r=xm(this.tree.root,t),i=Sm(this.tree.root,r);return JB(t)||i===""||i.startsWith("..")||JB(i)?{code:"write-outside-tree",message:`Refusing to write ${t}: it is outside the spec tree.`}:null}};var B_=class e{host;home;cwd;fixed;pullRequests;openFolders=null;preparesOnFirstUse=!1;prepared=new Set;written=null;constructor(t){this.host=t.host,this.cwd=t.cwd,this.home=t.home??Wo(),this.fixed=t.fixed??!1,this.pullRequests=t.pullRequests??F_}usage(t,r){W2(this.home,t.tree.root,this.host,r)}gateUsage(t,r,i,n){if(r.outcome==="skipped"||r.outcome!=="blocked"&&!n)return;let o=[...r.blocking,...r.warnings].map(s=>s.id);this.usage(t,{event:"gate",gate:r.gate,outcome:r.outcome,artifact:i,checks:o})}prepareProjectsOnFirstUse(){this.preparesOnFirstUse=!0}useOpenFolders(t){this.openFolders=t}async forCall(t){let r=this.cwd;if(t!==void 0){if(!Vhe(t)||!Khe(t))return I({code:"workspace-invalid",message:`${t} is not the absolute path of a folder on this machine.`,remedy:"Call again with workspace set to the absolute path of the project folder."});r=t}else if(!this.fixed&&this.openFolders){let n=await this.openFolders().catch(()=>[]),o=n.filter(s=>Gp(s)!==null);if(o.length===1)r=o[0];else if(o.length===0&&n.length===1)r=n[0];else if(n.length>0)return I({code:"workspace-unknown",message:`Several folders are open (${n.join(", ")}), so BuildKeel cannot tell which project this call is for.`,remedy:"Call again with workspace set to the absolute path of the project folder."})}let i=r===this.cwd?this:new e({host:this.host,cwd:r,home:this.home,pullRequests:this.pullRequests});return this.preparesOnFirstUse&&this.prepare(i),N(i)}prepare(t=this){let r=Gp(t.cwd);if(!r||this.prepared.has(r))return;let i=t.workspace();if(!i.ok)return;this.prepared.add(r),t.refreshHookCache(i.value),t.checkFreshness(i.value).catch(()=>{});let{resolved:n}=i.value,o={codeRoot:n.codeRoot,repo:n.pointer.repo,home:t.home,host:t.host};I_({tree:i.value.tree,writer:t.writer(i.value),code:o}).then(()=>t.flushWrites()).catch(s=>{process.stderr.write(`BuildKeel could not assign pending numbers: ${s instanceof Error?s.message:String(s)}
|
|
356
|
+
`)})}workspace(){let t=FB(this.cwd,this.home);if(!t.ok)return t;let r=KB(t.value.specRoot,void 0,{home:this.home});return r.ok?N({resolved:t.value,tree:r.value,notices:r.problems}):I(...r.problems)}writer(t){let r=new V_(t.tree);return r.onWrite(()=>{this.written=t}),r}flushWrites(){this.written&&this.refreshHookCache(this.written)}refreshHookCache(t){this.written=null;let{tree:r,resolved:i}=t,n=J(r.root),{codeRoot:o}=i,s=Ke(o)?.suspects,a=s_(o,n);if(!a)return n;let c=$a(r.root),u=a.activeUnit,l=u?Ki(r,n,{codeRoot:o,repo:i.pointer.repo},this.home):null,d=pr(r.root,n).suspects;if(s){let f=new Set(s);for(let p of d.filter(m=>!f.has(m.id)))this.usage(t,{event:"suspect",id:p.id,target:p.target})}return Hn(o,{unpushedApprovals:c.approvals,unpushedCompletions:c.completions,suspects:[...new Set(d.map(f=>f.id))],...u&&l?{scope:BB(r.root,n,l,i.pointer.repo,u)}:{}}),Bhe(o,u&&l?yl(r,n,u,{active:!0,code:el(r.root,n,l,u)}):null),n}unitCode(t,r,i){let{tree:n,resolved:o}=t,s=Ki(n,r,{codeRoot:o.codeRoot,repo:o.pointer.repo},this.home);return el(n.root,r,s,i)}async unitCodeWithPullRequests(t,r,i){let{tree:n,resolved:o}=t,s=Ki(n,r,{codeRoot:o.codeRoot,repo:o.pointer.repo},this.home);return ZB(el(n.root,r,s,i),s,this.pullRequests)}async checkFreshness(t){let r=await yV(t.tree.root);Ke(t.resolved.codeRoot)||this.refreshHookCache(t);let i=$a(t.tree.root);return Hn(t.resolved.codeRoot,{freshness:r,unpushedApprovals:i.approvals,unpushedCompletions:i.completions}),r}};function Bhe(e,t){t?.ok?cn(rE(e),t.value):Fhe(rE(e),{force:!0})}function Khe(e){try{return Zhe(e).isDirectory()}catch{return!1}}import{appendFileSync as Ghe}from"node:fs";import{fileURLToPath as Whe}from"node:url";var Jhe=5e3;async function YB(e,t,r,i){if(Im({args:process.argv.slice(2),cwd:process.cwd(),fixed:i.fixed}),t.prepareProjectsOnFirstUse(),i.fixed){t.prepare(),e.server.oninitialized=()=>Im({client:e.server.getClientVersion(),roots:!!e.server.getClientCapabilities()?.roots}),await e.connect(r);return}let n=async()=>{let o=await HB(e);Im({folders:o});for(let s of o)await t.forCall(s)};e.server.oninitialized=()=>{let o=!!e.server.getClientCapabilities()?.roots;Im({client:e.server.getClientVersion(),roots:o}),o&&(t.useOpenFolders(()=>HB(e)),n().catch(s=>Im({rootsFailed:s instanceof Error?s.message:String(s)})))},e.server.setNotificationHandler(Y0,()=>{n().catch(()=>{})}),await e.connect(r)}function Im(e){let t=process.env.BUILDKEEL_SERVER_LOG;t&&Ghe(t,`${JSON.stringify({at:new Date().toISOString(),...e})}
|
|
357
|
+
`)}async function HB(e){let{roots:t}=await e.server.listRoots(void 0,{timeout:Jhe});return t.filter(r=>r.uri.startsWith("file:")).map(r=>Whe(r.uri))}function Hhe(e){let t="claude-code",r=process.cwd(),i=!1;for(let n=0;n<e.length;n++){let o=e[n];o==="--host"?t=e[++n]??"":o==="--root"&&(r=e[++n]??r,i=!0)}if(!Oj(t))throw new Error(`Unknown host "${t}". Use one of: ${X0.join(", ")}.`);return{host:t,cwd:r,rootGiven:i}}try{let{host:e,cwd:t,rootGiven:r}=Hhe(process.argv.slice(2)),i=new B_({host:e,cwd:t,fixed:r});await YB(UB(i),i,new av,{fixed:r})}catch(e){process.stderr.write(`BuildKeel server could not start: ${e instanceof Error?e.message:String(e)}
|
|
358
|
+
`),process.exit(1)}
|