@rizom/ops 0.2.0-alpha.806 → 0.2.0-alpha.808
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/dist/brains-ops.js +28 -28
- package/dist/index.js +30 -30
- package/package.json +1 -1
package/dist/brains-ops.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var WH=Object.create;var{getPrototypeOf:GH,defineProperty:Ub,getOwnPropertyNames:QH}=Object;var YH=Object.prototype.hasOwnProperty;function XH(e){return this[e]}var eJ,tJ,Jl=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?eJ??=new WeakMap:tJ??=new WeakMap,i=n.get(e);if(i)return i}r=e!=null?WH(GH(e)):{};let s=t||!e||!e.__esModule?Ub(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of QH(e))if(!YH.call(s,a))Ub(s,a,{get:XH.bind(e,a),enumerable:!0})}if(o)n.set(e,s);return s};var ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var rJ=(e)=>e;function nJ(e,t){this[e]=rJ.bind(null,t)}var Lt=(e,t)=>{for(var r in t)Ub(e,r,{get:t[r],enumerable:!0,configurable:!0,set:nJ.bind(t,r)})};var S=(e,t)=>()=>(e&&(t=e(e=0)),t);var Fr=import.meta.require;function Ve(e,t){if(e instanceof Error)return e.message;return t??String(e)}function Mb(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function St(e,t=""){if(typeof e!=="number"){let r=t&&`"${t}" `;throw TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw RangeError(`${r}expected integer >= 0, got ${e}`)}}function Mt(e,t,r=""){let o=Mb(e),n=e?.length,i=t!==void 0;if(!o||i&&n!==t){let s=r&&`"${r}" `,a=i?` of length ${t}`:"",l=o?`length=${n}`:`type=${typeof e}`,u=s+"expected Uint8Array"+a+", got "+l;if(!o)throw TypeError(u);throw RangeError(u)}return e}function po(e){if(typeof e!=="function"||typeof e.create!=="function")throw TypeError("Hash must wrapped by utils.createHasher");if(St(e.outputLen),St(e.blockLen),e.outputLen<1)throw Error('"outputLen" must be >= 1');if(e.blockLen<1)throw Error('"blockLen" must be >= 1')}function Aa(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function pf(e,t){Mt(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw RangeError('"digestInto() output" expected to be of length >='+r)}function ff(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function cr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ka(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ln(e,t){return e<<32-t|e>>>t}function Fe(e,t){return e<<t|e>>>32-t>>>0}function mJ(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function hJ(e){for(let t=0;t<e.length;t++)e[t]=mJ(e[t]);return e}function mf(e){if(Mt(e),hO)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=gJ[e[r]];return t}function mO(e){if(e>=uo._0&&e<=uo._9)return e-uo._0;if(e>=uo.A&&e<=uo.F)return e-(uo.A-10);if(e>=uo.a&&e<=uo.f)return e-(uo.a-10);return}function Kl(e){if(typeof e!=="string")throw TypeError("hex string expected, got "+typeof e);if(hO)try{return Uint8Array.fromHex(e)}catch(n){if(n instanceof SyntaxError)throw RangeError(n.message);throw n}let t=e.length,r=t/2;if(t%2)throw RangeError("hex string expected, got unpadded hex of length "+t);let o=new Uint8Array(r);for(let n=0,i=0;n<r;n++,i+=2){let s=mO(e.charCodeAt(i)),a=mO(e.charCodeAt(i+1));if(s===void 0||a===void 0){let l=e[i]+e[i+1];throw RangeError('hex string expected, got non-hex character "'+l+'" at index '+i)}o[n]=s*16+a}return o}function yJ(e){if(typeof e!=="string")throw TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Fb(e,t=""){if(typeof e==="string")return yJ(e);return Mt(e,void 0,t)}function Hb(...e){let t=0;for(let o=0;o<e.length;o++){let n=e[o];Mt(n),t+=n.length}let r=new Uint8Array(t);for(let o=0,n=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return r}function hf(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw TypeError("options must be object or undefined");return Object.assign(e,t)}function Jb(e,t={}){let r=(n,i)=>e(i).update(n).digest(),o=e(void 0);return r.outputLen=o.outputLen,r.blockLen=o.blockLen,r.canXOF=o.canXOF,r.create=(n)=>e(n),Object.assign(r,t),Object.freeze(r)}function fo(e=32){St(e,"bytesLength");let t=typeof globalThis==="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!=="function")throw Error("crypto.getRandomValues must be defined");if(e>65536)throw RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var fJ,qb,hO,gJ,uo,Kb=(e)=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Hr=S(()=>{fJ=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();qb=fJ?(e)=>e:hJ,hO=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),gJ=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));uo={_0:48,_9:57,A:65,F:70,a:97,f:102}});class Vb{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if(po(e),Mt(t,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,o=new Uint8Array(r);o.set(t.length>r?e.create().update(t).digest():t);for(let n=0;n<o.length;n++)o[n]^=54;this.iHash.update(o),this.oHash=e.create();for(let n=0;n<o.length;n++)o[n]^=106;this.oHash.update(o),cr(o)}update(e){return Aa(this),this.iHash.update(e),this}digestInto(e){Aa(this),pf(e,this),this.finished=!0;let t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:r,finished:o,destroyed:n,blockLen:i,outputLen:s}=this;return e=e,e.finished=o,e.destroyed=n,e.blockLen=i,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var Pn;var Vl=S(()=>{Hr();Pn=(()=>{let e=(t,r,o)=>new Vb(t,r).update(o).digest();return e.create=(t,r)=>new Vb(t,r),e})()});function Wl(e,t,r){if(po(e),r===void 0)r=new Uint8Array(e.outputLen);return Pn(e,r,t)}function Gb(e,t,r,o=32){po(e),St(o,"length"),Mt(t,void 0,"prk");let n=e.outputLen;if(t.length<n)throw Error('"prk" must be at least HashLen octets');if(o>255*n)throw Error("Length must be <= 255*HashLen");let i=Math.ceil(o/n);if(r===void 0)r=gO;else Mt(r,void 0,"info");let s=new Uint8Array(i*n),a=Pn.create(e,t),l=a._cloneInto(),u=new Uint8Array(a.outputLen);for(let d=0;d<i;d++)Wb[0]=d+1,l.update(d===0?gO:u).update(r).update(Wb).digestInto(u),s.set(u,n*d),a._cloneInto(l);return a.destroy(),l.destroy(),cr(u,Wb),s.slice(0,o)}var Wb,gO,Yo=(e,t,r,o,n)=>Gb(e,Wl(e,t,r),o,n);var Qb=S(()=>{Vl();Hr();Wb=Uint8Array.of(0),gO=Uint8Array.of()});function yO(e,t,r){return e&t^~e&r}function bO(e,t,r){return e&t^e&r^t&r}class gf{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,o){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(e),this.view=ka(this.buffer)}update(e){Aa(this),Mt(e);let{view:t,buffer:r,blockLen:o}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(o-this.pos,n-i);if(s===o){let a=ka(e);for(;o<=n-i;i+=o)this.process(a,i);continue}if(r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===o)this.process(t,0),this.pos=0}return this.length+=e.length,this.roundClean(),this}digestInto(e){Aa(this),pf(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:o,isLE:n}=this,{pos:i}=this;if(t[i++]=128,cr(this.buffer.subarray(i)),this.padOffset>o-i)this.process(r,0),i=0;for(let d=i;d<o;d++)t[d]=0;r.setBigUint64(o-8,BigInt(this.length*8),n),this.process(r,0);let s=ka(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen must be aligned to 32bit");let l=a/4,u=this.get();if(l>u.length)throw Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)s.setUint32(4*d,u[d],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:o,finished:n,destroyed:i,pos:s}=this;if(e.destroyed=i,e.finished=n,e.length=o,e.pos=s,o%t)e.buffer.set(r);return e}clone(){return this._cloneInto()}}var mo,qt;var SO=S(()=>{Hr();mo=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qt=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function bJ(e,t=!1){if(t)return{h:Number(e&yf),l:Number(e>>vO&yf)};return{h:Number(e>>vO&yf)|0,l:Number(e&yf)|0}}function wO(e,t=!1){let r=e.length,o=new Uint32Array(r),n=new Uint32Array(r);for(let i=0;i<r;i++){let{h:s,l:a}=bJ(e[i],t);[o[i],n[i]]=[s,a]}return[o,n]}function zn(e,t,r,o){let n=(t>>>0)+(o>>>0);return{h:e+r+(n/4294967296|0)|0,l:n|0}}var yf,vO,Yb=(e,t,r)=>e>>>r,Xb=(e,t,r)=>e<<32-r|t>>>r,fs=(e,t,r)=>e>>>r|t<<32-r,ms=(e,t,r)=>e<<32-r|t>>>r,Gl=(e,t,r)=>e<<64-r|t>>>r-32,Ql=(e,t,r)=>e>>>r-32|t<<64-r,xO=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),_O=(e,t,r,o)=>t+r+o+(e/4294967296|0)|0,EO=(e,t,r,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0),IO=(e,t,r,o,n)=>t+r+o+n+(e/4294967296|0)|0,AO=(e,t,r,o,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0)+(n>>>0),kO=(e,t,r,o,n,i)=>t+r+o+n+i+(e/4294967296|0)|0;var RO=S(()=>{yf=BigInt(4294967295),vO=BigInt(32)});var vJ,Xo,TO,$O,OO,wJ,xJ,ei,ti,CO,PO,vt,bf;var Ra=S(()=>{SO();RO();Hr();vJ=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Xo=new Uint32Array(64);TO=class TO extends gf{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:o,E:n,F:i,G:s,H:a}=this;return[e,t,r,o,n,i,s,a]}set(e,t,r,o,n,i,s,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=n|0,this.F=i|0,this.G=s|0,this.H=a|0}process(e,t){for(let d=0;d<16;d++,t+=4)Xo[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let p=Xo[d-15],m=Xo[d-2],h=ln(p,7)^ln(p,18)^p>>>3,b=ln(m,17)^ln(m,19)^m>>>10;Xo[d]=b+Xo[d-7]+h+Xo[d-16]|0}let{A:r,B:o,C:n,D:i,E:s,F:a,G:l,H:u}=this;for(let d=0;d<64;d++){let p=ln(s,6)^ln(s,11)^ln(s,25),m=u+p+yO(s,a,l)+vJ[d]+Xo[d]|0,b=(ln(r,2)^ln(r,13)^ln(r,22))+bO(r,o,n)|0;u=l,l=a,a=s,s=i+m|0,i=n,n=o,o=r,r=m+b|0}r=r+this.A|0,o=o+this.B|0,n=n+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,o,n,i,s,a,l,u)}roundClean(){cr(Xo)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),cr(this.buffer)}};$O=class $O extends TO{A=mo[0]|0;B=mo[1]|0;C=mo[2]|0;D=mo[3]|0;E=mo[4]|0;F=mo[5]|0;G=mo[6]|0;H=mo[7]|0;constructor(){super(32)}};OO=(()=>wO(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e)=>BigInt(e))))(),wJ=(()=>OO[0])(),xJ=(()=>OO[1])(),ei=new Uint32Array(80),ti=new Uint32Array(80);CO=class CO extends gf{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:r,Bl:o,Ch:n,Cl:i,Dh:s,Dl:a,Eh:l,El:u,Fh:d,Fl:p,Gh:m,Gl:h,Hh:b,Hl:y}=this;return[e,t,r,o,n,i,s,a,l,u,d,p,m,h,b,y]}set(e,t,r,o,n,i,s,a,l,u,d,p,m,h,b,y){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=o|0,this.Ch=n|0,this.Cl=i|0,this.Dh=s|0,this.Dl=a|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=p|0,this.Gh=m|0,this.Gl=h|0,this.Hh=b|0,this.Hl=y|0}process(e,t){for(let _=0;_<16;_++,t+=4)ei[_]=e.getUint32(t),ti[_]=e.getUint32(t+=4);for(let _=16;_<80;_++){let k=ei[_-15]|0,O=ti[_-15]|0,L=fs(k,O,1)^fs(k,O,8)^Yb(k,O,7),z=ms(k,O,1)^ms(k,O,8)^Xb(k,O,7),J=ei[_-2]|0,P=ti[_-2]|0,W=fs(J,P,19)^Gl(J,P,61)^Yb(J,P,6),ee=ms(J,P,19)^Ql(J,P,61)^Xb(J,P,6),j=EO(z,ee,ti[_-7],ti[_-16]),T=IO(j,L,W,ei[_-7],ei[_-16]);ei[_]=T|0,ti[_]=j|0}let{Ah:r,Al:o,Bh:n,Bl:i,Ch:s,Cl:a,Dh:l,Dl:u,Eh:d,El:p,Fh:m,Fl:h,Gh:b,Gl:y,Hh:v,Hl:x}=this;for(let _=0;_<80;_++){let k=fs(d,p,14)^fs(d,p,18)^Gl(d,p,41),O=ms(d,p,14)^ms(d,p,18)^Ql(d,p,41),L=d&m^~d&b,z=p&h^~p&y,J=AO(x,O,z,xJ[_],ti[_]),P=kO(J,v,k,L,wJ[_],ei[_]),W=J|0,ee=fs(r,o,28)^Gl(r,o,34)^Gl(r,o,39),j=ms(r,o,28)^Ql(r,o,34)^Ql(r,o,39),T=r&n^r&s^n&s,Z=o&i^o&a^i&a;v=b|0,x=y|0,b=m|0,y=h|0,m=d|0,h=p|0,{h:d,l:p}=zn(l|0,u|0,P|0,W|0),l=s|0,u=a|0,s=n|0,a=i|0,n=r|0,i=o|0;let I=xO(W,j,Z);r=_O(I,P,ee,T),o=I|0}({h:r,l:o}=zn(this.Ah|0,this.Al|0,r|0,o|0)),{h:n,l:i}=zn(this.Bh|0,this.Bl|0,n|0,i|0),{h:s,l:a}=zn(this.Ch|0,this.Cl|0,s|0,a|0),{h:l,l:u}=zn(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:p}=zn(this.Eh|0,this.El|0,d|0,p|0),{h:m,l:h}=zn(this.Fh|0,this.Fl|0,m|0,h|0),{h:b,l:y}=zn(this.Gh|0,this.Gl|0,b|0,y|0),{h:v,l:x}=zn(this.Hh|0,this.Hl|0,v|0,x|0),this.set(r,o,n,i,s,a,l,u,d,p,m,h,b,y,v,x)}roundClean(){cr(ei,ti)}destroy(){this.destroyed=!0,cr(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};PO=class PO extends CO{Ah=qt[0]|0;Al=qt[1]|0;Bh=qt[2]|0;Bl=qt[3]|0;Ch=qt[4]|0;Cl=qt[5]|0;Dh=qt[6]|0;Dl=qt[7]|0;Eh=qt[8]|0;El=qt[9]|0;Fh=qt[10]|0;Fl=qt[11]|0;Gh=qt[12]|0;Gl=qt[13]|0;Hh=qt[14]|0;Hl=qt[15]|0;constructor(){super(64)}};vt=Jb(()=>new $O,Kb(1)),bf=Jb(()=>new PO,Kb(3))});function _f(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function rS(e){if(!_f(e))throw TypeError("Uint8Array expected")}function ZO(e,t){if(!Array.isArray(t))return!1;if(t.length===0)return!0;if(e)return t.every((r)=>typeof r==="string");else return t.every((r)=>Number.isSafeInteger(r))}function jO(e){if(typeof e!=="function")throw TypeError("function expected");return!0}function ri(e,t){if(typeof t!=="string")throw TypeError(`${e}: string expected`);return!0}function Xl(e){if(typeof e!=="number")throw TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw RangeError(`invalid integer: ${e}`)}function vf(e){if(!Array.isArray(e))throw TypeError("array expected")}function wf(e,t){if(!ZO(!0,t))throw TypeError(`${e}: array of strings expected`)}function nS(e,t){if(!ZO(!1,t))throw TypeError(`${e}: array of numbers expected`)}function Cr(...e){let t=(i)=>i,r=(i,s)=>(a)=>i(s(a)),o=e.map((i)=>i.encode).reduceRight(r,t),n=e.map((i)=>i.decode).reduce(r,t);return{encode:o,decode:n}}function Pr(e){let t=typeof e==="string"?e.split(""):e,r=t.length;wf("alphabet",t);let o=new Map(t.map((n,i)=>[n,i]));return{encode:(n)=>(vf(n),n.map((i)=>{if(!Number.isSafeInteger(i)||i<0||i>=r)throw Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${e}`);return t[i]})),decode:(n)=>(vf(n),n.map((i)=>{ri("alphabet.decode",i);let s=o.get(i);if(s===void 0)throw Error(`Unknown letter: "${i}". Allowed: ${e}`);return s}))}}function zr(e=""){return ri("join",e),{encode:(t)=>(wf("join.decode",t),t.join(e)),decode:(t)=>(ri("join.decode",t),t.split(e))}}function Ef(e,t="="){return Xl(e),ri("padding",t),{encode(r){wf("padding.encode",r);while(r.length*e%8)r.push(t);return r},decode(r){wf("padding.decode",r);let o=r.length;if(o*e%8)throw Error("padding: invalid, string should have whole number of bytes");for(;o>0&&r[o-1]===t;o--)if((o-1)*e%8===0)throw Error("padding: invalid, string has too much padding");return r.slice(0,o)}}}function BO(e){return jO(e),{encode:(t)=>t,decode:(t)=>e(t)}}function zO(e,t,r){if(t<2)throw RangeError(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(r<2)throw RangeError(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(vf(e),!e.length)return[];let o=0,n=[],i=Array.from(e,(a)=>{if(Xl(a),a<0||a>=t)throw Error(`invalid integer: ${a}`);return a}),s=i.length;while(!0){let a=0,l=!0;for(let u=o;u<s;u++){let d=i[u],p=t*a,m=p+d;if(!Number.isSafeInteger(m)||p/t!==a||m-d!==p)throw Error("convertRadix: carry overflow");let h=m/r;a=m%r;let b=Math.floor(h);if(i[u]=b,!Number.isSafeInteger(b)||b*r+a!==m)throw Error("convertRadix: carry overflow");if(!l)continue;else if(!b)o=u;else l=!1}if(n.push(a),l)break}for(let a=0;a<e.length-1&&e[a]===0;a++)n.push(0);return n.reverse()}function eS(e,t,r,o){if(vf(e),t<=0||t>32)throw RangeError(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw RangeError(`convertRadix2: wrong to=${r}`);if(xf(t,r)>32)throw Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${xf(t,r)}`);let n=0,i=0,s=Sf[t],a=Sf[r]-1,l=[];for(let u of e){if(Xl(u),u>=s)throw Error(`convertRadix2: invalid data word=${u} from=${t}`);if(n=n<<t|u,i+t>32)throw Error(`convertRadix2: carry overflow pos=${i} from=${t}`);i+=t;for(;i>=r;i-=r)l.push((n>>i-r&a)>>>0);let d=Sf[i];if(d===void 0)throw Error("invalid carry");n&=d-1}if(n=n<<r-i&a,!o&&i>=t)throw Error("Excess padding");if(!o&&n>0)throw Error(`Non-zero padding: ${n}`);if(o&&i>0)l.push(n>>>0);return l}function _J(e){Xl(e);let t=256;return{encode:(r)=>{if(!_f(r))throw TypeError("radix.encode input should be Uint8Array");return zO(Array.from(r),t,e)},decode:(r)=>(nS("radix.decode",r),Uint8Array.from(zO(r,e,t)))}}function Jr(e,t=!1){if(Xl(e),e<=0||e>32)throw RangeError("radix2: bits should be in (0..32]");if(xf(8,e)>32||xf(e,8)>32)throw RangeError("radix2: carry overflow");return{encode:(r)=>{if(!_f(r))throw TypeError("radix2.encode input should be Uint8Array");return eS(Array.from(r),8,e,!t)},decode:(r)=>(nS("radix2.decode",r),Uint8Array.from(eS(r,e,8,t)))}}function NO(e){return jO(e),function(...t){try{return e.apply(null,t)}catch(r){}}}function Yl(e){let t=e>>25,r=(e&33554431)<<5;for(let o=0;o<DO.length;o++)if((t>>o&1)===1)r^=DO[o];return r}function LO(e,t,r=1){let o=e.length,n=1;for(let i=0;i<o;i++){let s=e.charCodeAt(i);if(s<33||s>126)throw Error(`Invalid prefix (${e})`);n=Yl(n)^s>>5}n=Yl(n);for(let i=0;i<o;i++)n=Yl(n)^e.charCodeAt(i)&31;for(let i of t)n=Yl(n)^i;for(let i=0;i<6;i++)n=Yl(n);return n^=r,tS.encode(eS([n%Sf[30]],30,5,!1))}function FO(e){let t=e==="bech32"?1:734539939,r=Jr(5),o=r.decode,n=r.encode,i=NO(o);function s(p,m,h=90){if(ri("bech32.encode prefix",p),_f(m))m=Array.from(m);nS("bech32.encode",m);let b=p.length;if(b===0)throw TypeError(`Invalid prefix length ${b}`);let y=b+7+m.length;if(h!==!1&&y>h)throw TypeError(`Length ${y} exceeds limit ${h}`);let v=p.toLowerCase(),x=LO(v,m,t);return`${v}1${tS.encode(m)}${x}`}function a(p,m=90){ri("bech32.decode input",p);let h=p.length;if(h<8||m!==!1&&h>m)throw TypeError(`invalid string length: ${h} (${p}). Expected (8..${m})`);let b=p.toLowerCase();if(p!==b&&p!==p.toUpperCase())throw Error("String must be lowercase or uppercase");let y=b.lastIndexOf("1");if(y===0||y===-1)throw Error('Letter "1" must be present between prefix and data only');let v=b.slice(0,y),x=b.slice(y+1);if(x.length<6)throw Error("Data must be at least 6 characters long");let _=tS.decode(x).slice(0,-6),k=LO(v,_,t);if(!x.endsWith(k))throw Error(`Invalid checksum in ${p}: expected "${k}"`);return{prefix:v,words:_}}let l=NO(a);function u(p){let{prefix:m,words:h}=a(p,!1);return{prefix:m,words:h,bytes:o(h)}}function d(p,m){return s(p,n(m))}return{encode:s,decode:a,encodeFromBytes:d,decodeToBytes:u,decodeUnsafe:l,fromWords:o,fromWordsUnsafe:i,toWords:n}}var UO=(e,t)=>t===0?e:UO(t,e%t),xf=(e,t)=>e+(t-UO(e,t)),Sf,jye,Bye,Uye,Mye,qye,Fye,MO,EJ,qO=(e,t)=>{ri("base64",e);let r=t?"base64url":"base64";if(e.length>0&&EJ.test(e))throw Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},oS,Yt,Hye,Jye,iS=(e)=>Cr(_J(58),Pr(e),zr("")),Kye,Vye,Wye,tS,DO,Nr,Gye,IJ,AJ,Qye;var eu=S(()=>{/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */Sf=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();jye=Object.freeze(Cr(Jr(4),Pr("0123456789ABCDEF"),zr(""))),Bye=Object.freeze(Cr(Jr(5),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Ef(5),zr(""))),Uye=Object.freeze(Cr(Jr(5),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),zr(""))),Mye=Object.freeze(Cr(Jr(5),Pr("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Ef(5),zr(""))),qye=Object.freeze(Cr(Jr(5),Pr("0123456789ABCDEFGHIJKLMNOPQRSTUV"),zr(""))),Fye=Object.freeze(Cr(Jr(5),Pr("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),zr(""),BO((e)=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),MO=(()=>typeof Uint8Array.from([]).toBase64==="function"&&typeof Uint8Array.fromBase64==="function")(),EJ=/[\t\n\f\r ]/,oS=Object.freeze(MO?{encode(e){return rS(e),e.toBase64()},decode(e){return qO(e,!1)}}:Cr(Jr(6),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Ef(6),zr(""))),Yt=Object.freeze(Cr(Jr(6),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),zr(""))),Hye=Object.freeze(MO?{encode(e){return rS(e),e.toBase64({alphabet:"base64url"})},decode(e){return qO(e,!0)}}:Cr(Jr(6),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Ef(6),zr(""))),Jye=Object.freeze(Cr(Jr(6),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),zr(""))),Kye=Object.freeze(iS("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")),Vye=Object.freeze(iS("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ")),Wye=Object.freeze(iS("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz")),tS=Cr(Pr("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),zr("")),DO=[996825010,642813549,513874426,1027748829,705979059];Nr=Object.freeze(FO("bech32")),Gye=Object.freeze(FO("bech32m")),IJ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),AJ={encode(e){return rS(e),e.toHex()},decode(e){return ri("hex",e),Uint8Array.fromHex(e)}},Qye=Object.freeze(IJ?AJ:Cr(Jr(4),Pr("0123456789abcdef"),zr(""),BO((e)=>{if(typeof e!=="string"||e.length%2!==0)throw TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})))});function RJ(e,t,r,o){po(e);let n=hf({dkLen:32,asyncTick:10},o),{c:i,dkLen:s,asyncTick:a}=n;if(St(i,"c"),St(s,"dkLen"),St(a,"asyncTick"),i<1)throw Error("iterations (c) must be >= 1");if(s<1)throw Error('"dkLen" must be >= 1');if(s>4294967295*e.outputLen)throw Error("derived key too long");let l=Fb(t,"password"),u=Fb(r,"salt"),d=new Uint8Array(s),p=Pn.create(e,l),m=p._cloneInto().update(u);return{c:i,dkLen:s,asyncTick:a,DK:d,PRF:p,PRFSalt:m}}function TJ(e,t,r,o,n){if(e.destroy(),t.destroy(),o)o.destroy();return cr(n),r}function sS(e,t,r,o){let{c:n,dkLen:i,DK:s,PRF:a,PRFSalt:l}=RJ(e,t,r,o),u,d=new Uint8Array(4),p=ka(d),m=new Uint8Array(a.outputLen);for(let h=1,b=0;b<i;h++,b+=a.outputLen){let y=s.subarray(b,b+a.outputLen);p.setInt32(0,h,!1),(u=l._cloneInto(u)).update(d).digestInto(m),y.set(m.subarray(0,y.length));for(let v=1;v<n;v++){a._cloneInto(u).update(m).digestInto(m);for(let x=0;x<y.length;x++)y[x]^=m[x]}}return TJ(a,l,s,u,m)}var HO=S(()=>{Vl();Hr()});function JO(e,t,r,o,n,i){let s=e[t++]^r[o++],a=e[t++]^r[o++],l=e[t++]^r[o++],u=e[t++]^r[o++],d=e[t++]^r[o++],p=e[t++]^r[o++],m=e[t++]^r[o++],h=e[t++]^r[o++],b=e[t++]^r[o++],y=e[t++]^r[o++],v=e[t++]^r[o++],x=e[t++]^r[o++],_=e[t++]^r[o++],k=e[t++]^r[o++],O=e[t++]^r[o++],L=e[t++]^r[o++],z=s,J=a,P=l,W=u,ee=d,j=p,T=m,Z=h,I=b,R=y,A=v,q=x,N=_,K=k,G=O,re=L;for(let ae=0;ae<8;ae+=2)ee^=Fe(z+N|0,7),I^=Fe(ee+z|0,9),N^=Fe(I+ee|0,13),z^=Fe(N+I|0,18),R^=Fe(j+J|0,7),K^=Fe(R+j|0,9),J^=Fe(K+R|0,13),j^=Fe(J+K|0,18),G^=Fe(A+T|0,7),P^=Fe(G+A|0,9),T^=Fe(P+G|0,13),A^=Fe(T+P|0,18),W^=Fe(re+q|0,7),Z^=Fe(W+re|0,9),q^=Fe(Z+W|0,13),re^=Fe(q+Z|0,18),J^=Fe(z+W|0,7),P^=Fe(J+z|0,9),W^=Fe(P+J|0,13),z^=Fe(W+P|0,18),T^=Fe(j+ee|0,7),Z^=Fe(T+j|0,9),ee^=Fe(Z+T|0,13),j^=Fe(ee+Z|0,18),q^=Fe(A+R|0,7),I^=Fe(q+A|0,9),R^=Fe(I+q|0,13),A^=Fe(R+I|0,18),N^=Fe(re+G|0,7),K^=Fe(N+re|0,9),G^=Fe(K+N|0,13),re^=Fe(G+K|0,18);n[i++]=s+z|0,n[i++]=a+J|0,n[i++]=l+P|0,n[i++]=u+W|0,n[i++]=d+ee|0,n[i++]=p+j|0,n[i++]=m+T|0,n[i++]=h+Z|0,n[i++]=b+I|0,n[i++]=y+R|0,n[i++]=v+A|0,n[i++]=x+q|0,n[i++]=_+N|0,n[i++]=k+K|0,n[i++]=O+G|0,n[i++]=L+re|0}function aS(e,t,r,o,n){let i=o+0,s=o+16*n;for(let a=0;a<16;a++)r[s+a]=e[t+(2*n-1)*16+a];for(let a=0;a<n;a++,i+=16,t+=16){if(JO(r,s,e,t,r,i),a>0)s+=16;JO(r,i,e,t+=16,r,s)}}function $J(e,t,r){let o=hf({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:n,r:i,p:s,dkLen:a,asyncTick:l,maxmem:u,onProgress:d}=o;if(St(n,"N"),St(i,"r"),St(s,"p"),St(a,"dkLen"),St(l,"asyncTick"),St(u,"maxmem"),d!==void 0&&typeof d!=="function")throw Error("progressCb must be a function");let p=128*i,m=p/4,h=Math.pow(2,32);if(n<=1||(n&n-1)!==0||n>h)throw Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');if(s<1||s>(h-1)*32/p)throw Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');if(a<1||a>(h-1)*32)throw Error('"dkLen" expected integer 1..(2^32 - 1) * 32');let b=p*(n+s+1);if(b>u)throw Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))='+b+", maxmem="+u);let y=sS(vt,e,t,{c:1,dkLen:p*s}),v=ff(y),x=ff(new Uint8Array(p*n)),_=ff(new Uint8Array(p)),k=()=>{};if(d){let O=2*n*s,L=Math.max(Math.floor(O/1e4),1),z=0;k=()=>{if(z++,d&&(!(z%L)||z===O))d(z/O)}}return{N:n,r:i,p:s,dkLen:a,blockSize32:m,V:x,B32:v,B:y,tmp:_,blockMixCb:k,asyncTick:l}}function OJ(e,t,r,o,n){let i=sS(vt,e,r,{c:1,dkLen:t});return cr(r,o,n),i}function cS(e,t,r){let{N:o,r:n,p:i,dkLen:s,blockSize32:a,V:l,B32:u,B:d,tmp:p,blockMixCb:m}=$J(e,t,r);qb(u);for(let h=0;h<i;h++){let b=a*h;for(let y=0;y<a;y++)l[y]=u[b+y];for(let y=0,v=0;y<o-1;y++)aS(l,v,l,v+=a,n),m();aS(l,(o-1)*a,u,b,n),m();for(let y=0;y<o;y++){let v=(u[b+a-16]&o-1)>>>0;for(let x=0;x<a;x++)p[x]=u[b+x]^l[v*a+x];aS(p,0,u,b,n),m()}}return qb(u),OJ(e,s,d,l,p)}var KO=S(()=>{HO();Ra();Hr()});function CJ(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function If(e){if(typeof e!=="boolean")throw TypeError(`boolean expected, not ${e}`)}function Ta(e){if(typeof e!=="number")throw TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError("positive integer expected, got "+e)}function $t(e,t,r=""){let o=CJ(e),n=e?.length,i=t!==void 0;if(!o||i&&n!==t){let s=r&&`"${r}" `,a=i?` of length ${t}`:"",l=o?`length=${n}`:`type=${typeof e}`,u=s+"expected Uint8Array"+a+", got "+l;if(!o)throw TypeError(u);throw RangeError(u)}return e}function lS(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function VO(e,t,r=!1){$t(e,void 0,"output");let o=t.outputLen;if(e.length<o)throw RangeError("digestInto() expects output buffer of length at least "+o);if(r&&!$a(e))throw Error("invalid output, must be aligned")}function Nn(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function un(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function PJ(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function WO(e,t){if(t==null||typeof t!=="object")throw Error("options must be defined");return Object.assign(e,t)}function GO(e,t){if(e.length!==t.length)return!1;let r=0;for(let o=0;o<e.length;o++)r|=e[o]^t[o];return r===0}function QO(e,t,r){let o=t,n=r||(()=>[]),i=(a,l)=>o(l,...n(a)).update(a).digest(),s=o(new Uint8Array(e),...n(new Uint8Array(0)));return i.outputLen=s.outputLen,i.blockLen=s.blockLen,i.create=(a,...l)=>o(a,...l),i}function tu(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if($t(t,void 0,"output"),t.length!==e)throw Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(r&&!$a(t))throw Error("invalid output, must be aligned");return t}function XO(e,t,r){Ta(e),Ta(t),If(r);let o=new Uint8Array(16),n=PJ(o);return n.setBigUint64(0,BigInt(t),r),n.setBigUint64(8,BigInt(e),r),o}function $a(e){return e.byteOffset%4===0}function Oa(e){return Uint8Array.from($t(e))}var hs,zJ=(e)=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,NJ=(e)=>{for(let t=0;t<e.length;t++)e[t]=zJ(e[t]);return e},ho,YO=(e,t)=>{function r(o,...n){if($t(o,void 0,"key"),e.nonceLength!==void 0){let d=n[0];$t(d,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let i=e.tagLength;if(i&&n[1]!==void 0)$t(n[1],void 0,"AAD");let s=t(o,...n),a=(d,p)=>{if(p!==void 0){if(d!==2)throw Error("cipher output not supported");$t(p,void 0,"output")}},l=!1;return{encrypt(d,p){if(l)throw Error("cannot encrypt() twice with same key + nonce");return l=!0,$t(d),a(s.encrypt.length,p),s.encrypt(d,p)},decrypt(d,p){if($t(d),i&&d.length<i)throw Error('"ciphertext" expected length bigger than tagLength='+i);return a(s.decrypt.length,p),s.decrypt(d,p)}}}return Object.assign(r,e),r};var Af=S(()=>{/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */hs=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),ho=hs?(e)=>e:NJ});function He(e,t){return e<<t|e>>>32-t}function jJ(e,t,r,o,n,i,s,a){let l=n.length,u=new Uint8Array(ru),d=Nn(u),p=hs&&$a(n)&&$a(i),m=p?Nn(n):eC,h=p?Nn(i):eC;if(!hs){for(let b=0;b<l;s++){if(e(t,r,o,d,s,a),ho(d),s>=uS)throw Error("arx: counter overflow");let y=Math.min(ru,l-b);for(let v=0,x;v<y;v++)x=b+v,i[x]=n[x]^u[v];b+=y}return}for(let b=0;b<l;s++){if(e(t,r,o,d,s,a),s>=uS)throw Error("arx: counter overflow");let y=Math.min(ru,l-b);if(p&&y===ru){let v=b/4;if(b%4!==0)throw Error("arx: invalid block position");for(let x=0,_;x<ZJ;x++)_=v+x,h[_]=m[_]^d[x];b+=ru;continue}for(let v=0,x;v<y;v++)x=b+v,i[x]=n[x]^u[v];b+=y}}function rC(e,t){let{allowShortKeys:r,extendNonceFn:o,counterLength:n,counterRight:i,rounds:s}=WO({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!=="function")throw Error("core must be a function");return Ta(n),Ta(s),If(i),If(r),(a,l,u,d,p=0)=>{$t(a,void 0,"key"),$t(l,void 0,"nonce"),$t(u,void 0,"data");let m=u.length;if(d=tu(m,d,!1),Ta(p),p<0||p>=uS)throw Error("arx: counter overflow");let h=[],b=a.length,y,v;if(b===32)h.push(y=Oa(a)),v=LJ;else if(b===16&&r)y=new Uint8Array(32),y.set(a),y.set(a,16),v=DJ,h.push(y);else throw $t(a,32,"arx key"),Error("invalid key size");if(!hs||!$a(l))h.push(l=Oa(l));let x=Nn(y);if(o){if(l.length!==24)throw Error("arx: extended nonce must be 24 bytes");let O=l.subarray(0,16);if(hs)o(v,x,Nn(O),x);else{let L=ho(Uint32Array.from(v));o(L,x,Nn(O),x),un(L),ho(x)}l=l.subarray(16)}else if(!hs)ho(x);let _=16-n;if(_!==l.length)throw Error(`arx: nonce must be ${_} or 16 bytes`);if(_!==12){let O=new Uint8Array(12);O.set(l,i?0:12-l.length),l=O,h.push(l)}let k=ho(Nn(l));try{return jJ(e,v,x,k,u,d,p,s),d}finally{un(...h)}}}var tC=(e)=>Uint8Array.from(e.split(""),(t)=>t.charCodeAt(0)),DJ,LJ,ru=64,ZJ=16,uS,eC;var nC=S(()=>{Af();DJ=(()=>ho(Nn(tC("expand 16-byte k"))))(),LJ=(()=>ho(Nn(tC("expand 32-byte k"))))();uS=(()=>4294967295)(),eC=Uint32Array.of()});function Ft(e,t){return e[t++]&255|(e[t++]&255)<<8}class oC{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(e){e=Oa($t(e,32,"key"));let t=Ft(e,0),r=Ft(e,2),o=Ft(e,4),n=Ft(e,6),i=Ft(e,8),s=Ft(e,10),a=Ft(e,12),l=Ft(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|n<<9)&8191,this.r[4]=(n>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|s<<2)&8191,this.r[7]=(s>>>11|a<<5)&8065,this.r[8]=(a>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Ft(e,16+2*u)}process(e,t,r=!1){let o=r?0:2048,{h:n,r:i}=this,s=i[0],a=i[1],l=i[2],u=i[3],d=i[4],p=i[5],m=i[6],h=i[7],b=i[8],y=i[9],v=Ft(e,t+0),x=Ft(e,t+2),_=Ft(e,t+4),k=Ft(e,t+6),O=Ft(e,t+8),L=Ft(e,t+10),z=Ft(e,t+12),J=Ft(e,t+14),P=n[0]+(v&8191),W=n[1]+((v>>>13|x<<3)&8191),ee=n[2]+((x>>>10|_<<6)&8191),j=n[3]+((_>>>7|k<<9)&8191),T=n[4]+((k>>>4|O<<12)&8191),Z=n[5]+(O>>>1&8191),I=n[6]+((O>>>14|L<<2)&8191),R=n[7]+((L>>>11|z<<5)&8191),A=n[8]+((z>>>8|J<<8)&8191),q=n[9]+(J>>>5|o),N=0,K=N+P*s+W*(5*y)+ee*(5*b)+j*(5*h)+T*(5*m);N=K>>>13,K&=8191,K+=Z*(5*p)+I*(5*d)+R*(5*u)+A*(5*l)+q*(5*a),N+=K>>>13,K&=8191;let G=N+P*a+W*s+ee*(5*y)+j*(5*b)+T*(5*h);N=G>>>13,G&=8191,G+=Z*(5*m)+I*(5*p)+R*(5*d)+A*(5*u)+q*(5*l),N+=G>>>13,G&=8191;let re=N+P*l+W*a+ee*s+j*(5*y)+T*(5*b);N=re>>>13,re&=8191,re+=Z*(5*h)+I*(5*m)+R*(5*p)+A*(5*d)+q*(5*u),N+=re>>>13,re&=8191;let ae=N+P*u+W*l+ee*a+j*s+T*(5*y);N=ae>>>13,ae&=8191,ae+=Z*(5*b)+I*(5*h)+R*(5*m)+A*(5*p)+q*(5*d),N+=ae>>>13,ae&=8191;let me=N+P*d+W*u+ee*l+j*a+T*s;N=me>>>13,me&=8191,me+=Z*(5*y)+I*(5*b)+R*(5*h)+A*(5*m)+q*(5*p),N+=me>>>13,me&=8191;let Se=N+P*p+W*d+ee*u+j*l+T*a;N=Se>>>13,Se&=8191,Se+=Z*s+I*(5*y)+R*(5*b)+A*(5*h)+q*(5*m),N+=Se>>>13,Se&=8191;let xe=N+P*m+W*p+ee*d+j*u+T*l;N=xe>>>13,xe&=8191,xe+=Z*a+I*s+R*(5*y)+A*(5*b)+q*(5*h),N+=xe>>>13,xe&=8191;let ke=N+P*h+W*m+ee*p+j*d+T*u;N=ke>>>13,ke&=8191,ke+=Z*l+I*a+R*s+A*(5*y)+q*(5*b),N+=ke>>>13,ke&=8191;let Ae=N+P*b+W*h+ee*m+j*p+T*d;N=Ae>>>13,Ae&=8191,Ae+=Z*u+I*l+R*a+A*s+q*(5*y),N+=Ae>>>13,Ae&=8191;let _e=N+P*y+W*b+ee*h+j*m+T*p;N=_e>>>13,_e&=8191,_e+=Z*d+I*u+R*l+A*a+q*s,N+=_e>>>13,_e&=8191,N=(N<<2)+N|0,N=N+K|0,K=N&8191,N=N>>>13,G+=N,n[0]=K,n[1]=G,n[2]=re,n[3]=ae,n[4]=me,n[5]=Se,n[6]=xe,n[7]=ke,n[8]=Ae,n[9]=_e}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),o=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=o,o=e[s]>>>13,e[s]&=8191;e[0]+=o*5,o=e[0]>>>13,e[0]&=8191,e[1]+=o,o=e[1]>>>13,e[1]&=8191,e[2]+=o,r[0]=e[0]+5,o=r[0]>>>13,r[0]&=8191;for(let s=1;s<10;s++)r[s]=e[s]+o,o=r[s]>>>13,r[s]&=8191;r[9]-=8192;let n=(o^1)-1;for(let s=0;s<10;s++)r[s]&=n;n=~n;for(let s=0;s<10;s++)e[s]=e[s]&n|r[s];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let i=e[0]+t[0];e[0]=i&65535;for(let s=1;s<8;s++)i=(e[s]+t[s]|0)+(i>>>16)|0,e[s]=i&65535;un(r)}update(e){lS(this),$t(e),e=Oa(e);let{buffer:t,blockLen:r}=this,o=e.length;for(let n=0;n<o;){let i=Math.min(r-this.pos,o-n);if(i===r){for(;r<=o-n;n+=r)this.process(e,n);continue}if(t.set(e.subarray(n,n+i),this.pos),this.pos+=i,n+=i,this.pos===r)this.process(t,0,!1),this.pos=0}return this}destroy(){this.destroyed=!0,un(this.h,this.r,this.buffer,this.pad)}digestInto(e){lS(this),VO(e,this),this.finished=!0;let{buffer:t,h:r}=this,{pos:o}=this;if(o){t[o++]=1;for(;o<16;o++)t[o]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let i=0;i<8;i++)e[n++]=r[i]>>>0,e[n++]=r[i]>>>8}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}var iC;var sC=S(()=>{Af();iC=QO(32,(e)=>new oC(e))});function BJ(e,t,r,o,n,i=20){let s=e[0],a=e[1],l=e[2],u=e[3],d=t[0],p=t[1],m=t[2],h=t[3],b=t[4],y=t[5],v=t[6],x=t[7],_=n,k=r[0],O=r[1],L=r[2],z=s,J=a,P=l,W=u,ee=d,j=p,T=m,Z=h,I=b,R=y,A=v,q=x,N=_,K=k,G=O,re=L;for(let me=0;me<i;me+=2)z=z+ee|0,N=He(N^z,16),I=I+N|0,ee=He(ee^I,12),z=z+ee|0,N=He(N^z,8),I=I+N|0,ee=He(ee^I,7),J=J+j|0,K=He(K^J,16),R=R+K|0,j=He(j^R,12),J=J+j|0,K=He(K^J,8),R=R+K|0,j=He(j^R,7),P=P+T|0,G=He(G^P,16),A=A+G|0,T=He(T^A,12),P=P+T|0,G=He(G^P,8),A=A+G|0,T=He(T^A,7),W=W+Z|0,re=He(re^W,16),q=q+re|0,Z=He(Z^q,12),W=W+Z|0,re=He(re^W,8),q=q+re|0,Z=He(Z^q,7),z=z+j|0,re=He(re^z,16),A=A+re|0,j=He(j^A,12),z=z+j|0,re=He(re^z,8),A=A+re|0,j=He(j^A,7),J=J+T|0,N=He(N^J,16),q=q+N|0,T=He(T^q,12),J=J+T|0,N=He(N^J,8),q=q+N|0,T=He(T^q,7),P=P+Z|0,K=He(K^P,16),I=I+K|0,Z=He(Z^I,12),P=P+Z|0,K=He(K^P,8),I=I+K|0,Z=He(Z^I,7),W=W+ee|0,G=He(G^W,16),R=R+G|0,ee=He(ee^R,12),W=W+ee|0,G=He(G^W,8),R=R+G|0,ee=He(ee^R,7);let ae=0;o[ae++]=s+z|0,o[ae++]=a+J|0,o[ae++]=l+P|0,o[ae++]=u+W|0,o[ae++]=d+ee|0,o[ae++]=p+j|0,o[ae++]=m+T|0,o[ae++]=h+Z|0,o[ae++]=b+I|0,o[ae++]=y+R|0,o[ae++]=v+A|0,o[ae++]=x+q|0,o[ae++]=_+N|0,o[ae++]=k+K|0,o[ae++]=O+G|0,o[ae++]=L+re|0}function cC(e,t,r,o,n){if(n!==void 0)$t(n,void 0,"AAD");let i=e(t,r,qJ),s=XO(o.length,n?n.length:0,!0),a=iC.create(i);if(n)aC(a,n);aC(a,o),a.update(s);let l=a.digest();return un(i,s),l}var UJ,MJ,aC=(e,t)=>{e.update(t);let r=t.length%16;if(r)e.update(MJ.subarray(r))},qJ,FJ=(e)=>(t,r,o)=>({encrypt(i,s){let a=i.length;s=tu(a+16,s,!1),s.set(i);let l=s.subarray(0,-16);e(t,r,l,l,1);let u=cC(e,t,r,l,o);return s.set(u,a),un(u),s},decrypt(i,s){s=tu(i.length-16,s,!1);let a=i.subarray(0,-16),l=i.subarray(-16),u=cC(e,t,r,a,o);if(!GO(l,u))throw un(u),Error("invalid tag");return s.set(i.subarray(0,-16)),e(t,r,s,s,1),un(u),s}}),Kr;var dS=S(()=>{nC();sC();Af();UJ=rC(BJ,{counterRight:!1,counterLength:4,allowShortKeys:!1}),MJ=new Uint8Array(16),qJ=new Uint8Array(32);Kr=YO({blockSize:64,nonceLength:12,tagLength:16},FJ(UJ))});function Ca(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zt(e,t=""){if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw Error(`${r}expected integer >= 0, got ${e}`)}}function Re(e,t,r=""){let o=Ca(e),n=e?.length,i=t!==void 0;if(!o||i&&n!==t){let s=r&&`"${r}" `,a=i?` of length ${t}`:"",l=o?`length=${n}`:`type=${typeof e}`;throw Error(s+"expected Uint8Array"+a+", got "+l)}return e}function Vr(e){if(typeof e!=="function"||typeof e.create!=="function")throw Error("Hash must wrapped by utils.createHasher");Zt(e.outputLen),Zt(e.blockLen)}function yo(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function kf(e,t){Re(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw Error('"digestInto() output" expected to be of length >='+r)}function Rf(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function wr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Tf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function dn(e,t){return e<<32-t|e>>>t}function JJ(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function KJ(e){for(let t=0;t<e.length;t++)e[t]=JJ(e[t]);return e}function gs(e){if(Re(e),uC)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=VJ[e[r]];return t}function lC(e){if(e>=go._0&&e<=go._9)return e-go._0;if(e>=go.A&&e<=go.F)return e-(go.A-10);if(e>=go.a&&e<=go.f)return e-(go.a-10);return}function ys(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);if(uC)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let o=new Uint8Array(r);for(let n=0,i=0;n<r;n++,i+=2){let s=lC(e.charCodeAt(i)),a=lC(e.charCodeAt(i+1));if(s===void 0||a===void 0){let l=e[i]+e[i+1];throw Error('hex string expected, got non-hex character "'+l+'" at index '+i)}o[n]=s*16+a}return o}function It(...e){let t=0;for(let o=0;o<e.length;o++){let n=e[o];Re(n),t+=n.length}let r=new Uint8Array(t);for(let o=0,n=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return r}function Pa(e,t={}){let r=(n,i)=>e(i).update(n).digest(),o=e(void 0);return r.outputLen=o.outputLen,r.blockLen=o.blockLen,r.create=(n)=>e(n),Object.assign(r,t),Object.freeze(r)}function ni(e=32){let t=typeof globalThis==="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!=="function")throw Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}var HJ,pS,uC,VJ,go,oi=(e)=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Dr=S(()=>{/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */HJ=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();pS=HJ?(e)=>e:KJ,uC=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),VJ=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));go={_0:48,_9:57,A:65,F:70,a:97,f:102}});function nu(e,t=""){if(typeof e!=="boolean"){let r=t&&`"${t}" `;throw Error(r+"expected boolean, got type="+typeof e)}return e}function dC(e){if(typeof e==="bigint"){if(!$f(e))throw Error("positive bigint expected, got "+e)}else Zt(e);return e}function ou(e){let t=dC(e).toString(16);return t.length&1?"0"+t:t}function pC(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);return e===""?mS:BigInt("0x"+e)}function ii(e){return pC(gs(e))}function si(e){return pC(gs(Of(Re(e)).reverse()))}function za(e,t){Zt(t),e=dC(e);let r=ys(e.toString(16).padStart(t*2,"0"));if(r.length!==t)throw Error("number too large");return r}function iu(e,t){return za(e,t).reverse()}function Of(e){return Uint8Array.from(e)}function ai(e){return Uint8Array.from(e,(t,r)=>{let o=t.charCodeAt(0);if(t.length!==1||o>127)throw Error(`string contains non-ASCII character "${e[r]}" with code ${o} at position ${r}`);return o})}function WJ(e,t,r){return $f(e)&&$f(t)&&$f(r)&&t<=e&&e<r}function su(e,t,r,o){if(!WJ(t,r,o))throw Error("expected valid "+e+": "+r+" <= n < "+o+", got "+t)}function hS(e){let t;for(t=0;e>mS;e>>=fS,t+=1);return t}function fC(e,t,r){if(Zt(e,"hashLen"),Zt(t,"qByteLen"),typeof r!=="function")throw Error("hmacFn must be a function");let o=(v)=>new Uint8Array(v),n=Uint8Array.of(),i=Uint8Array.of(0),s=Uint8Array.of(1),a=1000,l=o(e),u=o(e),d=0,p=()=>{l.fill(1),u.fill(0),d=0},m=(...v)=>r(u,It(l,...v)),h=(v=n)=>{if(u=m(i,v),l=m(),v.length===0)return;u=m(s,v),l=m()},b=()=>{if(d++>=a)throw Error("drbg: tried max amount of iterations");let v=0,x=[];while(v<t){l=m();let _=l.slice();x.push(_),v+=l.length}return It(...x)};return(v,x)=>{p(),h(v);let _=void 0;while(!(_=x(b())))h();return p(),_}}function bs(e,t={},r={}){if(!e||typeof e!=="object")throw Error("expected valid options object");function o(i,s,a){let l=e[i];if(a&&l===void 0)return;let u=typeof l;if(u!==s||l===null)throw Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}let n=(i,s)=>Object.entries(i).forEach(([a,l])=>o(a,l,s));n(t,!1),n(r,!0)}function gS(e){let t=new WeakMap;return(r,...o)=>{let n=t.get(r);if(n!==void 0)return n;let i=e(r,...o);return t.set(r,i),i}}var mS,fS,$f=(e)=>typeof e==="bigint"&&mS<=e,au=(e)=>(fS<<BigInt(e))-fS;var Na=S(()=>{Dr();Dr();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */mS=BigInt(0),fS=BigInt(1)});function lr(e,t){let r=e%t;return r>=ur?r:t+r}function Wr(e,t,r){let o=e;while(t-- >ur)o*=o,o%=r;return o}function mC(e,t){if(e===ur)throw Error("invert: expected non-zero number");if(t<=ur)throw Error("invert: expected positive modulus, got "+t);let r=lr(e,t),o=t,n=ur,i=Xt,s=Xt,a=ur;while(r!==ur){let u=o/r,d=o%r,p=n-s*u,m=i-a*u;o=r,r=d,n=s,i=a,s=p,a=m}if(o!==Xt)throw Error("invert: does not exist");return lr(n,t)}function yS(e,t,r){if(!e.eql(e.sqr(t),r))throw Error("Cannot find square root")}function wC(e,t){let r=(e.ORDER+Xt)/yC,o=e.pow(t,r);return yS(e,o,t),o}function YJ(e,t){let r=(e.ORDER-bC)/SC,o=e.mul(t,Ss),n=e.pow(o,r),i=e.mul(t,n),s=e.mul(e.mul(i,Ss),n),a=e.mul(i,e.sub(s,e.ONE));return yS(e,a,t),a}function XJ(e){let t=Cf(e),r=xC(e),o=r(t,t.neg(t.ONE)),n=r(t,o),i=r(t,t.neg(o)),s=(e+GJ)/vC;return(a,l)=>{let u=a.pow(l,s),d=a.mul(u,o),p=a.mul(u,n),m=a.mul(u,i),h=a.eql(a.sqr(d),l),b=a.eql(a.sqr(p),l);u=a.cmov(u,d,h),d=a.cmov(m,p,b);let y=a.eql(a.sqr(d),l),v=a.cmov(u,d,y);return yS(a,v,l),v}}function xC(e){if(e<gC)throw Error("sqrt is not defined for small field");let t=e-Xt,r=0;while(t%Ss===ur)t/=Ss,r++;let o=Ss,n=Cf(e);while(hC(n,o)===1)if(o++>1000)throw Error("Cannot find square root: probably non-prime P");if(r===1)return wC;let i=n.pow(o,t),s=(t+Xt)/Ss;return function(l,u){if(l.is0(u))return u;if(hC(l,u)!==1)throw Error("Cannot find square root");let d=r,p=l.mul(l.ONE,i),m=l.pow(u,t),h=l.pow(u,s);while(!l.eql(m,l.ONE)){if(l.is0(m))return l.ZERO;let b=1,y=l.sqr(m);while(!l.eql(y,l.ONE))if(b++,y=l.sqr(y),b===d)throw Error("Cannot find square root");let v=Xt<<BigInt(d-b-1),x=l.pow(p,v);d=b,p=l.sqr(x),m=l.mul(m,p),h=l.mul(h,x)}return h}}function eK(e){if(e%yC===gC)return wC;if(e%SC===bC)return YJ;if(e%vC===QJ)return XJ(e);return xC(e)}function bS(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=tK.reduce((o,n)=>(o[n]="function",o),t);return bs(e,r),e}function rK(e,t,r){if(r<ur)throw Error("invalid exponent, negatives unsupported");if(r===ur)return e.ONE;if(r===Xt)return t;let o=e.ONE,n=t;while(r>ur){if(r&Xt)o=e.mul(o,n);n=e.sqr(n),r>>=Xt}return o}function cu(e,t,r=!1){let o=Array(t.length).fill(r?e.ZERO:void 0),n=t.reduce((s,a,l)=>{if(e.is0(a))return s;return o[l]=s,e.mul(s,a)},e.ONE),i=e.inv(n);return t.reduceRight((s,a,l)=>{if(e.is0(a))return s;return o[l]=e.mul(s,o[l]),e.mul(s,a)},i),o}function hC(e,t){let r=(e.ORDER-Xt)/Ss,o=e.pow(t,r),n=e.eql(o,e.ONE),i=e.eql(o,e.ZERO),s=e.eql(o,e.neg(e.ONE));if(!n&&!i&&!s)throw Error("invalid Legendre symbol result");return n?1:i?0:-1}function nK(e,t){if(t!==void 0)Zt(t);let r=t!==void 0?t:e.toString(2).length,o=Math.ceil(r/8);return{nBitLength:r,nByteLength:o}}class _C{ORDER;BITS;BYTES;isLE;ZERO=ur;ONE=Xt;_lengths;_sqrt;_mod;constructor(e,t={}){if(e<=ur)throw Error("invalid field: expected ORDER > 0, got "+e);let r=void 0;if(this.isLE=!1,t!=null&&typeof t==="object"){if(typeof t.BITS==="number")r=t.BITS;if(typeof t.sqrt==="function")this.sqrt=t.sqrt;if(typeof t.isLE==="boolean")this.isLE=t.isLE;if(t.allowedLengths)this._lengths=t.allowedLengths?.slice();if(typeof t.modFromBytes==="boolean")this._mod=t.modFromBytes}let{nBitLength:o,nByteLength:n}=nK(e,r);if(n>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=o,this.BYTES=n,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return lr(e,this.ORDER)}isValid(e){if(typeof e!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof e);return ur<=e&&e<this.ORDER}is0(e){return e===ur}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&Xt)===Xt}neg(e){return lr(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return lr(e*e,this.ORDER)}add(e,t){return lr(e+t,this.ORDER)}sub(e,t){return lr(e-t,this.ORDER)}mul(e,t){return lr(e*t,this.ORDER)}pow(e,t){return rK(this,e,t)}div(e,t){return lr(e*mC(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return mC(e,this.ORDER)}sqrt(e){if(!this._sqrt)this._sqrt=eK(this.ORDER);return this._sqrt(this,e)}toBytes(e){return this.isLE?iu(e,this.BYTES):za(e,this.BYTES)}fromBytes(e,t=!1){Re(e);let{_lengths:r,BYTES:o,isLE:n,ORDER:i,_mod:s}=this;if(r){if(!r.includes(e.length)||e.length>o)throw Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);let l=new Uint8Array(o);l.set(e,n?0:l.length-e.length),e=l}if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);let a=n?si(e):ii(e);if(s)a=lr(a,i);if(!t){if(!this.isValid(a))throw Error("invalid field element: outside of range 0..ORDER")}return a}invertBatch(e){return cu(this,e)}cmov(e,t,r){return r?t:e}}function Cf(e,t={}){return new _C(e,t)}function EC(e){if(typeof e!=="bigint")throw Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function SS(e){let t=EC(e);return t+Math.ceil(t/2)}function IC(e,t,r=!1){Re(e);let o=e.length,n=EC(t),i=SS(t);if(o<16||o<i||o>1024)throw Error("expected "+i+"-1024 bytes of input, got "+o);let s=r?si(e):ii(e),a=lr(s,t-Xt)+Xt;return r?iu(a,n):za(a,n)}var ur,Xt,Ss,gC,yC,bC,GJ,SC,QJ,vC,tK;var lu=S(()=>{Na();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ur=BigInt(0),Xt=BigInt(1),Ss=BigInt(2),gC=BigInt(3),yC=BigInt(4),bC=BigInt(5),GJ=BigInt(7),SC=BigInt(8),QJ=BigInt(9),vC=BigInt(16);tK=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function uu(e,t){let r=t.negate();return e?r:t}function _S(e,t){let r=cu(e.Fp,t.map((o)=>o.Z));return t.map((o,n)=>e.fromAffine(o.toAffine(r[n])))}function TC(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function vS(e,t){TC(e,t);let r=Math.ceil(t/e)+1,o=2**(e-1),n=2**e,i=au(e),s=BigInt(e);return{windows:r,windowSize:o,mask:i,maxNumber:n,shiftBy:s}}function AC(e,t,r){let{windowSize:o,mask:n,maxNumber:i,shiftBy:s}=r,a=Number(e&n),l=e>>s;if(a>o)a-=i,l+=vs;let u=t*o,d=u+Math.abs(a)-1,p=a===0,m=a<0,h=t%2!==0;return{nextN:l,offset:d,isZero:p,isNeg:m,isNegF:h,offsetF:u}}function xS(e){return $C.get(e)||1}function kC(e){if(e!==Da)throw Error("invalid wNAF")}class ES{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let o=e;while(t>Da){if(t&vs)r=r.add(o);o=o.double(),t>>=vs}return r}precomputeWindow(e,t){let{windows:r,windowSize:o}=vS(t,this.bits),n=[],i=e,s=i;for(let a=0;a<r;a++){s=i,n.push(s);for(let l=1;l<o;l++)s=s.add(i),n.push(s);i=s.double()}return n}wNAF(e,t,r){if(!this.Fn.isValid(r))throw Error("invalid scalar");let o=this.ZERO,n=this.BASE,i=vS(e,this.bits);for(let s=0;s<i.windows;s++){let{nextN:a,offset:l,isZero:u,isNeg:d,isNegF:p,offsetF:m}=AC(r,s,i);if(r=a,u)n=n.add(uu(p,t[m]));else o=o.add(uu(d,t[l]))}return kC(r),{p:o,f:n}}wNAFUnsafe(e,t,r,o=this.ZERO){let n=vS(e,this.bits);for(let i=0;i<n.windows;i++){if(r===Da)break;let{nextN:s,offset:a,isZero:l,isNeg:u}=AC(r,i,n);if(r=s,l)continue;else{let d=t[a];o=o.add(u?d.negate():d)}}return kC(r),o}getPrecomputes(e,t,r){let o=wS.get(t);if(!o){if(o=this.precomputeWindow(t,e),e!==1){if(typeof r==="function")o=r(o);wS.set(t,o)}}return o}cached(e,t,r){let o=xS(e);return this.wNAF(o,this.getPrecomputes(o,e,r),t)}unsafe(e,t,r,o){let n=xS(e);if(n===1)return this._unsafeLadder(e,t,o);return this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,o)}createCache(e,t){TC(t,this.bits),$C.set(e,t),wS.delete(e)}hasCache(e){return xS(e)!==1}}function OC(e,t,r,o){let n=t,i=e.ZERO,s=e.ZERO;while(r>Da||o>Da){if(r&vs)i=i.add(n);if(o&vs)s=s.add(n);n=n.double(),r>>=vs,o>>=vs}return{p1:i,p2:s}}function RC(e,t,r){if(t){if(t.ORDER!==e)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return bS(t),t}else return Cf(e,{isLE:r})}function CC(e,t,r={},o){if(o===void 0)o=e==="edwards";if(!t||typeof t!=="object")throw Error(`expected valid ${e} CURVE object`);for(let l of["p","n","h"]){let u=t[l];if(!(typeof u==="bigint"&&u>Da))throw Error(`CURVE.${l} must be positive bigint`)}let n=RC(t.p,r.Fp,o),i=RC(t.n,r.Fn,o),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let l of a)if(!n.isValid(t[l]))throw Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:i}}function Pf(e,t){return function(o){let n=e(o);return{secretKey:n,publicKey:t(n)}}}var Da,vs,wS,$C;var IS=S(()=>{Na();lu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Da=BigInt(0),vs=BigInt(1);wS=new WeakMap,$C=new WeakMap});function oK(e){return bs(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function PC(e){let t=oK(e),{P:r,type:o,adjustScalarBytes:n,powPminus2:i,randomBytes:s}=t,a=o==="x25519";if(!a&&o!=="x448")throw Error("invalid type");let l=s||ni,u=a?255:448,d=a?32:56,p=a?BigInt(9):BigInt(5),m=a?BigInt(121665):BigInt(39081),h=a?zf**BigInt(254):zf**BigInt(447),b=a?BigInt(8)*zf**BigInt(251)-La:BigInt(4)*zf**BigInt(445)-La,y=h+b+La,v=(I)=>lr(I,r),x=_(p);function _(I){return iu(v(I),d)}function k(I){let R=Of(Re(I,d,"uCoordinate"));if(a)R[31]&=127;return v(si(R))}function O(I){return si(n(Of(Re(I,d,"scalar"))))}function L(I,R){let A=ee(k(R),O(I));if(A===du)throw Error("invalid private or public key received");return _(A)}function z(I){return L(I,x)}let J=z,P=L;function W(I,R,A){let q=v(I*(R-A));return R=v(R-q),A=v(A+q),{x_2:R,x_3:A}}function ee(I,R){su("u",I,du,r),su("scalar",R,h,y);let A=R,q=I,N=La,K=du,G=I,re=La,ae=du;for(let Se=BigInt(u-1);Se>=du;Se--){let xe=A>>Se&La;ae^=xe,{x_2:N,x_3:G}=W(ae,N,G),{x_2:K,x_3:re}=W(ae,K,re),ae=xe;let ke=N+K,Ae=v(ke*ke),_e=N-K,Ue=v(_e*_e),De=Ae-Ue,Qe=G+re,bt=G-re,Tt=v(bt*ke),Dt=v(Qe*_e),lt=Tt+Dt,Or=Tt-Dt;G=v(lt*lt),re=v(q*v(Or*Or)),N=v(Ae*Ue),K=v(De*(Ae+v(m*De)))}({x_2:N,x_3:G}=W(ae,N,G)),{x_2:K,x_3:re}=W(ae,K,re);let me=i(K);return v(N*me)}let j={secretKey:d,publicKey:d,seed:d},T=(I=l(d))=>(Re(I,j.seed,"seed"),I),Z={randomSecretKey:T};return Object.freeze({keygen:Pf(T,J),getSharedSecret:P,getPublicKey:J,scalarMult:L,scalarMultBase:z,utils:Z,GuBytes:x.slice(),lengths:j})}var du,La,zf;var zC=S(()=>{Na();IS();lu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */du=BigInt(0),La=BigInt(1),zf=BigInt(2)});class AS{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){if(Vr(e),Re(t,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,o=new Uint8Array(r);o.set(t.length>r?e.create().update(t).digest():t);for(let n=0;n<o.length;n++)o[n]^=54;this.iHash.update(o),this.oHash=e.create();for(let n=0;n<o.length;n++)o[n]^=106;this.oHash.update(o),wr(o)}update(e){return yo(this),this.iHash.update(e),this}digestInto(e){yo(this),Re(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:r,finished:o,destroyed:n,blockLen:i,outputLen:s}=this;return e=e,e.finished=o,e.destroyed=n,e.blockLen=i,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var Za=(e,t,r)=>new AS(e,t).update(r).digest();var kS=S(()=>{Dr();Za.create=(e,t)=>new AS(e,t)});function iK(e,t,r){let[[o,n],[i,s]]=t,a=NC(s*e,r),l=NC(-n*e,r),u=e-a*o-l*i,d=-a*n-l*s,p=u<bo,m=d<bo;if(p)u=-u;if(m)d=-d;let h=au(Math.ceil(hS(r)/2))+ja;if(u<bo||u>=h||d<bo||d>=h)throw Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:p,k1:u,k2neg:m,k2:d}}function TS(e){if(!["compact","recovered","der"].includes(e))throw Error('Signature format must be "compact", "recovered", or "der"');return e}function RS(e,t){let r={};for(let o of Object.keys(t))r[o]=e[o]===void 0?t[o]:e[o];if(nu(r.lowS,"lowS"),nu(r.prehash,"prehash"),r.format!==void 0)TS(r.format);return r}function $S(e,t={}){let r=CC("weierstrass",e,t),{Fp:o,Fn:n}=r,i=r.CURVE,{h:s,n:a}=i;bs(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:l}=t;if(l){if(!o.is0(i.a)||typeof l.beta!=="bigint"||!Array.isArray(l.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let u=jC(o,n);function d(){if(!o.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function p(T,Z,I){let{x:R,y:A}=Z.toAffine(),q=o.toBytes(R);if(nu(I,"isCompressed"),I){d();let N=!o.isOdd(A);return It(ZC(N),q)}else return It(Uint8Array.of(4),q,o.toBytes(A))}function m(T){Re(T,void 0,"Point");let{publicKey:Z,publicKeyUncompressed:I}=u,R=T.length,A=T[0],q=T.subarray(1);if(R===Z&&(A===2||A===3)){let N=o.fromBytes(q);if(!o.isValid(N))throw Error("bad point: is not on curve, wrong x");let K=y(N),G;try{G=o.sqrt(K)}catch(me){let Se=me instanceof Error?": "+me.message:"";throw Error("bad point: is not on curve, sqrt error"+Se)}d();let re=o.isOdd(G);if((A&1)===1!==re)G=o.neg(G);return{x:N,y:G}}else if(R===I&&A===4){let N=o.BYTES,K=o.fromBytes(q.subarray(0,N)),G=o.fromBytes(q.subarray(N,N*2));if(!v(K,G))throw Error("bad point: is not on curve");return{x:K,y:G}}else throw Error(`bad point: got length ${R}, expected compressed=${Z} or uncompressed=${I}`)}let h=t.toBytes||p,b=t.fromBytes||m;function y(T){let Z=o.sqr(T),I=o.mul(Z,T);return o.add(o.add(I,o.mul(T,i.a)),i.b)}function v(T,Z){let I=o.sqr(Z),R=y(T);return o.eql(I,R)}if(!v(i.Gx,i.Gy))throw Error("bad curve params: generator point");let x=o.mul(o.pow(i.a,Nf),sK),_=o.mul(o.sqr(i.b),BigInt(27));if(o.is0(o.add(x,_)))throw Error("bad curve params: a or b");function k(T,Z,I=!1){if(!o.isValid(Z)||I&&o.is0(Z))throw Error(`bad point coordinate ${T}`);return Z}function O(T){if(!(T instanceof W))throw Error("Weierstrass Point expected")}function L(T){if(!l||!l.basises)throw Error("no endo");return iK(T,l.basises,n.ORDER)}let z=gS((T,Z)=>{let{X:I,Y:R,Z:A}=T;if(o.eql(A,o.ONE))return{x:I,y:R};let q=T.is0();if(Z==null)Z=q?o.ONE:o.inv(A);let N=o.mul(I,Z),K=o.mul(R,Z),G=o.mul(A,Z);if(q)return{x:o.ZERO,y:o.ZERO};if(!o.eql(G,o.ONE))throw Error("invZ was invalid");return{x:N,y:K}}),J=gS((T)=>{if(T.is0()){if(t.allowInfinityPoint&&!o.is0(T.Y))return;throw Error("bad point: ZERO")}let{x:Z,y:I}=T.toAffine();if(!o.isValid(Z)||!o.isValid(I))throw Error("bad point: x or y not field elements");if(!v(Z,I))throw Error("bad point: equation left != right");if(!T.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function P(T,Z,I,R,A){return I=new W(o.mul(I.X,T),I.Y,I.Z),Z=uu(R,Z),I=uu(A,I),Z.add(I)}class W{static BASE=new W(i.Gx,i.Gy,o.ONE);static ZERO=new W(o.ZERO,o.ONE,o.ZERO);static Fp=o;static Fn=n;X;Y;Z;constructor(T,Z,I){this.X=k("x",T),this.Y=k("y",Z,!0),this.Z=k("z",I),Object.freeze(this)}static CURVE(){return i}static fromAffine(T){let{x:Z,y:I}=T||{};if(!T||!o.isValid(Z)||!o.isValid(I))throw Error("invalid affine point");if(T instanceof W)throw Error("projective point not allowed");if(o.is0(Z)&&o.is0(I))return W.ZERO;return new W(Z,I,o.ONE)}static fromBytes(T){let Z=W.fromAffine(b(Re(T,void 0,"point")));return Z.assertValidity(),Z}static fromHex(T){return W.fromBytes(ys(T))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(T=8,Z=!0){if(j.createCache(this,T),!Z)this.multiply(Nf);return this}assertValidity(){J(this)}hasEvenY(){let{y:T}=this.toAffine();if(!o.isOdd)throw Error("Field doesn't support isOdd");return!o.isOdd(T)}equals(T){O(T);let{X:Z,Y:I,Z:R}=this,{X:A,Y:q,Z:N}=T,K=o.eql(o.mul(Z,N),o.mul(A,R)),G=o.eql(o.mul(I,N),o.mul(q,R));return K&&G}negate(){return new W(this.X,o.neg(this.Y),this.Z)}double(){let{a:T,b:Z}=i,I=o.mul(Z,Nf),{X:R,Y:A,Z:q}=this,N=o.ZERO,K=o.ZERO,G=o.ZERO,re=o.mul(R,R),ae=o.mul(A,A),me=o.mul(q,q),Se=o.mul(R,A);return Se=o.add(Se,Se),G=o.mul(R,q),G=o.add(G,G),N=o.mul(T,G),K=o.mul(I,me),K=o.add(N,K),N=o.sub(ae,K),K=o.add(ae,K),K=o.mul(N,K),N=o.mul(Se,N),G=o.mul(I,G),me=o.mul(T,me),Se=o.sub(re,me),Se=o.mul(T,Se),Se=o.add(Se,G),G=o.add(re,re),re=o.add(G,re),re=o.add(re,me),re=o.mul(re,Se),K=o.add(K,re),me=o.mul(A,q),me=o.add(me,me),re=o.mul(me,Se),N=o.sub(N,re),G=o.mul(me,ae),G=o.add(G,G),G=o.add(G,G),new W(N,K,G)}add(T){O(T);let{X:Z,Y:I,Z:R}=this,{X:A,Y:q,Z:N}=T,K=o.ZERO,G=o.ZERO,re=o.ZERO,ae=i.a,me=o.mul(i.b,Nf),Se=o.mul(Z,A),xe=o.mul(I,q),ke=o.mul(R,N),Ae=o.add(Z,I),_e=o.add(A,q);Ae=o.mul(Ae,_e),_e=o.add(Se,xe),Ae=o.sub(Ae,_e),_e=o.add(Z,R);let Ue=o.add(A,N);return _e=o.mul(_e,Ue),Ue=o.add(Se,ke),_e=o.sub(_e,Ue),Ue=o.add(I,R),K=o.add(q,N),Ue=o.mul(Ue,K),K=o.add(xe,ke),Ue=o.sub(Ue,K),re=o.mul(ae,_e),K=o.mul(me,ke),re=o.add(K,re),K=o.sub(xe,re),re=o.add(xe,re),G=o.mul(K,re),xe=o.add(Se,Se),xe=o.add(xe,Se),ke=o.mul(ae,ke),_e=o.mul(me,_e),xe=o.add(xe,ke),ke=o.sub(Se,ke),ke=o.mul(ae,ke),_e=o.add(_e,ke),Se=o.mul(xe,_e),G=o.add(G,Se),Se=o.mul(Ue,_e),K=o.mul(Ae,K),K=o.sub(K,Se),Se=o.mul(Ae,xe),re=o.mul(Ue,re),re=o.add(re,Se),new W(K,G,re)}subtract(T){return this.add(T.negate())}is0(){return this.equals(W.ZERO)}multiply(T){let{endo:Z}=t;if(!n.isValidNot0(T))throw Error("invalid scalar: out of range");let I,R,A=(q)=>j.cached(this,q,(N)=>_S(W,N));if(Z){let{k1neg:q,k1:N,k2neg:K,k2:G}=L(T),{p:re,f:ae}=A(N),{p:me,f:Se}=A(G);R=ae.add(Se),I=P(Z.beta,re,me,q,K)}else{let{p:q,f:N}=A(T);I=q,R=N}return _S(W,[I,R])[0]}multiplyUnsafe(T){let{endo:Z}=t,I=this;if(!n.isValid(T))throw Error("invalid scalar: out of range");if(T===bo||I.is0())return W.ZERO;if(T===ja)return I;if(j.hasCache(this))return this.multiply(T);if(Z){let{k1neg:R,k1:A,k2neg:q,k2:N}=L(T),{p1:K,p2:G}=OC(W,I,A,N);return P(Z.beta,K,G,R,q)}else return j.unsafe(I,T)}toAffine(T){return z(this,T)}isTorsionFree(){let{isTorsionFree:T}=t;if(s===ja)return!0;if(T)return T(W,this);return j.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:T}=t;if(s===ja)return this;if(T)return T(W,this);return this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(T=!0){return nu(T,"isCompressed"),this.assertValidity(),h(W,this,T)}toHex(T=!0){return gs(this.toBytes(T))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let ee=n.BITS,j=new ES(W,t.endo?Math.ceil(ee/2):ee);return W.BASE.precompute(8),W}function ZC(e){return Uint8Array.of(e?2:3)}function jC(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function aK(e,t={}){let{Fn:r}=e,o=t.randomBytes||ni,n=Object.assign(jC(e.Fp,r),{seed:SS(r.ORDER)});function i(h){try{let b=r.fromBytes(h);return r.isValidNot0(b)}catch(b){return!1}}function s(h,b){let{publicKey:y,publicKeyUncompressed:v}=n;try{let x=h.length;if(b===!0&&x!==y)return!1;if(b===!1&&x!==v)return!1;return!!e.fromBytes(h)}catch(x){return!1}}function a(h=o(n.seed)){return IC(Re(h,n.seed,"seed"),r.ORDER)}function l(h,b=!0){return e.BASE.multiply(r.fromBytes(h)).toBytes(b)}function u(h){let{secretKey:b,publicKey:y,publicKeyUncompressed:v}=n;if(!Ca(h))return;if("_lengths"in r&&r._lengths||b===y)return;let x=Re(h,void 0,"key").length;return x===y||x===v}function d(h,b,y=!0){if(u(h)===!0)throw Error("first arg must be private key");if(u(b)===!1)throw Error("second arg must be public key");let v=r.fromBytes(h);return e.fromBytes(b).multiply(v).toBytes(y)}let p={isValidSecretKey:i,isValidPublicKey:s,randomSecretKey:a},m=Pf(a,l);return Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:m,Point:e,utils:p,lengths:n})}function OS(e,t,r={}){Vr(t),bs(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let o=r.randomBytes||ni,n=r.hmac||((I,R)=>Za(t,I,R)),{Fp:i,Fn:s}=e,{ORDER:a,BITS:l}=s,{keygen:u,getPublicKey:d,getSharedSecret:p,utils:m,lengths:h}=aK(e,r),b={prehash:!0,lowS:typeof r.lowS==="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},y=a*LC<i.ORDER;function v(I){let R=a>>ja;return I>R}function x(I,R){if(!s.isValidNot0(R))throw Error(`invalid signature ${I}: out of range 1..Point.Fn.ORDER`);return R}function _(){if(y)throw Error('"recovered" sig type is not supported for cofactor >2 curves')}function k(I,R){TS(R);let A=h.signature,q=R==="compact"?A:R==="recovered"?A+1:void 0;return Re(I,q)}class O{r;s;recovery;constructor(I,R,A){if(this.r=x("r",I),this.s=x("s",R),A!=null){if(_(),![0,1,2,3].includes(A))throw Error("invalid recovery id");this.recovery=A}Object.freeze(this)}static fromBytes(I,R=b.format){k(I,R);let A;if(R==="der"){let{r:G,s:re}=ci.toSig(Re(I));return new O(G,re)}if(R==="recovered")A=I[0],R="compact",I=I.subarray(1);let q=h.signature/2,N=I.subarray(0,q),K=I.subarray(q,q*2);return new O(s.fromBytes(N),s.fromBytes(K),A)}static fromHex(I,R){return this.fromBytes(ys(I),R)}assertRecovery(){let{recovery:I}=this;if(I==null)throw Error("invalid recovery id: must be present");return I}addRecoveryBit(I){return new O(this.r,this.s,I)}recoverPublicKey(I){let{r:R,s:A}=this,q=this.assertRecovery(),N=q===2||q===3?R+a:R;if(!i.isValid(N))throw Error("invalid recovery id: sig.r+curve.n != R.x");let K=i.toBytes(N),G=e.fromBytes(It(ZC((q&1)===0),K)),re=s.inv(N),ae=z(Re(I,void 0,"msgHash")),me=s.create(-ae*re),Se=s.create(A*re),xe=e.BASE.multiplyUnsafe(me).add(G.multiplyUnsafe(Se));if(xe.is0())throw Error("invalid recovery: point at infinify");return xe.assertValidity(),xe}hasHighS(){return v(this.s)}toBytes(I=b.format){if(TS(I),I==="der")return ys(ci.hexFromSig(this));let{r:R,s:A}=this,q=s.toBytes(R),N=s.toBytes(A);if(I==="recovered")return _(),It(Uint8Array.of(this.assertRecovery()),q,N);return It(q,N)}toHex(I){return gs(this.toBytes(I))}}let L=r.bits2int||function(R){if(R.length>8192)throw Error("input is too large");let A=ii(R),q=R.length*8-l;return q>0?A>>BigInt(q):A},z=r.bits2int_modN||function(R){return s.create(L(R))},J=au(l);function P(I){return su("num < 2^"+l,I,bo,J),s.toBytes(I)}function W(I,R){return Re(I,void 0,"message"),R?Re(t(I),void 0,"prehashed message"):I}function ee(I,R,A){let{lowS:q,prehash:N,extraEntropy:K}=RS(A,b);I=W(I,N);let G=z(I),re=s.fromBytes(R);if(!s.isValidNot0(re))throw Error("invalid private key");let ae=[P(re),P(G)];if(K!=null&&K!==!1){let ke=K===!0?o(h.secretKey):K;ae.push(Re(ke,void 0,"extraEntropy"))}let me=It(...ae),Se=G;function xe(ke){let Ae=L(ke);if(!s.isValidNot0(Ae))return;let _e=s.inv(Ae),Ue=e.BASE.multiply(Ae).toAffine(),De=s.create(Ue.x);if(De===bo)return;let Qe=s.create(_e*s.create(Se+De*re));if(Qe===bo)return;let bt=(Ue.x===De?0:2)|Number(Ue.y&ja),Tt=Qe;if(q&&v(Qe))Tt=s.neg(Qe),bt^=1;return new O(De,Tt,y?void 0:bt)}return{seed:me,k2sig:xe}}function j(I,R,A={}){let{seed:q,k2sig:N}=ee(I,R,A);return fC(t.outputLen,s.BYTES,n)(q,N).toBytes(A.format)}function T(I,R,A,q={}){let{lowS:N,prehash:K,format:G}=RS(q,b);if(A=Re(A,void 0,"publicKey"),R=W(R,K),!Ca(I)){let re=I instanceof O?", use sig.toBytes()":"";throw Error("verify expects Uint8Array signature"+re)}k(I,G);try{let re=O.fromBytes(I,G),ae=e.fromBytes(A);if(N&&re.hasHighS())return!1;let{r:me,s:Se}=re,xe=z(R),ke=s.inv(Se),Ae=s.create(xe*ke),_e=s.create(me*ke),Ue=e.BASE.multiplyUnsafe(Ae).add(ae.multiplyUnsafe(_e));if(Ue.is0())return!1;return s.create(Ue.x)===me}catch(re){return!1}}function Z(I,R,A={}){let{prehash:q}=RS(A,b);return R=W(R,q),O.fromBytes(I,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:u,getPublicKey:d,getSharedSecret:p,utils:m,lengths:h,Point:e,sign:j,verify:T,recoverPublicKey:Z,Signature:O,hash:t})}var NC=(e,t)=>(e+(e>=0?t:-t)/LC)/t,DC,ci,bo,ja,LC,Nf,sK;var BC=S(()=>{kS();Dr();Na();IS();lu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */DC=class DC extends Error{constructor(e=""){super(e)}};ci={Err:DC,_tlv:{encode:(e,t)=>{let{Err:r}=ci;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let o=t.length/2,n=ou(o);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let i=o>127?ou(n.length/2|128):"";return ou(e)+i+n+t},decode(e,t){let{Err:r}=ci,o=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[o++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[o++],i=!!(n&128),s=0;if(!i)s=n;else{let l=n&127;if(!l)throw new r("tlv.decode(long): indefinite length not supported");if(l>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(o,o+l);if(u.length!==l)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let d of u)s=s<<8|d;if(o+=l,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(o,o+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(o+s)}}},_int:{encode(e){let{Err:t}=ci;if(e<bo)throw new t("integer: negative integers are not allowed");let r=ou(e);if(Number.parseInt(r[0],16)&8)r="00"+r;if(r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=ci;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ii(e)}},toSig(e){let{Err:t,_int:r,_tlv:o}=ci,n=Re(e,void 0,"signature"),{v:i,l:s}=o.decode(48,n);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l}=o.decode(2,i),{v:u,l:d}=o.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=ci,o=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s)),i=o+n;return t.encode(48,i)}},bo=BigInt(0),ja=BigInt(1),LC=BigInt(2),Nf=BigInt(3),sK=BigInt(4)});function UC(e,t,r){return e&t^~e&r}function MC(e,t,r){return e&t^e&r^t&r}class Df{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,o){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(e),this.view=Tf(this.buffer)}update(e){yo(this),Re(e);let{view:t,buffer:r,blockLen:o}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(o-this.pos,n-i);if(s===o){let a=Tf(e);for(;o<=n-i;i+=o)this.process(a,i);continue}if(r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===o)this.process(t,0),this.pos=0}return this.length+=e.length,this.roundClean(),this}digestInto(e){yo(this),kf(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:o,isLE:n}=this,{pos:i}=this;if(t[i++]=128,wr(this.buffer.subarray(i)),this.padOffset>o-i)this.process(r,0),i=0;for(let d=i;d<o;d++)t[d]=0;r.setBigUint64(o-8,BigInt(this.length*8),n),this.process(r,0);let s=Tf(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen must be aligned to 32bit");let l=a/4,u=this.get();if(l>u.length)throw Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)s.setUint32(4*d,u[d],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:o,finished:n,destroyed:i,pos:s}=this;if(e.destroyed=i,e.finished=n,e.length=o,e.pos=s,o%t)e.buffer.set(r);return e}clone(){return this._cloneInto()}}var So,Ht;var qC=S(()=>{Dr();So=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ht=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])});function cK(e,t=!1){if(t)return{h:Number(e&Lf),l:Number(e>>FC&Lf)};return{h:Number(e>>FC&Lf)|0,l:Number(e&Lf)|0}}function Zf(e,t=!1){let r=e.length,o=new Uint32Array(r),n=new Uint32Array(r);for(let i=0;i<r;i++){let{h:s,l:a}=cK(e[i],t);[o[i],n[i]]=[s,a]}return[o,n]}function Dn(e,t,r,o){let n=(t>>>0)+(o>>>0);return{h:e+r+(n/4294967296|0)|0,l:n|0}}var Lf,FC,CS=(e,t,r)=>e>>>r,PS=(e,t,r)=>e<<32-r|t>>>r,ws=(e,t,r)=>e>>>r|t<<32-r,xs=(e,t,r)=>e<<32-r|t>>>r,pu=(e,t,r)=>e<<64-r|t>>>r-32,fu=(e,t,r)=>e>>>r-32|t<<64-r,HC=(e,t,r)=>e<<r|t>>>32-r,JC=(e,t,r)=>t<<r|e>>>32-r,KC=(e,t,r)=>t<<r-32|e>>>64-r,VC=(e,t,r)=>e<<r-32|t>>>64-r,WC=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),GC=(e,t,r,o)=>t+r+o+(e/4294967296|0)|0,QC=(e,t,r,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0),YC=(e,t,r,o,n)=>t+r+o+n+(e/4294967296|0)|0,XC=(e,t,r,o,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0)+(n>>>0),e1=(e,t,r,o,n,i)=>t+r+o+n+i+(e/4294967296|0)|0;var zS=S(()=>{Lf=BigInt(4294967295),FC=BigInt(32)});var uK,li,t1,r1,n1,dK,pK,ui,di,o1,i1,jf,s1;var NS=S(()=>{qC();zS();Dr();uK=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),li=new Uint32Array(64);t1=class t1 extends Df{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:o,E:n,F:i,G:s,H:a}=this;return[e,t,r,o,n,i,s,a]}set(e,t,r,o,n,i,s,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=n|0,this.F=i|0,this.G=s|0,this.H=a|0}process(e,t){for(let d=0;d<16;d++,t+=4)li[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let p=li[d-15],m=li[d-2],h=dn(p,7)^dn(p,18)^p>>>3,b=dn(m,17)^dn(m,19)^m>>>10;li[d]=b+li[d-7]+h+li[d-16]|0}let{A:r,B:o,C:n,D:i,E:s,F:a,G:l,H:u}=this;for(let d=0;d<64;d++){let p=dn(s,6)^dn(s,11)^dn(s,25),m=u+p+UC(s,a,l)+uK[d]+li[d]|0,b=(dn(r,2)^dn(r,13)^dn(r,22))+MC(r,o,n)|0;u=l,l=a,a=s,s=i+m|0,i=n,n=o,o=r,r=m+b|0}r=r+this.A|0,o=o+this.B|0,n=n+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,o,n,i,s,a,l,u)}roundClean(){wr(li)}destroy(){this.set(0,0,0,0,0,0,0,0),wr(this.buffer)}};r1=class r1 extends t1{A=So[0]|0;B=So[1]|0;C=So[2]|0;D=So[3]|0;E=So[4]|0;F=So[5]|0;G=So[6]|0;H=So[7]|0;constructor(){super(32)}};n1=(()=>Zf(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e)=>BigInt(e))))(),dK=(()=>n1[0])(),pK=(()=>n1[1])(),ui=new Uint32Array(80),di=new Uint32Array(80);o1=class o1 extends Df{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:r,Bl:o,Ch:n,Cl:i,Dh:s,Dl:a,Eh:l,El:u,Fh:d,Fl:p,Gh:m,Gl:h,Hh:b,Hl:y}=this;return[e,t,r,o,n,i,s,a,l,u,d,p,m,h,b,y]}set(e,t,r,o,n,i,s,a,l,u,d,p,m,h,b,y){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=o|0,this.Ch=n|0,this.Cl=i|0,this.Dh=s|0,this.Dl=a|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=p|0,this.Gh=m|0,this.Gl=h|0,this.Hh=b|0,this.Hl=y|0}process(e,t){for(let _=0;_<16;_++,t+=4)ui[_]=e.getUint32(t),di[_]=e.getUint32(t+=4);for(let _=16;_<80;_++){let k=ui[_-15]|0,O=di[_-15]|0,L=ws(k,O,1)^ws(k,O,8)^CS(k,O,7),z=xs(k,O,1)^xs(k,O,8)^PS(k,O,7),J=ui[_-2]|0,P=di[_-2]|0,W=ws(J,P,19)^pu(J,P,61)^CS(J,P,6),ee=xs(J,P,19)^fu(J,P,61)^PS(J,P,6),j=QC(z,ee,di[_-7],di[_-16]),T=YC(j,L,W,ui[_-7],ui[_-16]);ui[_]=T|0,di[_]=j|0}let{Ah:r,Al:o,Bh:n,Bl:i,Ch:s,Cl:a,Dh:l,Dl:u,Eh:d,El:p,Fh:m,Fl:h,Gh:b,Gl:y,Hh:v,Hl:x}=this;for(let _=0;_<80;_++){let k=ws(d,p,14)^ws(d,p,18)^pu(d,p,41),O=xs(d,p,14)^xs(d,p,18)^fu(d,p,41),L=d&m^~d&b,z=p&h^~p&y,J=XC(x,O,z,pK[_],di[_]),P=e1(J,v,k,L,dK[_],ui[_]),W=J|0,ee=ws(r,o,28)^pu(r,o,34)^pu(r,o,39),j=xs(r,o,28)^fu(r,o,34)^fu(r,o,39),T=r&n^r&s^n&s,Z=o&i^o&a^i&a;v=b|0,x=y|0,b=m|0,y=h|0,m=d|0,h=p|0,{h:d,l:p}=Dn(l|0,u|0,P|0,W|0),l=s|0,u=a|0,s=n|0,a=i|0,n=r|0,i=o|0;let I=WC(W,j,Z);r=GC(I,P,ee,T),o=I|0}({h:r,l:o}=Dn(this.Ah|0,this.Al|0,r|0,o|0)),{h:n,l:i}=Dn(this.Bh|0,this.Bl|0,n|0,i|0),{h:s,l:a}=Dn(this.Ch|0,this.Cl|0,s|0,a|0),{h:l,l:u}=Dn(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:p}=Dn(this.Eh|0,this.El|0,d|0,p|0),{h:m,l:h}=Dn(this.Fh|0,this.Fl|0,m|0,h|0),{h:b,l:y}=Dn(this.Gh|0,this.Gl|0,b|0,y|0),{h:v,l:x}=Dn(this.Hh|0,this.Hl|0,v|0,x|0),this.set(r,o,n,i,s,a,l,u,d,p,m,h,b,y,v,x)}roundClean(){wr(ui,di)}destroy(){wr(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};i1=class i1 extends o1{Ah=Ht[0]|0;Al=Ht[1]|0;Bh=Ht[2]|0;Bl=Ht[3]|0;Ch=Ht[4]|0;Cl=Ht[5]|0;Dh=Ht[6]|0;Dl=Ht[7]|0;Eh=Ht[8]|0;El=Ht[9]|0;Fh=Ht[10]|0;Fl=Ht[11]|0;Gh=Ht[12]|0;Gl=Ht[13]|0;Hh=Ht[14]|0;Hl=Ht[15]|0;constructor(){super(48)}};jf=Pa(()=>new r1,oi(1)),s1=Pa(()=>new i1,oi(2))});function gK(e){let t=BigInt(10),r=BigInt(20),o=BigInt(40),n=BigInt(80),i=c1,a=e*e%i*e%i,l=Wr(a,a1,i)*a%i,u=Wr(l,fK,i)*e%i,d=Wr(u,hK,i)*u%i,p=Wr(d,t,i)*d%i,m=Wr(p,r,i)*p%i,h=Wr(m,o,i)*m%i,b=Wr(h,n,i)*h%i,y=Wr(b,n,i)*h%i,v=Wr(y,t,i)*d%i;return{pow_p_5_8:Wr(v,a1,i)*e%i,b2:a}}function yK(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var fK,a1,mK,hK,eSe,c1,l1;var u1=S(()=>{lu();zC();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */fK=BigInt(1),a1=BigInt(2),mK=BigInt(3),hK=BigInt(5),eSe=BigInt(8),c1=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");l1=(()=>{let e=c1;return PC({P:e,type:"x25519",powPminus2:(t)=>{let{pow_p_5_8:r,b2:o}=gK(t);return lr(Wr(r,mK,e)*o,e)},adjustScalarBytes:yK})})()});var bK,SK,vK,DS,wK,d1;var p1=S(()=>{NS();BC();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */bK=(()=>({p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")}))(),SK=(()=>({p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")}))(),vK=$S(bK),DS=OS(vK,jf),wK=$S(SK),d1=OS(wK,s1)});function m1(e,t,r){if(Vr(e),r===void 0)r=new Uint8Array(e.outputLen);return Za(e,r,t)}function h1(e,t,r,o=32){Vr(e),Zt(o,"length");let n=e.outputLen;if(o>255*n)throw Error("Length must be <= 255*HashLen");let i=Math.ceil(o/n);if(r===void 0)r=f1;else Re(r,void 0,"info");let s=new Uint8Array(i*n),a=Za.create(e,t),l=a._cloneInto(),u=new Uint8Array(a.outputLen);for(let d=0;d<i;d++)LS[0]=d+1,l.update(d===0?f1:u).update(r).update(LS).digestInto(u),s.set(u,n*d),a._cloneInto(l);return a.destroy(),l.destroy(),wr(u,LS),s.slice(0,o)}var LS,f1;var g1=S(()=>{kS();Dr();LS=Uint8Array.of(0),f1=Uint8Array.of()});function TK(e,t=24){let r=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,l=(s+2)%10,u=r[l],d=r[l+1],p=y1(u,d,1)^r[a],m=b1(u,d,1)^r[a+1];for(let h=0;h<50;h+=10)e[s+h]^=p,e[s+h+1]^=m}let n=e[2],i=e[3];for(let s=0;s<24;s++){let a=v1[s],l=y1(n,i,a),u=b1(n,i,a),d=S1[s];n=e[d],i=e[d+1],e[d]=l,e[d+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=kK[o],e[1]^=RK[o]}wr(r)}class Bf{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(e,t,r,o=!1,n=24){if(this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=o,this.rounds=n,Zt(r,"outputLen"),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Rf(this.state)}clone(){return this._cloneInto()}keccak(){pS(this.state32),TK(this.state32,this.rounds),pS(this.state32),this.posOut=0,this.pos=0}update(e){yo(this),Re(e);let{blockLen:t,state:r}=this,o=e.length;for(let n=0;n<o;){let i=Math.min(t-this.pos,o-n);for(let s=0;s<i;s++)r[this.pos++]^=e[n++];if(this.pos===t)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:o}=this;if(e[r]^=t,(t&128)!==0&&r===o-1)this.keccak();e[o-1]^=128,this.keccak()}writeInto(e){yo(this,!1),Re(e),this.finish();let t=this.state,{blockLen:r}=this;for(let o=0,n=e.length;o<n;){if(this.posOut>=r)this.keccak();let i=Math.min(r-this.posOut,n-o);e.set(t.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Zt(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(kf(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,wr(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:o,rounds:n,enableXOF:i}=this;return e||=new Bf(t,r,o,i,n),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=o,e.enableXOF=i,e.destroyed=this.destroyed,e}}var xK,mu,_K,EK,IK,AK,S1,v1,w1,x1,kK,RK,y1=(e,t,r)=>r>32?KC(e,t,r):HC(e,t,r),b1=(e,t,r)=>r>32?VC(e,t,r):JC(e,t,r),_1=(e,t,r,o={})=>Pa(()=>new Bf(t,e,r),o),_s,E1,I1=(e,t,r,o={})=>Pa((n={})=>new Bf(t,e,n.dkLen===void 0?r:n.dkLen,!0),o),A1,Ln;var Uf=S(()=>{zS();Dr();xK=BigInt(0),mu=BigInt(1),_K=BigInt(2),EK=BigInt(7),IK=BigInt(256),AK=BigInt(113),S1=[],v1=[],w1=[];for(let e=0,t=mu,r=1,o=0;e<24;e++){[r,o]=[o,(2*r+3*o)%5],S1.push(2*(5*o+r)),v1.push((e+1)*(e+2)/2%64);let n=xK;for(let i=0;i<7;i++)if(t=(t<<mu^(t>>EK)*AK)%IK,t&_K)n^=mu<<(mu<<BigInt(i))-mu;w1.push(n)}x1=Zf(w1,!0),kK=x1[0],RK=x1[1];_s=_1(6,136,32,oi(8)),E1=_1(6,72,64,oi(10)),A1=I1(31,168,16,oi(11)),Ln=I1(31,136,32,oi(12))});function ZS(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw Error("wrong u32 integer:"+e);return e}function R1(e){return ZS(e),(e&e-1)===0&&e!==0}function jS(e,t){ZS(e);let r=0;for(let o=0;o<t;o++,e>>>=1)r=r<<1|e&1;return r}function T1(e){return ZS(e),31-Math.clz32(e)}function k1(e){let t=e.length;if(t<2||!R1(t))throw Error("n must be a power of 2 and greater than 1. Got "+t);let r=T1(t);for(let o=0;o<t;o++){let n=jS(o,r);if(o<n){let i=e[o];e[o]=e[n],e[n]=i}}return e}var BS=(e,t)=>{let{N:r,roots:o,dit:n,invertButterflies:i=!1,skipStages:s=0,brp:a=!0}=t,l=T1(r);if(!R1(r))throw Error("FFT: Polynomial size should be power of two");let u=n!==i;return(d)=>{if(d.length!==r)throw Error("FFT: wrong Polynomial length");if(n&&a)k1(d);for(let p=0,m=1;p<l-s;p++){let h=n?p+1+s:l-p,b=1<<h,y=b>>1,v=r>>h;for(let x=0;x<r;x+=b)for(let _=0,k=m++;_<y;_++){let O=i?n?r-k:k:_*v,L=x+_,z=x+_+y,J=o[O],P=d[z],W=d[L];if(u){let ee=e.mul(P,J);d[L]=e.add(W,ee),d[z]=e.sub(W,ee)}else if(i)d[L]=e.add(P,W),d[z]=e.mul(e.sub(P,W),J);else d[L]=e.add(W,P),d[z]=e.mul(e.sub(W,P),J)}}if(!n&&a)k1(d);return d}};var $1=()=>{};function Mf(e,t){if(e.length!==t.length)return!1;let r=0;for(let o=0;o<e.length;o++)r|=e[o]^t[o];return r===0}function O1(e){return Uint8Array.from(e)}function Es(e,...t){let r=(n)=>typeof n==="number"?n:n.bytesLen,o=t.reduce((n,i)=>n+r(i),0);return{bytesLen:o,encode:(n)=>{let i=new Uint8Array(o);for(let s=0,a=0;s<t.length;s++){let l=t[s],u=r(l),d=typeof l==="number"?n[s]:l.encode(n[s]);if(Re(d,u,e),i.set(d,a),typeof l!=="number")d.fill(0);a+=u}return i},decode:(n)=>{Re(n,o,e);let i=[];for(let s of t){let a=r(s),l=n.subarray(0,a);i.push(typeof s==="number"?l:s.decode(l)),n=n.subarray(a)}return i}}}function qf(e,t){let r=t*e.bytesLen;return{bytesLen:r,encode:(o)=>{if(o.length!==t)throw Error(`vecCoder.encode: wrong length=${o.length}. Expected: ${t}`);let n=new Uint8Array(r);for(let i=0,s=0;i<o.length;i++){let a=e.encode(o[i]);n.set(a,s),a.fill(0),s+=a.length}return n},decode:(o)=>{Re(o,r);let n=[];for(let i=0;i<o.length;i+=e.bytesLen)n.push(e.decode(o.subarray(i,i+e.bytesLen)));return n}}}function Ot(...e){for(let t of e)if(Array.isArray(t))for(let r of t)r.fill(0);else t.fill(0)}function US(e){return(1<<e)-1}var Zn,hSe;var Ff=S(()=>{Dr();Dr();/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */Zn=ni;hSe=Uint8Array.of()});var C1=(e)=>{let{newPoly:t,N:r,Q:o,F:n,ROOT_OF_UNITY:i,brvBits:s,isKyber:a}=e,l=(_,k=o)=>{let O=_%k|0;return(O>=0?O|0:k+O|0)|0},u=(_,k=o)=>{let O=l(_,k)|0;return(O>k>>1?O-k|0:O)|0};function d(){let _=t(r);for(let k=0;k<r;k++){let O=jS(k,s),L=BigInt(i)**BigInt(O)%BigInt(o);_[k]=Number(L)|0}return _}let p=d(),m={add:(_,k)=>l((_|0)+(k|0))|0,sub:(_,k)=>l((_|0)-(k|0))|0,mul:(_,k)=>l((_|0)*(k|0))|0,inv:(_)=>{throw Error("not implemented")}},h={N:r,roots:p,invertButterflies:!0,skipStages:a?1:0,brp:!1},b=BS(m,{dit:!1,...h}),y=BS(m,{dit:!0,...h});return{mod:l,smod:u,nttZetas:p,NTT:{encode:(_)=>b(_),decode:(_)=>{y(_);for(let k=0;k<_.length;k++)_[k]=l(n*_[k]);return _}},bitsCoder:(_,k)=>{let O=US(_),L=_*(r/8);return{bytesLen:L,encode:(z)=>{let J=new Uint8Array(L);for(let P=0,W=0,ee=0,j=0;P<z.length;P++){W|=(k.encode(z[P])&O)<<ee,ee+=_;for(;ee>=8;ee-=8,W>>=8)J[j++]=W&US(ee)}return J},decode:(z)=>{let J=t(r);for(let P=0,W=0,ee=0,j=0;P<z.length;P++){W|=z[P]<<ee,ee+=8;for(;ee>=_;ee-=_,W>>=_)J[j++]=k.decode(W&O)}return J}}}}},$K=(e)=>(t,r)=>{if(!r)r=e.blockLen;let o=new Uint8Array(t.length+2);o.set(t);let n=t.length,i=new Uint8Array(r),s=e.create({}),a=0,l=0;return{stats:()=>({calls:a,xofs:l}),get:(u,d)=>(o[n+0]=u,o[n+1]=d,s.destroy(),s=e.create({}).update(o),a++,()=>(l++,s.xofInto(i))),clean:()=>{s.destroy(),Ot(i,o)}}},P1;var z1=S(()=>{$1();Uf();Ff();/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */P1=$K(A1)});function As(e,t){for(let r=0;r<er;r++)e[r]=yu(e[r]+t[r])}function DK(e,t){for(let r=0;r<er;r++)e[r]=yu(e[r]-t[r])}function LK(e,t,r,o,n){let i=yu(t*o*n+e*r),s=yu(e*o+t*r);return{c0:i,c1:s}}function Hf(e,t){for(let r=0;r<er/2;r++){let o=PK[64+(r>>1)];if(r&1)o=-o;let{c0:n,c1:i}=LK(e[2*r+0],e[2*r+1],t[2*r+0],t[2*r+1],o);e[2*r+0]=n,e[2*r+1]=i}return e}function N1(e){let t=new Uint16Array(er);for(let r=0;r<er;){let o=e();if(o.length%3)throw Error("SampleNTT: unaligned block");for(let n=0;r<er&&n+3<=o.length;n+=3){let i=(o[n+0]>>0|o[n+1]<<8)&4095,s=(o[n+1]>>4|o[n+2]<<4)&4095;if(i<vo)t[r++]=i;if(r<er&&s<vo)t[r++]=s}}return t}function gu(e,t,r,o){let n=e(o*er/4,t,r),i=new Uint16Array(er),s=Rf(n),a=0;for(let l=0,u=0,d=0,p=0;l<s.length;l++){let m=s[l];for(let h=0;h<32;h++)if(d+=m&1,m>>=1,a+=1,a===o)p=d,d=0;else if(a===2*o)i[u++]=yu(p-d),d=0,a=0}if(a)throw Error(`sampleCBD: leftover bits: ${a}`);return i}function qS(e){let t=ZK(e),{HASH256:r,HASH512:o,KDF:n}=e,{secretCoder:i,lengths:s}=t,a=Es("secretKey",s.secretKey,s.publicKey,32,32),l=32,u=64;return{info:{type:"ml-kem"},lengths:{...s,seed:64,msg:32,msgRand:32,secretKey:a.bytesLen},keygen:(d=Zn(64))=>{Re(d,64,"seed");let{publicKey:p,secretKey:m}=t.keygen(d.subarray(0,32)),h=r(p),b=a.encode([m,p,h,d.subarray(32)]);return Ot(m,h),{publicKey:p,secretKey:b}},getPublicKey:(d)=>{let[p,m,h,b]=a.decode(d);return Uint8Array.from(m)},encapsulate:(d,p=Zn(32))=>{Re(d,s.publicKey,"publicKey"),Re(p,32,"message");let m=d.subarray(0,384*e.K),h=i.encode(i.decode(O1(m)));if(!Mf(h,m))throw Ot(h),Error("ML-KEM.encapsulate: wrong publicKey modulus");Ot(h);let b=o.create().update(p).update(r(d)).digest(),y=t.encrypt(d,p,b.subarray(32,64));return Ot(b.subarray(32)),{cipherText:y,sharedSecret:b.subarray(0,32)}},decapsulate:(d,p)=>{Re(p,a.bytesLen,"secretKey"),Re(d,s.cipherText,"cipherText");let m=a.bytesLen-96,h=m+32,b=r(p.subarray(m/2,h));if(!Mf(b,p.subarray(h,h+32)))throw Error("invalid secretKey: hash check failed");let[y,v,x,_]=a.decode(p),k=t.decrypt(d,y),O=o.create().update(k).update(x).digest(),L=O.subarray(0,32),z=t.encrypt(v,k,O.subarray(32,64)),J=Mf(d,z),P=n.create({dkLen:32}).update(_).update(d).digest();return Ot(k,z,!J?L:P),J?L:P}}}function jK(e,t,r){return Ln.create({dkLen:e}).update(t).update(new Uint8Array([r])).digest()}var er=256,vo=3329,OK=3303,CK=17,yu,PK,Is,zK,MS,NK=(e)=>{if(e>=12)return{encode:(r)=>r,decode:(r)=>r};let t=2**(e-1);return{encode:(r)=>((r<<e)+vo/2)/vo,decode:(r)=>r*vo+t>>>e}},hu=(e)=>zK(e,NK(e)),ZK=(e)=>{let{K:t,PRF:r,XOF:o,HASH512:n,ETA1:i,ETA2:s,du:a,dv:l}=e,u=hu(1),d=hu(l),p=hu(a),m=Es("publicKey",qf(hu(12),t),32),h=qf(hu(12),t),b=Es("ciphertext",qf(p,t),d),y=Es("seed",32,32);return{secretCoder:h,lengths:{secretKey:h.bytesLen,publicKey:m.bytesLen,cipherText:b.bytesLen},keygen:(v)=>{Re(v,32,"seed");let x=new Uint8Array(33);x.set(v),x[32]=t;let _=n(x),[k,O]=y.decode(_),L=[],z=[];for(let W=0;W<t;W++)L.push(Is.encode(gu(r,O,W,i)));let J=o(k);for(let W=0;W<t;W++){let ee=Is.encode(gu(r,O,t+W,i));for(let j=0;j<t;j++){let T=N1(J.get(j,W));As(ee,Hf(T,L[j]))}z.push(ee)}J.clean();let P={publicKey:m.encode([z,k]),secretKey:h.encode(L)};return Ot(k,O,L,z,x,_),P},encrypt:(v,x,_)=>{let[k,O]=m.decode(v),L=[];for(let j=0;j<t;j++)L.push(Is.encode(gu(r,_,j,i)));let z=o(O),J=new Uint16Array(er),P=[];for(let j=0;j<t;j++){let T=gu(r,_,t+j,s),Z=new Uint16Array(er);for(let I=0;I<t;I++){let R=N1(z.get(j,I));As(Z,Hf(R,L[I]))}As(T,Is.decode(Z)),P.push(T),As(J,Hf(k[j],L[j])),Ot(Z)}z.clean();let W=gu(r,_,2*t,s);As(W,Is.decode(J));let ee=u.decode(x);return As(ee,W),Ot(k,L,J,W),b.encode([P,ee])},decrypt:(v,x)=>{let[_,k]=b.decode(v),O=h.decode(x),L=new Uint16Array(er);for(let z=0;z<t;z++)As(L,Hf(O[z],Is.encode(_[z])));return DK(k,Is.decode(L)),Ot(L,O,_),u.encode(k)}}},FS,ASe,bu,D1;var L1=S(()=>{Uf();Dr();z1();Ff();/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */({mod:yu,nttZetas:PK,NTT:Is,bitsCoder:zK}=C1({N:er,Q:vo,F:OK,ROOT_OF_UNITY:CK,newPoly:(e)=>new Uint16Array(e),brvBits:7,isKyber:!0})),MS={512:{N:er,Q:vo,K:2,ETA1:3,ETA2:2,du:10,dv:4,RBGstrength:128},768:{N:er,Q:vo,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192},1024:{N:er,Q:vo,K:4,ETA1:2,ETA2:2,du:11,dv:5,RBGstrength:256}};FS={HASH256:_s,HASH512:E1,KDF:Ln,XOF:P1,PRF:jK},ASe=qS({...FS,...MS[512]}),bu=qS({...FS,...MS[768]}),D1=qS({...FS,...MS[1024]})});function BK(e,t=!1){let{lengths:r,keygen:o}=e;if(t){let i=e.Point.Fn;if(!i)throw Error("No Point.Fn");o=(s=Zn(r.seed))=>{Re(s,r.seed,"seed");let a=i.isLE?si(s):ii(s),l=i.toBytes(i.create(a));return{secretKey:l,publicKey:e.getPublicKey(l)}}}return{lengths:{secretKey:r.secretKey,publicKey:r.publicKey,seed:r.seed},keygen:o,getPublicKey:(n)=>e.getPublicKey(n)}}function HS(e,t=!1){let r=BK(e,t);if(!e.getSharedSecret)throw Error("wrong curve");return{lengths:{...r.lengths,msg:r.lengths.seed,cipherText:r.lengths.publicKey},keygen:r.keygen,getPublicKey:r.getPublicKey,encapsulate(o,n=Zn(e.lengths.seed)){let i=this.keygen(n).secretKey,s=this.decapsulate(o,i),a=e.getPublicKey(i);return Ot(i),{sharedSecret:s,cipherText:a}},decapsulate(o,n){let i=e.getSharedSecret(n,o);return e.lengths.publicKeyHasPrefix?i.subarray(1):i}}}function Su(e,t){return Es(t,...e.map((r)=>{if(typeof r.lengths[t]!=="number")throw Error("wrong length: "+t);return r.lengths[t]}))}function JS(e){return(t,r)=>e(t,{dkLen:r})}function UK(e,t,...r){let o=Su(r,"seed"),n=Su(r,"publicKey");if(e===void 0)e=o.bytesLen;Zt(e);function i(s){Re(s,e);let a=o.decode(t(s,o.bytesLen)),l=r.map((p,m)=>p.keygen(a[m])),u=l.map((p)=>p.secretKey),d=l.map((p)=>p.publicKey);return{secretKey:u,publicKey:d}}return{info:{lengths:{seed:e,publicKey:n.bytesLen,secretKey:e}},getPublicKey(s){return this.keygen(s).publicKey},keygen(s=Zn(e)){let{publicKey:a,secretKey:l}=i(s),u=n.encode(a);return Ot(a),Ot(l),{secretKey:s,publicKey:u}},expandDecapsulationKey:i,realSeedLen:e}}function Jf(e,t,r,o,...n){let i=UK(e,r,...n),s=Su(n,"cipherText"),a=Su(n,"publicKey"),l=Su(n,"msg");if(t===void 0)t=l.bytesLen;return Zt(t),{lengths:{...i.info.lengths,msg:t,msgRand:l.bytesLen,cipherText:s.bytesLen},getPublicKey:i.getPublicKey,keygen:i.keygen,encapsulate(u,d=Zn(l.bytesLen)){let p=a.decode(u),m=l.decode(d),h=n.map((x,_)=>x.encapsulate(p[_],m[_])),b=h.map((x)=>x.sharedSecret),y=h.map((x)=>x.cipherText),v={sharedSecret:o(p,y,b),cipherText:s.encode(y)};return Ot(b,y),v},decapsulate(u,d){let p=s.decode(u),{publicKey:m,secretKey:h}=i.expandDecapsulationKey(d),b=n.map((y,v)=>y.decapsulate(p[v],h[v]));return o(m,p,b)}}}function Z1(e,t,r,o,n){return Vr(o),Vr(n),Jf(32,32,JS(o),(i,s,a)=>n(It(a[0],a[1],s[1],i[1],ai(e))),t,r)}function MK(e,t,r,o,n){return Vr(o),Vr(n),Jf(32,32,JS(o),(i,s,a)=>{let l=It(a[0],a[1],s[0],i[0],s[1],i[1],ai(e)),u=32,d=It(ai("hybrid_prk"),l),p=m1(n,d),m=It(za(32,2),ai("shared_secret"),ai("")),h=h1(n,p,m,32);return Ot(p,m,d,l),h},t,r)}function FK(e,t,r,o){let n=e.Point.Fn;if(!n)throw Error("no Point.Fn");function i(s){let a;for(let d=0,p=t;;d=p,p+=t){if(p>s.length)throw Error("rejection sampling failed");if(a=n.fromBytes(s.subarray(d,p),!0),n.isValidNot0(a))break}let l=n.toBytes(n.create(a)),u=e.getPublicKey(l,!1);return{secretKey:l,publicKey:u}}return{lengths:{secretKey:t,publicKey:r,seed:o,msg:o,cipherText:r},keygen(s=Zn(o)){return Re(s,o,"seed"),i(s)},getPublicKey(s){return e.getPublicKey(s,!1)},encapsulate(s,a=Zn(o)){Re(a,o,"rand");let{secretKey:l}=i(a),u=this.decapsulate(s,l),d=e.getPublicKey(l,!1);return Ot(l),{sharedSecret:u,cipherText:d}},decapsulate(s,a){return e.getSharedSecret(a,s).subarray(1)}}}function HK(e,t,r,o){let{secretKey:n,publicKeyUncompressed:i}=r.lengths;if(!n||!i)throw Error("wrong curve");let s=FK(r,n,i,o),a=64,l=a+o;return Jf(32,32,(u)=>{Re(u,32);let d=Ln(u,{dkLen:l}),p=d.subarray(0,a),m=d.subarray(a,l);return It(p,m)},(u,d,p)=>_s(It(p[0],p[1],d[1],u[1],ai(e))),t,s)}var LSe,ZSe,j1,jSe,qK,JK,Kf,B1;var U1=S(()=>{u1();p1();Na();g1();NS();Uf();Dr();L1();Ff();/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */LSe=Z1("QSF-KEM(ML-KEM-768,P-256)-XOF(SHAKE256)-KDF(SHA3-256)",bu,HS(DS,!0),Ln,_s),ZSe=Z1("QSF-KEM(ML-KEM-1024,P-384)-XOF(SHAKE256)-KDF(SHA3-256)",D1,HS(d1,!0),Ln,_s);j1=HS(l1),jSe=MK("KitchenSink-KEM(ML-KEM-768,X25519)-XOF(SHAKE256)-KDF(HKDF-SHA-256)",bu,j1,Ln,jf),qK=(()=>Jf(32,32,JS(Ln),(e,t,r)=>_s(It(r[0],r[1],t[1],e[1],ai("\\.//^\\"))),bu,j1))();JK=(()=>HK("MLKEM768-P256",bu,DS,128))(),Kf=qK,B1=JK});function wo(e,t=""){if(typeof e!=="boolean"){let r=t&&`"${t}" `;throw TypeError(r+"expected boolean, got type="+typeof e)}return e}function Gf(e){if(typeof e==="bigint"){if(!Vf(e))throw RangeError("positive bigint expected, got "+e)}else VS(e);return e}function jn(e,t=""){if(typeof e!=="number"){let r=t&&`"${t}" `;throw TypeError(r+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let r=t&&`"${t}" `;throw RangeError(r+"expected safe integer, got "+e)}}function vu(e){let t=Gf(e).toString(16);return t.length&1?"0"+t:t}function M1(e){if(typeof e!=="string")throw TypeError("hex string expected, got "+typeof e);return e===""?Wf:BigInt("0x"+e)}function ks(e){return M1(mf(e))}function pn(e){return M1(mf(pi(Mt(e)).reverse()))}function Qf(e,t){if(St(t),t===0)throw RangeError("zero length");e=Gf(e);let r=e.toString(16);if(r.length>t*2)throw RangeError("number too large");return Kl(r.padStart(t*2,"0"))}function wu(e,t){return Qf(e,t).reverse()}function q1(e,t){if(e=Ye(e),t=Ye(t),e.length!==t.length)return!1;let r=0;for(let o=0;o<e.length;o++)r|=e[o]^t[o];return r===0}function pi(e){return Uint8Array.from(Ye(e))}function Yf(e){if(typeof e!=="string")throw TypeError("ascii string expected, got "+typeof e);return Uint8Array.from(e,(t,r)=>{let o=t.charCodeAt(0);if(t.length!==1||o>127)throw RangeError(`string contains non-ASCII character "${e[r]}" with code ${o} at position ${r}`);return o})}function KK(e,t,r){return Vf(e)&&Vf(t)&&Vf(r)&&t<=e&&e<r}function xo(e,t,r,o){if(!KK(t,r,o))throw RangeError("expected valid "+e+": "+r+" <= n < "+o+", got "+t)}function Fa(e){if(e<Wf)throw Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Wf;e>>=KS,t+=1);return t}function F1(e,t,r){if(St(e,"hashLen"),St(t,"qByteLen"),typeof r!=="function")throw TypeError("hmacFn must be a function");let o=(v)=>new Uint8Array(v),n=Uint8Array.of(),i=Uint8Array.of(0),s=Uint8Array.of(1),a=1000,l=o(e),u=o(e),d=0,p=()=>{l.fill(1),u.fill(0),d=0},m=(...v)=>r(u,Jt(l,...v)),h=(v=n)=>{if(u=m(i,v),l=m(),v.length===0)return;u=m(s,v),l=m()},b=()=>{if(d++>=a)throw Error("drbg: tried max amount of iterations");let v=0,x=[];while(v<t){l=m();let _=l.slice();x.push(_),v+=l.length}return Jt(...x)};return(v,x)=>{p(),h(v);let _=void 0;while((_=x(b()))===void 0)h();return p(),_}}function Gr(e,t={},r={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw TypeError("expected valid options object");function o(i,s,a){if(!a&&s!=="function"&&!Object.hasOwn(e,i))throw TypeError(`param "${i}" is invalid: expected own property`);let l=e[i];if(a&&l===void 0)return;let u=typeof l;if(u!==s||l===null)throw TypeError(`param "${i}" is invalid: expected ${s}, got ${u}`)}let n=(i,s)=>Object.entries(i).forEach(([a,l])=>o(a,l,s));n(t,!1),n(r,!0)}var Ye=(e,t,r)=>Mt(e,t,r),VS,Ba,Jt=(...e)=>Hb(...e),Ua=(e)=>Kl(e),Ma,qa=(e)=>fo(e),Wf,KS,Vf=(e)=>typeof e==="bigint"&&Wf<=e,xu=(e)=>(KS<<BigInt(e))-KS,WS=()=>{throw Error("not implemented")};var fi=S(()=>{Hr();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */VS=St,Ba=mf,Ma=Mb,Wf=BigInt(0),KS=BigInt(1)});function it(e,t){if(t<=Kt)throw Error("mod: expected positive modulus, got "+t);let r=e%t;return r>=Kt?r:t+r}function Qr(e,t,r){if(t<Kt)throw Error("pow2: expected non-negative exponent, got "+t);let o=e;while(t-- >Kt)o*=o,o%=r;return o}function H1(e,t){if(e===Kt)throw Error("invert: expected non-zero number");if(t<=Kt)throw Error("invert: expected positive modulus, got "+t);let r=it(e,t),o=t,n=Kt,i=ht,s=ht,a=Kt;while(r!==Kt){let u=o/r,d=o-r*u,p=n-s*u,m=i-a*u;o=r,r=d,n=s,i=a,s=p,a=m}if(o!==ht)throw Error("invert: does not exist");return it(n,t)}function GS(e,t,r){let o=e;if(!o.eql(o.sqr(t),r))throw Error("Cannot find square root")}function X1(e,t){let r=e,o=(r.ORDER+ht)/W1,n=r.pow(t,o);return GS(r,n,t),n}function GK(e,t){let r=e,o=(r.ORDER-G1)/Q1,n=r.mul(t,Rs),i=r.pow(n,o),s=r.mul(t,i),a=r.mul(r.mul(s,Rs),i),l=r.mul(s,r.sub(a,r.ONE));return GS(r,l,t),l}function QK(e){let t=Xf(e),r=eP(e),o=r(t,t.neg(t.ONE)),n=r(t,o),i=r(t,t.neg(o)),s=(e+VK)/Y1;return(a,l)=>{let u=a,d=u.pow(l,s),p=u.mul(d,o),m=u.mul(d,n),h=u.mul(d,i),b=u.eql(u.sqr(p),l),y=u.eql(u.sqr(m),l);d=u.cmov(d,p,b),p=u.cmov(h,m,y);let v=u.eql(u.sqr(p),l),x=u.cmov(d,p,v);return GS(u,x,l),x}}function eP(e){if(e<V1)throw Error("sqrt is not defined for small field");let t=e-ht,r=0;while(t%Rs===Kt)t/=Rs,r++;let o=Rs,n=Xf(e);while(J1(n,o)===1)if(o++>1000)throw Error("Cannot find square root: probably non-prime P");if(r===1)return X1;let i=n.pow(o,t),s=(t+ht)/Rs;return function(l,u){let d=l;if(d.is0(u))return u;if(J1(d,u)!==1)throw Error("Cannot find square root");let p=r,m=d.mul(d.ONE,i),h=d.pow(u,t),b=d.pow(u,s);while(!d.eql(h,d.ONE)){if(d.is0(h))return d.ZERO;let y=1,v=d.sqr(h);while(!d.eql(v,d.ONE))if(y++,v=d.sqr(v),y===p)throw Error("Cannot find square root");let x=ht<<BigInt(p-y-1),_=d.pow(m,x);p=y,m=d.sqr(_),h=d.mul(h,m),b=d.mul(b,_)}return b}}function YK(e){if(e%W1===V1)return X1;if(e%Q1===G1)return GK;if(e%Y1===WK)return QK(e);return eP(e)}function QS(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=XK.reduce((o,n)=>(o[n]="function",o),t);if(Gr(e,r),jn(e.BYTES,"BYTES"),jn(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=ht)throw Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function eV(e,t,r){let o=e;if(r<Kt)throw Error("invalid exponent, negatives unsupported");if(r===Kt)return o.ONE;if(r===ht)return t;let n=o.ONE,i=t;while(r>Kt){if(r&ht)n=o.mul(n,i);i=o.sqr(i),r>>=ht}return n}function _u(e,t,r=!1){let o=e,n=Array(t.length).fill(r?o.ZERO:void 0),i=t.reduce((a,l,u)=>{if(o.is0(l))return a;return n[u]=a,o.mul(a,l)},o.ONE),s=o.inv(i);return t.reduceRight((a,l,u)=>{if(o.is0(l))return a;return n[u]=o.mul(a,n[u]),o.mul(a,l)},s),n}function J1(e,t){let r=e,o=(r.ORDER-ht)/Rs,n=r.pow(t,o),i=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),a=r.eql(n,r.neg(r.ONE));if(!i&&!s&&!a)throw Error("invalid Legendre symbol result");return i?1:s?0:-1}function tV(e,t){if(t!==void 0)VS(t);if(e<=Kt)throw Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw Error("invalid n length: expected positive bit length, got "+t);let r=Fa(e);if(t!==void 0&&t<r)throw Error(`invalid n length: expected bit length (${r}) >= n.length (${t})`);let o=t!==void 0?t:r,n=Math.ceil(o/8);return{nBitLength:o,nByteLength:n}}class YS{ORDER;BITS;BYTES;isLE;ZERO=Kt;ONE=ht;_lengths;_mod;constructor(e,t={}){if(e<=ht)throw Error("invalid field: expected ORDER > 1, got "+e);let r=void 0;if(this.isLE=!1,t!=null&&typeof t==="object"){if(typeof t.BITS==="number")r=t.BITS;if(typeof t.sqrt==="function")Object.defineProperty(this,"sqrt",{value:t.sqrt,enumerable:!0});if(typeof t.isLE==="boolean")this.isLE=t.isLE;if(t.allowedLengths)this._lengths=Object.freeze(t.allowedLengths.slice());if(typeof t.modFromBytes==="boolean")this._mod=t.modFromBytes}let{nBitLength:o,nByteLength:n}=tV(e,r);if(n>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=o,this.BYTES=n,Object.freeze(this)}create(e){return it(e,this.ORDER)}isValid(e){if(typeof e!=="bigint")throw TypeError("invalid field element: expected bigint, got "+typeof e);return Kt<=e&&e<this.ORDER}is0(e){return e===Kt}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&ht)===ht}neg(e){return it(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return it(e*e,this.ORDER)}add(e,t){return it(e+t,this.ORDER)}sub(e,t){return it(e-t,this.ORDER)}mul(e,t){return it(e*t,this.ORDER)}pow(e,t){return eV(this,e,t)}div(e,t){return it(e*H1(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return H1(e,this.ORDER)}sqrt(e){let t=K1.get(this);if(!t)K1.set(this,t=YK(this.ORDER));return t(this,e)}toBytes(e){return this.isLE?wu(e,this.BYTES):Qf(e,this.BYTES)}fromBytes(e,t=!1){Ye(e);let{_lengths:r,BYTES:o,isLE:n,ORDER:i,_mod:s}=this;if(r){if(e.length<1||!r.includes(e.length)||e.length>o)throw Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);let l=new Uint8Array(o);l.set(e,n?0:l.length-e.length),e=l}if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);let a=n?pn(e):ks(e);if(s)a=it(a,i);if(!t){if(!this.isValid(a))throw Error("invalid field element: outside of range 0..ORDER")}return a}invertBatch(e){return _u(this,e)}cmov(e,t,r){return wo(r,"condition"),r?t:e}}function Xf(e,t={}){return new YS(e,t)}function tP(e){if(typeof e!=="bigint")throw Error("field order must be bigint");if(e<=ht)throw Error("field order must be greater than 1");let t=Fa(e-ht);return Math.ceil(t/8)}function XS(e){let t=tP(e);return t+Math.ceil(t/2)}function rP(e,t,r=!1){Ye(e);let o=e.length,n=tP(t),i=Math.max(XS(t),16);if(o<i||o>1024)throw Error("expected "+i+"-1024 bytes of input, got "+o);let s=r?pn(e):ks(e),a=it(s,t-ht)+ht;return r?wu(a,n):Qf(a,n)}var Kt,ht,Rs,V1,W1,G1,VK,Q1,WK,Y1,_o=(e,t)=>(it(e,t)&ht)===ht,XK,K1;var Eu=S(()=>{fi();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Kt=BigInt(0),ht=BigInt(1),Rs=BigInt(2),V1=BigInt(3),W1=BigInt(4),G1=BigInt(5),VK=BigInt(7),Q1=BigInt(8),WK=BigInt(9),Y1=BigInt(16);XK=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];K1=new WeakMap;Object.freeze(YS.prototype)});function Iu(e,t){let r=t.negate();return e?r:t}function $s(e,t){let r=_u(e.Fp,t.map((o)=>o.Z));return t.map((o,n)=>e.fromAffine(o.toAffine(r[n])))}function sP(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function ev(e,t){sP(e,t);let r=Math.ceil(t/e)+1,o=2**(e-1),n=2**e,i=xu(e),s=BigInt(e);return{windows:r,windowSize:o,mask:i,maxNumber:n,shiftBy:s}}function nP(e,t,r){let{windowSize:o,mask:n,maxNumber:i,shiftBy:s}=r,a=Number(e&n),l=e>>s;if(a>o)a-=i,l+=Ts;let u=t*o,d=u+Math.abs(a)-1,p=a===0,m=a<0,h=t%2!==0;return{nextN:l,offset:d,isZero:p,isNeg:m,isNegF:h,offsetF:u}}function rv(e){return aP.get(e)||1}function oP(e){if(e!==Ha)throw Error("invalid wNAF")}class Au{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let o=e;while(t>Ha){if(t&Ts)r=r.add(o);o=o.double(),t>>=Ts}return r}precomputeWindow(e,t){let{windows:r,windowSize:o}=ev(t,this.bits),n=[],i=e,s=i;for(let a=0;a<r;a++){s=i,n.push(s);for(let l=1;l<o;l++)s=s.add(i),n.push(s);i=s.double()}return n}wNAF(e,t,r){if(!this.Fn.isValid(r))throw Error("invalid scalar");let o=this.ZERO,n=this.BASE,i=ev(e,this.bits);for(let s=0;s<i.windows;s++){let{nextN:a,offset:l,isZero:u,isNeg:d,isNegF:p,offsetF:m}=nP(r,s,i);if(r=a,u)n=n.add(Iu(p,t[m]));else o=o.add(Iu(d,t[l]))}return oP(r),{p:o,f:n}}wNAFUnsafe(e,t,r,o=this.ZERO){let n=ev(e,this.bits);for(let i=0;i<n.windows;i++){if(r===Ha)break;let{nextN:s,offset:a,isZero:l,isNeg:u}=nP(r,i,n);if(r=s,l)continue;else{let d=t[a];o=o.add(u?d.negate():d)}}return oP(r),o}getPrecomputes(e,t,r){let o=tv.get(t);if(!o){if(o=this.precomputeWindow(t,e),e!==1){if(typeof r==="function")o=r(o);tv.set(t,o)}}return o}cached(e,t,r){let o=rv(e);return this.wNAF(o,this.getPrecomputes(o,e,r),t)}unsafe(e,t,r,o){let n=rv(e);if(n===1)return this._unsafeLadder(e,t,o);return this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,o)}createCache(e,t){sP(t,this.bits),aP.set(e,t),tv.delete(e)}hasCache(e){return rv(e)!==1}}function cP(e,t,r,o){let n=t,i=e.ZERO,s=e.ZERO;while(r>Ha||o>Ha){if(r&Ts)i=i.add(n);if(o&Ts)s=s.add(n);n=n.double(),r>>=Ts,o>>=Ts}return{p1:i,p2:s}}function iP(e,t,r){if(t){if(t.ORDER!==e)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return QS(t),t}else return Xf(e,{isLE:r})}function em(e,t,r={},o){if(o===void 0)o=e==="edwards";if(!t||typeof t!=="object")throw Error(`expected valid ${e} CURVE object`);for(let l of["p","n","h"]){let u=t[l];if(!(typeof u==="bigint"&&u>Ha))throw Error(`CURVE.${l} must be positive bigint`)}let n=iP(t.p,r.Fp,o),i=iP(t.n,r.Fn,o),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let l of a)if(!n.isValid(t[l]))throw Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:i}}function ku(e,t){return function(o){let n=e(o);return{secretKey:n,publicKey:t(n)}}}var Ha,Ts,tv,aP;var tm=S(()=>{fi();Eu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Ha=BigInt(0),Ts=BigInt(1);tv=new WeakMap,aP=new WeakMap});function Ru(e,t){if(jn(e),jn(t),t<0||t>4)throw Error("invalid I2OSP length: "+t);if(e<0||e>2**(8*t)-1)throw Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let o=t-1;o>=0;o--)r[o]=e&255,e>>>=8;return new Uint8Array(r)}function rV(e,t){let r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e[o]^t[o];return r}function nV(e){if(!Ma(e)&&typeof e!=="string")throw Error("DST must be Uint8Array or ascii string");let t=typeof e==="string"?Yf(e):e;if(t.length===0)throw Error("DST must be non-empty");return t}function nv(e,t,r,o){if(Ye(e),jn(r),t=nV(t),t.length>255)t=o(Jt(Yf("H2C-OVERSIZE-DST-"),t));let{outputLen:n,blockLen:i}=o,s=Math.ceil(r/n);if(r>65535||s>255)throw Error("expand_message_xmd: invalid lenInBytes");let a=Jt(t,Ru(t.length,1)),l=new Uint8Array(i),u=Ru(r,2),d=Array(s),p=o(Jt(l,e,u,Ru(0,1),a));d[0]=o(Jt(p,Ru(1,1),a));for(let h=1;h<s;h++){let b=[rV(p,d[h-1]),Ru(h+1,1),a];d[h]=o(Jt(...b))}return Jt(...d).slice(0,r)}var lP="HashToScalar-";var uP=S(()=>{fi()});function oV(e,t,r){xo("scalar",e,Bn,r);let[[o,n],[i,s]]=t,a=dP(s*e,r),l=dP(-n*e,r),u=e-a*o-l*i,d=-a*n-l*s,p=u<Bn,m=d<Bn;if(p)u=-u;if(m)d=-d;let h=xu(Math.ceil(Fa(r)/2))+mi;if(u<Bn||u>=h||d<Bn||d>=h)throw Error("splitScalar (endomorphism): failed for k");return{k1neg:p,k1:u,k2neg:m,k2:d}}function iv(e){if(!["compact","recovered","der"].includes(e))throw Error('Signature format must be "compact", "recovered", or "der"');return e}function ov(e,t){Gr(e);let r={};for(let o of Object.keys(t))r[o]=e[o]===void 0?t[o]:e[o];if(wo(r.lowS,"lowS"),wo(r.prehash,"prehash"),r.format!==void 0)iv(r.format);return r}function mP(e,t={}){let r=em("weierstrass",e,t),o=r.Fp,n=r.Fn,i=r.CURVE,{h:s,n:a}=i;Gr(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:l,allowInfinityPoint:u}=t;if(l){if(!o.is0(i.a)||typeof l.beta!=="bigint"||!Array.isArray(l.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let d=gP(o,n);function p(){if(!o.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function m(j,T,Z){if(u&&T.is0())return Uint8Array.of(0);let{x:I,y:R}=T.toAffine(),A=o.toBytes(I);if(wo(Z,"isCompressed"),Z){p();let q=!o.isOdd(R);return Jt(hP(q),A)}else return Jt(Uint8Array.of(4),A,o.toBytes(R))}function h(j){Ye(j,void 0,"Point");let{publicKey:T,publicKeyUncompressed:Z}=d,I=j.length,R=j[0],A=j.subarray(1);if(u&&I===1&&R===0)return{x:o.ZERO,y:o.ZERO};if(I===T&&(R===2||R===3)){let q=o.fromBytes(A);if(!o.isValid(q))throw Error("bad point: is not on curve, wrong x");let N=v(q),K;try{K=o.sqrt(N)}catch(ae){let me=ae instanceof Error?": "+ae.message:"";throw Error("bad point: is not on curve, sqrt error"+me)}p();let G=o.isOdd(K);if((R&1)===1!==G)K=o.neg(K);return{x:q,y:K}}else if(I===Z&&R===4){let q=o.BYTES,N=o.fromBytes(A.subarray(0,q)),K=o.fromBytes(A.subarray(q,q*2));if(!x(N,K))throw Error("bad point: is not on curve");return{x:N,y:K}}else throw Error(`bad point: got length ${I}, expected compressed=${T} or uncompressed=${Z}`)}let b=t.toBytes===void 0?m:t.toBytes,y=t.fromBytes===void 0?h:t.fromBytes;function v(j){let T=o.sqr(j),Z=o.mul(T,j);return o.add(o.add(Z,o.mul(j,i.a)),i.b)}function x(j,T){let Z=o.sqr(T),I=v(j);return o.eql(Z,I)}if(!x(i.Gx,i.Gy))throw Error("bad curve params: generator point");let _=o.mul(o.pow(i.a,rm),iV),k=o.mul(o.sqr(i.b),BigInt(27));if(o.is0(o.add(_,k)))throw Error("bad curve params: a or b");function O(j,T,Z=!1){if(!o.isValid(T)||Z&&o.is0(T))throw Error(`bad point coordinate ${j}`);return T}function L(j){if(!(j instanceof P))throw Error("Weierstrass Point expected")}function z(j){if(!l||!l.basises)throw Error("no endo");return oV(j,l.basises,n.ORDER)}function J(j,T,Z,I,R){return Z=new P(o.mul(Z.X,j),Z.Y,Z.Z),T=Iu(I,T),Z=Iu(R,Z),T.add(Z)}class P{static BASE=new P(i.Gx,i.Gy,o.ONE);static ZERO=new P(o.ZERO,o.ONE,o.ZERO);static Fp=o;static Fn=n;X;Y;Z;constructor(j,T,Z){this.X=O("x",j),this.Y=O("y",T,!0),this.Z=O("z",Z),Object.freeze(this)}static CURVE(){return i}static fromAffine(j){let{x:T,y:Z}=j||{};if(!j||!o.isValid(T)||!o.isValid(Z))throw Error("invalid affine point");if(j instanceof P)throw Error("projective point not allowed");if(o.is0(T)&&o.is0(Z))return P.ZERO;return new P(T,Z,o.ONE)}static fromBytes(j){let T=P.fromAffine(y(Ye(j,void 0,"point")));return T.assertValidity(),T}static fromHex(j){return P.fromBytes(Ua(j))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(j=8,T=!0){if(ee.createCache(this,j),!T)this.multiply(rm);return this}assertValidity(){let j=this;if(j.is0()){if(t.allowInfinityPoint&&o.is0(j.X)&&o.eql(j.Y,o.ONE)&&o.is0(j.Z))return;throw Error("bad point: ZERO")}let{x:T,y:Z}=j.toAffine();if(!o.isValid(T)||!o.isValid(Z))throw Error("bad point: x or y not field elements");if(!x(T,Z))throw Error("bad point: equation left != right");if(!j.isTorsionFree())throw Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:j}=this.toAffine();if(!o.isOdd)throw Error("Field doesn't support isOdd");return!o.isOdd(j)}equals(j){L(j);let{X:T,Y:Z,Z:I}=this,{X:R,Y:A,Z:q}=j,N=o.eql(o.mul(T,q),o.mul(R,I)),K=o.eql(o.mul(Z,q),o.mul(A,I));return N&&K}negate(){return new P(this.X,o.neg(this.Y),this.Z)}double(){let{a:j,b:T}=i,Z=o.mul(T,rm),{X:I,Y:R,Z:A}=this,q=o.ZERO,N=o.ZERO,K=o.ZERO,G=o.mul(I,I),re=o.mul(R,R),ae=o.mul(A,A),me=o.mul(I,R);return me=o.add(me,me),K=o.mul(I,A),K=o.add(K,K),q=o.mul(j,K),N=o.mul(Z,ae),N=o.add(q,N),q=o.sub(re,N),N=o.add(re,N),N=o.mul(q,N),q=o.mul(me,q),K=o.mul(Z,K),ae=o.mul(j,ae),me=o.sub(G,ae),me=o.mul(j,me),me=o.add(me,K),K=o.add(G,G),G=o.add(K,G),G=o.add(G,ae),G=o.mul(G,me),N=o.add(N,G),ae=o.mul(R,A),ae=o.add(ae,ae),G=o.mul(ae,me),q=o.sub(q,G),K=o.mul(ae,re),K=o.add(K,K),K=o.add(K,K),new P(q,N,K)}add(j){L(j);let{X:T,Y:Z,Z:I}=this,{X:R,Y:A,Z:q}=j,N=o.ZERO,K=o.ZERO,G=o.ZERO,re=i.a,ae=o.mul(i.b,rm),me=o.mul(T,R),Se=o.mul(Z,A),xe=o.mul(I,q),ke=o.add(T,Z),Ae=o.add(R,A);ke=o.mul(ke,Ae),Ae=o.add(me,Se),ke=o.sub(ke,Ae),Ae=o.add(T,I);let _e=o.add(R,q);return Ae=o.mul(Ae,_e),_e=o.add(me,xe),Ae=o.sub(Ae,_e),_e=o.add(Z,I),N=o.add(A,q),_e=o.mul(_e,N),N=o.add(Se,xe),_e=o.sub(_e,N),G=o.mul(re,Ae),N=o.mul(ae,xe),G=o.add(N,G),N=o.sub(Se,G),G=o.add(Se,G),K=o.mul(N,G),Se=o.add(me,me),Se=o.add(Se,me),xe=o.mul(re,xe),Ae=o.mul(ae,Ae),Se=o.add(Se,xe),xe=o.sub(me,xe),xe=o.mul(re,xe),Ae=o.add(Ae,xe),me=o.mul(Se,Ae),K=o.add(K,me),me=o.mul(_e,Ae),N=o.mul(ke,N),N=o.sub(N,me),me=o.mul(ke,Se),G=o.mul(_e,G),G=o.add(G,me),new P(N,K,G)}subtract(j){return L(j),this.add(j.negate())}is0(){return this.equals(P.ZERO)}multiply(j){let{endo:T}=t;if(!n.isValidNot0(j))throw RangeError("invalid scalar: out of range");let Z,I,R=(A)=>ee.cached(this,A,(q)=>$s(P,q));if(T){let{k1neg:A,k1:q,k2neg:N,k2:K}=z(j),{p:G,f:re}=R(q),{p:ae,f:me}=R(K);I=re.add(me),Z=J(T.beta,G,ae,A,N)}else{let{p:A,f:q}=R(j);Z=A,I=q}return $s(P,[Z,I])[0]}multiplyUnsafe(j){let{endo:T}=t,Z=this,I=j;if(!n.isValid(I))throw RangeError("invalid scalar: out of range");if(I===Bn||Z.is0())return P.ZERO;if(I===mi)return Z;if(ee.hasCache(this))return this.multiply(I);if(T){let{k1neg:R,k1:A,k2neg:q,k2:N}=z(I),{p1:K,p2:G}=cP(P,Z,A,N);return J(T.beta,K,G,R,q)}else return ee.unsafe(Z,I)}toAffine(j){let T=this,Z=j,{X:I,Y:R,Z:A}=T;if(o.eql(A,o.ONE))return{x:I,y:R};let q=T.is0();if(Z==null)Z=q?o.ONE:o.inv(A);let N=o.mul(I,Z),K=o.mul(R,Z),G=o.mul(A,Z);if(q)return{x:o.ZERO,y:o.ZERO};if(!o.eql(G,o.ONE))throw Error("invZ was invalid");return{x:N,y:K}}isTorsionFree(){let{isTorsionFree:j}=t;if(s===mi)return!0;if(j)return j(P,this);return ee.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:j}=t;if(s===mi)return this;if(j)return j(P,this);return this.multiplyUnsafe(s)}isSmallOrder(){if(s===mi)return this.is0();return this.clearCofactor().is0()}toBytes(j=!0){return wo(j,"isCompressed"),this.assertValidity(),b(P,this,j)}toHex(j=!0){return Ba(this.toBytes(j))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let W=n.BITS,ee=new Au(P,t.endo?Math.ceil(W/2):W);if(W>=8)P.BASE.precompute(8);return Object.freeze(P.prototype),Object.freeze(P),P}function hP(e){return Uint8Array.of(e?2:3)}function gP(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function sV(e,t={}){let{Fn:r}=e,o=t.randomBytes===void 0?qa:t.randomBytes,n=Object.assign(gP(e.Fp,r),{seed:Math.max(XS(r.ORDER),16)});function i(h){try{let b=r.fromBytes(h);return r.isValidNot0(b)}catch(b){return!1}}function s(h,b){let{publicKey:y,publicKeyUncompressed:v}=n;try{let x=h.length;if(b===!0&&x!==y)return!1;if(b===!1&&x!==v)return!1;return!!e.fromBytes(h)}catch(x){return!1}}function a(h){return h=h===void 0?o(n.seed):h,rP(Ye(h,n.seed,"seed"),r.ORDER)}function l(h,b=!0){return e.BASE.multiply(r.fromBytes(h)).toBytes(b)}function u(h){let{secretKey:b,publicKey:y,publicKeyUncompressed:v}=n,x=r._lengths;if(!Ma(h))return;let _=Ye(h,void 0,"key").length,k=_===y||_===v,O=_===b||!!x?.includes(_);if(k&&O)return;return k}function d(h,b,y=!0){if(u(h)===!0)throw Error("first arg must be private key");if(u(b)===!1)throw Error("second arg must be public key");let v=r.fromBytes(h);return e.fromBytes(b).multiply(v).toBytes(y)}let p={isValidSecretKey:i,isValidPublicKey:s,randomSecretKey:a},m=ku(a,l);return Object.freeze(p),Object.freeze(n),Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:m,Point:e,utils:p,lengths:n})}function yP(e,t,r={}){let o=t;po(o),Gr(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes===void 0?qa:r.randomBytes,i=r.hmac===void 0?(R,A)=>Pn(o,R,A):r.hmac,{Fp:s,Fn:a}=e,{ORDER:l,BITS:u}=a,{keygen:d,getPublicKey:p,getSharedSecret:m,utils:h,lengths:b}=sV(e,r),y={prehash:!0,lowS:typeof r.lowS==="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},v=l*fP+mi<s.ORDER;function x(R){let A=l>>mi;return R>A}function _(R,A){if(!a.isValidNot0(A))throw Error(`invalid signature ${R}: out of range 1..Point.Fn.ORDER`);return A}function k(){if(v)throw Error('"recovered" sig type is not supported for cofactor >2 curves')}function O(R,A){iv(A);let q=b.signature,N=A==="compact"?q:A==="recovered"?q+1:void 0;return Ye(R,N)}class L{r;s;recovery;constructor(R,A,q){if(this.r=_("r",R),this.s=_("s",A),q!=null){if(k(),![0,1,2,3].includes(q))throw Error("invalid recovery id");this.recovery=q}Object.freeze(this)}static fromBytes(R,A=y.format){O(R,A);let q;if(A==="der"){let{r:re,s:ae}=fn.toSig(Ye(R));return new L(re,ae)}if(A==="recovered")q=R[0],A="compact",R=R.subarray(1);let N=b.signature/2,K=R.subarray(0,N),G=R.subarray(N,N*2);return new L(a.fromBytes(K),a.fromBytes(G),q)}static fromHex(R,A){return this.fromBytes(Ua(R),A)}assertRecovery(){let{recovery:R}=this;if(R==null)throw Error("invalid recovery id: must be present");return R}addRecoveryBit(R){return new L(this.r,this.s,R)}recoverPublicKey(R){let{r:A,s:q}=this,N=this.assertRecovery(),K=N===2||N===3?A+l:A;if(!s.isValid(K))throw Error("invalid recovery id: sig.r+curve.n != R.x");let G=s.toBytes(K),re=e.fromBytes(Jt(hP((N&1)===0),G)),ae=a.inv(K),me=J(Ye(R,void 0,"msgHash")),Se=a.create(-me*ae),xe=a.create(q*ae),ke=e.BASE.multiplyUnsafe(Se).add(re.multiplyUnsafe(xe));if(ke.is0())throw Error("invalid recovery: point at infinify");return ke.assertValidity(),ke}hasHighS(){return x(this.s)}toBytes(R=y.format){if(iv(R),R==="der")return Ua(fn.hexFromSig(this));let{r:A,s:q}=this,N=a.toBytes(A),K=a.toBytes(q);if(R==="recovered")return k(),Jt(Uint8Array.of(this.assertRecovery()),N,K);return Jt(N,K)}toHex(R){return Ba(this.toBytes(R))}}Object.freeze(L.prototype),Object.freeze(L);let z=r.bits2int===void 0?function(A){if(A.length>8192)throw Error("input is too large");let q=ks(A),N=A.length*8-u;return N>0?q>>BigInt(N):q}:r.bits2int,J=r.bits2int_modN===void 0?function(A){return a.create(z(A))}:r.bits2int_modN,P=xu(u);function W(R){return xo("num < 2^"+u,R,Bn,P),a.toBytes(R)}function ee(R,A){return Ye(R,void 0,"message"),A?Ye(o(R),void 0,"prehashed message"):R}function j(R,A,q){let{lowS:N,prehash:K,extraEntropy:G}=ov(q,y);R=ee(R,K);let re=J(R),ae=a.fromBytes(A);if(!a.isValidNot0(ae))throw Error("invalid private key");let me=[W(ae),W(re)];if(G!=null&&G!==!1){let Ae=G===!0?n(b.secretKey):G;me.push(Ye(Ae,void 0,"extraEntropy"))}let Se=Jt(...me),xe=re;function ke(Ae){let _e=z(Ae);if(!a.isValidNot0(_e))return;let Ue=a.inv(_e),De=e.BASE.multiply(_e).toAffine(),Qe=a.create(De.x);if(Qe===Bn)return;let bt=a.create(Ue*a.create(xe+Qe*ae));if(bt===Bn)return;let Tt=(De.x===Qe?0:2)|Number(De.y&mi),Dt=bt;if(N&&x(bt))Dt=a.neg(bt),Tt^=1;return new L(Qe,Dt,v?void 0:Tt)}return{seed:Se,k2sig:ke}}function T(R,A,q={}){let{seed:N,k2sig:K}=j(R,A,q);return F1(o.outputLen,a.BYTES,i)(N,K).toBytes(q.format)}function Z(R,A,q,N={}){let{lowS:K,prehash:G,format:re}=ov(N,y);if(q=Ye(q,void 0,"publicKey"),A=ee(A,G),!Ma(R)){let ae=R instanceof L?", use sig.toBytes()":"";throw Error("verify expects Uint8Array signature"+ae)}O(R,re);try{let ae=L.fromBytes(R,re),me=e.fromBytes(q);if(K&&ae.hasHighS())return!1;let{r:Se,s:xe}=ae,ke=J(A),Ae=a.inv(xe),_e=a.create(ke*Ae),Ue=a.create(Se*Ae),De=e.BASE.multiplyUnsafe(_e).add(me.multiplyUnsafe(Ue));if(De.is0())return!1;return a.create(De.x)===Se}catch(ae){return!1}}function I(R,A,q={}){let{prehash:N}=ov(q,y);return A=ee(A,N),L.fromBytes(R,"recovered").recoverPublicKey(A).toBytes()}return Object.freeze({keygen:d,getPublicKey:p,getSharedSecret:m,utils:h,lengths:b,Point:e,sign:T,verify:Z,recoverPublicKey:I,Signature:L,hash:o})}var dP=(e,t)=>(e+(e>=0?t:-t)/fP)/t,pP,fn,Bn,mi,fP,rm,iV;var bP=S(()=>{Vl();Hr();fi();tm();Eu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */pP=class pP extends Error{constructor(e=""){super(e)}};fn={Err:pP,_tlv:{encode:(e,t)=>{let{Err:r}=fn;if(jn(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if(typeof t!=="string")throw TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new r("tlv.encode: unpadded data");let o=t.length/2,n=vu(o);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let i=o>127?vu(n.length/2|128):"";return vu(e)+i+n+t},decode(e,t){let{Err:r}=fn;t=Ye(t,void 0,"DER data");let o=0;if(e<0||e>255)throw new r("tlv.encode: wrong tag");if(t.length<2||t[o++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[o++],i=!!(n&128),s=0;if(!i)s=n;else{let l=n&127;if(!l)throw new r("tlv.decode(long): indefinite length not supported");if(l>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(o,o+l);if(u.length!==l)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let d of u)s=s<<8|d;if(o+=l,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(o,o+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(o+s)}}},_int:{encode(e){let{Err:t}=fn;if(Gf(e),e<Bn)throw new t("integer: negative integers are not allowed");let r=vu(e);if(Number.parseInt(r[0],16)&8)r="00"+r;if(r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=fn;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ks(e)}},toSig(e){let{Err:t,_int:r,_tlv:o}=fn,n=Ye(e,void 0,"signature"),{v:i,l:s}=o.decode(48,n);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l}=o.decode(2,i),{v:u,l:d}=o.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=fn,o=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s)),i=o+n;return t.encode(48,i)}};Object.freeze(fn._tlv);Object.freeze(fn._int);Object.freeze(fn);Bn=BigInt(0),mi=BigInt(1),fP=BigInt(2),rm=BigInt(3),iV=BigInt(4)});var aV,cV,Ja;var SP=S(()=>{Ra();bP();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */aV=(()=>({p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")}))(),cV=mP(aV),Ja=yP(cV,vt)});function uV(e,t,r,o){let n=e.sqr(r),i=e.sqr(o),s=e.add(e.mul(t.a,n),i),a=e.add(e.ONE,e.mul(t.d,e.mul(n,i)));return e.eql(s,a)}function vP(e,t={}){let r=t,o=em("edwards",e,r,r.FpFnLE),{Fp:n,Fn:i}=o,s=o.CURVE,{h:a}=s;Gr(r,{},{uvRatio:"function"});let l=sv<<BigInt(i.BYTES*8)-xr,u=(y)=>n.create(y),d=r.uvRatio===void 0?(y,v)=>{try{return{isValid:!0,value:n.sqrt(n.div(y,v))}}catch(x){return{isValid:!1,value:hi}}}:r.uvRatio;if(!uV(n,s,s.Gx,s.Gy))throw Error("bad curve params: generator point");function p(y,v,x=!1){let _=x?xr:hi;return xo("coordinate "+y,v,_,l),v}function m(y){if(!(y instanceof h))throw Error("EdwardsPoint expected")}class h{static BASE=new h(s.Gx,s.Gy,xr,u(s.Gx*s.Gy));static ZERO=new h(hi,xr,xr,hi);static Fp=n;static Fn=i;X;Y;Z;T;constructor(y,v,x,_){this.X=p("x",y),this.Y=p("y",v),this.Z=p("z",x,!0),this.T=p("t",_),Object.freeze(this)}static CURVE(){return s}static fromAffine(y){if(y instanceof h)throw Error("extended point not allowed");let{x:v,y:x}=y||{};return p("x",v),p("y",x),new h(v,x,xr,u(v*x))}static fromBytes(y,v=!1){let x=n.BYTES,{a:_,d:k}=s;y=pi(Ye(y,x,"point")),wo(v,"zip215");let O=pi(y),L=y[x-1];O[x-1]=L&-129;let z=pn(O),J=v?l:n.ORDER;xo("point.y",z,hi,J);let P=u(z*z),W=u(P-xr),ee=u(k*P-_),{isValid:j,value:T}=d(W,ee);if(!j)throw Error("bad point: invalid y coordinate");let Z=(T&xr)===xr,I=(L&128)!==0;if(!v&&T===hi&&I)throw Error("bad point: x=0 and x_0=1");if(I!==Z)T=u(-T);return h.fromAffine({x:T,y:z})}static fromHex(y,v=!1){return h.fromBytes(Ua(y),v)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,v=!0){if(b.createCache(this,y),!v)this.multiply(sv);return this}assertValidity(){let y=this,{a:v,d:x}=s;if(y.is0())throw Error("bad point: ZERO");let{X:_,Y:k,Z:O,T:L}=y,z=u(_*_),J=u(k*k),P=u(O*O),W=u(P*P),ee=u(z*v),j=u(P*u(ee+J)),T=u(W+u(x*u(z*J)));if(j!==T)throw Error("bad point: equation left != right (1)");let Z=u(_*k),I=u(O*L);if(Z!==I)throw Error("bad point: equation left != right (2)")}equals(y){m(y);let{X:v,Y:x,Z:_}=this,{X:k,Y:O,Z:L}=y,z=u(v*L),J=u(k*_),P=u(x*L),W=u(O*_);return z===J&&P===W}is0(){return this.equals(h.ZERO)}negate(){return new h(u(-this.X),this.Y,this.Z,u(-this.T))}double(){let{a:y}=s,{X:v,Y:x,Z:_}=this,k=u(v*v),O=u(x*x),L=u(sv*u(_*_)),z=u(y*k),J=v+x,P=u(u(J*J)-k-O),W=z+O,ee=W-L,j=z-O,T=u(P*ee),Z=u(W*j),I=u(P*j),R=u(ee*W);return new h(T,Z,R,I)}add(y){m(y);let{a:v,d:x}=s,{X:_,Y:k,Z:O,T:L}=this,{X:z,Y:J,Z:P,T:W}=y,ee=u(_*z),j=u(k*J),T=u(L*x*W),Z=u(O*P),I=u((_+k)*(z+J)-ee-j),R=Z-T,A=Z+T,q=u(j-v*ee),N=u(I*R),K=u(A*q),G=u(I*q),re=u(R*A);return new h(N,K,re,G)}subtract(y){return m(y),this.add(y.negate())}multiply(y){if(!i.isValidNot0(y))throw RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:v,f:x}=b.cached(this,y,(_)=>$s(h,_));return $s(h,[v,x])[0]}multiplyUnsafe(y){if(!i.isValid(y))throw RangeError("invalid scalar: expected 0 <= sc < curve.n");if(y===hi)return h.ZERO;if(this.is0()||y===xr)return this;return b.unsafe(this,y,(v)=>$s(h,v))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return b.unsafe(this,s.n).is0()}toAffine(y){let v=this,x=y,{X:_,Y:k,Z:O}=v,L=v.is0();if(x==null)x=L?lV:n.inv(O);let z=u(_*x),J=u(k*x),P=n.mul(O,x);if(L)return{x:hi,y:xr};if(P!==xr)throw Error("invZ was invalid");return{x:z,y:J}}clearCofactor(){if(a===xr)return this;return this.multiplyUnsafe(a)}toBytes(){let{x:y,y:v}=this.toAffine(),x=n.toBytes(v);return x[x.length-1]|=y&xr?128:0,x}toHex(){return Ba(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let b=new Au(h,i.BITS);if(i.BITS>=8)h.BASE.precompute(8);return Object.freeze(h.prototype),Object.freeze(h),h}class av{static BASE;static ZERO;static Fp;static Fn;ep;constructor(e){this.ep=e}static fromBytes(e){WS()}static fromHex(e){WS()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return Ba(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.ep.precompute(e,t),this}}var hi,xr,sv,lV;var wP=S(()=>{fi();tm();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */hi=BigInt(0),xr=BigInt(1),sv=BigInt(2),lV=BigInt(8)});function dV(e){return Gr(e,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...e})}function xP(e){let t=dV(e),{P:r,type:o,adjustScalarBytes:n,powPminus2:i,randomBytes:s}=t,a=o==="x25519";if(!a&&o!=="x448")throw Error("invalid type");let l=s===void 0?qa:s,u=a?255:448,d=a?32:56,p=a?BigInt(9):BigInt(5),m=a?BigInt(121665):BigInt(39081),h=a?nm**BigInt(254):nm**BigInt(447),b=a?BigInt(8)*nm**BigInt(251)-Ka:BigInt(4)*nm**BigInt(445)-Ka,y=h+b+Ka,v=(I)=>it(I,r),x=_(p);function _(I){return wu(v(I),d)}function k(I){let R=pi(Ye(I,d,"uCoordinate"));if(a)R[31]&=127;return v(pn(R))}function O(I){return pn(n(pi(Ye(I,d,"scalar"))))}function L(I,R){let A=ee(k(R),O(I));if(A===Tu)throw Error("invalid private or public key received");return _(A)}function z(I){return L(I,x)}let J=z,P=L;function W(I,R,A){let q=v(I*(R-A));return R=v(R-q),A=v(A+q),{x_2:R,x_3:A}}function ee(I,R){xo("u",I,Tu,r),xo("scalar",R,h,y);let A=R,q=I,N=Ka,K=Tu,G=I,re=Ka,ae=Tu;for(let Se=BigInt(u-1);Se>=Tu;Se--){let xe=A>>Se&Ka;ae^=xe,{x_2:N,x_3:G}=W(ae,N,G),{x_2:K,x_3:re}=W(ae,K,re),ae=xe;let ke=N+K,Ae=v(ke*ke),_e=N-K,Ue=v(_e*_e),De=Ae-Ue,Qe=G+re,bt=G-re,Tt=v(bt*ke),Dt=v(Qe*_e),lt=Tt+Dt,Or=Tt-Dt;G=v(lt*lt),re=v(q*v(Or*Or)),N=v(Ae*Ue),K=v(De*(Ae+v(m*De)))}({x_2:N,x_3:G}=W(ae,N,G)),{x_2:K,x_3:re}=W(ae,K,re);let me=i(K);return v(N*me)}let j={secretKey:d,publicKey:d,seed:d},T=(I)=>(I=I===void 0?l(d):I,Ye(I,j.seed,"seed"),I),Z={randomSecretKey:T};return Object.freeze(j),Object.freeze(Z),Object.freeze({keygen:ku(T,J),getSharedSecret:P,getPublicKey:J,scalarMult:L,scalarMultBase:z,utils:Z,GuBytes:x.slice(),lengths:j})}var Tu,Ka,nm;var _P=S(()=>{fi();tm();Eu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Tu=BigInt(0),Ka=BigInt(1),nm=BigInt(2)});function kP(e){let t=BigInt(10),r=BigInt(20),o=BigInt(40),n=BigInt(80),i=Cs,a=e*e%i*e%i,l=Qr(a,EP,i)*a%i,u=Qr(l,Eo,i)*e%i,d=Qr(u,mV,i)*u%i,p=Qr(d,t,i)*d%i,m=Qr(p,r,i)*p%i,h=Qr(m,o,i)*m%i,b=Qr(h,n,i)*h%i,y=Qr(b,n,i)*h%i,v=Qr(y,t,i)*d%i;return{pow_p_5_8:Qr(v,EP,i)*e%i,b2:a}}function gV(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function pv(e,t){let r=Cs,o=it(t*t*t,r),n=it(o*o*t,r),i=kP(e*n).pow_p_5_8,s=it(e*o*i,r),a=it(t*s*s,r),l=s,u=it(s*cv,r),d=a===e,p=a===it(-e,r),m=a===it(-e*cv,r);if(d)s=l;if(p||m)s=u;if(_o(s,r))s=it(-s,r);return{isValid:d||p,value:s}}function AP(e){let{d:t}=dv,r=Cs,o=(x)=>gi.create(x),n=o(lv*e*e),i=o((n+Eo)*SV),s=BigInt(-1),a=o((s-t*n)*o(n+t)),{isValid:l,value:u}=pv(i,a),d=o(u*e);if(!_o(d,r))d=o(-d);if(!l)u=d;if(!l)s=n;let p=o(s*(n-Eo)*vV-a),m=u*u,h=o((u+u)*a),b=o(p*yV),y=o(Eo-m),v=o(Eo+m);return new Os(o(h*v),o(y*b),o(b*v),o(h*y))}var pV,Eo,EP,fV,mV,hV,Cs,dv,cv,Os,gi,RP,om,lv,yV,bV,SV,vV,IP=(e)=>pv(Eo,e),wV,uv=(e)=>gi.create(pn(e)&wV),dr,xV;var TP=S(()=>{Ra();Hr();wP();uP();Eu();_P();fi();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */pV=BigInt(0),Eo=BigInt(1),EP=BigInt(2),fV=BigInt(3),mV=BigInt(5),hV=BigInt(8),Cs=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),dv=(()=>({p:Cs,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:hV,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();cv=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");Os=vP(dv,{uvRatio:pv}),gi=(()=>Os.Fp)(),RP=(()=>Os.Fn)(),om=(()=>{let e=Cs;return xP({P:e,type:"x25519",powPminus2:(t)=>{let{pow_p_5_8:r,b2:o}=kP(t);return it(Qr(r,fV,e)*o,e)},adjustScalarBytes:gV})})(),lv=cv,yV=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),bV=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),SV=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),vV=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),wV=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");dr=class dr extends av{static BASE=(()=>new dr(Os.BASE))();static ZERO=(()=>new dr(Os.ZERO))();static Fp=(()=>gi)();static Fn=(()=>RP)();constructor(e){super(e)}static fromAffine(e){return new dr(Os.fromAffine(e))}assertSame(e){if(!(e instanceof dr))throw Error("RistrettoPoint expected")}init(e){return new dr(e)}static fromBytes(e){Mt(e,32);let{a:t,d:r}=dv,o=Cs,n=(k)=>gi.create(k),i=uv(e);if(!q1(gi.toBytes(i),e)||_o(i,o))throw Error("invalid ristretto255 encoding 1");let s=n(i*i),a=n(Eo+t*s),l=n(Eo-t*s),u=n(a*a),d=n(l*l),p=n(t*r*u-d),{isValid:m,value:h}=IP(n(p*d)),b=n(h*l),y=n(h*b*p),v=n((i+i)*b);if(_o(v,o))v=n(-v);let x=n(a*y),_=n(v*x);if(!m||_o(_,o)||x===pV)throw Error("invalid ristretto255 encoding 2");return new dr(new Os(v,x,Eo,_))}static fromHex(e){return dr.fromBytes(Kl(e))}toBytes(){let{X:e,Y:t,Z:r,T:o}=this.ep,n=Cs,i=(y)=>gi.create(y),s=i(i(r+t)*i(r-t)),a=i(e*t),l=i(a*a),{value:u}=IP(i(s*l)),d=i(u*s),p=i(u*a),m=i(d*p*o),h;if(_o(o*m,n)){let y=i(t*lv),v=i(e*lv);e=y,t=v,h=i(d*bV)}else h=p;if(_o(e*m,n))t=i(-t);let b=i((r-t)*h);if(_o(b,n))b=i(-b);return gi.toBytes(b)}equals(e){this.assertSame(e);let{X:t,Y:r}=this.ep,{X:o,Y:n}=e.ep,i=(l)=>gi.create(l),s=i(t*n)===i(r*o),a=i(r*n)===i(t*o);return s||a}is0(){return this.equals(dr.ZERO)}};Object.freeze(dr.BASE);Object.freeze(dr.ZERO);Object.freeze(dr.prototype);Object.freeze(dr);xV=Object.freeze({Point:dr,hashToCurve(e,t){let r=t?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":t.DST,o=nv(e,r,64,bf);return xV.deriveToCurve(o)},hashToScalar(e,t={DST:lP}){let r=nv(e,t.DST,64,bf);return RP.create(pn(r))},deriveToCurve(e){Mt(e,64);let t=uv(e.subarray(0,32)),r=AP(t),o=uv(e.subarray(32,64)),n=AP(o);return new dr(r.add(n))}})});async function OP(e,t){if(_V)return await t();try{return await e()}catch(r){if(r instanceof ReferenceError||r instanceof DOMException&&r.name==="NotSupportedError")return await t();else throw r}}async function im(e,t){return await OP(async()=>{let r=fv(e)?e:await IV(e),o=await crypto.subtle.importKey("raw",AV(t),{name:"X25519"},$P,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:o},r,256))},()=>{if(fv(e))throw Error("CryptoKey provided but X25519 WebCrypto is not supported");return om.scalarMult(e,t)})}async function $u(e){return await OP(async()=>im(e,om.GuBytes),()=>{if(fv(e))throw Error("CryptoKey provided but X25519 WebCrypto is not supported");return om.scalarMultBase(e)})}async function IV(e){if(e.length!==32)throw Error("X25519 private key must be 32 bytes");let t=new Uint8Array([...EV,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},$P,["deriveBits"])}function fv(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}function AV(e){return e}var $P=!1,_V=!1,EV;var CP=S(()=>{TP();EV=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32])});class mv{s;transcript=[];buf=new Uint8Array(0);constructor(e){this.s=e.getReader()}async readLine(){let e=[];while(!0){let t=this.buf.indexOf(10);if(t>=0)return e.push(this.buf.subarray(0,t)),this.transcript.push(this.buf.subarray(0,t+1)),this.buf=this.buf.subarray(t+1),RV(Ps(e));if(this.buf.length>0)e.push(this.buf),this.transcript.push(this.buf);let r=await this.s.read();if(r.done)return this.buf=Ps(e),null;this.buf=r.value}}close(){return this.s.releaseLock(),{rest:this.buf,transcript:Ps(this.transcript)}}}function RV(e){return e.forEach((t)=>{if(t<32||t>126)throw Error("invalid non-ASCII byte in header")}),new TextDecoder().decode(e)}function Ps(e){let t=e.reduce((n,i)=>n+i.length,0),r=new Uint8Array(t),o=0;for(let n of e)r.set(n,o),o+=n.length;return r}function Va(e,...t){return e.pipeThrough(new TransformStream({start(r){for(let o of t)r.enqueue(o)}}))}function sm(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function hv(e){if(!(e instanceof ReadableStream))throw Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function PP(e){if(!(e instanceof ReadableStream))throw Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function zP(e,t){let r=e.getReader(),o=[],n=0;while(n<t){let{done:l,value:u}=await r.read();if(l)throw Error("stream ended before reading "+t.toString()+" bytes");o.push(u),n+=u.length}r.releaseLock();let i=Ps(o),s=i.subarray(0,t),a=Va(e,i.subarray(t));return{data:s,rest:a}}var gv=()=>{};class Un{args;body;constructor(e,t){this.args=e,this.body=t}}async function TV(e){let t=await e.readLine();if(t===null)throw Error("invalid stanza");let r=t.split(" ");if(r.length<2||r.shift()!=="->")return{next:t};for(let i of r)if(i.length===0)throw Error("invalid stanza");let o=[];for(;;){let i=await e.readLine();if(i===null)throw Error("invalid stanza");let s=Yt.decode(i);if(s.length>48)throw Error("invalid stanza");if(o.push(s),s.length<48)break}let n=Ps(o);return{s:new Un(r,n)}}async function NP(e){let t=new mv(e),r=await t.readLine();if(r!=="age-encryption.org/v1")throw Error("invalid version "+(r??"line"));let o=[];for(;;){let{s:n,next:i}=await TV(t);if(n!==void 0){o.push(n);continue}if(!i.startsWith("--- "))throw Error("invalid header");let s=Yt.decode(i.slice(4)),{rest:a,transcript:l}=t.close(),u=l.slice(0,l.length-1-i.length+3);return{stanzas:o,headerNoMAC:u,MAC:s,headerSize:l.length,rest:Va(e,a)}}}function yv(e){let t=[];t.push(`age-encryption.org/v1
|
|
3
|
+
var WH=Object.create;var{getPrototypeOf:GH,defineProperty:Ub,getOwnPropertyNames:QH}=Object;var YH=Object.prototype.hasOwnProperty;function XH(e){return this[e]}var eJ,tJ,Jl=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?eJ??=new WeakMap:tJ??=new WeakMap,i=n.get(e);if(i)return i}r=e!=null?WH(GH(e)):{};let s=t||!e||!e.__esModule?Ub(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of QH(e))if(!YH.call(s,a))Ub(s,a,{get:XH.bind(e,a),enumerable:!0})}if(o)n.set(e,s);return s};var ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var rJ=(e)=>e;function nJ(e,t){this[e]=rJ.bind(null,t)}var Lt=(e,t)=>{for(var r in t)Ub(e,r,{get:t[r],enumerable:!0,configurable:!0,set:nJ.bind(t,r)})};var S=(e,t)=>()=>(e&&(t=e(e=0)),t);var Fr=import.meta.require;function Ve(e,t){if(e instanceof Error)return e.message;return t??String(e)}function Mb(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function St(e,t=""){if(typeof e!=="number"){let r=t&&`"${t}" `;throw TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw RangeError(`${r}expected integer >= 0, got ${e}`)}}function Mt(e,t,r=""){let o=Mb(e),n=e?.length,i=t!==void 0;if(!o||i&&n!==t){let s=r&&`"${r}" `,a=i?` of length ${t}`:"",l=o?`length=${n}`:`type=${typeof e}`,u=s+"expected Uint8Array"+a+", got "+l;if(!o)throw TypeError(u);throw RangeError(u)}return e}function fo(e){if(typeof e!=="function"||typeof e.create!=="function")throw TypeError("Hash must wrapped by utils.createHasher");if(St(e.outputLen),St(e.blockLen),e.outputLen<1)throw Error('"outputLen" must be >= 1');if(e.blockLen<1)throw Error('"blockLen" must be >= 1')}function Aa(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function pf(e,t){Mt(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw RangeError('"digestInto() output" expected to be of length >='+r)}function ff(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function cr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ka(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ln(e,t){return e<<32-t|e>>>t}function Fe(e,t){return e<<t|e>>>32-t>>>0}function mJ(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function hJ(e){for(let t=0;t<e.length;t++)e[t]=mJ(e[t]);return e}function mf(e){if(Mt(e),hO)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=gJ[e[r]];return t}function mO(e){if(e>=po._0&&e<=po._9)return e-po._0;if(e>=po.A&&e<=po.F)return e-(po.A-10);if(e>=po.a&&e<=po.f)return e-(po.a-10);return}function Kl(e){if(typeof e!=="string")throw TypeError("hex string expected, got "+typeof e);if(hO)try{return Uint8Array.fromHex(e)}catch(n){if(n instanceof SyntaxError)throw RangeError(n.message);throw n}let t=e.length,r=t/2;if(t%2)throw RangeError("hex string expected, got unpadded hex of length "+t);let o=new Uint8Array(r);for(let n=0,i=0;n<r;n++,i+=2){let s=mO(e.charCodeAt(i)),a=mO(e.charCodeAt(i+1));if(s===void 0||a===void 0){let l=e[i]+e[i+1];throw RangeError('hex string expected, got non-hex character "'+l+'" at index '+i)}o[n]=s*16+a}return o}function yJ(e){if(typeof e!=="string")throw TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Fb(e,t=""){if(typeof e==="string")return yJ(e);return Mt(e,void 0,t)}function Hb(...e){let t=0;for(let o=0;o<e.length;o++){let n=e[o];Mt(n),t+=n.length}let r=new Uint8Array(t);for(let o=0,n=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return r}function hf(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw TypeError("options must be object or undefined");return Object.assign(e,t)}function Jb(e,t={}){let r=(n,i)=>e(i).update(n).digest(),o=e(void 0);return r.outputLen=o.outputLen,r.blockLen=o.blockLen,r.canXOF=o.canXOF,r.create=(n)=>e(n),Object.assign(r,t),Object.freeze(r)}function mo(e=32){St(e,"bytesLength");let t=typeof globalThis==="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!=="function")throw Error("crypto.getRandomValues must be defined");if(e>65536)throw RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var fJ,qb,hO,gJ,po,Kb=(e)=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Hr=S(()=>{fJ=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();qb=fJ?(e)=>e:hJ,hO=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),gJ=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));po={_0:48,_9:57,A:65,F:70,a:97,f:102}});class Vb{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if(fo(e),Mt(t,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,o=new Uint8Array(r);o.set(t.length>r?e.create().update(t).digest():t);for(let n=0;n<o.length;n++)o[n]^=54;this.iHash.update(o),this.oHash=e.create();for(let n=0;n<o.length;n++)o[n]^=106;this.oHash.update(o),cr(o)}update(e){return Aa(this),this.iHash.update(e),this}digestInto(e){Aa(this),pf(e,this),this.finished=!0;let t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:r,finished:o,destroyed:n,blockLen:i,outputLen:s}=this;return e=e,e.finished=o,e.destroyed=n,e.blockLen=i,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var Pn;var Vl=S(()=>{Hr();Pn=(()=>{let e=(t,r,o)=>new Vb(t,r).update(o).digest();return e.create=(t,r)=>new Vb(t,r),e})()});function Wl(e,t,r){if(fo(e),r===void 0)r=new Uint8Array(e.outputLen);return Pn(e,r,t)}function Gb(e,t,r,o=32){fo(e),St(o,"length"),Mt(t,void 0,"prk");let n=e.outputLen;if(t.length<n)throw Error('"prk" must be at least HashLen octets');if(o>255*n)throw Error("Length must be <= 255*HashLen");let i=Math.ceil(o/n);if(r===void 0)r=gO;else Mt(r,void 0,"info");let s=new Uint8Array(i*n),a=Pn.create(e,t),l=a._cloneInto(),u=new Uint8Array(a.outputLen);for(let d=0;d<i;d++)Wb[0]=d+1,l.update(d===0?gO:u).update(r).update(Wb).digestInto(u),s.set(u,n*d),a._cloneInto(l);return a.destroy(),l.destroy(),cr(u,Wb),s.slice(0,o)}var Wb,gO,Yo=(e,t,r,o,n)=>Gb(e,Wl(e,t,r),o,n);var Qb=S(()=>{Vl();Hr();Wb=Uint8Array.of(0),gO=Uint8Array.of()});function yO(e,t,r){return e&t^~e&r}function bO(e,t,r){return e&t^e&r^t&r}class gf{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,o){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(e),this.view=ka(this.buffer)}update(e){Aa(this),Mt(e);let{view:t,buffer:r,blockLen:o}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(o-this.pos,n-i);if(s===o){let a=ka(e);for(;o<=n-i;i+=o)this.process(a,i);continue}if(r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===o)this.process(t,0),this.pos=0}return this.length+=e.length,this.roundClean(),this}digestInto(e){Aa(this),pf(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:o,isLE:n}=this,{pos:i}=this;if(t[i++]=128,cr(this.buffer.subarray(i)),this.padOffset>o-i)this.process(r,0),i=0;for(let d=i;d<o;d++)t[d]=0;r.setBigUint64(o-8,BigInt(this.length*8),n),this.process(r,0);let s=ka(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen must be aligned to 32bit");let l=a/4,u=this.get();if(l>u.length)throw Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)s.setUint32(4*d,u[d],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:o,finished:n,destroyed:i,pos:s}=this;if(e.destroyed=i,e.finished=n,e.length=o,e.pos=s,o%t)e.buffer.set(r);return e}clone(){return this._cloneInto()}}var ho,qt;var SO=S(()=>{Hr();ho=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qt=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function bJ(e,t=!1){if(t)return{h:Number(e&yf),l:Number(e>>vO&yf)};return{h:Number(e>>vO&yf)|0,l:Number(e&yf)|0}}function wO(e,t=!1){let r=e.length,o=new Uint32Array(r),n=new Uint32Array(r);for(let i=0;i<r;i++){let{h:s,l:a}=bJ(e[i],t);[o[i],n[i]]=[s,a]}return[o,n]}function zn(e,t,r,o){let n=(t>>>0)+(o>>>0);return{h:e+r+(n/4294967296|0)|0,l:n|0}}var yf,vO,Yb=(e,t,r)=>e>>>r,Xb=(e,t,r)=>e<<32-r|t>>>r,fs=(e,t,r)=>e>>>r|t<<32-r,ms=(e,t,r)=>e<<32-r|t>>>r,Gl=(e,t,r)=>e<<64-r|t>>>r-32,Ql=(e,t,r)=>e>>>r-32|t<<64-r,xO=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),_O=(e,t,r,o)=>t+r+o+(e/4294967296|0)|0,EO=(e,t,r,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0),IO=(e,t,r,o,n)=>t+r+o+n+(e/4294967296|0)|0,AO=(e,t,r,o,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0)+(n>>>0),kO=(e,t,r,o,n,i)=>t+r+o+n+i+(e/4294967296|0)|0;var RO=S(()=>{yf=BigInt(4294967295),vO=BigInt(32)});var vJ,Xo,TO,$O,OO,wJ,xJ,ei,ti,CO,PO,vt,bf;var Ra=S(()=>{SO();RO();Hr();vJ=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Xo=new Uint32Array(64);TO=class TO extends gf{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:o,E:n,F:i,G:s,H:a}=this;return[e,t,r,o,n,i,s,a]}set(e,t,r,o,n,i,s,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=n|0,this.F=i|0,this.G=s|0,this.H=a|0}process(e,t){for(let d=0;d<16;d++,t+=4)Xo[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let p=Xo[d-15],m=Xo[d-2],h=ln(p,7)^ln(p,18)^p>>>3,b=ln(m,17)^ln(m,19)^m>>>10;Xo[d]=b+Xo[d-7]+h+Xo[d-16]|0}let{A:r,B:o,C:n,D:i,E:s,F:a,G:l,H:u}=this;for(let d=0;d<64;d++){let p=ln(s,6)^ln(s,11)^ln(s,25),m=u+p+yO(s,a,l)+vJ[d]+Xo[d]|0,b=(ln(r,2)^ln(r,13)^ln(r,22))+bO(r,o,n)|0;u=l,l=a,a=s,s=i+m|0,i=n,n=o,o=r,r=m+b|0}r=r+this.A|0,o=o+this.B|0,n=n+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,o,n,i,s,a,l,u)}roundClean(){cr(Xo)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),cr(this.buffer)}};$O=class $O extends TO{A=ho[0]|0;B=ho[1]|0;C=ho[2]|0;D=ho[3]|0;E=ho[4]|0;F=ho[5]|0;G=ho[6]|0;H=ho[7]|0;constructor(){super(32)}};OO=(()=>wO(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e)=>BigInt(e))))(),wJ=(()=>OO[0])(),xJ=(()=>OO[1])(),ei=new Uint32Array(80),ti=new Uint32Array(80);CO=class CO extends gf{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:r,Bl:o,Ch:n,Cl:i,Dh:s,Dl:a,Eh:l,El:u,Fh:d,Fl:p,Gh:m,Gl:h,Hh:b,Hl:y}=this;return[e,t,r,o,n,i,s,a,l,u,d,p,m,h,b,y]}set(e,t,r,o,n,i,s,a,l,u,d,p,m,h,b,y){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=o|0,this.Ch=n|0,this.Cl=i|0,this.Dh=s|0,this.Dl=a|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=p|0,this.Gh=m|0,this.Gl=h|0,this.Hh=b|0,this.Hl=y|0}process(e,t){for(let _=0;_<16;_++,t+=4)ei[_]=e.getUint32(t),ti[_]=e.getUint32(t+=4);for(let _=16;_<80;_++){let k=ei[_-15]|0,O=ti[_-15]|0,L=fs(k,O,1)^fs(k,O,8)^Yb(k,O,7),z=ms(k,O,1)^ms(k,O,8)^Xb(k,O,7),J=ei[_-2]|0,P=ti[_-2]|0,W=fs(J,P,19)^Gl(J,P,61)^Yb(J,P,6),ee=ms(J,P,19)^Ql(J,P,61)^Xb(J,P,6),j=EO(z,ee,ti[_-7],ti[_-16]),T=IO(j,L,W,ei[_-7],ei[_-16]);ei[_]=T|0,ti[_]=j|0}let{Ah:r,Al:o,Bh:n,Bl:i,Ch:s,Cl:a,Dh:l,Dl:u,Eh:d,El:p,Fh:m,Fl:h,Gh:b,Gl:y,Hh:v,Hl:x}=this;for(let _=0;_<80;_++){let k=fs(d,p,14)^fs(d,p,18)^Gl(d,p,41),O=ms(d,p,14)^ms(d,p,18)^Ql(d,p,41),L=d&m^~d&b,z=p&h^~p&y,J=AO(x,O,z,xJ[_],ti[_]),P=kO(J,v,k,L,wJ[_],ei[_]),W=J|0,ee=fs(r,o,28)^Gl(r,o,34)^Gl(r,o,39),j=ms(r,o,28)^Ql(r,o,34)^Ql(r,o,39),T=r&n^r&s^n&s,Z=o&i^o&a^i&a;v=b|0,x=y|0,b=m|0,y=h|0,m=d|0,h=p|0,{h:d,l:p}=zn(l|0,u|0,P|0,W|0),l=s|0,u=a|0,s=n|0,a=i|0,n=r|0,i=o|0;let I=xO(W,j,Z);r=_O(I,P,ee,T),o=I|0}({h:r,l:o}=zn(this.Ah|0,this.Al|0,r|0,o|0)),{h:n,l:i}=zn(this.Bh|0,this.Bl|0,n|0,i|0),{h:s,l:a}=zn(this.Ch|0,this.Cl|0,s|0,a|0),{h:l,l:u}=zn(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:p}=zn(this.Eh|0,this.El|0,d|0,p|0),{h:m,l:h}=zn(this.Fh|0,this.Fl|0,m|0,h|0),{h:b,l:y}=zn(this.Gh|0,this.Gl|0,b|0,y|0),{h:v,l:x}=zn(this.Hh|0,this.Hl|0,v|0,x|0),this.set(r,o,n,i,s,a,l,u,d,p,m,h,b,y,v,x)}roundClean(){cr(ei,ti)}destroy(){this.destroyed=!0,cr(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};PO=class PO extends CO{Ah=qt[0]|0;Al=qt[1]|0;Bh=qt[2]|0;Bl=qt[3]|0;Ch=qt[4]|0;Cl=qt[5]|0;Dh=qt[6]|0;Dl=qt[7]|0;Eh=qt[8]|0;El=qt[9]|0;Fh=qt[10]|0;Fl=qt[11]|0;Gh=qt[12]|0;Gl=qt[13]|0;Hh=qt[14]|0;Hl=qt[15]|0;constructor(){super(64)}};vt=Jb(()=>new $O,Kb(1)),bf=Jb(()=>new PO,Kb(3))});function _f(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function rS(e){if(!_f(e))throw TypeError("Uint8Array expected")}function ZO(e,t){if(!Array.isArray(t))return!1;if(t.length===0)return!0;if(e)return t.every((r)=>typeof r==="string");else return t.every((r)=>Number.isSafeInteger(r))}function jO(e){if(typeof e!=="function")throw TypeError("function expected");return!0}function ri(e,t){if(typeof t!=="string")throw TypeError(`${e}: string expected`);return!0}function Xl(e){if(typeof e!=="number")throw TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw RangeError(`invalid integer: ${e}`)}function vf(e){if(!Array.isArray(e))throw TypeError("array expected")}function wf(e,t){if(!ZO(!0,t))throw TypeError(`${e}: array of strings expected`)}function nS(e,t){if(!ZO(!1,t))throw TypeError(`${e}: array of numbers expected`)}function Cr(...e){let t=(i)=>i,r=(i,s)=>(a)=>i(s(a)),o=e.map((i)=>i.encode).reduceRight(r,t),n=e.map((i)=>i.decode).reduce(r,t);return{encode:o,decode:n}}function Pr(e){let t=typeof e==="string"?e.split(""):e,r=t.length;wf("alphabet",t);let o=new Map(t.map((n,i)=>[n,i]));return{encode:(n)=>(vf(n),n.map((i)=>{if(!Number.isSafeInteger(i)||i<0||i>=r)throw Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${e}`);return t[i]})),decode:(n)=>(vf(n),n.map((i)=>{ri("alphabet.decode",i);let s=o.get(i);if(s===void 0)throw Error(`Unknown letter: "${i}". Allowed: ${e}`);return s}))}}function zr(e=""){return ri("join",e),{encode:(t)=>(wf("join.decode",t),t.join(e)),decode:(t)=>(ri("join.decode",t),t.split(e))}}function Ef(e,t="="){return Xl(e),ri("padding",t),{encode(r){wf("padding.encode",r);while(r.length*e%8)r.push(t);return r},decode(r){wf("padding.decode",r);let o=r.length;if(o*e%8)throw Error("padding: invalid, string should have whole number of bytes");for(;o>0&&r[o-1]===t;o--)if((o-1)*e%8===0)throw Error("padding: invalid, string has too much padding");return r.slice(0,o)}}}function BO(e){return jO(e),{encode:(t)=>t,decode:(t)=>e(t)}}function zO(e,t,r){if(t<2)throw RangeError(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(r<2)throw RangeError(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(vf(e),!e.length)return[];let o=0,n=[],i=Array.from(e,(a)=>{if(Xl(a),a<0||a>=t)throw Error(`invalid integer: ${a}`);return a}),s=i.length;while(!0){let a=0,l=!0;for(let u=o;u<s;u++){let d=i[u],p=t*a,m=p+d;if(!Number.isSafeInteger(m)||p/t!==a||m-d!==p)throw Error("convertRadix: carry overflow");let h=m/r;a=m%r;let b=Math.floor(h);if(i[u]=b,!Number.isSafeInteger(b)||b*r+a!==m)throw Error("convertRadix: carry overflow");if(!l)continue;else if(!b)o=u;else l=!1}if(n.push(a),l)break}for(let a=0;a<e.length-1&&e[a]===0;a++)n.push(0);return n.reverse()}function eS(e,t,r,o){if(vf(e),t<=0||t>32)throw RangeError(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw RangeError(`convertRadix2: wrong to=${r}`);if(xf(t,r)>32)throw Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${xf(t,r)}`);let n=0,i=0,s=Sf[t],a=Sf[r]-1,l=[];for(let u of e){if(Xl(u),u>=s)throw Error(`convertRadix2: invalid data word=${u} from=${t}`);if(n=n<<t|u,i+t>32)throw Error(`convertRadix2: carry overflow pos=${i} from=${t}`);i+=t;for(;i>=r;i-=r)l.push((n>>i-r&a)>>>0);let d=Sf[i];if(d===void 0)throw Error("invalid carry");n&=d-1}if(n=n<<r-i&a,!o&&i>=t)throw Error("Excess padding");if(!o&&n>0)throw Error(`Non-zero padding: ${n}`);if(o&&i>0)l.push(n>>>0);return l}function _J(e){Xl(e);let t=256;return{encode:(r)=>{if(!_f(r))throw TypeError("radix.encode input should be Uint8Array");return zO(Array.from(r),t,e)},decode:(r)=>(nS("radix.decode",r),Uint8Array.from(zO(r,e,t)))}}function Jr(e,t=!1){if(Xl(e),e<=0||e>32)throw RangeError("radix2: bits should be in (0..32]");if(xf(8,e)>32||xf(e,8)>32)throw RangeError("radix2: carry overflow");return{encode:(r)=>{if(!_f(r))throw TypeError("radix2.encode input should be Uint8Array");return eS(Array.from(r),8,e,!t)},decode:(r)=>(nS("radix2.decode",r),Uint8Array.from(eS(r,e,8,t)))}}function NO(e){return jO(e),function(...t){try{return e.apply(null,t)}catch(r){}}}function Yl(e){let t=e>>25,r=(e&33554431)<<5;for(let o=0;o<DO.length;o++)if((t>>o&1)===1)r^=DO[o];return r}function LO(e,t,r=1){let o=e.length,n=1;for(let i=0;i<o;i++){let s=e.charCodeAt(i);if(s<33||s>126)throw Error(`Invalid prefix (${e})`);n=Yl(n)^s>>5}n=Yl(n);for(let i=0;i<o;i++)n=Yl(n)^e.charCodeAt(i)&31;for(let i of t)n=Yl(n)^i;for(let i=0;i<6;i++)n=Yl(n);return n^=r,tS.encode(eS([n%Sf[30]],30,5,!1))}function FO(e){let t=e==="bech32"?1:734539939,r=Jr(5),o=r.decode,n=r.encode,i=NO(o);function s(p,m,h=90){if(ri("bech32.encode prefix",p),_f(m))m=Array.from(m);nS("bech32.encode",m);let b=p.length;if(b===0)throw TypeError(`Invalid prefix length ${b}`);let y=b+7+m.length;if(h!==!1&&y>h)throw TypeError(`Length ${y} exceeds limit ${h}`);let v=p.toLowerCase(),x=LO(v,m,t);return`${v}1${tS.encode(m)}${x}`}function a(p,m=90){ri("bech32.decode input",p);let h=p.length;if(h<8||m!==!1&&h>m)throw TypeError(`invalid string length: ${h} (${p}). Expected (8..${m})`);let b=p.toLowerCase();if(p!==b&&p!==p.toUpperCase())throw Error("String must be lowercase or uppercase");let y=b.lastIndexOf("1");if(y===0||y===-1)throw Error('Letter "1" must be present between prefix and data only');let v=b.slice(0,y),x=b.slice(y+1);if(x.length<6)throw Error("Data must be at least 6 characters long");let _=tS.decode(x).slice(0,-6),k=LO(v,_,t);if(!x.endsWith(k))throw Error(`Invalid checksum in ${p}: expected "${k}"`);return{prefix:v,words:_}}let l=NO(a);function u(p){let{prefix:m,words:h}=a(p,!1);return{prefix:m,words:h,bytes:o(h)}}function d(p,m){return s(p,n(m))}return{encode:s,decode:a,encodeFromBytes:d,decodeToBytes:u,decodeUnsafe:l,fromWords:o,fromWordsUnsafe:i,toWords:n}}var UO=(e,t)=>t===0?e:UO(t,e%t),xf=(e,t)=>e+(t-UO(e,t)),Sf,jye,Bye,Uye,Mye,qye,Fye,MO,EJ,qO=(e,t)=>{ri("base64",e);let r=t?"base64url":"base64";if(e.length>0&&EJ.test(e))throw Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},oS,Yt,Hye,Jye,iS=(e)=>Cr(_J(58),Pr(e),zr("")),Kye,Vye,Wye,tS,DO,Nr,Gye,IJ,AJ,Qye;var eu=S(()=>{/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */Sf=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();jye=Object.freeze(Cr(Jr(4),Pr("0123456789ABCDEF"),zr(""))),Bye=Object.freeze(Cr(Jr(5),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Ef(5),zr(""))),Uye=Object.freeze(Cr(Jr(5),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),zr(""))),Mye=Object.freeze(Cr(Jr(5),Pr("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Ef(5),zr(""))),qye=Object.freeze(Cr(Jr(5),Pr("0123456789ABCDEFGHIJKLMNOPQRSTUV"),zr(""))),Fye=Object.freeze(Cr(Jr(5),Pr("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),zr(""),BO((e)=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),MO=(()=>typeof Uint8Array.from([]).toBase64==="function"&&typeof Uint8Array.fromBase64==="function")(),EJ=/[\t\n\f\r ]/,oS=Object.freeze(MO?{encode(e){return rS(e),e.toBase64()},decode(e){return qO(e,!1)}}:Cr(Jr(6),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Ef(6),zr(""))),Yt=Object.freeze(Cr(Jr(6),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),zr(""))),Hye=Object.freeze(MO?{encode(e){return rS(e),e.toBase64({alphabet:"base64url"})},decode(e){return qO(e,!0)}}:Cr(Jr(6),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Ef(6),zr(""))),Jye=Object.freeze(Cr(Jr(6),Pr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),zr(""))),Kye=Object.freeze(iS("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")),Vye=Object.freeze(iS("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ")),Wye=Object.freeze(iS("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz")),tS=Cr(Pr("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),zr("")),DO=[996825010,642813549,513874426,1027748829,705979059];Nr=Object.freeze(FO("bech32")),Gye=Object.freeze(FO("bech32m")),IJ=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),AJ={encode(e){return rS(e),e.toHex()},decode(e){return ri("hex",e),Uint8Array.fromHex(e)}},Qye=Object.freeze(IJ?AJ:Cr(Jr(4),Pr("0123456789abcdef"),zr(""),BO((e)=>{if(typeof e!=="string"||e.length%2!==0)throw TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})))});function RJ(e,t,r,o){fo(e);let n=hf({dkLen:32,asyncTick:10},o),{c:i,dkLen:s,asyncTick:a}=n;if(St(i,"c"),St(s,"dkLen"),St(a,"asyncTick"),i<1)throw Error("iterations (c) must be >= 1");if(s<1)throw Error('"dkLen" must be >= 1');if(s>4294967295*e.outputLen)throw Error("derived key too long");let l=Fb(t,"password"),u=Fb(r,"salt"),d=new Uint8Array(s),p=Pn.create(e,l),m=p._cloneInto().update(u);return{c:i,dkLen:s,asyncTick:a,DK:d,PRF:p,PRFSalt:m}}function TJ(e,t,r,o,n){if(e.destroy(),t.destroy(),o)o.destroy();return cr(n),r}function sS(e,t,r,o){let{c:n,dkLen:i,DK:s,PRF:a,PRFSalt:l}=RJ(e,t,r,o),u,d=new Uint8Array(4),p=ka(d),m=new Uint8Array(a.outputLen);for(let h=1,b=0;b<i;h++,b+=a.outputLen){let y=s.subarray(b,b+a.outputLen);p.setInt32(0,h,!1),(u=l._cloneInto(u)).update(d).digestInto(m),y.set(m.subarray(0,y.length));for(let v=1;v<n;v++){a._cloneInto(u).update(m).digestInto(m);for(let x=0;x<y.length;x++)y[x]^=m[x]}}return TJ(a,l,s,u,m)}var HO=S(()=>{Vl();Hr()});function JO(e,t,r,o,n,i){let s=e[t++]^r[o++],a=e[t++]^r[o++],l=e[t++]^r[o++],u=e[t++]^r[o++],d=e[t++]^r[o++],p=e[t++]^r[o++],m=e[t++]^r[o++],h=e[t++]^r[o++],b=e[t++]^r[o++],y=e[t++]^r[o++],v=e[t++]^r[o++],x=e[t++]^r[o++],_=e[t++]^r[o++],k=e[t++]^r[o++],O=e[t++]^r[o++],L=e[t++]^r[o++],z=s,J=a,P=l,W=u,ee=d,j=p,T=m,Z=h,I=b,R=y,A=v,q=x,N=_,K=k,G=O,re=L;for(let ae=0;ae<8;ae+=2)ee^=Fe(z+N|0,7),I^=Fe(ee+z|0,9),N^=Fe(I+ee|0,13),z^=Fe(N+I|0,18),R^=Fe(j+J|0,7),K^=Fe(R+j|0,9),J^=Fe(K+R|0,13),j^=Fe(J+K|0,18),G^=Fe(A+T|0,7),P^=Fe(G+A|0,9),T^=Fe(P+G|0,13),A^=Fe(T+P|0,18),W^=Fe(re+q|0,7),Z^=Fe(W+re|0,9),q^=Fe(Z+W|0,13),re^=Fe(q+Z|0,18),J^=Fe(z+W|0,7),P^=Fe(J+z|0,9),W^=Fe(P+J|0,13),z^=Fe(W+P|0,18),T^=Fe(j+ee|0,7),Z^=Fe(T+j|0,9),ee^=Fe(Z+T|0,13),j^=Fe(ee+Z|0,18),q^=Fe(A+R|0,7),I^=Fe(q+A|0,9),R^=Fe(I+q|0,13),A^=Fe(R+I|0,18),N^=Fe(re+G|0,7),K^=Fe(N+re|0,9),G^=Fe(K+N|0,13),re^=Fe(G+K|0,18);n[i++]=s+z|0,n[i++]=a+J|0,n[i++]=l+P|0,n[i++]=u+W|0,n[i++]=d+ee|0,n[i++]=p+j|0,n[i++]=m+T|0,n[i++]=h+Z|0,n[i++]=b+I|0,n[i++]=y+R|0,n[i++]=v+A|0,n[i++]=x+q|0,n[i++]=_+N|0,n[i++]=k+K|0,n[i++]=O+G|0,n[i++]=L+re|0}function aS(e,t,r,o,n){let i=o+0,s=o+16*n;for(let a=0;a<16;a++)r[s+a]=e[t+(2*n-1)*16+a];for(let a=0;a<n;a++,i+=16,t+=16){if(JO(r,s,e,t,r,i),a>0)s+=16;JO(r,i,e,t+=16,r,s)}}function $J(e,t,r){let o=hf({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:n,r:i,p:s,dkLen:a,asyncTick:l,maxmem:u,onProgress:d}=o;if(St(n,"N"),St(i,"r"),St(s,"p"),St(a,"dkLen"),St(l,"asyncTick"),St(u,"maxmem"),d!==void 0&&typeof d!=="function")throw Error("progressCb must be a function");let p=128*i,m=p/4,h=Math.pow(2,32);if(n<=1||(n&n-1)!==0||n>h)throw Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');if(s<1||s>(h-1)*32/p)throw Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');if(a<1||a>(h-1)*32)throw Error('"dkLen" expected integer 1..(2^32 - 1) * 32');let b=p*(n+s+1);if(b>u)throw Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))='+b+", maxmem="+u);let y=sS(vt,e,t,{c:1,dkLen:p*s}),v=ff(y),x=ff(new Uint8Array(p*n)),_=ff(new Uint8Array(p)),k=()=>{};if(d){let O=2*n*s,L=Math.max(Math.floor(O/1e4),1),z=0;k=()=>{if(z++,d&&(!(z%L)||z===O))d(z/O)}}return{N:n,r:i,p:s,dkLen:a,blockSize32:m,V:x,B32:v,B:y,tmp:_,blockMixCb:k,asyncTick:l}}function OJ(e,t,r,o,n){let i=sS(vt,e,r,{c:1,dkLen:t});return cr(r,o,n),i}function cS(e,t,r){let{N:o,r:n,p:i,dkLen:s,blockSize32:a,V:l,B32:u,B:d,tmp:p,blockMixCb:m}=$J(e,t,r);qb(u);for(let h=0;h<i;h++){let b=a*h;for(let y=0;y<a;y++)l[y]=u[b+y];for(let y=0,v=0;y<o-1;y++)aS(l,v,l,v+=a,n),m();aS(l,(o-1)*a,u,b,n),m();for(let y=0;y<o;y++){let v=(u[b+a-16]&o-1)>>>0;for(let x=0;x<a;x++)p[x]=u[b+x]^l[v*a+x];aS(p,0,u,b,n),m()}}return qb(u),OJ(e,s,d,l,p)}var KO=S(()=>{HO();Ra();Hr()});function CJ(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function If(e){if(typeof e!=="boolean")throw TypeError(`boolean expected, not ${e}`)}function Ta(e){if(typeof e!=="number")throw TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError("positive integer expected, got "+e)}function $t(e,t,r=""){let o=CJ(e),n=e?.length,i=t!==void 0;if(!o||i&&n!==t){let s=r&&`"${r}" `,a=i?` of length ${t}`:"",l=o?`length=${n}`:`type=${typeof e}`,u=s+"expected Uint8Array"+a+", got "+l;if(!o)throw TypeError(u);throw RangeError(u)}return e}function lS(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function VO(e,t,r=!1){$t(e,void 0,"output");let o=t.outputLen;if(e.length<o)throw RangeError("digestInto() expects output buffer of length at least "+o);if(r&&!$a(e))throw Error("invalid output, must be aligned")}function Nn(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function un(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function PJ(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function WO(e,t){if(t==null||typeof t!=="object")throw Error("options must be defined");return Object.assign(e,t)}function GO(e,t){if(e.length!==t.length)return!1;let r=0;for(let o=0;o<e.length;o++)r|=e[o]^t[o];return r===0}function QO(e,t,r){let o=t,n=r||(()=>[]),i=(a,l)=>o(l,...n(a)).update(a).digest(),s=o(new Uint8Array(e),...n(new Uint8Array(0)));return i.outputLen=s.outputLen,i.blockLen=s.blockLen,i.create=(a,...l)=>o(a,...l),i}function tu(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if($t(t,void 0,"output"),t.length!==e)throw Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(r&&!$a(t))throw Error("invalid output, must be aligned");return t}function XO(e,t,r){Ta(e),Ta(t),If(r);let o=new Uint8Array(16),n=PJ(o);return n.setBigUint64(0,BigInt(t),r),n.setBigUint64(8,BigInt(e),r),o}function $a(e){return e.byteOffset%4===0}function Oa(e){return Uint8Array.from($t(e))}var hs,zJ=(e)=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,NJ=(e)=>{for(let t=0;t<e.length;t++)e[t]=zJ(e[t]);return e},go,YO=(e,t)=>{function r(o,...n){if($t(o,void 0,"key"),e.nonceLength!==void 0){let d=n[0];$t(d,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let i=e.tagLength;if(i&&n[1]!==void 0)$t(n[1],void 0,"AAD");let s=t(o,...n),a=(d,p)=>{if(p!==void 0){if(d!==2)throw Error("cipher output not supported");$t(p,void 0,"output")}},l=!1;return{encrypt(d,p){if(l)throw Error("cannot encrypt() twice with same key + nonce");return l=!0,$t(d),a(s.encrypt.length,p),s.encrypt(d,p)},decrypt(d,p){if($t(d),i&&d.length<i)throw Error('"ciphertext" expected length bigger than tagLength='+i);return a(s.decrypt.length,p),s.decrypt(d,p)}}}return Object.assign(r,e),r};var Af=S(()=>{/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */hs=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),go=hs?(e)=>e:NJ});function He(e,t){return e<<t|e>>>32-t}function jJ(e,t,r,o,n,i,s,a){let l=n.length,u=new Uint8Array(ru),d=Nn(u),p=hs&&$a(n)&&$a(i),m=p?Nn(n):eC,h=p?Nn(i):eC;if(!hs){for(let b=0;b<l;s++){if(e(t,r,o,d,s,a),go(d),s>=uS)throw Error("arx: counter overflow");let y=Math.min(ru,l-b);for(let v=0,x;v<y;v++)x=b+v,i[x]=n[x]^u[v];b+=y}return}for(let b=0;b<l;s++){if(e(t,r,o,d,s,a),s>=uS)throw Error("arx: counter overflow");let y=Math.min(ru,l-b);if(p&&y===ru){let v=b/4;if(b%4!==0)throw Error("arx: invalid block position");for(let x=0,_;x<ZJ;x++)_=v+x,h[_]=m[_]^d[x];b+=ru;continue}for(let v=0,x;v<y;v++)x=b+v,i[x]=n[x]^u[v];b+=y}}function rC(e,t){let{allowShortKeys:r,extendNonceFn:o,counterLength:n,counterRight:i,rounds:s}=WO({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!=="function")throw Error("core must be a function");return Ta(n),Ta(s),If(i),If(r),(a,l,u,d,p=0)=>{$t(a,void 0,"key"),$t(l,void 0,"nonce"),$t(u,void 0,"data");let m=u.length;if(d=tu(m,d,!1),Ta(p),p<0||p>=uS)throw Error("arx: counter overflow");let h=[],b=a.length,y,v;if(b===32)h.push(y=Oa(a)),v=LJ;else if(b===16&&r)y=new Uint8Array(32),y.set(a),y.set(a,16),v=DJ,h.push(y);else throw $t(a,32,"arx key"),Error("invalid key size");if(!hs||!$a(l))h.push(l=Oa(l));let x=Nn(y);if(o){if(l.length!==24)throw Error("arx: extended nonce must be 24 bytes");let O=l.subarray(0,16);if(hs)o(v,x,Nn(O),x);else{let L=go(Uint32Array.from(v));o(L,x,Nn(O),x),un(L),go(x)}l=l.subarray(16)}else if(!hs)go(x);let _=16-n;if(_!==l.length)throw Error(`arx: nonce must be ${_} or 16 bytes`);if(_!==12){let O=new Uint8Array(12);O.set(l,i?0:12-l.length),l=O,h.push(l)}let k=go(Nn(l));try{return jJ(e,v,x,k,u,d,p,s),d}finally{un(...h)}}}var tC=(e)=>Uint8Array.from(e.split(""),(t)=>t.charCodeAt(0)),DJ,LJ,ru=64,ZJ=16,uS,eC;var nC=S(()=>{Af();DJ=(()=>go(Nn(tC("expand 16-byte k"))))(),LJ=(()=>go(Nn(tC("expand 32-byte k"))))();uS=(()=>4294967295)(),eC=Uint32Array.of()});function Ft(e,t){return e[t++]&255|(e[t++]&255)<<8}class oC{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(e){e=Oa($t(e,32,"key"));let t=Ft(e,0),r=Ft(e,2),o=Ft(e,4),n=Ft(e,6),i=Ft(e,8),s=Ft(e,10),a=Ft(e,12),l=Ft(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|n<<9)&8191,this.r[4]=(n>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|s<<2)&8191,this.r[7]=(s>>>11|a<<5)&8065,this.r[8]=(a>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Ft(e,16+2*u)}process(e,t,r=!1){let o=r?0:2048,{h:n,r:i}=this,s=i[0],a=i[1],l=i[2],u=i[3],d=i[4],p=i[5],m=i[6],h=i[7],b=i[8],y=i[9],v=Ft(e,t+0),x=Ft(e,t+2),_=Ft(e,t+4),k=Ft(e,t+6),O=Ft(e,t+8),L=Ft(e,t+10),z=Ft(e,t+12),J=Ft(e,t+14),P=n[0]+(v&8191),W=n[1]+((v>>>13|x<<3)&8191),ee=n[2]+((x>>>10|_<<6)&8191),j=n[3]+((_>>>7|k<<9)&8191),T=n[4]+((k>>>4|O<<12)&8191),Z=n[5]+(O>>>1&8191),I=n[6]+((O>>>14|L<<2)&8191),R=n[7]+((L>>>11|z<<5)&8191),A=n[8]+((z>>>8|J<<8)&8191),q=n[9]+(J>>>5|o),N=0,K=N+P*s+W*(5*y)+ee*(5*b)+j*(5*h)+T*(5*m);N=K>>>13,K&=8191,K+=Z*(5*p)+I*(5*d)+R*(5*u)+A*(5*l)+q*(5*a),N+=K>>>13,K&=8191;let G=N+P*a+W*s+ee*(5*y)+j*(5*b)+T*(5*h);N=G>>>13,G&=8191,G+=Z*(5*m)+I*(5*p)+R*(5*d)+A*(5*u)+q*(5*l),N+=G>>>13,G&=8191;let re=N+P*l+W*a+ee*s+j*(5*y)+T*(5*b);N=re>>>13,re&=8191,re+=Z*(5*h)+I*(5*m)+R*(5*p)+A*(5*d)+q*(5*u),N+=re>>>13,re&=8191;let ae=N+P*u+W*l+ee*a+j*s+T*(5*y);N=ae>>>13,ae&=8191,ae+=Z*(5*b)+I*(5*h)+R*(5*m)+A*(5*p)+q*(5*d),N+=ae>>>13,ae&=8191;let me=N+P*d+W*u+ee*l+j*a+T*s;N=me>>>13,me&=8191,me+=Z*(5*y)+I*(5*b)+R*(5*h)+A*(5*m)+q*(5*p),N+=me>>>13,me&=8191;let Se=N+P*p+W*d+ee*u+j*l+T*a;N=Se>>>13,Se&=8191,Se+=Z*s+I*(5*y)+R*(5*b)+A*(5*h)+q*(5*m),N+=Se>>>13,Se&=8191;let xe=N+P*m+W*p+ee*d+j*u+T*l;N=xe>>>13,xe&=8191,xe+=Z*a+I*s+R*(5*y)+A*(5*b)+q*(5*h),N+=xe>>>13,xe&=8191;let ke=N+P*h+W*m+ee*p+j*d+T*u;N=ke>>>13,ke&=8191,ke+=Z*l+I*a+R*s+A*(5*y)+q*(5*b),N+=ke>>>13,ke&=8191;let Ae=N+P*b+W*h+ee*m+j*p+T*d;N=Ae>>>13,Ae&=8191,Ae+=Z*u+I*l+R*a+A*s+q*(5*y),N+=Ae>>>13,Ae&=8191;let _e=N+P*y+W*b+ee*h+j*m+T*p;N=_e>>>13,_e&=8191,_e+=Z*d+I*u+R*l+A*a+q*s,N+=_e>>>13,_e&=8191,N=(N<<2)+N|0,N=N+K|0,K=N&8191,N=N>>>13,G+=N,n[0]=K,n[1]=G,n[2]=re,n[3]=ae,n[4]=me,n[5]=Se,n[6]=xe,n[7]=ke,n[8]=Ae,n[9]=_e}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),o=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=o,o=e[s]>>>13,e[s]&=8191;e[0]+=o*5,o=e[0]>>>13,e[0]&=8191,e[1]+=o,o=e[1]>>>13,e[1]&=8191,e[2]+=o,r[0]=e[0]+5,o=r[0]>>>13,r[0]&=8191;for(let s=1;s<10;s++)r[s]=e[s]+o,o=r[s]>>>13,r[s]&=8191;r[9]-=8192;let n=(o^1)-1;for(let s=0;s<10;s++)r[s]&=n;n=~n;for(let s=0;s<10;s++)e[s]=e[s]&n|r[s];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let i=e[0]+t[0];e[0]=i&65535;for(let s=1;s<8;s++)i=(e[s]+t[s]|0)+(i>>>16)|0,e[s]=i&65535;un(r)}update(e){lS(this),$t(e),e=Oa(e);let{buffer:t,blockLen:r}=this,o=e.length;for(let n=0;n<o;){let i=Math.min(r-this.pos,o-n);if(i===r){for(;r<=o-n;n+=r)this.process(e,n);continue}if(t.set(e.subarray(n,n+i),this.pos),this.pos+=i,n+=i,this.pos===r)this.process(t,0,!1),this.pos=0}return this}destroy(){this.destroyed=!0,un(this.h,this.r,this.buffer,this.pad)}digestInto(e){lS(this),VO(e,this),this.finished=!0;let{buffer:t,h:r}=this,{pos:o}=this;if(o){t[o++]=1;for(;o<16;o++)t[o]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let i=0;i<8;i++)e[n++]=r[i]>>>0,e[n++]=r[i]>>>8}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}var iC;var sC=S(()=>{Af();iC=QO(32,(e)=>new oC(e))});function BJ(e,t,r,o,n,i=20){let s=e[0],a=e[1],l=e[2],u=e[3],d=t[0],p=t[1],m=t[2],h=t[3],b=t[4],y=t[5],v=t[6],x=t[7],_=n,k=r[0],O=r[1],L=r[2],z=s,J=a,P=l,W=u,ee=d,j=p,T=m,Z=h,I=b,R=y,A=v,q=x,N=_,K=k,G=O,re=L;for(let me=0;me<i;me+=2)z=z+ee|0,N=He(N^z,16),I=I+N|0,ee=He(ee^I,12),z=z+ee|0,N=He(N^z,8),I=I+N|0,ee=He(ee^I,7),J=J+j|0,K=He(K^J,16),R=R+K|0,j=He(j^R,12),J=J+j|0,K=He(K^J,8),R=R+K|0,j=He(j^R,7),P=P+T|0,G=He(G^P,16),A=A+G|0,T=He(T^A,12),P=P+T|0,G=He(G^P,8),A=A+G|0,T=He(T^A,7),W=W+Z|0,re=He(re^W,16),q=q+re|0,Z=He(Z^q,12),W=W+Z|0,re=He(re^W,8),q=q+re|0,Z=He(Z^q,7),z=z+j|0,re=He(re^z,16),A=A+re|0,j=He(j^A,12),z=z+j|0,re=He(re^z,8),A=A+re|0,j=He(j^A,7),J=J+T|0,N=He(N^J,16),q=q+N|0,T=He(T^q,12),J=J+T|0,N=He(N^J,8),q=q+N|0,T=He(T^q,7),P=P+Z|0,K=He(K^P,16),I=I+K|0,Z=He(Z^I,12),P=P+Z|0,K=He(K^P,8),I=I+K|0,Z=He(Z^I,7),W=W+ee|0,G=He(G^W,16),R=R+G|0,ee=He(ee^R,12),W=W+ee|0,G=He(G^W,8),R=R+G|0,ee=He(ee^R,7);let ae=0;o[ae++]=s+z|0,o[ae++]=a+J|0,o[ae++]=l+P|0,o[ae++]=u+W|0,o[ae++]=d+ee|0,o[ae++]=p+j|0,o[ae++]=m+T|0,o[ae++]=h+Z|0,o[ae++]=b+I|0,o[ae++]=y+R|0,o[ae++]=v+A|0,o[ae++]=x+q|0,o[ae++]=_+N|0,o[ae++]=k+K|0,o[ae++]=O+G|0,o[ae++]=L+re|0}function cC(e,t,r,o,n){if(n!==void 0)$t(n,void 0,"AAD");let i=e(t,r,qJ),s=XO(o.length,n?n.length:0,!0),a=iC.create(i);if(n)aC(a,n);aC(a,o),a.update(s);let l=a.digest();return un(i,s),l}var UJ,MJ,aC=(e,t)=>{e.update(t);let r=t.length%16;if(r)e.update(MJ.subarray(r))},qJ,FJ=(e)=>(t,r,o)=>({encrypt(i,s){let a=i.length;s=tu(a+16,s,!1),s.set(i);let l=s.subarray(0,-16);e(t,r,l,l,1);let u=cC(e,t,r,l,o);return s.set(u,a),un(u),s},decrypt(i,s){s=tu(i.length-16,s,!1);let a=i.subarray(0,-16),l=i.subarray(-16),u=cC(e,t,r,a,o);if(!GO(l,u))throw un(u),Error("invalid tag");return s.set(i.subarray(0,-16)),e(t,r,s,s,1),un(u),s}}),Kr;var dS=S(()=>{nC();sC();Af();UJ=rC(BJ,{counterRight:!1,counterLength:4,allowShortKeys:!1}),MJ=new Uint8Array(16),qJ=new Uint8Array(32);Kr=YO({blockSize:64,nonceLength:12,tagLength:16},FJ(UJ))});function Ca(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zt(e,t=""){if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw Error(`${r}expected integer >= 0, got ${e}`)}}function Re(e,t,r=""){let o=Ca(e),n=e?.length,i=t!==void 0;if(!o||i&&n!==t){let s=r&&`"${r}" `,a=i?` of length ${t}`:"",l=o?`length=${n}`:`type=${typeof e}`;throw Error(s+"expected Uint8Array"+a+", got "+l)}return e}function Vr(e){if(typeof e!=="function"||typeof e.create!=="function")throw Error("Hash must wrapped by utils.createHasher");Zt(e.outputLen),Zt(e.blockLen)}function bo(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function kf(e,t){Re(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw Error('"digestInto() output" expected to be of length >='+r)}function Rf(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function wr(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Tf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function dn(e,t){return e<<32-t|e>>>t}function JJ(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function KJ(e){for(let t=0;t<e.length;t++)e[t]=JJ(e[t]);return e}function gs(e){if(Re(e),uC)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=VJ[e[r]];return t}function lC(e){if(e>=yo._0&&e<=yo._9)return e-yo._0;if(e>=yo.A&&e<=yo.F)return e-(yo.A-10);if(e>=yo.a&&e<=yo.f)return e-(yo.a-10);return}function ys(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);if(uC)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let o=new Uint8Array(r);for(let n=0,i=0;n<r;n++,i+=2){let s=lC(e.charCodeAt(i)),a=lC(e.charCodeAt(i+1));if(s===void 0||a===void 0){let l=e[i]+e[i+1];throw Error('hex string expected, got non-hex character "'+l+'" at index '+i)}o[n]=s*16+a}return o}function It(...e){let t=0;for(let o=0;o<e.length;o++){let n=e[o];Re(n),t+=n.length}let r=new Uint8Array(t);for(let o=0,n=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return r}function Pa(e,t={}){let r=(n,i)=>e(i).update(n).digest(),o=e(void 0);return r.outputLen=o.outputLen,r.blockLen=o.blockLen,r.create=(n)=>e(n),Object.assign(r,t),Object.freeze(r)}function ni(e=32){let t=typeof globalThis==="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!=="function")throw Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}var HJ,pS,uC,VJ,yo,oi=(e)=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Dr=S(()=>{/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */HJ=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();pS=HJ?(e)=>e:KJ,uC=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),VJ=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));yo={_0:48,_9:57,A:65,F:70,a:97,f:102}});function nu(e,t=""){if(typeof e!=="boolean"){let r=t&&`"${t}" `;throw Error(r+"expected boolean, got type="+typeof e)}return e}function dC(e){if(typeof e==="bigint"){if(!$f(e))throw Error("positive bigint expected, got "+e)}else Zt(e);return e}function ou(e){let t=dC(e).toString(16);return t.length&1?"0"+t:t}function pC(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);return e===""?mS:BigInt("0x"+e)}function ii(e){return pC(gs(e))}function si(e){return pC(gs(Of(Re(e)).reverse()))}function za(e,t){Zt(t),e=dC(e);let r=ys(e.toString(16).padStart(t*2,"0"));if(r.length!==t)throw Error("number too large");return r}function iu(e,t){return za(e,t).reverse()}function Of(e){return Uint8Array.from(e)}function ai(e){return Uint8Array.from(e,(t,r)=>{let o=t.charCodeAt(0);if(t.length!==1||o>127)throw Error(`string contains non-ASCII character "${e[r]}" with code ${o} at position ${r}`);return o})}function WJ(e,t,r){return $f(e)&&$f(t)&&$f(r)&&t<=e&&e<r}function su(e,t,r,o){if(!WJ(t,r,o))throw Error("expected valid "+e+": "+r+" <= n < "+o+", got "+t)}function hS(e){let t;for(t=0;e>mS;e>>=fS,t+=1);return t}function fC(e,t,r){if(Zt(e,"hashLen"),Zt(t,"qByteLen"),typeof r!=="function")throw Error("hmacFn must be a function");let o=(v)=>new Uint8Array(v),n=Uint8Array.of(),i=Uint8Array.of(0),s=Uint8Array.of(1),a=1000,l=o(e),u=o(e),d=0,p=()=>{l.fill(1),u.fill(0),d=0},m=(...v)=>r(u,It(l,...v)),h=(v=n)=>{if(u=m(i,v),l=m(),v.length===0)return;u=m(s,v),l=m()},b=()=>{if(d++>=a)throw Error("drbg: tried max amount of iterations");let v=0,x=[];while(v<t){l=m();let _=l.slice();x.push(_),v+=l.length}return It(...x)};return(v,x)=>{p(),h(v);let _=void 0;while(!(_=x(b())))h();return p(),_}}function bs(e,t={},r={}){if(!e||typeof e!=="object")throw Error("expected valid options object");function o(i,s,a){let l=e[i];if(a&&l===void 0)return;let u=typeof l;if(u!==s||l===null)throw Error(`param "${i}" is invalid: expected ${s}, got ${u}`)}let n=(i,s)=>Object.entries(i).forEach(([a,l])=>o(a,l,s));n(t,!1),n(r,!0)}function gS(e){let t=new WeakMap;return(r,...o)=>{let n=t.get(r);if(n!==void 0)return n;let i=e(r,...o);return t.set(r,i),i}}var mS,fS,$f=(e)=>typeof e==="bigint"&&mS<=e,au=(e)=>(fS<<BigInt(e))-fS;var Na=S(()=>{Dr();Dr();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */mS=BigInt(0),fS=BigInt(1)});function lr(e,t){let r=e%t;return r>=ur?r:t+r}function Wr(e,t,r){let o=e;while(t-- >ur)o*=o,o%=r;return o}function mC(e,t){if(e===ur)throw Error("invert: expected non-zero number");if(t<=ur)throw Error("invert: expected positive modulus, got "+t);let r=lr(e,t),o=t,n=ur,i=Xt,s=Xt,a=ur;while(r!==ur){let u=o/r,d=o%r,p=n-s*u,m=i-a*u;o=r,r=d,n=s,i=a,s=p,a=m}if(o!==Xt)throw Error("invert: does not exist");return lr(n,t)}function yS(e,t,r){if(!e.eql(e.sqr(t),r))throw Error("Cannot find square root")}function wC(e,t){let r=(e.ORDER+Xt)/yC,o=e.pow(t,r);return yS(e,o,t),o}function YJ(e,t){let r=(e.ORDER-bC)/SC,o=e.mul(t,Ss),n=e.pow(o,r),i=e.mul(t,n),s=e.mul(e.mul(i,Ss),n),a=e.mul(i,e.sub(s,e.ONE));return yS(e,a,t),a}function XJ(e){let t=Cf(e),r=xC(e),o=r(t,t.neg(t.ONE)),n=r(t,o),i=r(t,t.neg(o)),s=(e+GJ)/vC;return(a,l)=>{let u=a.pow(l,s),d=a.mul(u,o),p=a.mul(u,n),m=a.mul(u,i),h=a.eql(a.sqr(d),l),b=a.eql(a.sqr(p),l);u=a.cmov(u,d,h),d=a.cmov(m,p,b);let y=a.eql(a.sqr(d),l),v=a.cmov(u,d,y);return yS(a,v,l),v}}function xC(e){if(e<gC)throw Error("sqrt is not defined for small field");let t=e-Xt,r=0;while(t%Ss===ur)t/=Ss,r++;let o=Ss,n=Cf(e);while(hC(n,o)===1)if(o++>1000)throw Error("Cannot find square root: probably non-prime P");if(r===1)return wC;let i=n.pow(o,t),s=(t+Xt)/Ss;return function(l,u){if(l.is0(u))return u;if(hC(l,u)!==1)throw Error("Cannot find square root");let d=r,p=l.mul(l.ONE,i),m=l.pow(u,t),h=l.pow(u,s);while(!l.eql(m,l.ONE)){if(l.is0(m))return l.ZERO;let b=1,y=l.sqr(m);while(!l.eql(y,l.ONE))if(b++,y=l.sqr(y),b===d)throw Error("Cannot find square root");let v=Xt<<BigInt(d-b-1),x=l.pow(p,v);d=b,p=l.sqr(x),m=l.mul(m,p),h=l.mul(h,x)}return h}}function eK(e){if(e%yC===gC)return wC;if(e%SC===bC)return YJ;if(e%vC===QJ)return XJ(e);return xC(e)}function bS(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=tK.reduce((o,n)=>(o[n]="function",o),t);return bs(e,r),e}function rK(e,t,r){if(r<ur)throw Error("invalid exponent, negatives unsupported");if(r===ur)return e.ONE;if(r===Xt)return t;let o=e.ONE,n=t;while(r>ur){if(r&Xt)o=e.mul(o,n);n=e.sqr(n),r>>=Xt}return o}function cu(e,t,r=!1){let o=Array(t.length).fill(r?e.ZERO:void 0),n=t.reduce((s,a,l)=>{if(e.is0(a))return s;return o[l]=s,e.mul(s,a)},e.ONE),i=e.inv(n);return t.reduceRight((s,a,l)=>{if(e.is0(a))return s;return o[l]=e.mul(s,o[l]),e.mul(s,a)},i),o}function hC(e,t){let r=(e.ORDER-Xt)/Ss,o=e.pow(t,r),n=e.eql(o,e.ONE),i=e.eql(o,e.ZERO),s=e.eql(o,e.neg(e.ONE));if(!n&&!i&&!s)throw Error("invalid Legendre symbol result");return n?1:i?0:-1}function nK(e,t){if(t!==void 0)Zt(t);let r=t!==void 0?t:e.toString(2).length,o=Math.ceil(r/8);return{nBitLength:r,nByteLength:o}}class _C{ORDER;BITS;BYTES;isLE;ZERO=ur;ONE=Xt;_lengths;_sqrt;_mod;constructor(e,t={}){if(e<=ur)throw Error("invalid field: expected ORDER > 0, got "+e);let r=void 0;if(this.isLE=!1,t!=null&&typeof t==="object"){if(typeof t.BITS==="number")r=t.BITS;if(typeof t.sqrt==="function")this.sqrt=t.sqrt;if(typeof t.isLE==="boolean")this.isLE=t.isLE;if(t.allowedLengths)this._lengths=t.allowedLengths?.slice();if(typeof t.modFromBytes==="boolean")this._mod=t.modFromBytes}let{nBitLength:o,nByteLength:n}=nK(e,r);if(n>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=o,this.BYTES=n,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return lr(e,this.ORDER)}isValid(e){if(typeof e!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof e);return ur<=e&&e<this.ORDER}is0(e){return e===ur}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&Xt)===Xt}neg(e){return lr(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return lr(e*e,this.ORDER)}add(e,t){return lr(e+t,this.ORDER)}sub(e,t){return lr(e-t,this.ORDER)}mul(e,t){return lr(e*t,this.ORDER)}pow(e,t){return rK(this,e,t)}div(e,t){return lr(e*mC(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return mC(e,this.ORDER)}sqrt(e){if(!this._sqrt)this._sqrt=eK(this.ORDER);return this._sqrt(this,e)}toBytes(e){return this.isLE?iu(e,this.BYTES):za(e,this.BYTES)}fromBytes(e,t=!1){Re(e);let{_lengths:r,BYTES:o,isLE:n,ORDER:i,_mod:s}=this;if(r){if(!r.includes(e.length)||e.length>o)throw Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);let l=new Uint8Array(o);l.set(e,n?0:l.length-e.length),e=l}if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);let a=n?si(e):ii(e);if(s)a=lr(a,i);if(!t){if(!this.isValid(a))throw Error("invalid field element: outside of range 0..ORDER")}return a}invertBatch(e){return cu(this,e)}cmov(e,t,r){return r?t:e}}function Cf(e,t={}){return new _C(e,t)}function EC(e){if(typeof e!=="bigint")throw Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function SS(e){let t=EC(e);return t+Math.ceil(t/2)}function IC(e,t,r=!1){Re(e);let o=e.length,n=EC(t),i=SS(t);if(o<16||o<i||o>1024)throw Error("expected "+i+"-1024 bytes of input, got "+o);let s=r?si(e):ii(e),a=lr(s,t-Xt)+Xt;return r?iu(a,n):za(a,n)}var ur,Xt,Ss,gC,yC,bC,GJ,SC,QJ,vC,tK;var lu=S(()=>{Na();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ur=BigInt(0),Xt=BigInt(1),Ss=BigInt(2),gC=BigInt(3),yC=BigInt(4),bC=BigInt(5),GJ=BigInt(7),SC=BigInt(8),QJ=BigInt(9),vC=BigInt(16);tK=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function uu(e,t){let r=t.negate();return e?r:t}function _S(e,t){let r=cu(e.Fp,t.map((o)=>o.Z));return t.map((o,n)=>e.fromAffine(o.toAffine(r[n])))}function TC(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function vS(e,t){TC(e,t);let r=Math.ceil(t/e)+1,o=2**(e-1),n=2**e,i=au(e),s=BigInt(e);return{windows:r,windowSize:o,mask:i,maxNumber:n,shiftBy:s}}function AC(e,t,r){let{windowSize:o,mask:n,maxNumber:i,shiftBy:s}=r,a=Number(e&n),l=e>>s;if(a>o)a-=i,l+=vs;let u=t*o,d=u+Math.abs(a)-1,p=a===0,m=a<0,h=t%2!==0;return{nextN:l,offset:d,isZero:p,isNeg:m,isNegF:h,offsetF:u}}function xS(e){return $C.get(e)||1}function kC(e){if(e!==Da)throw Error("invalid wNAF")}class ES{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let o=e;while(t>Da){if(t&vs)r=r.add(o);o=o.double(),t>>=vs}return r}precomputeWindow(e,t){let{windows:r,windowSize:o}=vS(t,this.bits),n=[],i=e,s=i;for(let a=0;a<r;a++){s=i,n.push(s);for(let l=1;l<o;l++)s=s.add(i),n.push(s);i=s.double()}return n}wNAF(e,t,r){if(!this.Fn.isValid(r))throw Error("invalid scalar");let o=this.ZERO,n=this.BASE,i=vS(e,this.bits);for(let s=0;s<i.windows;s++){let{nextN:a,offset:l,isZero:u,isNeg:d,isNegF:p,offsetF:m}=AC(r,s,i);if(r=a,u)n=n.add(uu(p,t[m]));else o=o.add(uu(d,t[l]))}return kC(r),{p:o,f:n}}wNAFUnsafe(e,t,r,o=this.ZERO){let n=vS(e,this.bits);for(let i=0;i<n.windows;i++){if(r===Da)break;let{nextN:s,offset:a,isZero:l,isNeg:u}=AC(r,i,n);if(r=s,l)continue;else{let d=t[a];o=o.add(u?d.negate():d)}}return kC(r),o}getPrecomputes(e,t,r){let o=wS.get(t);if(!o){if(o=this.precomputeWindow(t,e),e!==1){if(typeof r==="function")o=r(o);wS.set(t,o)}}return o}cached(e,t,r){let o=xS(e);return this.wNAF(o,this.getPrecomputes(o,e,r),t)}unsafe(e,t,r,o){let n=xS(e);if(n===1)return this._unsafeLadder(e,t,o);return this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,o)}createCache(e,t){TC(t,this.bits),$C.set(e,t),wS.delete(e)}hasCache(e){return xS(e)!==1}}function OC(e,t,r,o){let n=t,i=e.ZERO,s=e.ZERO;while(r>Da||o>Da){if(r&vs)i=i.add(n);if(o&vs)s=s.add(n);n=n.double(),r>>=vs,o>>=vs}return{p1:i,p2:s}}function RC(e,t,r){if(t){if(t.ORDER!==e)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return bS(t),t}else return Cf(e,{isLE:r})}function CC(e,t,r={},o){if(o===void 0)o=e==="edwards";if(!t||typeof t!=="object")throw Error(`expected valid ${e} CURVE object`);for(let l of["p","n","h"]){let u=t[l];if(!(typeof u==="bigint"&&u>Da))throw Error(`CURVE.${l} must be positive bigint`)}let n=RC(t.p,r.Fp,o),i=RC(t.n,r.Fn,o),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let l of a)if(!n.isValid(t[l]))throw Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:i}}function Pf(e,t){return function(o){let n=e(o);return{secretKey:n,publicKey:t(n)}}}var Da,vs,wS,$C;var IS=S(()=>{Na();lu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Da=BigInt(0),vs=BigInt(1);wS=new WeakMap,$C=new WeakMap});function oK(e){return bs(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function PC(e){let t=oK(e),{P:r,type:o,adjustScalarBytes:n,powPminus2:i,randomBytes:s}=t,a=o==="x25519";if(!a&&o!=="x448")throw Error("invalid type");let l=s||ni,u=a?255:448,d=a?32:56,p=a?BigInt(9):BigInt(5),m=a?BigInt(121665):BigInt(39081),h=a?zf**BigInt(254):zf**BigInt(447),b=a?BigInt(8)*zf**BigInt(251)-La:BigInt(4)*zf**BigInt(445)-La,y=h+b+La,v=(I)=>lr(I,r),x=_(p);function _(I){return iu(v(I),d)}function k(I){let R=Of(Re(I,d,"uCoordinate"));if(a)R[31]&=127;return v(si(R))}function O(I){return si(n(Of(Re(I,d,"scalar"))))}function L(I,R){let A=ee(k(R),O(I));if(A===du)throw Error("invalid private or public key received");return _(A)}function z(I){return L(I,x)}let J=z,P=L;function W(I,R,A){let q=v(I*(R-A));return R=v(R-q),A=v(A+q),{x_2:R,x_3:A}}function ee(I,R){su("u",I,du,r),su("scalar",R,h,y);let A=R,q=I,N=La,K=du,G=I,re=La,ae=du;for(let Se=BigInt(u-1);Se>=du;Se--){let xe=A>>Se&La;ae^=xe,{x_2:N,x_3:G}=W(ae,N,G),{x_2:K,x_3:re}=W(ae,K,re),ae=xe;let ke=N+K,Ae=v(ke*ke),_e=N-K,Ue=v(_e*_e),De=Ae-Ue,Qe=G+re,bt=G-re,Tt=v(bt*ke),Dt=v(Qe*_e),lt=Tt+Dt,Or=Tt-Dt;G=v(lt*lt),re=v(q*v(Or*Or)),N=v(Ae*Ue),K=v(De*(Ae+v(m*De)))}({x_2:N,x_3:G}=W(ae,N,G)),{x_2:K,x_3:re}=W(ae,K,re);let me=i(K);return v(N*me)}let j={secretKey:d,publicKey:d,seed:d},T=(I=l(d))=>(Re(I,j.seed,"seed"),I),Z={randomSecretKey:T};return Object.freeze({keygen:Pf(T,J),getSharedSecret:P,getPublicKey:J,scalarMult:L,scalarMultBase:z,utils:Z,GuBytes:x.slice(),lengths:j})}var du,La,zf;var zC=S(()=>{Na();IS();lu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */du=BigInt(0),La=BigInt(1),zf=BigInt(2)});class AS{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){if(Vr(e),Re(t,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,o=new Uint8Array(r);o.set(t.length>r?e.create().update(t).digest():t);for(let n=0;n<o.length;n++)o[n]^=54;this.iHash.update(o),this.oHash=e.create();for(let n=0;n<o.length;n++)o[n]^=106;this.oHash.update(o),wr(o)}update(e){return bo(this),this.iHash.update(e),this}digestInto(e){bo(this),Re(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:r,finished:o,destroyed:n,blockLen:i,outputLen:s}=this;return e=e,e.finished=o,e.destroyed=n,e.blockLen=i,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var Za=(e,t,r)=>new AS(e,t).update(r).digest();var kS=S(()=>{Dr();Za.create=(e,t)=>new AS(e,t)});function iK(e,t,r){let[[o,n],[i,s]]=t,a=NC(s*e,r),l=NC(-n*e,r),u=e-a*o-l*i,d=-a*n-l*s,p=u<So,m=d<So;if(p)u=-u;if(m)d=-d;let h=au(Math.ceil(hS(r)/2))+ja;if(u<So||u>=h||d<So||d>=h)throw Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:p,k1:u,k2neg:m,k2:d}}function TS(e){if(!["compact","recovered","der"].includes(e))throw Error('Signature format must be "compact", "recovered", or "der"');return e}function RS(e,t){let r={};for(let o of Object.keys(t))r[o]=e[o]===void 0?t[o]:e[o];if(nu(r.lowS,"lowS"),nu(r.prehash,"prehash"),r.format!==void 0)TS(r.format);return r}function $S(e,t={}){let r=CC("weierstrass",e,t),{Fp:o,Fn:n}=r,i=r.CURVE,{h:s,n:a}=i;bs(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:l}=t;if(l){if(!o.is0(i.a)||typeof l.beta!=="bigint"||!Array.isArray(l.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let u=jC(o,n);function d(){if(!o.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function p(T,Z,I){let{x:R,y:A}=Z.toAffine(),q=o.toBytes(R);if(nu(I,"isCompressed"),I){d();let N=!o.isOdd(A);return It(ZC(N),q)}else return It(Uint8Array.of(4),q,o.toBytes(A))}function m(T){Re(T,void 0,"Point");let{publicKey:Z,publicKeyUncompressed:I}=u,R=T.length,A=T[0],q=T.subarray(1);if(R===Z&&(A===2||A===3)){let N=o.fromBytes(q);if(!o.isValid(N))throw Error("bad point: is not on curve, wrong x");let K=y(N),G;try{G=o.sqrt(K)}catch(me){let Se=me instanceof Error?": "+me.message:"";throw Error("bad point: is not on curve, sqrt error"+Se)}d();let re=o.isOdd(G);if((A&1)===1!==re)G=o.neg(G);return{x:N,y:G}}else if(R===I&&A===4){let N=o.BYTES,K=o.fromBytes(q.subarray(0,N)),G=o.fromBytes(q.subarray(N,N*2));if(!v(K,G))throw Error("bad point: is not on curve");return{x:K,y:G}}else throw Error(`bad point: got length ${R}, expected compressed=${Z} or uncompressed=${I}`)}let h=t.toBytes||p,b=t.fromBytes||m;function y(T){let Z=o.sqr(T),I=o.mul(Z,T);return o.add(o.add(I,o.mul(T,i.a)),i.b)}function v(T,Z){let I=o.sqr(Z),R=y(T);return o.eql(I,R)}if(!v(i.Gx,i.Gy))throw Error("bad curve params: generator point");let x=o.mul(o.pow(i.a,Nf),sK),_=o.mul(o.sqr(i.b),BigInt(27));if(o.is0(o.add(x,_)))throw Error("bad curve params: a or b");function k(T,Z,I=!1){if(!o.isValid(Z)||I&&o.is0(Z))throw Error(`bad point coordinate ${T}`);return Z}function O(T){if(!(T instanceof W))throw Error("Weierstrass Point expected")}function L(T){if(!l||!l.basises)throw Error("no endo");return iK(T,l.basises,n.ORDER)}let z=gS((T,Z)=>{let{X:I,Y:R,Z:A}=T;if(o.eql(A,o.ONE))return{x:I,y:R};let q=T.is0();if(Z==null)Z=q?o.ONE:o.inv(A);let N=o.mul(I,Z),K=o.mul(R,Z),G=o.mul(A,Z);if(q)return{x:o.ZERO,y:o.ZERO};if(!o.eql(G,o.ONE))throw Error("invZ was invalid");return{x:N,y:K}}),J=gS((T)=>{if(T.is0()){if(t.allowInfinityPoint&&!o.is0(T.Y))return;throw Error("bad point: ZERO")}let{x:Z,y:I}=T.toAffine();if(!o.isValid(Z)||!o.isValid(I))throw Error("bad point: x or y not field elements");if(!v(Z,I))throw Error("bad point: equation left != right");if(!T.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function P(T,Z,I,R,A){return I=new W(o.mul(I.X,T),I.Y,I.Z),Z=uu(R,Z),I=uu(A,I),Z.add(I)}class W{static BASE=new W(i.Gx,i.Gy,o.ONE);static ZERO=new W(o.ZERO,o.ONE,o.ZERO);static Fp=o;static Fn=n;X;Y;Z;constructor(T,Z,I){this.X=k("x",T),this.Y=k("y",Z,!0),this.Z=k("z",I),Object.freeze(this)}static CURVE(){return i}static fromAffine(T){let{x:Z,y:I}=T||{};if(!T||!o.isValid(Z)||!o.isValid(I))throw Error("invalid affine point");if(T instanceof W)throw Error("projective point not allowed");if(o.is0(Z)&&o.is0(I))return W.ZERO;return new W(Z,I,o.ONE)}static fromBytes(T){let Z=W.fromAffine(b(Re(T,void 0,"point")));return Z.assertValidity(),Z}static fromHex(T){return W.fromBytes(ys(T))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(T=8,Z=!0){if(j.createCache(this,T),!Z)this.multiply(Nf);return this}assertValidity(){J(this)}hasEvenY(){let{y:T}=this.toAffine();if(!o.isOdd)throw Error("Field doesn't support isOdd");return!o.isOdd(T)}equals(T){O(T);let{X:Z,Y:I,Z:R}=this,{X:A,Y:q,Z:N}=T,K=o.eql(o.mul(Z,N),o.mul(A,R)),G=o.eql(o.mul(I,N),o.mul(q,R));return K&&G}negate(){return new W(this.X,o.neg(this.Y),this.Z)}double(){let{a:T,b:Z}=i,I=o.mul(Z,Nf),{X:R,Y:A,Z:q}=this,N=o.ZERO,K=o.ZERO,G=o.ZERO,re=o.mul(R,R),ae=o.mul(A,A),me=o.mul(q,q),Se=o.mul(R,A);return Se=o.add(Se,Se),G=o.mul(R,q),G=o.add(G,G),N=o.mul(T,G),K=o.mul(I,me),K=o.add(N,K),N=o.sub(ae,K),K=o.add(ae,K),K=o.mul(N,K),N=o.mul(Se,N),G=o.mul(I,G),me=o.mul(T,me),Se=o.sub(re,me),Se=o.mul(T,Se),Se=o.add(Se,G),G=o.add(re,re),re=o.add(G,re),re=o.add(re,me),re=o.mul(re,Se),K=o.add(K,re),me=o.mul(A,q),me=o.add(me,me),re=o.mul(me,Se),N=o.sub(N,re),G=o.mul(me,ae),G=o.add(G,G),G=o.add(G,G),new W(N,K,G)}add(T){O(T);let{X:Z,Y:I,Z:R}=this,{X:A,Y:q,Z:N}=T,K=o.ZERO,G=o.ZERO,re=o.ZERO,ae=i.a,me=o.mul(i.b,Nf),Se=o.mul(Z,A),xe=o.mul(I,q),ke=o.mul(R,N),Ae=o.add(Z,I),_e=o.add(A,q);Ae=o.mul(Ae,_e),_e=o.add(Se,xe),Ae=o.sub(Ae,_e),_e=o.add(Z,R);let Ue=o.add(A,N);return _e=o.mul(_e,Ue),Ue=o.add(Se,ke),_e=o.sub(_e,Ue),Ue=o.add(I,R),K=o.add(q,N),Ue=o.mul(Ue,K),K=o.add(xe,ke),Ue=o.sub(Ue,K),re=o.mul(ae,_e),K=o.mul(me,ke),re=o.add(K,re),K=o.sub(xe,re),re=o.add(xe,re),G=o.mul(K,re),xe=o.add(Se,Se),xe=o.add(xe,Se),ke=o.mul(ae,ke),_e=o.mul(me,_e),xe=o.add(xe,ke),ke=o.sub(Se,ke),ke=o.mul(ae,ke),_e=o.add(_e,ke),Se=o.mul(xe,_e),G=o.add(G,Se),Se=o.mul(Ue,_e),K=o.mul(Ae,K),K=o.sub(K,Se),Se=o.mul(Ae,xe),re=o.mul(Ue,re),re=o.add(re,Se),new W(K,G,re)}subtract(T){return this.add(T.negate())}is0(){return this.equals(W.ZERO)}multiply(T){let{endo:Z}=t;if(!n.isValidNot0(T))throw Error("invalid scalar: out of range");let I,R,A=(q)=>j.cached(this,q,(N)=>_S(W,N));if(Z){let{k1neg:q,k1:N,k2neg:K,k2:G}=L(T),{p:re,f:ae}=A(N),{p:me,f:Se}=A(G);R=ae.add(Se),I=P(Z.beta,re,me,q,K)}else{let{p:q,f:N}=A(T);I=q,R=N}return _S(W,[I,R])[0]}multiplyUnsafe(T){let{endo:Z}=t,I=this;if(!n.isValid(T))throw Error("invalid scalar: out of range");if(T===So||I.is0())return W.ZERO;if(T===ja)return I;if(j.hasCache(this))return this.multiply(T);if(Z){let{k1neg:R,k1:A,k2neg:q,k2:N}=L(T),{p1:K,p2:G}=OC(W,I,A,N);return P(Z.beta,K,G,R,q)}else return j.unsafe(I,T)}toAffine(T){return z(this,T)}isTorsionFree(){let{isTorsionFree:T}=t;if(s===ja)return!0;if(T)return T(W,this);return j.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:T}=t;if(s===ja)return this;if(T)return T(W,this);return this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(T=!0){return nu(T,"isCompressed"),this.assertValidity(),h(W,this,T)}toHex(T=!0){return gs(this.toBytes(T))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let ee=n.BITS,j=new ES(W,t.endo?Math.ceil(ee/2):ee);return W.BASE.precompute(8),W}function ZC(e){return Uint8Array.of(e?2:3)}function jC(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function aK(e,t={}){let{Fn:r}=e,o=t.randomBytes||ni,n=Object.assign(jC(e.Fp,r),{seed:SS(r.ORDER)});function i(h){try{let b=r.fromBytes(h);return r.isValidNot0(b)}catch(b){return!1}}function s(h,b){let{publicKey:y,publicKeyUncompressed:v}=n;try{let x=h.length;if(b===!0&&x!==y)return!1;if(b===!1&&x!==v)return!1;return!!e.fromBytes(h)}catch(x){return!1}}function a(h=o(n.seed)){return IC(Re(h,n.seed,"seed"),r.ORDER)}function l(h,b=!0){return e.BASE.multiply(r.fromBytes(h)).toBytes(b)}function u(h){let{secretKey:b,publicKey:y,publicKeyUncompressed:v}=n;if(!Ca(h))return;if("_lengths"in r&&r._lengths||b===y)return;let x=Re(h,void 0,"key").length;return x===y||x===v}function d(h,b,y=!0){if(u(h)===!0)throw Error("first arg must be private key");if(u(b)===!1)throw Error("second arg must be public key");let v=r.fromBytes(h);return e.fromBytes(b).multiply(v).toBytes(y)}let p={isValidSecretKey:i,isValidPublicKey:s,randomSecretKey:a},m=Pf(a,l);return Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:m,Point:e,utils:p,lengths:n})}function OS(e,t,r={}){Vr(t),bs(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let o=r.randomBytes||ni,n=r.hmac||((I,R)=>Za(t,I,R)),{Fp:i,Fn:s}=e,{ORDER:a,BITS:l}=s,{keygen:u,getPublicKey:d,getSharedSecret:p,utils:m,lengths:h}=aK(e,r),b={prehash:!0,lowS:typeof r.lowS==="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},y=a*LC<i.ORDER;function v(I){let R=a>>ja;return I>R}function x(I,R){if(!s.isValidNot0(R))throw Error(`invalid signature ${I}: out of range 1..Point.Fn.ORDER`);return R}function _(){if(y)throw Error('"recovered" sig type is not supported for cofactor >2 curves')}function k(I,R){TS(R);let A=h.signature,q=R==="compact"?A:R==="recovered"?A+1:void 0;return Re(I,q)}class O{r;s;recovery;constructor(I,R,A){if(this.r=x("r",I),this.s=x("s",R),A!=null){if(_(),![0,1,2,3].includes(A))throw Error("invalid recovery id");this.recovery=A}Object.freeze(this)}static fromBytes(I,R=b.format){k(I,R);let A;if(R==="der"){let{r:G,s:re}=ci.toSig(Re(I));return new O(G,re)}if(R==="recovered")A=I[0],R="compact",I=I.subarray(1);let q=h.signature/2,N=I.subarray(0,q),K=I.subarray(q,q*2);return new O(s.fromBytes(N),s.fromBytes(K),A)}static fromHex(I,R){return this.fromBytes(ys(I),R)}assertRecovery(){let{recovery:I}=this;if(I==null)throw Error("invalid recovery id: must be present");return I}addRecoveryBit(I){return new O(this.r,this.s,I)}recoverPublicKey(I){let{r:R,s:A}=this,q=this.assertRecovery(),N=q===2||q===3?R+a:R;if(!i.isValid(N))throw Error("invalid recovery id: sig.r+curve.n != R.x");let K=i.toBytes(N),G=e.fromBytes(It(ZC((q&1)===0),K)),re=s.inv(N),ae=z(Re(I,void 0,"msgHash")),me=s.create(-ae*re),Se=s.create(A*re),xe=e.BASE.multiplyUnsafe(me).add(G.multiplyUnsafe(Se));if(xe.is0())throw Error("invalid recovery: point at infinify");return xe.assertValidity(),xe}hasHighS(){return v(this.s)}toBytes(I=b.format){if(TS(I),I==="der")return ys(ci.hexFromSig(this));let{r:R,s:A}=this,q=s.toBytes(R),N=s.toBytes(A);if(I==="recovered")return _(),It(Uint8Array.of(this.assertRecovery()),q,N);return It(q,N)}toHex(I){return gs(this.toBytes(I))}}let L=r.bits2int||function(R){if(R.length>8192)throw Error("input is too large");let A=ii(R),q=R.length*8-l;return q>0?A>>BigInt(q):A},z=r.bits2int_modN||function(R){return s.create(L(R))},J=au(l);function P(I){return su("num < 2^"+l,I,So,J),s.toBytes(I)}function W(I,R){return Re(I,void 0,"message"),R?Re(t(I),void 0,"prehashed message"):I}function ee(I,R,A){let{lowS:q,prehash:N,extraEntropy:K}=RS(A,b);I=W(I,N);let G=z(I),re=s.fromBytes(R);if(!s.isValidNot0(re))throw Error("invalid private key");let ae=[P(re),P(G)];if(K!=null&&K!==!1){let ke=K===!0?o(h.secretKey):K;ae.push(Re(ke,void 0,"extraEntropy"))}let me=It(...ae),Se=G;function xe(ke){let Ae=L(ke);if(!s.isValidNot0(Ae))return;let _e=s.inv(Ae),Ue=e.BASE.multiply(Ae).toAffine(),De=s.create(Ue.x);if(De===So)return;let Qe=s.create(_e*s.create(Se+De*re));if(Qe===So)return;let bt=(Ue.x===De?0:2)|Number(Ue.y&ja),Tt=Qe;if(q&&v(Qe))Tt=s.neg(Qe),bt^=1;return new O(De,Tt,y?void 0:bt)}return{seed:me,k2sig:xe}}function j(I,R,A={}){let{seed:q,k2sig:N}=ee(I,R,A);return fC(t.outputLen,s.BYTES,n)(q,N).toBytes(A.format)}function T(I,R,A,q={}){let{lowS:N,prehash:K,format:G}=RS(q,b);if(A=Re(A,void 0,"publicKey"),R=W(R,K),!Ca(I)){let re=I instanceof O?", use sig.toBytes()":"";throw Error("verify expects Uint8Array signature"+re)}k(I,G);try{let re=O.fromBytes(I,G),ae=e.fromBytes(A);if(N&&re.hasHighS())return!1;let{r:me,s:Se}=re,xe=z(R),ke=s.inv(Se),Ae=s.create(xe*ke),_e=s.create(me*ke),Ue=e.BASE.multiplyUnsafe(Ae).add(ae.multiplyUnsafe(_e));if(Ue.is0())return!1;return s.create(Ue.x)===me}catch(re){return!1}}function Z(I,R,A={}){let{prehash:q}=RS(A,b);return R=W(R,q),O.fromBytes(I,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:u,getPublicKey:d,getSharedSecret:p,utils:m,lengths:h,Point:e,sign:j,verify:T,recoverPublicKey:Z,Signature:O,hash:t})}var NC=(e,t)=>(e+(e>=0?t:-t)/LC)/t,DC,ci,So,ja,LC,Nf,sK;var BC=S(()=>{kS();Dr();Na();IS();lu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */DC=class DC extends Error{constructor(e=""){super(e)}};ci={Err:DC,_tlv:{encode:(e,t)=>{let{Err:r}=ci;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let o=t.length/2,n=ou(o);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let i=o>127?ou(n.length/2|128):"";return ou(e)+i+n+t},decode(e,t){let{Err:r}=ci,o=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[o++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[o++],i=!!(n&128),s=0;if(!i)s=n;else{let l=n&127;if(!l)throw new r("tlv.decode(long): indefinite length not supported");if(l>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(o,o+l);if(u.length!==l)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let d of u)s=s<<8|d;if(o+=l,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(o,o+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(o+s)}}},_int:{encode(e){let{Err:t}=ci;if(e<So)throw new t("integer: negative integers are not allowed");let r=ou(e);if(Number.parseInt(r[0],16)&8)r="00"+r;if(r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=ci;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ii(e)}},toSig(e){let{Err:t,_int:r,_tlv:o}=ci,n=Re(e,void 0,"signature"),{v:i,l:s}=o.decode(48,n);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l}=o.decode(2,i),{v:u,l:d}=o.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=ci,o=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s)),i=o+n;return t.encode(48,i)}},So=BigInt(0),ja=BigInt(1),LC=BigInt(2),Nf=BigInt(3),sK=BigInt(4)});function UC(e,t,r){return e&t^~e&r}function MC(e,t,r){return e&t^e&r^t&r}class Df{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,o){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(e),this.view=Tf(this.buffer)}update(e){bo(this),Re(e);let{view:t,buffer:r,blockLen:o}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(o-this.pos,n-i);if(s===o){let a=Tf(e);for(;o<=n-i;i+=o)this.process(a,i);continue}if(r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===o)this.process(t,0),this.pos=0}return this.length+=e.length,this.roundClean(),this}digestInto(e){bo(this),kf(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:o,isLE:n}=this,{pos:i}=this;if(t[i++]=128,wr(this.buffer.subarray(i)),this.padOffset>o-i)this.process(r,0),i=0;for(let d=i;d<o;d++)t[d]=0;r.setBigUint64(o-8,BigInt(this.length*8),n),this.process(r,0);let s=Tf(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen must be aligned to 32bit");let l=a/4,u=this.get();if(l>u.length)throw Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)s.setUint32(4*d,u[d],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:o,finished:n,destroyed:i,pos:s}=this;if(e.destroyed=i,e.finished=n,e.length=o,e.pos=s,o%t)e.buffer.set(r);return e}clone(){return this._cloneInto()}}var vo,Ht;var qC=S(()=>{Dr();vo=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ht=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])});function cK(e,t=!1){if(t)return{h:Number(e&Lf),l:Number(e>>FC&Lf)};return{h:Number(e>>FC&Lf)|0,l:Number(e&Lf)|0}}function Zf(e,t=!1){let r=e.length,o=new Uint32Array(r),n=new Uint32Array(r);for(let i=0;i<r;i++){let{h:s,l:a}=cK(e[i],t);[o[i],n[i]]=[s,a]}return[o,n]}function Dn(e,t,r,o){let n=(t>>>0)+(o>>>0);return{h:e+r+(n/4294967296|0)|0,l:n|0}}var Lf,FC,CS=(e,t,r)=>e>>>r,PS=(e,t,r)=>e<<32-r|t>>>r,ws=(e,t,r)=>e>>>r|t<<32-r,xs=(e,t,r)=>e<<32-r|t>>>r,pu=(e,t,r)=>e<<64-r|t>>>r-32,fu=(e,t,r)=>e>>>r-32|t<<64-r,HC=(e,t,r)=>e<<r|t>>>32-r,JC=(e,t,r)=>t<<r|e>>>32-r,KC=(e,t,r)=>t<<r-32|e>>>64-r,VC=(e,t,r)=>e<<r-32|t>>>64-r,WC=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),GC=(e,t,r,o)=>t+r+o+(e/4294967296|0)|0,QC=(e,t,r,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0),YC=(e,t,r,o,n)=>t+r+o+n+(e/4294967296|0)|0,XC=(e,t,r,o,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0)+(n>>>0),e1=(e,t,r,o,n,i)=>t+r+o+n+i+(e/4294967296|0)|0;var zS=S(()=>{Lf=BigInt(4294967295),FC=BigInt(32)});var uK,li,t1,r1,n1,dK,pK,ui,di,o1,i1,jf,s1;var NS=S(()=>{qC();zS();Dr();uK=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),li=new Uint32Array(64);t1=class t1 extends Df{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:o,E:n,F:i,G:s,H:a}=this;return[e,t,r,o,n,i,s,a]}set(e,t,r,o,n,i,s,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=n|0,this.F=i|0,this.G=s|0,this.H=a|0}process(e,t){for(let d=0;d<16;d++,t+=4)li[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let p=li[d-15],m=li[d-2],h=dn(p,7)^dn(p,18)^p>>>3,b=dn(m,17)^dn(m,19)^m>>>10;li[d]=b+li[d-7]+h+li[d-16]|0}let{A:r,B:o,C:n,D:i,E:s,F:a,G:l,H:u}=this;for(let d=0;d<64;d++){let p=dn(s,6)^dn(s,11)^dn(s,25),m=u+p+UC(s,a,l)+uK[d]+li[d]|0,b=(dn(r,2)^dn(r,13)^dn(r,22))+MC(r,o,n)|0;u=l,l=a,a=s,s=i+m|0,i=n,n=o,o=r,r=m+b|0}r=r+this.A|0,o=o+this.B|0,n=n+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,o,n,i,s,a,l,u)}roundClean(){wr(li)}destroy(){this.set(0,0,0,0,0,0,0,0),wr(this.buffer)}};r1=class r1 extends t1{A=vo[0]|0;B=vo[1]|0;C=vo[2]|0;D=vo[3]|0;E=vo[4]|0;F=vo[5]|0;G=vo[6]|0;H=vo[7]|0;constructor(){super(32)}};n1=(()=>Zf(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e)=>BigInt(e))))(),dK=(()=>n1[0])(),pK=(()=>n1[1])(),ui=new Uint32Array(80),di=new Uint32Array(80);o1=class o1 extends Df{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:r,Bl:o,Ch:n,Cl:i,Dh:s,Dl:a,Eh:l,El:u,Fh:d,Fl:p,Gh:m,Gl:h,Hh:b,Hl:y}=this;return[e,t,r,o,n,i,s,a,l,u,d,p,m,h,b,y]}set(e,t,r,o,n,i,s,a,l,u,d,p,m,h,b,y){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=o|0,this.Ch=n|0,this.Cl=i|0,this.Dh=s|0,this.Dl=a|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=p|0,this.Gh=m|0,this.Gl=h|0,this.Hh=b|0,this.Hl=y|0}process(e,t){for(let _=0;_<16;_++,t+=4)ui[_]=e.getUint32(t),di[_]=e.getUint32(t+=4);for(let _=16;_<80;_++){let k=ui[_-15]|0,O=di[_-15]|0,L=ws(k,O,1)^ws(k,O,8)^CS(k,O,7),z=xs(k,O,1)^xs(k,O,8)^PS(k,O,7),J=ui[_-2]|0,P=di[_-2]|0,W=ws(J,P,19)^pu(J,P,61)^CS(J,P,6),ee=xs(J,P,19)^fu(J,P,61)^PS(J,P,6),j=QC(z,ee,di[_-7],di[_-16]),T=YC(j,L,W,ui[_-7],ui[_-16]);ui[_]=T|0,di[_]=j|0}let{Ah:r,Al:o,Bh:n,Bl:i,Ch:s,Cl:a,Dh:l,Dl:u,Eh:d,El:p,Fh:m,Fl:h,Gh:b,Gl:y,Hh:v,Hl:x}=this;for(let _=0;_<80;_++){let k=ws(d,p,14)^ws(d,p,18)^pu(d,p,41),O=xs(d,p,14)^xs(d,p,18)^fu(d,p,41),L=d&m^~d&b,z=p&h^~p&y,J=XC(x,O,z,pK[_],di[_]),P=e1(J,v,k,L,dK[_],ui[_]),W=J|0,ee=ws(r,o,28)^pu(r,o,34)^pu(r,o,39),j=xs(r,o,28)^fu(r,o,34)^fu(r,o,39),T=r&n^r&s^n&s,Z=o&i^o&a^i&a;v=b|0,x=y|0,b=m|0,y=h|0,m=d|0,h=p|0,{h:d,l:p}=Dn(l|0,u|0,P|0,W|0),l=s|0,u=a|0,s=n|0,a=i|0,n=r|0,i=o|0;let I=WC(W,j,Z);r=GC(I,P,ee,T),o=I|0}({h:r,l:o}=Dn(this.Ah|0,this.Al|0,r|0,o|0)),{h:n,l:i}=Dn(this.Bh|0,this.Bl|0,n|0,i|0),{h:s,l:a}=Dn(this.Ch|0,this.Cl|0,s|0,a|0),{h:l,l:u}=Dn(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:p}=Dn(this.Eh|0,this.El|0,d|0,p|0),{h:m,l:h}=Dn(this.Fh|0,this.Fl|0,m|0,h|0),{h:b,l:y}=Dn(this.Gh|0,this.Gl|0,b|0,y|0),{h:v,l:x}=Dn(this.Hh|0,this.Hl|0,v|0,x|0),this.set(r,o,n,i,s,a,l,u,d,p,m,h,b,y,v,x)}roundClean(){wr(ui,di)}destroy(){wr(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};i1=class i1 extends o1{Ah=Ht[0]|0;Al=Ht[1]|0;Bh=Ht[2]|0;Bl=Ht[3]|0;Ch=Ht[4]|0;Cl=Ht[5]|0;Dh=Ht[6]|0;Dl=Ht[7]|0;Eh=Ht[8]|0;El=Ht[9]|0;Fh=Ht[10]|0;Fl=Ht[11]|0;Gh=Ht[12]|0;Gl=Ht[13]|0;Hh=Ht[14]|0;Hl=Ht[15]|0;constructor(){super(48)}};jf=Pa(()=>new r1,oi(1)),s1=Pa(()=>new i1,oi(2))});function gK(e){let t=BigInt(10),r=BigInt(20),o=BigInt(40),n=BigInt(80),i=c1,a=e*e%i*e%i,l=Wr(a,a1,i)*a%i,u=Wr(l,fK,i)*e%i,d=Wr(u,hK,i)*u%i,p=Wr(d,t,i)*d%i,m=Wr(p,r,i)*p%i,h=Wr(m,o,i)*m%i,b=Wr(h,n,i)*h%i,y=Wr(b,n,i)*h%i,v=Wr(y,t,i)*d%i;return{pow_p_5_8:Wr(v,a1,i)*e%i,b2:a}}function yK(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var fK,a1,mK,hK,eSe,c1,l1;var u1=S(()=>{lu();zC();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */fK=BigInt(1),a1=BigInt(2),mK=BigInt(3),hK=BigInt(5),eSe=BigInt(8),c1=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");l1=(()=>{let e=c1;return PC({P:e,type:"x25519",powPminus2:(t)=>{let{pow_p_5_8:r,b2:o}=gK(t);return lr(Wr(r,mK,e)*o,e)},adjustScalarBytes:yK})})()});var bK,SK,vK,DS,wK,d1;var p1=S(()=>{NS();BC();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */bK=(()=>({p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")}))(),SK=(()=>({p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")}))(),vK=$S(bK),DS=OS(vK,jf),wK=$S(SK),d1=OS(wK,s1)});function m1(e,t,r){if(Vr(e),r===void 0)r=new Uint8Array(e.outputLen);return Za(e,r,t)}function h1(e,t,r,o=32){Vr(e),Zt(o,"length");let n=e.outputLen;if(o>255*n)throw Error("Length must be <= 255*HashLen");let i=Math.ceil(o/n);if(r===void 0)r=f1;else Re(r,void 0,"info");let s=new Uint8Array(i*n),a=Za.create(e,t),l=a._cloneInto(),u=new Uint8Array(a.outputLen);for(let d=0;d<i;d++)LS[0]=d+1,l.update(d===0?f1:u).update(r).update(LS).digestInto(u),s.set(u,n*d),a._cloneInto(l);return a.destroy(),l.destroy(),wr(u,LS),s.slice(0,o)}var LS,f1;var g1=S(()=>{kS();Dr();LS=Uint8Array.of(0),f1=Uint8Array.of()});function TK(e,t=24){let r=new Uint32Array(10);for(let o=24-t;o<24;o++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,l=(s+2)%10,u=r[l],d=r[l+1],p=y1(u,d,1)^r[a],m=b1(u,d,1)^r[a+1];for(let h=0;h<50;h+=10)e[s+h]^=p,e[s+h+1]^=m}let n=e[2],i=e[3];for(let s=0;s<24;s++){let a=v1[s],l=y1(n,i,a),u=b1(n,i,a),d=S1[s];n=e[d],i=e[d+1],e[d]=l,e[d+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=kK[o],e[1]^=RK[o]}wr(r)}class Bf{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(e,t,r,o=!1,n=24){if(this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=o,this.rounds=n,Zt(r,"outputLen"),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Rf(this.state)}clone(){return this._cloneInto()}keccak(){pS(this.state32),TK(this.state32,this.rounds),pS(this.state32),this.posOut=0,this.pos=0}update(e){bo(this),Re(e);let{blockLen:t,state:r}=this,o=e.length;for(let n=0;n<o;){let i=Math.min(t-this.pos,o-n);for(let s=0;s<i;s++)r[this.pos++]^=e[n++];if(this.pos===t)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:o}=this;if(e[r]^=t,(t&128)!==0&&r===o-1)this.keccak();e[o-1]^=128,this.keccak()}writeInto(e){bo(this,!1),Re(e),this.finish();let t=this.state,{blockLen:r}=this;for(let o=0,n=e.length;o<n;){if(this.posOut>=r)this.keccak();let i=Math.min(r-this.posOut,n-o);e.set(t.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Zt(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(kf(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,wr(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:o,rounds:n,enableXOF:i}=this;return e||=new Bf(t,r,o,i,n),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=o,e.enableXOF=i,e.destroyed=this.destroyed,e}}var xK,mu,_K,EK,IK,AK,S1,v1,w1,x1,kK,RK,y1=(e,t,r)=>r>32?KC(e,t,r):HC(e,t,r),b1=(e,t,r)=>r>32?VC(e,t,r):JC(e,t,r),_1=(e,t,r,o={})=>Pa(()=>new Bf(t,e,r),o),_s,E1,I1=(e,t,r,o={})=>Pa((n={})=>new Bf(t,e,n.dkLen===void 0?r:n.dkLen,!0),o),A1,Ln;var Uf=S(()=>{zS();Dr();xK=BigInt(0),mu=BigInt(1),_K=BigInt(2),EK=BigInt(7),IK=BigInt(256),AK=BigInt(113),S1=[],v1=[],w1=[];for(let e=0,t=mu,r=1,o=0;e<24;e++){[r,o]=[o,(2*r+3*o)%5],S1.push(2*(5*o+r)),v1.push((e+1)*(e+2)/2%64);let n=xK;for(let i=0;i<7;i++)if(t=(t<<mu^(t>>EK)*AK)%IK,t&_K)n^=mu<<(mu<<BigInt(i))-mu;w1.push(n)}x1=Zf(w1,!0),kK=x1[0],RK=x1[1];_s=_1(6,136,32,oi(8)),E1=_1(6,72,64,oi(10)),A1=I1(31,168,16,oi(11)),Ln=I1(31,136,32,oi(12))});function ZS(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw Error("wrong u32 integer:"+e);return e}function R1(e){return ZS(e),(e&e-1)===0&&e!==0}function jS(e,t){ZS(e);let r=0;for(let o=0;o<t;o++,e>>>=1)r=r<<1|e&1;return r}function T1(e){return ZS(e),31-Math.clz32(e)}function k1(e){let t=e.length;if(t<2||!R1(t))throw Error("n must be a power of 2 and greater than 1. Got "+t);let r=T1(t);for(let o=0;o<t;o++){let n=jS(o,r);if(o<n){let i=e[o];e[o]=e[n],e[n]=i}}return e}var BS=(e,t)=>{let{N:r,roots:o,dit:n,invertButterflies:i=!1,skipStages:s=0,brp:a=!0}=t,l=T1(r);if(!R1(r))throw Error("FFT: Polynomial size should be power of two");let u=n!==i;return(d)=>{if(d.length!==r)throw Error("FFT: wrong Polynomial length");if(n&&a)k1(d);for(let p=0,m=1;p<l-s;p++){let h=n?p+1+s:l-p,b=1<<h,y=b>>1,v=r>>h;for(let x=0;x<r;x+=b)for(let _=0,k=m++;_<y;_++){let O=i?n?r-k:k:_*v,L=x+_,z=x+_+y,J=o[O],P=d[z],W=d[L];if(u){let ee=e.mul(P,J);d[L]=e.add(W,ee),d[z]=e.sub(W,ee)}else if(i)d[L]=e.add(P,W),d[z]=e.mul(e.sub(P,W),J);else d[L]=e.add(W,P),d[z]=e.mul(e.sub(W,P),J)}}if(!n&&a)k1(d);return d}};var $1=()=>{};function Mf(e,t){if(e.length!==t.length)return!1;let r=0;for(let o=0;o<e.length;o++)r|=e[o]^t[o];return r===0}function O1(e){return Uint8Array.from(e)}function Es(e,...t){let r=(n)=>typeof n==="number"?n:n.bytesLen,o=t.reduce((n,i)=>n+r(i),0);return{bytesLen:o,encode:(n)=>{let i=new Uint8Array(o);for(let s=0,a=0;s<t.length;s++){let l=t[s],u=r(l),d=typeof l==="number"?n[s]:l.encode(n[s]);if(Re(d,u,e),i.set(d,a),typeof l!=="number")d.fill(0);a+=u}return i},decode:(n)=>{Re(n,o,e);let i=[];for(let s of t){let a=r(s),l=n.subarray(0,a);i.push(typeof s==="number"?l:s.decode(l)),n=n.subarray(a)}return i}}}function qf(e,t){let r=t*e.bytesLen;return{bytesLen:r,encode:(o)=>{if(o.length!==t)throw Error(`vecCoder.encode: wrong length=${o.length}. Expected: ${t}`);let n=new Uint8Array(r);for(let i=0,s=0;i<o.length;i++){let a=e.encode(o[i]);n.set(a,s),a.fill(0),s+=a.length}return n},decode:(o)=>{Re(o,r);let n=[];for(let i=0;i<o.length;i+=e.bytesLen)n.push(e.decode(o.subarray(i,i+e.bytesLen)));return n}}}function Ot(...e){for(let t of e)if(Array.isArray(t))for(let r of t)r.fill(0);else t.fill(0)}function US(e){return(1<<e)-1}var Zn,hSe;var Ff=S(()=>{Dr();Dr();/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */Zn=ni;hSe=Uint8Array.of()});var C1=(e)=>{let{newPoly:t,N:r,Q:o,F:n,ROOT_OF_UNITY:i,brvBits:s,isKyber:a}=e,l=(_,k=o)=>{let O=_%k|0;return(O>=0?O|0:k+O|0)|0},u=(_,k=o)=>{let O=l(_,k)|0;return(O>k>>1?O-k|0:O)|0};function d(){let _=t(r);for(let k=0;k<r;k++){let O=jS(k,s),L=BigInt(i)**BigInt(O)%BigInt(o);_[k]=Number(L)|0}return _}let p=d(),m={add:(_,k)=>l((_|0)+(k|0))|0,sub:(_,k)=>l((_|0)-(k|0))|0,mul:(_,k)=>l((_|0)*(k|0))|0,inv:(_)=>{throw Error("not implemented")}},h={N:r,roots:p,invertButterflies:!0,skipStages:a?1:0,brp:!1},b=BS(m,{dit:!1,...h}),y=BS(m,{dit:!0,...h});return{mod:l,smod:u,nttZetas:p,NTT:{encode:(_)=>b(_),decode:(_)=>{y(_);for(let k=0;k<_.length;k++)_[k]=l(n*_[k]);return _}},bitsCoder:(_,k)=>{let O=US(_),L=_*(r/8);return{bytesLen:L,encode:(z)=>{let J=new Uint8Array(L);for(let P=0,W=0,ee=0,j=0;P<z.length;P++){W|=(k.encode(z[P])&O)<<ee,ee+=_;for(;ee>=8;ee-=8,W>>=8)J[j++]=W&US(ee)}return J},decode:(z)=>{let J=t(r);for(let P=0,W=0,ee=0,j=0;P<z.length;P++){W|=z[P]<<ee,ee+=8;for(;ee>=_;ee-=_,W>>=_)J[j++]=k.decode(W&O)}return J}}}}},$K=(e)=>(t,r)=>{if(!r)r=e.blockLen;let o=new Uint8Array(t.length+2);o.set(t);let n=t.length,i=new Uint8Array(r),s=e.create({}),a=0,l=0;return{stats:()=>({calls:a,xofs:l}),get:(u,d)=>(o[n+0]=u,o[n+1]=d,s.destroy(),s=e.create({}).update(o),a++,()=>(l++,s.xofInto(i))),clean:()=>{s.destroy(),Ot(i,o)}}},P1;var z1=S(()=>{$1();Uf();Ff();/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */P1=$K(A1)});function As(e,t){for(let r=0;r<er;r++)e[r]=yu(e[r]+t[r])}function DK(e,t){for(let r=0;r<er;r++)e[r]=yu(e[r]-t[r])}function LK(e,t,r,o,n){let i=yu(t*o*n+e*r),s=yu(e*o+t*r);return{c0:i,c1:s}}function Hf(e,t){for(let r=0;r<er/2;r++){let o=PK[64+(r>>1)];if(r&1)o=-o;let{c0:n,c1:i}=LK(e[2*r+0],e[2*r+1],t[2*r+0],t[2*r+1],o);e[2*r+0]=n,e[2*r+1]=i}return e}function N1(e){let t=new Uint16Array(er);for(let r=0;r<er;){let o=e();if(o.length%3)throw Error("SampleNTT: unaligned block");for(let n=0;r<er&&n+3<=o.length;n+=3){let i=(o[n+0]>>0|o[n+1]<<8)&4095,s=(o[n+1]>>4|o[n+2]<<4)&4095;if(i<wo)t[r++]=i;if(r<er&&s<wo)t[r++]=s}}return t}function gu(e,t,r,o){let n=e(o*er/4,t,r),i=new Uint16Array(er),s=Rf(n),a=0;for(let l=0,u=0,d=0,p=0;l<s.length;l++){let m=s[l];for(let h=0;h<32;h++)if(d+=m&1,m>>=1,a+=1,a===o)p=d,d=0;else if(a===2*o)i[u++]=yu(p-d),d=0,a=0}if(a)throw Error(`sampleCBD: leftover bits: ${a}`);return i}function qS(e){let t=ZK(e),{HASH256:r,HASH512:o,KDF:n}=e,{secretCoder:i,lengths:s}=t,a=Es("secretKey",s.secretKey,s.publicKey,32,32),l=32,u=64;return{info:{type:"ml-kem"},lengths:{...s,seed:64,msg:32,msgRand:32,secretKey:a.bytesLen},keygen:(d=Zn(64))=>{Re(d,64,"seed");let{publicKey:p,secretKey:m}=t.keygen(d.subarray(0,32)),h=r(p),b=a.encode([m,p,h,d.subarray(32)]);return Ot(m,h),{publicKey:p,secretKey:b}},getPublicKey:(d)=>{let[p,m,h,b]=a.decode(d);return Uint8Array.from(m)},encapsulate:(d,p=Zn(32))=>{Re(d,s.publicKey,"publicKey"),Re(p,32,"message");let m=d.subarray(0,384*e.K),h=i.encode(i.decode(O1(m)));if(!Mf(h,m))throw Ot(h),Error("ML-KEM.encapsulate: wrong publicKey modulus");Ot(h);let b=o.create().update(p).update(r(d)).digest(),y=t.encrypt(d,p,b.subarray(32,64));return Ot(b.subarray(32)),{cipherText:y,sharedSecret:b.subarray(0,32)}},decapsulate:(d,p)=>{Re(p,a.bytesLen,"secretKey"),Re(d,s.cipherText,"cipherText");let m=a.bytesLen-96,h=m+32,b=r(p.subarray(m/2,h));if(!Mf(b,p.subarray(h,h+32)))throw Error("invalid secretKey: hash check failed");let[y,v,x,_]=a.decode(p),k=t.decrypt(d,y),O=o.create().update(k).update(x).digest(),L=O.subarray(0,32),z=t.encrypt(v,k,O.subarray(32,64)),J=Mf(d,z),P=n.create({dkLen:32}).update(_).update(d).digest();return Ot(k,z,!J?L:P),J?L:P}}}function jK(e,t,r){return Ln.create({dkLen:e}).update(t).update(new Uint8Array([r])).digest()}var er=256,wo=3329,OK=3303,CK=17,yu,PK,Is,zK,MS,NK=(e)=>{if(e>=12)return{encode:(r)=>r,decode:(r)=>r};let t=2**(e-1);return{encode:(r)=>((r<<e)+wo/2)/wo,decode:(r)=>r*wo+t>>>e}},hu=(e)=>zK(e,NK(e)),ZK=(e)=>{let{K:t,PRF:r,XOF:o,HASH512:n,ETA1:i,ETA2:s,du:a,dv:l}=e,u=hu(1),d=hu(l),p=hu(a),m=Es("publicKey",qf(hu(12),t),32),h=qf(hu(12),t),b=Es("ciphertext",qf(p,t),d),y=Es("seed",32,32);return{secretCoder:h,lengths:{secretKey:h.bytesLen,publicKey:m.bytesLen,cipherText:b.bytesLen},keygen:(v)=>{Re(v,32,"seed");let x=new Uint8Array(33);x.set(v),x[32]=t;let _=n(x),[k,O]=y.decode(_),L=[],z=[];for(let W=0;W<t;W++)L.push(Is.encode(gu(r,O,W,i)));let J=o(k);for(let W=0;W<t;W++){let ee=Is.encode(gu(r,O,t+W,i));for(let j=0;j<t;j++){let T=N1(J.get(j,W));As(ee,Hf(T,L[j]))}z.push(ee)}J.clean();let P={publicKey:m.encode([z,k]),secretKey:h.encode(L)};return Ot(k,O,L,z,x,_),P},encrypt:(v,x,_)=>{let[k,O]=m.decode(v),L=[];for(let j=0;j<t;j++)L.push(Is.encode(gu(r,_,j,i)));let z=o(O),J=new Uint16Array(er),P=[];for(let j=0;j<t;j++){let T=gu(r,_,t+j,s),Z=new Uint16Array(er);for(let I=0;I<t;I++){let R=N1(z.get(j,I));As(Z,Hf(R,L[I]))}As(T,Is.decode(Z)),P.push(T),As(J,Hf(k[j],L[j])),Ot(Z)}z.clean();let W=gu(r,_,2*t,s);As(W,Is.decode(J));let ee=u.decode(x);return As(ee,W),Ot(k,L,J,W),b.encode([P,ee])},decrypt:(v,x)=>{let[_,k]=b.decode(v),O=h.decode(x),L=new Uint16Array(er);for(let z=0;z<t;z++)As(L,Hf(O[z],Is.encode(_[z])));return DK(k,Is.decode(L)),Ot(L,O,_),u.encode(k)}}},FS,ASe,bu,D1;var L1=S(()=>{Uf();Dr();z1();Ff();/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */({mod:yu,nttZetas:PK,NTT:Is,bitsCoder:zK}=C1({N:er,Q:wo,F:OK,ROOT_OF_UNITY:CK,newPoly:(e)=>new Uint16Array(e),brvBits:7,isKyber:!0})),MS={512:{N:er,Q:wo,K:2,ETA1:3,ETA2:2,du:10,dv:4,RBGstrength:128},768:{N:er,Q:wo,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192},1024:{N:er,Q:wo,K:4,ETA1:2,ETA2:2,du:11,dv:5,RBGstrength:256}};FS={HASH256:_s,HASH512:E1,KDF:Ln,XOF:P1,PRF:jK},ASe=qS({...FS,...MS[512]}),bu=qS({...FS,...MS[768]}),D1=qS({...FS,...MS[1024]})});function BK(e,t=!1){let{lengths:r,keygen:o}=e;if(t){let i=e.Point.Fn;if(!i)throw Error("No Point.Fn");o=(s=Zn(r.seed))=>{Re(s,r.seed,"seed");let a=i.isLE?si(s):ii(s),l=i.toBytes(i.create(a));return{secretKey:l,publicKey:e.getPublicKey(l)}}}return{lengths:{secretKey:r.secretKey,publicKey:r.publicKey,seed:r.seed},keygen:o,getPublicKey:(n)=>e.getPublicKey(n)}}function HS(e,t=!1){let r=BK(e,t);if(!e.getSharedSecret)throw Error("wrong curve");return{lengths:{...r.lengths,msg:r.lengths.seed,cipherText:r.lengths.publicKey},keygen:r.keygen,getPublicKey:r.getPublicKey,encapsulate(o,n=Zn(e.lengths.seed)){let i=this.keygen(n).secretKey,s=this.decapsulate(o,i),a=e.getPublicKey(i);return Ot(i),{sharedSecret:s,cipherText:a}},decapsulate(o,n){let i=e.getSharedSecret(n,o);return e.lengths.publicKeyHasPrefix?i.subarray(1):i}}}function Su(e,t){return Es(t,...e.map((r)=>{if(typeof r.lengths[t]!=="number")throw Error("wrong length: "+t);return r.lengths[t]}))}function JS(e){return(t,r)=>e(t,{dkLen:r})}function UK(e,t,...r){let o=Su(r,"seed"),n=Su(r,"publicKey");if(e===void 0)e=o.bytesLen;Zt(e);function i(s){Re(s,e);let a=o.decode(t(s,o.bytesLen)),l=r.map((p,m)=>p.keygen(a[m])),u=l.map((p)=>p.secretKey),d=l.map((p)=>p.publicKey);return{secretKey:u,publicKey:d}}return{info:{lengths:{seed:e,publicKey:n.bytesLen,secretKey:e}},getPublicKey(s){return this.keygen(s).publicKey},keygen(s=Zn(e)){let{publicKey:a,secretKey:l}=i(s),u=n.encode(a);return Ot(a),Ot(l),{secretKey:s,publicKey:u}},expandDecapsulationKey:i,realSeedLen:e}}function Jf(e,t,r,o,...n){let i=UK(e,r,...n),s=Su(n,"cipherText"),a=Su(n,"publicKey"),l=Su(n,"msg");if(t===void 0)t=l.bytesLen;return Zt(t),{lengths:{...i.info.lengths,msg:t,msgRand:l.bytesLen,cipherText:s.bytesLen},getPublicKey:i.getPublicKey,keygen:i.keygen,encapsulate(u,d=Zn(l.bytesLen)){let p=a.decode(u),m=l.decode(d),h=n.map((x,_)=>x.encapsulate(p[_],m[_])),b=h.map((x)=>x.sharedSecret),y=h.map((x)=>x.cipherText),v={sharedSecret:o(p,y,b),cipherText:s.encode(y)};return Ot(b,y),v},decapsulate(u,d){let p=s.decode(u),{publicKey:m,secretKey:h}=i.expandDecapsulationKey(d),b=n.map((y,v)=>y.decapsulate(p[v],h[v]));return o(m,p,b)}}}function Z1(e,t,r,o,n){return Vr(o),Vr(n),Jf(32,32,JS(o),(i,s,a)=>n(It(a[0],a[1],s[1],i[1],ai(e))),t,r)}function MK(e,t,r,o,n){return Vr(o),Vr(n),Jf(32,32,JS(o),(i,s,a)=>{let l=It(a[0],a[1],s[0],i[0],s[1],i[1],ai(e)),u=32,d=It(ai("hybrid_prk"),l),p=m1(n,d),m=It(za(32,2),ai("shared_secret"),ai("")),h=h1(n,p,m,32);return Ot(p,m,d,l),h},t,r)}function FK(e,t,r,o){let n=e.Point.Fn;if(!n)throw Error("no Point.Fn");function i(s){let a;for(let d=0,p=t;;d=p,p+=t){if(p>s.length)throw Error("rejection sampling failed");if(a=n.fromBytes(s.subarray(d,p),!0),n.isValidNot0(a))break}let l=n.toBytes(n.create(a)),u=e.getPublicKey(l,!1);return{secretKey:l,publicKey:u}}return{lengths:{secretKey:t,publicKey:r,seed:o,msg:o,cipherText:r},keygen(s=Zn(o)){return Re(s,o,"seed"),i(s)},getPublicKey(s){return e.getPublicKey(s,!1)},encapsulate(s,a=Zn(o)){Re(a,o,"rand");let{secretKey:l}=i(a),u=this.decapsulate(s,l),d=e.getPublicKey(l,!1);return Ot(l),{sharedSecret:u,cipherText:d}},decapsulate(s,a){return e.getSharedSecret(a,s).subarray(1)}}}function HK(e,t,r,o){let{secretKey:n,publicKeyUncompressed:i}=r.lengths;if(!n||!i)throw Error("wrong curve");let s=FK(r,n,i,o),a=64,l=a+o;return Jf(32,32,(u)=>{Re(u,32);let d=Ln(u,{dkLen:l}),p=d.subarray(0,a),m=d.subarray(a,l);return It(p,m)},(u,d,p)=>_s(It(p[0],p[1],d[1],u[1],ai(e))),t,s)}var LSe,ZSe,j1,jSe,qK,JK,Kf,B1;var U1=S(()=>{u1();p1();Na();g1();NS();Uf();Dr();L1();Ff();/*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) */LSe=Z1("QSF-KEM(ML-KEM-768,P-256)-XOF(SHAKE256)-KDF(SHA3-256)",bu,HS(DS,!0),Ln,_s),ZSe=Z1("QSF-KEM(ML-KEM-1024,P-384)-XOF(SHAKE256)-KDF(SHA3-256)",D1,HS(d1,!0),Ln,_s);j1=HS(l1),jSe=MK("KitchenSink-KEM(ML-KEM-768,X25519)-XOF(SHAKE256)-KDF(HKDF-SHA-256)",bu,j1,Ln,jf),qK=(()=>Jf(32,32,JS(Ln),(e,t,r)=>_s(It(r[0],r[1],t[1],e[1],ai("\\.//^\\"))),bu,j1))();JK=(()=>HK("MLKEM768-P256",bu,DS,128))(),Kf=qK,B1=JK});function xo(e,t=""){if(typeof e!=="boolean"){let r=t&&`"${t}" `;throw TypeError(r+"expected boolean, got type="+typeof e)}return e}function Gf(e){if(typeof e==="bigint"){if(!Vf(e))throw RangeError("positive bigint expected, got "+e)}else VS(e);return e}function jn(e,t=""){if(typeof e!=="number"){let r=t&&`"${t}" `;throw TypeError(r+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let r=t&&`"${t}" `;throw RangeError(r+"expected safe integer, got "+e)}}function vu(e){let t=Gf(e).toString(16);return t.length&1?"0"+t:t}function M1(e){if(typeof e!=="string")throw TypeError("hex string expected, got "+typeof e);return e===""?Wf:BigInt("0x"+e)}function ks(e){return M1(mf(e))}function pn(e){return M1(mf(pi(Mt(e)).reverse()))}function Qf(e,t){if(St(t),t===0)throw RangeError("zero length");e=Gf(e);let r=e.toString(16);if(r.length>t*2)throw RangeError("number too large");return Kl(r.padStart(t*2,"0"))}function wu(e,t){return Qf(e,t).reverse()}function q1(e,t){if(e=Ye(e),t=Ye(t),e.length!==t.length)return!1;let r=0;for(let o=0;o<e.length;o++)r|=e[o]^t[o];return r===0}function pi(e){return Uint8Array.from(Ye(e))}function Yf(e){if(typeof e!=="string")throw TypeError("ascii string expected, got "+typeof e);return Uint8Array.from(e,(t,r)=>{let o=t.charCodeAt(0);if(t.length!==1||o>127)throw RangeError(`string contains non-ASCII character "${e[r]}" with code ${o} at position ${r}`);return o})}function KK(e,t,r){return Vf(e)&&Vf(t)&&Vf(r)&&t<=e&&e<r}function _o(e,t,r,o){if(!KK(t,r,o))throw RangeError("expected valid "+e+": "+r+" <= n < "+o+", got "+t)}function Fa(e){if(e<Wf)throw Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Wf;e>>=KS,t+=1);return t}function F1(e,t,r){if(St(e,"hashLen"),St(t,"qByteLen"),typeof r!=="function")throw TypeError("hmacFn must be a function");let o=(v)=>new Uint8Array(v),n=Uint8Array.of(),i=Uint8Array.of(0),s=Uint8Array.of(1),a=1000,l=o(e),u=o(e),d=0,p=()=>{l.fill(1),u.fill(0),d=0},m=(...v)=>r(u,Jt(l,...v)),h=(v=n)=>{if(u=m(i,v),l=m(),v.length===0)return;u=m(s,v),l=m()},b=()=>{if(d++>=a)throw Error("drbg: tried max amount of iterations");let v=0,x=[];while(v<t){l=m();let _=l.slice();x.push(_),v+=l.length}return Jt(...x)};return(v,x)=>{p(),h(v);let _=void 0;while((_=x(b()))===void 0)h();return p(),_}}function Gr(e,t={},r={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw TypeError("expected valid options object");function o(i,s,a){if(!a&&s!=="function"&&!Object.hasOwn(e,i))throw TypeError(`param "${i}" is invalid: expected own property`);let l=e[i];if(a&&l===void 0)return;let u=typeof l;if(u!==s||l===null)throw TypeError(`param "${i}" is invalid: expected ${s}, got ${u}`)}let n=(i,s)=>Object.entries(i).forEach(([a,l])=>o(a,l,s));n(t,!1),n(r,!0)}var Ye=(e,t,r)=>Mt(e,t,r),VS,Ba,Jt=(...e)=>Hb(...e),Ua=(e)=>Kl(e),Ma,qa=(e)=>mo(e),Wf,KS,Vf=(e)=>typeof e==="bigint"&&Wf<=e,xu=(e)=>(KS<<BigInt(e))-KS,WS=()=>{throw Error("not implemented")};var fi=S(()=>{Hr();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */VS=St,Ba=mf,Ma=Mb,Wf=BigInt(0),KS=BigInt(1)});function it(e,t){if(t<=Kt)throw Error("mod: expected positive modulus, got "+t);let r=e%t;return r>=Kt?r:t+r}function Qr(e,t,r){if(t<Kt)throw Error("pow2: expected non-negative exponent, got "+t);let o=e;while(t-- >Kt)o*=o,o%=r;return o}function H1(e,t){if(e===Kt)throw Error("invert: expected non-zero number");if(t<=Kt)throw Error("invert: expected positive modulus, got "+t);let r=it(e,t),o=t,n=Kt,i=ht,s=ht,a=Kt;while(r!==Kt){let u=o/r,d=o-r*u,p=n-s*u,m=i-a*u;o=r,r=d,n=s,i=a,s=p,a=m}if(o!==ht)throw Error("invert: does not exist");return it(n,t)}function GS(e,t,r){let o=e;if(!o.eql(o.sqr(t),r))throw Error("Cannot find square root")}function X1(e,t){let r=e,o=(r.ORDER+ht)/W1,n=r.pow(t,o);return GS(r,n,t),n}function GK(e,t){let r=e,o=(r.ORDER-G1)/Q1,n=r.mul(t,Rs),i=r.pow(n,o),s=r.mul(t,i),a=r.mul(r.mul(s,Rs),i),l=r.mul(s,r.sub(a,r.ONE));return GS(r,l,t),l}function QK(e){let t=Xf(e),r=eP(e),o=r(t,t.neg(t.ONE)),n=r(t,o),i=r(t,t.neg(o)),s=(e+VK)/Y1;return(a,l)=>{let u=a,d=u.pow(l,s),p=u.mul(d,o),m=u.mul(d,n),h=u.mul(d,i),b=u.eql(u.sqr(p),l),y=u.eql(u.sqr(m),l);d=u.cmov(d,p,b),p=u.cmov(h,m,y);let v=u.eql(u.sqr(p),l),x=u.cmov(d,p,v);return GS(u,x,l),x}}function eP(e){if(e<V1)throw Error("sqrt is not defined for small field");let t=e-ht,r=0;while(t%Rs===Kt)t/=Rs,r++;let o=Rs,n=Xf(e);while(J1(n,o)===1)if(o++>1000)throw Error("Cannot find square root: probably non-prime P");if(r===1)return X1;let i=n.pow(o,t),s=(t+ht)/Rs;return function(l,u){let d=l;if(d.is0(u))return u;if(J1(d,u)!==1)throw Error("Cannot find square root");let p=r,m=d.mul(d.ONE,i),h=d.pow(u,t),b=d.pow(u,s);while(!d.eql(h,d.ONE)){if(d.is0(h))return d.ZERO;let y=1,v=d.sqr(h);while(!d.eql(v,d.ONE))if(y++,v=d.sqr(v),y===p)throw Error("Cannot find square root");let x=ht<<BigInt(p-y-1),_=d.pow(m,x);p=y,m=d.sqr(_),h=d.mul(h,m),b=d.mul(b,_)}return b}}function YK(e){if(e%W1===V1)return X1;if(e%Q1===G1)return GK;if(e%Y1===WK)return QK(e);return eP(e)}function QS(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=XK.reduce((o,n)=>(o[n]="function",o),t);if(Gr(e,r),jn(e.BYTES,"BYTES"),jn(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=ht)throw Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function eV(e,t,r){let o=e;if(r<Kt)throw Error("invalid exponent, negatives unsupported");if(r===Kt)return o.ONE;if(r===ht)return t;let n=o.ONE,i=t;while(r>Kt){if(r&ht)n=o.mul(n,i);i=o.sqr(i),r>>=ht}return n}function _u(e,t,r=!1){let o=e,n=Array(t.length).fill(r?o.ZERO:void 0),i=t.reduce((a,l,u)=>{if(o.is0(l))return a;return n[u]=a,o.mul(a,l)},o.ONE),s=o.inv(i);return t.reduceRight((a,l,u)=>{if(o.is0(l))return a;return n[u]=o.mul(a,n[u]),o.mul(a,l)},s),n}function J1(e,t){let r=e,o=(r.ORDER-ht)/Rs,n=r.pow(t,o),i=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),a=r.eql(n,r.neg(r.ONE));if(!i&&!s&&!a)throw Error("invalid Legendre symbol result");return i?1:s?0:-1}function tV(e,t){if(t!==void 0)VS(t);if(e<=Kt)throw Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw Error("invalid n length: expected positive bit length, got "+t);let r=Fa(e);if(t!==void 0&&t<r)throw Error(`invalid n length: expected bit length (${r}) >= n.length (${t})`);let o=t!==void 0?t:r,n=Math.ceil(o/8);return{nBitLength:o,nByteLength:n}}class YS{ORDER;BITS;BYTES;isLE;ZERO=Kt;ONE=ht;_lengths;_mod;constructor(e,t={}){if(e<=ht)throw Error("invalid field: expected ORDER > 1, got "+e);let r=void 0;if(this.isLE=!1,t!=null&&typeof t==="object"){if(typeof t.BITS==="number")r=t.BITS;if(typeof t.sqrt==="function")Object.defineProperty(this,"sqrt",{value:t.sqrt,enumerable:!0});if(typeof t.isLE==="boolean")this.isLE=t.isLE;if(t.allowedLengths)this._lengths=Object.freeze(t.allowedLengths.slice());if(typeof t.modFromBytes==="boolean")this._mod=t.modFromBytes}let{nBitLength:o,nByteLength:n}=tV(e,r);if(n>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=o,this.BYTES=n,Object.freeze(this)}create(e){return it(e,this.ORDER)}isValid(e){if(typeof e!=="bigint")throw TypeError("invalid field element: expected bigint, got "+typeof e);return Kt<=e&&e<this.ORDER}is0(e){return e===Kt}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&ht)===ht}neg(e){return it(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return it(e*e,this.ORDER)}add(e,t){return it(e+t,this.ORDER)}sub(e,t){return it(e-t,this.ORDER)}mul(e,t){return it(e*t,this.ORDER)}pow(e,t){return eV(this,e,t)}div(e,t){return it(e*H1(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return H1(e,this.ORDER)}sqrt(e){let t=K1.get(this);if(!t)K1.set(this,t=YK(this.ORDER));return t(this,e)}toBytes(e){return this.isLE?wu(e,this.BYTES):Qf(e,this.BYTES)}fromBytes(e,t=!1){Ye(e);let{_lengths:r,BYTES:o,isLE:n,ORDER:i,_mod:s}=this;if(r){if(e.length<1||!r.includes(e.length)||e.length>o)throw Error("Field.fromBytes: expected "+r+" bytes, got "+e.length);let l=new Uint8Array(o);l.set(e,n?0:l.length-e.length),e=l}if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);let a=n?pn(e):ks(e);if(s)a=it(a,i);if(!t){if(!this.isValid(a))throw Error("invalid field element: outside of range 0..ORDER")}return a}invertBatch(e){return _u(this,e)}cmov(e,t,r){return xo(r,"condition"),r?t:e}}function Xf(e,t={}){return new YS(e,t)}function tP(e){if(typeof e!=="bigint")throw Error("field order must be bigint");if(e<=ht)throw Error("field order must be greater than 1");let t=Fa(e-ht);return Math.ceil(t/8)}function XS(e){let t=tP(e);return t+Math.ceil(t/2)}function rP(e,t,r=!1){Ye(e);let o=e.length,n=tP(t),i=Math.max(XS(t),16);if(o<i||o>1024)throw Error("expected "+i+"-1024 bytes of input, got "+o);let s=r?pn(e):ks(e),a=it(s,t-ht)+ht;return r?wu(a,n):Qf(a,n)}var Kt,ht,Rs,V1,W1,G1,VK,Q1,WK,Y1,Eo=(e,t)=>(it(e,t)&ht)===ht,XK,K1;var Eu=S(()=>{fi();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Kt=BigInt(0),ht=BigInt(1),Rs=BigInt(2),V1=BigInt(3),W1=BigInt(4),G1=BigInt(5),VK=BigInt(7),Q1=BigInt(8),WK=BigInt(9),Y1=BigInt(16);XK=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];K1=new WeakMap;Object.freeze(YS.prototype)});function Iu(e,t){let r=t.negate();return e?r:t}function $s(e,t){let r=_u(e.Fp,t.map((o)=>o.Z));return t.map((o,n)=>e.fromAffine(o.toAffine(r[n])))}function sP(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function ev(e,t){sP(e,t);let r=Math.ceil(t/e)+1,o=2**(e-1),n=2**e,i=xu(e),s=BigInt(e);return{windows:r,windowSize:o,mask:i,maxNumber:n,shiftBy:s}}function nP(e,t,r){let{windowSize:o,mask:n,maxNumber:i,shiftBy:s}=r,a=Number(e&n),l=e>>s;if(a>o)a-=i,l+=Ts;let u=t*o,d=u+Math.abs(a)-1,p=a===0,m=a<0,h=t%2!==0;return{nextN:l,offset:d,isZero:p,isNeg:m,isNegF:h,offsetF:u}}function rv(e){return aP.get(e)||1}function oP(e){if(e!==Ha)throw Error("invalid wNAF")}class Au{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let o=e;while(t>Ha){if(t&Ts)r=r.add(o);o=o.double(),t>>=Ts}return r}precomputeWindow(e,t){let{windows:r,windowSize:o}=ev(t,this.bits),n=[],i=e,s=i;for(let a=0;a<r;a++){s=i,n.push(s);for(let l=1;l<o;l++)s=s.add(i),n.push(s);i=s.double()}return n}wNAF(e,t,r){if(!this.Fn.isValid(r))throw Error("invalid scalar");let o=this.ZERO,n=this.BASE,i=ev(e,this.bits);for(let s=0;s<i.windows;s++){let{nextN:a,offset:l,isZero:u,isNeg:d,isNegF:p,offsetF:m}=nP(r,s,i);if(r=a,u)n=n.add(Iu(p,t[m]));else o=o.add(Iu(d,t[l]))}return oP(r),{p:o,f:n}}wNAFUnsafe(e,t,r,o=this.ZERO){let n=ev(e,this.bits);for(let i=0;i<n.windows;i++){if(r===Ha)break;let{nextN:s,offset:a,isZero:l,isNeg:u}=nP(r,i,n);if(r=s,l)continue;else{let d=t[a];o=o.add(u?d.negate():d)}}return oP(r),o}getPrecomputes(e,t,r){let o=tv.get(t);if(!o){if(o=this.precomputeWindow(t,e),e!==1){if(typeof r==="function")o=r(o);tv.set(t,o)}}return o}cached(e,t,r){let o=rv(e);return this.wNAF(o,this.getPrecomputes(o,e,r),t)}unsafe(e,t,r,o){let n=rv(e);if(n===1)return this._unsafeLadder(e,t,o);return this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,o)}createCache(e,t){sP(t,this.bits),aP.set(e,t),tv.delete(e)}hasCache(e){return rv(e)!==1}}function cP(e,t,r,o){let n=t,i=e.ZERO,s=e.ZERO;while(r>Ha||o>Ha){if(r&Ts)i=i.add(n);if(o&Ts)s=s.add(n);n=n.double(),r>>=Ts,o>>=Ts}return{p1:i,p2:s}}function iP(e,t,r){if(t){if(t.ORDER!==e)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return QS(t),t}else return Xf(e,{isLE:r})}function em(e,t,r={},o){if(o===void 0)o=e==="edwards";if(!t||typeof t!=="object")throw Error(`expected valid ${e} CURVE object`);for(let l of["p","n","h"]){let u=t[l];if(!(typeof u==="bigint"&&u>Ha))throw Error(`CURVE.${l} must be positive bigint`)}let n=iP(t.p,r.Fp,o),i=iP(t.n,r.Fn,o),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let l of a)if(!n.isValid(t[l]))throw Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:i}}function ku(e,t){return function(o){let n=e(o);return{secretKey:n,publicKey:t(n)}}}var Ha,Ts,tv,aP;var tm=S(()=>{fi();Eu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Ha=BigInt(0),Ts=BigInt(1);tv=new WeakMap,aP=new WeakMap});function Ru(e,t){if(jn(e),jn(t),t<0||t>4)throw Error("invalid I2OSP length: "+t);if(e<0||e>2**(8*t)-1)throw Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let o=t-1;o>=0;o--)r[o]=e&255,e>>>=8;return new Uint8Array(r)}function rV(e,t){let r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e[o]^t[o];return r}function nV(e){if(!Ma(e)&&typeof e!=="string")throw Error("DST must be Uint8Array or ascii string");let t=typeof e==="string"?Yf(e):e;if(t.length===0)throw Error("DST must be non-empty");return t}function nv(e,t,r,o){if(Ye(e),jn(r),t=nV(t),t.length>255)t=o(Jt(Yf("H2C-OVERSIZE-DST-"),t));let{outputLen:n,blockLen:i}=o,s=Math.ceil(r/n);if(r>65535||s>255)throw Error("expand_message_xmd: invalid lenInBytes");let a=Jt(t,Ru(t.length,1)),l=new Uint8Array(i),u=Ru(r,2),d=Array(s),p=o(Jt(l,e,u,Ru(0,1),a));d[0]=o(Jt(p,Ru(1,1),a));for(let h=1;h<s;h++){let b=[rV(p,d[h-1]),Ru(h+1,1),a];d[h]=o(Jt(...b))}return Jt(...d).slice(0,r)}var lP="HashToScalar-";var uP=S(()=>{fi()});function oV(e,t,r){_o("scalar",e,Bn,r);let[[o,n],[i,s]]=t,a=dP(s*e,r),l=dP(-n*e,r),u=e-a*o-l*i,d=-a*n-l*s,p=u<Bn,m=d<Bn;if(p)u=-u;if(m)d=-d;let h=xu(Math.ceil(Fa(r)/2))+mi;if(u<Bn||u>=h||d<Bn||d>=h)throw Error("splitScalar (endomorphism): failed for k");return{k1neg:p,k1:u,k2neg:m,k2:d}}function iv(e){if(!["compact","recovered","der"].includes(e))throw Error('Signature format must be "compact", "recovered", or "der"');return e}function ov(e,t){Gr(e);let r={};for(let o of Object.keys(t))r[o]=e[o]===void 0?t[o]:e[o];if(xo(r.lowS,"lowS"),xo(r.prehash,"prehash"),r.format!==void 0)iv(r.format);return r}function mP(e,t={}){let r=em("weierstrass",e,t),o=r.Fp,n=r.Fn,i=r.CURVE,{h:s,n:a}=i;Gr(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:l,allowInfinityPoint:u}=t;if(l){if(!o.is0(i.a)||typeof l.beta!=="bigint"||!Array.isArray(l.basises))throw Error('invalid endo: expected "beta": bigint and "basises": array')}let d=gP(o,n);function p(){if(!o.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}function m(j,T,Z){if(u&&T.is0())return Uint8Array.of(0);let{x:I,y:R}=T.toAffine(),A=o.toBytes(I);if(xo(Z,"isCompressed"),Z){p();let q=!o.isOdd(R);return Jt(hP(q),A)}else return Jt(Uint8Array.of(4),A,o.toBytes(R))}function h(j){Ye(j,void 0,"Point");let{publicKey:T,publicKeyUncompressed:Z}=d,I=j.length,R=j[0],A=j.subarray(1);if(u&&I===1&&R===0)return{x:o.ZERO,y:o.ZERO};if(I===T&&(R===2||R===3)){let q=o.fromBytes(A);if(!o.isValid(q))throw Error("bad point: is not on curve, wrong x");let N=v(q),K;try{K=o.sqrt(N)}catch(ae){let me=ae instanceof Error?": "+ae.message:"";throw Error("bad point: is not on curve, sqrt error"+me)}p();let G=o.isOdd(K);if((R&1)===1!==G)K=o.neg(K);return{x:q,y:K}}else if(I===Z&&R===4){let q=o.BYTES,N=o.fromBytes(A.subarray(0,q)),K=o.fromBytes(A.subarray(q,q*2));if(!x(N,K))throw Error("bad point: is not on curve");return{x:N,y:K}}else throw Error(`bad point: got length ${I}, expected compressed=${T} or uncompressed=${Z}`)}let b=t.toBytes===void 0?m:t.toBytes,y=t.fromBytes===void 0?h:t.fromBytes;function v(j){let T=o.sqr(j),Z=o.mul(T,j);return o.add(o.add(Z,o.mul(j,i.a)),i.b)}function x(j,T){let Z=o.sqr(T),I=v(j);return o.eql(Z,I)}if(!x(i.Gx,i.Gy))throw Error("bad curve params: generator point");let _=o.mul(o.pow(i.a,rm),iV),k=o.mul(o.sqr(i.b),BigInt(27));if(o.is0(o.add(_,k)))throw Error("bad curve params: a or b");function O(j,T,Z=!1){if(!o.isValid(T)||Z&&o.is0(T))throw Error(`bad point coordinate ${j}`);return T}function L(j){if(!(j instanceof P))throw Error("Weierstrass Point expected")}function z(j){if(!l||!l.basises)throw Error("no endo");return oV(j,l.basises,n.ORDER)}function J(j,T,Z,I,R){return Z=new P(o.mul(Z.X,j),Z.Y,Z.Z),T=Iu(I,T),Z=Iu(R,Z),T.add(Z)}class P{static BASE=new P(i.Gx,i.Gy,o.ONE);static ZERO=new P(o.ZERO,o.ONE,o.ZERO);static Fp=o;static Fn=n;X;Y;Z;constructor(j,T,Z){this.X=O("x",j),this.Y=O("y",T,!0),this.Z=O("z",Z),Object.freeze(this)}static CURVE(){return i}static fromAffine(j){let{x:T,y:Z}=j||{};if(!j||!o.isValid(T)||!o.isValid(Z))throw Error("invalid affine point");if(j instanceof P)throw Error("projective point not allowed");if(o.is0(T)&&o.is0(Z))return P.ZERO;return new P(T,Z,o.ONE)}static fromBytes(j){let T=P.fromAffine(y(Ye(j,void 0,"point")));return T.assertValidity(),T}static fromHex(j){return P.fromBytes(Ua(j))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(j=8,T=!0){if(ee.createCache(this,j),!T)this.multiply(rm);return this}assertValidity(){let j=this;if(j.is0()){if(t.allowInfinityPoint&&o.is0(j.X)&&o.eql(j.Y,o.ONE)&&o.is0(j.Z))return;throw Error("bad point: ZERO")}let{x:T,y:Z}=j.toAffine();if(!o.isValid(T)||!o.isValid(Z))throw Error("bad point: x or y not field elements");if(!x(T,Z))throw Error("bad point: equation left != right");if(!j.isTorsionFree())throw Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:j}=this.toAffine();if(!o.isOdd)throw Error("Field doesn't support isOdd");return!o.isOdd(j)}equals(j){L(j);let{X:T,Y:Z,Z:I}=this,{X:R,Y:A,Z:q}=j,N=o.eql(o.mul(T,q),o.mul(R,I)),K=o.eql(o.mul(Z,q),o.mul(A,I));return N&&K}negate(){return new P(this.X,o.neg(this.Y),this.Z)}double(){let{a:j,b:T}=i,Z=o.mul(T,rm),{X:I,Y:R,Z:A}=this,q=o.ZERO,N=o.ZERO,K=o.ZERO,G=o.mul(I,I),re=o.mul(R,R),ae=o.mul(A,A),me=o.mul(I,R);return me=o.add(me,me),K=o.mul(I,A),K=o.add(K,K),q=o.mul(j,K),N=o.mul(Z,ae),N=o.add(q,N),q=o.sub(re,N),N=o.add(re,N),N=o.mul(q,N),q=o.mul(me,q),K=o.mul(Z,K),ae=o.mul(j,ae),me=o.sub(G,ae),me=o.mul(j,me),me=o.add(me,K),K=o.add(G,G),G=o.add(K,G),G=o.add(G,ae),G=o.mul(G,me),N=o.add(N,G),ae=o.mul(R,A),ae=o.add(ae,ae),G=o.mul(ae,me),q=o.sub(q,G),K=o.mul(ae,re),K=o.add(K,K),K=o.add(K,K),new P(q,N,K)}add(j){L(j);let{X:T,Y:Z,Z:I}=this,{X:R,Y:A,Z:q}=j,N=o.ZERO,K=o.ZERO,G=o.ZERO,re=i.a,ae=o.mul(i.b,rm),me=o.mul(T,R),Se=o.mul(Z,A),xe=o.mul(I,q),ke=o.add(T,Z),Ae=o.add(R,A);ke=o.mul(ke,Ae),Ae=o.add(me,Se),ke=o.sub(ke,Ae),Ae=o.add(T,I);let _e=o.add(R,q);return Ae=o.mul(Ae,_e),_e=o.add(me,xe),Ae=o.sub(Ae,_e),_e=o.add(Z,I),N=o.add(A,q),_e=o.mul(_e,N),N=o.add(Se,xe),_e=o.sub(_e,N),G=o.mul(re,Ae),N=o.mul(ae,xe),G=o.add(N,G),N=o.sub(Se,G),G=o.add(Se,G),K=o.mul(N,G),Se=o.add(me,me),Se=o.add(Se,me),xe=o.mul(re,xe),Ae=o.mul(ae,Ae),Se=o.add(Se,xe),xe=o.sub(me,xe),xe=o.mul(re,xe),Ae=o.add(Ae,xe),me=o.mul(Se,Ae),K=o.add(K,me),me=o.mul(_e,Ae),N=o.mul(ke,N),N=o.sub(N,me),me=o.mul(ke,Se),G=o.mul(_e,G),G=o.add(G,me),new P(N,K,G)}subtract(j){return L(j),this.add(j.negate())}is0(){return this.equals(P.ZERO)}multiply(j){let{endo:T}=t;if(!n.isValidNot0(j))throw RangeError("invalid scalar: out of range");let Z,I,R=(A)=>ee.cached(this,A,(q)=>$s(P,q));if(T){let{k1neg:A,k1:q,k2neg:N,k2:K}=z(j),{p:G,f:re}=R(q),{p:ae,f:me}=R(K);I=re.add(me),Z=J(T.beta,G,ae,A,N)}else{let{p:A,f:q}=R(j);Z=A,I=q}return $s(P,[Z,I])[0]}multiplyUnsafe(j){let{endo:T}=t,Z=this,I=j;if(!n.isValid(I))throw RangeError("invalid scalar: out of range");if(I===Bn||Z.is0())return P.ZERO;if(I===mi)return Z;if(ee.hasCache(this))return this.multiply(I);if(T){let{k1neg:R,k1:A,k2neg:q,k2:N}=z(I),{p1:K,p2:G}=cP(P,Z,A,N);return J(T.beta,K,G,R,q)}else return ee.unsafe(Z,I)}toAffine(j){let T=this,Z=j,{X:I,Y:R,Z:A}=T;if(o.eql(A,o.ONE))return{x:I,y:R};let q=T.is0();if(Z==null)Z=q?o.ONE:o.inv(A);let N=o.mul(I,Z),K=o.mul(R,Z),G=o.mul(A,Z);if(q)return{x:o.ZERO,y:o.ZERO};if(!o.eql(G,o.ONE))throw Error("invZ was invalid");return{x:N,y:K}}isTorsionFree(){let{isTorsionFree:j}=t;if(s===mi)return!0;if(j)return j(P,this);return ee.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:j}=t;if(s===mi)return this;if(j)return j(P,this);return this.multiplyUnsafe(s)}isSmallOrder(){if(s===mi)return this.is0();return this.clearCofactor().is0()}toBytes(j=!0){return xo(j,"isCompressed"),this.assertValidity(),b(P,this,j)}toHex(j=!0){return Ba(this.toBytes(j))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let W=n.BITS,ee=new Au(P,t.endo?Math.ceil(W/2):W);if(W>=8)P.BASE.precompute(8);return Object.freeze(P.prototype),Object.freeze(P),P}function hP(e){return Uint8Array.of(e?2:3)}function gP(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function sV(e,t={}){let{Fn:r}=e,o=t.randomBytes===void 0?qa:t.randomBytes,n=Object.assign(gP(e.Fp,r),{seed:Math.max(XS(r.ORDER),16)});function i(h){try{let b=r.fromBytes(h);return r.isValidNot0(b)}catch(b){return!1}}function s(h,b){let{publicKey:y,publicKeyUncompressed:v}=n;try{let x=h.length;if(b===!0&&x!==y)return!1;if(b===!1&&x!==v)return!1;return!!e.fromBytes(h)}catch(x){return!1}}function a(h){return h=h===void 0?o(n.seed):h,rP(Ye(h,n.seed,"seed"),r.ORDER)}function l(h,b=!0){return e.BASE.multiply(r.fromBytes(h)).toBytes(b)}function u(h){let{secretKey:b,publicKey:y,publicKeyUncompressed:v}=n,x=r._lengths;if(!Ma(h))return;let _=Ye(h,void 0,"key").length,k=_===y||_===v,O=_===b||!!x?.includes(_);if(k&&O)return;return k}function d(h,b,y=!0){if(u(h)===!0)throw Error("first arg must be private key");if(u(b)===!1)throw Error("second arg must be public key");let v=r.fromBytes(h);return e.fromBytes(b).multiply(v).toBytes(y)}let p={isValidSecretKey:i,isValidPublicKey:s,randomSecretKey:a},m=ku(a,l);return Object.freeze(p),Object.freeze(n),Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:m,Point:e,utils:p,lengths:n})}function yP(e,t,r={}){let o=t;fo(o),Gr(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes===void 0?qa:r.randomBytes,i=r.hmac===void 0?(R,A)=>Pn(o,R,A):r.hmac,{Fp:s,Fn:a}=e,{ORDER:l,BITS:u}=a,{keygen:d,getPublicKey:p,getSharedSecret:m,utils:h,lengths:b}=sV(e,r),y={prehash:!0,lowS:typeof r.lowS==="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},v=l*fP+mi<s.ORDER;function x(R){let A=l>>mi;return R>A}function _(R,A){if(!a.isValidNot0(A))throw Error(`invalid signature ${R}: out of range 1..Point.Fn.ORDER`);return A}function k(){if(v)throw Error('"recovered" sig type is not supported for cofactor >2 curves')}function O(R,A){iv(A);let q=b.signature,N=A==="compact"?q:A==="recovered"?q+1:void 0;return Ye(R,N)}class L{r;s;recovery;constructor(R,A,q){if(this.r=_("r",R),this.s=_("s",A),q!=null){if(k(),![0,1,2,3].includes(q))throw Error("invalid recovery id");this.recovery=q}Object.freeze(this)}static fromBytes(R,A=y.format){O(R,A);let q;if(A==="der"){let{r:re,s:ae}=fn.toSig(Ye(R));return new L(re,ae)}if(A==="recovered")q=R[0],A="compact",R=R.subarray(1);let N=b.signature/2,K=R.subarray(0,N),G=R.subarray(N,N*2);return new L(a.fromBytes(K),a.fromBytes(G),q)}static fromHex(R,A){return this.fromBytes(Ua(R),A)}assertRecovery(){let{recovery:R}=this;if(R==null)throw Error("invalid recovery id: must be present");return R}addRecoveryBit(R){return new L(this.r,this.s,R)}recoverPublicKey(R){let{r:A,s:q}=this,N=this.assertRecovery(),K=N===2||N===3?A+l:A;if(!s.isValid(K))throw Error("invalid recovery id: sig.r+curve.n != R.x");let G=s.toBytes(K),re=e.fromBytes(Jt(hP((N&1)===0),G)),ae=a.inv(K),me=J(Ye(R,void 0,"msgHash")),Se=a.create(-me*ae),xe=a.create(q*ae),ke=e.BASE.multiplyUnsafe(Se).add(re.multiplyUnsafe(xe));if(ke.is0())throw Error("invalid recovery: point at infinify");return ke.assertValidity(),ke}hasHighS(){return x(this.s)}toBytes(R=y.format){if(iv(R),R==="der")return Ua(fn.hexFromSig(this));let{r:A,s:q}=this,N=a.toBytes(A),K=a.toBytes(q);if(R==="recovered")return k(),Jt(Uint8Array.of(this.assertRecovery()),N,K);return Jt(N,K)}toHex(R){return Ba(this.toBytes(R))}}Object.freeze(L.prototype),Object.freeze(L);let z=r.bits2int===void 0?function(A){if(A.length>8192)throw Error("input is too large");let q=ks(A),N=A.length*8-u;return N>0?q>>BigInt(N):q}:r.bits2int,J=r.bits2int_modN===void 0?function(A){return a.create(z(A))}:r.bits2int_modN,P=xu(u);function W(R){return _o("num < 2^"+u,R,Bn,P),a.toBytes(R)}function ee(R,A){return Ye(R,void 0,"message"),A?Ye(o(R),void 0,"prehashed message"):R}function j(R,A,q){let{lowS:N,prehash:K,extraEntropy:G}=ov(q,y);R=ee(R,K);let re=J(R),ae=a.fromBytes(A);if(!a.isValidNot0(ae))throw Error("invalid private key");let me=[W(ae),W(re)];if(G!=null&&G!==!1){let Ae=G===!0?n(b.secretKey):G;me.push(Ye(Ae,void 0,"extraEntropy"))}let Se=Jt(...me),xe=re;function ke(Ae){let _e=z(Ae);if(!a.isValidNot0(_e))return;let Ue=a.inv(_e),De=e.BASE.multiply(_e).toAffine(),Qe=a.create(De.x);if(Qe===Bn)return;let bt=a.create(Ue*a.create(xe+Qe*ae));if(bt===Bn)return;let Tt=(De.x===Qe?0:2)|Number(De.y&mi),Dt=bt;if(N&&x(bt))Dt=a.neg(bt),Tt^=1;return new L(Qe,Dt,v?void 0:Tt)}return{seed:Se,k2sig:ke}}function T(R,A,q={}){let{seed:N,k2sig:K}=j(R,A,q);return F1(o.outputLen,a.BYTES,i)(N,K).toBytes(q.format)}function Z(R,A,q,N={}){let{lowS:K,prehash:G,format:re}=ov(N,y);if(q=Ye(q,void 0,"publicKey"),A=ee(A,G),!Ma(R)){let ae=R instanceof L?", use sig.toBytes()":"";throw Error("verify expects Uint8Array signature"+ae)}O(R,re);try{let ae=L.fromBytes(R,re),me=e.fromBytes(q);if(K&&ae.hasHighS())return!1;let{r:Se,s:xe}=ae,ke=J(A),Ae=a.inv(xe),_e=a.create(ke*Ae),Ue=a.create(Se*Ae),De=e.BASE.multiplyUnsafe(_e).add(me.multiplyUnsafe(Ue));if(De.is0())return!1;return a.create(De.x)===Se}catch(ae){return!1}}function I(R,A,q={}){let{prehash:N}=ov(q,y);return A=ee(A,N),L.fromBytes(R,"recovered").recoverPublicKey(A).toBytes()}return Object.freeze({keygen:d,getPublicKey:p,getSharedSecret:m,utils:h,lengths:b,Point:e,sign:T,verify:Z,recoverPublicKey:I,Signature:L,hash:o})}var dP=(e,t)=>(e+(e>=0?t:-t)/fP)/t,pP,fn,Bn,mi,fP,rm,iV;var bP=S(()=>{Vl();Hr();fi();tm();Eu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */pP=class pP extends Error{constructor(e=""){super(e)}};fn={Err:pP,_tlv:{encode:(e,t)=>{let{Err:r}=fn;if(jn(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if(typeof t!=="string")throw TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new r("tlv.encode: unpadded data");let o=t.length/2,n=vu(o);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let i=o>127?vu(n.length/2|128):"";return vu(e)+i+n+t},decode(e,t){let{Err:r}=fn;t=Ye(t,void 0,"DER data");let o=0;if(e<0||e>255)throw new r("tlv.encode: wrong tag");if(t.length<2||t[o++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[o++],i=!!(n&128),s=0;if(!i)s=n;else{let l=n&127;if(!l)throw new r("tlv.decode(long): indefinite length not supported");if(l>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(o,o+l);if(u.length!==l)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let d of u)s=s<<8|d;if(o+=l,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(o,o+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(o+s)}}},_int:{encode(e){let{Err:t}=fn;if(Gf(e),e<Bn)throw new t("integer: negative integers are not allowed");let r=vu(e);if(Number.parseInt(r[0],16)&8)r="00"+r;if(r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=fn;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return ks(e)}},toSig(e){let{Err:t,_int:r,_tlv:o}=fn,n=Ye(e,void 0,"signature"),{v:i,l:s}=o.decode(48,n);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l}=o.decode(2,i),{v:u,l:d}=o.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=fn,o=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s)),i=o+n;return t.encode(48,i)}};Object.freeze(fn._tlv);Object.freeze(fn._int);Object.freeze(fn);Bn=BigInt(0),mi=BigInt(1),fP=BigInt(2),rm=BigInt(3),iV=BigInt(4)});var aV,cV,Ja;var SP=S(()=>{Ra();bP();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */aV=(()=>({p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")}))(),cV=mP(aV),Ja=yP(cV,vt)});function uV(e,t,r,o){let n=e.sqr(r),i=e.sqr(o),s=e.add(e.mul(t.a,n),i),a=e.add(e.ONE,e.mul(t.d,e.mul(n,i)));return e.eql(s,a)}function vP(e,t={}){let r=t,o=em("edwards",e,r,r.FpFnLE),{Fp:n,Fn:i}=o,s=o.CURVE,{h:a}=s;Gr(r,{},{uvRatio:"function"});let l=sv<<BigInt(i.BYTES*8)-xr,u=(y)=>n.create(y),d=r.uvRatio===void 0?(y,v)=>{try{return{isValid:!0,value:n.sqrt(n.div(y,v))}}catch(x){return{isValid:!1,value:hi}}}:r.uvRatio;if(!uV(n,s,s.Gx,s.Gy))throw Error("bad curve params: generator point");function p(y,v,x=!1){let _=x?xr:hi;return _o("coordinate "+y,v,_,l),v}function m(y){if(!(y instanceof h))throw Error("EdwardsPoint expected")}class h{static BASE=new h(s.Gx,s.Gy,xr,u(s.Gx*s.Gy));static ZERO=new h(hi,xr,xr,hi);static Fp=n;static Fn=i;X;Y;Z;T;constructor(y,v,x,_){this.X=p("x",y),this.Y=p("y",v),this.Z=p("z",x,!0),this.T=p("t",_),Object.freeze(this)}static CURVE(){return s}static fromAffine(y){if(y instanceof h)throw Error("extended point not allowed");let{x:v,y:x}=y||{};return p("x",v),p("y",x),new h(v,x,xr,u(v*x))}static fromBytes(y,v=!1){let x=n.BYTES,{a:_,d:k}=s;y=pi(Ye(y,x,"point")),xo(v,"zip215");let O=pi(y),L=y[x-1];O[x-1]=L&-129;let z=pn(O),J=v?l:n.ORDER;_o("point.y",z,hi,J);let P=u(z*z),W=u(P-xr),ee=u(k*P-_),{isValid:j,value:T}=d(W,ee);if(!j)throw Error("bad point: invalid y coordinate");let Z=(T&xr)===xr,I=(L&128)!==0;if(!v&&T===hi&&I)throw Error("bad point: x=0 and x_0=1");if(I!==Z)T=u(-T);return h.fromAffine({x:T,y:z})}static fromHex(y,v=!1){return h.fromBytes(Ua(y),v)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,v=!0){if(b.createCache(this,y),!v)this.multiply(sv);return this}assertValidity(){let y=this,{a:v,d:x}=s;if(y.is0())throw Error("bad point: ZERO");let{X:_,Y:k,Z:O,T:L}=y,z=u(_*_),J=u(k*k),P=u(O*O),W=u(P*P),ee=u(z*v),j=u(P*u(ee+J)),T=u(W+u(x*u(z*J)));if(j!==T)throw Error("bad point: equation left != right (1)");let Z=u(_*k),I=u(O*L);if(Z!==I)throw Error("bad point: equation left != right (2)")}equals(y){m(y);let{X:v,Y:x,Z:_}=this,{X:k,Y:O,Z:L}=y,z=u(v*L),J=u(k*_),P=u(x*L),W=u(O*_);return z===J&&P===W}is0(){return this.equals(h.ZERO)}negate(){return new h(u(-this.X),this.Y,this.Z,u(-this.T))}double(){let{a:y}=s,{X:v,Y:x,Z:_}=this,k=u(v*v),O=u(x*x),L=u(sv*u(_*_)),z=u(y*k),J=v+x,P=u(u(J*J)-k-O),W=z+O,ee=W-L,j=z-O,T=u(P*ee),Z=u(W*j),I=u(P*j),R=u(ee*W);return new h(T,Z,R,I)}add(y){m(y);let{a:v,d:x}=s,{X:_,Y:k,Z:O,T:L}=this,{X:z,Y:J,Z:P,T:W}=y,ee=u(_*z),j=u(k*J),T=u(L*x*W),Z=u(O*P),I=u((_+k)*(z+J)-ee-j),R=Z-T,A=Z+T,q=u(j-v*ee),N=u(I*R),K=u(A*q),G=u(I*q),re=u(R*A);return new h(N,K,re,G)}subtract(y){return m(y),this.add(y.negate())}multiply(y){if(!i.isValidNot0(y))throw RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:v,f:x}=b.cached(this,y,(_)=>$s(h,_));return $s(h,[v,x])[0]}multiplyUnsafe(y){if(!i.isValid(y))throw RangeError("invalid scalar: expected 0 <= sc < curve.n");if(y===hi)return h.ZERO;if(this.is0()||y===xr)return this;return b.unsafe(this,y,(v)=>$s(h,v))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return b.unsafe(this,s.n).is0()}toAffine(y){let v=this,x=y,{X:_,Y:k,Z:O}=v,L=v.is0();if(x==null)x=L?lV:n.inv(O);let z=u(_*x),J=u(k*x),P=n.mul(O,x);if(L)return{x:hi,y:xr};if(P!==xr)throw Error("invZ was invalid");return{x:z,y:J}}clearCofactor(){if(a===xr)return this;return this.multiplyUnsafe(a)}toBytes(){let{x:y,y:v}=this.toAffine(),x=n.toBytes(v);return x[x.length-1]|=y&xr?128:0,x}toHex(){return Ba(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let b=new Au(h,i.BITS);if(i.BITS>=8)h.BASE.precompute(8);return Object.freeze(h.prototype),Object.freeze(h),h}class av{static BASE;static ZERO;static Fp;static Fn;ep;constructor(e){this.ep=e}static fromBytes(e){WS()}static fromHex(e){WS()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return Ba(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.ep.precompute(e,t),this}}var hi,xr,sv,lV;var wP=S(()=>{fi();tm();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */hi=BigInt(0),xr=BigInt(1),sv=BigInt(2),lV=BigInt(8)});function dV(e){return Gr(e,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...e})}function xP(e){let t=dV(e),{P:r,type:o,adjustScalarBytes:n,powPminus2:i,randomBytes:s}=t,a=o==="x25519";if(!a&&o!=="x448")throw Error("invalid type");let l=s===void 0?qa:s,u=a?255:448,d=a?32:56,p=a?BigInt(9):BigInt(5),m=a?BigInt(121665):BigInt(39081),h=a?nm**BigInt(254):nm**BigInt(447),b=a?BigInt(8)*nm**BigInt(251)-Ka:BigInt(4)*nm**BigInt(445)-Ka,y=h+b+Ka,v=(I)=>it(I,r),x=_(p);function _(I){return wu(v(I),d)}function k(I){let R=pi(Ye(I,d,"uCoordinate"));if(a)R[31]&=127;return v(pn(R))}function O(I){return pn(n(pi(Ye(I,d,"scalar"))))}function L(I,R){let A=ee(k(R),O(I));if(A===Tu)throw Error("invalid private or public key received");return _(A)}function z(I){return L(I,x)}let J=z,P=L;function W(I,R,A){let q=v(I*(R-A));return R=v(R-q),A=v(A+q),{x_2:R,x_3:A}}function ee(I,R){_o("u",I,Tu,r),_o("scalar",R,h,y);let A=R,q=I,N=Ka,K=Tu,G=I,re=Ka,ae=Tu;for(let Se=BigInt(u-1);Se>=Tu;Se--){let xe=A>>Se&Ka;ae^=xe,{x_2:N,x_3:G}=W(ae,N,G),{x_2:K,x_3:re}=W(ae,K,re),ae=xe;let ke=N+K,Ae=v(ke*ke),_e=N-K,Ue=v(_e*_e),De=Ae-Ue,Qe=G+re,bt=G-re,Tt=v(bt*ke),Dt=v(Qe*_e),lt=Tt+Dt,Or=Tt-Dt;G=v(lt*lt),re=v(q*v(Or*Or)),N=v(Ae*Ue),K=v(De*(Ae+v(m*De)))}({x_2:N,x_3:G}=W(ae,N,G)),{x_2:K,x_3:re}=W(ae,K,re);let me=i(K);return v(N*me)}let j={secretKey:d,publicKey:d,seed:d},T=(I)=>(I=I===void 0?l(d):I,Ye(I,j.seed,"seed"),I),Z={randomSecretKey:T};return Object.freeze(j),Object.freeze(Z),Object.freeze({keygen:ku(T,J),getSharedSecret:P,getPublicKey:J,scalarMult:L,scalarMultBase:z,utils:Z,GuBytes:x.slice(),lengths:j})}var Tu,Ka,nm;var _P=S(()=>{fi();tm();Eu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */Tu=BigInt(0),Ka=BigInt(1),nm=BigInt(2)});function kP(e){let t=BigInt(10),r=BigInt(20),o=BigInt(40),n=BigInt(80),i=Cs,a=e*e%i*e%i,l=Qr(a,EP,i)*a%i,u=Qr(l,Io,i)*e%i,d=Qr(u,mV,i)*u%i,p=Qr(d,t,i)*d%i,m=Qr(p,r,i)*p%i,h=Qr(m,o,i)*m%i,b=Qr(h,n,i)*h%i,y=Qr(b,n,i)*h%i,v=Qr(y,t,i)*d%i;return{pow_p_5_8:Qr(v,EP,i)*e%i,b2:a}}function gV(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function pv(e,t){let r=Cs,o=it(t*t*t,r),n=it(o*o*t,r),i=kP(e*n).pow_p_5_8,s=it(e*o*i,r),a=it(t*s*s,r),l=s,u=it(s*cv,r),d=a===e,p=a===it(-e,r),m=a===it(-e*cv,r);if(d)s=l;if(p||m)s=u;if(Eo(s,r))s=it(-s,r);return{isValid:d||p,value:s}}function AP(e){let{d:t}=dv,r=Cs,o=(x)=>gi.create(x),n=o(lv*e*e),i=o((n+Io)*SV),s=BigInt(-1),a=o((s-t*n)*o(n+t)),{isValid:l,value:u}=pv(i,a),d=o(u*e);if(!Eo(d,r))d=o(-d);if(!l)u=d;if(!l)s=n;let p=o(s*(n-Io)*vV-a),m=u*u,h=o((u+u)*a),b=o(p*yV),y=o(Io-m),v=o(Io+m);return new Os(o(h*v),o(y*b),o(b*v),o(h*y))}var pV,Io,EP,fV,mV,hV,Cs,dv,cv,Os,gi,RP,om,lv,yV,bV,SV,vV,IP=(e)=>pv(Io,e),wV,uv=(e)=>gi.create(pn(e)&wV),dr,xV;var TP=S(()=>{Ra();Hr();wP();uP();Eu();_P();fi();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */pV=BigInt(0),Io=BigInt(1),EP=BigInt(2),fV=BigInt(3),mV=BigInt(5),hV=BigInt(8),Cs=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),dv=(()=>({p:Cs,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:hV,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();cv=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");Os=vP(dv,{uvRatio:pv}),gi=(()=>Os.Fp)(),RP=(()=>Os.Fn)(),om=(()=>{let e=Cs;return xP({P:e,type:"x25519",powPminus2:(t)=>{let{pow_p_5_8:r,b2:o}=kP(t);return it(Qr(r,fV,e)*o,e)},adjustScalarBytes:gV})})(),lv=cv,yV=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),bV=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),SV=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),vV=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),wV=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");dr=class dr extends av{static BASE=(()=>new dr(Os.BASE))();static ZERO=(()=>new dr(Os.ZERO))();static Fp=(()=>gi)();static Fn=(()=>RP)();constructor(e){super(e)}static fromAffine(e){return new dr(Os.fromAffine(e))}assertSame(e){if(!(e instanceof dr))throw Error("RistrettoPoint expected")}init(e){return new dr(e)}static fromBytes(e){Mt(e,32);let{a:t,d:r}=dv,o=Cs,n=(k)=>gi.create(k),i=uv(e);if(!q1(gi.toBytes(i),e)||Eo(i,o))throw Error("invalid ristretto255 encoding 1");let s=n(i*i),a=n(Io+t*s),l=n(Io-t*s),u=n(a*a),d=n(l*l),p=n(t*r*u-d),{isValid:m,value:h}=IP(n(p*d)),b=n(h*l),y=n(h*b*p),v=n((i+i)*b);if(Eo(v,o))v=n(-v);let x=n(a*y),_=n(v*x);if(!m||Eo(_,o)||x===pV)throw Error("invalid ristretto255 encoding 2");return new dr(new Os(v,x,Io,_))}static fromHex(e){return dr.fromBytes(Kl(e))}toBytes(){let{X:e,Y:t,Z:r,T:o}=this.ep,n=Cs,i=(y)=>gi.create(y),s=i(i(r+t)*i(r-t)),a=i(e*t),l=i(a*a),{value:u}=IP(i(s*l)),d=i(u*s),p=i(u*a),m=i(d*p*o),h;if(Eo(o*m,n)){let y=i(t*lv),v=i(e*lv);e=y,t=v,h=i(d*bV)}else h=p;if(Eo(e*m,n))t=i(-t);let b=i((r-t)*h);if(Eo(b,n))b=i(-b);return gi.toBytes(b)}equals(e){this.assertSame(e);let{X:t,Y:r}=this.ep,{X:o,Y:n}=e.ep,i=(l)=>gi.create(l),s=i(t*n)===i(r*o),a=i(r*n)===i(t*o);return s||a}is0(){return this.equals(dr.ZERO)}};Object.freeze(dr.BASE);Object.freeze(dr.ZERO);Object.freeze(dr.prototype);Object.freeze(dr);xV=Object.freeze({Point:dr,hashToCurve(e,t){let r=t?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":t.DST,o=nv(e,r,64,bf);return xV.deriveToCurve(o)},hashToScalar(e,t={DST:lP}){let r=nv(e,t.DST,64,bf);return RP.create(pn(r))},deriveToCurve(e){Mt(e,64);let t=uv(e.subarray(0,32)),r=AP(t),o=uv(e.subarray(32,64)),n=AP(o);return new dr(r.add(n))}})});async function OP(e,t){if(_V)return await t();try{return await e()}catch(r){if(r instanceof ReferenceError||r instanceof DOMException&&r.name==="NotSupportedError")return await t();else throw r}}async function im(e,t){return await OP(async()=>{let r=fv(e)?e:await IV(e),o=await crypto.subtle.importKey("raw",AV(t),{name:"X25519"},$P,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:o},r,256))},()=>{if(fv(e))throw Error("CryptoKey provided but X25519 WebCrypto is not supported");return om.scalarMult(e,t)})}async function $u(e){return await OP(async()=>im(e,om.GuBytes),()=>{if(fv(e))throw Error("CryptoKey provided but X25519 WebCrypto is not supported");return om.scalarMultBase(e)})}async function IV(e){if(e.length!==32)throw Error("X25519 private key must be 32 bytes");let t=new Uint8Array([...EV,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},$P,["deriveBits"])}function fv(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}function AV(e){return e}var $P=!1,_V=!1,EV;var CP=S(()=>{TP();EV=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32])});class mv{s;transcript=[];buf=new Uint8Array(0);constructor(e){this.s=e.getReader()}async readLine(){let e=[];while(!0){let t=this.buf.indexOf(10);if(t>=0)return e.push(this.buf.subarray(0,t)),this.transcript.push(this.buf.subarray(0,t+1)),this.buf=this.buf.subarray(t+1),RV(Ps(e));if(this.buf.length>0)e.push(this.buf),this.transcript.push(this.buf);let r=await this.s.read();if(r.done)return this.buf=Ps(e),null;this.buf=r.value}}close(){return this.s.releaseLock(),{rest:this.buf,transcript:Ps(this.transcript)}}}function RV(e){return e.forEach((t)=>{if(t<32||t>126)throw Error("invalid non-ASCII byte in header")}),new TextDecoder().decode(e)}function Ps(e){let t=e.reduce((n,i)=>n+i.length,0),r=new Uint8Array(t),o=0;for(let n of e)r.set(n,o),o+=n.length;return r}function Va(e,...t){return e.pipeThrough(new TransformStream({start(r){for(let o of t)r.enqueue(o)}}))}function sm(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function hv(e){if(!(e instanceof ReadableStream))throw Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function PP(e){if(!(e instanceof ReadableStream))throw Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function zP(e,t){let r=e.getReader(),o=[],n=0;while(n<t){let{done:l,value:u}=await r.read();if(l)throw Error("stream ended before reading "+t.toString()+" bytes");o.push(u),n+=u.length}r.releaseLock();let i=Ps(o),s=i.subarray(0,t),a=Va(e,i.subarray(t));return{data:s,rest:a}}var gv=()=>{};class Un{args;body;constructor(e,t){this.args=e,this.body=t}}async function TV(e){let t=await e.readLine();if(t===null)throw Error("invalid stanza");let r=t.split(" ");if(r.length<2||r.shift()!=="->")return{next:t};for(let i of r)if(i.length===0)throw Error("invalid stanza");let o=[];for(;;){let i=await e.readLine();if(i===null)throw Error("invalid stanza");let s=Yt.decode(i);if(s.length>48)throw Error("invalid stanza");if(o.push(s),s.length<48)break}let n=Ps(o);return{s:new Un(r,n)}}async function NP(e){let t=new mv(e),r=await t.readLine();if(r!=="age-encryption.org/v1")throw Error("invalid version "+(r??"line"));let o=[];for(;;){let{s:n,next:i}=await TV(t);if(n!==void 0){o.push(n);continue}if(!i.startsWith("--- "))throw Error("invalid header");let s=Yt.decode(i.slice(4)),{rest:a,transcript:l}=t.close(),u=l.slice(0,l.length-1-i.length+3);return{stanzas:o,headerNoMAC:u,MAC:s,headerSize:l.length,rest:Va(e,a)}}}function yv(e){let t=[];t.push(`age-encryption.org/v1
|
|
4
4
|
`);for(let r of e){t.push("-> "+r.args.join(" ")+`
|
|
5
5
|
`);for(let o=0;o<r.body.length;o+=48){let n=o+48;if(n>r.body.length)n=r.body.length;t.push(Yt.encode(r.body.subarray(o,n))+`
|
|
6
6
|
`)}if(r.body.length%48===0)t.push(`
|
|
7
7
|
`)}return t.push("---"),new TextEncoder().encode(t.join(""))}function DP(e,t){return Ps([yv(e),new TextEncoder().encode(" "+Yt.encode(t)+`
|
|
8
|
-
`)])}var am=S(()=>{eu();gv()});function vv(){return LP()}function LP(){let e=
|
|
8
|
+
`)])}var am=S(()=>{eu();gv()});function vv(){return LP()}function LP(){let e=mo(32),t=Nr.encodeFromBytes("AGE-SECRET-KEY-",e).toUpperCase();return Promise.resolve(t)}async function lm(e){let t;if(jP(e))t=e;else if(e.startsWith("AGE-SECRET-KEY-PQ-1")){let o=Nr.decodeToBytes(e);if(o.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||o.bytes.length!==32)throw Error("invalid identity");let n=Kf.getPublicKey(o.bytes);return Nr.encode("age1pq",Nr.toWords(n),!1)}else{let o=Nr.decodeToBytes(e);if(!e.startsWith("AGE-SECRET-KEY-1")||o.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||o.bytes.length!==32)throw Error("invalid identity");t=o.bytes}let r=await $u(t);return Nr.encodeFromBytes("age",r)}class wv{recipient;constructor(e){let t=Nr.decodeToBytes(e);if(!e.startsWith("age1pq1")||t.prefix.toLowerCase()!=="age1pq"||t.bytes.length!==1216)throw Error("invalid recipient");this.recipient=t.bytes}wrapFileKey(e){let{cipherText:t,sharedSecret:r}=Kf.encapsulate(this.recipient),o=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:n,nonce:i}=um(ZP,r,o),s=Kr(n,i).encrypt(e);return[new Un(["mlkem768x25519",Yt.encode(t)],s)]}}class xv{identity;constructor(e){let t=Nr.decodeToBytes(e);if(!e.startsWith("AGE-SECRET-KEY-PQ-1")||t.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||t.bytes.length!==32)throw Error("invalid identity");this.identity=t.bytes}unwrapFileKey(e){for(let t of e){if(t.args.length<1||t.args[0]!=="mlkem768x25519")continue;if(t.args.length!==2)throw Error("invalid mlkem768x25519 stanza");let r=Yt.decode(t.args[1]);if(r.length!==1120)throw Error("invalid mlkem768x25519 stanza");if(t.body.length!==32)throw Error("invalid mlkem768x25519 stanza");let o=Kf.decapsulate(r,this.identity),n=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:i,nonce:s}=um(ZP,o,n);try{return Kr(i,s).decrypt(t.body)}catch{continue}}return null}}function um(e,t,r){let o=OV(e),n=cm(o,void 0,"psk_id_hash",new Uint8Array(0)),i=cm(o,void 0,"info_hash",r),s=new Uint8Array(1+n.length+i.length);s[0]=0,s.set(n,1),s.set(i,1+n.length);let a=cm(o,t,"secret",new Uint8Array(0)),l=Sv(o,a,"key",s,32),u=Sv(o,a,"base_nonce",s,12);return{key:l,nonce:u}}function OV(e){let t=new Uint8Array(10);return t.set(new TextEncoder().encode("HPKE"),0),t[4]=e>>8&255,t[5]=e&255,t[6]=0,t[7]=1,t[8]=0,t[9]=3,t}function cm(e,t,r,o){let n=new Uint8Array(7+e.length+r.length+o.length),i=0;return n.set(new TextEncoder().encode("HPKE-v1"),i),i+=7,n.set(e,i),i+=e.length,n.set(new TextEncoder().encode(r),i),i+=r.length,n.set(o,i),Wl(vt,n,t)}function Sv(e,t,r,o,n){let i=new Uint8Array(9+e.length+r.length+o.length),s=0;return i[s]=n>>8&255,i[s+1]=n&255,s+=2,i.set(new TextEncoder().encode("HPKE-v1"),s),s+=7,i.set(e,s),s+=e.length,i.set(new TextEncoder().encode(r),s),s+=r.length,i.set(o,s),Gb(vt,t,i,n)}function CV(e){if(e.length!==Ja.lengths.publicKeyUncompressed)e=Ja.Point.fromBytes(e).toBytes(!1);let t=Ja.utils.randomSecretKey(),r=Ja.getPublicKey(t,!1),o=Ja.getSharedSecret(t,e,!0).subarray(1),n=new Uint8Array(r.length+e.length);n.set(r,0),n.set(e,r.length);let i=new Uint8Array(5);i.set(new TextEncoder().encode("KEM"),0),i[3]=bv>>8,i[4]=bv&255;let s=cm(i,void 0,"eae_prk",o),a=Sv(i,s,"shared_secret",n,32);return{encapsulatedKey:r,sharedSecret:a}}class _v{recipient;constructor(e){let t=Nr.decodeToBytes(e);if(!e.startsWith("age1tag1")||t.prefix.toLowerCase()!=="age1tag"||t.bytes.length!==33)throw Error("invalid recipient");this.recipient=t.bytes}wrapFileKey(e){let{encapsulatedKey:t,sharedSecret:r}=CV(this.recipient),o=new TextEncoder().encode("age-encryption.org/p256tag"),n=(()=>{let l=vt(this.recipient).subarray(0,4),u=new Uint8Array(t.length+l.length);return u.set(t,0),u.set(l,t.length),Wl(vt,u,o).subarray(0,4)})(),{key:i,nonce:s}=um(bv,r,o),a=Kr(i,s).encrypt(e);return[new Un(["p256tag",Yt.encode(n),Yt.encode(t)],a)]}}class Ev{recipient;constructor(e){let t=Nr.decodeToBytes(e);if(!e.startsWith("age1tagpq1")||t.prefix.toLowerCase()!=="age1tagpq"||t.bytes.length!==1249)throw Error("invalid recipient");this.recipient=t.bytes}wrapFileKey(e){let{cipherText:t,sharedSecret:r}=B1.encapsulate(this.recipient),o=new TextEncoder().encode("age-encryption.org/mlkem768p256tag"),n=(()=>{let l=vt(this.recipient.subarray(1184)).subarray(0,4),u=new Uint8Array(t.length+l.length);return u.set(t,0),u.set(l,t.length),Wl(vt,u,o).subarray(0,4)})(),{key:i,nonce:s}=um($V,r,o),a=Kr(i,s).encrypt(e);return[new Un(["mlkem768p256tag",Yt.encode(n),Yt.encode(t)],a)]}}class Iv{recipient;constructor(e){let t=Nr.decodeToBytes(e);if(!e.startsWith("age1")||t.prefix.toLowerCase()!=="age"||t.bytes.length!==32)throw Error("invalid recipient");this.recipient=t.bytes}async wrapFileKey(e){let t=mo(32),r=await $u(t),o=await im(t,this.recipient),n=new Uint8Array(r.length+this.recipient.length);n.set(r),n.set(this.recipient,r.length);let i=new TextEncoder().encode("age-encryption.org/v1/X25519"),s=Yo(vt,o,n,i,32);return[new Un(["X25519",Yt.encode(r)],Rv(e,s))]}}class dm{identity;recipient;constructor(e){if(jP(e)){this.identity=e,this.recipient=$u(e);return}let t=Nr.decodeToBytes(e);if(!e.startsWith("AGE-SECRET-KEY-1")||t.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||t.bytes.length!==32)throw Error("invalid identity");this.identity=t.bytes,this.recipient=$u(t.bytes)}async unwrapFileKey(e){for(let t of e){if(t.args.length<1||t.args[0]!=="X25519")continue;if(t.args.length!==2)throw Error("invalid X25519 stanza");let r=Yt.decode(t.args[1]);if(r.length!==32)throw Error("invalid X25519 stanza");let o=await im(this.identity,r),n=await this.recipient,i=new Uint8Array(r.length+n.length);i.set(r),i.set(n,r.length);let s=new TextEncoder().encode("age-encryption.org/v1/X25519"),a=Yo(vt,o,i,s,32),l=Tv(t.body,a);if(l!==null)return l}return null}}class Av{passphrase;logN;constructor(e,t){this.passphrase=e,this.logN=t}wrapFileKey(e){let t=mo(16),r="age-encryption.org/v1/scrypt",o=new Uint8Array(44);o.set(new TextEncoder().encode("age-encryption.org/v1/scrypt")),o.set(t,28);let n=cS(this.passphrase,o,{N:2**this.logN,r:8,p:1,dkLen:32});return[new Un(["scrypt",Yt.encode(t),this.logN.toString()],Rv(e,n))]}}class kv{passphrase;constructor(e){this.passphrase=e}unwrapFileKey(e){for(let t of e){if(t.args.length<1||t.args[0]!=="scrypt")continue;if(e.length!==1)throw Error("scrypt recipient is not the only one in the header");if(t.args.length!==3)throw Error("invalid scrypt stanza");if(!/^[1-9][0-9]*$/.test(t.args[2]))throw Error("invalid scrypt stanza");let r=Yt.decode(t.args[1]);if(r.length!==16)throw Error("invalid scrypt stanza");let o=Number(t.args[2]);if(o>20)throw Error("scrypt work factor is too high");let n="age-encryption.org/v1/scrypt",i=new Uint8Array(n.length+16);i.set(new TextEncoder().encode(n)),i.set(r,n.length);let s=cS(this.passphrase,i,{N:2**o,r:8,p:1,dkLen:32}),a=Tv(t.body,s);if(a!==null)return a}return null}}function Rv(e,t){let r=new Uint8Array(12);return Kr(t,r).encrypt(e)}function Tv(e,t){if(e.length!==32)throw Error("invalid stanza");let r=new Uint8Array(12);try{return Kr(t,r).decrypt(e)}catch{return null}}function jP(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var ZP=25722,$V=80,bv=16;var zs=S(()=>{eu();Qb();Ra();KO();dS();U1();SP();Hr();eu();CP();am();yi()});function BP(e){let t=new Uint8Array(12),r=()=>{for(let s=t.length-2;s>=0;s--)if(t[s]++,t[s]!==0)break},o=!0,n=new Uint8Array($v),i=0;return new TransformStream({transform(s,a){while(s.length>0){if(i===n.length){let u=Kr(e,t).decrypt(n);a.enqueue(u),r(),i=0,o=!1}let l=Math.min(n.length-i,s.length);n.set(s.subarray(0,l),i),i+=l,s=s.subarray(l)}},flush(s){t[11]=1;let a=Kr(e,t).decrypt(n.subarray(0,i));if(!o&&a.length===0)throw Error("final chunk is empty");s.enqueue(a)}})}function UP(e){if(e<Ns)throw Error("ciphertext is too small");if(e===Ns)return 0;let t=Math.floor(e/$v),r=e%$v;if(0<r&&r<=Ns)throw Error("ciphertext size is invalid");let o=e;return o-=t*Ns,o-=r>0?Ns:0,o}function MP(e){let t=new Uint8Array(12),r=()=>{for(let i=t.length-2;i>=0;i--)if(t[i]++,t[i]!==0)break},o=new Uint8Array(Ov),n=0;return new TransformStream({transform(i,s){while(i.length>0){if(n===o.length){let l=Kr(e,t).encrypt(o);s.enqueue(l),r(),n=0}let a=Math.min(o.length-n,i.length);o.set(i.subarray(0,a),n),n+=a,i=i.subarray(a)}},flush(i){t[11]=1;let s=Kr(e,t).encrypt(o.subarray(0,n));i.enqueue(s)}})}function qP(e){let t=Math.max(1,Math.ceil(e/Ov));return e+Ns*t}var Ns=16,Ov,$v;var FP=S(()=>{dS();Ov=(()=>65536)(),$v=(()=>Ov+Ns)()});var bi={};Lt(bi,{decode:()=>zV,encode:()=>PV});function PV(e){let t=[];t.push(`-----BEGIN AGE ENCRYPTED FILE-----
|
|
9
9
|
`);for(let r=0;r<e.length;r+=48){let o=r+48;if(o>e.length)o=e.length;t.push(oS.encode(e.subarray(r,o))+`
|
|
10
10
|
`)}return t.push(`-----END AGE ENCRYPTED FILE-----
|
|
11
11
|
`),t.join("")}function zV(e){let t=e.trim().replaceAll(`\r
|
|
12
12
|
`,`
|
|
13
13
|
`).split(`
|
|
14
|
-
`);if(t.shift()!=="-----BEGIN AGE ENCRYPTED FILE-----")throw Error("invalid header");if(t.pop()!=="-----END AGE ENCRYPTED FILE-----")throw Error("invalid footer");function r(o,n){if(o===t.length-1)return n.length>0&&n.length<=64&&n.length%4===0;return n.length===64}if(!t.every((o,n)=>r(n,o)))throw Error("invalid line length");if(!t.every((o)=>/^[A-Za-z0-9+/=]+$/.test(o)))throw Error("invalid base64");return oS.decode(t.join(""))}var HP=S(()=>{eu();yi()});var JP=S(()=>{yi();am();zs();yi()});class Ou{passphrase=null;scryptWorkFactor=18;recipients=[];setPassphrase(e){if(this.passphrase!==null)throw Error("can encrypt to at most one passphrase");if(this.recipients.length!==0)throw Error("can't encrypt to both recipients and passphrases");this.passphrase=e}setScryptWorkFactor(e){this.scryptWorkFactor=e}addRecipient(e){if(this.passphrase!==null)throw Error("can't encrypt to both recipients and passphrases");if(typeof e==="string")if(e.startsWith("age1pq1"))this.recipients.push(new wv(e));else if(e.startsWith("age1tag1"))this.recipients.push(new _v(e));else if(e.startsWith("age1tagpq1"))this.recipients.push(new Ev(e));else if(e.startsWith("age1"))this.recipients.push(new Iv(e));else throw Error("unrecognized recipient type");else this.recipients.push(e)}async encrypt(e){let t=
|
|
14
|
+
`);if(t.shift()!=="-----BEGIN AGE ENCRYPTED FILE-----")throw Error("invalid header");if(t.pop()!=="-----END AGE ENCRYPTED FILE-----")throw Error("invalid footer");function r(o,n){if(o===t.length-1)return n.length>0&&n.length<=64&&n.length%4===0;return n.length===64}if(!t.every((o,n)=>r(n,o)))throw Error("invalid line length");if(!t.every((o)=>/^[A-Za-z0-9+/=]+$/.test(o)))throw Error("invalid base64");return oS.decode(t.join(""))}var HP=S(()=>{eu();yi()});var JP=S(()=>{yi();am();zs();yi()});class Ou{passphrase=null;scryptWorkFactor=18;recipients=[];setPassphrase(e){if(this.passphrase!==null)throw Error("can encrypt to at most one passphrase");if(this.recipients.length!==0)throw Error("can't encrypt to both recipients and passphrases");this.passphrase=e}setScryptWorkFactor(e){this.scryptWorkFactor=e}addRecipient(e){if(this.passphrase!==null)throw Error("can't encrypt to both recipients and passphrases");if(typeof e==="string")if(e.startsWith("age1pq1"))this.recipients.push(new wv(e));else if(e.startsWith("age1tag1"))this.recipients.push(new _v(e));else if(e.startsWith("age1tagpq1"))this.recipients.push(new Ev(e));else if(e.startsWith("age1"))this.recipients.push(new Iv(e));else throw Error("unrecognized recipient type");else this.recipients.push(e)}async encrypt(e){let t=mo(16),r=[],o=this.recipients;if(this.passphrase!==null)o=[new Av(this.passphrase,this.scryptWorkFactor)];for(let m of o)r.push(...await m.wrapFileKey(t));let n=new TextEncoder().encode("header"),i=Yo(vt,t,void 0,n,32),s=Pn(vt,i,yv(r)),a=DP(r,s),l=mo(16),u=new TextEncoder().encode("payload"),d=Yo(vt,t,l,u,32),p=MP(d);if(!(e instanceof ReadableStream)){if(typeof e==="string")e=new TextEncoder().encode(e);return await hv(Va(sm(e).pipeThrough(p),a,l))}return Object.assign(Va(e.pipeThrough(p),a,l),{size:(m)=>qP(m)+a.length+l.length})}}class Cu{identities=[];addPassphrase(e){this.identities.push(new kv(e))}addIdentity(e){if(ZV(e))this.identities.push(new dm(e));else if(typeof e==="string")if(e.startsWith("AGE-SECRET-KEY-1"))this.identities.push(new dm(e));else if(e.startsWith("AGE-SECRET-KEY-PQ-1"))this.identities.push(new xv(e));else throw Error("unrecognized identity type");else this.identities.push(e)}async decrypt(e,t){let r=e instanceof ReadableStream?e:sm(e),{fileKey:o,headerSize:n,rest:i}=await this.decryptHeaderInternal(r),{data:s,rest:a}=await zP(i,16),l=new TextEncoder().encode("payload"),u=Yo(vt,o,s,l,32),d=BP(u),p=a.pipeThrough(d),m=Object.assign(p,{size:(h)=>UP(h-n-s.length)});if(e instanceof ReadableStream)return m;if(t==="text")return await PP(p);return await hv(p)}async decryptHeader(e){return(await this.decryptHeaderInternal(sm(e))).fileKey}async decryptHeaderInternal(e){let t=await NP(e),r=await this.unwrapFileKey(t.stanzas);if(r===null)throw Error("no identity matched any of the file's recipients");let o=new TextEncoder().encode("header"),n=Yo(vt,r,void 0,o,32),i=Pn(vt,n,t.headerNoMAC);if(!LV(t.MAC,i))throw Error("invalid header HMAC");return{fileKey:r,headerSize:t.headerSize,rest:t.rest}}async unwrapFileKey(e){for(let t of this.identities){let r=await t.unwrapFileKey(e);if(r!==null)return r}return null}}function LV(e,t){if(e.length!==t.length)return!1;let r=0;for(let o=0;o<e.length;o++)r|=e[o]^t[o];return r===0}function ZV(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var yi=S(()=>{Vl();Qb();Ra();Hr();zs();zs();zs();zs();am();FP();gv();HP();JP();zs()});import{spawn as jV}from"child_process";var tr=async(e,t,r={})=>new Promise((o,n)=>{let i=jV(e,t,{stdio:["pipe","inherit","inherit"],env:r.env?{...process.env,...r.env}:process.env,cwd:r.cwd});if(i.on("error",n),i.on("close",(s)=>{if(s===0){o();return}n(Error(`${e} ${t.join(" ")} exited with code ${s??1}`))}),r.stdin)i.stdin.end(r.stdin);else i.stdin.end()});var Mn=()=>{};function KP(e,t,r){if(r.length===0)return;e(`${t} (${r.length}):`);for(let o of r)e(` - ${o}`)}function Cv(e,t,r){let o=t.filter((i)=>r(i)),n=t.filter((i)=>!r(i));KP(e,"Required before first deploy",o),KP(e,"Safe to ignore for now",n)}async function Si(e,t={}){let r=t.runCommand??tr;(t.logger??console.log)(`Pushing ${e.length} secrets to GitHub Secrets...`),await Promise.all(e.map(([n,i])=>r("gh",["secret","set",n],{stdin:i})))}var Pu=S(()=>{Mn()});function Wa(e){let t=e?.trim().toLowerCase();if(!t)return;if(t==="gh"||t==="github")return"gh";if(t==="bw"||t==="bitwarden")return"bitwarden";throw Error(`Unsupported --push-to value: ${e}`)}import{existsSync as BV,mkdirSync as UV,readFileSync as Pv,writeFileSync as zv}from"fs";import{dirname as MV,join as VP}from"path";async function WP(e,t={}){try{let r=await qV(e,t);return{success:!0,message:r.createdLocalKey?`Age key ready at ${r.identityPath}`:`Age key already ready at ${r.identityPath}`}}catch(r){return{success:!1,message:Ve(r,"Age key bootstrap failed")}}}async function qV(e,t={}){let r=t.logger??console.log,o=VP(e,".brains-ops","age","identity.txt"),n=!1,i,s;if(BV(o))i=zu(Pv(o,"utf8")),s=await lm(i);else UV(MV(o),{recursive:!0,mode:448}),i=await vv(),s=await lm(i),zv(o,HV(i,s),{encoding:"utf8",mode:384}),n=!0;FV(VP(e,"pilot.yaml"),s);let a=Wa(t.pushTo);if(a)await Si([["AGE_SECRET_KEY",Pv(o,"utf8")]],{logger:r,runCommand:t.runCommand??tr});if(r(n?`Created ${o}`:`Reusing ${o}`),r(`Configured pilot.yaml agePublicKey ${s}`),a)r(`Pushed AGE_SECRET_KEY to ${a}`);return{createdLocalKey:n,identityPath:o,agePublicKey:s}}function FV(e,t){let r=Pv(e,"utf8"),o=r.match(/^agePublicKey:\s*(.+)$/m),n=o?.[1]?.trim().replace(/^['"]|['"]$/g,"");if(n===t)return;if(n&&n!=="age1replace-with-your-public-key")throw Error(`pilot.yaml agePublicKey does not match local age identity (${n} !== ${t})`);if(o){zv(e,r.replace(/^agePublicKey:\s*.+$/m,`agePublicKey: ${t}`),"utf8");return}let i=r.endsWith(`
|
|
15
15
|
`)?`${r}agePublicKey: ${t}
|
|
16
16
|
`:`${r}
|
|
17
17
|
agePublicKey: ${t}
|
|
@@ -184,7 +184,7 @@ RUN test -n "$BRAIN_VERSION" \\
|
|
|
184
184
|
`}let r=['CMD ["./node_modules/.bin/brain", "start"]','CMD ["bun", "./node_modules/@rizom/brain/dist/brain.js", "start"]','CMD ["bun", "--no-orphans", "./node_modules/@rizom/brain/dist/brain.js", "start"]'].some((n)=>e.includes(n)),o=e.includes("chromium-headless-shell");return r&&o&&["ARG BUN_VERSION=","FROM oven/bun:${BUN_VERSION}-slim AS runtime","FROM runtime AS standalone","FROM runtime AS fleet"].every((n)=>e.includes(n))}function hm(e){return YP.replaceAll("__SERVICE_NAME__",e.serviceName)}function Ga(e){return e.replace(/\nvolumes:\n(?: {2}- .*\n)+$/,`
|
|
185
185
|
volumes:
|
|
186
186
|
- __VOLUMES__
|
|
187
|
-
`)}function fm(e){return e.replace(/\n {4}# <% if ENV\['WWW_DOMAIN'\] && !ENV\['WWW_DOMAIN'\]\.empty\? %>\n {4}- <%= ENV\['WWW_DOMAIN'\] %>\n {4}# <% end %>/,"")}function mm(e){return e.replace(/^# <% if \(ENV\['LOCAL_MODELS'\][^\n]*\|\| ENV\['MATRIX_ENABLED'\][^\n]*%>\naccessories:\n# <% end %>\n/gm,"").replace(/^ *# <% if ENV\['MATRIX_ENABLED'\] == 'true' %>\n[\s\S]*?^ *# <% end %>\n/gm,"").replace(/^ *# <% if ENV\['LOCAL_MODELS'\] && !ENV\['LOCAL_MODELS'\]\.empty\? %>\n[\s\S]*?^ *# <% end %>\n\n?/gm,"").replace(/^ {2}- \/opt\/brain-matrix:\/app\/matrix\n/m,"")}function iz(e,t,r=(o)=>o){let o=hm({serviceName:t}),n=fm(r(e))===fm(r(o)),i=fm(r(mm(e))),s=fm(r(mm(o)));if(!n&&i===s)return!0;let a=c9.every((d)=>i.includes(d)),l=s.replace("path: /health/ready","path: /health"),u=Ga(i);return i===l||!a&&(u===Ga(s)||u===Ga(l))}var tz,a9,c9;var wi=S(()=>{GP();QP();XP();Mv();tz=["create-predeploy-backup.ts","install-health-watchdog.ts","provision-server.ts","pull-local-models.ts","reload-homeserver.ts","update-dns.ts","validate-secrets.ts","write-kamal-secrets.ts","write-ssh-key.ts"],a9={"create-predeploy-backup.ts":"brains-predeploy-backup-v1","install-health-watchdog.ts":"/usr/local/sbin/brains-health-watchdog","provision-server.ts":'requireEnv("HCLOUD_TOKEN")',"pull-local-models.ts":"export async function pullLocalModels","reload-homeserver.ts":"export async function reloadHomeserver","update-dns.ts":'requireEnv("CF_API_TOKEN")',"validate-secrets.ts":"const requiredKeys = schema","write-kamal-secrets.ts":".kamal/secrets","write-ssh-key.ts":'requireEnv("KAMAL_SSH_PRIVATE_KEY")'};c9=["/opt/brain-runtime:/app/data","/opt/brain-state:/data","/opt/brain-config:/config","/opt/brain-dist:/app/dist"]});function B(e,t,r){function o(a,l){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);let u=s.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){let m=d[p];if(!(m in a))a[m]=u[m].bind(a)}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var l;let u=r?.Parent?new i:this;o(u,a),(l=u._zod).deferred??(l.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}function gt(e){if(e)Object.assign(Ds,e);return Ds}var sz,qv,Fv,qn,Ls,Ds;var Zs=S(()=>{qv=Object.freeze({status:"aborted"});Fv=Symbol("zod_brand");qn=class qn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};Ls=class Ls extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(sz=globalThis).__zod_globalConfig??(sz.__zod_globalConfig={});Ds=globalThis.__zod_globalConfig});var ue={};Lt(ue,{BIGINT_FORMAT_RANGES:()=>Xv,Class:()=>uz,NUMBER_FORMAT_RANGES:()=>Yv,aborted:()=>Ii,allowsEval:()=>Vv,assert:()=>h9,assertEqual:()=>d9,assertIs:()=>f9,assertNever:()=>m9,assertNotEqual:()=>p9,assignProp:()=>_i,base64ToUint8Array:()=>cz,base64urlToUint8Array:()=>C9,cached:()=>Xa,captureStackTrace:()=>ym,cleanEnum:()=>O9,cleanRegex:()=>Lu,clone:()=>pr,cloneDef:()=>y9,createTransparentProxy:()=>_9,defineLazy:()=>Be,esc:()=>gm,escapeRegex:()=>Yr,explicitlyAborted:()=>ew,extend:()=>A9,finalizeIssue:()=>fr,floatSafeRemainder:()=>Jv,getElementAtPath:()=>b9,getEnumValues:()=>Du,getLengthableOrigin:()=>Bu,getParsedType:()=>x9,getSizableOrigin:()=>ju,hexToUint8Array:()=>z9,isObject:()=>js,isPlainObject:()=>Ei,issue:()=>ec,joinValues:()=>Q,jsonStringifyReplacer:()=>Ya,merge:()=>R9,mergeDefs:()=>Io,normalizeParams:()=>pe,nullish:()=>xi,numKeys:()=>w9,objectClone:()=>g9,omit:()=>I9,optionalKeys:()=>Qv,parsedType:()=>le,partial:()=>T9,pick:()=>E9,prefixIssues:()=>_r,primitiveTypes:()=>Gv,promiseAllObject:()=>S9,propertyKeyTypes:()=>Zu,randomString:()=>v9,required:()=>$9,safeExtend:()=>k9,shallowClone:()=>Wv,slugify:()=>Kv,stringifyPrimitive:()=>ce,uint8ArrayToBase64:()=>lz,uint8ArrayToBase64url:()=>P9,uint8ArrayToHex:()=>N9,unwrapMessage:()=>Nu});function d9(e){return e}function p9(e){return e}function f9(e){}function m9(e){throw Error("Unexpected value in exhaustive check")}function h9(e){}function Du(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Q(e,t="|"){return e.map((r)=>ce(r)).join(t)}function Ya(e,t){if(typeof t==="bigint")return t.toString();return t}function Xa(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function xi(e){return e===null||e===void 0}function Lu(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Jv(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}function Be(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===az)return;if(o===void 0)o=az,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function g9(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function _i(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Io(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function y9(e){return Io(e._zod.def)}function b9(e,t){if(!t)return e;return t.reduce((r,o)=>r?.[o],e)}function S9(e){let t=Object.keys(e),r=t.map((o)=>e[o]);return Promise.all(r).then((o)=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function v9(e=10){let r="";for(let o=0;o<e;o++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function gm(e){return JSON.stringify(e)}function Kv(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function js(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ei(e){if(js(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(js(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Wv(e){if(Ei(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function w9(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}function Yr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pr(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function pe(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 Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function _9(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function ce(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Qv(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function E9(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=Io(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;s[a]=r.shape[a]}return _i(this,"shape",s),s},checks:[]});return pr(e,i)}function I9(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=Io(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete s[a]}return _i(this,"shape",s),s},checks:[]});return pr(e,i)}function A9(e,t){if(!Ei(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Io(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return _i(this,"shape",i),i}});return pr(e,n)}function k9(e,t){if(!Ei(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=Io(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return _i(this,"shape",o),o}});return pr(e,r)}function R9(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Io(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return _i(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return pr(e,r)}function T9(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let s=Io(t._zod.def,{get shape(){let a=t._zod.def.shape,l={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;l[u]=e?new e({type:"optional",innerType:a[u]}):a[u]}else for(let u in a)l[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return _i(this,"shape",l),l},checks:[]});return pr(t,s)}function $9(e,t,r){let o=Io(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;i[s]=new e({type:"nonoptional",innerType:n[s]})}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return _i(this,"shape",i),i}});return pr(t,o)}function Ii(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 ew(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 _r(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Nu(e){return typeof e==="string"?e:e?.message}function fr(e,t,r){let o=e.message?e.message:Nu(e.inst?._zod.def?.error?.(e))??Nu(t?.error?.(e))??Nu(r.customError?.(e))??Nu(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:s,...a}=e;if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=s;return a}function ju(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Bu(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function le(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 ec(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function O9(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function cz(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function lz(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function C9(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return cz(t+r)}function P9(e){return lz(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function z9(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function N9(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class uz{constructor(...e){}}var az,ym,Vv,x9=(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":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},Zu,Gv,Yv,Xv;var Ie=S(()=>{Zs();az=Symbol("evaluating");ym="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};Vv=Xa(()=>{if(Ds.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});Zu=new Set(["string","number","symbol"]),Gv=new Set(["string","number","bigint","boolean","symbol","undefined"]);Yv={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Xv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function Mu(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function qu(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let l=r,u=0;while(u<a.length){let d=a[u];if(u!==a.length-1)l[d]=l[d]||{_errors:[]};else l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(s));l=l[d],u++}}}};return o(e),r}function tw(e,t=(r)=>r.message){let r={errors:[]},o=(n,i=[])=>{var s,a;for(let l of n.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map((u)=>o({issues:u},[...i,...l.path]));else if(l.code==="invalid_key")o({issues:l.issues},[...i,...l.path]);else if(l.code==="invalid_element")o({issues:l.issues},[...i,...l.path]);else{let u=[...i,...l.path];if(u.length===0){r.errors.push(t(l));continue}let d=r,p=0;while(p<u.length){let m=u[p],h=p===u.length-1;if(typeof m==="string")d.properties??(d.properties={}),(s=d.properties)[m]??(s[m]={errors:[]}),d=d.properties[m];else d.items??(d.items=[]),(a=d.items)[m]??(a[m]={errors:[]}),d=d.items[m];if(h)d.errors.push(t(l));p++}}};return o(e),r}function pz(e){let t=[],r=e.map((o)=>typeof o==="object"?o.key:o);for(let o of r)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function rw(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)if(t.push(`\u2716 ${o.message}`),o.path?.length)t.push(` \u2192 at ${pz(o.path)}`);return t.join(`
|
|
187
|
+
`)}function fm(e){return e.replace(/\n {4}# <% if ENV\['WWW_DOMAIN'\] && !ENV\['WWW_DOMAIN'\]\.empty\? %>\n {4}- <%= ENV\['WWW_DOMAIN'\] %>\n {4}# <% end %>/,"")}function mm(e){return e.replace(/^# <% if \(ENV\['LOCAL_MODELS'\][^\n]*\|\| ENV\['MATRIX_ENABLED'\][^\n]*%>\naccessories:\n# <% end %>\n/gm,"").replace(/^ *# <% if ENV\['MATRIX_ENABLED'\] == 'true' %>\n[\s\S]*?^ *# <% end %>\n/gm,"").replace(/^ *# <% if ENV\['LOCAL_MODELS'\] && !ENV\['LOCAL_MODELS'\]\.empty\? %>\n[\s\S]*?^ *# <% end %>\n\n?/gm,"").replace(/^ {2}- \/opt\/brain-matrix:\/app\/matrix\n/m,"")}function iz(e,t,r=(o)=>o){let o=hm({serviceName:t}),n=fm(r(e))===fm(r(o)),i=fm(r(mm(e))),s=fm(r(mm(o)));if(!n&&i===s)return!0;let a=c9.every((d)=>i.includes(d)),l=s.replace("path: /health/ready","path: /health"),u=Ga(i);return i===l||!a&&(u===Ga(s)||u===Ga(l))}var tz,a9,c9;var wi=S(()=>{GP();QP();XP();Mv();tz=["create-predeploy-backup.ts","install-health-watchdog.ts","provision-server.ts","pull-local-models.ts","reload-homeserver.ts","update-dns.ts","validate-secrets.ts","write-kamal-secrets.ts","write-ssh-key.ts"],a9={"create-predeploy-backup.ts":"brains-predeploy-backup-v1","install-health-watchdog.ts":"/usr/local/sbin/brains-health-watchdog","provision-server.ts":'requireEnv("HCLOUD_TOKEN")',"pull-local-models.ts":"export async function pullLocalModels","reload-homeserver.ts":"export async function reloadHomeserver","update-dns.ts":'requireEnv("CF_API_TOKEN")',"validate-secrets.ts":"const requiredKeys = schema","write-kamal-secrets.ts":".kamal/secrets","write-ssh-key.ts":'requireEnv("KAMAL_SSH_PRIVATE_KEY")'};c9=["/opt/brain-runtime:/app/data","/opt/brain-state:/data","/opt/brain-config:/config","/opt/brain-dist:/app/dist"]});function B(e,t,r){function o(a,l){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);let u=s.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){let m=d[p];if(!(m in a))a[m]=u[m].bind(a)}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var l;let u=r?.Parent?new i:this;o(u,a),(l=u._zod).deferred??(l.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}function gt(e){if(e)Object.assign(Ds,e);return Ds}var sz,qv,Fv,qn,Ls,Ds;var Zs=S(()=>{qv=Object.freeze({status:"aborted"});Fv=Symbol("zod_brand");qn=class qn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};Ls=class Ls extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(sz=globalThis).__zod_globalConfig??(sz.__zod_globalConfig={});Ds=globalThis.__zod_globalConfig});var ue={};Lt(ue,{BIGINT_FORMAT_RANGES:()=>Xv,Class:()=>uz,NUMBER_FORMAT_RANGES:()=>Yv,aborted:()=>Ii,allowsEval:()=>Vv,assert:()=>h9,assertEqual:()=>d9,assertIs:()=>f9,assertNever:()=>m9,assertNotEqual:()=>p9,assignProp:()=>_i,base64ToUint8Array:()=>cz,base64urlToUint8Array:()=>C9,cached:()=>Xa,captureStackTrace:()=>ym,cleanEnum:()=>O9,cleanRegex:()=>Lu,clone:()=>pr,cloneDef:()=>y9,createTransparentProxy:()=>_9,defineLazy:()=>Be,esc:()=>gm,escapeRegex:()=>Yr,explicitlyAborted:()=>ew,extend:()=>A9,finalizeIssue:()=>fr,floatSafeRemainder:()=>Jv,getElementAtPath:()=>b9,getEnumValues:()=>Du,getLengthableOrigin:()=>Bu,getParsedType:()=>x9,getSizableOrigin:()=>ju,hexToUint8Array:()=>z9,isObject:()=>js,isPlainObject:()=>Ei,issue:()=>ec,joinValues:()=>Q,jsonStringifyReplacer:()=>Ya,merge:()=>R9,mergeDefs:()=>Ao,normalizeParams:()=>pe,nullish:()=>xi,numKeys:()=>w9,objectClone:()=>g9,omit:()=>I9,optionalKeys:()=>Qv,parsedType:()=>le,partial:()=>T9,pick:()=>E9,prefixIssues:()=>_r,primitiveTypes:()=>Gv,promiseAllObject:()=>S9,propertyKeyTypes:()=>Zu,randomString:()=>v9,required:()=>$9,safeExtend:()=>k9,shallowClone:()=>Wv,slugify:()=>Kv,stringifyPrimitive:()=>ce,uint8ArrayToBase64:()=>lz,uint8ArrayToBase64url:()=>P9,uint8ArrayToHex:()=>N9,unwrapMessage:()=>Nu});function d9(e){return e}function p9(e){return e}function f9(e){}function m9(e){throw Error("Unexpected value in exhaustive check")}function h9(e){}function Du(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Q(e,t="|"){return e.map((r)=>ce(r)).join(t)}function Ya(e,t){if(typeof t==="bigint")return t.toString();return t}function Xa(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function xi(e){return e===null||e===void 0}function Lu(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Jv(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}function Be(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===az)return;if(o===void 0)o=az,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function g9(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function _i(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ao(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function y9(e){return Ao(e._zod.def)}function b9(e,t){if(!t)return e;return t.reduce((r,o)=>r?.[o],e)}function S9(e){let t=Object.keys(e),r=t.map((o)=>e[o]);return Promise.all(r).then((o)=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function v9(e=10){let r="";for(let o=0;o<e;o++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function gm(e){return JSON.stringify(e)}function Kv(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function js(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ei(e){if(js(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(js(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Wv(e){if(Ei(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function w9(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}function Yr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pr(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function pe(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 Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function _9(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function ce(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Qv(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function E9(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=Ao(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;s[a]=r.shape[a]}return _i(this,"shape",s),s},checks:[]});return pr(e,i)}function I9(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=Ao(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete s[a]}return _i(this,"shape",s),s},checks:[]});return pr(e,i)}function A9(e,t){if(!Ei(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Ao(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return _i(this,"shape",i),i}});return pr(e,n)}function k9(e,t){if(!Ei(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=Ao(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return _i(this,"shape",o),o}});return pr(e,r)}function R9(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Ao(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return _i(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return pr(e,r)}function T9(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let s=Ao(t._zod.def,{get shape(){let a=t._zod.def.shape,l={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;l[u]=e?new e({type:"optional",innerType:a[u]}):a[u]}else for(let u in a)l[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return _i(this,"shape",l),l},checks:[]});return pr(t,s)}function $9(e,t,r){let o=Ao(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;i[s]=new e({type:"nonoptional",innerType:n[s]})}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return _i(this,"shape",i),i}});return pr(t,o)}function Ii(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 ew(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 _r(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Nu(e){return typeof e==="string"?e:e?.message}function fr(e,t,r){let o=e.message?e.message:Nu(e.inst?._zod.def?.error?.(e))??Nu(t?.error?.(e))??Nu(r.customError?.(e))??Nu(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:s,...a}=e;if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=s;return a}function ju(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Bu(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function le(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 ec(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function O9(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function cz(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function lz(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function C9(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return cz(t+r)}function P9(e){return lz(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function z9(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function N9(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class uz{constructor(...e){}}var az,ym,Vv,x9=(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":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},Zu,Gv,Yv,Xv;var Ie=S(()=>{Zs();az=Symbol("evaluating");ym="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};Vv=Xa(()=>{if(Ds.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});Zu=new Set(["string","number","symbol"]),Gv=new Set(["string","number","bigint","boolean","symbol","undefined"]);Yv={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Xv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function Mu(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function qu(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let l=r,u=0;while(u<a.length){let d=a[u];if(u!==a.length-1)l[d]=l[d]||{_errors:[]};else l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(s));l=l[d],u++}}}};return o(e),r}function tw(e,t=(r)=>r.message){let r={errors:[]},o=(n,i=[])=>{var s,a;for(let l of n.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map((u)=>o({issues:u},[...i,...l.path]));else if(l.code==="invalid_key")o({issues:l.issues},[...i,...l.path]);else if(l.code==="invalid_element")o({issues:l.issues},[...i,...l.path]);else{let u=[...i,...l.path];if(u.length===0){r.errors.push(t(l));continue}let d=r,p=0;while(p<u.length){let m=u[p],h=p===u.length-1;if(typeof m==="string")d.properties??(d.properties={}),(s=d.properties)[m]??(s[m]={errors:[]}),d=d.properties[m];else d.items??(d.items=[]),(a=d.items)[m]??(a[m]={errors:[]}),d=d.items[m];if(h)d.errors.push(t(l));p++}}};return o(e),r}function pz(e){let t=[],r=e.map((o)=>typeof o==="object"?o.key:o);for(let o of r)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function rw(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)if(t.push(`\u2716 ${o.message}`),o.path?.length)t.push(` \u2192 at ${pz(o.path)}`);return t.join(`
|
|
188
188
|
`)}var dz=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ya,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Uu,Er;var nw=S(()=>{Zs();Ie();Uu=B("$ZodError",dz),Er=B("$ZodError",dz,{Parent:Error})});var tc=(e)=>(t,r,o,n)=>{let i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new qn;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((l)=>fr(l,i,gt())));throw ym(a,n?.callee),a}return s.value},bm,rc=(e)=>async(t,r,o,n)=>{let i=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((l)=>fr(l,i,gt())));throw ym(a,n?.callee),a}return s.value},Sm,nc=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new qn;return i.issues.length?{success:!1,error:new(e??Uu)(i.issues.map((s)=>fr(s,n,gt())))}:{success:!0,data:i.value}},ow,oc=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>fr(s,n,gt())))}:{success:!0,data:i.value}},iw,vm=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return tc(e)(t,r,n)},L9,wm=(e)=>(t,r,o)=>tc(e)(t,r,o),Z9,xm=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return rc(e)(t,r,n)},j9,_m=(e)=>async(t,r,o)=>rc(e)(t,r,o),B9,Em=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return nc(e)(t,r,n)},U9,Im=(e)=>(t,r,o)=>nc(e)(t,r,o),M9,Am=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return oc(e)(t,r,n)},q9,km=(e)=>async(t,r,o)=>oc(e)(t,r,o),F9;var sw=S(()=>{Zs();nw();Ie();bm=tc(Er),Sm=rc(Er),ow=nc(Er),iw=oc(Er),L9=vm(Er),Z9=wm(Er),j9=xm(Er),B9=_m(Er),U9=Em(Er),M9=Im(Er),q9=Am(Er),F9=km(Er)});var Zr={};Lt(Zr,{base64:()=>xw,base64url:()=>Rm,bigint:()=>Tw,boolean:()=>Ow,browserEmail:()=>Y9,cidrv4:()=>vw,cidrv6:()=>ww,cuid:()=>aw,cuid2:()=>cw,date:()=>Iw,datetime:()=>kw,domain:()=>t7,duration:()=>fw,e164:()=>Ew,email:()=>hw,emoji:()=>gw,extendedDuration:()=>H9,guid:()=>mw,hex:()=>r7,hostname:()=>e7,html5Email:()=>W9,httpProtocol:()=>_w,idnEmail:()=>Q9,integer:()=>$w,ipv4:()=>yw,ipv6:()=>bw,ksuid:()=>dw,lowercase:()=>zw,mac:()=>Sw,md5_base64:()=>o7,md5_base64url:()=>i7,md5_hex:()=>n7,nanoid:()=>pw,null:()=>Cw,number:()=>Fu,rfc5322Email:()=>G9,sha1_base64:()=>a7,sha1_base64url:()=>c7,sha1_hex:()=>s7,sha256_base64:()=>u7,sha256_base64url:()=>d7,sha256_hex:()=>l7,sha384_base64:()=>f7,sha384_base64url:()=>m7,sha384_hex:()=>p7,sha512_base64:()=>g7,sha512_base64url:()=>y7,sha512_hex:()=>h7,string:()=>Rw,time:()=>Aw,ulid:()=>lw,undefined:()=>Pw,unicodeEmail:()=>fz,uppercase:()=>Nw,uuid:()=>Bs,uuid4:()=>J9,uuid6:()=>K9,uuid7:()=>V9,xid:()=>uw});function gw(){return new RegExp(X9,"u")}function hz(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Aw(e){return new RegExp(`^${hz(e)}$`)}function kw(e){let t=hz({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${mz}T(?:${o})$`)}function Hu(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Ju(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var aw,cw,lw,uw,dw,pw,fw,H9,mw,Bs=(e)=>{if(!e)return/^([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)$/;return 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})$`)},J9,K9,V9,hw,W9,G9,fz,Q9,Y9,X9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",yw,bw,Sw=(e)=>{let t=Yr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},vw,ww,xw,Rm,e7,t7,_w,Ew,mz="(?:(?:\\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])))",Iw,Rw=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Tw,$w,Fu,Ow,Cw,Pw,zw,Nw,r7,n7,o7,i7,s7,a7,c7,l7,u7,d7,p7,f7,m7,h7,g7,y7;var Tm=S(()=>{Ie();aw=/^[cC][0-9a-z]{6,}$/,cw=/^[0-9a-z]+$/,lw=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uw=/^[0-9a-vA-V]{20}$/,dw=/^[A-Za-z0-9]{27}$/,pw=/^[a-zA-Z0-9_-]{21}$/,fw=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,H9=/^[-+]?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)?)??$/,mw=/^([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})$/,J9=Bs(4),K9=Bs(6),V9=Bs(7),hw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,W9=/^[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])?)*$/,G9=/^(([^<>()\[\]\\.,;:\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,}))$/,fz=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Q9=fz,Y9=/^[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])?)*$/;yw=/^(?:(?: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])$/,bw=/^(([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}|:))$/,vw=/^((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])$/,ww=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rm=/^[A-Za-z0-9_-]*$/,e7=/^(?=.{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])?)*\.?$/,t7=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,_w=/^https?$/,Ew=/^\+[1-9]\d{6,14}$/,Iw=new RegExp(`^${mz}$`);Tw=/^-?\d+n?$/,$w=/^-?\d+$/,Fu=/^-?\d+(?:\.\d+)?$/,Ow=/^(?:true|false)$/i,Cw=/^null$/i,Pw=/^undefined$/i,zw=/^[^A-Z]*$/,Nw=/^[^a-z]*$/,r7=/^[0-9a-fA-F]*$/;n7=/^[0-9a-fA-F]{32}$/,o7=Hu(22,"=="),i7=Ju(22),s7=/^[0-9a-fA-F]{40}$/,a7=Hu(27,"="),c7=Ju(27),l7=/^[0-9a-fA-F]{64}$/,u7=Hu(43,"="),d7=Ju(43),p7=/^[0-9a-fA-F]{96}$/,f7=Hu(64,""),m7=Ju(64),h7=/^[0-9a-fA-F]{128}$/,g7=Hu(86,"=="),y7=Ju(86)});function gz(e,t,r){if(e.issues.length)t.issues.push(..._r(r,e.issues))}var rt,yz,$m,Om,Dw,Lw,Zw,jw,Bw,Uw,Mw,qw,Fw,ic,Hw,Jw,Kw,Vw,Ww,Gw,Qw,Yw,Xw;var Cm=S(()=>{Zs();Tm();Ie();rt=B("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),yz={number:"number",bigint:"bigint",object:"date"},$m=B("$ZodCheckLessThan",(e,t)=>{rt.init(e,t);let r=yz[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Om=B("$ZodCheckGreaterThan",(e,t)=>{rt.init(e,t);let r=yz[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dw=B("$ZodCheckMultipleOf",(e,t)=>{rt.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Jv(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Lw=B("$ZodCheckNumberFormat",(e,t)=>{rt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=Yv[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=i,r)a.pattern=$w}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(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:o,inclusive:!0,continue:!t.abort});else 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:o,inclusive:!0,continue:!t.abort});return}}if(a<n)s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Zw=B("$ZodCheckBigIntFormat",(e,t)=>{rt.init(e,t);let[r,o]=Xv[t.format];e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=(n)=>{let i=n.value;if(i<r)n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(i>o)n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),jw=B("$ZodCheckMaxSize",(e,t)=>{var r;rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!xi(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.size<=t.maximum)return;o.issues.push({origin:ju(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Bw=B("$ZodCheckMinSize",(e,t)=>{var r;rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!xi(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.size>=t.minimum)return;o.issues.push({origin:ju(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Uw=B("$ZodCheckSizeEquals",(e,t)=>{var r;rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!xi(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=(o)=>{let n=o.value,i=n.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:ju(n),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Mw=B("$ZodCheckMaxLength",(e,t)=>{var r;rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!xi(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let s=Bu(n);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),qw=B("$ZodCheckMinLength",(e,t)=>{var r;rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!xi(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let s=Bu(n);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Fw=B("$ZodCheckLengthEquals",(e,t)=>{var r;rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!xi(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,i=n.length;if(i===t.length)return;let s=Bu(n),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),ic=B("$ZodCheckStringFormat",(e,t)=>{var r,o;if(rt.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;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})});else(o=e._zod).check??(o.check=()=>{})}),Hw=B("$ZodCheckRegex",(e,t)=>{ic.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Jw=B("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zw),ic.init(e,t)}),Kw=B("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Nw),ic.init(e,t)}),Vw=B("$ZodCheckIncludes",(e,t)=>{rt.init(e,t);let r=Yr(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ww=B("$ZodCheckStartsWith",(e,t)=>{rt.init(e,t);let r=new RegExp(`^${Yr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Gw=B("$ZodCheckEndsWith",(e,t)=>{rt.init(e,t);let r=new RegExp(`.*${Yr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});Qw=B("$ZodCheckProperty",(e,t)=>{rt.init(e,t),e._zod.check=(r)=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((n)=>gz(n,r,t.property));gz(o,r,t.property);return}}),Yw=B("$ZodCheckMimeType",(e,t)=>{rt.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(r.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),Xw=B("$ZodCheckOverwrite",(e,t)=>{rt.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}})});class Pm{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
189
189
|
`).filter((i)=>i),o=Math.min(...r.map((i)=>i.length-i.trimStart().length)),n=r.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
|
|
190
190
|
`))}}var ex;var tx=S(()=>{ex={major:4,minor:4,patch:3}});function _x(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function Pz(e){if(!Rm.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return _x(r)}function zz(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}function Sz(e,t,r){if(e.issues.length)t.issues.push(..._r(r,e.issues));t.value[r]=e.value}function Lm(e,t,r,o,n,i){let s=r in o;if(e.issues.length){if(n&&i&&!s)return;t.issues.push(..._r(r,e.issues))}if(!s&&!n){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s)t.value[r]=void 0}else t.value[r]=e.value}function Nz(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Qv(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Dz(e,t,r,o,n,i){let s=[],a=n.keySet,l=n.catchall._zod,u=l.def.type,d=l.optin==="optional",p=l.optout==="optional";for(let m in t){if(m==="__proto__")continue;if(a.has(m))continue;if(u==="never"){s.push(m);continue}let h=l.run({value:t[m],issues:[]},o);if(h instanceof Promise)e.push(h.then((b)=>Lm(b,r,m,t,d,p)));else Lm(h,r,m,t,d,p)}if(s.length)r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i});if(!e.length)return r;return Promise.all(e).then(()=>r)}function vz(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!Ii(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>fr(s,o,gt())))}),t}function wz(e,t,r,o){let n=e.filter((i)=>i.issues.length===0);if(n.length===1)return t.value=n[0].value,t;if(n.length===0)t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>fr(s,o,gt())))});else t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1});return t}function rx(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(Ei(e)&&Ei(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let s=rx(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=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 o=0;o<e.length;o++){let n=e[o],i=t[o],s=rx(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function xz(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let l of a.keys){if(!o.has(l))o.set(l,{});o.get(l).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let l of a.keys){if(!o.has(l))o.set(l,{});o.get(l).r=!0}else e.issues.push(a);let i=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&n)e.issues.push({...n,keys:i});if(Ii(e))return e;let s=rx(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}function _z(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function Ez(e,t,r){if(e.issues.length)t.issues.push(..._r(r,e.issues));t.value[r]=e.value}function Iz(e,t,r,o,n){for(let i=0;i<r.length;i++){let s=e[i],a=i<o.length;if(s.issues.length){if(!a&&i>=n){t.value.length=i;break}t.issues.push(..._r(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=o.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}function Az(e,t,r,o,n,i,s){if(e.issues.length)if(Zu.has(typeof o))r.issues.push(..._r(o,e.issues));else r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map((a)=>fr(a,s,gt()))});if(t.issues.length)if(Zu.has(typeof o))r.issues.push(..._r(o,t.issues));else r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map((a)=>fr(a,s,gt()))});r.value.set(e.value,t.value)}function kz(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}function Rz(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}function Tz(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}function $z(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function zm(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}function Nm(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);if(n instanceof Promise)return n.then((i)=>Dm(e,i,t.out,r));return Dm(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);if(n instanceof Promise)return n.then((i)=>Dm(e,i,t.in,r));return Dm(e,n,t.in,r)}}function Dm(e,t,r,o){if(e.issues.length)return e.aborted=!0,e;return r._zod.run({value:t,issues:e.issues},o)}function Oz(e){return e.value=Object.freeze(e.value),e}function Cz(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(ec(n))}}var Ne,Us,Xe,nx,ox,ix,sx,ax,cx,lx,ux,dx,px,fx,mx,hx,gx,yx,bx,Sx,vx,wx,xx,Ex,Ix,Ax,kx,Rx,Zm,Tx,Ku,jm,$x,Ox,Cx,Px,zx,Nx,Dx,Lx,Zx,jx,Lz,Bx,Vu,Ux,Mx,qx,Bm,Fx,Hx,Jx,Kx,Vx,Wx,Gx,Um,Qx,Yx,Xx,e0,t0,r0,n0,o0,Mm,Wu,i0,s0,a0,c0,l0,u0,d0;var p0=S(()=>{Cm();Zs();sw();Tm();Ie();tx();Ie();Ne=B("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ex;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,a,l)=>{let u=Ii(s),d;for(let p of a){if(p._zod.def.when){if(ew(s))continue;if(!p._zod.def.when(s))continue}else if(u)continue;let m=s.issues.length,h=p._zod.check(s);if(h instanceof Promise&&l?.async===!1)throw new qn;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await h,s.issues.length===m)return;if(!u)u=Ii(s,m)});else{if(s.issues.length===m)continue;if(!u)u=Ii(s,m)}}if(d)return d.then(()=>s);return s},i=(s,a,l)=>{if(Ii(s))return s.aborted=!0,s;let u=n(a,o,l);if(u instanceof Promise){if(l.async===!1)throw new qn;return u.then((d)=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((d)=>i(d,s,a));return i(u,s,a)}let l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new qn;return l.then((u)=>n(u,o,a))}return n(l,o,a)}}Be(e,"~standard",()=>({validate:(n)=>{try{let i=ow(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return iw(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Us=B("$ZodString",(e,t)=>{Ne.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Rw(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Xe=B("$ZodStringFormat",(e,t)=>{ic.init(e,t),Us.init(e,t)}),nx=B("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=mw),Xe.init(e,t)}),ox=B("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Bs(o))}else t.pattern??(t.pattern=Bs());Xe.init(e,t)}),ix=B("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=hw),Xe.init(e,t)}),sx=B("$ZodURL",(e,t)=>{Xe.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===_w.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let n=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=n.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ax=B("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=gw()),Xe.init(e,t)}),cx=B("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=pw),Xe.init(e,t)}),lx=B("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=aw),Xe.init(e,t)}),ux=B("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=cw),Xe.init(e,t)}),dx=B("$ZodULID",(e,t)=>{t.pattern??(t.pattern=lw),Xe.init(e,t)}),px=B("$ZodXID",(e,t)=>{t.pattern??(t.pattern=uw),Xe.init(e,t)}),fx=B("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=dw),Xe.init(e,t)}),mx=B("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=kw(t)),Xe.init(e,t)}),hx=B("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Iw),Xe.init(e,t)}),gx=B("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Aw(t)),Xe.init(e,t)}),yx=B("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=fw),Xe.init(e,t)}),bx=B("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=yw),Xe.init(e,t),e._zod.bag.format="ipv4"}),Sx=B("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bw),Xe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),vx=B("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Sw(t.delimiter)),Xe.init(e,t),e._zod.bag.format="mac"}),wx=B("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=vw),Xe.init(e,t)}),xx=B("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ww),Xe.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[n,i]=o;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});Ex=B("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=xw),Xe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(_x(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});Ix=B("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Rm),Xe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(Pz(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ax=B("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ew),Xe.init(e,t)});kx=B("$ZodJWT",(e,t)=>{Xe.init(e,t),e._zod.check=(r)=>{if(zz(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Rx=B("$ZodCustomStringFormat",(e,t)=>{Xe.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Zm=B("$ZodNumber",(e,t)=>{Ne.init(e,t),e._zod.pattern=e._zod.bag.pattern??Fu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),Tx=B("$ZodNumberFormat",(e,t)=>{Lw.init(e,t),Zm.init(e,t)}),Ku=B("$ZodBoolean",(e,t)=>{Ne.init(e,t),e._zod.pattern=Ow,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),jm=B("$ZodBigInt",(e,t)=>{Ne.init(e,t),e._zod.pattern=Tw,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(n){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),$x=B("$ZodBigIntFormat",(e,t)=>{Zw.init(e,t),jm.init(e,t)}),Ox=B("$ZodSymbol",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Cx=B("$ZodUndefined",(e,t)=>{Ne.init(e,t),e._zod.pattern=Pw,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Px=B("$ZodNull",(e,t)=>{Ne.init(e,t),e._zod.pattern=Cw,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),zx=B("$ZodAny",(e,t)=>{Ne.init(e,t),e._zod.parse=(r)=>r}),Nx=B("$ZodUnknown",(e,t)=>{Ne.init(e,t),e._zod.parse=(r)=>r}),Dx=B("$ZodNever",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Lx=B("$ZodVoid",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Zx=B("$ZodDate",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(a){}let n=r.value,i=n instanceof Date;if(i&&!Number.isNaN(n.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});jx=B("$ZodArray",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let a=n[s],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)i.push(l.then((u)=>Sz(u,r,s)));else Sz(l,r,s)}if(i.length)return Promise.all(i).then(()=>r);return r}});Lz=B("$ZodObject",(e,t)=>{if(Ne.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}let o=Xa(()=>Nz(t));Be(e._zod,"propValues",()=>{let a=t.shape,l={};for(let u in a){let d=a[u]._zod;if(d.values){l[u]??(l[u]=new Set);for(let p of d.values)l[u].add(p)}}return l});let n=js,i=t.catchall,s;e._zod.parse=(a,l)=>{s??(s=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let d=[],p=s.shape;for(let m of s.keys){let h=p[m],b=h._zod.optin==="optional",y=h._zod.optout==="optional",v=h._zod.run({value:u[m],issues:[]},l);if(v instanceof Promise)d.push(v.then((x)=>Lm(x,a,m,u,b,y)));else Lm(v,a,m,u,b,y)}if(!i)return d.length?Promise.all(d).then(()=>a):a;return Dz(d,u,a,l,o.value,e)}}),Bx=B("$ZodObjectJIT",(e,t)=>{Lz.init(e,t);let r=e._zod.parse,o=Xa(()=>Nz(t)),n=(m)=>{let h=new Pm(["shape","payload","ctx"]),b=o.value,y=(k)=>{let O=gm(k);return`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`};h.write("const input = payload.value;");let v=Object.create(null),x=0;for(let k of b.keys)v[k]=`key_${x++}`;h.write("const newResult = {};");for(let k of b.keys){let O=v[k],L=gm(k),z=m[k],J=z?._zod?.optin==="optional",P=z?._zod?.optout==="optional";if(h.write(`const ${O} = ${y(k)};`),J&&P)h.write(`
|
|
@@ -246,9 +246,9 @@ volumes:
|
|
|
246
246
|
newResult[${L}] = ${O}.value;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
`)}h.write("payload.value = newResult;"),h.write("return payload;");let _=h.compile();return(k,O)=>_(m,k,O)},i,s=js,a=!Ds.jitless,u=a&&Vv.value,d=t.catchall,p;e._zod.parse=(m,h)=>{p??(p=o.value);let b=m.value;if(!s(b))return m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m;if(a&&u&&h?.async===!1&&h.jitless!==!0){if(!i)i=n(t.shape);if(m=i(m,h),!d)return m;return Dz([],b,m,h,p,e)}return r(m,h)}});Vu=B("$ZodUnion",(e,t)=>{Ne.init(e,t),Be(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),Be(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),Be(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),Be(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${o.map((n)=>Lu(n.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}if(!i)return vz(s,o,e,n);return Promise.all(s).then((a)=>vz(a,o,e,n))}});Ux=B("$ZodXor",(e,t)=>{Vu.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)s.push(l),i=!0;else s.push(l)}if(!i)return wz(s,o,e,n);return Promise.all(s).then((a)=>wz(a,o,e,n))}}),Mx=B("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Vu.init(e,t);let r=e._zod.parse;Be(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,l]of Object.entries(s)){if(!n[a])n[a]=new Set;for(let u of l)n[a].add(u)}}return n});let o=Xa(()=>{let n=t.options,i=new Map;for(let s of n){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of a){if(i.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!js(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:s,path:[t.discriminator],inst:e}),n}}),qx=B("$ZodIntersection",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([l,u])=>xz(r,l,u));return xz(r,i,s)}});Bm=B("$ZodTuple",(e,t)=>{Ne.init(e,t);let r=t.items;e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[],a=_z(r,"optin"),l=_z(r,"optout");if(!t.rest){if(i.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:i,inst:e,origin:"array"}),o;if(i.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:e,origin:"array"})}let u=Array(r.length);for(let d=0;d<r.length;d++){let p=r[d]._zod.run({value:i[d],issues:[]},n);if(p instanceof Promise)s.push(p.then((m)=>{u[d]=m}));else u[d]=p}if(t.rest){let d=r.length-1,p=i.slice(r.length);for(let m of p){d++;let h=t.rest._zod.run({value:m,issues:[]},n);if(h instanceof Promise)s.push(h.then((b)=>Ez(b,o,d)));else Ez(h,o,d)}}if(s.length)return Promise.all(s).then(()=>Iz(u,o,r,i,l));return Iz(u,o,r,i,l)}});Fx=B("$ZodRecord",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Ei(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){a.add(typeof u==="number"?u.toString():u);let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((h)=>fr(h,o,gt())),input:u,path:[u],inst:e});continue}let p=d.value,m=t.valueType._zod.run({value:n[u],issues:[]},o);if(m instanceof Promise)i.push(m.then((h)=>{if(h.issues.length)r.issues.push(..._r(u,h.issues));r.value[p]=h.value}));else{if(m.issues.length)r.issues.push(..._r(u,m.issues));r.value[p]=m.value}}let l;for(let u in n)if(!a.has(u))l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Fu.test(a)&&l.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)l=p}if(l.issues.length){if(t.mode==="loose")r.value[a]=n[a];else r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((p)=>fr(p,o,gt())),input:a,path:[a],inst:e});continue}let d=t.valueType._zod.run({value:n[a],issues:[]},o);if(d instanceof Promise)i.push(d.then((p)=>{if(p.issues.length)r.issues.push(..._r(a,p.issues));r.value[l.value]=p.value}));else{if(d.issues.length)r.issues.push(..._r(a,d.issues));r.value[l.value]=d.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}}),Hx=B("$ZodMap",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,a]of n){let l=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);if(l instanceof Promise||u instanceof Promise)i.push(Promise.all([l,u]).then(([d,p])=>{Az(d,p,r,s,n,e,o)}));else Az(l,u,r,s,n,e,o)}if(i.length)return Promise.all(i).then(()=>r);return r}});Jx=B("$ZodSet",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((l)=>kz(l,r)));else kz(a,r)}if(i.length)return Promise.all(i).then(()=>r);return r}});Kx=B("$ZodEnum",(e,t)=>{Ne.init(e,t);let r=Du(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>Zu.has(typeof n)).map((n)=>typeof n==="string"?Yr(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),Vx=B("$ZodLiteral",(e,t)=>{if(Ne.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?Yr(o):o?Yr(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),Wx=B("$ZodFile",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(n instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Gx=B("$ZodTransform",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ls(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r.fallback=!0,r));if(n instanceof Promise)throw new qn;return r.value=n,r.fallback=!0,r}});Um=B("$ZodOptional",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Be(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Lu(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,i=t.innerType._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Rz(s,n));return Rz(i,n)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Qx=B("$ZodExactOptional",(e,t)=>{Um.init(e,t),Be(e._zod,"values",()=>t.innerType._zod.values),Be(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Yx=B("$ZodNullable",(e,t)=>{Ne.init(e,t),Be(e._zod,"optin",()=>t.innerType._zod.optin),Be(e._zod,"optout",()=>t.innerType._zod.optout),Be(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Lu(r.source)}|null)$`):void 0}),Be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Xx=B("$ZodDefault",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",Be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Tz(i,t));return Tz(n,t)}});e0=B("$ZodPrefault",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",Be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),t0=B("$ZodNonOptional",(e,t)=>{Ne.init(e,t),Be(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>$z(i,e));return $z(n,e)}});r0=B("$ZodSuccess",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ls("ZodSuccess");let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>(r.value=i.issues.length===0,r));return r.value=n.issues.length===0,r}}),n0=B("$ZodCatch",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",Be(e._zod,"optout",()=>t.innerType._zod.optout),Be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>fr(s,o,gt()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>fr(i,o,gt()))},input:r.value}),r.issues=[],r.fallback=!0;return r}}),o0=B("$ZodNaN",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),Mm=B("$ZodPipe",(e,t)=>{Ne.init(e,t),Be(e._zod,"values",()=>t.in._zod.values),Be(e._zod,"optin",()=>t.in._zod.optin),Be(e._zod,"optout",()=>t.out._zod.optout),Be(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>zm(s,t.in,o));return zm(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>zm(i,t.out,o));return zm(n,t.out,o)}});Wu=B("$ZodCodec",(e,t)=>{Ne.init(e,t),Be(e._zod,"values",()=>t.in._zod.values),Be(e._zod,"optin",()=>t.in._zod.optin),Be(e._zod,"optout",()=>t.out._zod.optout),Be(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Nm(s,t,o));return Nm(i,t,o)}else{let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Nm(s,t,o));return Nm(i,t,o)}}});i0=B("$ZodPreprocess",(e,t)=>{Mm.init(e,t)}),s0=B("$ZodReadonly",(e,t)=>{Ne.init(e,t),Be(e._zod,"propValues",()=>t.innerType._zod.propValues),Be(e._zod,"values",()=>t.innerType._zod.values),Be(e._zod,"optin",()=>t.innerType?._zod?.optin),Be(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Oz);return Oz(n)}});a0=B("$ZodTemplateLiteral",(e,t)=>{Ne.init(e,t);let r=[];for(let o of t.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||Gv.has(typeof o))r.push(Yr(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o;return o}}),c0=B("$ZodFunction",(e,t)=>(Ne.init(e,t),e._def=t,e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return function(...o){let n=e._def.input?bm(e._def.input,o):o,i=Reflect.apply(r,this,n);if(e._def.output)return bm(e._def.output,i);return i}},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let n=e._def.input?await Sm(e._def.input,o):o,i=await Reflect.apply(r,this,n);if(e._def.output)return await Sm(e._def.output,i);return i}},e._zod.parse=(r,o)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let o=e.constructor;if(Array.isArray(r[0]))return new o({type:"function",input:new Bm({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new o({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),l0=B("$ZodPromise",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then((n)=>t.innerType._zod.run({value:n,issues:[]},o))}),u0=B("$ZodLazy",(e,t)=>{Ne.init(e,t),Be(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),Be(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Be(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Be(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Be(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),d0=B("$ZodCustom",(e,t)=>{rt.init(e,t),Ne.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>Cz(i,r,o,e));Cz(n,r,o,e);return}})});function f0(){return{localeError:S7()}}var S7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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: ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return` \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"} ${i} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`;return`\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"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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 ${i} ${n.minimum.toString()} ${s.unit}`;return`\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 ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`;if(i.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`;if(i.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`${r[i.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":""}: ${Q(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"}}};var Zz=S(()=>{Ie()});function m0(){return{localeError:v7()}}var v7=()=>{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"}};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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${a}`;return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${a}`}case"invalid_value":if(n.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${ce(n.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(i.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`;if(i.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`;if(i.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${r[i.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":""}: ${Q(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"}}};var jz=S(()=>{Ie()});function Bz(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}function h0(){return{localeError:w7()}}var w7=()=>{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"},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",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",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},o={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${i}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":if(n.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=Bz(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} ${i}${n.maximum.toString()} ${l}`}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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=Bz(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} ${i}${n.minimum.toString()} ${l}`}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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[i.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"}: ${Q(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"}}};var Uz=S(()=>{Ie()});function g0(){return{localeError:x7()}}var x7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":if(n.values.length===1)return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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 ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.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 "${i.prefix}"`;if(i.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 "${i.suffix}"`;if(i.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 "${i.includes}"`;if(i.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 ${i.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";if(i.format==="emoji")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(i.format==="datetime")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(i.format==="date")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";if(i.format==="time")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(i.format==="duration")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";return`${s} ${r[i.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":""}: ${Q(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"}}};var Mz=S(()=>{Ie()});function y0(){return{localeError:_7()}}var _7=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{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",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",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${a}`;return`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${a}`}case"invalid_value":if(n.values.length===1)return`Valor inv\xE0lid: s'esperava ${ce(n.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${Q(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a m\xE0xim":"menys de",s=t(n.origin);if(s)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${i} ${n.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=t(n.origin);if(s)return`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${i} ${n.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format inv\xE0lid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`;return`Format inv\xE0lid per a ${r[i.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":""}: ${Q(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"}}};var qz=S(()=>{Ie()});function b0(){return{localeError:E7()}}var E7=()=>{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"}};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",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",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${a}`;return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${a}`}case"invalid_value":if(n.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${ce(n.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`;if(i.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`;return`Neplatn\xFD form\xE1t ${r[i.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: ${Q(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"}}};var Fz=S(()=>{Ie()});function S0(){return{localeError:I7()}}var I7=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{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-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ugyldigt input: forventede instanceof ${n.expected}, fik ${a}`;return`Ugyldigt input: forventede ${i}, fik ${a}`}case"invalid_value":if(n.values.length===1)return`Ugyldig v\xE6rdi: forventede ${ce(n.values[0])}`;return`Ugyldigt valg: forventede en af f\xF8lgende ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`For stor: forventede ${a??"value"} ${s.verb} ${i} ${n.maximum.toString()} ${s.unit??"elementer"}`;return`For stor: forventede ${a??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`For lille: forventede ${a} ${s.verb} ${i} ${n.minimum.toString()} ${s.unit}`;return`For lille: forventede ${a} havde ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: skal starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: skal ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: skal indeholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: skal matche m\xF8nsteret ${i.pattern}`;return`Ugyldig ${r[i.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"}: ${Q(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"}}};var Hz=S(()=>{Ie()});function v0(){return{localeError:A7()}}var A7=()=>{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"}};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",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${a}`;return`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${a}`}case"invalid_value":if(n.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${ce(n.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ung\xFCltiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ung\xFCltiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ung\xFCltig: ${r[i.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"}: ${Q(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"}}};var Jz=S(()=>{Ie()});function w0(){return{localeError:k7()}}var k7=()=>{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",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(typeof n.expected==="string"&&/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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 ${i}${n.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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 ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[i.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"}: ${Q(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"}}};var Kz=S(()=>{Ie()});function Gu(){return{localeError:R7()}}var R7=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${ce(n.values[0])}`;return`Invalid option: expected one of ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`;return`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Q(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0)return`Invalid discriminator value. Expected ${n.options.map((s)=>`'${s}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};var x0=S(()=>{Ie()});function _0(){return{localeError:T7()}}var T7=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{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",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",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${a}`;return`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${a}`}case"invalid_value":if(n.values.length===1)return`Nevalida enigo: atendi\u011Dis ${ce(n.values[0])}`;return`Nevalida opcio: atendi\u011Dis unu el ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${s.unit??"elementojn"}`;return`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${i}${n.minimum.toString()} ${s.unit}`;return`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nevalida karaktraro: devas komenci\u011Di per "${i.prefix}"`;if(i.format==="ends_with")return`Nevalida karaktraro: devas fini\u011Di per "${i.suffix}"`;if(i.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${i.includes}"`;if(i.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`;return`Nevalida ${r[i.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":""}: ${Q(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"}}};var Vz=S(()=>{Ie()});function E0(){return{localeError:$7()}}var $7=()=>{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",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",jwt:"JWT",template_literal:"entrada"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${a}`;return`Entrada inv\xE1lida: se esperaba ${i}, recibido ${a}`}case"invalid_value":if(n.values.length===1)return`Entrada inv\xE1lida: se esperaba ${ce(n.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${a??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${i}${n.minimum.toString()} ${s.unit}`;return`Demasiado peque\xF1o: se esperaba que ${a} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`;if(i.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`;if(i.format==="includes")return`Cadena inv\xE1lida: debe incluir "${i.includes}"`;if(i.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`;return`Inv\xE1lido ${r[i.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":""}: ${Q(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}};var Wz=S(()=>{Ie()});function I0(){return{localeError:O7()}}var O7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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`;return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":if(n.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${ce(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\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 ${Q(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(i.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(i.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`;if(i.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${r[i.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: ${Q(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"}}};var Gz=S(()=>{Ie()});function A0(){return{localeError:C7()}}var C7=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},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",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${a}`;return`Virheellinen tyyppi: odotettiin ${i}, oli ${a}`}case"invalid_value":if(n.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${ce(n.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${n.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${n.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`;if(i.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`;return`Virheellinen ${r[i.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"}: ${Q(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"}}};var Qz=S(()=>{Ie()});function k0(){return{localeError:P7()}}var P7=()=>{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:"entr\xE9e",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",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",jwt:"JWT",template_literal:"entr\xE9e"},o={string:"cha\xEEne",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:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Entr\xE9e invalide : instanceof ${n.expected} attendu, ${a} re\xE7u`;return`Entr\xE9e invalide : ${i} attendu, ${a} re\xE7u`}case"invalid_value":if(n.values.length===1)return`Entr\xE9e invalide : ${ce(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${Q(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Trop grand : ${o[n.origin]??"valeur"} doit ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Trop petit : ${o[n.origin]??"valeur"} doit ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Cha\xEEne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`;return`${r[i.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":""} : ${Q(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"}}};var Yz=S(()=>{Ie()});function R0(){return{localeError:z7()}}var z7=()=>{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:"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",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",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${a}`;return`Entr\xE9e invalide : attendu ${i}, re\xE7u ${a}`}case"invalid_value":if(n.values.length===1)return`Entr\xE9e invalide : attendu ${ce(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u2264":"<",s=t(n.origin);if(s)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u2265":">",s=t(n.origin);if(s)return`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Cha\xEEne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`;return`${r[i.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":""} : ${Q(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"}}};var Xz=S(()=>{Ie()});function T0(){return{localeError:N7()}}var N7=()=>{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,o=(u)=>{let d=r(u);if(d)return d.label;return u??e.unknown.label},n=(u)=>`\u05D4${o(u)}`,i=(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)=>{if(!u)return null;return t[u]??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"},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"},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"},jwt:{label:"JWT",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"}},l={nan:"NaN"};return(u)=>{switch(u.code){case"invalid_type":{let d=u.expected,p=l[d??""]??o(d),m=le(u.input),h=l[m]??e[m]?.label??m;if(/^[A-Z]/.test(u.expected))return`\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 ${h}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${p}, \u05D4\u05EA\u05E7\u05D1\u05DC ${h}`}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 ${ce(u.values[0])}`;let d=u.values.map((h)=>ce(h));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 ${d[0]} \u05D0\u05D5 ${d[1]}`;let p=d[d.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 ${d.slice(0,-1).join(", ")} \u05D0\u05D5 ${p}`}case"too_big":{let d=s(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${d?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${d?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let b=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: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${b}`}if(u.origin==="array"||u.origin==="set"){let b=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",y=u.inclusive?`${u.maximum} ${d?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${d?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} ${b} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`.trim()}let m=u.inclusive?"<=":"<",h=i(u.origin??"value");if(d?.unit)return`${d.longLabel} \u05DE\u05D3\u05D9: ${p} ${h} ${m}${u.maximum.toString()} ${d.unit}`;return`${d?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${p} ${h} ${m}${u.maximum.toString()}`}case"too_small":{let d=s(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${d?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${d?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let b=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: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${b}`}if(u.origin==="array"||u.origin==="set"){let b=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let v=u.origin==="set"?"\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3":"\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3";return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${b} \u05DC\u05D4\u05DB\u05D9\u05DC ${v}`}let y=u.inclusive?`${u.minimum} ${d?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${d?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${b} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`.trim()}let m=u.inclusive?">=":">",h=i(u.origin??"value");if(d?.unit)return`${d.shortLabel} \u05DE\u05D3\u05D9: ${p} ${h} ${m}${u.minimum.toString()} ${d.unit}`;return`${d?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${p} ${h} ${m}${u.minimum.toString()}`}case"invalid_format":{let d=u;if(d.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${d.prefix}"`;if(d.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${d.suffix}"`;if(d.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${d.includes}"`;if(d.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 ${d.pattern}`;let p=a[d.format],m=p?.label??d.format,b=(p?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${m} \u05DC\u05D0 ${b}`}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"}: ${Q(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"}}};var eN=S(()=>{Ie()});function $0(){return{localeError:D7()}}var D7=()=>{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",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${a}`;return`Neispravan unos: o\u010Dekuje se ${i}, a primljeno je ${a}`}case"invalid_value":if(n.values.length===1)return`Neispravna vrijednost: o\u010Dekivano ${ce(n.values[0])}`;return`Neispravna opcija: o\u010Dekivano jedno od ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${i}${n.maximum.toString()} ${s.unit??"elemenata"}`;return`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`Premalo: o\u010Dekivano da ${a} ima ${i}${n.minimum.toString()} ${s.unit}`;return`Premalo: o\u010Dekivano da ${a} bude ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neispravan tekst: mora zapo\u010Dinjati s "${i.prefix}"`;if(i.format==="ends_with")return`Neispravan tekst: mora zavr\u0161avati s "${i.suffix}"`;if(i.format==="includes")return`Neispravan tekst: mora sadr\u017Eavati "${i.includes}"`;if(i.format==="regex")return`Neispravan tekst: mora odgovarati uzorku ${i.pattern}`;return`Neispravna ${r[i.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"}: ${Q(n.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${o[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[n.origin]??n.origin}`;default:return"Neispravan unos"}}};var tN=S(()=>{Ie()});function O0(){return{localeError:L7()}}var L7=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{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",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",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${a}`;return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":if(n.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${ce(n.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${n.maximum.toString()} ${s.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${i}${n.minimum.toString()} ${s.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(i.format==="ends_with")return`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(i.format==="includes")return`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(i.format==="regex")return`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${r[i.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":""}: ${Q(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"}}};var rN=S(()=>{Ie()});function nN(e,t,r){return Math.abs(e)===1?t:r}function sc(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")}function C0(){return{localeError:Z7()}}var Z7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},o={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[1])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=nN(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 ${sc(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.maximum.toString()} ${l}`}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 ${sc(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=nN(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 ${sc(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.minimum.toString()} ${l}`}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 ${sc(n.origin)} \u056C\u056B\u0576\u056B ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${i.prefix}"-\u0578\u057E`;if(i.format==="ends_with")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${i.suffix}"-\u0578\u057E`;if(i.format==="includes")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`;return`\u054D\u056D\u0561\u056C ${r[i.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":""}. ${Q(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${sc(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 ${sc(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};var oN=S(()=>{Ie()});function P0(){return{localeError:j7()}}var j7=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{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",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",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${a}`;return`Input tidak valid: diharapkan ${i}, diterima ${a}`}case"invalid_value":if(n.values.length===1)return`Input tidak valid: diharapkan ${ce(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${r[i.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":""}: ${Q(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"}}};var iN=S(()=>{Ie()});function z0(){return{localeError:B7()}}var B7=()=>{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"}};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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"n\xFAmer",array:"fylki"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`;return`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":if(n.values.length===1)return`Rangt gildi: gert r\xE1\xF0 fyrir ${ce(n.values[0])}`;return`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${s.unit??"hluti"}`;return`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${i}${n.minimum.toString()} ${s.unit}`;return`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${i.prefix}"`;if(i.format==="ends_with")return`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${i.suffix}"`;if(i.format==="includes")return`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${i.includes}"`;if(i.format==="regex")return`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${i.pattern}`;return`Rangt ${r[i.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"}: ${Q(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"}}};var sN=S(()=>{Ie()});function N0(){return{localeError:U7()}}var U7=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{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",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Input non valido: atteso instanceof ${n.expected}, ricevuto ${a}`;return`Input non valido: atteso ${i}, ricevuto ${a}`}case"invalid_value":if(n.values.length===1)return`Input non valido: atteso ${ce(n.values[0])}`;return`Opzione non valida: atteso uno tra ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Input non valido: ${r[i.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"}: ${Q(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"}}};var aN=S(()=>{Ie()});function D0(){return{localeError:M7()}}var M7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},o={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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`;return`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":if(n.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${ce(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${Q(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=t(n.origin);if(s)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=t(n.origin);if(s)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(i.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(i.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(i.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${r[i.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":""}: ${Q(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"}}};var cN=S(()=>{Ie()});function L0(){return{localeError:q7()}}var q7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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} ${i}${n.maximum.toString()} ${s.unit}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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} ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"-\u10D8\u10D7`;if(i.format==="ends_with")return`\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 "${i.suffix}"-\u10D8\u10D7`;if(i.format==="includes")return`\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 "${i.includes}"-\u10E1`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[i.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"}: ${Q(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"}}};var lN=S(()=>{Ie()});function Qu(){return{localeError:F7()}}var F7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()} ${s.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[i.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 ${Q(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"}}};var Z0=S(()=>{Ie()});function j0(){return Qu()}var uN=S(()=>{Z0()});function B0(){return{localeError:H7()}}var H7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\uC785\uB825"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":if(n.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${ce(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${Q(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),l=a?.unit??"\uC694\uC18C";if(a)return`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${l} ${i}${s}`;return`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${i}${s}`}case"too_small":{let i=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),l=a?.unit??"\uC694\uC18C";if(a)return`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${l} ${i}${s}`;return`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(i.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(i.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(i.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${r[i.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: ${Q(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"}}};var dN=S(()=>{Ie()});function pN(e){let t=Math.abs(e),r=t%10,o=t%100;if(o>=11&&o<=19||r===0)return"many";if(r===1)return"one";return"few"}function U0(){return{localeError:J7()}}var Yu=(e)=>e.charAt(0).toUpperCase()+e.slice(1),J7=()=>{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,i,s,a){let l=e[n]??null;if(l===null)return l;return{unit:l.unit[i],verb:l.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",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",jwt:"JWT",template_literal:"\u012Fvestis"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${n.expected}`;return`Gautas tipas ${a}, o tik\u0117tasi - ${i}`}case"invalid_value":if(n.values.length===1)return`Privalo b\u016Bti ${ce(n.values[0])}`;return`Privalo b\u016Bti vienas i\u0161 ${Q(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,s=t(n.origin,pN(Number(n.maximum)),n.inclusive??!1,"smaller");if(s?.verb)return`${Yu(i??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`${Yu(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.maximum.toString()} ${s?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,s=t(n.origin,pN(Number(n.minimum)),n.inclusive??!1,"bigger");if(s?.verb)return`${Yu(i??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`${Yu(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.minimum.toString()} ${s?.unit}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Eilut\u0117 privalo prasid\u0117ti "${i.prefix}"`;if(i.format==="ends_with")return`Eilut\u0117 privalo pasibaigti "${i.suffix}"`;if(i.format==="includes")return`Eilut\u0117 privalo \u012Ftraukti "${i.includes}"`;if(i.format==="regex")return`Eilut\u0117 privalo atitikti ${i.pattern}`;return`Neteisingas ${r[i.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"}: ${Q(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let i=o[n.origin]??n.origin;return`${Yu(i??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};var fN=S(()=>{Ie()});function M0(){return{localeError:K7()}}var K7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},o={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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 ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`Invalid ${r[i.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"}: ${Q(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"}}};var mN=S(()=>{Ie()});function q0(){return{localeError:V7()}}var V7=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{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",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${a}`;return`Input tidak sah: dijangka ${i}, diterima ${a}`}case"invalid_value":if(n.values.length===1)return`Input tidak sah: dijangka ${ce(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${r[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${Q(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"}}};var hN=S(()=>{Ie()});function F0(){return{localeError:W7()}}var W7=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{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",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${a}`;return`Ongeldige invoer: verwacht ${i}, ontving ${a}`}case"invalid_value":if(n.values.length===1)return`Ongeldige invoer: verwacht ${ce(n.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";if(s)return`Te ${a}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`;return`Te ${a}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";if(s)return`Te ${a}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`;return`Te ${a}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${r[i.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":""}: ${Q(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"}}};var gN=S(()=>{Ie()});function H0(){return{localeError:G7()}}var G7=()=>{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"}};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-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ugyldig input: forventet instanceof ${n.expected}, fikk ${a}`;return`Ugyldig input: forventet ${i}, fikk ${a}`}case"invalid_value":if(n.values.length===1)return`Ugyldig verdi: forventet ${ce(n.values[0])}`;return`Ugyldig valg: forventet en av ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`;return`Ugyldig ${r[i.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"}: ${Q(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"}}};var yN=S(()=>{Ie()});function J0(){return{localeError:Q7()}}var Q7=()=>{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"}};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",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${a}`;return`F\xE2sit giren: umulan ${i}, al\u0131nan ${a}`}case"invalid_value":if(n.values.length===1)return`F\xE2sit giren: umulan ${ce(n.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`;if(i.format==="ends_with")return`F\xE2sit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`;if(i.format==="regex")return`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${r[i.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":""}: ${Q(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."}}};var bN=S(()=>{Ie()});function K0(){return{localeError:Y7()}}var Y7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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`;return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${i} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":if(n.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${ce(n.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${Q(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(i.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(i.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`;if(i.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${r[i.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"}: ${Q(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"}}};var SN=S(()=>{Ie()});function V0(){return{localeError:X7()}}var X7=()=>{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"}};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",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",jwt:"JWT",template_literal:"wej\u015Bcie"},o={nan:"NaN",number:"liczba",array:"tablica"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${a}`;return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${a}`}case"invalid_value":if(n.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${ce(n.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.maximum.toString()} ${s.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.minimum.toString()} ${s.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`;if(i.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`;if(i.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${r[i.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":""}: ${Q(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"}}};var vN=S(()=>{Ie()});function W0(){return{localeError:eW()}}var eW=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}let r={regex:"padr\xE3o",email:"endere\xE7o de 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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"n\xFAmero",null:"nulo"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Tipo inv\xE1lido: esperado instanceof ${n.expected}, recebido ${a}`;return`Tipo inv\xE1lido: esperado ${i}, recebido ${a}`}case"invalid_value":if(n.values.length===1)return`Entrada inv\xE1lida: esperado ${ce(n.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inv\xE1lido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`;return`${r[i.format]??n.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${Q(n.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${n.origin}`;default:return"Campo inv\xE1lido"}}};var wN=S(()=>{Ie()});function G0(){return{localeError:tW()}}var tW=()=>{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",jwt:"JWT",template_literal:"intrare"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${i}, primit ${a}`}case"invalid_value":if(n.values.length===1)return`Intrare invalid\u0103: a\u0219teptat ${ce(n.values[0])}`;return`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemente"}`;return`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Prea mic: a\u0219teptat ca ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Prea mic: a\u0219teptat ca ${n.origin} s\u0103 fie ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${i.prefix}"`;if(i.format==="ends_with")return`\u0218ir invalid: trebuie s\u0103 se termine cu "${i.suffix}"`;if(i.format==="includes")return`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${i.includes}"`;if(i.format==="regex")return`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${i.pattern}`;return`Format invalid: ${r[i.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: ${Q(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"}}};var xN=S(()=>{Ie()});function _N(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}function Q0(){return{localeError:rW()}}var rW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":if(n.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=_N(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 ${i}${n.maximum.toString()} ${l}`}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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=_N(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 ${i}${n.minimum.toString()} ${l}`}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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[i.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":""}: ${Q(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"}}};var EN=S(()=>{Ie()});function Y0(){return{localeError:nW()}}var nW=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{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",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${a}`;return`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${a}`}case"invalid_value":if(n.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${ce(n.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${s.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${r[i.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"}: ${Q(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"}}};var IN=S(()=>{Ie()});function X0(){return{localeError:oW()}}var oW=()=>{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"}};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-intervall",ipv6:"IPv6-intervall",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",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${a}`;return`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${a}`}case"invalid_value":if(n.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${ce(n.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()} ${s.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`;if(i.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`;return`Ogiltig(t) ${r[i.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"}: ${Q(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"}}};var AN=S(()=>{Ie()});function e_(){return{localeError:iW()}}var iW=()=>{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"}};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",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",jwt:"JWT",template_literal:"input"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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"} ${i}${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`;return`\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"} ${i}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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} ${i}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\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} ${i}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(i.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(i.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(i.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.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`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[i.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":""}: ${Q(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"}}};var kN=S(()=>{Ie()});function t_(){return{localeError:sW()}}var sW=()=>{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"}};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",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)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":if(n.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);if(s)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);if(s)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()} ${s.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[i.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: ${Q(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"}}};var RN=S(()=>{Ie()});function r_(){return{localeError:aW()}}var aW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u015Eablon dizesi"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${a}`;return`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${a}`}case"invalid_value":if(n.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${ce(n.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ge\xE7ersiz metin: "${i.prefix}" ile ba\u015Flamal\u0131`;if(i.format==="ends_with")return`Ge\xE7ersiz metin: "${i.suffix}" ile bitmeli`;if(i.format==="includes")return`Ge\xE7ersiz metin: "${i.includes}" i\xE7ermeli`;if(i.format==="regex")return`Ge\xE7ersiz metin: ${i.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${r[i.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":""}: ${Q(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"}}};var TN=S(()=>{Ie()});function Xu(){return{localeError:cW()}}var cW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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} ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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} ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[i.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":""}: ${Q(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"}}};var n_=S(()=>{Ie()});function o_(){return Xu()}var $N=S(()=>{n_()});function i_(){return{localeError:lW()}}var lW=()=>{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"}};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",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",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},o={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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`;return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":if(n.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${ce(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${Q(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${i}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${i}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(i.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(i.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(i.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${r[i.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":""}: ${Q(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"}}};var ON=S(()=>{Ie()});function s_(){return{localeError:uW()}}var uW=()=>{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",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${a}`;return`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${a}`}case"invalid_value":if(n.values.length===1)return`Noto\u2018g\u2018ri kirish: kutilgan ${ce(n.values[0])}`;return`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${s.unit} ${s.verb}`;return`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`;return`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Noto\u2018g\u2018ri satr: "${i.prefix}" bilan boshlanishi kerak`;if(i.format==="ends_with")return`Noto\u2018g\u2018ri satr: "${i.suffix}" bilan tugashi kerak`;if(i.format==="includes")return`Noto\u2018g\u2018ri satr: "${i.includes}" ni o\u2018z ichiga olishi kerak`;if(i.format==="regex")return`Noto\u2018g\u2018ri satr: ${i.pattern} shabloniga mos kelishi kerak`;return`Noto\u2018g\u2018ri ${r[i.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":""}: ${Q(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"}}};var CN=S(()=>{Ie()});function a_(){return{localeError:dW()}}var dW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},o={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`;return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":if(n.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${ce(n.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`;if(i.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`;if(i.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`;if(i.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`;return`${r[i.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: ${Q(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"}}};var PN=S(()=>{Ie()});function c_(){return{localeError:pW()}}var pW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u8F93\u5165"},o={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`;return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":if(n.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${ce(n.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`;if(i.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`;if(i.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`;if(i.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`;return`\u65E0\u6548${r[i.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): ${Q(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"}}};var zN=S(()=>{Ie()});function l_(){return{localeError:fW()}}var fW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u8F38\u5165"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${a}`;return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":if(n.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${ce(n.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()} ${s.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`;if(i.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`;if(i.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`;if(i.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`;return`\u7121\u6548\u7684 ${r[i.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${Q(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"}}};var NN=S(()=>{Ie()});function u_(){return{localeError:mW()}}var mW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},o={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`;return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":if(n.values.length===1)return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${ce(n.values[0])}`;return`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${s.verb} ${i}${n.maximum} ${s.unit}`;return`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.maximum}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${s.verb} ${i}${n.minimum} ${s.unit}`;return`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.minimum}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`;if(i.format==="ends_with")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`;if(i.format==="includes")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`;if(i.format==="regex")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`;return`A\u1E63\xEC\u1E63e: ${r[i.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: ${Q(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"}}};var DN=S(()=>{Ie()});var ed={};Lt(ed,{ar:()=>f0,az:()=>m0,be:()=>h0,bg:()=>g0,ca:()=>y0,cs:()=>b0,da:()=>S0,de:()=>v0,el:()=>w0,en:()=>Gu,eo:()=>_0,es:()=>E0,fa:()=>I0,fi:()=>A0,fr:()=>k0,frCA:()=>R0,he:()=>T0,hr:()=>$0,hu:()=>O0,hy:()=>C0,id:()=>P0,is:()=>z0,it:()=>N0,ja:()=>D0,ka:()=>L0,kh:()=>j0,km:()=>Qu,ko:()=>B0,lt:()=>U0,mk:()=>M0,ms:()=>q0,nl:()=>F0,no:()=>H0,ota:()=>J0,pl:()=>V0,ps:()=>K0,pt:()=>W0,ro:()=>G0,ru:()=>Q0,sl:()=>Y0,sv:()=>X0,ta:()=>e_,th:()=>t_,tr:()=>r_,ua:()=>o_,uk:()=>Xu,ur:()=>i_,uz:()=>s_,vi:()=>a_,yo:()=>u_,zhCN:()=>c_,zhTW:()=>l_});var d_=S(()=>{Zz();jz();Uz();Mz();qz();Fz();Hz();Jz();Kz();x0();Vz();Wz();Gz();Qz();Yz();Xz();eN();tN();rN();oN();iN();sN();aN();cN();lN();uN();Z0();dN();fN();mN();hN();gN();yN();bN();SN();vN();wN();xN();EN();IN();AN();kN();RN();TN();$N();n_();ON();CN();PN();zN();NN();DN()});class m_{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function qm(){return new m_}var LN,p_,f_,Vt;var td=S(()=>{p_=Symbol("ZodOutput"),f_=Symbol("ZodInput");(LN=globalThis).__zod_globalRegistry??(LN.__zod_globalRegistry=qm());Vt=globalThis.__zod_globalRegistry});function h_(e,t){return new e({type:"string",...pe(t)})}function g_(e,t){return new e({type:"string",coerce:!0,...pe(t)})}function Fm(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...pe(t)})}function rd(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...pe(t)})}function Hm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...pe(t)})}function Jm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...pe(t)})}function Km(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...pe(t)})}function Vm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...pe(t)})}function nd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...pe(t)})}function Wm(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...pe(t)})}function Gm(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...pe(t)})}function Qm(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...pe(t)})}function Ym(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...pe(t)})}function Xm(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...pe(t)})}function eh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...pe(t)})}function th(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...pe(t)})}function rh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...pe(t)})}function nh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...pe(t)})}function y_(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...pe(t)})}function oh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...pe(t)})}function ih(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...pe(t)})}function sh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...pe(t)})}function ah(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...pe(t)})}function ch(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...pe(t)})}function lh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...pe(t)})}function S_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...pe(t)})}function v_(e,t){return new e({type:"string",format:"date",check:"string_format",...pe(t)})}function w_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...pe(t)})}function x_(e,t){return new e({type:"string",format:"duration",check:"string_format",...pe(t)})}function __(e,t){return new e({type:"number",checks:[],...pe(t)})}function E_(e,t){return new e({type:"number",coerce:!0,checks:[],...pe(t)})}function I_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...pe(t)})}function A_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...pe(t)})}function k_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...pe(t)})}function R_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...pe(t)})}function T_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...pe(t)})}function $_(e,t){return new e({type:"boolean",...pe(t)})}function O_(e,t){return new e({type:"boolean",coerce:!0,...pe(t)})}function C_(e,t){return new e({type:"bigint",...pe(t)})}function P_(e,t){return new e({type:"bigint",coerce:!0,...pe(t)})}function z_(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...pe(t)})}function N_(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...pe(t)})}function D_(e,t){return new e({type:"symbol",...pe(t)})}function L_(e,t){return new e({type:"undefined",...pe(t)})}function Z_(e,t){return new e({type:"null",...pe(t)})}function j_(e){return new e({type:"any"})}function B_(e){return new e({type:"unknown"})}function U_(e,t){return new e({type:"never",...pe(t)})}function M_(e,t){return new e({type:"void",...pe(t)})}function q_(e,t){return new e({type:"date",...pe(t)})}function F_(e,t){return new e({type:"date",coerce:!0,...pe(t)})}function H_(e,t){return new e({type:"nan",...pe(t)})}function Fn(e,t){return new $m({check:"less_than",...pe(t),value:e,inclusive:!1})}function jr(e,t){return new $m({check:"less_than",...pe(t),value:e,inclusive:!0})}function Hn(e,t){return new Om({check:"greater_than",...pe(t),value:e,inclusive:!1})}function mr(e,t){return new Om({check:"greater_than",...pe(t),value:e,inclusive:!0})}function uh(e){return Hn(0,e)}function dh(e){return Fn(0,e)}function ph(e){return jr(0,e)}function fh(e){return mr(0,e)}function Ai(e,t){return new Dw({check:"multiple_of",...pe(t),value:e})}function ki(e,t){return new jw({check:"max_size",...pe(t),maximum:e})}function Jn(e,t){return new Bw({check:"min_size",...pe(t),minimum:e})}function Ms(e,t){return new Uw({check:"size_equals",...pe(t),size:e})}function qs(e,t){return new Mw({check:"max_length",...pe(t),maximum:e})}function Ao(e,t){return new qw({check:"min_length",...pe(t),minimum:e})}function Fs(e,t){return new Fw({check:"length_equals",...pe(t),length:e})}function ac(e,t){return new Hw({check:"string_format",format:"regex",...pe(t),pattern:e})}function cc(e){return new Jw({check:"string_format",format:"lowercase",...pe(e)})}function lc(e){return new Kw({check:"string_format",format:"uppercase",...pe(e)})}function uc(e,t){return new Vw({check:"string_format",format:"includes",...pe(t),includes:e})}function dc(e,t){return new Ww({check:"string_format",format:"starts_with",...pe(t),prefix:e})}function pc(e,t){return new Gw({check:"string_format",format:"ends_with",...pe(t),suffix:e})}function mh(e,t,r){return new Qw({check:"property",property:e,schema:t,...pe(r)})}function fc(e,t){return new Yw({check:"mime_type",mime:e,...pe(t)})}function mn(e){return new Xw({check:"overwrite",tx:e})}function mc(e){return mn((t)=>t.normalize(e))}function hc(){return mn((e)=>e.trim())}function gc(){return mn((e)=>e.toLowerCase())}function yc(){return mn((e)=>e.toUpperCase())}function bc(){return mn((e)=>Kv(e))}function J_(e,t,r){return new e({type:"array",element:t,...pe(r)})}function gW(e,t,r){return new e({type:"union",options:t,...pe(r)})}function yW(e,t,r){return new e({type:"union",options:t,inclusive:!1,...pe(r)})}function bW(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...pe(o)})}function SW(e,t,r){return new e({type:"intersection",left:t,right:r})}function vW(e,t,r,o){let n=r instanceof Ne;return new e({type:"tuple",items:t,rest:n?r:null,...pe(n?o:r)})}function wW(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...pe(o)})}function xW(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...pe(o)})}function _W(e,t,r){return new e({type:"set",valueType:t,...pe(r)})}function EW(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map((n)=>[n,n])):t;return new e({type:"enum",entries:o,...pe(r)})}function IW(e,t,r){return new e({type:"enum",entries:t,...pe(r)})}function AW(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...pe(r)})}function K_(e,t){return new e({type:"file",...pe(t)})}function kW(e,t){return new e({type:"transform",transform:t})}function RW(e,t){return new e({type:"optional",innerType:t})}function TW(e,t){return new e({type:"nullable",innerType:t})}function $W(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r==="function"?r():Wv(r)}})}function OW(e,t,r){return new e({type:"nonoptional",innerType:t,...pe(r)})}function CW(e,t){return new e({type:"success",innerType:t})}function PW(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r==="function"?r:()=>r})}function zW(e,t,r){return new e({type:"pipe",in:t,out:r})}function NW(e,t){return new e({type:"readonly",innerType:t})}function DW(e,t,r){return new e({type:"template_literal",parts:t,...pe(r)})}function LW(e,t){return new e({type:"lazy",getter:t})}function ZW(e,t){return new e({type:"promise",innerType:t})}function V_(e,t,r){let o=pe(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function W_(e,t,r){return new e({type:"custom",check:"custom",fn:t,...pe(r)})}function G_(e,t){let r=ZN((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(ec(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(ec(i))}},e(o.value,o)),t);return r}function ZN(e,t){let r=new rt({check:"custom",...pe(t)});return r._zod.check=e,r}function Q_(e){let t=new rt({check:"describe"});return t._zod.onattach=[(r)=>{let o=Vt.get(r)??{};Vt.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Y_(e){let t=new rt({check:"meta"});return t._zod.onattach=[(r)=>{let o=Vt.get(r)??{};Vt.add(r,{...o,...e})}],t._zod.check=()=>{},t}function X_(e,t){let r=pe(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((h)=>typeof h==="string"?h.toLowerCase():h),n=n.map((h)=>typeof h==="string"?h.toLowerCase():h);let i=new Set(o),s=new Set(n),a=e.Codec??Wu,l=e.Boolean??Ku,d=new(e.String??Us)({type:"string",error:r.error}),p=new l({type:"boolean",error:r.error}),m=new a({type:"pipe",in:d,out:p,transform:(h,b)=>{let y=h;if(r.case!=="sensitive")y=y.toLowerCase();if(i.has(y))return!0;else if(s.has(y))return!1;else return b.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:b.value,inst:m,continue:!1}),{}},reverseTransform:(h,b)=>{if(h===!0)return o[0]||"true";else return n[0]||"false"},error:r.error});return m}function Sc(e,t,r,o={}){let n=pe(o),i={...pe(o),check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(a)=>r.test(a),...n};if(r instanceof RegExp)i.pattern=r;return new e(i)}var b_;var jN=S(()=>{Cm();td();p0();Ie();b_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function Ri(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Vt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function We(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let m=s.schema,h=t.processors[n.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);h(e,t,m,d)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;We(p,t,d),t.seen.get(p).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)Object.assign(s.schema,l);if(t.io==="input"&&hr(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Ti(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let l=o.get(a);if(l&&l!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let n=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??((b)=>b);if(p)return{ref:m(p)};let h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${m("__shared")}#/${a}/${h}`}}if(s[1]===r)return{ref:"#"};let u=`${"#"}/${a}/`,d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:l,defId:u}=n(s);if(a.def={...a.schema},u)a.defId=u;let d=a.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
249
|
+
`)}h.write("payload.value = newResult;"),h.write("return payload;");let _=h.compile();return(k,O)=>_(m,k,O)},i,s=js,a=!Ds.jitless,u=a&&Vv.value,d=t.catchall,p;e._zod.parse=(m,h)=>{p??(p=o.value);let b=m.value;if(!s(b))return m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m;if(a&&u&&h?.async===!1&&h.jitless!==!0){if(!i)i=n(t.shape);if(m=i(m,h),!d)return m;return Dz([],b,m,h,p,e)}return r(m,h)}});Vu=B("$ZodUnion",(e,t)=>{Ne.init(e,t),Be(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),Be(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),Be(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),Be(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${o.map((n)=>Lu(n.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}if(!i)return vz(s,o,e,n);return Promise.all(s).then((a)=>vz(a,o,e,n))}});Ux=B("$ZodXor",(e,t)=>{Vu.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let l=a._zod.run({value:o.value,issues:[]},n);if(l instanceof Promise)s.push(l),i=!0;else s.push(l)}if(!i)return wz(s,o,e,n);return Promise.all(s).then((a)=>wz(a,o,e,n))}}),Mx=B("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Vu.init(e,t);let r=e._zod.parse;Be(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,l]of Object.entries(s)){if(!n[a])n[a]=new Set;for(let u of l)n[a].add(u)}}return n});let o=Xa(()=>{let n=t.options,i=new Map;for(let s of n){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let l of a){if(i.has(l))throw Error(`Duplicate discriminator value "${String(l)}"`);i.set(l,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!js(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:s,path:[t.discriminator],inst:e}),n}}),qx=B("$ZodIntersection",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([l,u])=>xz(r,l,u));return xz(r,i,s)}});Bm=B("$ZodTuple",(e,t)=>{Ne.init(e,t);let r=t.items;e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[],a=_z(r,"optin"),l=_z(r,"optout");if(!t.rest){if(i.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:i,inst:e,origin:"array"}),o;if(i.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:e,origin:"array"})}let u=Array(r.length);for(let d=0;d<r.length;d++){let p=r[d]._zod.run({value:i[d],issues:[]},n);if(p instanceof Promise)s.push(p.then((m)=>{u[d]=m}));else u[d]=p}if(t.rest){let d=r.length-1,p=i.slice(r.length);for(let m of p){d++;let h=t.rest._zod.run({value:m,issues:[]},n);if(h instanceof Promise)s.push(h.then((b)=>Ez(b,o,d)));else Ez(h,o,d)}}if(s.length)return Promise.all(s).then(()=>Iz(u,o,r,i,l));return Iz(u,o,r,i,l)}});Fx=B("$ZodRecord",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Ei(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){a.add(typeof u==="number"?u.toString():u);let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((h)=>fr(h,o,gt())),input:u,path:[u],inst:e});continue}let p=d.value,m=t.valueType._zod.run({value:n[u],issues:[]},o);if(m instanceof Promise)i.push(m.then((h)=>{if(h.issues.length)r.issues.push(..._r(u,h.issues));r.value[p]=h.value}));else{if(m.issues.length)r.issues.push(..._r(u,m.issues));r.value[p]=m.value}}let l;for(let u in n)if(!a.has(u))l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Fu.test(a)&&l.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)l=p}if(l.issues.length){if(t.mode==="loose")r.value[a]=n[a];else r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((p)=>fr(p,o,gt())),input:a,path:[a],inst:e});continue}let d=t.valueType._zod.run({value:n[a],issues:[]},o);if(d instanceof Promise)i.push(d.then((p)=>{if(p.issues.length)r.issues.push(..._r(a,p.issues));r.value[l.value]=p.value}));else{if(d.issues.length)r.issues.push(..._r(a,d.issues));r.value[l.value]=d.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}}),Hx=B("$ZodMap",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,a]of n){let l=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);if(l instanceof Promise||u instanceof Promise)i.push(Promise.all([l,u]).then(([d,p])=>{Az(d,p,r,s,n,e,o)}));else Az(l,u,r,s,n,e,o)}if(i.length)return Promise.all(i).then(()=>r);return r}});Jx=B("$ZodSet",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((l)=>kz(l,r)));else kz(a,r)}if(i.length)return Promise.all(i).then(()=>r);return r}});Kx=B("$ZodEnum",(e,t)=>{Ne.init(e,t);let r=Du(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>Zu.has(typeof n)).map((n)=>typeof n==="string"?Yr(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),Vx=B("$ZodLiteral",(e,t)=>{if(Ne.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?Yr(o):o?Yr(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),Wx=B("$ZodFile",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(n instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Gx=B("$ZodTransform",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ls(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r.fallback=!0,r));if(n instanceof Promise)throw new qn;return r.value=n,r.fallback=!0,r}});Um=B("$ZodOptional",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Be(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Lu(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,i=t.innerType._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Rz(s,n));return Rz(i,n)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Qx=B("$ZodExactOptional",(e,t)=>{Um.init(e,t),Be(e._zod,"values",()=>t.innerType._zod.values),Be(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Yx=B("$ZodNullable",(e,t)=>{Ne.init(e,t),Be(e._zod,"optin",()=>t.innerType._zod.optin),Be(e._zod,"optout",()=>t.innerType._zod.optout),Be(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Lu(r.source)}|null)$`):void 0}),Be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Xx=B("$ZodDefault",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",Be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Tz(i,t));return Tz(n,t)}});e0=B("$ZodPrefault",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",Be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),t0=B("$ZodNonOptional",(e,t)=>{Ne.init(e,t),Be(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>$z(i,e));return $z(n,e)}});r0=B("$ZodSuccess",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ls("ZodSuccess");let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>(r.value=i.issues.length===0,r));return r.value=n.issues.length===0,r}}),n0=B("$ZodCatch",(e,t)=>{Ne.init(e,t),e._zod.optin="optional",Be(e._zod,"optout",()=>t.innerType._zod.optout),Be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>fr(s,o,gt()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>fr(i,o,gt()))},input:r.value}),r.issues=[],r.fallback=!0;return r}}),o0=B("$ZodNaN",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),Mm=B("$ZodPipe",(e,t)=>{Ne.init(e,t),Be(e._zod,"values",()=>t.in._zod.values),Be(e._zod,"optin",()=>t.in._zod.optin),Be(e._zod,"optout",()=>t.out._zod.optout),Be(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>zm(s,t.in,o));return zm(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>zm(i,t.out,o));return zm(n,t.out,o)}});Wu=B("$ZodCodec",(e,t)=>{Ne.init(e,t),Be(e._zod,"values",()=>t.in._zod.values),Be(e._zod,"optin",()=>t.in._zod.optin),Be(e._zod,"optout",()=>t.out._zod.optout),Be(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Nm(s,t,o));return Nm(i,t,o)}else{let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Nm(s,t,o));return Nm(i,t,o)}}});i0=B("$ZodPreprocess",(e,t)=>{Mm.init(e,t)}),s0=B("$ZodReadonly",(e,t)=>{Ne.init(e,t),Be(e._zod,"propValues",()=>t.innerType._zod.propValues),Be(e._zod,"values",()=>t.innerType._zod.values),Be(e._zod,"optin",()=>t.innerType?._zod?.optin),Be(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Oz);return Oz(n)}});a0=B("$ZodTemplateLiteral",(e,t)=>{Ne.init(e,t);let r=[];for(let o of t.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||Gv.has(typeof o))r.push(Yr(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o;return o}}),c0=B("$ZodFunction",(e,t)=>(Ne.init(e,t),e._def=t,e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return function(...o){let n=e._def.input?bm(e._def.input,o):o,i=Reflect.apply(r,this,n);if(e._def.output)return bm(e._def.output,i);return i}},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let n=e._def.input?await Sm(e._def.input,o):o,i=await Reflect.apply(r,this,n);if(e._def.output)return await Sm(e._def.output,i);return i}},e._zod.parse=(r,o)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let o=e.constructor;if(Array.isArray(r[0]))return new o({type:"function",input:new Bm({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new o({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),l0=B("$ZodPromise",(e,t)=>{Ne.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then((n)=>t.innerType._zod.run({value:n,issues:[]},o))}),u0=B("$ZodLazy",(e,t)=>{Ne.init(e,t),Be(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),Be(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Be(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Be(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Be(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),d0=B("$ZodCustom",(e,t)=>{rt.init(e,t),Ne.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>Cz(i,r,o,e));Cz(n,r,o,e);return}})});function f0(){return{localeError:S7()}}var S7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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: ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return` \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"} ${i} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`;return`\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"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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 ${i} ${n.minimum.toString()} ${s.unit}`;return`\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 ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`;if(i.format==="ends_with")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`;if(i.format==="includes")return`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`${r[i.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":""}: ${Q(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"}}};var Zz=S(()=>{Ie()});function m0(){return{localeError:v7()}}var v7=()=>{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"}};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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${a}`;return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${a}`}case"invalid_value":if(n.values.length===1)return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${ce(n.values[0])}`;return`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;if(i.format==="ends_with")return`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`;if(i.format==="includes")return`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`;if(i.format==="regex")return`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;return`Yanl\u0131\u015F ${r[i.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":""}: ${Q(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"}}};var jz=S(()=>{Ie()});function Bz(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}function h0(){return{localeError:w7()}}var w7=()=>{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"},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",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",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},o={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${i}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":if(n.values.length===1)return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=Bz(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} ${i}${n.maximum.toString()} ${l}`}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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=Bz(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} ${i}${n.minimum.toString()} ${l}`}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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[i.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"}: ${Q(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"}}};var Uz=S(()=>{Ie()});function g0(){return{localeError:x7()}}var x7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":if(n.values.length===1)return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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 ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.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 "${i.prefix}"`;if(i.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 "${i.suffix}"`;if(i.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 "${i.includes}"`;if(i.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 ${i.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";if(i.format==="emoji")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(i.format==="datetime")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(i.format==="date")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";if(i.format==="time")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";if(i.format==="duration")s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";return`${s} ${r[i.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":""}: ${Q(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"}}};var Mz=S(()=>{Ie()});function y0(){return{localeError:_7()}}var _7=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{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",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",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${a}`;return`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${a}`}case"invalid_value":if(n.values.length===1)return`Valor inv\xE0lid: s'esperava ${ce(n.values[0])}`;return`Opci\xF3 inv\xE0lida: s'esperava una de ${Q(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a m\xE0xim":"menys de",s=t(n.origin);if(s)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${i} ${n.maximum.toString()} ${s.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=t(n.origin);if(s)return`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${i} ${n.minimum.toString()} ${s.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format inv\xE0lid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`;return`Format inv\xE0lid per a ${r[i.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":""}: ${Q(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"}}};var qz=S(()=>{Ie()});function b0(){return{localeError:E7()}}var E7=()=>{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"}};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",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",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${a}`;return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${a}`}case"invalid_value":if(n.values.length===1)return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${ce(n.values[0])}`;return`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`;return`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`;if(i.format==="includes")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`;return`Neplatn\xFD form\xE1t ${r[i.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: ${Q(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"}}};var Fz=S(()=>{Ie()});function S0(){return{localeError:I7()}}var I7=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{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-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ugyldigt input: forventede instanceof ${n.expected}, fik ${a}`;return`Ugyldigt input: forventede ${i}, fik ${a}`}case"invalid_value":if(n.values.length===1)return`Ugyldig v\xE6rdi: forventede ${ce(n.values[0])}`;return`Ugyldigt valg: forventede en af f\xF8lgende ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`For stor: forventede ${a??"value"} ${s.verb} ${i} ${n.maximum.toString()} ${s.unit??"elementer"}`;return`For stor: forventede ${a??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`For lille: forventede ${a} ${s.verb} ${i} ${n.minimum.toString()} ${s.unit}`;return`For lille: forventede ${a} havde ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: skal starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: skal ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: skal indeholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: skal matche m\xF8nsteret ${i.pattern}`;return`Ugyldig ${r[i.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"}: ${Q(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"}}};var Hz=S(()=>{Ie()});function v0(){return{localeError:A7()}}var A7=()=>{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"}};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",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${a}`;return`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${a}`}case"invalid_value":if(n.values.length===1)return`Ung\xFCltige Eingabe: erwartet ${ce(n.values[0])}`;return`Ung\xFCltige Option: erwartet eine von ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${s.unit??"Elemente"} hat`;return`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${s.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ung\xFCltiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ung\xFCltiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ung\xFCltig: ${r[i.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"}: ${Q(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"}}};var Jz=S(()=>{Ie()});function w0(){return{localeError:k7()}}var k7=()=>{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",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(typeof n.expected==="string"&&/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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 ${i}${n.maximum.toString()} ${s.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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 ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[i.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"}: ${Q(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"}}};var Kz=S(()=>{Ie()});function Gu(){return{localeError:R7()}}var R7=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${ce(n.values[0])}`;return`Invalid option: expected one of ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`;return`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Q(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0)return`Invalid discriminator value. Expected ${n.options.map((s)=>`'${s}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};var x0=S(()=>{Ie()});function _0(){return{localeError:T7()}}var T7=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{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",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",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${a}`;return`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${a}`}case"invalid_value":if(n.values.length===1)return`Nevalida enigo: atendi\u011Dis ${ce(n.values[0])}`;return`Nevalida opcio: atendi\u011Dis unu el ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${s.unit??"elementojn"}`;return`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${i}${n.minimum.toString()} ${s.unit}`;return`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nevalida karaktraro: devas komenci\u011Di per "${i.prefix}"`;if(i.format==="ends_with")return`Nevalida karaktraro: devas fini\u011Di per "${i.suffix}"`;if(i.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${i.includes}"`;if(i.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`;return`Nevalida ${r[i.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":""}: ${Q(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"}}};var Vz=S(()=>{Ie()});function E0(){return{localeError:$7()}}var $7=()=>{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",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",jwt:"JWT",template_literal:"entrada"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${a}`;return`Entrada inv\xE1lida: se esperaba ${i}, recibido ${a}`}case"invalid_value":if(n.values.length===1)return`Entrada inv\xE1lida: se esperaba ${ce(n.values[0])}`;return`Opci\xF3n inv\xE1lida: se esperaba una de ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${a??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${i}${n.minimum.toString()} ${s.unit}`;return`Demasiado peque\xF1o: se esperaba que ${a} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`;if(i.format==="ends_with")return`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`;if(i.format==="includes")return`Cadena inv\xE1lida: debe incluir "${i.includes}"`;if(i.format==="regex")return`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`;return`Inv\xE1lido ${r[i.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":""}: ${Q(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}};var Wz=S(()=>{Ie()});function I0(){return{localeError:O7()}}var O7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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`;return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":if(n.values.length===1)return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${ce(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;return`\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 ${Q(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`;return`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;if(i.format==="ends_with")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;if(i.format==="includes")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`;if(i.format==="regex")return`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;return`${r[i.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: ${Q(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"}}};var Gz=S(()=>{Ie()});function A0(){return{localeError:C7()}}var C7=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},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",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${a}`;return`Virheellinen tyyppi: odotettiin ${i}, oli ${a}`}case"invalid_value":if(n.values.length===1)return`Virheellinen sy\xF6te: t\xE4ytyy olla ${ce(n.values[0])}`;return`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${n.maximum.toString()} ${s.unit}`.trim();return`Liian suuri: arvon t\xE4ytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${n.minimum.toString()} ${s.unit}`.trim();return`Liian pieni: arvon t\xE4ytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`;if(i.format==="regex")return`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`;return`Virheellinen ${r[i.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"}: ${Q(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"}}};var Qz=S(()=>{Ie()});function k0(){return{localeError:P7()}}var P7=()=>{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:"entr\xE9e",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",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",jwt:"JWT",template_literal:"entr\xE9e"},o={string:"cha\xEEne",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:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Entr\xE9e invalide : instanceof ${n.expected} attendu, ${a} re\xE7u`;return`Entr\xE9e invalide : ${i} attendu, ${a} re\xE7u`}case"invalid_value":if(n.values.length===1)return`Entr\xE9e invalide : ${ce(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${Q(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Trop grand : ${o[n.origin]??"valeur"} doit ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`;return`Trop grand : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Trop petit : ${o[n.origin]??"valeur"} doit ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : ${o[n.origin]??"valeur"} doit \xEAtre ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Cha\xEEne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`;return`${r[i.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":""} : ${Q(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"}}};var Yz=S(()=>{Ie()});function R0(){return{localeError:z7()}}var z7=()=>{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:"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",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",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${a}`;return`Entr\xE9e invalide : attendu ${i}, re\xE7u ${a}`}case"invalid_value":if(n.values.length===1)return`Entr\xE9e invalide : attendu ${ce(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u2264":"<",s=t(n.origin);if(s)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${s.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u2265":">",s=t(n.origin);if(s)return`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${s.unit}`;return`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cha\xEEne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Cha\xEEne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`;return`${r[i.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":""} : ${Q(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"}}};var Xz=S(()=>{Ie()});function T0(){return{localeError:N7()}}var N7=()=>{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,o=(u)=>{let d=r(u);if(d)return d.label;return u??e.unknown.label},n=(u)=>`\u05D4${o(u)}`,i=(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)=>{if(!u)return null;return t[u]??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"},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"},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"},jwt:{label:"JWT",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"}},l={nan:"NaN"};return(u)=>{switch(u.code){case"invalid_type":{let d=u.expected,p=l[d??""]??o(d),m=le(u.input),h=l[m]??e[m]?.label??m;if(/^[A-Z]/.test(u.expected))return`\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 ${h}`;return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${p}, \u05D4\u05EA\u05E7\u05D1\u05DC ${h}`}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 ${ce(u.values[0])}`;let d=u.values.map((h)=>ce(h));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 ${d[0]} \u05D0\u05D5 ${d[1]}`;let p=d[d.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 ${d.slice(0,-1).join(", ")} \u05D0\u05D5 ${p}`}case"too_big":{let d=s(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${d?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${d?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let b=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: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${b}`}if(u.origin==="array"||u.origin==="set"){let b=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",y=u.inclusive?`${u.maximum} ${d?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${d?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} ${b} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`.trim()}let m=u.inclusive?"<=":"<",h=i(u.origin??"value");if(d?.unit)return`${d.longLabel} \u05DE\u05D3\u05D9: ${p} ${h} ${m}${u.maximum.toString()} ${d.unit}`;return`${d?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${p} ${h} ${m}${u.maximum.toString()}`}case"too_small":{let d=s(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${d?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${d?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let b=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: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${b}`}if(u.origin==="array"||u.origin==="set"){let b=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let v=u.origin==="set"?"\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3":"\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3";return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${b} \u05DC\u05D4\u05DB\u05D9\u05DC ${v}`}let y=u.inclusive?`${u.minimum} ${d?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${d?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${b} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`.trim()}let m=u.inclusive?">=":">",h=i(u.origin??"value");if(d?.unit)return`${d.shortLabel} \u05DE\u05D3\u05D9: ${p} ${h} ${m}${u.minimum.toString()} ${d.unit}`;return`${d?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${p} ${h} ${m}${u.minimum.toString()}`}case"invalid_format":{let d=u;if(d.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${d.prefix}"`;if(d.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${d.suffix}"`;if(d.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${d.includes}"`;if(d.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 ${d.pattern}`;let p=a[d.format],m=p?.label??d.format,b=(p?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${m} \u05DC\u05D0 ${b}`}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"}: ${Q(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"}}};var eN=S(()=>{Ie()});function $0(){return{localeError:D7()}}var D7=()=>{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",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Neispravan unos: o\u010Dekuje se instanceof ${n.expected}, a primljeno je ${a}`;return`Neispravan unos: o\u010Dekuje se ${i}, a primljeno je ${a}`}case"invalid_value":if(n.values.length===1)return`Neispravna vrijednost: o\u010Dekivano ${ce(n.values[0])}`;return`Neispravna opcija: o\u010Dekivano jedno od ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${i}${n.maximum.toString()} ${s.unit??"elemenata"}`;return`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=o[n.origin]??n.origin;if(s)return`Premalo: o\u010Dekivano da ${a} ima ${i}${n.minimum.toString()} ${s.unit}`;return`Premalo: o\u010Dekivano da ${a} bude ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neispravan tekst: mora zapo\u010Dinjati s "${i.prefix}"`;if(i.format==="ends_with")return`Neispravan tekst: mora zavr\u0161avati s "${i.suffix}"`;if(i.format==="includes")return`Neispravan tekst: mora sadr\u017Eavati "${i.includes}"`;if(i.format==="regex")return`Neispravan tekst: mora odgovarati uzorku ${i.pattern}`;return`Neispravna ${r[i.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"}: ${Q(n.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${o[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[n.origin]??n.origin}`;default:return"Neispravan unos"}}};var tN=S(()=>{Ie()});function O0(){return{localeError:L7()}}var L7=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{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",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",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${a}`;return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":if(n.values.length===1)return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${ce(n.values[0])}`;return`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${n.maximum.toString()} ${s.unit??"elem"}`;return`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${i}${n.minimum.toString()} ${s.unit}`;return`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;if(i.format==="ends_with")return`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;if(i.format==="includes")return`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`;if(i.format==="regex")return`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`;return`\xC9rv\xE9nytelen ${r[i.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":""}: ${Q(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"}}};var rN=S(()=>{Ie()});function nN(e,t,r){return Math.abs(e)===1?t:r}function sc(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")}function C0(){return{localeError:Z7()}}var Z7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},o={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[1])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=nN(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 ${sc(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.maximum.toString()} ${l}`}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 ${sc(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=nN(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 ${sc(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.minimum.toString()} ${l}`}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 ${sc(n.origin)} \u056C\u056B\u0576\u056B ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${i.prefix}"-\u0578\u057E`;if(i.format==="ends_with")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${i.suffix}"-\u0578\u057E`;if(i.format==="includes")return`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`;return`\u054D\u056D\u0561\u056C ${r[i.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":""}. ${Q(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${sc(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 ${sc(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};var oN=S(()=>{Ie()});function P0(){return{localeError:j7()}}var j7=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{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",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",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${a}`;return`Input tidak valid: diharapkan ${i}, diterima ${a}`}case"invalid_value":if(n.values.length===1)return`Input tidak valid: diharapkan ${ce(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${r[i.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":""}: ${Q(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"}}};var iN=S(()=>{Ie()});function z0(){return{localeError:B7()}}var B7=()=>{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"}};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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"n\xFAmer",array:"fylki"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`;return`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":if(n.values.length===1)return`Rangt gildi: gert r\xE1\xF0 fyrir ${ce(n.values[0])}`;return`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${s.unit??"hluti"}`;return`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${i}${n.minimum.toString()} ${s.unit}`;return`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${i.prefix}"`;if(i.format==="ends_with")return`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${i.suffix}"`;if(i.format==="includes")return`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${i.includes}"`;if(i.format==="regex")return`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${i.pattern}`;return`Rangt ${r[i.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"}: ${Q(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"}}};var sN=S(()=>{Ie()});function N0(){return{localeError:U7()}}var U7=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{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",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Input non valido: atteso instanceof ${n.expected}, ricevuto ${a}`;return`Input non valido: atteso ${i}, ricevuto ${a}`}case"invalid_value":if(n.values.length===1)return`Input non valido: atteso ${ce(n.values[0])}`;return`Opzione non valida: atteso uno tra ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${s.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${s.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Input non valido: ${r[i.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"}: ${Q(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"}}};var aN=S(()=>{Ie()});function D0(){return{localeError:M7()}}var M7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},o={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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`;return`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":if(n.values.length===1)return`\u7121\u52B9\u306A\u5165\u529B: ${ce(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;return`\u7121\u52B9\u306A\u9078\u629E: ${Q(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=t(n.origin);if(s)return`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=t(n.origin);if(s)return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(i.format==="ends_with")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(i.format==="includes")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;if(i.format==="regex")return`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;return`\u7121\u52B9\u306A${r[i.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":""}: ${Q(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"}}};var cN=S(()=>{Ie()});function L0(){return{localeError:q7()}}var q7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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} ${i}${n.maximum.toString()} ${s.unit}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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} ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"-\u10D8\u10D7`;if(i.format==="ends_with")return`\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 "${i.suffix}"-\u10D8\u10D7`;if(i.format==="includes")return`\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 "${i.includes}"-\u10E1`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[i.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"}: ${Q(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"}}};var lN=S(()=>{Ie()});function Qu(){return{localeError:F7()}}var F7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`;return`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()} ${s.unit}`;return`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[i.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 ${Q(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"}}};var Z0=S(()=>{Ie()});function j0(){return Qu()}var uN=S(()=>{Z0()});function B0(){return{localeError:H7()}}var H7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\uC785\uB825"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":if(n.values.length===1)return`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${ce(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C \uC635\uC158: ${Q(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),l=a?.unit??"\uC694\uC18C";if(a)return`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${l} ${i}${s}`;return`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${i}${s}`}case"too_small":{let i=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(n.origin),l=a?.unit??"\uC694\uC18C";if(a)return`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${l} ${i}${s}`;return`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;if(i.format==="ends_with")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;if(i.format==="includes")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;if(i.format==="regex")return`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;return`\uC798\uBABB\uB41C ${r[i.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: ${Q(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"}}};var dN=S(()=>{Ie()});function pN(e){let t=Math.abs(e),r=t%10,o=t%100;if(o>=11&&o<=19||r===0)return"many";if(r===1)return"one";return"few"}function U0(){return{localeError:J7()}}var Yu=(e)=>e.charAt(0).toUpperCase()+e.slice(1),J7=()=>{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,i,s,a){let l=e[n]??null;if(l===null)return l;return{unit:l.unit[i],verb:l.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",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",jwt:"JWT",template_literal:"\u012Fvestis"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${n.expected}`;return`Gautas tipas ${a}, o tik\u0117tasi - ${i}`}case"invalid_value":if(n.values.length===1)return`Privalo b\u016Bti ${ce(n.values[0])}`;return`Privalo b\u016Bti vienas i\u0161 ${Q(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,s=t(n.origin,pN(Number(n.maximum)),n.inclusive??!1,"smaller");if(s?.verb)return`${Yu(i??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`${Yu(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.maximum.toString()} ${s?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,s=t(n.origin,pN(Number(n.minimum)),n.inclusive??!1,"bigger");if(s?.verb)return`${Yu(i??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`${Yu(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${n.minimum.toString()} ${s?.unit}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Eilut\u0117 privalo prasid\u0117ti "${i.prefix}"`;if(i.format==="ends_with")return`Eilut\u0117 privalo pasibaigti "${i.suffix}"`;if(i.format==="includes")return`Eilut\u0117 privalo \u012Ftraukti "${i.includes}"`;if(i.format==="regex")return`Eilut\u0117 privalo atitikti ${i.pattern}`;return`Neteisingas ${r[i.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"}: ${Q(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let i=o[n.origin]??n.origin;return`${Yu(i??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};var fN=S(()=>{Ie()});function M0(){return{localeError:K7()}}var K7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},o={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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 ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`Invalid ${r[i.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"}: ${Q(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"}}};var mN=S(()=>{Ie()});function q0(){return{localeError:V7()}}var V7=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{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",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${a}`;return`Input tidak sah: dijangka ${i}, diterima ${a}`}case"invalid_value":if(n.values.length===1)return`Input tidak sah: dijangka ${ce(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${r[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${Q(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"}}};var hN=S(()=>{Ie()});function F0(){return{localeError:W7()}}var W7=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{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",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${a}`;return`Ongeldige invoer: verwacht ${i}, ontving ${a}`}case"invalid_value":if(n.values.length===1)return`Ongeldige invoer: verwacht ${ce(n.values[0])}`;return`Ongeldige optie: verwacht \xE9\xE9n van ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),a=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";if(s)return`Te ${a}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`;return`Te ${a}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),a=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";if(s)return`Te ${a}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`;return`Te ${a}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${r[i.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":""}: ${Q(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"}}};var gN=S(()=>{Ie()});function H0(){return{localeError:G7()}}var G7=()=>{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"}};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-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ugyldig input: forventet instanceof ${n.expected}, fikk ${a}`;return`Ugyldig input: forventet ${i}, fikk ${a}`}case"invalid_value":if(n.values.length===1)return`Ugyldig verdi: forventet ${ce(n.values[0])}`;return`Ugyldig valg: forventet en av ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${s.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${s.unit}`;return`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: m\xE5 starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: m\xE5 ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: m\xE5 inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`;return`Ugyldig ${r[i.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"}: ${Q(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"}}};var yN=S(()=>{Ie()});function J0(){return{localeError:Q7()}}var Q7=()=>{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"}};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",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${a}`;return`F\xE2sit giren: umulan ${i}, al\u0131nan ${a}`}case"invalid_value":if(n.values.length===1)return`F\xE2sit giren: umulan ${ce(n.values[0])}`;return`F\xE2sit tercih: m\xFBteberler ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`;return`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`;return`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`;if(i.format==="ends_with")return`F\xE2sit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`;if(i.format==="regex")return`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`;return`F\xE2sit ${r[i.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":""}: ${Q(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."}}};var bN=S(()=>{Ie()});function K0(){return{localeError:Y7()}}var Y7=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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`;return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${i} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":if(n.values.length===1)return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${ce(n.values[0])} \u0648\u0627\u06CC`;return`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${Q(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`;return`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;if(i.format==="ends_with")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;if(i.format==="includes")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`;if(i.format==="regex")return`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;return`${r[i.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"}: ${Q(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"}}};var SN=S(()=>{Ie()});function V0(){return{localeError:X7()}}var X7=()=>{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"}};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",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",jwt:"JWT",template_literal:"wej\u015Bcie"},o={nan:"NaN",number:"liczba",array:"tablica"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${a}`;return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${a}`}case"invalid_value":if(n.values.length===1)return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${ce(n.values[0])}`;return`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.maximum.toString()} ${s.unit??"element\xF3w"}`;return`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.minimum.toString()} ${s.unit??"element\xF3w"}`;return`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`;if(i.format==="includes")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`;if(i.format==="regex")return`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`;return`Nieprawid\u0142ow(y/a/e) ${r[i.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":""}: ${Q(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"}}};var vN=S(()=>{Ie()});function W0(){return{localeError:eW()}}var eW=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}let r={regex:"padr\xE3o",email:"endere\xE7o de 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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"n\xFAmero",null:"nulo"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Tipo inv\xE1lido: esperado instanceof ${n.expected}, recebido ${a}`;return`Tipo inv\xE1lido: esperado ${i}, recebido ${a}`}case"invalid_value":if(n.values.length===1)return`Entrada inv\xE1lida: esperado ${ce(n.values[0])}`;return`Op\xE7\xE3o inv\xE1lida: esperada uma das ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${s.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${s.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inv\xE1lido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inv\xE1lido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`;return`${r[i.format]??n.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${Q(n.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${n.origin}`;default:return"Campo inv\xE1lido"}}};var wN=S(()=>{Ie()});function G0(){return{localeError:tW()}}var tW=()=>{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",jwt:"JWT",template_literal:"intrare"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;return`Intrare invalid\u0103: a\u0219teptat ${i}, primit ${a}`}case"invalid_value":if(n.values.length===1)return`Intrare invalid\u0103: a\u0219teptat ${ce(n.values[0])}`;return`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemente"}`;return`Prea mare: a\u0219teptat ca ${n.origin??"valoarea"} s\u0103 fie ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Prea mic: a\u0219teptat ca ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Prea mic: a\u0219teptat ca ${n.origin} s\u0103 fie ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${i.prefix}"`;if(i.format==="ends_with")return`\u0218ir invalid: trebuie s\u0103 se termine cu "${i.suffix}"`;if(i.format==="includes")return`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${i.includes}"`;if(i.format==="regex")return`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${i.pattern}`;return`Format invalid: ${r[i.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: ${Q(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"}}};var xN=S(()=>{Ie()});function _N(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;if(s>=11&&s<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}function Q0(){return{localeError:rW()}}var rW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":if(n.values.length===1)return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let a=Number(n.maximum),l=_N(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 ${i}${n.maximum.toString()} ${l}`}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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let a=Number(n.minimum),l=_N(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 ${i}${n.minimum.toString()} ${l}`}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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[i.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":""}: ${Q(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"}}};var EN=S(()=>{Ie()});function Y0(){return{localeError:nW()}}var nW=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{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",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${a}`;return`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${a}`}case"invalid_value":if(n.values.length===1)return`Neveljaven vnos: pri\u010Dakovano ${ce(n.values[0])}`;return`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${s.unit??"elementov"}`;return`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${s.unit}`;return`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${r[i.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"}: ${Q(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"}}};var IN=S(()=>{Ie()});function X0(){return{localeError:oW()}}var oW=()=>{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"}};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-intervall",ipv6:"IPv6-intervall",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",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${a}`;return`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${a}`}case"invalid_value":if(n.values.length===1)return`Ogiltig inmatning: f\xF6rv\xE4ntat ${ce(n.values[0])}`;return`Ogiltigt val: f\xF6rv\xE4ntade en av ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()} ${s.unit??"element"}`;return`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()} ${s.unit}`;return`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`;if(i.format==="regex")return`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`;return`Ogiltig(t) ${r[i.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"}: ${Q(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"}}};var AN=S(()=>{Ie()});function e_(){return{localeError:iW()}}var iW=()=>{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"}};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",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",jwt:"JWT",template_literal:"input"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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"} ${i}${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`;return`\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"} ${i}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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} ${i}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;return`\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} ${i}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(i.format==="ends_with")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(i.format==="includes")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;if(i.format==="regex")return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.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`;return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[i.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":""}: ${Q(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"}}};var kN=S(()=>{Ie()});function t_(){return{localeError:sW()}}var sW=()=>{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"}};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",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)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},o={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 i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":if(n.values.length===1)return`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);if(s)return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;return`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);if(s)return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()} ${s.unit}`;return`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[i.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: ${Q(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"}}};var RN=S(()=>{Ie()});function r_(){return{localeError:aW()}}var aW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u015Eablon dizesi"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${a}`;return`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${a}`}case"invalid_value":if(n.values.length===1)return`Ge\xE7ersiz de\u011Fer: beklenen ${ce(n.values[0])}`;return`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`;return`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ge\xE7ersiz metin: "${i.prefix}" ile ba\u015Flamal\u0131`;if(i.format==="ends_with")return`Ge\xE7ersiz metin: "${i.suffix}" ile bitmeli`;if(i.format==="includes")return`Ge\xE7ersiz metin: "${i.includes}" i\xE7ermeli`;if(i.format==="regex")return`Ge\xE7ersiz metin: ${i.pattern} desenine uymal\u0131`;return`Ge\xE7ersiz ${r[i.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":""}: ${Q(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"}}};var TN=S(()=>{Ie()});function Xu(){return{localeError:cW()}}var cW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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}`;return`\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 ${i}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":if(n.values.length===1)return`\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 ${ce(n.values[0])}`;return`\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 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\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} ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;return`\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 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\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} ${i}${n.minimum.toString()} ${s.unit}`;return`\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 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\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 "${i.prefix}"`;if(i.format==="ends_with")return`\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 "${i.suffix}"`;if(i.format==="includes")return`\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 "${i.includes}"`;if(i.format==="regex")return`\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 ${i.pattern}`;return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[i.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":""}: ${Q(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"}}};var n_=S(()=>{Ie()});function o_(){return Xu()}var $N=S(()=>{n_()});function i_(){return{localeError:lW()}}var lW=()=>{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"}};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",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",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},o={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\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`;return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":if(n.values.length===1)return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${ce(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;return`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${Q(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${i}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;return`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${i}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(i.format==="ends_with")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(i.format==="includes")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;if(i.format==="regex")return`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;return`\u063A\u0644\u0637 ${r[i.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":""}: ${Q(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"}}};var ON=S(()=>{Ie()});function s_(){return{localeError:uW()}}var uW=()=>{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",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${a}`;return`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${a}`}case"invalid_value":if(n.values.length===1)return`Noto\u2018g\u2018ri kirish: kutilgan ${ce(n.values[0])}`;return`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${s.unit} ${s.verb}`;return`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`;return`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Noto\u2018g\u2018ri satr: "${i.prefix}" bilan boshlanishi kerak`;if(i.format==="ends_with")return`Noto\u2018g\u2018ri satr: "${i.suffix}" bilan tugashi kerak`;if(i.format==="includes")return`Noto\u2018g\u2018ri satr: "${i.includes}" ni o\u2018z ichiga olishi kerak`;if(i.format==="regex")return`Noto\u2018g\u2018ri satr: ${i.pattern} shabloniga mos kelishi kerak`;return`Noto\u2018g\u2018ri ${r[i.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":""}: ${Q(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"}}};var CN=S(()=>{Ie()});function a_(){return{localeError:dW()}}var dW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},o={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`;return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":if(n.values.length===1)return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${ce(n.values[0])}`;return`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`;return`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`;return`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`;if(i.format==="ends_with")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`;if(i.format==="includes")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`;if(i.format==="regex")return`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`;return`${r[i.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: ${Q(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"}}};var PN=S(()=>{Ie()});function c_(){return{localeError:pW()}}var pW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u8F93\u5165"},o={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`;return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":if(n.values.length===1)return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${ce(n.values[0])}`;return`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`;return`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`;return`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`;if(i.format==="ends_with")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`;if(i.format==="includes")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`;if(i.format==="regex")return`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`;return`\u65E0\u6548${r[i.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): ${Q(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"}}};var zN=S(()=>{Ie()});function l_(){return{localeError:fW()}}var fW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u8F38\u5165"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${a}`;return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":if(n.values.length===1)return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${ce(n.values[0])}`;return`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`;return`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()} ${s.unit}`;return`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`;if(i.format==="ends_with")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`;if(i.format==="includes")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`;if(i.format==="regex")return`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`;return`\u7121\u6548\u7684 ${r[i.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${Q(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"}}};var NN=S(()=>{Ie()});function u_(){return{localeError:mW()}}var mW=()=>{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"}};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",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",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},o={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=le(n.input),a=o[s]??s;if(/^[A-Z]/.test(n.expected))return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`;return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":if(n.values.length===1)return`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${ce(n.values[0])}`;return`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${Q(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${s.verb} ${i}${n.maximum} ${s.unit}`;return`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.maximum}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${s.verb} ${i}${n.minimum} ${s.unit}`;return`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.minimum}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`;if(i.format==="ends_with")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`;if(i.format==="includes")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`;if(i.format==="regex")return`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`;return`A\u1E63\xEC\u1E63e: ${r[i.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: ${Q(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"}}};var DN=S(()=>{Ie()});var ed={};Lt(ed,{ar:()=>f0,az:()=>m0,be:()=>h0,bg:()=>g0,ca:()=>y0,cs:()=>b0,da:()=>S0,de:()=>v0,el:()=>w0,en:()=>Gu,eo:()=>_0,es:()=>E0,fa:()=>I0,fi:()=>A0,fr:()=>k0,frCA:()=>R0,he:()=>T0,hr:()=>$0,hu:()=>O0,hy:()=>C0,id:()=>P0,is:()=>z0,it:()=>N0,ja:()=>D0,ka:()=>L0,kh:()=>j0,km:()=>Qu,ko:()=>B0,lt:()=>U0,mk:()=>M0,ms:()=>q0,nl:()=>F0,no:()=>H0,ota:()=>J0,pl:()=>V0,ps:()=>K0,pt:()=>W0,ro:()=>G0,ru:()=>Q0,sl:()=>Y0,sv:()=>X0,ta:()=>e_,th:()=>t_,tr:()=>r_,ua:()=>o_,uk:()=>Xu,ur:()=>i_,uz:()=>s_,vi:()=>a_,yo:()=>u_,zhCN:()=>c_,zhTW:()=>l_});var d_=S(()=>{Zz();jz();Uz();Mz();qz();Fz();Hz();Jz();Kz();x0();Vz();Wz();Gz();Qz();Yz();Xz();eN();tN();rN();oN();iN();sN();aN();cN();lN();uN();Z0();dN();fN();mN();hN();gN();yN();bN();SN();vN();wN();xN();EN();IN();AN();kN();RN();TN();$N();n_();ON();CN();PN();zN();NN();DN()});class m_{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function qm(){return new m_}var LN,p_,f_,Vt;var td=S(()=>{p_=Symbol("ZodOutput"),f_=Symbol("ZodInput");(LN=globalThis).__zod_globalRegistry??(LN.__zod_globalRegistry=qm());Vt=globalThis.__zod_globalRegistry});function h_(e,t){return new e({type:"string",...pe(t)})}function g_(e,t){return new e({type:"string",coerce:!0,...pe(t)})}function Fm(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...pe(t)})}function rd(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...pe(t)})}function Hm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...pe(t)})}function Jm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...pe(t)})}function Km(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...pe(t)})}function Vm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...pe(t)})}function nd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...pe(t)})}function Wm(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...pe(t)})}function Gm(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...pe(t)})}function Qm(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...pe(t)})}function Ym(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...pe(t)})}function Xm(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...pe(t)})}function eh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...pe(t)})}function th(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...pe(t)})}function rh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...pe(t)})}function nh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...pe(t)})}function y_(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...pe(t)})}function oh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...pe(t)})}function ih(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...pe(t)})}function sh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...pe(t)})}function ah(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...pe(t)})}function ch(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...pe(t)})}function lh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...pe(t)})}function S_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...pe(t)})}function v_(e,t){return new e({type:"string",format:"date",check:"string_format",...pe(t)})}function w_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...pe(t)})}function x_(e,t){return new e({type:"string",format:"duration",check:"string_format",...pe(t)})}function __(e,t){return new e({type:"number",checks:[],...pe(t)})}function E_(e,t){return new e({type:"number",coerce:!0,checks:[],...pe(t)})}function I_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...pe(t)})}function A_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...pe(t)})}function k_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...pe(t)})}function R_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...pe(t)})}function T_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...pe(t)})}function $_(e,t){return new e({type:"boolean",...pe(t)})}function O_(e,t){return new e({type:"boolean",coerce:!0,...pe(t)})}function C_(e,t){return new e({type:"bigint",...pe(t)})}function P_(e,t){return new e({type:"bigint",coerce:!0,...pe(t)})}function z_(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...pe(t)})}function N_(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...pe(t)})}function D_(e,t){return new e({type:"symbol",...pe(t)})}function L_(e,t){return new e({type:"undefined",...pe(t)})}function Z_(e,t){return new e({type:"null",...pe(t)})}function j_(e){return new e({type:"any"})}function B_(e){return new e({type:"unknown"})}function U_(e,t){return new e({type:"never",...pe(t)})}function M_(e,t){return new e({type:"void",...pe(t)})}function q_(e,t){return new e({type:"date",...pe(t)})}function F_(e,t){return new e({type:"date",coerce:!0,...pe(t)})}function H_(e,t){return new e({type:"nan",...pe(t)})}function Fn(e,t){return new $m({check:"less_than",...pe(t),value:e,inclusive:!1})}function jr(e,t){return new $m({check:"less_than",...pe(t),value:e,inclusive:!0})}function Hn(e,t){return new Om({check:"greater_than",...pe(t),value:e,inclusive:!1})}function mr(e,t){return new Om({check:"greater_than",...pe(t),value:e,inclusive:!0})}function uh(e){return Hn(0,e)}function dh(e){return Fn(0,e)}function ph(e){return jr(0,e)}function fh(e){return mr(0,e)}function Ai(e,t){return new Dw({check:"multiple_of",...pe(t),value:e})}function ki(e,t){return new jw({check:"max_size",...pe(t),maximum:e})}function Jn(e,t){return new Bw({check:"min_size",...pe(t),minimum:e})}function Ms(e,t){return new Uw({check:"size_equals",...pe(t),size:e})}function qs(e,t){return new Mw({check:"max_length",...pe(t),maximum:e})}function ko(e,t){return new qw({check:"min_length",...pe(t),minimum:e})}function Fs(e,t){return new Fw({check:"length_equals",...pe(t),length:e})}function ac(e,t){return new Hw({check:"string_format",format:"regex",...pe(t),pattern:e})}function cc(e){return new Jw({check:"string_format",format:"lowercase",...pe(e)})}function lc(e){return new Kw({check:"string_format",format:"uppercase",...pe(e)})}function uc(e,t){return new Vw({check:"string_format",format:"includes",...pe(t),includes:e})}function dc(e,t){return new Ww({check:"string_format",format:"starts_with",...pe(t),prefix:e})}function pc(e,t){return new Gw({check:"string_format",format:"ends_with",...pe(t),suffix:e})}function mh(e,t,r){return new Qw({check:"property",property:e,schema:t,...pe(r)})}function fc(e,t){return new Yw({check:"mime_type",mime:e,...pe(t)})}function mn(e){return new Xw({check:"overwrite",tx:e})}function mc(e){return mn((t)=>t.normalize(e))}function hc(){return mn((e)=>e.trim())}function gc(){return mn((e)=>e.toLowerCase())}function yc(){return mn((e)=>e.toUpperCase())}function bc(){return mn((e)=>Kv(e))}function J_(e,t,r){return new e({type:"array",element:t,...pe(r)})}function gW(e,t,r){return new e({type:"union",options:t,...pe(r)})}function yW(e,t,r){return new e({type:"union",options:t,inclusive:!1,...pe(r)})}function bW(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...pe(o)})}function SW(e,t,r){return new e({type:"intersection",left:t,right:r})}function vW(e,t,r,o){let n=r instanceof Ne;return new e({type:"tuple",items:t,rest:n?r:null,...pe(n?o:r)})}function wW(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...pe(o)})}function xW(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...pe(o)})}function _W(e,t,r){return new e({type:"set",valueType:t,...pe(r)})}function EW(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map((n)=>[n,n])):t;return new e({type:"enum",entries:o,...pe(r)})}function IW(e,t,r){return new e({type:"enum",entries:t,...pe(r)})}function AW(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...pe(r)})}function K_(e,t){return new e({type:"file",...pe(t)})}function kW(e,t){return new e({type:"transform",transform:t})}function RW(e,t){return new e({type:"optional",innerType:t})}function TW(e,t){return new e({type:"nullable",innerType:t})}function $W(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r==="function"?r():Wv(r)}})}function OW(e,t,r){return new e({type:"nonoptional",innerType:t,...pe(r)})}function CW(e,t){return new e({type:"success",innerType:t})}function PW(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r==="function"?r:()=>r})}function zW(e,t,r){return new e({type:"pipe",in:t,out:r})}function NW(e,t){return new e({type:"readonly",innerType:t})}function DW(e,t,r){return new e({type:"template_literal",parts:t,...pe(r)})}function LW(e,t){return new e({type:"lazy",getter:t})}function ZW(e,t){return new e({type:"promise",innerType:t})}function V_(e,t,r){let o=pe(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function W_(e,t,r){return new e({type:"custom",check:"custom",fn:t,...pe(r)})}function G_(e,t){let r=ZN((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(ec(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(ec(i))}},e(o.value,o)),t);return r}function ZN(e,t){let r=new rt({check:"custom",...pe(t)});return r._zod.check=e,r}function Q_(e){let t=new rt({check:"describe"});return t._zod.onattach=[(r)=>{let o=Vt.get(r)??{};Vt.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Y_(e){let t=new rt({check:"meta"});return t._zod.onattach=[(r)=>{let o=Vt.get(r)??{};Vt.add(r,{...o,...e})}],t._zod.check=()=>{},t}function X_(e,t){let r=pe(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((h)=>typeof h==="string"?h.toLowerCase():h),n=n.map((h)=>typeof h==="string"?h.toLowerCase():h);let i=new Set(o),s=new Set(n),a=e.Codec??Wu,l=e.Boolean??Ku,d=new(e.String??Us)({type:"string",error:r.error}),p=new l({type:"boolean",error:r.error}),m=new a({type:"pipe",in:d,out:p,transform:(h,b)=>{let y=h;if(r.case!=="sensitive")y=y.toLowerCase();if(i.has(y))return!0;else if(s.has(y))return!1;else return b.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:b.value,inst:m,continue:!1}),{}},reverseTransform:(h,b)=>{if(h===!0)return o[0]||"true";else return n[0]||"false"},error:r.error});return m}function Sc(e,t,r,o={}){let n=pe(o),i={...pe(o),check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(a)=>r.test(a),...n};if(r instanceof RegExp)i.pattern=r;return new e(i)}var b_;var jN=S(()=>{Cm();td();p0();Ie();b_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function Ri(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Vt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function We(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let m=s.schema,h=t.processors[n.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);h(e,t,m,d)}let p=e._zod.parent;if(p){if(!s.ref)s.ref=p;We(p,t,d),t.seen.get(p).isParent=!0}}let l=t.metadataRegistry.get(e);if(l)Object.assign(s.schema,l);if(t.io==="input"&&hr(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Ti(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let l=o.get(a);if(l&&l!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let n=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??((b)=>b);if(p)return{ref:m(p)};let h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${m("__shared")}#/${a}/${h}`}}if(s[1]===r)return{ref:"#"};let u=`${"#"}/${a}/`,d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:l,defId:u}=n(s);if(a.def={...a.schema},u)a.defId=u;let d=a.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
250
250
|
|
|
251
|
-
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]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref"){i(s);continue}}}}function $i(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let l=e.seen.get(a);if(l.ref===null)return;let u=l.def??l.schema,d={...u},p=l.ref;if(l.ref=null,p){o(p);let h=e.seen.get(p),b=h.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(b);else Object.assign(u,b);if(Object.assign(u,d),a._zod.parent===p)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(!(v in d))delete u[v]}if(b.$ref&&h.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in h.def&&JSON.stringify(u[v])===JSON.stringify(h.def[v]))delete u[v]}}let m=a._zod.parent;if(m&&m!==p){o(m);let h=e.seen.get(m);if(h?.schema.$ref){if(u.$ref=h.schema.$ref,h.def)for(let b in u){if(b==="$ref"||b==="allOf")continue;if(b in h.def&&JSON.stringify(u[b])===JSON.stringify(h.def[b]))delete u[b]}}}e.override({zodSchema:a,jsonSchema:u,path:l.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};for(let a of e.seen.entries()){let l=a[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;s[l.defId]=l.def}}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else 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(a){throw Error("Error converting schema to JSON.")}}function hr(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return hr(o.element,r);if(o.type==="set")return hr(o.valueType,r);if(o.type==="lazy")return hr(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return hr(o.innerType,r);if(o.type==="intersection")return hr(o.left,r)||hr(o.right,r);if(o.type==="record"||o.type==="map")return hr(o.keyType,r)||hr(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return hr(o.in,r)||hr(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(hr(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(hr(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(hr(n,r))return!0;if(o.rest&&hr(o.rest,r))return!0;return!1}return!1}var eE=(e,t={})=>(r)=>{let o=Ri({...r,processors:t});return We(e,o),Ti(o,e),$i(o,e)},vc=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Ri({...n??{},target:i,io:t,processors:r});return We(e,s),Ti(s,e),$i(s,e)};var od=S(()=>{td()});function bh(e,t){if("_idmap"in e){let o=e,n=Ri({...t,processors:hh}),i={};for(let l of o._idmap.entries()){let[u,d]=l;We(d,n)}let s={},a={registry:o,uri:t?.uri,defs:i};n.external=a;for(let l of o._idmap.entries()){let[u,d]=l;Ti(n,d),s[u]=$i(n,d)}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[l]:i}}return{schemas:s}}let r=Ri({...t,processors:hh});return We(e,r),Ti(r,e),$i(r,e)}var jW,tE=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:a,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(a){if(n.format=jW[a]??a,n.format==="")delete n.format;if(a==="time")delete n.format}if(u)n.contentEncoding=u;if(l&&l.size>0){let d=[...l];if(d.length===1)n.pattern=d[0].source;else if(d.length>1)n.allOf=[...d.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},rE=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))n.type="integer";else n.type="number";let p=typeof d==="number"&&d>=(i??Number.NEGATIVE_INFINITY),m=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(h)n.minimum=d,n.exclusiveMinimum=!0;else n.exclusiveMinimum=d;else if(typeof i==="number")n.minimum=i;if(m)if(h)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof s==="number")n.maximum=s;if(typeof l==="number")n.multipleOf=l},nE=(e,t,r,o)=>{r.type="boolean"},oE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},iE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},sE=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},aE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},cE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},lE=(e,t,r,o)=>{r.not={}},uE=(e,t,r,o)=>{},dE=(e,t,r,o)=>{},pE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},fE=(e,t,r,o)=>{let n=e._zod.def,i=Du(n.entries);if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},mE=(e,t,r,o)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},hE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},gE=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},yE=(e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:l}=e._zod.bag;if(s!==void 0)i.minLength=s;if(a!==void 0)i.maxLength=a;if(l)if(l.length===1)i.contentMediaType=l[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=l.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},bE=(e,t,r,o)=>{r.type="boolean"},SE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},vE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},wE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},xE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},_E=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},EE=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;if(typeof s==="number")n.minItems=s;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=We(i.element,t,{...o,path:[...o.path,"items"]})},IE=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=We(s[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(s)),l=new Set([...a].filter((u)=>{let d=i.shape[u]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(l.size>0)n.required=Array.from(l);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=We(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},gh=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((a,l)=>We(a,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));if(i)r.oneOf=s;else r.anyOf=s},AE=(e,t,r,o)=>{let n=e._zod.def,i=We(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=We(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=l},kE=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((m,h)=>We(m,t,{...o,path:[...o.path,s,h]})),u=i.rest?We(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=l,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:l},u)n.items.anyOf.push(u);if(n.minItems=l.length,!u)n.maxItems=l.length}else if(n.items=l,u)n.additionalItems=u;let{minimum:d,maximum:p}=e._zod.bag;if(typeof d==="number")n.minItems=d;if(typeof p==="number")n.maxItems=p},RE=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let s=i.keyType,l=s._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let d=We(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of l)n.patternProperties[p.source]=d}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=We(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=We(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=s._zod.values;if(u){let d=[...u].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)n.required=d}},TE=(e,t,r,o)=>{let n=e._zod.def,i=We(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},$E=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},OE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},CE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},PE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},zE=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;We(s,t,o);let a=t.seen.get(e);a.ref=s},NE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},DE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},yh=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},LE=(e,t,r,o)=>{let n=e._zod.innerType;We(n,t,o);let i=t.seen.get(e);i.ref=n},hh;var id=S(()=>{od();Ie();jW={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hh={string:tE,number:rE,boolean:nE,bigint:oE,symbol:iE,null:sE,undefined:aE,void:cE,never:lE,any:uE,unknown:dE,date:pE,enum:fE,literal:mE,nan:hE,template_literal:gE,file:yE,success:bE,custom:SE,function:vE,transform:wE,map:xE,set:_E,array:EE,object:IE,union:gh,intersection:AE,tuple:kE,record:RE,nullable:TE,nonoptional:$E,default:OE,prefault:CE,catch:PE,pipe:zE,readonly:NE,promise:DE,optional:yh,lazy:LE}});class ZE{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(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";this.ctx=Ri({processors:hh,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return We(e,this.ctx,t)}emit(e,t){if(t){if(t.cycles)this.ctx.cycles=t.cycles;if(t.reused)this.ctx.reused=t.reused;if(t.external)this.ctx.external=t.external}Ti(this.ctx,e);let r=$i(this.ctx,e),{"~standard":o,...n}=r;return n}}var BN=S(()=>{id();od()});var UN={};var MN=()=>{};var ko={};Lt(ko,{$ZodAny:()=>zx,$ZodArray:()=>jx,$ZodAsyncError:()=>qn,$ZodBase64:()=>Ex,$ZodBase64URL:()=>Ix,$ZodBigInt:()=>jm,$ZodBigIntFormat:()=>$x,$ZodBoolean:()=>Ku,$ZodCIDRv4:()=>wx,$ZodCIDRv6:()=>xx,$ZodCUID:()=>lx,$ZodCUID2:()=>ux,$ZodCatch:()=>n0,$ZodCheck:()=>rt,$ZodCheckBigIntFormat:()=>Zw,$ZodCheckEndsWith:()=>Gw,$ZodCheckGreaterThan:()=>Om,$ZodCheckIncludes:()=>Vw,$ZodCheckLengthEquals:()=>Fw,$ZodCheckLessThan:()=>$m,$ZodCheckLowerCase:()=>Jw,$ZodCheckMaxLength:()=>Mw,$ZodCheckMaxSize:()=>jw,$ZodCheckMimeType:()=>Yw,$ZodCheckMinLength:()=>qw,$ZodCheckMinSize:()=>Bw,$ZodCheckMultipleOf:()=>Dw,$ZodCheckNumberFormat:()=>Lw,$ZodCheckOverwrite:()=>Xw,$ZodCheckProperty:()=>Qw,$ZodCheckRegex:()=>Hw,$ZodCheckSizeEquals:()=>Uw,$ZodCheckStartsWith:()=>Ww,$ZodCheckStringFormat:()=>ic,$ZodCheckUpperCase:()=>Kw,$ZodCodec:()=>Wu,$ZodCustom:()=>d0,$ZodCustomStringFormat:()=>Rx,$ZodDate:()=>Zx,$ZodDefault:()=>Xx,$ZodDiscriminatedUnion:()=>Mx,$ZodE164:()=>Ax,$ZodEmail:()=>ix,$ZodEmoji:()=>ax,$ZodEncodeError:()=>Ls,$ZodEnum:()=>Kx,$ZodError:()=>Uu,$ZodExactOptional:()=>Qx,$ZodFile:()=>Wx,$ZodFunction:()=>c0,$ZodGUID:()=>nx,$ZodIPv4:()=>bx,$ZodIPv6:()=>Sx,$ZodISODate:()=>hx,$ZodISODateTime:()=>mx,$ZodISODuration:()=>yx,$ZodISOTime:()=>gx,$ZodIntersection:()=>qx,$ZodJWT:()=>kx,$ZodKSUID:()=>fx,$ZodLazy:()=>u0,$ZodLiteral:()=>Vx,$ZodMAC:()=>vx,$ZodMap:()=>Hx,$ZodNaN:()=>o0,$ZodNanoID:()=>cx,$ZodNever:()=>Dx,$ZodNonOptional:()=>t0,$ZodNull:()=>Px,$ZodNullable:()=>Yx,$ZodNumber:()=>Zm,$ZodNumberFormat:()=>Tx,$ZodObject:()=>Lz,$ZodObjectJIT:()=>Bx,$ZodOptional:()=>Um,$ZodPipe:()=>Mm,$ZodPrefault:()=>e0,$ZodPreprocess:()=>i0,$ZodPromise:()=>l0,$ZodReadonly:()=>s0,$ZodRealError:()=>Er,$ZodRecord:()=>Fx,$ZodRegistry:()=>m_,$ZodSet:()=>Jx,$ZodString:()=>Us,$ZodStringFormat:()=>Xe,$ZodSuccess:()=>r0,$ZodSymbol:()=>Ox,$ZodTemplateLiteral:()=>a0,$ZodTransform:()=>Gx,$ZodTuple:()=>Bm,$ZodType:()=>Ne,$ZodULID:()=>dx,$ZodURL:()=>sx,$ZodUUID:()=>ox,$ZodUndefined:()=>Cx,$ZodUnion:()=>Vu,$ZodUnknown:()=>Nx,$ZodVoid:()=>Lx,$ZodXID:()=>px,$ZodXor:()=>Ux,$brand:()=>Fv,$constructor:()=>B,$input:()=>f_,$output:()=>p_,Doc:()=>Pm,JSONSchema:()=>UN,JSONSchemaGenerator:()=>ZE,NEVER:()=>qv,TimePrecision:()=>b_,_any:()=>j_,_array:()=>J_,_base64:()=>sh,_base64url:()=>ah,_bigint:()=>C_,_boolean:()=>$_,_catch:()=>PW,_check:()=>ZN,_cidrv4:()=>oh,_cidrv6:()=>ih,_coercedBigint:()=>P_,_coercedBoolean:()=>O_,_coercedDate:()=>F_,_coercedNumber:()=>E_,_coercedString:()=>g_,_cuid:()=>Qm,_cuid2:()=>Ym,_custom:()=>V_,_date:()=>q_,_decode:()=>wm,_decodeAsync:()=>_m,_default:()=>$W,_discriminatedUnion:()=>bW,_e164:()=>ch,_email:()=>Fm,_emoji:()=>Wm,_encode:()=>vm,_encodeAsync:()=>xm,_endsWith:()=>pc,_enum:()=>EW,_file:()=>K_,_float32:()=>A_,_float64:()=>k_,_gt:()=>Hn,_gte:()=>mr,_guid:()=>rd,_includes:()=>uc,_int:()=>I_,_int32:()=>R_,_int64:()=>z_,_intersection:()=>SW,_ipv4:()=>rh,_ipv6:()=>nh,_isoDate:()=>v_,_isoDateTime:()=>S_,_isoDuration:()=>x_,_isoTime:()=>w_,_jwt:()=>lh,_ksuid:()=>th,_lazy:()=>LW,_length:()=>Fs,_literal:()=>AW,_lowercase:()=>cc,_lt:()=>Fn,_lte:()=>jr,_mac:()=>y_,_map:()=>xW,_max:()=>jr,_maxLength:()=>qs,_maxSize:()=>ki,_mime:()=>fc,_min:()=>mr,_minLength:()=>Ao,_minSize:()=>Jn,_multipleOf:()=>Ai,_nan:()=>H_,_nanoid:()=>Gm,_nativeEnum:()=>IW,_negative:()=>dh,_never:()=>U_,_nonnegative:()=>fh,_nonoptional:()=>OW,_nonpositive:()=>ph,_normalize:()=>mc,_null:()=>Z_,_nullable:()=>TW,_number:()=>__,_optional:()=>RW,_overwrite:()=>mn,_parse:()=>tc,_parseAsync:()=>rc,_pipe:()=>zW,_positive:()=>uh,_promise:()=>ZW,_property:()=>mh,_readonly:()=>NW,_record:()=>wW,_refine:()=>W_,_regex:()=>ac,_safeDecode:()=>Im,_safeDecodeAsync:()=>km,_safeEncode:()=>Em,_safeEncodeAsync:()=>Am,_safeParse:()=>nc,_safeParseAsync:()=>oc,_set:()=>_W,_size:()=>Ms,_slugify:()=>bc,_startsWith:()=>dc,_string:()=>h_,_stringFormat:()=>Sc,_stringbool:()=>X_,_success:()=>CW,_superRefine:()=>G_,_symbol:()=>D_,_templateLiteral:()=>DW,_toLowerCase:()=>gc,_toUpperCase:()=>yc,_transform:()=>kW,_trim:()=>hc,_tuple:()=>vW,_uint32:()=>T_,_uint64:()=>N_,_ulid:()=>Xm,_undefined:()=>L_,_union:()=>gW,_unknown:()=>B_,_uppercase:()=>lc,_url:()=>nd,_uuid:()=>Hm,_uuidv4:()=>Jm,_uuidv6:()=>Km,_uuidv7:()=>Vm,_void:()=>M_,_xid:()=>eh,_xor:()=>yW,clone:()=>pr,config:()=>gt,createStandardJSONSchemaMethod:()=>vc,createToJSONSchemaMethod:()=>eE,decode:()=>Z9,decodeAsync:()=>B9,describe:()=>Q_,encode:()=>L9,encodeAsync:()=>j9,extractDefs:()=>Ti,finalize:()=>$i,flattenError:()=>Mu,formatError:()=>qu,globalConfig:()=>Ds,globalRegistry:()=>Vt,initializeContext:()=>Ri,isValidBase64:()=>_x,isValidBase64URL:()=>Pz,isValidJWT:()=>zz,locales:()=>ed,meta:()=>Y_,parse:()=>bm,parseAsync:()=>Sm,prettifyError:()=>rw,process:()=>We,regexes:()=>Zr,registry:()=>qm,safeDecode:()=>M9,safeDecodeAsync:()=>F9,safeEncode:()=>U9,safeEncodeAsync:()=>q9,safeParse:()=>ow,safeParseAsync:()=>iw,toDotPath:()=>pz,toJSONSchema:()=>bh,treeifyError:()=>tw,util:()=>ue,version:()=>ex});var Br=S(()=>{Ie();Tm();d_();id();BN();MN();Zs();sw();nw();p0();Cm();tx();td();jN();od()});var Sh={};Lt(Sh,{endsWith:()=>pc,gt:()=>Hn,gte:()=>mr,includes:()=>uc,length:()=>Fs,lowercase:()=>cc,lt:()=>Fn,lte:()=>jr,maxLength:()=>qs,maxSize:()=>ki,mime:()=>fc,minLength:()=>Ao,minSize:()=>Jn,multipleOf:()=>Ai,negative:()=>dh,nonnegative:()=>fh,nonpositive:()=>ph,normalize:()=>mc,overwrite:()=>mn,positive:()=>uh,property:()=>mh,regex:()=>ac,size:()=>Ms,slugify:()=>bc,startsWith:()=>dc,toLowerCase:()=>gc,toUpperCase:()=>yc,trim:()=>hc,uppercase:()=>lc});var vh=S(()=>{Br()});var wc={};Lt(wc,{ZodISODate:()=>xh,ZodISODateTime:()=>wh,ZodISODuration:()=>Eh,ZodISOTime:()=>_h,date:()=>BE,datetime:()=>jE,duration:()=>ME,time:()=>UE});function jE(e){return S_(wh,e)}function BE(e){return v_(xh,e)}function UE(e){return w_(_h,e)}function ME(e){return x_(Eh,e)}var wh,xh,_h,Eh;var sd=S(()=>{Br();cd();wh=B("ZodISODateTime",(e,t)=>{mx.init(e,t),et.init(e,t)});xh=B("ZodISODate",(e,t)=>{hx.init(e,t),et.init(e,t)});_h=B("ZodISOTime",(e,t)=>{gx.init(e,t),et.init(e,t)});Eh=B("ZodISODuration",(e,t)=>{yx.init(e,t),et.init(e,t)})});var qN=(e,t)=>{Uu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>qu(e,r)},flatten:{value:(r)=>Mu(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ya,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ya,2)}},isEmpty:{get(){return e.issues.length===0}}})},FN,Ir;var qE=S(()=>{Br();Br();Ie();FN=B("ZodError",qN),Ir=B("ZodError",qN,{Parent:Error})});var FE,HE,JE,KE,VE,WE,GE,QE,YE,XE,eI,tI;var rI=S(()=>{Br();qE();FE=tc(Ir),HE=rc(Ir),JE=nc(Ir),KE=oc(Ir),VE=vm(Ir),WE=wm(Ir),GE=xm(Ir),QE=_m(Ir),YE=Em(Ir),XE=Im(Ir),eI=Am(Ir),tI=km(Ir)});var ad={};Lt(ad,{ZodAny:()=>uI,ZodArray:()=>mI,ZodBase64:()=>Bh,ZodBase64URL:()=>Uh,ZodBigInt:()=>Rc,ZodBigIntFormat:()=>Fh,ZodBoolean:()=>kc,ZodCIDRv4:()=>Zh,ZodCIDRv6:()=>jh,ZodCUID:()=>Oh,ZodCUID2:()=>Ch,ZodCatch:()=>DI,ZodCodec:()=>vd,ZodCustom:()=>wd,ZodCustomStringFormat:()=>Ic,ZodDate:()=>hd,ZodDefault:()=>$I,ZodDiscriminatedUnion:()=>gI,ZodE164:()=>Mh,ZodEmail:()=>Rh,ZodEmoji:()=>Th,ZodEnum:()=>_c,ZodExactOptional:()=>kI,ZodFile:()=>II,ZodFunction:()=>JI,ZodGUID:()=>ud,ZodIPv4:()=>Dh,ZodIPv6:()=>Lh,ZodIntersection:()=>yI,ZodJWT:()=>qh,ZodKSUID:()=>Nh,ZodLazy:()=>qI,ZodLiteral:()=>EI,ZodMAC:()=>nI,ZodMap:()=>xI,ZodNaN:()=>ZI,ZodNanoID:()=>$h,ZodNever:()=>pI,ZodNonOptional:()=>Gh,ZodNull:()=>cI,ZodNullable:()=>TI,ZodNumber:()=>Ac,ZodNumberFormat:()=>Js,ZodObject:()=>yd,ZodOptional:()=>Wh,ZodPipe:()=>Sd,ZodPrefault:()=>CI,ZodPreprocess:()=>jI,ZodPromise:()=>HI,ZodReadonly:()=>BI,ZodRecord:()=>xc,ZodSet:()=>_I,ZodString:()=>Ec,ZodStringFormat:()=>et,ZodSuccess:()=>NI,ZodSymbol:()=>sI,ZodTemplateLiteral:()=>MI,ZodTransform:()=>AI,ZodTuple:()=>SI,ZodType:()=>Ze,ZodULID:()=>Ph,ZodURL:()=>md,ZodUUID:()=>Kn,ZodUndefined:()=>aI,ZodUnion:()=>bd,ZodUnknown:()=>dI,ZodVoid:()=>fI,ZodXID:()=>zh,ZodXor:()=>hI,_ZodString:()=>kh,_default:()=>OI,_function:()=>Y2,any:()=>T2,array:()=>gd,base64:()=>p2,base64url:()=>f2,bigint:()=>E2,boolean:()=>iI,catch:()=>LI,check:()=>X2,cidrv4:()=>u2,cidrv6:()=>d2,codec:()=>V2,cuid:()=>r2,cuid2:()=>n2,custom:()=>eD,date:()=>O2,describe:()=>tD,discriminatedUnion:()=>L2,e164:()=>m2,email:()=>JN,emoji:()=>e2,enum:()=>Kh,exactOptional:()=>RI,file:()=>F2,float32:()=>v2,float64:()=>w2,function:()=>Y2,guid:()=>KN,hash:()=>S2,hex:()=>b2,hostname:()=>y2,httpUrl:()=>XN,instanceof:()=>nD,int:()=>Ih,int32:()=>x2,int64:()=>I2,intersection:()=>bI,invertCodec:()=>W2,ipv4:()=>a2,ipv6:()=>l2,json:()=>iD,jwt:()=>h2,keyof:()=>C2,ksuid:()=>s2,lazy:()=>FI,literal:()=>q2,looseObject:()=>N2,looseRecord:()=>j2,mac:()=>c2,map:()=>B2,meta:()=>rD,nan:()=>K2,nanoid:()=>t2,nativeEnum:()=>M2,never:()=>Hh,nonoptional:()=>zI,null:()=>lI,nullable:()=>pd,nullish:()=>H2,number:()=>oI,object:()=>P2,optional:()=>dd,partialRecord:()=>Z2,pipe:()=>Ah,prefault:()=>PI,preprocess:()=>sD,promise:()=>Q2,readonly:()=>UI,record:()=>wI,refine:()=>KI,set:()=>U2,strictObject:()=>z2,string:()=>ld,stringFormat:()=>g2,stringbool:()=>oD,success:()=>J2,superRefine:()=>VI,symbol:()=>k2,templateLiteral:()=>G2,transform:()=>Vh,tuple:()=>vI,uint32:()=>_2,uint64:()=>A2,ulid:()=>o2,undefined:()=>R2,union:()=>Jh,unknown:()=>Hs,url:()=>YN,uuid:()=>VN,uuidv4:()=>WN,uuidv6:()=>GN,uuidv7:()=>QN,void:()=>$2,xid:()=>i2,xor:()=>D2});function fd(e,t,r){let o=Object.getPrototypeOf(e),n=HN.get(o);if(!n)n=new Set,HN.set(o,n);if(n.has(t))return;n.add(t);for(let i in r){let s=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}function ld(e){return h_(Ec,e)}function JN(e){return Fm(Rh,e)}function KN(e){return rd(ud,e)}function VN(e){return Hm(Kn,e)}function WN(e){return Jm(Kn,e)}function GN(e){return Km(Kn,e)}function QN(e){return Vm(Kn,e)}function YN(e){return nd(md,e)}function XN(e){return nd(md,{protocol:Zr.httpProtocol,hostname:Zr.domain,...ue.normalizeParams(e)})}function e2(e){return Wm(Th,e)}function t2(e){return Gm($h,e)}function r2(e){return Qm(Oh,e)}function n2(e){return Ym(Ch,e)}function o2(e){return Xm(Ph,e)}function i2(e){return eh(zh,e)}function s2(e){return th(Nh,e)}function a2(e){return rh(Dh,e)}function c2(e){return y_(nI,e)}function l2(e){return nh(Lh,e)}function u2(e){return oh(Zh,e)}function d2(e){return ih(jh,e)}function p2(e){return sh(Bh,e)}function f2(e){return ah(Uh,e)}function m2(e){return ch(Mh,e)}function h2(e){return lh(qh,e)}function g2(e,t,r={}){return Sc(Ic,e,t,r)}function y2(e){return Sc(Ic,"hostname",Zr.hostname,e)}function b2(e){return Sc(Ic,"hex",Zr.hex,e)}function S2(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=Zr[o];if(!n)throw Error(`Unrecognized hash format: ${o}`);return Sc(Ic,o,n,t)}function oI(e){return __(Ac,e)}function Ih(e){return I_(Js,e)}function v2(e){return A_(Js,e)}function w2(e){return k_(Js,e)}function x2(e){return R_(Js,e)}function _2(e){return T_(Js,e)}function iI(e){return $_(kc,e)}function E2(e){return C_(Rc,e)}function I2(e){return z_(Fh,e)}function A2(e){return N_(Fh,e)}function k2(e){return D_(sI,e)}function R2(e){return L_(aI,e)}function lI(e){return Z_(cI,e)}function T2(){return j_(uI)}function Hs(){return B_(dI)}function Hh(e){return U_(pI,e)}function $2(e){return M_(fI,e)}function O2(e){return q_(hd,e)}function gd(e,t){return J_(mI,e,t)}function C2(e){let t=e._zod.def.shape;return Kh(Object.keys(t))}function P2(e,t){let r={type:"object",shape:e??{},...ue.normalizeParams(t)};return new yd(r)}function z2(e,t){return new yd({type:"object",shape:e,catchall:Hh(),...ue.normalizeParams(t)})}function N2(e,t){return new yd({type:"object",shape:e,catchall:Hs(),...ue.normalizeParams(t)})}function Jh(e,t){return new bd({type:"union",options:e,...ue.normalizeParams(t)})}function D2(e,t){return new hI({type:"union",options:e,inclusive:!1,...ue.normalizeParams(t)})}function L2(e,t,r){return new gI({type:"union",options:t,discriminator:e,...ue.normalizeParams(r)})}function bI(e,t){return new yI({type:"intersection",left:e,right:t})}function vI(e,t,r){let o=t instanceof Ne,n=o?r:t;return new SI({type:"tuple",items:e,rest:o?t:null,...ue.normalizeParams(n)})}function wI(e,t,r){if(!t||!t._zod)return new xc({type:"record",keyType:ld(),valueType:e,...ue.normalizeParams(t)});return new xc({type:"record",keyType:e,valueType:t,...ue.normalizeParams(r)})}function Z2(e,t,r){let o=pr(e);return o._zod.values=void 0,new xc({type:"record",keyType:o,valueType:t,...ue.normalizeParams(r)})}function j2(e,t,r){return new xc({type:"record",keyType:e,valueType:t,mode:"loose",...ue.normalizeParams(r)})}function B2(e,t,r){return new xI({type:"map",keyType:e,valueType:t,...ue.normalizeParams(r)})}function U2(e,t){return new _I({type:"set",valueType:e,...ue.normalizeParams(t)})}function Kh(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new _c({type:"enum",entries:r,...ue.normalizeParams(t)})}function M2(e,t){return new _c({type:"enum",entries:e,...ue.normalizeParams(t)})}function q2(e,t){return new EI({type:"literal",values:Array.isArray(e)?e:[e],...ue.normalizeParams(t)})}function F2(e){return K_(II,e)}function Vh(e){return new AI({type:"transform",transform:e})}function dd(e){return new Wh({type:"optional",innerType:e})}function RI(e){return new kI({type:"optional",innerType:e})}function pd(e){return new TI({type:"nullable",innerType:e})}function H2(e){return dd(pd(e))}function OI(e,t){return new $I({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ue.shallowClone(t)}})}function PI(e,t){return new CI({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ue.shallowClone(t)}})}function zI(e,t){return new Gh({type:"nonoptional",innerType:e,...ue.normalizeParams(t)})}function J2(e){return new NI({type:"success",innerType:e})}function LI(e,t){return new DI({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}function K2(e){return H_(ZI,e)}function Ah(e,t){return new Sd({type:"pipe",in:e,out:t})}function V2(e,t,r){return new vd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function W2(e){let t=e._zod.def;return new vd({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function UI(e){return new BI({type:"readonly",innerType:e})}function G2(e,t){return new MI({type:"template_literal",parts:e,...ue.normalizeParams(t)})}function FI(e){return new qI({type:"lazy",getter:e})}function Q2(e){return new HI({type:"promise",innerType:e})}function Y2(e){return new JI({type:"function",input:Array.isArray(e?.input)?vI(e?.input):e?.input??gd(Hs()),output:e?.output??Hs()})}function X2(e){let t=new rt({check:"custom"});return t._zod.check=e,t}function eD(e,t){return V_(wd,e??(()=>!0),t)}function KI(e,t={}){return W_(wd,e,t)}function VI(e,t){return G_(e,t)}function nD(e,t={}){let r=new wd({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...ue.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=(o)=>{if(!(o.value instanceof e))o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}function iD(e){let t=FI(()=>Jh([ld(e),oI(),iI(),lI(),gd(t),wI(ld(),t)]));return t}function sD(e,t){return new jI({type:"pipe",in:Vh(e),out:t})}var HN,Ze,kh,Ec,et,Rh,ud,Kn,md,Th,$h,Oh,Ch,Ph,zh,Nh,Dh,nI,Lh,Zh,jh,Bh,Uh,Mh,qh,Ic,Ac,Js,kc,Rc,Fh,sI,aI,cI,uI,dI,pI,fI,hd,mI,yd,bd,hI,gI,yI,SI,xc,xI,_I,_c,EI,II,AI,Wh,kI,TI,$I,CI,Gh,NI,DI,ZI,Sd,vd,jI,BI,MI,qI,HI,JI,wd,tD,rD,oD=(...e)=>X_({Codec:vd,Boolean:kc,String:Ec},...e);var cd=S(()=>{Br();Br();id();od();vh();sd();rI();HN=new WeakMap;Ze=B("ZodType",(e,t)=>(Ne.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:vc(e,"input"),output:vc(e,"output")}}),e.toJSONSchema=eE(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>FE(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>JE(e,r,o),e.parseAsync=async(r,o)=>HE(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>KE(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>VE(e,r,o),e.decode=(r,o)=>WE(e,r,o),e.encodeAsync=async(r,o)=>GE(e,r,o),e.decodeAsync=async(r,o)=>QE(e,r,o),e.safeEncode=(r,o)=>YE(e,r,o),e.safeDecode=(r,o)=>XE(e,r,o),e.safeEncodeAsync=async(r,o)=>eI(e,r,o),e.safeDecodeAsync=async(r,o)=>tI(e,r,o),fd(e,"ZodType",{check(...r){let o=this.def;return this.clone(ue.mergeDefs(o,{checks:[...o.checks??[],...r.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return pr(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(KI(r,o))},superRefine(r,o){return this.check(VI(r,o))},overwrite(r){return this.check(mn(r))},optional(){return dd(this)},exactOptional(){return RI(this)},nullable(){return pd(this)},nullish(){return dd(pd(this))},nonoptional(r){return zI(this,r)},array(){return gd(this)},or(r){return Jh([this,r])},and(r){return bI(this,r)},transform(r){return Ah(this,Vh(r))},default(r){return OI(this,r)},prefault(r){return PI(this,r)},catch(r){return LI(this,r)},pipe(r){return Ah(this,r)},readonly(){return UI(this)},describe(r){let o=this.clone();return Vt.add(o,{description:r}),o},meta(...r){if(r.length===0)return Vt.get(this);let o=this.clone();return Vt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Vt.get(e)?.description},configurable:!0}),e)),kh=B("_ZodString",(e,t)=>{Us.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>tE(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,fd(e,"_ZodString",{regex(...o){return this.check(ac(...o))},includes(...o){return this.check(uc(...o))},startsWith(...o){return this.check(dc(...o))},endsWith(...o){return this.check(pc(...o))},min(...o){return this.check(Ao(...o))},max(...o){return this.check(qs(...o))},length(...o){return this.check(Fs(...o))},nonempty(...o){return this.check(Ao(1,...o))},lowercase(o){return this.check(cc(o))},uppercase(o){return this.check(lc(o))},trim(){return this.check(hc())},normalize(...o){return this.check(mc(...o))},toLowerCase(){return this.check(gc())},toUpperCase(){return this.check(yc())},slugify(){return this.check(bc())}})}),Ec=B("ZodString",(e,t)=>{Us.init(e,t),kh.init(e,t),e.email=(r)=>e.check(Fm(Rh,r)),e.url=(r)=>e.check(nd(md,r)),e.jwt=(r)=>e.check(lh(qh,r)),e.emoji=(r)=>e.check(Wm(Th,r)),e.guid=(r)=>e.check(rd(ud,r)),e.uuid=(r)=>e.check(Hm(Kn,r)),e.uuidv4=(r)=>e.check(Jm(Kn,r)),e.uuidv6=(r)=>e.check(Km(Kn,r)),e.uuidv7=(r)=>e.check(Vm(Kn,r)),e.nanoid=(r)=>e.check(Gm($h,r)),e.guid=(r)=>e.check(rd(ud,r)),e.cuid=(r)=>e.check(Qm(Oh,r)),e.cuid2=(r)=>e.check(Ym(Ch,r)),e.ulid=(r)=>e.check(Xm(Ph,r)),e.base64=(r)=>e.check(sh(Bh,r)),e.base64url=(r)=>e.check(ah(Uh,r)),e.xid=(r)=>e.check(eh(zh,r)),e.ksuid=(r)=>e.check(th(Nh,r)),e.ipv4=(r)=>e.check(rh(Dh,r)),e.ipv6=(r)=>e.check(nh(Lh,r)),e.cidrv4=(r)=>e.check(oh(Zh,r)),e.cidrv6=(r)=>e.check(ih(jh,r)),e.e164=(r)=>e.check(ch(Mh,r)),e.datetime=(r)=>e.check(jE(r)),e.date=(r)=>e.check(BE(r)),e.time=(r)=>e.check(UE(r)),e.duration=(r)=>e.check(ME(r))});et=B("ZodStringFormat",(e,t)=>{Xe.init(e,t),kh.init(e,t)}),Rh=B("ZodEmail",(e,t)=>{ix.init(e,t),et.init(e,t)});ud=B("ZodGUID",(e,t)=>{nx.init(e,t),et.init(e,t)});Kn=B("ZodUUID",(e,t)=>{ox.init(e,t),et.init(e,t)});md=B("ZodURL",(e,t)=>{sx.init(e,t),et.init(e,t)});Th=B("ZodEmoji",(e,t)=>{ax.init(e,t),et.init(e,t)});$h=B("ZodNanoID",(e,t)=>{cx.init(e,t),et.init(e,t)});Oh=B("ZodCUID",(e,t)=>{lx.init(e,t),et.init(e,t)});Ch=B("ZodCUID2",(e,t)=>{ux.init(e,t),et.init(e,t)});Ph=B("ZodULID",(e,t)=>{dx.init(e,t),et.init(e,t)});zh=B("ZodXID",(e,t)=>{px.init(e,t),et.init(e,t)});Nh=B("ZodKSUID",(e,t)=>{fx.init(e,t),et.init(e,t)});Dh=B("ZodIPv4",(e,t)=>{bx.init(e,t),et.init(e,t)});nI=B("ZodMAC",(e,t)=>{vx.init(e,t),et.init(e,t)});Lh=B("ZodIPv6",(e,t)=>{Sx.init(e,t),et.init(e,t)});Zh=B("ZodCIDRv4",(e,t)=>{wx.init(e,t),et.init(e,t)});jh=B("ZodCIDRv6",(e,t)=>{xx.init(e,t),et.init(e,t)});Bh=B("ZodBase64",(e,t)=>{Ex.init(e,t),et.init(e,t)});Uh=B("ZodBase64URL",(e,t)=>{Ix.init(e,t),et.init(e,t)});Mh=B("ZodE164",(e,t)=>{Ax.init(e,t),et.init(e,t)});qh=B("ZodJWT",(e,t)=>{kx.init(e,t),et.init(e,t)});Ic=B("ZodCustomStringFormat",(e,t)=>{Rx.init(e,t),et.init(e,t)});Ac=B("ZodNumber",(e,t)=>{Zm.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>rE(e,o,n,i),fd(e,"ZodNumber",{gt(o,n){return this.check(Hn(o,n))},gte(o,n){return this.check(mr(o,n))},min(o,n){return this.check(mr(o,n))},lt(o,n){return this.check(Fn(o,n))},lte(o,n){return this.check(jr(o,n))},max(o,n){return this.check(jr(o,n))},int(o){return this.check(Ih(o))},safe(o){return this.check(Ih(o))},positive(o){return this.check(Hn(0,o))},nonnegative(o){return this.check(mr(0,o))},negative(o){return this.check(Fn(0,o))},nonpositive(o){return this.check(jr(0,o))},multipleOf(o,n){return this.check(Ai(o,n))},step(o,n){return this.check(Ai(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});Js=B("ZodNumberFormat",(e,t)=>{Tx.init(e,t),Ac.init(e,t)});kc=B("ZodBoolean",(e,t)=>{Ku.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nE(e,r,o,n)});Rc=B("ZodBigInt",(e,t)=>{jm.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>oE(e,o,n,i),e.gte=(o,n)=>e.check(mr(o,n)),e.min=(o,n)=>e.check(mr(o,n)),e.gt=(o,n)=>e.check(Hn(o,n)),e.gte=(o,n)=>e.check(mr(o,n)),e.min=(o,n)=>e.check(mr(o,n)),e.lt=(o,n)=>e.check(Fn(o,n)),e.lte=(o,n)=>e.check(jr(o,n)),e.max=(o,n)=>e.check(jr(o,n)),e.positive=(o)=>e.check(Hn(BigInt(0),o)),e.negative=(o)=>e.check(Fn(BigInt(0),o)),e.nonpositive=(o)=>e.check(jr(BigInt(0),o)),e.nonnegative=(o)=>e.check(mr(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Ai(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});Fh=B("ZodBigIntFormat",(e,t)=>{$x.init(e,t),Rc.init(e,t)});sI=B("ZodSymbol",(e,t)=>{Ox.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>iE(e,r,o,n)});aI=B("ZodUndefined",(e,t)=>{Cx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>aE(e,r,o,n)});cI=B("ZodNull",(e,t)=>{Px.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sE(e,r,o,n)});uI=B("ZodAny",(e,t)=>{zx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uE(e,r,o,n)});dI=B("ZodUnknown",(e,t)=>{Nx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dE(e,r,o,n)});pI=B("ZodNever",(e,t)=>{Dx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lE(e,r,o,n)});fI=B("ZodVoid",(e,t)=>{Lx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cE(e,r,o,n)});hd=B("ZodDate",(e,t)=>{Zx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>pE(e,o,n,i),e.min=(o,n)=>e.check(mr(o,n)),e.max=(o,n)=>e.check(jr(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});mI=B("ZodArray",(e,t)=>{jx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>EE(e,r,o,n),e.element=t.element,fd(e,"ZodArray",{min(r,o){return this.check(Ao(r,o))},nonempty(r){return this.check(Ao(1,r))},max(r,o){return this.check(qs(r,o))},length(r,o){return this.check(Fs(r,o))},unwrap(){return this.element}})});yd=B("ZodObject",(e,t)=>{Bx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>IE(e,r,o,n),ue.defineLazy(e,"shape",()=>t.shape),fd(e,"ZodObject",{keyof(){return Kh(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Hs()})},loose(){return this.clone({...this._zod.def,catchall:Hs()})},strict(){return this.clone({...this._zod.def,catchall:Hh()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return ue.extend(this,r)},safeExtend(r){return ue.safeExtend(this,r)},merge(r){return ue.merge(this,r)},pick(r){return ue.pick(this,r)},omit(r){return ue.omit(this,r)},partial(...r){return ue.partial(Wh,this,r[0])},required(...r){return ue.required(Gh,this,r[0])}})});bd=B("ZodUnion",(e,t)=>{Vu.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gh(e,r,o,n),e.options=t.options});hI=B("ZodXor",(e,t)=>{bd.init(e,t),Ux.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gh(e,r,o,n),e.options=t.options});gI=B("ZodDiscriminatedUnion",(e,t)=>{bd.init(e,t),Mx.init(e,t)});yI=B("ZodIntersection",(e,t)=>{qx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>AE(e,r,o,n)});SI=B("ZodTuple",(e,t)=>{Bm.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kE(e,r,o,n),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});xc=B("ZodRecord",(e,t)=>{Fx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>RE(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});xI=B("ZodMap",(e,t)=>{Hx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xE(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Jn(...r)),e.nonempty=(r)=>e.check(Jn(1,r)),e.max=(...r)=>e.check(ki(...r)),e.size=(...r)=>e.check(Ms(...r))});_I=B("ZodSet",(e,t)=>{Jx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_E(e,r,o,n),e.min=(...r)=>e.check(Jn(...r)),e.nonempty=(r)=>e.check(Jn(1,r)),e.max=(...r)=>e.check(ki(...r)),e.size=(...r)=>e.check(Ms(...r))});_c=B("ZodEnum",(e,t)=>{Kx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>fE(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new _c({...t,checks:[],...ue.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new _c({...t,checks:[],...ue.normalizeParams(n),entries:i})}});EI=B("ZodLiteral",(e,t)=>{Vx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mE(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});II=B("ZodFile",(e,t)=>{Wx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yE(e,r,o,n),e.min=(r,o)=>e.check(Jn(r,o)),e.max=(r,o)=>e.check(ki(r,o)),e.mime=(r,o)=>e.check(fc(Array.isArray(r)?r:[r],o))});AI=B("ZodTransform",(e,t)=>{Gx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wE(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ls(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ue.issue(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(ue.issue(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r.fallback=!0,r));return r.value=n,r.fallback=!0,r}});Wh=B("ZodOptional",(e,t)=>{Um.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});kI=B("ZodExactOptional",(e,t)=>{Qx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});TI=B("ZodNullable",(e,t)=>{Yx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>TE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});$I=B("ZodDefault",(e,t)=>{Xx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>OE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});CI=B("ZodPrefault",(e,t)=>{e0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>CE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});Gh=B("ZodNonOptional",(e,t)=>{t0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$E(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});NI=B("ZodSuccess",(e,t)=>{r0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});DI=B("ZodCatch",(e,t)=>{n0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>PE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});ZI=B("ZodNaN",(e,t)=>{o0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hE(e,r,o,n)});Sd=B("ZodPipe",(e,t)=>{Mm.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zE(e,r,o,n),e.in=t.in,e.out=t.out});vd=B("ZodCodec",(e,t)=>{Sd.init(e,t),Wu.init(e,t)});jI=B("ZodPreprocess",(e,t)=>{Sd.init(e,t),i0.init(e,t)}),BI=B("ZodReadonly",(e,t)=>{s0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>NE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});MI=B("ZodTemplateLiteral",(e,t)=>{a0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gE(e,r,o,n)});qI=B("ZodLazy",(e,t)=>{u0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>LE(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});HI=B("ZodPromise",(e,t)=>{l0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>DE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});JI=B("ZodFunction",(e,t)=>{c0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vE(e,r,o,n)});wd=B("ZodCustom",(e,t)=>{d0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>SE(e,r,o,n)});tD=Q_,rD=Y_});function qW(e){gt({customError:e})}function FW(){return gt().customError}var MW,WI;var aD=S(()=>{Br();MW={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(e){})(WI||(WI={}))});function JW(e,t){let r=e.$schema;if(r==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(r==="http://json-schema.org/draft-07/schema#")return"draft-7";if(r==="http://json-schema.org/draft-04/schema#")return"draft-4";return t??"draft-2020-12"}function KW(e,t){if(!e.startsWith("#"))throw 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 o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}function cD(e,t){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return ve.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw 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 ve.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=KW(n,t),s=rr(i,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 ve.null();if(n.length===0)return ve.never();if(n.length===1)return ve.literal(n[0]);if(n.every((s)=>typeof s==="string"))return ve.enum(n);let i=n.map((s)=>ve.literal(s));if(i.length<2)return i[0];return ve.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return ve.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map((i)=>{let s={...e,type:i};return cD(s,t)});if(n.length===0)return ve.never();if(n.length===1)return n[0];return ve.union(n)}if(!r)return ve.any();let o;switch(r){case"string":{let n=ve.string();if(e.format){let i=e.format;if(i==="email")n=n.check(ve.email());else if(i==="uri"||i==="uri-reference")n=n.check(ve.url());else if(i==="uuid"||i==="guid")n=n.check(ve.uuid());else if(i==="date-time")n=n.check(ve.iso.datetime());else if(i==="date")n=n.check(ve.iso.date());else if(i==="time")n=n.check(ve.iso.time());else if(i==="duration")n=n.check(ve.iso.duration());else if(i==="ipv4")n=n.check(ve.ipv4());else if(i==="ipv6")n=n.check(ve.ipv6());else if(i==="mac")n=n.check(ve.mac());else if(i==="cidr")n=n.check(ve.cidrv4());else if(i==="cidr-v6")n=n.check(ve.cidrv6());else if(i==="base64")n=n.check(ve.base64());else if(i==="base64url")n=n.check(ve.base64url());else if(i==="e164")n=n.check(ve.e164());else if(i==="jwt")n=n.check(ve.jwt());else if(i==="emoji")n=n.check(ve.emoji());else if(i==="nanoid")n=n.check(ve.nanoid());else if(i==="cuid")n=n.check(ve.cuid());else if(i==="cuid2")n=n.check(ve.cuid2());else if(i==="ulid")n=n.check(ve.ulid());else if(i==="xid")n=n.check(ve.xid());else if(i==="ksuid")n=n.check(ve.ksuid())}if(typeof e.minLength==="number")n=n.min(e.minLength);if(typeof e.maxLength==="number")n=n.max(e.maxLength);if(e.pattern)n=n.regex(new RegExp(e.pattern));o=n;break}case"number":case"integer":{let n=r==="integer"?ve.number().int():ve.number();if(typeof e.minimum==="number")n=n.min(e.minimum);if(typeof e.maximum==="number")n=n.max(e.maximum);if(typeof e.exclusiveMinimum==="number")n=n.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")n=n.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")n=n.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")n=n.lt(e.maximum);if(typeof e.multipleOf==="number")n=n.multipleOf(e.multipleOf);o=n;break}case"boolean":{o=ve.boolean();break}case"null":{o=ve.null();break}case"object":{let n={},i=e.properties||{},s=new Set(e.required||[]);for(let[l,u]of Object.entries(i)){let d=rr(u,t);n[l]=s.has(l)?d:d.optional()}if(e.propertyNames){let l=rr(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties==="object"?rr(e.additionalProperties,t):ve.any();if(Object.keys(n).length===0){o=ve.record(l,u);break}let d=ve.object(n).passthrough(),p=ve.looseRecord(l,u);o=ve.intersection(d,p);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),d=[];for(let m of u){let h=rr(l[m],t),b=ve.string().regex(new RegExp(m));d.push(ve.looseRecord(b,h))}let p=[];if(Object.keys(n).length>0)p.push(ve.object(n).passthrough());if(p.push(...d),p.length===0)o=ve.object({}).passthrough();else if(p.length===1)o=p[0];else{let m=ve.intersection(p[0],p[1]);for(let h=2;h<p.length;h++)m=ve.intersection(m,p[h]);o=m}break}let a=ve.object(n);if(e.additionalProperties===!1)o=a.strict();else if(typeof e.additionalProperties==="object")o=a.catchall(rr(e.additionalProperties,t));else o=a.passthrough();break}case"array":{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let s=n.map((l)=>rr(l,t)),a=i&&typeof i==="object"&&!Array.isArray(i)?rr(i,t):void 0;if(a)o=ve.tuple(s).rest(a);else o=ve.tuple(s);if(typeof e.minItems==="number")o=o.check(ve.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(ve.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=i.map((l)=>rr(l,t)),a=e.additionalItems&&typeof e.additionalItems==="object"?rr(e.additionalItems,t):void 0;if(a)o=ve.tuple(s).rest(a);else o=ve.tuple(s);if(typeof e.minItems==="number")o=o.check(ve.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(ve.maxLength(e.maxItems))}else if(i!==void 0){let s=rr(i,t),a=ve.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);o=a}else o=ve.array(ve.any());break}default:throw Error(`Unsupported type: ${r}`)}return o}function rr(e,t){if(typeof e==="boolean")return e?ve.any():ve.never();let r=cD(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((u)=>rr(u,t)),l=ve.union(a);r=o?ve.intersection(r,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((u)=>rr(u,t)),l=ve.xor(a);r=o?ve.intersection(r,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:ve.any();else{let a=o?r:rr(e.allOf[0],t),l=o?0:1;for(let u=l;u<e.allOf.length;u++)a=ve.intersection(a,rr(e.allOf[u],t));r=a}if(e.nullable===!0&&t.version==="openapi-3.0")r=ve.nullable(r);if(e.readOnly===!0)r=ve.readonly(r);if(e.default!==void 0)r=r.default(e.default);let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)n[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)n[a]=e[a];for(let a of Object.keys(e))if(!HW.has(a))n[a]=e[a];if(Object.keys(n).length>0)t.registry.add(r,n);if(e.description)r=r.describe(e.description);return r}function lD(e,t){if(typeof e==="boolean")return e?ve.any():ve.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=JW(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Vt};return rr(r,i)}var ve,HW;var uD=S(()=>{td();vh();sd();cd();ve={...ad,...Sh,iso:wc},HW=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"])});var GI={};Lt(GI,{bigint:()=>QW,boolean:()=>GW,date:()=>YW,number:()=>WW,string:()=>VW});function VW(e){return g_(Ec,e)}function WW(e){return E_(Ac,e)}function GW(e){return O_(kc,e)}function QW(e){return P_(Rc,e)}function YW(e){return F_(hd,e)}var dD=S(()=>{Br();cd()});var c={};Lt(c,{$brand:()=>Fv,$input:()=>f_,$output:()=>p_,NEVER:()=>qv,TimePrecision:()=>b_,ZodAny:()=>uI,ZodArray:()=>mI,ZodBase64:()=>Bh,ZodBase64URL:()=>Uh,ZodBigInt:()=>Rc,ZodBigIntFormat:()=>Fh,ZodBoolean:()=>kc,ZodCIDRv4:()=>Zh,ZodCIDRv6:()=>jh,ZodCUID:()=>Oh,ZodCUID2:()=>Ch,ZodCatch:()=>DI,ZodCodec:()=>vd,ZodCustom:()=>wd,ZodCustomStringFormat:()=>Ic,ZodDate:()=>hd,ZodDefault:()=>$I,ZodDiscriminatedUnion:()=>gI,ZodE164:()=>Mh,ZodEmail:()=>Rh,ZodEmoji:()=>Th,ZodEnum:()=>_c,ZodError:()=>FN,ZodExactOptional:()=>kI,ZodFile:()=>II,ZodFirstPartyTypeKind:()=>WI,ZodFunction:()=>JI,ZodGUID:()=>ud,ZodIPv4:()=>Dh,ZodIPv6:()=>Lh,ZodISODate:()=>xh,ZodISODateTime:()=>wh,ZodISODuration:()=>Eh,ZodISOTime:()=>_h,ZodIntersection:()=>yI,ZodIssueCode:()=>MW,ZodJWT:()=>qh,ZodKSUID:()=>Nh,ZodLazy:()=>qI,ZodLiteral:()=>EI,ZodMAC:()=>nI,ZodMap:()=>xI,ZodNaN:()=>ZI,ZodNanoID:()=>$h,ZodNever:()=>pI,ZodNonOptional:()=>Gh,ZodNull:()=>cI,ZodNullable:()=>TI,ZodNumber:()=>Ac,ZodNumberFormat:()=>Js,ZodObject:()=>yd,ZodOptional:()=>Wh,ZodPipe:()=>Sd,ZodPrefault:()=>CI,ZodPreprocess:()=>jI,ZodPromise:()=>HI,ZodReadonly:()=>BI,ZodRealError:()=>Ir,ZodRecord:()=>xc,ZodSet:()=>_I,ZodString:()=>Ec,ZodStringFormat:()=>et,ZodSuccess:()=>NI,ZodSymbol:()=>sI,ZodTemplateLiteral:()=>MI,ZodTransform:()=>AI,ZodTuple:()=>SI,ZodType:()=>Ze,ZodULID:()=>Ph,ZodURL:()=>md,ZodUUID:()=>Kn,ZodUndefined:()=>aI,ZodUnion:()=>bd,ZodUnknown:()=>dI,ZodVoid:()=>fI,ZodXID:()=>zh,ZodXor:()=>hI,_ZodString:()=>kh,_default:()=>OI,_function:()=>Y2,any:()=>T2,array:()=>gd,base64:()=>p2,base64url:()=>f2,bigint:()=>E2,boolean:()=>iI,catch:()=>LI,check:()=>X2,cidrv4:()=>u2,cidrv6:()=>d2,clone:()=>pr,codec:()=>V2,coerce:()=>GI,config:()=>gt,core:()=>ko,cuid:()=>r2,cuid2:()=>n2,custom:()=>eD,date:()=>O2,decode:()=>WE,decodeAsync:()=>QE,describe:()=>tD,discriminatedUnion:()=>L2,e164:()=>m2,email:()=>JN,emoji:()=>e2,encode:()=>VE,encodeAsync:()=>GE,endsWith:()=>pc,enum:()=>Kh,exactOptional:()=>RI,file:()=>F2,flattenError:()=>Mu,float32:()=>v2,float64:()=>w2,formatError:()=>qu,fromJSONSchema:()=>lD,function:()=>Y2,getErrorMap:()=>FW,globalRegistry:()=>Vt,gt:()=>Hn,gte:()=>mr,guid:()=>KN,hash:()=>S2,hex:()=>b2,hostname:()=>y2,httpUrl:()=>XN,includes:()=>uc,instanceof:()=>nD,int:()=>Ih,int32:()=>x2,int64:()=>I2,intersection:()=>bI,invertCodec:()=>W2,ipv4:()=>a2,ipv6:()=>l2,iso:()=>wc,json:()=>iD,jwt:()=>h2,keyof:()=>C2,ksuid:()=>s2,lazy:()=>FI,length:()=>Fs,literal:()=>q2,locales:()=>ed,looseObject:()=>N2,looseRecord:()=>j2,lowercase:()=>cc,lt:()=>Fn,lte:()=>jr,mac:()=>c2,map:()=>B2,maxLength:()=>qs,maxSize:()=>ki,meta:()=>rD,mime:()=>fc,minLength:()=>Ao,minSize:()=>Jn,multipleOf:()=>Ai,nan:()=>K2,nanoid:()=>t2,nativeEnum:()=>M2,negative:()=>dh,never:()=>Hh,nonnegative:()=>fh,nonoptional:()=>zI,nonpositive:()=>ph,normalize:()=>mc,null:()=>lI,nullable:()=>pd,nullish:()=>H2,number:()=>oI,object:()=>P2,optional:()=>dd,overwrite:()=>mn,parse:()=>FE,parseAsync:()=>HE,partialRecord:()=>Z2,pipe:()=>Ah,positive:()=>uh,prefault:()=>PI,preprocess:()=>sD,prettifyError:()=>rw,promise:()=>Q2,property:()=>mh,readonly:()=>UI,record:()=>wI,refine:()=>KI,regex:()=>ac,regexes:()=>Zr,registry:()=>qm,safeDecode:()=>XE,safeDecodeAsync:()=>tI,safeEncode:()=>YE,safeEncodeAsync:()=>eI,safeParse:()=>JE,safeParseAsync:()=>KE,set:()=>U2,setErrorMap:()=>qW,size:()=>Ms,slugify:()=>bc,startsWith:()=>dc,strictObject:()=>z2,string:()=>ld,stringFormat:()=>g2,stringbool:()=>oD,success:()=>J2,superRefine:()=>VI,symbol:()=>k2,templateLiteral:()=>G2,toJSONSchema:()=>bh,toLowerCase:()=>gc,toUpperCase:()=>yc,transform:()=>Vh,treeifyError:()=>tw,trim:()=>hc,tuple:()=>vI,uint32:()=>_2,uint64:()=>A2,ulid:()=>o2,undefined:()=>R2,union:()=>Jh,unknown:()=>Hs,uppercase:()=>lc,url:()=>YN,util:()=>ue,uuid:()=>VN,uuidv4:()=>WN,uuidv6:()=>GN,uuidv7:()=>QN,void:()=>$2,xid:()=>i2,xor:()=>D2});var QI=S(()=>{Br();Br();x0();Br();id();uD();d_();sd();sd();dD();cd();vh();qE();rI();aD();gt(Gu())});var pD=S(()=>{QI();QI()});var YI=S(()=>{pD()});var de=S(()=>{YI()});function $c(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Qh(e){if(Array.isArray(e))return e.map(Qh);if(!e||typeof e!=="object")return e;if(e instanceof Uint8Array)return e;return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).map(([t,r])=>[t,Qh(r)]))}var Ks={};Lt(Ks,{CORE_SCHEMA:()=>CG,DEFAULT_SCHEMA:()=>xA,FAILSAFE_SCHEMA:()=>$G,JSON_SCHEMA:()=>OG,Schema:()=>TG,Type:()=>Oc,YAMLException:()=>zG,default:()=>pL,dump:()=>Id,load:()=>Cc,loadAll:()=>PG,safeDump:()=>ZG,safeLoad:()=>DG,safeLoadAll:()=>LG,types:()=>NG});function _G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _d(){if(ED)return Oi;ED=1;function e(s){return typeof s>"u"||s===null}function t(s){return typeof s==="object"&&s!==null}function r(s){if(Array.isArray(s))return s;else if(e(s))return[];return[s]}function o(s,a){if(a){let l=Object.keys(a);for(let u=0,d=l.length;u<d;u+=1){let p=l[u];s[p]=a[p]}}return s}function n(s,a){let l="";for(let u=0;u<a;u+=1)l+=s;return l}function i(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return Oi.isNothing=e,Oi.isObject=t,Oi.toArray=r,Oi.repeat=n,Oi.isNegativeZero=i,Oi.extend=o,Oi}function Ed(){if(ID)return XI;ID=1;function e(r,o){let n="",i=r.reason||"(unknown reason)";if(!r.mark)return i;if(r.mark.name)n+='in "'+r.mark.name+'" ';if(n+="("+(r.mark.line+1)+":"+(r.mark.column+1)+")",!o&&r.mark.snippet)n+=`
|
|
251
|
+
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]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref"){i(s);continue}}}}function $i(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let l=e.seen.get(a);if(l.ref===null)return;let u=l.def??l.schema,d={...u},p=l.ref;if(l.ref=null,p){o(p);let h=e.seen.get(p),b=h.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(b);else Object.assign(u,b);if(Object.assign(u,d),a._zod.parent===p)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(!(v in d))delete u[v]}if(b.$ref&&h.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in h.def&&JSON.stringify(u[v])===JSON.stringify(h.def[v]))delete u[v]}}let m=a._zod.parent;if(m&&m!==p){o(m);let h=e.seen.get(m);if(h?.schema.$ref){if(u.$ref=h.schema.$ref,h.def)for(let b in u){if(b==="$ref"||b==="allOf")continue;if(b in h.def&&JSON.stringify(u[b])===JSON.stringify(h.def[b]))delete u[b]}}}e.override({zodSchema:a,jsonSchema:u,path:l.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};for(let a of e.seen.entries()){let l=a[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;s[l.defId]=l.def}}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else 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(a){throw Error("Error converting schema to JSON.")}}function hr(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return hr(o.element,r);if(o.type==="set")return hr(o.valueType,r);if(o.type==="lazy")return hr(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return hr(o.innerType,r);if(o.type==="intersection")return hr(o.left,r)||hr(o.right,r);if(o.type==="record"||o.type==="map")return hr(o.keyType,r)||hr(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return hr(o.in,r)||hr(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(hr(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(hr(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(hr(n,r))return!0;if(o.rest&&hr(o.rest,r))return!0;return!1}return!1}var eE=(e,t={})=>(r)=>{let o=Ri({...r,processors:t});return We(e,o),Ti(o,e),$i(o,e)},vc=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Ri({...n??{},target:i,io:t,processors:r});return We(e,s),Ti(s,e),$i(s,e)};var od=S(()=>{td()});function bh(e,t){if("_idmap"in e){let o=e,n=Ri({...t,processors:hh}),i={};for(let l of o._idmap.entries()){let[u,d]=l;We(d,n)}let s={},a={registry:o,uri:t?.uri,defs:i};n.external=a;for(let l of o._idmap.entries()){let[u,d]=l;Ti(n,d),s[u]=$i(n,d)}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[l]:i}}return{schemas:s}}let r=Ri({...t,processors:hh});return We(e,r),Ti(r,e),$i(r,e)}var jW,tE=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:a,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(a){if(n.format=jW[a]??a,n.format==="")delete n.format;if(a==="time")delete n.format}if(u)n.contentEncoding=u;if(l&&l.size>0){let d=[...l];if(d.length===1)n.pattern=d[0].source;else if(d.length>1)n.allOf=[...d.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},rE=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))n.type="integer";else n.type="number";let p=typeof d==="number"&&d>=(i??Number.NEGATIVE_INFINITY),m=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(h)n.minimum=d,n.exclusiveMinimum=!0;else n.exclusiveMinimum=d;else if(typeof i==="number")n.minimum=i;if(m)if(h)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof s==="number")n.maximum=s;if(typeof l==="number")n.multipleOf=l},nE=(e,t,r,o)=>{r.type="boolean"},oE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},iE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},sE=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},aE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},cE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},lE=(e,t,r,o)=>{r.not={}},uE=(e,t,r,o)=>{},dE=(e,t,r,o)=>{},pE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},fE=(e,t,r,o)=>{let n=e._zod.def,i=Du(n.entries);if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},mE=(e,t,r,o)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},hE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},gE=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},yE=(e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:l}=e._zod.bag;if(s!==void 0)i.minLength=s;if(a!==void 0)i.maxLength=a;if(l)if(l.length===1)i.contentMediaType=l[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=l.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},bE=(e,t,r,o)=>{r.type="boolean"},SE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},vE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},wE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},xE=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},_E=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},EE=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;if(typeof s==="number")n.minItems=s;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=We(i.element,t,{...o,path:[...o.path,"items"]})},IE=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=We(s[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(s)),l=new Set([...a].filter((u)=>{let d=i.shape[u]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(l.size>0)n.required=Array.from(l);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=We(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},gh=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((a,l)=>We(a,t,{...o,path:[...o.path,i?"oneOf":"anyOf",l]}));if(i)r.oneOf=s;else r.anyOf=s},AE=(e,t,r,o)=>{let n=e._zod.def,i=We(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=We(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,l=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=l},kE=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((m,h)=>We(m,t,{...o,path:[...o.path,s,h]})),u=i.rest?We(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=l,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:l},u)n.items.anyOf.push(u);if(n.minItems=l.length,!u)n.maxItems=l.length}else if(n.items=l,u)n.additionalItems=u;let{minimum:d,maximum:p}=e._zod.bag;if(typeof d==="number")n.minItems=d;if(typeof p==="number")n.maxItems=p},RE=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let s=i.keyType,l=s._zod.bag?.patterns;if(i.mode==="loose"&&l&&l.size>0){let d=We(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of l)n.patternProperties[p.source]=d}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=We(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=We(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=s._zod.values;if(u){let d=[...u].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)n.required=d}},TE=(e,t,r,o)=>{let n=e._zod.def,i=We(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},$E=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},OE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},CE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},PE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},zE=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;We(s,t,o);let a=t.seen.get(e);a.ref=s},NE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},DE=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},yh=(e,t,r,o)=>{let n=e._zod.def;We(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},LE=(e,t,r,o)=>{let n=e._zod.innerType;We(n,t,o);let i=t.seen.get(e);i.ref=n},hh;var id=S(()=>{od();Ie();jW={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hh={string:tE,number:rE,boolean:nE,bigint:oE,symbol:iE,null:sE,undefined:aE,void:cE,never:lE,any:uE,unknown:dE,date:pE,enum:fE,literal:mE,nan:hE,template_literal:gE,file:yE,success:bE,custom:SE,function:vE,transform:wE,map:xE,set:_E,array:EE,object:IE,union:gh,intersection:AE,tuple:kE,record:RE,nullable:TE,nonoptional:$E,default:OE,prefault:CE,catch:PE,pipe:zE,readonly:NE,promise:DE,optional:yh,lazy:LE}});class ZE{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(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";this.ctx=Ri({processors:hh,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return We(e,this.ctx,t)}emit(e,t){if(t){if(t.cycles)this.ctx.cycles=t.cycles;if(t.reused)this.ctx.reused=t.reused;if(t.external)this.ctx.external=t.external}Ti(this.ctx,e);let r=$i(this.ctx,e),{"~standard":o,...n}=r;return n}}var BN=S(()=>{id();od()});var UN={};var MN=()=>{};var Ro={};Lt(Ro,{$ZodAny:()=>zx,$ZodArray:()=>jx,$ZodAsyncError:()=>qn,$ZodBase64:()=>Ex,$ZodBase64URL:()=>Ix,$ZodBigInt:()=>jm,$ZodBigIntFormat:()=>$x,$ZodBoolean:()=>Ku,$ZodCIDRv4:()=>wx,$ZodCIDRv6:()=>xx,$ZodCUID:()=>lx,$ZodCUID2:()=>ux,$ZodCatch:()=>n0,$ZodCheck:()=>rt,$ZodCheckBigIntFormat:()=>Zw,$ZodCheckEndsWith:()=>Gw,$ZodCheckGreaterThan:()=>Om,$ZodCheckIncludes:()=>Vw,$ZodCheckLengthEquals:()=>Fw,$ZodCheckLessThan:()=>$m,$ZodCheckLowerCase:()=>Jw,$ZodCheckMaxLength:()=>Mw,$ZodCheckMaxSize:()=>jw,$ZodCheckMimeType:()=>Yw,$ZodCheckMinLength:()=>qw,$ZodCheckMinSize:()=>Bw,$ZodCheckMultipleOf:()=>Dw,$ZodCheckNumberFormat:()=>Lw,$ZodCheckOverwrite:()=>Xw,$ZodCheckProperty:()=>Qw,$ZodCheckRegex:()=>Hw,$ZodCheckSizeEquals:()=>Uw,$ZodCheckStartsWith:()=>Ww,$ZodCheckStringFormat:()=>ic,$ZodCheckUpperCase:()=>Kw,$ZodCodec:()=>Wu,$ZodCustom:()=>d0,$ZodCustomStringFormat:()=>Rx,$ZodDate:()=>Zx,$ZodDefault:()=>Xx,$ZodDiscriminatedUnion:()=>Mx,$ZodE164:()=>Ax,$ZodEmail:()=>ix,$ZodEmoji:()=>ax,$ZodEncodeError:()=>Ls,$ZodEnum:()=>Kx,$ZodError:()=>Uu,$ZodExactOptional:()=>Qx,$ZodFile:()=>Wx,$ZodFunction:()=>c0,$ZodGUID:()=>nx,$ZodIPv4:()=>bx,$ZodIPv6:()=>Sx,$ZodISODate:()=>hx,$ZodISODateTime:()=>mx,$ZodISODuration:()=>yx,$ZodISOTime:()=>gx,$ZodIntersection:()=>qx,$ZodJWT:()=>kx,$ZodKSUID:()=>fx,$ZodLazy:()=>u0,$ZodLiteral:()=>Vx,$ZodMAC:()=>vx,$ZodMap:()=>Hx,$ZodNaN:()=>o0,$ZodNanoID:()=>cx,$ZodNever:()=>Dx,$ZodNonOptional:()=>t0,$ZodNull:()=>Px,$ZodNullable:()=>Yx,$ZodNumber:()=>Zm,$ZodNumberFormat:()=>Tx,$ZodObject:()=>Lz,$ZodObjectJIT:()=>Bx,$ZodOptional:()=>Um,$ZodPipe:()=>Mm,$ZodPrefault:()=>e0,$ZodPreprocess:()=>i0,$ZodPromise:()=>l0,$ZodReadonly:()=>s0,$ZodRealError:()=>Er,$ZodRecord:()=>Fx,$ZodRegistry:()=>m_,$ZodSet:()=>Jx,$ZodString:()=>Us,$ZodStringFormat:()=>Xe,$ZodSuccess:()=>r0,$ZodSymbol:()=>Ox,$ZodTemplateLiteral:()=>a0,$ZodTransform:()=>Gx,$ZodTuple:()=>Bm,$ZodType:()=>Ne,$ZodULID:()=>dx,$ZodURL:()=>sx,$ZodUUID:()=>ox,$ZodUndefined:()=>Cx,$ZodUnion:()=>Vu,$ZodUnknown:()=>Nx,$ZodVoid:()=>Lx,$ZodXID:()=>px,$ZodXor:()=>Ux,$brand:()=>Fv,$constructor:()=>B,$input:()=>f_,$output:()=>p_,Doc:()=>Pm,JSONSchema:()=>UN,JSONSchemaGenerator:()=>ZE,NEVER:()=>qv,TimePrecision:()=>b_,_any:()=>j_,_array:()=>J_,_base64:()=>sh,_base64url:()=>ah,_bigint:()=>C_,_boolean:()=>$_,_catch:()=>PW,_check:()=>ZN,_cidrv4:()=>oh,_cidrv6:()=>ih,_coercedBigint:()=>P_,_coercedBoolean:()=>O_,_coercedDate:()=>F_,_coercedNumber:()=>E_,_coercedString:()=>g_,_cuid:()=>Qm,_cuid2:()=>Ym,_custom:()=>V_,_date:()=>q_,_decode:()=>wm,_decodeAsync:()=>_m,_default:()=>$W,_discriminatedUnion:()=>bW,_e164:()=>ch,_email:()=>Fm,_emoji:()=>Wm,_encode:()=>vm,_encodeAsync:()=>xm,_endsWith:()=>pc,_enum:()=>EW,_file:()=>K_,_float32:()=>A_,_float64:()=>k_,_gt:()=>Hn,_gte:()=>mr,_guid:()=>rd,_includes:()=>uc,_int:()=>I_,_int32:()=>R_,_int64:()=>z_,_intersection:()=>SW,_ipv4:()=>rh,_ipv6:()=>nh,_isoDate:()=>v_,_isoDateTime:()=>S_,_isoDuration:()=>x_,_isoTime:()=>w_,_jwt:()=>lh,_ksuid:()=>th,_lazy:()=>LW,_length:()=>Fs,_literal:()=>AW,_lowercase:()=>cc,_lt:()=>Fn,_lte:()=>jr,_mac:()=>y_,_map:()=>xW,_max:()=>jr,_maxLength:()=>qs,_maxSize:()=>ki,_mime:()=>fc,_min:()=>mr,_minLength:()=>ko,_minSize:()=>Jn,_multipleOf:()=>Ai,_nan:()=>H_,_nanoid:()=>Gm,_nativeEnum:()=>IW,_negative:()=>dh,_never:()=>U_,_nonnegative:()=>fh,_nonoptional:()=>OW,_nonpositive:()=>ph,_normalize:()=>mc,_null:()=>Z_,_nullable:()=>TW,_number:()=>__,_optional:()=>RW,_overwrite:()=>mn,_parse:()=>tc,_parseAsync:()=>rc,_pipe:()=>zW,_positive:()=>uh,_promise:()=>ZW,_property:()=>mh,_readonly:()=>NW,_record:()=>wW,_refine:()=>W_,_regex:()=>ac,_safeDecode:()=>Im,_safeDecodeAsync:()=>km,_safeEncode:()=>Em,_safeEncodeAsync:()=>Am,_safeParse:()=>nc,_safeParseAsync:()=>oc,_set:()=>_W,_size:()=>Ms,_slugify:()=>bc,_startsWith:()=>dc,_string:()=>h_,_stringFormat:()=>Sc,_stringbool:()=>X_,_success:()=>CW,_superRefine:()=>G_,_symbol:()=>D_,_templateLiteral:()=>DW,_toLowerCase:()=>gc,_toUpperCase:()=>yc,_transform:()=>kW,_trim:()=>hc,_tuple:()=>vW,_uint32:()=>T_,_uint64:()=>N_,_ulid:()=>Xm,_undefined:()=>L_,_union:()=>gW,_unknown:()=>B_,_uppercase:()=>lc,_url:()=>nd,_uuid:()=>Hm,_uuidv4:()=>Jm,_uuidv6:()=>Km,_uuidv7:()=>Vm,_void:()=>M_,_xid:()=>eh,_xor:()=>yW,clone:()=>pr,config:()=>gt,createStandardJSONSchemaMethod:()=>vc,createToJSONSchemaMethod:()=>eE,decode:()=>Z9,decodeAsync:()=>B9,describe:()=>Q_,encode:()=>L9,encodeAsync:()=>j9,extractDefs:()=>Ti,finalize:()=>$i,flattenError:()=>Mu,formatError:()=>qu,globalConfig:()=>Ds,globalRegistry:()=>Vt,initializeContext:()=>Ri,isValidBase64:()=>_x,isValidBase64URL:()=>Pz,isValidJWT:()=>zz,locales:()=>ed,meta:()=>Y_,parse:()=>bm,parseAsync:()=>Sm,prettifyError:()=>rw,process:()=>We,regexes:()=>Zr,registry:()=>qm,safeDecode:()=>M9,safeDecodeAsync:()=>F9,safeEncode:()=>U9,safeEncodeAsync:()=>q9,safeParse:()=>ow,safeParseAsync:()=>iw,toDotPath:()=>pz,toJSONSchema:()=>bh,treeifyError:()=>tw,util:()=>ue,version:()=>ex});var Br=S(()=>{Ie();Tm();d_();id();BN();MN();Zs();sw();nw();p0();Cm();tx();td();jN();od()});var Sh={};Lt(Sh,{endsWith:()=>pc,gt:()=>Hn,gte:()=>mr,includes:()=>uc,length:()=>Fs,lowercase:()=>cc,lt:()=>Fn,lte:()=>jr,maxLength:()=>qs,maxSize:()=>ki,mime:()=>fc,minLength:()=>ko,minSize:()=>Jn,multipleOf:()=>Ai,negative:()=>dh,nonnegative:()=>fh,nonpositive:()=>ph,normalize:()=>mc,overwrite:()=>mn,positive:()=>uh,property:()=>mh,regex:()=>ac,size:()=>Ms,slugify:()=>bc,startsWith:()=>dc,toLowerCase:()=>gc,toUpperCase:()=>yc,trim:()=>hc,uppercase:()=>lc});var vh=S(()=>{Br()});var wc={};Lt(wc,{ZodISODate:()=>xh,ZodISODateTime:()=>wh,ZodISODuration:()=>Eh,ZodISOTime:()=>_h,date:()=>BE,datetime:()=>jE,duration:()=>ME,time:()=>UE});function jE(e){return S_(wh,e)}function BE(e){return v_(xh,e)}function UE(e){return w_(_h,e)}function ME(e){return x_(Eh,e)}var wh,xh,_h,Eh;var sd=S(()=>{Br();cd();wh=B("ZodISODateTime",(e,t)=>{mx.init(e,t),et.init(e,t)});xh=B("ZodISODate",(e,t)=>{hx.init(e,t),et.init(e,t)});_h=B("ZodISOTime",(e,t)=>{gx.init(e,t),et.init(e,t)});Eh=B("ZodISODuration",(e,t)=>{yx.init(e,t),et.init(e,t)})});var qN=(e,t)=>{Uu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>qu(e,r)},flatten:{value:(r)=>Mu(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ya,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ya,2)}},isEmpty:{get(){return e.issues.length===0}}})},FN,Ir;var qE=S(()=>{Br();Br();Ie();FN=B("ZodError",qN),Ir=B("ZodError",qN,{Parent:Error})});var FE,HE,JE,KE,VE,WE,GE,QE,YE,XE,eI,tI;var rI=S(()=>{Br();qE();FE=tc(Ir),HE=rc(Ir),JE=nc(Ir),KE=oc(Ir),VE=vm(Ir),WE=wm(Ir),GE=xm(Ir),QE=_m(Ir),YE=Em(Ir),XE=Im(Ir),eI=Am(Ir),tI=km(Ir)});var ad={};Lt(ad,{ZodAny:()=>uI,ZodArray:()=>mI,ZodBase64:()=>Bh,ZodBase64URL:()=>Uh,ZodBigInt:()=>Rc,ZodBigIntFormat:()=>Fh,ZodBoolean:()=>kc,ZodCIDRv4:()=>Zh,ZodCIDRv6:()=>jh,ZodCUID:()=>Oh,ZodCUID2:()=>Ch,ZodCatch:()=>DI,ZodCodec:()=>vd,ZodCustom:()=>wd,ZodCustomStringFormat:()=>Ic,ZodDate:()=>hd,ZodDefault:()=>$I,ZodDiscriminatedUnion:()=>gI,ZodE164:()=>Mh,ZodEmail:()=>Rh,ZodEmoji:()=>Th,ZodEnum:()=>_c,ZodExactOptional:()=>kI,ZodFile:()=>II,ZodFunction:()=>JI,ZodGUID:()=>ud,ZodIPv4:()=>Dh,ZodIPv6:()=>Lh,ZodIntersection:()=>yI,ZodJWT:()=>qh,ZodKSUID:()=>Nh,ZodLazy:()=>qI,ZodLiteral:()=>EI,ZodMAC:()=>nI,ZodMap:()=>xI,ZodNaN:()=>ZI,ZodNanoID:()=>$h,ZodNever:()=>pI,ZodNonOptional:()=>Gh,ZodNull:()=>cI,ZodNullable:()=>TI,ZodNumber:()=>Ac,ZodNumberFormat:()=>Js,ZodObject:()=>yd,ZodOptional:()=>Wh,ZodPipe:()=>Sd,ZodPrefault:()=>CI,ZodPreprocess:()=>jI,ZodPromise:()=>HI,ZodReadonly:()=>BI,ZodRecord:()=>xc,ZodSet:()=>_I,ZodString:()=>Ec,ZodStringFormat:()=>et,ZodSuccess:()=>NI,ZodSymbol:()=>sI,ZodTemplateLiteral:()=>MI,ZodTransform:()=>AI,ZodTuple:()=>SI,ZodType:()=>Ze,ZodULID:()=>Ph,ZodURL:()=>md,ZodUUID:()=>Kn,ZodUndefined:()=>aI,ZodUnion:()=>bd,ZodUnknown:()=>dI,ZodVoid:()=>fI,ZodXID:()=>zh,ZodXor:()=>hI,_ZodString:()=>kh,_default:()=>OI,_function:()=>Y2,any:()=>T2,array:()=>gd,base64:()=>p2,base64url:()=>f2,bigint:()=>E2,boolean:()=>iI,catch:()=>LI,check:()=>X2,cidrv4:()=>u2,cidrv6:()=>d2,codec:()=>V2,cuid:()=>r2,cuid2:()=>n2,custom:()=>eD,date:()=>O2,describe:()=>tD,discriminatedUnion:()=>L2,e164:()=>m2,email:()=>JN,emoji:()=>e2,enum:()=>Kh,exactOptional:()=>RI,file:()=>F2,float32:()=>v2,float64:()=>w2,function:()=>Y2,guid:()=>KN,hash:()=>S2,hex:()=>b2,hostname:()=>y2,httpUrl:()=>XN,instanceof:()=>nD,int:()=>Ih,int32:()=>x2,int64:()=>I2,intersection:()=>bI,invertCodec:()=>W2,ipv4:()=>a2,ipv6:()=>l2,json:()=>iD,jwt:()=>h2,keyof:()=>C2,ksuid:()=>s2,lazy:()=>FI,literal:()=>q2,looseObject:()=>N2,looseRecord:()=>j2,mac:()=>c2,map:()=>B2,meta:()=>rD,nan:()=>K2,nanoid:()=>t2,nativeEnum:()=>M2,never:()=>Hh,nonoptional:()=>zI,null:()=>lI,nullable:()=>pd,nullish:()=>H2,number:()=>oI,object:()=>P2,optional:()=>dd,partialRecord:()=>Z2,pipe:()=>Ah,prefault:()=>PI,preprocess:()=>sD,promise:()=>Q2,readonly:()=>UI,record:()=>wI,refine:()=>KI,set:()=>U2,strictObject:()=>z2,string:()=>ld,stringFormat:()=>g2,stringbool:()=>oD,success:()=>J2,superRefine:()=>VI,symbol:()=>k2,templateLiteral:()=>G2,transform:()=>Vh,tuple:()=>vI,uint32:()=>_2,uint64:()=>A2,ulid:()=>o2,undefined:()=>R2,union:()=>Jh,unknown:()=>Hs,url:()=>YN,uuid:()=>VN,uuidv4:()=>WN,uuidv6:()=>GN,uuidv7:()=>QN,void:()=>$2,xid:()=>i2,xor:()=>D2});function fd(e,t,r){let o=Object.getPrototypeOf(e),n=HN.get(o);if(!n)n=new Set,HN.set(o,n);if(n.has(t))return;n.add(t);for(let i in r){let s=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}function ld(e){return h_(Ec,e)}function JN(e){return Fm(Rh,e)}function KN(e){return rd(ud,e)}function VN(e){return Hm(Kn,e)}function WN(e){return Jm(Kn,e)}function GN(e){return Km(Kn,e)}function QN(e){return Vm(Kn,e)}function YN(e){return nd(md,e)}function XN(e){return nd(md,{protocol:Zr.httpProtocol,hostname:Zr.domain,...ue.normalizeParams(e)})}function e2(e){return Wm(Th,e)}function t2(e){return Gm($h,e)}function r2(e){return Qm(Oh,e)}function n2(e){return Ym(Ch,e)}function o2(e){return Xm(Ph,e)}function i2(e){return eh(zh,e)}function s2(e){return th(Nh,e)}function a2(e){return rh(Dh,e)}function c2(e){return y_(nI,e)}function l2(e){return nh(Lh,e)}function u2(e){return oh(Zh,e)}function d2(e){return ih(jh,e)}function p2(e){return sh(Bh,e)}function f2(e){return ah(Uh,e)}function m2(e){return ch(Mh,e)}function h2(e){return lh(qh,e)}function g2(e,t,r={}){return Sc(Ic,e,t,r)}function y2(e){return Sc(Ic,"hostname",Zr.hostname,e)}function b2(e){return Sc(Ic,"hex",Zr.hex,e)}function S2(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=Zr[o];if(!n)throw Error(`Unrecognized hash format: ${o}`);return Sc(Ic,o,n,t)}function oI(e){return __(Ac,e)}function Ih(e){return I_(Js,e)}function v2(e){return A_(Js,e)}function w2(e){return k_(Js,e)}function x2(e){return R_(Js,e)}function _2(e){return T_(Js,e)}function iI(e){return $_(kc,e)}function E2(e){return C_(Rc,e)}function I2(e){return z_(Fh,e)}function A2(e){return N_(Fh,e)}function k2(e){return D_(sI,e)}function R2(e){return L_(aI,e)}function lI(e){return Z_(cI,e)}function T2(){return j_(uI)}function Hs(){return B_(dI)}function Hh(e){return U_(pI,e)}function $2(e){return M_(fI,e)}function O2(e){return q_(hd,e)}function gd(e,t){return J_(mI,e,t)}function C2(e){let t=e._zod.def.shape;return Kh(Object.keys(t))}function P2(e,t){let r={type:"object",shape:e??{},...ue.normalizeParams(t)};return new yd(r)}function z2(e,t){return new yd({type:"object",shape:e,catchall:Hh(),...ue.normalizeParams(t)})}function N2(e,t){return new yd({type:"object",shape:e,catchall:Hs(),...ue.normalizeParams(t)})}function Jh(e,t){return new bd({type:"union",options:e,...ue.normalizeParams(t)})}function D2(e,t){return new hI({type:"union",options:e,inclusive:!1,...ue.normalizeParams(t)})}function L2(e,t,r){return new gI({type:"union",options:t,discriminator:e,...ue.normalizeParams(r)})}function bI(e,t){return new yI({type:"intersection",left:e,right:t})}function vI(e,t,r){let o=t instanceof Ne,n=o?r:t;return new SI({type:"tuple",items:e,rest:o?t:null,...ue.normalizeParams(n)})}function wI(e,t,r){if(!t||!t._zod)return new xc({type:"record",keyType:ld(),valueType:e,...ue.normalizeParams(t)});return new xc({type:"record",keyType:e,valueType:t,...ue.normalizeParams(r)})}function Z2(e,t,r){let o=pr(e);return o._zod.values=void 0,new xc({type:"record",keyType:o,valueType:t,...ue.normalizeParams(r)})}function j2(e,t,r){return new xc({type:"record",keyType:e,valueType:t,mode:"loose",...ue.normalizeParams(r)})}function B2(e,t,r){return new xI({type:"map",keyType:e,valueType:t,...ue.normalizeParams(r)})}function U2(e,t){return new _I({type:"set",valueType:e,...ue.normalizeParams(t)})}function Kh(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new _c({type:"enum",entries:r,...ue.normalizeParams(t)})}function M2(e,t){return new _c({type:"enum",entries:e,...ue.normalizeParams(t)})}function q2(e,t){return new EI({type:"literal",values:Array.isArray(e)?e:[e],...ue.normalizeParams(t)})}function F2(e){return K_(II,e)}function Vh(e){return new AI({type:"transform",transform:e})}function dd(e){return new Wh({type:"optional",innerType:e})}function RI(e){return new kI({type:"optional",innerType:e})}function pd(e){return new TI({type:"nullable",innerType:e})}function H2(e){return dd(pd(e))}function OI(e,t){return new $I({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ue.shallowClone(t)}})}function PI(e,t){return new CI({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ue.shallowClone(t)}})}function zI(e,t){return new Gh({type:"nonoptional",innerType:e,...ue.normalizeParams(t)})}function J2(e){return new NI({type:"success",innerType:e})}function LI(e,t){return new DI({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}function K2(e){return H_(ZI,e)}function Ah(e,t){return new Sd({type:"pipe",in:e,out:t})}function V2(e,t,r){return new vd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function W2(e){let t=e._zod.def;return new vd({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function UI(e){return new BI({type:"readonly",innerType:e})}function G2(e,t){return new MI({type:"template_literal",parts:e,...ue.normalizeParams(t)})}function FI(e){return new qI({type:"lazy",getter:e})}function Q2(e){return new HI({type:"promise",innerType:e})}function Y2(e){return new JI({type:"function",input:Array.isArray(e?.input)?vI(e?.input):e?.input??gd(Hs()),output:e?.output??Hs()})}function X2(e){let t=new rt({check:"custom"});return t._zod.check=e,t}function eD(e,t){return V_(wd,e??(()=>!0),t)}function KI(e,t={}){return W_(wd,e,t)}function VI(e,t){return G_(e,t)}function nD(e,t={}){let r=new wd({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...ue.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=(o)=>{if(!(o.value instanceof e))o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}function iD(e){let t=FI(()=>Jh([ld(e),oI(),iI(),lI(),gd(t),wI(ld(),t)]));return t}function sD(e,t){return new jI({type:"pipe",in:Vh(e),out:t})}var HN,Ze,kh,Ec,et,Rh,ud,Kn,md,Th,$h,Oh,Ch,Ph,zh,Nh,Dh,nI,Lh,Zh,jh,Bh,Uh,Mh,qh,Ic,Ac,Js,kc,Rc,Fh,sI,aI,cI,uI,dI,pI,fI,hd,mI,yd,bd,hI,gI,yI,SI,xc,xI,_I,_c,EI,II,AI,Wh,kI,TI,$I,CI,Gh,NI,DI,ZI,Sd,vd,jI,BI,MI,qI,HI,JI,wd,tD,rD,oD=(...e)=>X_({Codec:vd,Boolean:kc,String:Ec},...e);var cd=S(()=>{Br();Br();id();od();vh();sd();rI();HN=new WeakMap;Ze=B("ZodType",(e,t)=>(Ne.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:vc(e,"input"),output:vc(e,"output")}}),e.toJSONSchema=eE(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>FE(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>JE(e,r,o),e.parseAsync=async(r,o)=>HE(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>KE(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>VE(e,r,o),e.decode=(r,o)=>WE(e,r,o),e.encodeAsync=async(r,o)=>GE(e,r,o),e.decodeAsync=async(r,o)=>QE(e,r,o),e.safeEncode=(r,o)=>YE(e,r,o),e.safeDecode=(r,o)=>XE(e,r,o),e.safeEncodeAsync=async(r,o)=>eI(e,r,o),e.safeDecodeAsync=async(r,o)=>tI(e,r,o),fd(e,"ZodType",{check(...r){let o=this.def;return this.clone(ue.mergeDefs(o,{checks:[...o.checks??[],...r.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return pr(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(KI(r,o))},superRefine(r,o){return this.check(VI(r,o))},overwrite(r){return this.check(mn(r))},optional(){return dd(this)},exactOptional(){return RI(this)},nullable(){return pd(this)},nullish(){return dd(pd(this))},nonoptional(r){return zI(this,r)},array(){return gd(this)},or(r){return Jh([this,r])},and(r){return bI(this,r)},transform(r){return Ah(this,Vh(r))},default(r){return OI(this,r)},prefault(r){return PI(this,r)},catch(r){return LI(this,r)},pipe(r){return Ah(this,r)},readonly(){return UI(this)},describe(r){let o=this.clone();return Vt.add(o,{description:r}),o},meta(...r){if(r.length===0)return Vt.get(this);let o=this.clone();return Vt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Vt.get(e)?.description},configurable:!0}),e)),kh=B("_ZodString",(e,t)=>{Us.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>tE(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,fd(e,"_ZodString",{regex(...o){return this.check(ac(...o))},includes(...o){return this.check(uc(...o))},startsWith(...o){return this.check(dc(...o))},endsWith(...o){return this.check(pc(...o))},min(...o){return this.check(ko(...o))},max(...o){return this.check(qs(...o))},length(...o){return this.check(Fs(...o))},nonempty(...o){return this.check(ko(1,...o))},lowercase(o){return this.check(cc(o))},uppercase(o){return this.check(lc(o))},trim(){return this.check(hc())},normalize(...o){return this.check(mc(...o))},toLowerCase(){return this.check(gc())},toUpperCase(){return this.check(yc())},slugify(){return this.check(bc())}})}),Ec=B("ZodString",(e,t)=>{Us.init(e,t),kh.init(e,t),e.email=(r)=>e.check(Fm(Rh,r)),e.url=(r)=>e.check(nd(md,r)),e.jwt=(r)=>e.check(lh(qh,r)),e.emoji=(r)=>e.check(Wm(Th,r)),e.guid=(r)=>e.check(rd(ud,r)),e.uuid=(r)=>e.check(Hm(Kn,r)),e.uuidv4=(r)=>e.check(Jm(Kn,r)),e.uuidv6=(r)=>e.check(Km(Kn,r)),e.uuidv7=(r)=>e.check(Vm(Kn,r)),e.nanoid=(r)=>e.check(Gm($h,r)),e.guid=(r)=>e.check(rd(ud,r)),e.cuid=(r)=>e.check(Qm(Oh,r)),e.cuid2=(r)=>e.check(Ym(Ch,r)),e.ulid=(r)=>e.check(Xm(Ph,r)),e.base64=(r)=>e.check(sh(Bh,r)),e.base64url=(r)=>e.check(ah(Uh,r)),e.xid=(r)=>e.check(eh(zh,r)),e.ksuid=(r)=>e.check(th(Nh,r)),e.ipv4=(r)=>e.check(rh(Dh,r)),e.ipv6=(r)=>e.check(nh(Lh,r)),e.cidrv4=(r)=>e.check(oh(Zh,r)),e.cidrv6=(r)=>e.check(ih(jh,r)),e.e164=(r)=>e.check(ch(Mh,r)),e.datetime=(r)=>e.check(jE(r)),e.date=(r)=>e.check(BE(r)),e.time=(r)=>e.check(UE(r)),e.duration=(r)=>e.check(ME(r))});et=B("ZodStringFormat",(e,t)=>{Xe.init(e,t),kh.init(e,t)}),Rh=B("ZodEmail",(e,t)=>{ix.init(e,t),et.init(e,t)});ud=B("ZodGUID",(e,t)=>{nx.init(e,t),et.init(e,t)});Kn=B("ZodUUID",(e,t)=>{ox.init(e,t),et.init(e,t)});md=B("ZodURL",(e,t)=>{sx.init(e,t),et.init(e,t)});Th=B("ZodEmoji",(e,t)=>{ax.init(e,t),et.init(e,t)});$h=B("ZodNanoID",(e,t)=>{cx.init(e,t),et.init(e,t)});Oh=B("ZodCUID",(e,t)=>{lx.init(e,t),et.init(e,t)});Ch=B("ZodCUID2",(e,t)=>{ux.init(e,t),et.init(e,t)});Ph=B("ZodULID",(e,t)=>{dx.init(e,t),et.init(e,t)});zh=B("ZodXID",(e,t)=>{px.init(e,t),et.init(e,t)});Nh=B("ZodKSUID",(e,t)=>{fx.init(e,t),et.init(e,t)});Dh=B("ZodIPv4",(e,t)=>{bx.init(e,t),et.init(e,t)});nI=B("ZodMAC",(e,t)=>{vx.init(e,t),et.init(e,t)});Lh=B("ZodIPv6",(e,t)=>{Sx.init(e,t),et.init(e,t)});Zh=B("ZodCIDRv4",(e,t)=>{wx.init(e,t),et.init(e,t)});jh=B("ZodCIDRv6",(e,t)=>{xx.init(e,t),et.init(e,t)});Bh=B("ZodBase64",(e,t)=>{Ex.init(e,t),et.init(e,t)});Uh=B("ZodBase64URL",(e,t)=>{Ix.init(e,t),et.init(e,t)});Mh=B("ZodE164",(e,t)=>{Ax.init(e,t),et.init(e,t)});qh=B("ZodJWT",(e,t)=>{kx.init(e,t),et.init(e,t)});Ic=B("ZodCustomStringFormat",(e,t)=>{Rx.init(e,t),et.init(e,t)});Ac=B("ZodNumber",(e,t)=>{Zm.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>rE(e,o,n,i),fd(e,"ZodNumber",{gt(o,n){return this.check(Hn(o,n))},gte(o,n){return this.check(mr(o,n))},min(o,n){return this.check(mr(o,n))},lt(o,n){return this.check(Fn(o,n))},lte(o,n){return this.check(jr(o,n))},max(o,n){return this.check(jr(o,n))},int(o){return this.check(Ih(o))},safe(o){return this.check(Ih(o))},positive(o){return this.check(Hn(0,o))},nonnegative(o){return this.check(mr(0,o))},negative(o){return this.check(Fn(0,o))},nonpositive(o){return this.check(jr(0,o))},multipleOf(o,n){return this.check(Ai(o,n))},step(o,n){return this.check(Ai(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});Js=B("ZodNumberFormat",(e,t)=>{Tx.init(e,t),Ac.init(e,t)});kc=B("ZodBoolean",(e,t)=>{Ku.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nE(e,r,o,n)});Rc=B("ZodBigInt",(e,t)=>{jm.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>oE(e,o,n,i),e.gte=(o,n)=>e.check(mr(o,n)),e.min=(o,n)=>e.check(mr(o,n)),e.gt=(o,n)=>e.check(Hn(o,n)),e.gte=(o,n)=>e.check(mr(o,n)),e.min=(o,n)=>e.check(mr(o,n)),e.lt=(o,n)=>e.check(Fn(o,n)),e.lte=(o,n)=>e.check(jr(o,n)),e.max=(o,n)=>e.check(jr(o,n)),e.positive=(o)=>e.check(Hn(BigInt(0),o)),e.negative=(o)=>e.check(Fn(BigInt(0),o)),e.nonpositive=(o)=>e.check(jr(BigInt(0),o)),e.nonnegative=(o)=>e.check(mr(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Ai(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});Fh=B("ZodBigIntFormat",(e,t)=>{$x.init(e,t),Rc.init(e,t)});sI=B("ZodSymbol",(e,t)=>{Ox.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>iE(e,r,o,n)});aI=B("ZodUndefined",(e,t)=>{Cx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>aE(e,r,o,n)});cI=B("ZodNull",(e,t)=>{Px.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sE(e,r,o,n)});uI=B("ZodAny",(e,t)=>{zx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uE(e,r,o,n)});dI=B("ZodUnknown",(e,t)=>{Nx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dE(e,r,o,n)});pI=B("ZodNever",(e,t)=>{Dx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lE(e,r,o,n)});fI=B("ZodVoid",(e,t)=>{Lx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cE(e,r,o,n)});hd=B("ZodDate",(e,t)=>{Zx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>pE(e,o,n,i),e.min=(o,n)=>e.check(mr(o,n)),e.max=(o,n)=>e.check(jr(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});mI=B("ZodArray",(e,t)=>{jx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>EE(e,r,o,n),e.element=t.element,fd(e,"ZodArray",{min(r,o){return this.check(ko(r,o))},nonempty(r){return this.check(ko(1,r))},max(r,o){return this.check(qs(r,o))},length(r,o){return this.check(Fs(r,o))},unwrap(){return this.element}})});yd=B("ZodObject",(e,t)=>{Bx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>IE(e,r,o,n),ue.defineLazy(e,"shape",()=>t.shape),fd(e,"ZodObject",{keyof(){return Kh(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Hs()})},loose(){return this.clone({...this._zod.def,catchall:Hs()})},strict(){return this.clone({...this._zod.def,catchall:Hh()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return ue.extend(this,r)},safeExtend(r){return ue.safeExtend(this,r)},merge(r){return ue.merge(this,r)},pick(r){return ue.pick(this,r)},omit(r){return ue.omit(this,r)},partial(...r){return ue.partial(Wh,this,r[0])},required(...r){return ue.required(Gh,this,r[0])}})});bd=B("ZodUnion",(e,t)=>{Vu.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gh(e,r,o,n),e.options=t.options});hI=B("ZodXor",(e,t)=>{bd.init(e,t),Ux.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gh(e,r,o,n),e.options=t.options});gI=B("ZodDiscriminatedUnion",(e,t)=>{bd.init(e,t),Mx.init(e,t)});yI=B("ZodIntersection",(e,t)=>{qx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>AE(e,r,o,n)});SI=B("ZodTuple",(e,t)=>{Bm.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kE(e,r,o,n),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});xc=B("ZodRecord",(e,t)=>{Fx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>RE(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});xI=B("ZodMap",(e,t)=>{Hx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xE(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Jn(...r)),e.nonempty=(r)=>e.check(Jn(1,r)),e.max=(...r)=>e.check(ki(...r)),e.size=(...r)=>e.check(Ms(...r))});_I=B("ZodSet",(e,t)=>{Jx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_E(e,r,o,n),e.min=(...r)=>e.check(Jn(...r)),e.nonempty=(r)=>e.check(Jn(1,r)),e.max=(...r)=>e.check(ki(...r)),e.size=(...r)=>e.check(Ms(...r))});_c=B("ZodEnum",(e,t)=>{Kx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,i)=>fE(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new _c({...t,checks:[],...ue.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new _c({...t,checks:[],...ue.normalizeParams(n),entries:i})}});EI=B("ZodLiteral",(e,t)=>{Vx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mE(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});II=B("ZodFile",(e,t)=>{Wx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yE(e,r,o,n),e.min=(r,o)=>e.check(Jn(r,o)),e.max=(r,o)=>e.check(ki(r,o)),e.mime=(r,o)=>e.check(fc(Array.isArray(r)?r:[r],o))});AI=B("ZodTransform",(e,t)=>{Gx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wE(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ls(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ue.issue(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(ue.issue(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r.fallback=!0,r));return r.value=n,r.fallback=!0,r}});Wh=B("ZodOptional",(e,t)=>{Um.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});kI=B("ZodExactOptional",(e,t)=>{Qx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});TI=B("ZodNullable",(e,t)=>{Yx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>TE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});$I=B("ZodDefault",(e,t)=>{Xx.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>OE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});CI=B("ZodPrefault",(e,t)=>{e0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>CE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});Gh=B("ZodNonOptional",(e,t)=>{t0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$E(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});NI=B("ZodSuccess",(e,t)=>{r0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});DI=B("ZodCatch",(e,t)=>{n0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>PE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});ZI=B("ZodNaN",(e,t)=>{o0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hE(e,r,o,n)});Sd=B("ZodPipe",(e,t)=>{Mm.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zE(e,r,o,n),e.in=t.in,e.out=t.out});vd=B("ZodCodec",(e,t)=>{Sd.init(e,t),Wu.init(e,t)});jI=B("ZodPreprocess",(e,t)=>{Sd.init(e,t),i0.init(e,t)}),BI=B("ZodReadonly",(e,t)=>{s0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>NE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});MI=B("ZodTemplateLiteral",(e,t)=>{a0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gE(e,r,o,n)});qI=B("ZodLazy",(e,t)=>{u0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>LE(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});HI=B("ZodPromise",(e,t)=>{l0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>DE(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});JI=B("ZodFunction",(e,t)=>{c0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vE(e,r,o,n)});wd=B("ZodCustom",(e,t)=>{d0.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>SE(e,r,o,n)});tD=Q_,rD=Y_});function qW(e){gt({customError:e})}function FW(){return gt().customError}var MW,WI;var aD=S(()=>{Br();MW={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(e){})(WI||(WI={}))});function JW(e,t){let r=e.$schema;if(r==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(r==="http://json-schema.org/draft-07/schema#")return"draft-7";if(r==="http://json-schema.org/draft-04/schema#")return"draft-4";return t??"draft-2020-12"}function KW(e,t){if(!e.startsWith("#"))throw 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 o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}function cD(e,t){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return ve.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw 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 ve.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=KW(n,t),s=rr(i,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 ve.null();if(n.length===0)return ve.never();if(n.length===1)return ve.literal(n[0]);if(n.every((s)=>typeof s==="string"))return ve.enum(n);let i=n.map((s)=>ve.literal(s));if(i.length<2)return i[0];return ve.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return ve.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map((i)=>{let s={...e,type:i};return cD(s,t)});if(n.length===0)return ve.never();if(n.length===1)return n[0];return ve.union(n)}if(!r)return ve.any();let o;switch(r){case"string":{let n=ve.string();if(e.format){let i=e.format;if(i==="email")n=n.check(ve.email());else if(i==="uri"||i==="uri-reference")n=n.check(ve.url());else if(i==="uuid"||i==="guid")n=n.check(ve.uuid());else if(i==="date-time")n=n.check(ve.iso.datetime());else if(i==="date")n=n.check(ve.iso.date());else if(i==="time")n=n.check(ve.iso.time());else if(i==="duration")n=n.check(ve.iso.duration());else if(i==="ipv4")n=n.check(ve.ipv4());else if(i==="ipv6")n=n.check(ve.ipv6());else if(i==="mac")n=n.check(ve.mac());else if(i==="cidr")n=n.check(ve.cidrv4());else if(i==="cidr-v6")n=n.check(ve.cidrv6());else if(i==="base64")n=n.check(ve.base64());else if(i==="base64url")n=n.check(ve.base64url());else if(i==="e164")n=n.check(ve.e164());else if(i==="jwt")n=n.check(ve.jwt());else if(i==="emoji")n=n.check(ve.emoji());else if(i==="nanoid")n=n.check(ve.nanoid());else if(i==="cuid")n=n.check(ve.cuid());else if(i==="cuid2")n=n.check(ve.cuid2());else if(i==="ulid")n=n.check(ve.ulid());else if(i==="xid")n=n.check(ve.xid());else if(i==="ksuid")n=n.check(ve.ksuid())}if(typeof e.minLength==="number")n=n.min(e.minLength);if(typeof e.maxLength==="number")n=n.max(e.maxLength);if(e.pattern)n=n.regex(new RegExp(e.pattern));o=n;break}case"number":case"integer":{let n=r==="integer"?ve.number().int():ve.number();if(typeof e.minimum==="number")n=n.min(e.minimum);if(typeof e.maximum==="number")n=n.max(e.maximum);if(typeof e.exclusiveMinimum==="number")n=n.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")n=n.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")n=n.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")n=n.lt(e.maximum);if(typeof e.multipleOf==="number")n=n.multipleOf(e.multipleOf);o=n;break}case"boolean":{o=ve.boolean();break}case"null":{o=ve.null();break}case"object":{let n={},i=e.properties||{},s=new Set(e.required||[]);for(let[l,u]of Object.entries(i)){let d=rr(u,t);n[l]=s.has(l)?d:d.optional()}if(e.propertyNames){let l=rr(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties==="object"?rr(e.additionalProperties,t):ve.any();if(Object.keys(n).length===0){o=ve.record(l,u);break}let d=ve.object(n).passthrough(),p=ve.looseRecord(l,u);o=ve.intersection(d,p);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),d=[];for(let m of u){let h=rr(l[m],t),b=ve.string().regex(new RegExp(m));d.push(ve.looseRecord(b,h))}let p=[];if(Object.keys(n).length>0)p.push(ve.object(n).passthrough());if(p.push(...d),p.length===0)o=ve.object({}).passthrough();else if(p.length===1)o=p[0];else{let m=ve.intersection(p[0],p[1]);for(let h=2;h<p.length;h++)m=ve.intersection(m,p[h]);o=m}break}let a=ve.object(n);if(e.additionalProperties===!1)o=a.strict();else if(typeof e.additionalProperties==="object")o=a.catchall(rr(e.additionalProperties,t));else o=a.passthrough();break}case"array":{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let s=n.map((l)=>rr(l,t)),a=i&&typeof i==="object"&&!Array.isArray(i)?rr(i,t):void 0;if(a)o=ve.tuple(s).rest(a);else o=ve.tuple(s);if(typeof e.minItems==="number")o=o.check(ve.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(ve.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=i.map((l)=>rr(l,t)),a=e.additionalItems&&typeof e.additionalItems==="object"?rr(e.additionalItems,t):void 0;if(a)o=ve.tuple(s).rest(a);else o=ve.tuple(s);if(typeof e.minItems==="number")o=o.check(ve.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(ve.maxLength(e.maxItems))}else if(i!==void 0){let s=rr(i,t),a=ve.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);o=a}else o=ve.array(ve.any());break}default:throw Error(`Unsupported type: ${r}`)}return o}function rr(e,t){if(typeof e==="boolean")return e?ve.any():ve.never();let r=cD(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((u)=>rr(u,t)),l=ve.union(a);r=o?ve.intersection(r,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((u)=>rr(u,t)),l=ve.xor(a);r=o?ve.intersection(r,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:ve.any();else{let a=o?r:rr(e.allOf[0],t),l=o?0:1;for(let u=l;u<e.allOf.length;u++)a=ve.intersection(a,rr(e.allOf[u],t));r=a}if(e.nullable===!0&&t.version==="openapi-3.0")r=ve.nullable(r);if(e.readOnly===!0)r=ve.readonly(r);if(e.default!==void 0)r=r.default(e.default);let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)n[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)n[a]=e[a];for(let a of Object.keys(e))if(!HW.has(a))n[a]=e[a];if(Object.keys(n).length>0)t.registry.add(r,n);if(e.description)r=r.describe(e.description);return r}function lD(e,t){if(typeof e==="boolean")return e?ve.any():ve.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=JW(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Vt};return rr(r,i)}var ve,HW;var uD=S(()=>{td();vh();sd();cd();ve={...ad,...Sh,iso:wc},HW=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"])});var GI={};Lt(GI,{bigint:()=>QW,boolean:()=>GW,date:()=>YW,number:()=>WW,string:()=>VW});function VW(e){return g_(Ec,e)}function WW(e){return E_(Ac,e)}function GW(e){return O_(kc,e)}function QW(e){return P_(Rc,e)}function YW(e){return F_(hd,e)}var dD=S(()=>{Br();cd()});var c={};Lt(c,{$brand:()=>Fv,$input:()=>f_,$output:()=>p_,NEVER:()=>qv,TimePrecision:()=>b_,ZodAny:()=>uI,ZodArray:()=>mI,ZodBase64:()=>Bh,ZodBase64URL:()=>Uh,ZodBigInt:()=>Rc,ZodBigIntFormat:()=>Fh,ZodBoolean:()=>kc,ZodCIDRv4:()=>Zh,ZodCIDRv6:()=>jh,ZodCUID:()=>Oh,ZodCUID2:()=>Ch,ZodCatch:()=>DI,ZodCodec:()=>vd,ZodCustom:()=>wd,ZodCustomStringFormat:()=>Ic,ZodDate:()=>hd,ZodDefault:()=>$I,ZodDiscriminatedUnion:()=>gI,ZodE164:()=>Mh,ZodEmail:()=>Rh,ZodEmoji:()=>Th,ZodEnum:()=>_c,ZodError:()=>FN,ZodExactOptional:()=>kI,ZodFile:()=>II,ZodFirstPartyTypeKind:()=>WI,ZodFunction:()=>JI,ZodGUID:()=>ud,ZodIPv4:()=>Dh,ZodIPv6:()=>Lh,ZodISODate:()=>xh,ZodISODateTime:()=>wh,ZodISODuration:()=>Eh,ZodISOTime:()=>_h,ZodIntersection:()=>yI,ZodIssueCode:()=>MW,ZodJWT:()=>qh,ZodKSUID:()=>Nh,ZodLazy:()=>qI,ZodLiteral:()=>EI,ZodMAC:()=>nI,ZodMap:()=>xI,ZodNaN:()=>ZI,ZodNanoID:()=>$h,ZodNever:()=>pI,ZodNonOptional:()=>Gh,ZodNull:()=>cI,ZodNullable:()=>TI,ZodNumber:()=>Ac,ZodNumberFormat:()=>Js,ZodObject:()=>yd,ZodOptional:()=>Wh,ZodPipe:()=>Sd,ZodPrefault:()=>CI,ZodPreprocess:()=>jI,ZodPromise:()=>HI,ZodReadonly:()=>BI,ZodRealError:()=>Ir,ZodRecord:()=>xc,ZodSet:()=>_I,ZodString:()=>Ec,ZodStringFormat:()=>et,ZodSuccess:()=>NI,ZodSymbol:()=>sI,ZodTemplateLiteral:()=>MI,ZodTransform:()=>AI,ZodTuple:()=>SI,ZodType:()=>Ze,ZodULID:()=>Ph,ZodURL:()=>md,ZodUUID:()=>Kn,ZodUndefined:()=>aI,ZodUnion:()=>bd,ZodUnknown:()=>dI,ZodVoid:()=>fI,ZodXID:()=>zh,ZodXor:()=>hI,_ZodString:()=>kh,_default:()=>OI,_function:()=>Y2,any:()=>T2,array:()=>gd,base64:()=>p2,base64url:()=>f2,bigint:()=>E2,boolean:()=>iI,catch:()=>LI,check:()=>X2,cidrv4:()=>u2,cidrv6:()=>d2,clone:()=>pr,codec:()=>V2,coerce:()=>GI,config:()=>gt,core:()=>Ro,cuid:()=>r2,cuid2:()=>n2,custom:()=>eD,date:()=>O2,decode:()=>WE,decodeAsync:()=>QE,describe:()=>tD,discriminatedUnion:()=>L2,e164:()=>m2,email:()=>JN,emoji:()=>e2,encode:()=>VE,encodeAsync:()=>GE,endsWith:()=>pc,enum:()=>Kh,exactOptional:()=>RI,file:()=>F2,flattenError:()=>Mu,float32:()=>v2,float64:()=>w2,formatError:()=>qu,fromJSONSchema:()=>lD,function:()=>Y2,getErrorMap:()=>FW,globalRegistry:()=>Vt,gt:()=>Hn,gte:()=>mr,guid:()=>KN,hash:()=>S2,hex:()=>b2,hostname:()=>y2,httpUrl:()=>XN,includes:()=>uc,instanceof:()=>nD,int:()=>Ih,int32:()=>x2,int64:()=>I2,intersection:()=>bI,invertCodec:()=>W2,ipv4:()=>a2,ipv6:()=>l2,iso:()=>wc,json:()=>iD,jwt:()=>h2,keyof:()=>C2,ksuid:()=>s2,lazy:()=>FI,length:()=>Fs,literal:()=>q2,locales:()=>ed,looseObject:()=>N2,looseRecord:()=>j2,lowercase:()=>cc,lt:()=>Fn,lte:()=>jr,mac:()=>c2,map:()=>B2,maxLength:()=>qs,maxSize:()=>ki,meta:()=>rD,mime:()=>fc,minLength:()=>ko,minSize:()=>Jn,multipleOf:()=>Ai,nan:()=>K2,nanoid:()=>t2,nativeEnum:()=>M2,negative:()=>dh,never:()=>Hh,nonnegative:()=>fh,nonoptional:()=>zI,nonpositive:()=>ph,normalize:()=>mc,null:()=>lI,nullable:()=>pd,nullish:()=>H2,number:()=>oI,object:()=>P2,optional:()=>dd,overwrite:()=>mn,parse:()=>FE,parseAsync:()=>HE,partialRecord:()=>Z2,pipe:()=>Ah,positive:()=>uh,prefault:()=>PI,preprocess:()=>sD,prettifyError:()=>rw,promise:()=>Q2,property:()=>mh,readonly:()=>UI,record:()=>wI,refine:()=>KI,regex:()=>ac,regexes:()=>Zr,registry:()=>qm,safeDecode:()=>XE,safeDecodeAsync:()=>tI,safeEncode:()=>YE,safeEncodeAsync:()=>eI,safeParse:()=>JE,safeParseAsync:()=>KE,set:()=>U2,setErrorMap:()=>qW,size:()=>Ms,slugify:()=>bc,startsWith:()=>dc,strictObject:()=>z2,string:()=>ld,stringFormat:()=>g2,stringbool:()=>oD,success:()=>J2,superRefine:()=>VI,symbol:()=>k2,templateLiteral:()=>G2,toJSONSchema:()=>bh,toLowerCase:()=>gc,toUpperCase:()=>yc,transform:()=>Vh,treeifyError:()=>tw,trim:()=>hc,tuple:()=>vI,uint32:()=>_2,uint64:()=>A2,ulid:()=>o2,undefined:()=>R2,union:()=>Jh,unknown:()=>Hs,uppercase:()=>lc,url:()=>YN,util:()=>ue,uuid:()=>VN,uuidv4:()=>WN,uuidv6:()=>GN,uuidv7:()=>QN,void:()=>$2,xid:()=>i2,xor:()=>D2});var QI=S(()=>{Br();Br();x0();Br();id();uD();d_();sd();sd();dD();cd();vh();qE();rI();aD();gt(Gu())});var pD=S(()=>{QI();QI()});var YI=S(()=>{pD()});var de=S(()=>{YI()});function $c(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Qh(e){if(Array.isArray(e))return e.map(Qh);if(!e||typeof e!=="object")return e;if(e instanceof Uint8Array)return e;return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).map(([t,r])=>[t,Qh(r)]))}var Ks={};Lt(Ks,{CORE_SCHEMA:()=>CG,DEFAULT_SCHEMA:()=>xA,FAILSAFE_SCHEMA:()=>$G,JSON_SCHEMA:()=>OG,Schema:()=>TG,Type:()=>Oc,YAMLException:()=>zG,default:()=>pL,dump:()=>Id,load:()=>Cc,loadAll:()=>PG,safeDump:()=>ZG,safeLoad:()=>DG,safeLoadAll:()=>LG,types:()=>NG});function _G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _d(){if(ED)return Oi;ED=1;function e(s){return typeof s>"u"||s===null}function t(s){return typeof s==="object"&&s!==null}function r(s){if(Array.isArray(s))return s;else if(e(s))return[];return[s]}function o(s,a){if(a){let l=Object.keys(a);for(let u=0,d=l.length;u<d;u+=1){let p=l[u];s[p]=a[p]}}return s}function n(s,a){let l="";for(let u=0;u<a;u+=1)l+=s;return l}function i(s){return s===0&&Number.NEGATIVE_INFINITY===1/s}return Oi.isNothing=e,Oi.isObject=t,Oi.toArray=r,Oi.repeat=n,Oi.isNegativeZero=i,Oi.extend=o,Oi}function Ed(){if(ID)return XI;ID=1;function e(r,o){let n="",i=r.reason||"(unknown reason)";if(!r.mark)return i;if(r.mark.name)n+='in "'+r.mark.name+'" ';if(n+="("+(r.mark.line+1)+":"+(r.mark.column+1)+")",!o&&r.mark.snippet)n+=`
|
|
252
252
|
|
|
253
253
|
`+r.mark.snippet;return i+" "+n}function t(r,o){if(Error.call(this),this.name="YAMLException",this.reason=r,this.mark=o,this.message=e(this,!1),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else this.stack=Error().stack||""}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.prototype.toString=function(o){return this.name+": "+e(this,o)},XI=t,XI}function EG(){if(AD)return eA;AD=1;let e=_d();function t(n,i,s,a,l){let u="",d="",p=Math.floor(l/2)-1;if(a-i>p)u=" ... ",i=a-p+u.length;if(s-a>p)d=" ...",s=a+p-d.length;return{str:u+n.slice(i,s).replace(/\t/g,"\u2192")+d,pos:a-i+u.length}}function r(n,i){return e.repeat(" ",i-n.length)+n}function o(n,i){if(i=Object.create(i||null),!n.buffer)return null;if(!i.maxLength)i.maxLength=79;if(typeof i.indent!=="number")i.indent=1;if(typeof i.linesBefore!=="number")i.linesBefore=3;if(typeof i.linesAfter!=="number")i.linesAfter=2;let s=/\r?\n|\r|\0/g,a=[0],l=[],u,d=-1;while(u=s.exec(n.buffer))if(l.push(u.index),a.push(u.index+u[0].length),n.position<=u.index&&d<0)d=a.length-2;if(d<0)d=a.length-1;let p="",m=Math.min(n.line+i.linesAfter,l.length).toString().length,h=i.maxLength-(i.indent+m+3);for(let y=1;y<=i.linesBefore;y++){if(d-y<0)break;let v=t(n.buffer,a[d-y],l[d-y],n.position-(a[d]-a[d-y]),h);p=e.repeat(" ",i.indent)+r((n.line-y+1).toString(),m)+" | "+v.str+`
|
|
254
254
|
`+p}let b=t(n.buffer,a[d],l[d],n.position,h);p+=e.repeat(" ",i.indent)+r((n.line+1).toString(),m)+" | "+b.str+`
|
|
@@ -263,11 +263,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
263
263
|
`,X?1+g:g);else if(E)E=!1,f.result+=e.repeat(`
|
|
264
264
|
`,g+1);else if(g===0){if(X)f.result+=" "}else f.result+=e.repeat(`
|
|
265
265
|
`,g);else f.result+=e.repeat(`
|
|
266
|
-
`,X?1+g:g);X=!0,w=!0,g=0;let M=f.position;while(!_(H)&&H!==0)H=f.input.charCodeAt(++f.position);xe(f,M,f.position,!1)}return!0}function Le(f,U){let{tag:ne,anchor:ie}=f,X=[],w=!1;if(f.firstTabInLine!==-1)return!1;if(f.anchor!==null)N(f,f.anchor,X);let V=f.input.charCodeAt(f.position);while(V!==0){if(f.firstTabInLine!==-1)f.position=f.firstTabInLine,A(f,"tab characters must not be used in indentation");if(V!==45)break;let g=f.input.charCodeAt(f.position+1);if(!O(g))break;if(w=!0,f.position++,De(f,!0,-1)){if(f.lineIndent<=U){X.push(null),V=f.input.charCodeAt(f.position);continue}}let E=f.line;if(On(f,U,a,!1,!0),X.push(f.result),De(f,!0,-1),V=f.input.charCodeAt(f.position),(f.line===E||f.lineIndent>U)&&V!==0)A(f,"bad indentation of a sequence entry");else if(f.lineIndent<U)break}if(w)return f.tag=ne,f.anchor=ie,f.kind="sequence",f.result=X,!0;return!1}function
|
|
266
|
+
`,X?1+g:g);X=!0,w=!0,g=0;let M=f.position;while(!_(H)&&H!==0)H=f.input.charCodeAt(++f.position);xe(f,M,f.position,!1)}return!0}function Le(f,U){let{tag:ne,anchor:ie}=f,X=[],w=!1;if(f.firstTabInLine!==-1)return!1;if(f.anchor!==null)N(f,f.anchor,X);let V=f.input.charCodeAt(f.position);while(V!==0){if(f.firstTabInLine!==-1)f.position=f.firstTabInLine,A(f,"tab characters must not be used in indentation");if(V!==45)break;let g=f.input.charCodeAt(f.position+1);if(!O(g))break;if(w=!0,f.position++,De(f,!0,-1)){if(f.lineIndent<=U){X.push(null),V=f.input.charCodeAt(f.position);continue}}let E=f.line;if(On(f,U,a,!1,!0),X.push(f.result),De(f,!0,-1),V=f.input.charCodeAt(f.position),(f.line===E||f.lineIndent>U)&&V!==0)A(f,"bad indentation of a sequence entry");else if(f.lineIndent<U)break}if(w)return f.tag=ne,f.anchor=ie,f.kind="sequence",f.result=X,!0;return!1}function uo(f,U,ne){let ie,X,w,V,g=f.tag,E=f.anchor,D={},H=Object.create(null),M=null,te=null,se=null,be=!1,fe=!1;if(f.firstTabInLine!==-1)return!1;if(f.anchor!==null)N(f,f.anchor,D);let Te=f.input.charCodeAt(f.position);while(Te!==0){if(!be&&f.firstTabInLine!==-1)f.position=f.firstTabInLine,A(f,"tab characters must not be used in indentation");let ze=f.input.charCodeAt(f.position+1),Cn=f.line;if((Te===63||Te===58)&&O(ze)){if(Te===63){if(be)_e(f,D,H,M,te,null,X,w,V),M=te=se=null;fe=!0,be=!0,ie=!0}else if(be)be=!1,ie=!0;else A(f,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");f.position+=1,Te=ze}else{if(X=f.line,w=f.lineStart,V=f.position,!On(f,ne,s,!1,!0))break;if(f.line===Cn){Te=f.input.charCodeAt(f.position);while(k(Te))Te=f.input.charCodeAt(++f.position);if(Te===58){if(Te=f.input.charCodeAt(++f.position),!O(Te))A(f,"a whitespace character is expected after the key-value separator within a block mapping");if(be)_e(f,D,H,M,te,null,X,w,V),M=te=se=null;fe=!0,be=!1,ie=!1,M=f.tag,te=f.result}else if(fe)A(f,"can not read an implicit mapping pair; a colon is missed");else return f.tag=g,f.anchor=E,!0}else if(fe)A(f,"can not read a block mapping entry; a multiline key may not be an implicit key");else return f.tag=g,f.anchor=E,!0}if(f.line===Cn||f.lineIndent>U){if(be)X=f.line,w=f.lineStart,V=f.position;if(On(f,U,l,!0,ie))if(be)te=f.result;else se=f.result;if(!be)_e(f,D,H,M,te,se,X,w,V),M=te=se=null;De(f,!0,-1),Te=f.input.charCodeAt(f.position)}if((f.line===Cn||f.lineIndent>U)&&Te!==0)A(f,"bad indentation of a mapping entry");else if(f.lineIndent<U)break}if(be)_e(f,D,H,M,te,null,X,w,V);if(fe)f.tag=g,f.anchor=E,f.kind="mapping",f.result=D;return fe}function cs(f){let U=!1,ne=!1,ie,X,w=f.input.charCodeAt(f.position);if(w!==33)return!1;if(f.tag!==null)A(f,"duplication of a tag property");if(w=f.input.charCodeAt(++f.position),w===60)U=!0,w=f.input.charCodeAt(++f.position);else if(w===33)ne=!0,ie="!!",w=f.input.charCodeAt(++f.position);else ie="!";let V=f.position;if(U){do w=f.input.charCodeAt(++f.position);while(w!==0&&w!==62);if(f.position<f.length)X=f.input.slice(V,f.position),w=f.input.charCodeAt(++f.position);else A(f,"unexpected end of the stream within a verbatim tag")}else{while(w!==0&&!O(w)){if(w===33)if(!ne){if(ie=f.input.slice(V-1,f.position+1),!y.test(ie))A(f,"named tag handle cannot contain such characters");ne=!0,V=f.position+1}else A(f,"tag suffix cannot contain exclamation marks");w=f.input.charCodeAt(++f.position)}if(X=f.input.slice(V,f.position),b.test(X))A(f,"tag suffix cannot contain flow indicator characters")}if(X&&!v.test(X))A(f,"tag name cannot contain such characters: "+X);try{X=decodeURIComponent(X)}catch(g){A(f,"tag name is malformed: "+X)}if(U)f.tag=X;else if(n.call(f.tagMap,ie))f.tag=f.tagMap[ie]+X;else if(ie==="!")f.tag="!"+X;else if(ie==="!!")f.tag="tag:yaml.org,2002:"+X;else A(f,'undeclared tag handle "'+ie+'"');return!0}function ls(f){let U=f.input.charCodeAt(f.position);if(U!==38)return!1;if(f.anchor!==null)A(f,"duplication of an anchor property");U=f.input.charCodeAt(++f.position);let ne=f.position;while(U!==0&&!O(U)&&!L(U))U=f.input.charCodeAt(++f.position);if(f.position===ne)A(f,"name of an anchor node must contain at least one character");return f.anchor=f.input.slice(ne,f.position),!0}function _a(f){let U=f.input.charCodeAt(f.position);if(U!==42)return!1;U=f.input.charCodeAt(++f.position);let ne=f.position;while(U!==0&&!O(U)&&!L(U))U=f.input.charCodeAt(++f.position);if(f.position===ne)A(f,"name of an alias node must contain at least one character");let ie=f.input.slice(ne,f.position);if(!n.call(f.anchorMap,ie))A(f,'unidentified alias "'+ie+'"');return f.result=f.anchorMap[ie],De(f,!0,-1),!0}function us(f,U,ne,ie){let X=ae(f);if(K(f),me(f,U),f.tag=null,f.anchor=null,f.kind=null,f.result=null,uo(f,ne,ie)&&f.kind==="mapping")return G(f),!0;return re(f),me(f,X),!1}function On(f,U,ne,ie,X){let w,V,g=1,E=!1,D=!1,H=null,M,te,se;if(f.depth>=f.maxDepth)A(f,"nesting exceeded maxDepth ("+f.maxDepth+")");if(f.depth+=1,f.listener!==null)f.listener("open",f);f.tag=null,f.anchor=null,f.kind=null,f.result=null;let be=w=V=l===ne||a===ne;if(ie){if(De(f,!0,-1)){if(E=!0,f.lineIndent>U)g=1;else if(f.lineIndent===U)g=0;else if(f.lineIndent<U)g=-1}}if(g===1)while(!0){let fe=f.input.charCodeAt(f.position),Te=ae(f);if(E&&(fe===33&&f.tag!==null||fe===38&&f.anchor!==null))break;if(!cs(f)&&!ls(f))break;if(H===null)H=Te;if(De(f,!0,-1)){if(E=!0,V=be,f.lineIndent>U)g=1;else if(f.lineIndent===U)g=0;else if(f.lineIndent<U)g=-1}else V=!1}if(V)V=E||X;if(g===1||l===ne){if(i===ne||s===ne)te=U;else te=U+1;if(se=f.position-f.lineStart,g===1)if(V&&(Le(f,se)||uo(f,se,te))||Or(f,te))D=!0;else{let fe=f.input.charCodeAt(f.position);if(H!==null&&be&&!V&&fe!==124&&fe!==62&&us(f,H,H.position-H.lineStart,te))D=!0;else if(w&&$n(f,te)||Dt(f,te)||lt(f,te))D=!0;else if(_a(f)){if(D=!0,f.tag!==null||f.anchor!==null)A(f,"alias node should not have any properties")}else if(Tt(f,te,i===ne)){if(D=!0,f.tag===null)f.tag="?"}if(f.anchor!==null)N(f,f.anchor,f.result)}else if(g===0)D=V&&Le(f,se)}if(f.tag===null){if(f.anchor!==null)N(f,f.anchor,f.result)}else if(f.tag==="?"){if(f.result!==null&&f.kind!=="scalar")A(f,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+f.kind+'"');for(let fe=0,Te=f.implicitTypes.length;fe<Te;fe+=1)if(M=f.implicitTypes[fe],M.resolve(f.result)){if(f.result=M.construct(f.result),f.tag=M.tag,f.anchor!==null)N(f,f.anchor,f.result);break}}else if(f.tag!=="!"){if(n.call(f.typeMap[f.kind||"fallback"],f.tag))M=f.typeMap[f.kind||"fallback"][f.tag];else{M=null;let fe=f.typeMap.multi[f.kind||"fallback"];for(let Te=0,ze=fe.length;Te<ze;Te+=1)if(f.tag.slice(0,fe[Te].tag.length)===fe[Te].tag){M=fe[Te];break}}if(!M)A(f,"unknown tag !<"+f.tag+">");if(f.result!==null&&M.kind!==f.kind)A(f,"unacceptable node kind for !<"+f.tag+'> tag; it should be "'+M.kind+'", not "'+f.kind+'"');if(!M.resolve(f.result,f.tag))A(f,"cannot resolve a node with !<"+f.tag+"> explicit tag");else if(f.result=M.construct(f.result,f.tag),f.anchor!==null)N(f,f.anchor,f.result)}if(f.listener!==null)f.listener("close",f);return f.depth-=1,f.tag!==null||f.anchor!==null||D}function Fl(f){let U=f.position,ne=!1,ie;f.version=null,f.checkLineBreaks=f.legacy,f.tagMap=Object.create(null),f.anchorMap=Object.create(null);while((ie=f.input.charCodeAt(f.position))!==0){if(De(f,!0,-1),ie=f.input.charCodeAt(f.position),f.lineIndent>0||ie!==37)break;ne=!0,ie=f.input.charCodeAt(++f.position);let X=f.position;while(ie!==0&&!O(ie))ie=f.input.charCodeAt(++f.position);let w=f.input.slice(X,f.position),V=[];if(w.length<1)A(f,"directive name must not be less than one character in length");while(ie!==0){while(k(ie))ie=f.input.charCodeAt(++f.position);if(ie===35){do ie=f.input.charCodeAt(++f.position);while(ie!==0&&!_(ie));break}if(_(ie))break;X=f.position;while(ie!==0&&!O(ie))ie=f.input.charCodeAt(++f.position);V.push(f.input.slice(X,f.position))}if(ie!==0)Ue(f);if(n.call(Se,w))Se[w](f,w,V);else q(f,'unknown document directive "'+w+'"')}if(De(f,!0,-1),f.lineIndent===0&&f.input.charCodeAt(f.position)===45&&f.input.charCodeAt(f.position+1)===45&&f.input.charCodeAt(f.position+2)===45)f.position+=3,De(f,!0,-1);else if(ne)A(f,"directives end mark is expected");if(On(f,f.lineIndent-1,l,!1,!0),De(f,!0,-1),f.checkLineBreaks&&h.test(f.input.slice(U,f.position)))q(f,"non-ASCII line breaks are interpreted as content");if(f.documents.push(f.result),f.position===f.lineStart&&Qe(f)){if(f.input.charCodeAt(f.position)===46)f.position+=3,De(f,!0,-1);return}if(f.position<f.length-1)A(f,"end of the stream or a document separator is expected")}function Qo(f,U){if(f=String(f),U=U||{},f.length!==0){if(f.charCodeAt(f.length-1)!==10&&f.charCodeAt(f.length-1)!==13)f+=`
|
|
267
267
|
`;if(f.charCodeAt(0)===65279)f=f.slice(1)}let ne=new I(f,U),ie=f.indexOf("\x00");if(ie!==-1)ne.position=ie,A(ne,"null byte is not allowed in input");ne.input+="\x00";while(ne.input.charCodeAt(ne.position)===32)ne.lineIndent+=1,ne.position+=1;while(ne.position<ne.length-1)Fl(ne);return ne.documents}function Ea(f,U,ne){if(U!==null&&typeof U==="object"&&typeof ne>"u")ne=U,U=null;let ie=Qo(f,ne);if(typeof U!=="function")return ie;for(let X=0,w=ie.length;X<w;X+=1)U(ie[X])}function Ia(f,U){let ne=Qo(f,U);if(ne.length===0)return;else if(ne.length===1)return ne[0];throw new t("expected a single document in the stream, but found more")}return Yh.loadAll=Ea,Yh.load=Ia,Yh}function AG(){if(KD)return vA;KD=1;let e=_d(),t=Ed(),r=wA(),o=Object.prototype.toString,n=Object.prototype.hasOwnProperty,i=65279,s=9,a=10,l=13,u=32,d=33,p=34,m=35,h=37,b=38,y=39,v=42,x=44,_=45,k=58,O=61,L=62,z=63,J=64,P=91,W=93,ee=96,j=123,T=124,Z=125,I={};I[0]="\\0",I[7]="\\a",I[8]="\\b",I[9]="\\t",I[10]="\\n",I[11]="\\v",I[12]="\\f",I[13]="\\r",I[27]="\\e",I[34]="\\\"",I[92]="\\\\",I[133]="\\N",I[160]="\\_",I[8232]="\\L",I[8233]="\\P";let R=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],A=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function q(w,V){if(V===null)return{};let g={},E=Object.keys(V);for(let D=0,H=E.length;D<H;D+=1){let M=E[D],te=String(V[M]);if(M.slice(0,2)==="!!")M="tag:yaml.org,2002:"+M.slice(2);let se=w.compiledTypeMap.fallback[M];if(se&&n.call(se.styleAliases,te))te=se.styleAliases[te];g[M]=te}return g}function N(w){let V,g,E=w.toString(16).toUpperCase();if(w<=255)V="x",g=2;else if(w<=65535)V="u",g=4;else if(w<=4294967295)V="U",g=8;else throw new t("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+V+e.repeat("0",g-E.length)+E}let K=1,G=2;function re(w){this.schema=w.schema||r,this.indent=Math.max(1,w.indent||2),this.noArrayIndent=w.noArrayIndent||!1,this.skipInvalid=w.skipInvalid||!1,this.flowLevel=e.isNothing(w.flowLevel)?-1:w.flowLevel,this.styleMap=q(this.schema,w.styles||null),this.sortKeys=w.sortKeys||!1,this.lineWidth=w.lineWidth||80,this.noRefs=w.noRefs||!1,this.noCompatMode=w.noCompatMode||!1,this.condenseFlow=w.condenseFlow||!1,this.quotingType=w.quotingType==='"'?G:K,this.forceQuotes=w.forceQuotes||!1,this.replacer=typeof w.replacer==="function"?w.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ae(w,V){let g=e.repeat(" ",V),E=0,D="",H=w.length;while(E<H){let M,te=w.indexOf(`
|
|
268
268
|
`,E);if(te===-1)M=w.slice(E),E=H;else M=w.slice(E,te+1),E=te+1;if(M.length&&M!==`
|
|
269
269
|
`)D+=g;D+=M}return D}function me(w,V){return`
|
|
270
|
-
`+e.repeat(" ",w.indent*V)}function Se(w,V){for(let g=0,E=w.implicitTypes.length;g<E;g+=1)if(w.implicitTypes[g].resolve(V))return!0;return!1}function xe(w){return w===u||w===s}function ke(w){return w>=32&&w<=126||w>=161&&w<=55295&&w!==8232&&w!==8233||w>=57344&&w<=65533&&w!==i||w>=65536&&w<=1114111}function Ae(w){return ke(w)&&w!==i&&w!==l&&w!==a}function _e(w,V,g){let E=Ae(w),D=E&&!xe(w);return(g?E:E&&w!==x&&w!==P&&w!==W&&w!==j&&w!==Z)&&w!==m&&!(V===k&&!D)||Ae(V)&&!xe(V)&&w===m||V===k&&D}function Ue(w){return ke(w)&&w!==i&&!xe(w)&&w!==_&&w!==z&&w!==k&&w!==x&&w!==P&&w!==W&&w!==j&&w!==Z&&w!==m&&w!==b&&w!==v&&w!==d&&w!==T&&w!==O&&w!==L&&w!==y&&w!==p&&w!==h&&w!==J&&w!==ee}function De(w){return!xe(w)&&w!==k}function Qe(w,V){let g=w.charCodeAt(V),E;if(g>=55296&&g<=56319&&V+1<w.length){if(E=w.charCodeAt(V+1),E>=56320&&E<=57343)return(g-55296)*1024+E-56320+65536}return g}function bt(w){return/^\n* /.test(w)}let Tt=1,Dt=2,lt=3,Or=4,$n=5;function Le(w,V,g,E,D,H,M,te){let se,be=0,fe=null,Te=!1,ze=!1,Cn=E!==-1,ds=-1,Hl=Ue(Qe(w,0))&&De(Qe(w,w.length-1));if(V||M)for(se=0;se<w.length;be>=65536?se+=2:se++){if(be=Qe(w,se),!ke(be))return $n;Hl=Hl&&_e(be,fe,te),fe=be}else{for(se=0;se<w.length;be>=65536?se+=2:se++){if(be=Qe(w,se),be===a){if(Te=!0,Cn)ze=ze||se-ds-1>E&&w[ds+1]!==" ",ds=se}else if(!ke(be))return $n;Hl=Hl&&_e(be,fe,te),fe=be}ze=ze||Cn&&(se-ds-1>E&&w[ds+1]!==" ")}if(!Te&&!ze){if(Hl&&!M&&!D(w))return Tt;return H===G?$n:Dt}if(g>9&&bt(w))return $n;if(!M)return ze?Or:lt;return H===G?$n:Dt}function
|
|
270
|
+
`+e.repeat(" ",w.indent*V)}function Se(w,V){for(let g=0,E=w.implicitTypes.length;g<E;g+=1)if(w.implicitTypes[g].resolve(V))return!0;return!1}function xe(w){return w===u||w===s}function ke(w){return w>=32&&w<=126||w>=161&&w<=55295&&w!==8232&&w!==8233||w>=57344&&w<=65533&&w!==i||w>=65536&&w<=1114111}function Ae(w){return ke(w)&&w!==i&&w!==l&&w!==a}function _e(w,V,g){let E=Ae(w),D=E&&!xe(w);return(g?E:E&&w!==x&&w!==P&&w!==W&&w!==j&&w!==Z)&&w!==m&&!(V===k&&!D)||Ae(V)&&!xe(V)&&w===m||V===k&&D}function Ue(w){return ke(w)&&w!==i&&!xe(w)&&w!==_&&w!==z&&w!==k&&w!==x&&w!==P&&w!==W&&w!==j&&w!==Z&&w!==m&&w!==b&&w!==v&&w!==d&&w!==T&&w!==O&&w!==L&&w!==y&&w!==p&&w!==h&&w!==J&&w!==ee}function De(w){return!xe(w)&&w!==k}function Qe(w,V){let g=w.charCodeAt(V),E;if(g>=55296&&g<=56319&&V+1<w.length){if(E=w.charCodeAt(V+1),E>=56320&&E<=57343)return(g-55296)*1024+E-56320+65536}return g}function bt(w){return/^\n* /.test(w)}let Tt=1,Dt=2,lt=3,Or=4,$n=5;function Le(w,V,g,E,D,H,M,te){let se,be=0,fe=null,Te=!1,ze=!1,Cn=E!==-1,ds=-1,Hl=Ue(Qe(w,0))&&De(Qe(w,w.length-1));if(V||M)for(se=0;se<w.length;be>=65536?se+=2:se++){if(be=Qe(w,se),!ke(be))return $n;Hl=Hl&&_e(be,fe,te),fe=be}else{for(se=0;se<w.length;be>=65536?se+=2:se++){if(be=Qe(w,se),be===a){if(Te=!0,Cn)ze=ze||se-ds-1>E&&w[ds+1]!==" ",ds=se}else if(!ke(be))return $n;Hl=Hl&&_e(be,fe,te),fe=be}ze=ze||Cn&&(se-ds-1>E&&w[ds+1]!==" ")}if(!Te&&!ze){if(Hl&&!M&&!D(w))return Tt;return H===G?$n:Dt}if(g>9&&bt(w))return $n;if(!M)return ze?Or:lt;return H===G?$n:Dt}function uo(w,V,g,E,D){w.dump=function(){if(V.length===0)return w.quotingType===G?'""':"''";if(!w.noCompatMode){if(R.indexOf(V)!==-1||A.test(V))return w.quotingType===G?'"'+V+'"':"'"+V+"'"}let H=w.indent*Math.max(1,g),M=w.lineWidth===-1?-1:Math.max(Math.min(w.lineWidth,40),w.lineWidth-H),te=E||w.flowLevel>-1&&g>=w.flowLevel;function se(be){return Se(w,be)}switch(Le(V,te,w.indent,M,se,w.quotingType,w.forceQuotes&&!E,D)){case Tt:return V;case Dt:return"'"+V.replace(/'/g,"''")+"'";case lt:return"|"+cs(V,w.indent)+ls(ae(V,H));case Or:return">"+cs(V,w.indent)+ls(ae(_a(V,M),H));case $n:return'"'+On(V)+'"';default:throw new t("impossible error: invalid scalar style")}}()}function cs(w,V){let g=bt(w)?String(V):"",E=w[w.length-1]===`
|
|
271
271
|
`,H=E&&(w[w.length-2]===`
|
|
272
272
|
`||w===`
|
|
273
273
|
`)?"+":E?"":"-";return g+H+`
|
|
@@ -278,11 +278,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
278
278
|
`:"")+us(se,V),D=H}return E}function us(w,V){if(w===""||w[0]===" ")return w;let g=/ [^ ]/g,E,D=0,H,M=0,te=0,se="";while(E=g.exec(w)){if(te=E.index,te-D>V)H=M>D?M:te,se+=`
|
|
279
279
|
`+w.slice(D,H),D=H+1;M=te}if(se+=`
|
|
280
280
|
`,w.length-D>V&&M>D)se+=w.slice(D,M)+`
|
|
281
|
-
`+w.slice(M+1);else se+=w.slice(D);return se.slice(1)}function On(w){let V="",g=0;for(let E=0;E<w.length;g>=65536?E+=2:E++){g=Qe(w,E);let D=I[g];if(!D&&ke(g)){if(V+=w[E],g>=65536)V+=w[E+1]}else V+=D||N(g)}return V}function Fl(w,V,g){let E="",D=w.tag;for(let H=0,M=g.length;H<M;H+=1){let te=g[H];if(w.replacer)te=w.replacer.call(g,String(H),te);if(U(w,V,te,!1,!1)||typeof te>"u"&&U(w,V,null,!1,!1)){if(E!=="")E+=","+(!w.condenseFlow?" ":"");E+=w.dump}}w.tag=D,w.dump="["+E+"]"}function Qo(w,V,g,E){let D="",H=w.tag;for(let M=0,te=g.length;M<te;M+=1){let se=g[M];if(w.replacer)se=w.replacer.call(g,String(M),se);if(U(w,V+1,se,!0,!0,!1,!0)||typeof se>"u"&&U(w,V+1,null,!0,!0,!1,!0)){if(!E||D!=="")D+=me(w,V);if(w.dump&&a===w.dump.charCodeAt(0))D+="-";else D+="- ";D+=w.dump}}w.tag=H,w.dump=D||"[]"}function Ea(w,V,g){let E="",D=w.tag,H=Object.keys(g);for(let M=0,te=H.length;M<te;M+=1){let se="";if(E!=="")se+=", ";if(w.condenseFlow)se+='"';let be=H[M],fe=g[be];if(w.replacer)fe=w.replacer.call(g,be,fe);if(!U(w,V,be,!1,!1))continue;if(w.dump.length>1024)se+="? ";if(se+=w.dump+(w.condenseFlow?'"':"")+":"+(w.condenseFlow?"":" "),!U(w,V,fe,!1,!1))continue;se+=w.dump,E+=se}w.tag=D,w.dump="{"+E+"}"}function Ia(w,V,g,E){let D="",H=w.tag,M=Object.keys(g);if(w.sortKeys===!0)M.sort();else if(typeof w.sortKeys==="function")M.sort(w.sortKeys);else if(w.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let te=0,se=M.length;te<se;te+=1){let be="";if(!E||D!=="")be+=me(w,V);let fe=M[te],Te=g[fe];if(w.replacer)Te=w.replacer.call(g,fe,Te);if(!U(w,V+1,fe,!0,!0,!0))continue;let ze=w.tag!==null&&w.tag!=="?"||w.dump&&w.dump.length>1024;if(ze)if(w.dump&&a===w.dump.charCodeAt(0))be+="?";else be+="? ";if(be+=w.dump,ze)be+=me(w,V);if(!U(w,V+1,Te,!0,ze))continue;if(w.dump&&a===w.dump.charCodeAt(0))be+=":";else be+=": ";be+=w.dump,D+=be}w.tag=H,w.dump=D||"{}"}function f(w,V,g){let E=g?w.explicitTypes:w.implicitTypes;for(let D=0,H=E.length;D<H;D+=1){let M=E[D];if((M.instanceOf||M.predicate)&&(!M.instanceOf||typeof V==="object"&&V instanceof M.instanceOf)&&(!M.predicate||M.predicate(V))){if(g)if(M.multi&&M.representName)w.tag=M.representName(V);else w.tag=M.tag;else w.tag="?";if(M.represent){let te=w.styleMap[M.tag]||M.defaultStyle,se;if(o.call(M.represent)==="[object Function]")se=M.represent(V,te);else if(n.call(M.represent,te))se=M.represent[te](V,te);else throw new t("!<"+M.tag+'> tag resolver accepts not "'+te+'" style');w.dump=se}return!0}}return!1}function U(w,V,g,E,D,H,M){if(w.tag=null,w.dump=g,!f(w,g,!1))f(w,g,!0);let te=o.call(w.dump),se=E;if(E)E=w.flowLevel<0||w.flowLevel>V;let be=te==="[object Object]"||te==="[object Array]",fe,Te;if(be)fe=w.duplicates.indexOf(g),Te=fe!==-1;if(w.tag!==null&&w.tag!=="?"||Te||w.indent!==2&&V>0)D=!1;if(Te&&w.usedDuplicates[fe])w.dump="*ref_"+fe;else{if(be&&Te&&!w.usedDuplicates[fe])w.usedDuplicates[fe]=!0;if(te==="[object Object]"){if(E&&Object.keys(w.dump).length!==0){if(Ia(w,V,w.dump,D),Te)w.dump="&ref_"+fe+w.dump}else if(Ea(w,V,w.dump),Te)w.dump="&ref_"+fe+" "+w.dump}else if(te==="[object Array]"){if(E&&w.dump.length!==0){if(w.noArrayIndent&&!M&&V>0)Qo(w,V-1,w.dump,D);else Qo(w,V,w.dump,D);if(Te)w.dump="&ref_"+fe+w.dump}else if(Fl(w,V,w.dump),Te)w.dump="&ref_"+fe+" "+w.dump}else if(te==="[object String]"){if(w.tag!=="?")
|
|
282
|
-
`;return""}return vA.dump=X,vA}function kG(){if(VD)return nr;VD=1;let e=IG(),t=AG();function r(o,n){return function(){throw Error("Function yaml."+o+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}return nr.Type=gr(),nr.Schema=WD(),nr.FAILSAFE_SCHEMA=XD(),nr.JSON_SCHEMA=oL(),nr.CORE_SCHEMA=iL(),nr.DEFAULT_SCHEMA=wA(),nr.load=e.load,nr.loadAll=e.loadAll,nr.dump=t.dump,nr.YAMLException=Ed(),nr.types={binary:cL(),float:nL(),map:YD(),null:eL(),pairs:uL(),set:dL(),timestamp:sL(),bool:tL(),int:rL(),merge:aL(),omap:lL(),seq:QD(),str:GD()},nr.safeLoad=r("safeLoad","load"),nr.safeLoadAll=r("safeLoadAll","loadAll"),nr.safeDump=r("safeDump","dump"),nr}var nr,Yh,Oi,ED,XI,ID,eA,AD,tA,kD,rA,RD,nA,TD,oA,$D,iA,OD,sA,CD,aA,PD,cA,zD,lA,ND,uA,DD,dA,LD,pA,ZD,fA,jD,mA,BD,hA,UD,gA,MD,yA,qD,bA,FD,SA,HD,JD,vA,KD,VD,RG,pL,Oc,TG,$G,OG,CG,xA,Cc,PG,Id,zG,NG,DG,LG,ZG;var Pc=S(()=>{nr={},Yh={},Oi={};vA={};RG=kG(),pL=_G(RG),{Type:Oc,Schema:TG,FAILSAFE_SCHEMA:$G,JSON_SCHEMA:OG,CORE_SCHEMA:CG,DEFAULT_SCHEMA:xA,load:Cc,loadAll:PG,dump:Id,YAMLException:zG,types:NG,safeLoad:DG,safeLoadAll:LG,safeDump:ZG}=pL});function zc(e){return Id(e,{skipInvalid:!0,noRefs:!0,sortKeys:!0})}function fL(e){return Cc(e)}function yr(e,t){if(!e.trim())return{ok:!1,error:"file is empty"};let r;try{r=Cc(e)}catch(n){return{ok:!1,error:Ve(n,"YAML parse error")}}if(!jG(r))return{ok:!1,error:"expected a YAML mapping (key: value pairs)"};if(!t)return{ok:!0,data:r};let o=t.safeParse(r);if(!o.success)return{ok:!1,error:`invalid field(s): ${o.error.issues.map((i)=>i.path.map(String).join(".")).join(", ")}`};return{ok:!0,data:o.data}}function jG(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}var Vn=S(()=>{Pc()});var _A,mL;var EA=S(()=>{de();_A=c.object({title:c.string().trim().min(1).max(500).optional(),introduction:c.string().trim().min(1).max(4000).optional(),topics:c.array(c.string().trim().min(1).max(500)).max(20).optional(),topicsHeading:c.string().trim().min(1).max(120).optional(),contactLabel:c.string().trim().min(1).max(80).optional(),contactNote:c.string().trim().min(1).max(240).optional(),mapCaption:c.string().trim().min(1).max(160).optional(),refusal:c.string().trim().min(1).max(500).optional(),faqHeading:c.string().trim().min(1).max(120).optional()}),mL=_A.omit({introduction:!0})});function Vs(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function gL(e){let t=Reflect.get(Ks,"types"),r=Vs(t)?t[e]:void 0;if(!(r instanceof Oc))throw Error(`Required YAML type is unavailable: ${e}`);return r}function MG(e,t){let r=0,o=1;for(let n of e.split(":").reverse())r+=(t?Number.parseFloat(n):Number.parseInt(n,10))*o,o*=60;return r}function hL(e){let t=gL(e);return new Oc(`tag:yaml.org,2002:${e}`,{kind:"scalar",resolve:(r)=>typeof r==="string"&&(e==="int"?BG:UG).test(r)&&!r.endsWith("_"),construct:(r)=>{let o=r.replace(/_/g,""),n=o.startsWith("-")?-1:1,i=o.replace(/^[+-]/,"");if(i.includes(":"))return n*MG(i,e==="float");if(e==="int"&&i==="0")return 0;if(e==="int"&&/^0[0-7]+$/.test(i))return n*Number.parseInt(i,8);return t.construct(o)},predicate:t.predicate??void 0,represent:t.represent??void 0,defaultStyle:t.defaultStyle??void 0})}var BG,UG,IA,qG,FG,HG;var yL=S(()=>{Pc();BG=/^[+-]?(?:0|0b[01_]*[01]|0x[\da-fA-F_]*[\da-fA-F]|0[0-7_]*[0-7]|[1-9](?:[\d_]*\d)?|[1-9][\d_]*(?::[0-5]?\d)+)$/,UG=/^(?:[-+]?(?:0|[1-9][\d_]*)(?:\.[\d_]*)?(?:[eE][-+]?\d+)?|\.[\d_]+(?:[eE][-+]?\d+)?|[-+]?\d[\d_]*(?::[0-5]?\d)+\.[\d_]*|[-+]?\.(?:inf|Inf|INF)|\.(?:nan|NaN|NAN))$/;IA=gL("binary"),qG=new Oc("tag:yaml.org,2002:binary",{kind:"scalar",resolve:(e)=>IA.resolve(e),construct:(e)=>{let t=IA.construct(e);if(!(t instanceof Uint8Array))throw Error("Invalid YAML binary result");return typeof Buffer>"u"?Array.from(t):Buffer.from(t)},predicate:(e)=>typeof Buffer<"u"&&Buffer.isBuffer(e),represent:IA.represent??void 0}),FG=new Oc("tag:yaml.org,2002:str",{kind:"scalar",resolve:(e)=>typeof e==="string"&&e.includes(":"),construct:(e)=>e}),HG=xA.extend({implicit:[hL("int"),hL("float"),FG],explicit:[qG]})});var bL=S(()=>{Pc();yL()});var SL,vL,wL,JG;var AA=S(()=>{bL();de();SL=c.object({audiences:c.array(c.string()).optional(),positioning:c.string().optional()}),vL=c.object({summary:c.string().optional(),traits:c.array(c.string()).optional(),principles:c.array(c.string()).optional(),preferredTerms:c.array(c.string()).optional(),avoid:c.array(c.string()).optional()}),wL=c.object({artDirection:c.string().optional(),palette:c.array(c.string()).optional(),composition:c.string().optional(),mood:c.string().optional(),preferred:c.array(c.string()).optional(),avoid:c.array(c.string()).optional()}),JG=c.object({name:c.string().describe("Style guide name"),messaging:SL.optional(),voice:vL.optional(),visual:wL.optional()})});var _L=S(()=>{EA();AA()});var Nc,wEe,kA="data-ask-sheet",KG;var RA=S(()=>{de();Nc=c.object({name:c.string().trim().min(1).max(200),url:c.string().url().optional()}),wEe=c.object({sources:c.array(c.object({id:c.string(),title:c.string(),brain:Nc.optional()}))}),KG=`body *:not([${kA}], [${kA}] *) { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }`});import{createHash as VG}from"crypto";function Xh(e){return VG("sha256").update(e).digest("hex")}var eg=()=>{};var Wn;var Ad=S(()=>{de();eg();Wn=c.discriminatedUnion("kind",[c.object({kind:c.literal("user"),userId:c.string().min(1),canonicalId:c.string().min(1).optional()}),c.object({kind:c.literal("external"),externalActorId:c.string().min(1)}),c.object({kind:c.literal("agent"),agentId:c.string().min(1)}),c.object({kind:c.literal("service"),serviceId:c.string().min(1)})])});var WG,TEe,Dc,GG,QG,EL,$Ee,YG,XG,IL;var AL=S(()=>{de();WG=c.strictObject({messageCharacters:c.number().int().positive(),requestTimeoutSeconds:c.number().int().positive().max(2147483)}),TEe=c.strictObject({limits:WG,maxCostMicroUsd:c.number().int().positive()}),Dc=c.number().int().nonnegative(),GG=c.strictObject({modelCalls:Dc,inputTokens:Dc,cachedInputTokens:Dc,outputTokens:Dc,reasoningTokens:Dc,embeddingTokens:Dc}),QG=c.discriminatedUnion("state",[c.strictObject({state:c.literal("known"),microUsd:c.number().int().nonnegative(),pricing:c.string().trim().min(1).max(120)}),c.strictObject({state:c.literal("unknown"),reason:c.enum(["missing-usage","unsupported-pricing"])})]),EL=c.strictObject({usage:GG,cost:QG}),$Ee=c.strictObject({topics:c.array(c.string().trim().min(1).max(500)).max(20),introduction:c.string().trim().min(1).max(4000).optional(),refusal:c.string().trim().min(1).max(500).optional()}),YG=c.enum(["in-scope","off-topic","abusive","injection","harmful"]),XG=YG.exclude(["in-scope"]),IL=c.discriminatedUnion("outcome",[c.strictObject({outcome:c.literal("answered")}),c.strictObject({outcome:c.literal("refused"),category:XG}),c.strictObject({outcome:c.literal("unscreened")})])});function tQ(e){let t=eQ.safeParse(e);if(!t.success)return e;return{...t.data,cards:t.data.cards.filter((r)=>TA.safeParse(r).success)}}var kL,RL,TL,$L,OL,CL,Lc,PL,zL,NL,DL,LL,TA,ZL,jL,BL,eQ,UL;var kd=S(()=>{de();RA();AL();kL=c.object({id:c.string(),toolCallId:c.string().optional(),toolName:c.string(),summary:c.string(),completionSummary:c.string().optional(),preview:c.string().optional(),args:c.unknown()}),RL=c.enum(["approval-requested","approval-responded","output-available","output-denied","output-error"]),TL=c.object({kind:c.literal("tool-approval"),id:c.string(),toolCallId:c.string().optional(),toolName:c.string(),input:c.record(c.string(),c.unknown()).optional(),summary:c.string(),completionSummary:c.string().optional(),preview:c.string().optional(),state:RL,output:c.unknown().optional(),error:c.string().optional()}),$L=c.object({entityType:c.string().optional(),entityId:c.string().optional(),attachmentType:c.string().optional()}),OL=c.object({mediaType:c.string().min(1),url:c.string().min(1),downloadUrl:c.string().min(1).optional(),previewUrl:c.string().min(1).optional(),filename:c.string().min(1).optional(),sizeBytes:c.number().nonnegative().optional(),source:$L.optional()}),CL=c.object({kind:c.literal("attachment"),id:c.string(),jobId:c.string().optional(),title:c.string(),description:c.string().optional(),attachment:OL}),Lc=c.object({id:c.string().min(1),title:c.string().min(1).optional(),source:c.string().min(1),url:c.string().min(1).optional(),entityType:c.string().min(1).optional(),entityId:c.string().min(1).optional(),excerpt:c.string().min(1).optional(),provenance:c.record(c.string(),c.unknown()).optional(),brain:Nc.optional()}),PL=c.object({kind:c.literal("sources"),id:c.string().min(1),title:c.string().min(1).optional(),sources:c.array(Lc).min(1)}),zL=c.object({type:c.literal("prompt"),id:c.string().min(1),label:c.string().min(1),prompt:c.string().min(1),description:c.string().min(1).optional()}),NL=c.object({type:c.literal("event"),id:c.string().min(1),label:c.string().min(1),event:c.string().min(1),fromState:c.string().min(1).optional(),description:c.string().min(1).optional()}),DL=c.discriminatedUnion("type",[zL,NL]),LL=c.object({kind:c.literal("actions"),id:c.string().min(1),title:c.string().min(1).optional(),defaultOpen:c.boolean().optional(),actions:c.array(DL).min(1)}),TA=c.discriminatedUnion("kind",[TL,CL,PL,LL]),ZL=c.object({toolName:c.string(),args:c.record(c.string(),c.unknown()).optional(),jobId:c.string().optional(),data:c.unknown().optional(),error:c.object({message:c.string(),code:c.string().optional()}).optional()}),jL=c.object({faqId:c.string().min(1)}),BL=c.object({text:c.string(),error:c.string().optional(),toolResults:c.array(ZL).optional(),cards:c.array(TA).optional(),pendingConfirmations:c.array(kL).optional(),usage:c.object({promptTokens:c.number(),completionTokens:c.number(),totalTokens:c.number()}),guestSettlement:EL.optional(),guestScreening:IL.optional(),askedBefore:jL.optional()}),eQ=c.looseObject({cards:c.array(c.unknown())});UL=c.preprocess((e)=>tQ(Qh(e)),BL)});function ye(e){return Object.freeze({name:e.channel,schema:e.request,response:e.response,delivery:e.delivery})}function Gn(e,t){return Object.freeze({name:e,schema:t})}var jEe;var tg=S(()=>{de();jEe=c.object({name:c.string(),schema:c.custom((e)=>typeof e==="object"&&e!==null&&("safeParse"in e))})});var rg,rQ,nQ,oQ,iQ,ML,sQ,aQ,cQ,lQ,uQ,dQ,qL,FL,HL,pQ,JL,fQ,KL,mQ,VL,hQ;var WL=S(()=>{de();Ad();kd();tg();rg=c.object({state:c.string(),response:c.string(),sources:c.array(Lc)}),rQ=c.object({agent:c.string().trim().min(1).max(253),question:c.string().trim().min(1).max(4000)}),nQ=ye({channel:"a2a:ask:request",request:rQ,response:rg,delivery:"request"}),oQ=c.object({agent:c.string().trim().min(1).max(253),message:c.string().trim().min(1).max(32000)}),iQ=ye({channel:"a2a:turn:request",request:oQ,response:rg,delivery:"request"}),ML=c.object({entityType:c.string().optional(),entityId:c.string().optional(),actor:Wn.optional(),interfaceType:c.string().optional(),userPermissionLevel:c.enum(["admin","trusted","public"])}),sQ=c.object({agent:c.string().trim().min(1).max(253),instruction:c.string().trim().min(1).max(2000),selection:c.string().min(1).max(8000),...ML.shape}),aQ=ye({channel:"a2a:call:request",request:sQ,response:rg,delivery:"request"}),cQ=c.object({agents:c.array(c.object({id:c.string(),label:c.string()}))}),lQ=ye({channel:"a2a:call:agents",request:ML,response:cQ,delivery:"request"}),uQ=c.object({approvedAt:c.string(),approvedBy:c.string().optional()}),dQ=c.discriminatedUnion("op",[c.object({op:c.literal("get"),entityType:c.string().min(1),id:c.string().min(1)}),c.object({op:c.literal("list")})]),qL=c.object({entities:c.array(c.object({entityType:c.string().min(1),id:c.string().min(1),title:c.string()}))}),FL=c.object({signedAt:c.string().min(1),keyId:c.string().min(1),signature:c.string().min(1)}),HL=c.object({entityType:c.string().min(1),id:c.string().min(1),markdown:c.string(),contentHash:c.string().min(1),attestation:FL}),pQ=c.object({agent:c.string().min(1),entityType:c.string().min(1),id:c.string().min(1)}),JL=c.discriminatedUnion("status",[c.object({status:c.literal("found"),entity:HL}),c.object({status:c.literal("not-found")}),c.object({status:c.literal("refused"),code:c.string(),error:c.string()})]),fQ=ye({channel:"a2a:shared-entity:get",request:pQ,response:JL,delivery:"request"}),KL=c.discriminatedUnion("status",[c.object({status:c.literal("found"),entities:qL.shape.entities}),c.object({status:c.literal("not-found")}),c.object({status:c.literal("refused"),code:c.string(),error:c.string()})]),mQ=ye({channel:"a2a:shared-entity:list",request:c.object({agent:c.string().min(1)}),response:KL,delivery:"request"}),VL=c.object({domain:c.string().min(1),level:c.enum(["trusted","public"])}),hQ=Gn("a2a:peer-trust-changed",VL)});var gQ,GL,yQ,bQ;var QL=S(()=>{de();kd();gQ=c.object({type:c.literal("event"),event:c.string().min(1),fromState:c.string().min(1).optional()}),GL=c.object({conversationId:c.string().min(1),interfaceType:c.string().min(1),channelId:c.string().min(1).optional(),channelName:c.string().min(1),userPermissionLevel:c.enum(["admin","trusted","public"]),isAnchor:c.boolean(),action:gQ}),yQ=UL.nullable(),bQ=ye({channel:"agent:action:request",request:GL,response:yQ,delivery:"request"})});var YL,SQ,XL,vQ;var eZ=S(()=>{de();kd();YL=c.object({question:c.string().trim().min(1)}),SQ=c.object({faqId:c.string().min(1),faqQuestion:c.string().min(1),answer:c.string().trim().min(1),sources:c.array(Lc).default([])}),XL=c.object({hit:SQ.optional()}),vQ=ye({channel:"guest:asked-before",request:YL,response:XL,delivery:"collect"})});var rZ,tZ,nZ,oZ,wQ,iZ,sZ,aZ,xQ;var cZ=S(()=>{de();rZ=c.enum(["studio","drive","file","git"]),tZ=c.enum(["public","shared","restricted"]),nZ=c.object({entityType:c.string().min(1),entityId:c.string().min(1),origin:rZ,actor:c.string().min(1).optional(),base:c.string().min(1).optional(),current:c.string().min(1),text:c.string(),targetVisibility:tZ,declaredVisibility:tZ.optional()}),oZ=c.object({conflictId:c.string().min(1),created:c.boolean()}),wQ=ye({channel:"conflict:record",request:nZ,response:oZ,delivery:"request"}),iZ=c.enum(["apply","keep-current"]),sZ=c.object({conflictId:c.string().min(1),action:iZ,userId:c.string().min(1),permissionLevel:c.enum(["admin","trusted","public"])}),aZ=c.object({resolved:c.literal(!0)}),xQ=ye({channel:"conflict:resolve",request:sZ,response:aZ,delivery:"request"})});var _Q,lZ,uZ,sIe,EQ,IQ;var dZ=S(()=>{de();_Q=c.enum(["admin","trusted","public"]),lZ=c.object({conversationId:c.string().min(1),message:c.string(),interfaceType:c.string().min(1),channelId:c.string().optional(),channelName:c.string().optional(),userPermissionLevel:_Q}),uZ=c.object({id:c.string().min(1),source:c.string().min(1),title:c.string().optional(),content:c.string().min(1),provenance:c.record(c.string(),c.unknown()).optional()}),sIe=c.object({items:c.array(uZ).default([])}),EQ=c.object({items:c.array(c.unknown()).default([]).transform((e)=>e.flatMap((t)=>{let r=uZ.safeParse(t);return r.success?[r.data]:[]}))}),IQ=ye({channel:"agent:context:request",request:lZ,response:EQ,delivery:"collect"})});var AQ,kQ;var pZ=S(()=>{de();AQ=c.strictObject({entityType:c.string().min(1),entityId:c.string().min(1)}),kQ=c.strictObject({startedAt:c.string().datetime(),retrieved:c.array(AQ).max(50)})});var fZ,RQ,mZ,TQ;var hZ=S(()=>{de();Ad();fZ=c.object({actor:Wn}),RQ=c.object({userId:c.string().min(1),personId:c.string().min(1),canonicalId:c.string().min(1).optional(),displayName:c.string().min(1),permissionLevel:c.enum(["admin","trusted","public"])}),mZ=c.object({principal:RQ.nullable()}),TQ=ye({channel:"auth:principal:resolve",request:fZ,response:mZ,delivery:"request"})});var gZ,$Q;var yZ=S(()=>{de();gZ=c.object({type:c.string().regex(/^[a-z][a-z0-9-]*$/),subjectPrefix:c.string().max(32).default(""),subjectSuffix:c.string().max(255).default("")}),$Q=c.object({clientId:c.string().regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/).min(3).max(64),clientSecret:c.string().min(32).max(512),clientName:c.string().trim().min(1).max(200),redirectUris:c.array(c.url()).min(1).max(10),identityClaim:gZ.optional()})});var bZ=()=>{};var SZ=()=>{};var $A,OQ,vZ,CQ,PQ;var wZ=S(()=>{de();$A=c.strictObject({name:c.string().min(1).optional(),address:c.email()}),OQ=c.strictObject({personId:c.string().min(1).max(200),displayName:c.string().trim().min(1).max(200),permissionLevel:c.enum(["admin","trusted","public"])}),vZ=c.strictObject({messageId:c.string().min(1),sourceRef:c.string().min(1),threadId:c.string().min(1).optional(),from:$A,replyTo:$A.optional(),to:c.array($A),subject:c.string(),receivedAt:c.iso.datetime(),text:c.string(),html:c.string().min(1).optional(),headers:c.strictObject({listUnsubscribe:c.string().min(1).optional(),autoSubmitted:c.string().min(1).optional(),precedence:c.string().min(1).optional(),inReplyTo:c.string().min(1).optional(),references:c.array(c.string().min(1)).optional()}),sender:OQ.optional()}),CQ=c.strictObject({}),PQ=ye({channel:"email:inbound",request:vZ,response:CQ,delivery:"request"})});var zQ,NQ,xZ,OA,DQ,_Z,LQ;var EZ=S(()=>{de();zQ=c.strictObject({permissionLevel:c.enum(["admin","trusted","public"])}),NQ=c.custom((e)=>typeof AbortSignal<"u"&&e instanceof AbortSignal),xZ=c.strictObject({sourceRef:c.string().regex(/^imap:[a-f0-9]{64}$/),actor:zQ,signal:NQ.optional()}),OA=c.strictObject({name:c.string().trim().min(1).max(300).optional(),address:c.email().max(320)}),DQ=c.strictObject({messageId:c.string().trim().min(1).max(2000),from:OA,replyTo:OA.optional(),to:c.array(OA).max(100),subject:c.string().max(1000),receivedAt:c.iso.datetime(),text:c.string().max(1e5),inReplyTo:c.string().trim().min(1).max(2000).optional(),references:c.array(c.string().trim().min(1).max(2000)).max(100),truncated:c.boolean()}),_Z=c.discriminatedUnion("kind",[c.strictObject({kind:c.literal("available"),message:DQ}),c.strictObject({kind:c.literal("unavailable")})]),LQ=ye({channel:"email:source-read",request:xZ,response:_Z,delivery:"request"})});var IZ=S(()=>{eg()});var ZQ;var AZ=S(()=>{de();ZQ=c.object({url:c.string(),authToken:c.string().optional()})});var jQ;var kZ=S(()=>{de();jQ=c.object({success:c.boolean(),entityId:c.string().optional(),error:c.string().optional()})});var RZ=()=>{};function ng(e,t="handler_failed"){let r=t,o;try{if(e!==null&&typeof e==="object"){let n=Rd.safeParse(Reflect.get(e,"code"));if(n.success)r=n.data,o=Td.shape.message.safeParse(Reflect.get(e,"publicMessage")).data;else{let i=Reflect.get(e,"name");if(i==="AbortError")r="cancelled";if(i==="TimeoutError")r="deadline_exceeded"}}}catch{}return new Ci(r,{cause:e,...o!==void 0?{publicMessage:o}:{}})}var Rd,$Z=1024,Td,TZ,Ci;var OZ=S(()=>{de();Rd=c.enum(["no_handler","handler_failed","invalid_input","invalid_response","unauthenticated","permission_denied","not_found","conflict","cancelled","deadline_exceeded"]),Td=c.object({code:Rd,message:c.string().max($Z)}),TZ={no_handler:"No handler is available for this capability",handler_failed:"The operation failed",invalid_input:"Invalid input",invalid_response:"Invalid response",unauthenticated:"Authentication required",permission_denied:"Permission denied",not_found:"Not found",conflict:"The operation conflicts with the current state",cancelled:"The operation was cancelled",deadline_exceeded:"The execution deadline was exceeded"};Ci=class Ci extends Error{code;publicMessage;constructor(e,t={}){let r=Rd.parse(e),o=Td.shape.message.parse(t.publicMessage??TZ[r]);super(t.message??o,{cause:t.cause});this.name="SdkError",this.code=r,this.publicMessage=o}toJSON(){let e=Rd.safeParse(this.code),t=e.data??"handler_failed",r=e.success?Td.shape.message.safeParse(this.publicMessage).data:void 0;return{code:t,message:r??TZ[t]}}}});var og,ig;var CA=S(()=>{de();og=c.lazy(()=>c.union([c.null(),c.boolean(),c.number().finite().refine((e)=>!Number.isInteger(e)||Number.isSafeInteger(e),{message:"integer exceeds the JSON-safe range"}),c.string(),c.array(og),c.record(c.string(),og)])),ig=c.record(c.string(),og)});var BQ;var CZ=S(()=>{de();BQ=c.enum(["user","assistant"])});var UQ,Ro;var PZ=S(()=>{de();UQ=c.object({entityType:c.string().min(1),entityId:c.string().min(1),contentHash:c.string().min(1).optional()}),Ro=c.object({rootJobId:c.string().min(1),causationId:c.string().min(1),projectionId:c.string().min(1).optional(),projectionLineage:c.array(c.string().min(1)),sourceEntity:UQ.optional(),derivationDepth:c.number().int().nonnegative()}).superRefine((e,t)=>{if(e.derivationDepth!==e.projectionLineage.length)t.addIssue({code:"custom",path:["derivationDepth"],message:"Derivation depth must equal projection lineage length"});let r=e.projectionLineage.at(-1);if(e.projectionId!==r)t.addIssue({code:"custom",path:["projectionId"],message:"Current projection must equal the final projection lineage entry"})})});var PA=10,zZ=82,zA,MQ,qQ,FQ,HQ,JQ,KQ;var NZ=S(()=>{de();zA=c.object({title:c.string().min(1).max(200),lines:c.array(c.string().min(1)).min(1).max(PA),actions:c.array(c.object({label:c.string().min(1).max(80),value:c.string().min(1).max(zZ)})).max(PA)}),MQ=zA.extend({channelId:c.string().min(1),interfaceType:c.string().min(1),reactions:c.array(c.object({messageId:c.string().min(1),emoji:c.string().min(1)}))}),qQ=c.object({messageId:c.string().min(1)}),FQ=c.object({conversationId:c.string().min(1),noticeMessageId:c.string().min(1),value:c.string().min(1),by:c.string().min(1)}),HQ=ye({channel:"chat:space-notice",request:MQ,response:qQ,delivery:"request"}),JQ=zA.nullable(),KQ=ye({channel:"chat:space-notice-action",request:FQ,response:JQ,delivery:"collect"})});var NA,DA,VQ,WQ,GQ,QQ;var DZ=S(()=>{de();tg();NA={progress:"job-progress"},DA={completed:"publish:completed",failed:"publish:failed"},VQ=c.object({entityType:c.string().min(1),entityId:c.string().min(1),result:c.object({id:c.string(),url:c.string().optional()})}),WQ=c.object({entityType:c.string().min(1),entityId:c.string().min(1),error:c.string(),retryCount:c.number(),willRetry:c.boolean()}),GQ=Gn(DA.completed,VQ),QQ=Gn(DA.failed,WQ)});var LA=()=>{};var GIe;var LZ=S(()=>{de();LA();GIe=c.object({public:c.boolean(),preview:c.boolean()})});var ZZ,jZ,XQ;var BZ=S(()=>{de();ZZ=c.object({entityType:c.string().min(1),entityId:c.string(),metadata:c.record(c.string(),c.unknown()).default({}),content:c.string().default("")}),jZ=c.object({relativePath:c.string(),leaf:c.object({start:c.number().int().nonnegative(),end:c.number().int().nonnegative()}).nullable(),owner:c.object({entityType:c.string(),id:c.string()}).optional(),writable:c.boolean().optional()}),XQ=ye({channel:"sync:path:request",request:ZZ,response:jZ,delivery:"request"})});var eY,tY,rY,nY;var UZ=S(()=>{de();eY=c.strictObject({}),tY=c.object({branch:c.string(),hasChanges:c.boolean(),ahead:c.number(),behind:c.number(),lastCommit:c.string().nullable(),remote:c.string().nullable()}),rY=c.object({syncPath:c.string(),isInitialized:c.boolean(),watchEnabled:c.boolean(),lastSync:c.string().nullable(),totalFiles:c.number(),byEntityType:c.record(c.string(),c.number()),git:tY.nullable(),managementUrl:c.string().optional()}),nY=ye({channel:"sync:status:request",request:eY,response:rY,delivery:"request"})});var MZ=()=>{};var qZ,oY,iY;var FZ=S(()=>{de();qZ=c.strictObject({waveId:c.string().trim().min(1),sourceTypes:c.array(c.string().trim().min(1)),changedTargetTypes:c.array(c.string().trim().min(1))}),oY=c.strictObject({}),iY=ye({channel:"projection:wave-ready",request:qZ,response:oY,delivery:"collect"})});var sY,aY,cY,lY;var HZ=S(()=>{de();sY=c.strictObject({}),aY=c.object({entityType:c.string().min(1),entityId:c.string().min(1),previousHash:c.string().min(1),contentHash:c.string().min(1)}),cY=c.object({restated:c.array(aY)}),lY=ye({channel:"stored-content:restate",request:sY,response:cY,delivery:"collect"})});var uY,dY,pY;var JZ=S(()=>{de();uY=c.strictObject({}),dY=c.string(),pY=ye({channel:"plugin:site-builder:head-scripts",request:uY,response:dY,delivery:"collect"})});function KZ(e){return typeof e==="function"}var VZ=".site-build-manifest.json",fY,mY,hY,gY;var WZ=S(()=>{de();fY=`/${VZ}`,mY=ye({channel:"site:build:requested",request:c.object({reason:c.string().min(1)}),response:c.void(),delivery:"command"});hY=c.object({outputDir:c.string(),environment:c.enum(["preview","production"]),routesBuilt:c.number(),siteConfig:c.object({title:c.string().optional(),description:c.string().optional(),url:c.string().optional(),copyright:c.string().optional(),themeMode:c.enum(["light","dark"]).optional()}),generateEntityUrl:c.custom(KZ),reportFailure:c.custom(KZ)}),gY=ye({channel:"site:build:staging",request:hY,response:c.void(),delivery:"command"})});var yY,bY,SY;var GZ=S(()=>{de();yY=c.object({id:c.string().min(1),trigger:c.string().min(1),playbookId:c.string().min(1),once:c.boolean().default(!0),starterText:c.string().min(1),description:c.string().min(1).optional(),starterPrompt:c.string().min(1)}).strict(),bY=c.object({registered:c.boolean(),id:c.string(),ignored:c.boolean().optional(),reason:c.string().optional()}),SY=ye({channel:"playbooks:register-lifecycle-starter",request:yY,response:bY,delivery:"request"})});var vY,wY,xY;var QZ=S(()=>{de();vY=c.object({id:c.string().min(1),markdown:c.string().min(1)}).strict(),wY=c.object({created:c.boolean()}),xY=ye({channel:"playbooks:seed",request:vY,response:wY,delivery:"request"})});var YZ,sg,ZA,XZ,ej,_Y,EY;var tj=S(()=>{de();YZ=["name","headline","industry","location","website","story"],sg=c.enum(YZ),ZA=c.object({name:c.string().optional(),headline:c.string().optional(),industry:c.string().optional(),location:c.string().optional(),website:c.string().optional(),story:c.string().optional()}),XZ=c.enum(["fill","preserve","unchanged"]),ej=c.object({field:sg,current:c.string().nullable(),imported:c.string(),outcome:XZ}),_Y=ye({channel:"@brains/profile:import-preview",request:c.object({fields:ZA}),response:c.object({fields:c.array(ej),changed:c.boolean(),revision:c.string()}),delivery:"request"}),EY=ye({channel:"@brains/profile:import-apply",request:c.object({fields:ZA,revision:c.string()}),response:c.object({filled:c.array(sg),kept:c.array(sg)}),delivery:"request"})});function kY(e){return typeof e==="object"&&e!==null&&"name"in e&&typeof e.name==="string"&&"publish"in e&&typeof e.publish==="function"}var IY,AY,RY,TY,$Y,OY,rj,CY;var nj=S(()=>{de();IY=c.enum(["provider"]),AY=c.object({executionMode:IY.optional(),publishResultIdField:c.string().min(1).optional(),publishTimestampField:c.string().min(1).optional(),enabled:c.boolean().optional()}).strict();RY=c.custom(kY),TY=c.object({entityType:c.string(),provider:RY.optional(),config:AY.optional()}),$Y=ye({channel:"publish:register",request:TY,response:c.void(),delivery:"command"}),OY=c.union([c.string().min(1),c.object({location:c.enum(["metadata","frontmatter"]),field:c.string().min(1)})]),rj=c.object({entityType:c.string().min(1),attachmentType:c.string().min(1),mediaEntityType:c.enum(["image"]),targetEntityField:OY.optional(),requiredWhen:c.object({status:c.string().min(1).optional(),visibility:c.string().min(1).optional()}).optional(),autoGenerate:c.boolean().optional(),requiredForPublish:c.boolean().optional()}),CY=ye({channel:"publish-assets:register",request:rj,response:c.void(),delivery:"command"})});var PY,zY,NY,DY,LY,ZY;var oj=S(()=>{de();PY=c.object({entityType:c.string()}),zY=ye({channel:"generate:execute",request:PY,response:c.void(),delivery:"command"}),NY=c.object({entityType:c.string(),entityId:c.string()}),DY=ye({channel:"generate:report:success",request:NY,response:c.void(),delivery:"command"}),LY=c.object({entityType:c.string(),error:c.string()}),ZY=ye({channel:"generate:report:failure",request:LY,response:c.void(),delivery:"command"})});var ij=()=>{};var sj,aj,cj,jY;var lj=S(()=>{de();Ad();sj=c.record(c.string(),c.unknown()),aj=c.object({entityType:c.string().min(1),source:c.object({entityType:c.string().min(1),entityIds:c.array(c.string().min(1)).min(1).max(51)}),prompt:c.string().trim().min(1).max(2000).optional(),approval:sj.optional(),actor:Wn,interfaceType:c.string().min(1),userPermissionLevel:c.enum(["admin","trusted","public"])}),cj=c.discriminatedUnion("status",[c.object({status:c.literal("confirm"),summary:c.string(),completionSummary:c.string().optional(),preview:c.string(),approval:sj}),c.object({status:c.literal("queued"),entityId:c.string(),jobId:c.string().optional()}),c.object({status:c.literal("refused"),error:c.string(),code:c.string().optional()})]),jY=ye({channel:"generate:from-sources",request:aj,response:cj,delivery:"request"})});var BY,uj,dj,pj;var fj=S(()=>{de();BY=c.object({message:c.string().describe("Natural language response to the query"),summary:c.string().optional().describe("Brief summary if applicable"),topics:c.array(c.string()).optional().describe("Related topics mentioned"),sources:c.array(c.object({id:c.string(),type:c.string(),excerpt:c.string().optional(),relevance:c.number().min(0).max(1).optional()})).optional().describe("Source entities used to answer the query"),metadata:c.record(c.string(),c.unknown()).optional()}).describe("defaultQueryResponse"),uj=c.object({message:c.string()}).describe("simpleTextResponse"),dj=c.object({success:c.boolean(),entityId:c.string().optional(),message:c.string()}).describe("createEntityResponse"),pj=c.object({success:c.boolean(),entityId:c.string(),changes:c.array(c.string()).optional(),message:c.string()}).describe("updateEntityResponse")});var mj,hj,UY,gj,yj,MY;var bj=S(()=>{de();mj=c.discriminatedUnion("type",[c.strictObject({type:c.literal("email"),address:c.email()}),c.strictObject({type:c.literal("matrix"),address:c.string().regex(/^@[a-z0-9._=/+-]+:[A-Za-z0-9.-]+(:[0-9]+)?$/)})]),hj=c.strictObject({recipient:mj.optional(),title:c.string().min(1),body:c.string().min(1),html:c.string().min(1).optional(),sensitivity:c.enum(["normal","secret"]).default("normal"),idempotencyKey:c.string().trim().min(1).max(200).optional(),replyTo:c.email().optional()}),UY=c.enum(["recipient-missing","transport-missing","delivery-failed"]),gj=c.string().regex(/^[a-z0-9_:.-]{1,80}$/u),yj=c.discriminatedUnion("status",[c.strictObject({status:c.literal("sent"),deliveryId:c.string().optional()}),c.strictObject({status:c.literal("failed"),failure:UY,transportCode:gj.optional()})]),MY=ye({channel:"notifications:send",request:hj,response:yj,delivery:"request"})});var qY,Sj,FY;var vj=S(()=>{de();qY=c.strictObject({}),Sj=c.strictObject({titles:c.array(c.string().trim().min(1).max(500)).max(20)}),FY=ye({channel:"topics:public-titles",request:qY,response:Sj,delivery:"request"})});var HY,jA,JY,KY,VY,WY,GY,QY;var wj=S(()=>{de();HY=c.strictObject({}),jA=c.string().trim().min(1).max(100),JY=c.strictObject({types:c.array(jA).max(20)}),KY=ye({channel:"collections:types",request:HY,response:JY,delivery:"collect"}),VY=c.strictObject({entityType:jA,ids:c.array(c.string().min(1).max(500)).min(1).max(200),visibilityScope:c.enum(["public","shared","restricted"])}),WY=c.strictObject({entityType:jA,id:c.string().min(1).max(500)}),GY=c.strictObject({collections:c.array(c.strictObject({id:c.string().min(1).max(500),members:c.array(WY).max(1000)})).max(200)}),QY=ye({channel:"collections:members",request:VY,response:GY,delivery:"collect"})});var YY,XY,eX,tX,rX;var xj=S(()=>{de();YY=c.string().trim().regex(/^[a-z][a-z0-9-]*$/).max(100),XY=c.strictObject({entityType:YY,entityId:c.string().min(1).max(300),visibilityScope:c.enum(["public","shared","restricted"])}),eX=c.strictObject({name:c.string().min(1).max(100),label:c.string().min(1).max(100)}),tX=c.strictObject({title:c.string().max(500),typeLabel:c.string().min(1).max(100),markdown:c.string(),fields:c.array(eX).max(40)}).nullable(),rX=ye({channel:"studio:entry-context",request:XY,response:tX,delivery:"request"})});var nX,oX,iX;var _j=S(()=>{de();nX=c.strictObject({}),oX=c.strictObject({types:c.array(c.string().trim().min(1))}),iX=ye({channel:"topics:source-types",request:nX,response:oX,delivery:"request"})});var Ej,Ij,sX;var Aj=S(()=>{de();Ej=c.strictObject({id:c.string().regex(/^[a-z0-9][a-z0-9-]{0,79}$/),title:c.string().trim().min(1).max(200),body:c.string().trim().min(1).max(20000)}),Ij=c.strictObject({noteId:c.string(),created:c.boolean()}),sX=ye({channel:"note:capture",request:Ej,response:Ij,delivery:"request"})});var Zc,$d,aX,cX,lX,uX,dX,pX;var kj=S(()=>{de();CA();Zc=c.string().regex(/^[a-z][a-z0-9-]{0,63}$/),$d=c.string().min(32).max(512),aX=c.strictObject({provider:Zc,brainState:$d}),cX=c.strictObject({authorizationUrl:c.url({protocol:/^https?$/})}),lX=c.strictObject({provider:Zc,grant:$d}),uX=c.strictObject({provider:Zc,credential:ig}),dX=c.enum(["provider_denied","authorization_incomplete","credential_exchange_failed"]),pX=c.union([c.strictObject({provider:Zc,state:$d,grant:$d}),c.strictObject({provider:Zc,state:$d,error:dX})])});var fX,mX,hX,gX;var Rj=S(()=>{de();fX=c.object({permissionLevel:c.enum(["public","trusted","admin"])}),mX=c.object({id:c.string().min(1),title:c.string().min(1),sub:c.string().optional(),href:c.string().min(1),primary:c.boolean().optional(),keywords:c.array(c.string()).optional()}),hX=c.array(mX),gX=ye({channel:"console:jump-destinations",request:fX,response:hX,delivery:"collect"})});var ag,BA;var Tj=S(()=>{de();ag=c.enum(["github","instagram","linkedin","podcast","email","website"]),BA=c.object({platform:ag.describe("Social media platform"),url:c.string().describe("Profile or contact URL"),label:c.string().optional().describe("Optional display label")})});function Od(e){if(!e.type.includes(":"))throw Error(`Job contract type "${e.type}" must name its owner, as "owner:job"`);return Object.freeze({type:e.type,input:e.input})}var $j,Oj,Cj,yX,bX,Pj,SX;var zj=S(()=>{de();$j=c.enum(["1:1","16:9","9:16","4:3","3:4"]),Oj=c.object({prompt:c.string(),title:c.string().optional(),aspectRatio:$j.optional(),targetEntityType:c.string().optional(),targetEntityId:c.string().optional(),entityTitle:c.string().optional(),entityContent:c.string().optional()}),Cj=c.object({imageId:c.string().min(1)}),yX=Od({type:"image:image-describe",input:Cj}),bX=Od({type:"image:image-generate",input:Oj}),Pj=c.object({sourceEntityType:c.string().min(1),sourceEntityId:c.string().min(1),attachmentType:c.string().min(1),imageId:c.string().min(1),dedupKey:c.string().min(1).optional(),replace:c.boolean().optional(),targetEntityType:c.string().min(1).optional(),targetEntityId:c.string().min(1).optional(),targetImageField:c.enum(["coverImageId","ogImageId"]).optional()}),SX=Od({type:"image:image-render-source",input:Pj})});var vX;var Nj=S(()=>{de();vX=c.enum(["none","low","medium","high","xhigh","max"])});var wX,Dj,xX;var Lj=S(()=>{de();wX=c.object({}),Dj=c.object({userId:c.string().min(1),password:c.string().min(1)}),xX=ye({channel:"matrix:bot-credentials",request:wX,response:Dj,delivery:"request"})});var UA;var Zj=S(()=>{UA=["core","media","automation","web","chat","site","publishing","federation","matrix","team"]});var kke;var jj=S(()=>{de();kke=c.object({series:c.array(c.string()).optional(),publishedAt:c.string().optional()})});var wt=S(()=>{EA();_L();RA();WL();QL();kd();eZ();cZ();dZ();pZ();Ad();hZ();yZ();bZ();SZ();wZ();EZ();IZ();AZ();kZ();RZ();OZ();CA();CZ();PZ();NZ();DZ();tg();LZ();LA();BZ();UZ();MZ();FZ();HZ();AA();JZ();WZ();GZ();QZ();tj();nj();oj();ij();lj();fj();bj();vj();wj();xj();_j();Aj();kj();Rj();Tj();zj();Nj();Lj();Zj();jj()});var AX,kX,Ct,br,Ws,RX,Gs="capability-bundles-v1",MA,TX,$X,OX,CX,Bj,cg,Qs,hn,PX,zX,NX,DX,LX,qA,ZX,jX,lg;var To=S(()=>{wt();wt();de();AX=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,kX=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Ct=c.string().regex(AX,"expected exact pinned version"),br=c.string().regex(kX,"expected lowercase handle slug"),Ws=c.string().min(1),RX=c.string().startsWith("age1").min(1),MA=c.enum(UA),TX=["professional","team","organization"],$X=c.enum(TX),OX=["person","team","organization"],CX=c.enum(OX),Bj=c.array(MA).min(1),cg=c.array(c.string().min(1)),Qs=c.strictObject({brainVersion:Ct,bundleContract:c.literal(Gs),bundles:Bj,add:cg.optional(),remove:cg.optional(),githubOrg:c.string().min(1),contentRepoPrefix:c.string().min(1),domainSuffix:c.string().min(1),openaiApiKey:Ws,gitSyncToken:Ws,contentRepoAdminToken:Ws,agePublicKey:RX}).superRefine((e,t)=>{if(new Set(e.bundles).size!==e.bundles.length)t.addIssue({code:c.ZodIssueCode.custom,path:["bundles"],message:"canonical bundles must be unique"})}),hn=c.strictObject({members:c.array(br).min(1),brainVersionOverride:Ct.optional(),bundlesOverride:Bj.optional(),addOverride:cg.optional(),removeOverride:cg.optional(),openaiApiKeyOverride:Ws.optional(),gitSyncTokenOverride:Ws.optional()}).superRefine((e,t)=>{if(new Set(e.members).size!==e.members.length)t.addIssue({code:c.ZodIssueCode.custom,path:["members"],message:"cohort members must be unique"});if(e.bundlesOverride&&new Set(e.bundlesOverride).size!==e.bundlesOverride.length)t.addIssue({code:c.ZodIssueCode.custom,path:["bundlesOverride"],message:"canonical bundle overrides must be unique"})}),PX=c.strictObject({platform:ag,url:c.string().min(1),label:c.string().min(1).optional()}),zX=c.strictObject({name:c.string().min(1).optional(),description:c.string().min(1).optional(),website:c.string().min(1).optional(),email:c.string().min(1).optional(),story:c.string().min(1).optional(),socialLinks:c.array(PX).optional()}),NX=c.strictObject({delivery:c.literal("email"),email:c.string().email()}),DX=c.strictObject({enabled:c.boolean().optional(),endpoint:c.string().url().refine((e)=>new URL(e).protocol==="wss:",{message:"Jetstream endpoint must use wss"}).optional(),replayWindowSeconds:c.number().int().min(60).optional(),denyDids:c.array(c.string().startsWith("did:plc:")).optional(),denyDomains:c.array(c.string().min(1)).optional(),skillKeywords:c.array(c.string().min(1)).optional(),queueLimit:c.number().int().min(1).max(1e4).optional(),concurrency:c.number().int().min(1).max(32).optional(),perDidCooldownSeconds:c.number().int().nonnegative().optional(),fetchBudgetPerMinute:c.number().int().min(1).optional(),newAgentsPerHour:c.number().int().min(1).optional(),pendingCandidateCeiling:c.number().int().min(1).optional(),staleCandidateRetentionDays:c.number().int().min(1).optional(),requestTimeoutMs:c.number().int().min(100).optional(),maxResponseBytes:c.number().int().min(1024).optional(),maxRedirects:c.number().int().nonnegative().optional(),retryAttempts:c.number().int().min(1).optional(),heartbeatIntervalHours:c.number().min(1).optional()}),LX=c.strictObject({identifier:c.string().min(1),accountDid:c.string().min(1).optional(),lexiconAuthority:c.boolean().optional(),jetstream:DX.optional()}),qA=c.strictObject({package:c.string().min(1),version:Ct.optional(),theme:c.string().min(1).optional(),themeVersion:Ct.optional()}).superRefine((e,t)=>{let r=e.package.startsWith("@rizom/");if(r&&e.version===void 0)t.addIssue({code:c.ZodIssueCode.custom,path:["version"],message:"external @rizom site packages require an exact version pin"});if(!r&&e.version!==void 0)t.addIssue({code:c.ZodIssueCode.custom,path:["version"],message:"version is valid only for external @rizom site packages"});let o=e.theme?.startsWith("@rizom/")===!0;if(o&&e.themeVersion===void 0)t.addIssue({code:c.ZodIssueCode.custom,path:["themeVersion"],message:"external @rizom themes require an exact version pin"});if(!o&&e.themeVersion!==void 0)t.addIssue({code:c.ZodIssueCode.custom,path:["themeVersion"],message:"themeVersion is valid only for external @rizom themes"})}),ZX=c.strictObject({onboarding:c.boolean().optional()}),jX=c.record(c.string().min(1),c.record(c.string(),c.unknown())),lg=c.strictObject({handle:br,discord:c.strictObject({enabled:c.boolean(),anchorUserId:c.string().min(1).optional()}),openaiApiKeyOverride:Ws.optional(),gitSyncTokenOverride:Ws.optional(),domainOverride:c.string().min(1).optional(),cloudflareZoneId:c.string().min(1).optional(),contentRepoOverride:c.string().min(1).optional(),profileKind:$X.optional(),anchorKind:CX.optional(),plugins:jX.optional(),spaces:c.array(c.string().min(1)).optional(),embeddingEnabled:c.boolean().optional(),embeddingModel:c.string().optional(),topicExtractionEnabled:c.boolean().optional(),skillDerivationEnabled:c.boolean().optional(),swotDerivationEnabled:c.boolean().optional(),addOverride:c.array(c.string().min(1)).optional(),removeOverride:c.array(c.string().min(1)).optional(),siteOverride:qA.optional(),setup:NX.optional(),atproto:LX.optional(),playbooks:ZX.optional(),anchorProfile:zX.optional()})});import{access as BX}from"fs/promises";async function Ar(e){try{return await BX(e),!0}catch{return!1}}function jc(e){return e.replaceAll("\\","/")}var Ys=()=>{};import{readdir as UX,readFile as MX}from"fs/promises";import{basename as FA,join as Cd,relative as qX}from"path";async function xt(e,t={}){let[r,o,n]=await Promise.all([HA(Cd(e,"pilot.yaml"),Qs),HX(e),JX(e)]),i=KX(o,n),s=n.map((l)=>({id:l.id,members:[...l.data.members].sort(),...$c({brainVersionOverride:l.data.brainVersionOverride,bundlesOverride:l.data.bundlesOverride,addOverride:l.data.addOverride,removeOverride:l.data.removeOverride,openaiApiKeyOverride:l.data.openaiApiKeyOverride,gitSyncTokenOverride:l.data.gitSyncTokenOverride})})).sort((l,u)=>l.id.localeCompare(u.id)),a=await Promise.all(o.map(async(l)=>{let u=i.get(l.data.handle);if(!u)throw new Xs(`User ${l.data.handle} must belong to exactly one cohort`);let d={...FX(l.data,u,r),snapshotStatus:await GX(e,l.data.handle)},p=await t.resolveStatus?.(d);return{...d,serverStatus:p?.serverStatus??"unknown",deployStatus:p?.deployStatus??"unknown",dnsStatus:p?.dnsStatus??"unknown",mcpStatus:p?.mcpStatus??"unknown"}}));return a.sort((l,u)=>l.handle.localeCompare(u.handle)),{pilot:r,cohorts:s,users:a}}function FX(e,t,r){let o=t.data.bundlesOverride===void 0;return{handle:e.handle,cohort:t.id,brainVersion:t.data.brainVersionOverride??r.brainVersion,bundleContract:r.bundleContract,bundles:[...t.data.bundlesOverride??r.bundles],add:Uj(t.data.addOverride??(o?r.add:void 0),e.addOverride),remove:Uj(t.data.removeOverride??(o?r.remove:void 0),e.removeOverride),domain:e.domainOverride??`${e.handle}${r.domainSuffix}`,...$c({cloudflareZoneId:e.cloudflareZoneId}),contentRepo:e.contentRepoOverride??`${r.contentRepoPrefix}${e.handle}-content`,...$c({profileKind:e.profileKind,anchorKind:e.anchorKind,embeddingEnabled:e.embeddingEnabled,embeddingModel:e.embeddingModel,spaces:e.spaces,plugins:e.plugins,topicExtractionEnabled:e.topicExtractionEnabled,skillDerivationEnabled:e.skillDerivationEnabled,swotDerivationEnabled:e.swotDerivationEnabled,siteOverride:e.siteOverride&&{...e.siteOverride}}),discordEnabled:e.discord.enabled,...$c({discordAnchorUserId:e.discord.anchorUserId}),effectiveOpenaiApiKey:e.openaiApiKeyOverride??t.data.openaiApiKeyOverride??r.openaiApiKey,effectiveGitSyncToken:e.gitSyncTokenOverride??t.data.gitSyncTokenOverride??r.gitSyncToken,...$c({setup:e.setup,atproto:e.atproto,playbooks:e.playbooks}),anchorProfile:VX(e.handle,e.anchorProfile)}}function Uj(e,t){return QX([...e??[],...t??[]])}async function HX(e){let t=Cd(e,"users"),r=(await Mj(t)).filter((n)=>!FA(n).endsWith(".secrets.yaml"));return(await Promise.all(r.map(async(n)=>{let i=qj(FA(n)),s=await HA(n,lg);if(s.handle!==i){let a=jc(qX(e,n));throw new Xs(`${a} must declare handle: ${i}`)}return{id:i,data:s}}))).sort((n,i)=>n.id.localeCompare(i.id))}async function JX(e){let t=Cd(e,"cohorts"),r=await Mj(t);return(await Promise.all(r.map(async(n)=>({id:qj(FA(n)),data:await HA(n,hn)})))).sort((n,i)=>n.id.localeCompare(i.id))}function KX(e,t){let r=new Map(e.map((n)=>[n.data.handle,n])),o=new Map;for(let n of t)for(let i of n.data.members){if(!r.has(i))throw new Xs(`Cohort ${n.id} references unknown user ${i}`);if(o.has(i))throw new Xs(`User ${i} must belong to exactly one cohort`);o.set(i,n)}for(let n of e)if(!o.has(n.data.handle))throw new Xs(`User ${n.data.handle} must belong to exactly one cohort`);return o}function VX(e,t){return{name:t?.name??WX(e),...t?.description?{description:t.description}:{},...t?.website?{website:t.website}:{},...t?.email?{email:t.email}:{},...t?.story?{story:t.story}:{},...t?.socialLinks?{socialLinks:t.socialLinks.map((r)=>({platform:r.platform,url:r.url,...r.label?{label:r.label}:{}}))}:{}}}function WX(e){return e.split("-").filter((t)=>t.length>0).map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}async function GX(e,t){let r=Cd(e,"users",t,"brain.yaml");return await Ar(r)?"present":"missing"}async function Mj(e){return(await UX(e,{withFileTypes:!0})).filter((r)=>r.isFile()&&r.name.endsWith(".yaml")).map((r)=>Cd(e,r.name)).sort((r,o)=>r.localeCompare(o))}async function HA(e,t){let r=await MX(e,"utf8"),o=yr(r,t);if(!o.ok)throw new Xs(`${jc(e)}: ${o.error}`);return o.data}function QX(e){return[...new Set(e)]}function qj(e){return e.replace(/\.ya?ml$/,"")}var Xs;var gn=S(()=>{Vn();To();Ys();Xs=class Xs extends Error{}});import{mkdir as nee,writeFile as oee}from"fs/promises";import{join as Kj}from"path";async function Pi(e,t={}){let o=(t.registry??await xt(e,t)).users.map((i)=>{let s=i.discordEnabled?"on":"off";return[i.handle,i.cohort,i.bundles.join(","),i.add.join(","),i.remove.join(","),i.brainVersion,i.domain,i.contentRepo,s,i.serverStatus,i.deployStatus,i.dnsStatus,i.mcpStatus]}),n=["<!-- generated by brains-ops; do not edit -->","",iee,see,...o.map((i)=>`| ${i.join(" | ")} |`),""].join(`
|
|
281
|
+
`+w.slice(M+1);else se+=w.slice(D);return se.slice(1)}function On(w){let V="",g=0;for(let E=0;E<w.length;g>=65536?E+=2:E++){g=Qe(w,E);let D=I[g];if(!D&&ke(g)){if(V+=w[E],g>=65536)V+=w[E+1]}else V+=D||N(g)}return V}function Fl(w,V,g){let E="",D=w.tag;for(let H=0,M=g.length;H<M;H+=1){let te=g[H];if(w.replacer)te=w.replacer.call(g,String(H),te);if(U(w,V,te,!1,!1)||typeof te>"u"&&U(w,V,null,!1,!1)){if(E!=="")E+=","+(!w.condenseFlow?" ":"");E+=w.dump}}w.tag=D,w.dump="["+E+"]"}function Qo(w,V,g,E){let D="",H=w.tag;for(let M=0,te=g.length;M<te;M+=1){let se=g[M];if(w.replacer)se=w.replacer.call(g,String(M),se);if(U(w,V+1,se,!0,!0,!1,!0)||typeof se>"u"&&U(w,V+1,null,!0,!0,!1,!0)){if(!E||D!=="")D+=me(w,V);if(w.dump&&a===w.dump.charCodeAt(0))D+="-";else D+="- ";D+=w.dump}}w.tag=H,w.dump=D||"[]"}function Ea(w,V,g){let E="",D=w.tag,H=Object.keys(g);for(let M=0,te=H.length;M<te;M+=1){let se="";if(E!=="")se+=", ";if(w.condenseFlow)se+='"';let be=H[M],fe=g[be];if(w.replacer)fe=w.replacer.call(g,be,fe);if(!U(w,V,be,!1,!1))continue;if(w.dump.length>1024)se+="? ";if(se+=w.dump+(w.condenseFlow?'"':"")+":"+(w.condenseFlow?"":" "),!U(w,V,fe,!1,!1))continue;se+=w.dump,E+=se}w.tag=D,w.dump="{"+E+"}"}function Ia(w,V,g,E){let D="",H=w.tag,M=Object.keys(g);if(w.sortKeys===!0)M.sort();else if(typeof w.sortKeys==="function")M.sort(w.sortKeys);else if(w.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let te=0,se=M.length;te<se;te+=1){let be="";if(!E||D!=="")be+=me(w,V);let fe=M[te],Te=g[fe];if(w.replacer)Te=w.replacer.call(g,fe,Te);if(!U(w,V+1,fe,!0,!0,!0))continue;let ze=w.tag!==null&&w.tag!=="?"||w.dump&&w.dump.length>1024;if(ze)if(w.dump&&a===w.dump.charCodeAt(0))be+="?";else be+="? ";if(be+=w.dump,ze)be+=me(w,V);if(!U(w,V+1,Te,!0,ze))continue;if(w.dump&&a===w.dump.charCodeAt(0))be+=":";else be+=": ";be+=w.dump,D+=be}w.tag=H,w.dump=D||"{}"}function f(w,V,g){let E=g?w.explicitTypes:w.implicitTypes;for(let D=0,H=E.length;D<H;D+=1){let M=E[D];if((M.instanceOf||M.predicate)&&(!M.instanceOf||typeof V==="object"&&V instanceof M.instanceOf)&&(!M.predicate||M.predicate(V))){if(g)if(M.multi&&M.representName)w.tag=M.representName(V);else w.tag=M.tag;else w.tag="?";if(M.represent){let te=w.styleMap[M.tag]||M.defaultStyle,se;if(o.call(M.represent)==="[object Function]")se=M.represent(V,te);else if(n.call(M.represent,te))se=M.represent[te](V,te);else throw new t("!<"+M.tag+'> tag resolver accepts not "'+te+'" style');w.dump=se}return!0}}return!1}function U(w,V,g,E,D,H,M){if(w.tag=null,w.dump=g,!f(w,g,!1))f(w,g,!0);let te=o.call(w.dump),se=E;if(E)E=w.flowLevel<0||w.flowLevel>V;let be=te==="[object Object]"||te==="[object Array]",fe,Te;if(be)fe=w.duplicates.indexOf(g),Te=fe!==-1;if(w.tag!==null&&w.tag!=="?"||Te||w.indent!==2&&V>0)D=!1;if(Te&&w.usedDuplicates[fe])w.dump="*ref_"+fe;else{if(be&&Te&&!w.usedDuplicates[fe])w.usedDuplicates[fe]=!0;if(te==="[object Object]"){if(E&&Object.keys(w.dump).length!==0){if(Ia(w,V,w.dump,D),Te)w.dump="&ref_"+fe+w.dump}else if(Ea(w,V,w.dump),Te)w.dump="&ref_"+fe+" "+w.dump}else if(te==="[object Array]"){if(E&&w.dump.length!==0){if(w.noArrayIndent&&!M&&V>0)Qo(w,V-1,w.dump,D);else Qo(w,V,w.dump,D);if(Te)w.dump="&ref_"+fe+w.dump}else if(Fl(w,V,w.dump),Te)w.dump="&ref_"+fe+" "+w.dump}else if(te==="[object String]"){if(w.tag!=="?")uo(w,w.dump,V,H,se)}else if(te==="[object Undefined]")return!1;else{if(w.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+te)}if(w.tag!==null&&w.tag!=="?"){let ze=encodeURI(w.tag[0]==="!"?w.tag.slice(1):w.tag).replace(/!/g,"%21");if(w.tag[0]==="!")ze="!"+ze;else if(ze.slice(0,18)==="tag:yaml.org,2002:")ze="!!"+ze.slice(18);else ze="!<"+ze+">";w.dump=ze+" "+w.dump}}return!0}function ne(w,V){let g=[],E=[];ie(w,g,E);let D=E.length;for(let H=0;H<D;H+=1)V.duplicates.push(g[E[H]]);V.usedDuplicates=Array(D)}function ie(w,V,g){if(w!==null&&typeof w==="object"){let E=V.indexOf(w);if(E!==-1){if(g.indexOf(E)===-1)g.push(E)}else if(V.push(w),Array.isArray(w))for(let D=0,H=w.length;D<H;D+=1)ie(w[D],V,g);else{let D=Object.keys(w);for(let H=0,M=D.length;H<M;H+=1)ie(w[D[H]],V,g)}}}function X(w,V){V=V||{};let g=new re(V);if(!g.noRefs)ne(w,g);let E=w;if(g.replacer)E=g.replacer.call({"":E},"",E);if(U(g,0,E,!0,!0))return g.dump+`
|
|
282
|
+
`;return""}return vA.dump=X,vA}function kG(){if(VD)return nr;VD=1;let e=IG(),t=AG();function r(o,n){return function(){throw Error("Function yaml."+o+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}return nr.Type=gr(),nr.Schema=WD(),nr.FAILSAFE_SCHEMA=XD(),nr.JSON_SCHEMA=oL(),nr.CORE_SCHEMA=iL(),nr.DEFAULT_SCHEMA=wA(),nr.load=e.load,nr.loadAll=e.loadAll,nr.dump=t.dump,nr.YAMLException=Ed(),nr.types={binary:cL(),float:nL(),map:YD(),null:eL(),pairs:uL(),set:dL(),timestamp:sL(),bool:tL(),int:rL(),merge:aL(),omap:lL(),seq:QD(),str:GD()},nr.safeLoad=r("safeLoad","load"),nr.safeLoadAll=r("safeLoadAll","loadAll"),nr.safeDump=r("safeDump","dump"),nr}var nr,Yh,Oi,ED,XI,ID,eA,AD,tA,kD,rA,RD,nA,TD,oA,$D,iA,OD,sA,CD,aA,PD,cA,zD,lA,ND,uA,DD,dA,LD,pA,ZD,fA,jD,mA,BD,hA,UD,gA,MD,yA,qD,bA,FD,SA,HD,JD,vA,KD,VD,RG,pL,Oc,TG,$G,OG,CG,xA,Cc,PG,Id,zG,NG,DG,LG,ZG;var Pc=S(()=>{nr={},Yh={},Oi={};vA={};RG=kG(),pL=_G(RG),{Type:Oc,Schema:TG,FAILSAFE_SCHEMA:$G,JSON_SCHEMA:OG,CORE_SCHEMA:CG,DEFAULT_SCHEMA:xA,load:Cc,loadAll:PG,dump:Id,YAMLException:zG,types:NG,safeLoad:DG,safeLoadAll:LG,safeDump:ZG}=pL});function zc(e){return Id(e,{skipInvalid:!0,noRefs:!0,sortKeys:!0})}function fL(e){return Cc(e)}function yr(e,t){if(!e.trim())return{ok:!1,error:"file is empty"};let r;try{r=Cc(e)}catch(n){return{ok:!1,error:Ve(n,"YAML parse error")}}if(!jG(r))return{ok:!1,error:"expected a YAML mapping (key: value pairs)"};if(!t)return{ok:!0,data:r};let o=t.safeParse(r);if(!o.success)return{ok:!1,error:`invalid field(s): ${o.error.issues.map((i)=>i.path.map(String).join(".")).join(", ")}`};return{ok:!0,data:o.data}}function jG(e){return Boolean(e)&&typeof e==="object"&&!Array.isArray(e)}var Vn=S(()=>{Pc()});var _A,mL;var EA=S(()=>{de();_A=c.object({title:c.string().trim().min(1).max(500).optional(),introduction:c.string().trim().min(1).max(4000).optional(),topics:c.array(c.string().trim().min(1).max(500)).max(20).optional(),topicsHeading:c.string().trim().min(1).max(120).optional(),contactLabel:c.string().trim().min(1).max(80).optional(),contactNote:c.string().trim().min(1).max(240).optional(),mapCaption:c.string().trim().min(1).max(160).optional(),refusal:c.string().trim().min(1).max(500).optional(),faqHeading:c.string().trim().min(1).max(120).optional()}),mL=_A.omit({introduction:!0})});function Vs(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function gL(e){let t=Reflect.get(Ks,"types"),r=Vs(t)?t[e]:void 0;if(!(r instanceof Oc))throw Error(`Required YAML type is unavailable: ${e}`);return r}function MG(e,t){let r=0,o=1;for(let n of e.split(":").reverse())r+=(t?Number.parseFloat(n):Number.parseInt(n,10))*o,o*=60;return r}function hL(e){let t=gL(e);return new Oc(`tag:yaml.org,2002:${e}`,{kind:"scalar",resolve:(r)=>typeof r==="string"&&(e==="int"?BG:UG).test(r)&&!r.endsWith("_"),construct:(r)=>{let o=r.replace(/_/g,""),n=o.startsWith("-")?-1:1,i=o.replace(/^[+-]/,"");if(i.includes(":"))return n*MG(i,e==="float");if(e==="int"&&i==="0")return 0;if(e==="int"&&/^0[0-7]+$/.test(i))return n*Number.parseInt(i,8);return t.construct(o)},predicate:t.predicate??void 0,represent:t.represent??void 0,defaultStyle:t.defaultStyle??void 0})}var BG,UG,IA,qG,FG,HG;var yL=S(()=>{Pc();BG=/^[+-]?(?:0|0b[01_]*[01]|0x[\da-fA-F_]*[\da-fA-F]|0[0-7_]*[0-7]|[1-9](?:[\d_]*\d)?|[1-9][\d_]*(?::[0-5]?\d)+)$/,UG=/^(?:[-+]?(?:0|[1-9][\d_]*)(?:\.[\d_]*)?(?:[eE][-+]?\d+)?|\.[\d_]+(?:[eE][-+]?\d+)?|[-+]?\d[\d_]*(?::[0-5]?\d)+\.[\d_]*|[-+]?\.(?:inf|Inf|INF)|\.(?:nan|NaN|NAN))$/;IA=gL("binary"),qG=new Oc("tag:yaml.org,2002:binary",{kind:"scalar",resolve:(e)=>IA.resolve(e),construct:(e)=>{let t=IA.construct(e);if(!(t instanceof Uint8Array))throw Error("Invalid YAML binary result");return typeof Buffer>"u"?Array.from(t):Buffer.from(t)},predicate:(e)=>typeof Buffer<"u"&&Buffer.isBuffer(e),represent:IA.represent??void 0}),FG=new Oc("tag:yaml.org,2002:str",{kind:"scalar",resolve:(e)=>typeof e==="string"&&e.includes(":"),construct:(e)=>e}),HG=xA.extend({implicit:[hL("int"),hL("float"),FG],explicit:[qG]})});var bL=S(()=>{Pc();yL()});var SL,vL,wL,JG;var AA=S(()=>{bL();de();SL=c.object({audiences:c.array(c.string()).optional(),positioning:c.string().optional()}),vL=c.object({summary:c.string().optional(),traits:c.array(c.string()).optional(),principles:c.array(c.string()).optional(),preferredTerms:c.array(c.string()).optional(),avoid:c.array(c.string()).optional()}),wL=c.object({artDirection:c.string().optional(),palette:c.array(c.string()).optional(),composition:c.string().optional(),mood:c.string().optional(),preferred:c.array(c.string()).optional(),avoid:c.array(c.string()).optional()}),JG=c.object({name:c.string().describe("Style guide name"),messaging:SL.optional(),voice:vL.optional(),visual:wL.optional()})});var _L=S(()=>{EA();AA()});var Nc,wEe,kA="data-ask-sheet",KG;var RA=S(()=>{de();Nc=c.object({name:c.string().trim().min(1).max(200),url:c.string().url().optional()}),wEe=c.object({sources:c.array(c.object({id:c.string(),title:c.string(),brain:Nc.optional()}))}),KG=`body *:not([${kA}], [${kA}] *) { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }`});import{createHash as VG}from"crypto";function Xh(e){return VG("sha256").update(e).digest("hex")}var eg=()=>{};var Wn;var Ad=S(()=>{de();eg();Wn=c.discriminatedUnion("kind",[c.object({kind:c.literal("user"),userId:c.string().min(1),canonicalId:c.string().min(1).optional()}),c.object({kind:c.literal("external"),externalActorId:c.string().min(1)}),c.object({kind:c.literal("agent"),agentId:c.string().min(1)}),c.object({kind:c.literal("service"),serviceId:c.string().min(1)})])});var WG,TEe,Dc,GG,QG,EL,$Ee,YG,XG,IL;var AL=S(()=>{de();WG=c.strictObject({messageCharacters:c.number().int().positive(),requestTimeoutSeconds:c.number().int().positive().max(2147483)}),TEe=c.strictObject({limits:WG,maxCostMicroUsd:c.number().int().positive()}),Dc=c.number().int().nonnegative(),GG=c.strictObject({modelCalls:Dc,inputTokens:Dc,cachedInputTokens:Dc,outputTokens:Dc,reasoningTokens:Dc,embeddingTokens:Dc}),QG=c.discriminatedUnion("state",[c.strictObject({state:c.literal("known"),microUsd:c.number().int().nonnegative(),pricing:c.string().trim().min(1).max(120)}),c.strictObject({state:c.literal("unknown"),reason:c.enum(["missing-usage","unsupported-pricing"])})]),EL=c.strictObject({usage:GG,cost:QG}),$Ee=c.strictObject({topics:c.array(c.string().trim().min(1).max(500)).max(20),introduction:c.string().trim().min(1).max(4000).optional(),refusal:c.string().trim().min(1).max(500).optional()}),YG=c.enum(["in-scope","off-topic","abusive","injection","harmful"]),XG=YG.exclude(["in-scope"]),IL=c.discriminatedUnion("outcome",[c.strictObject({outcome:c.literal("answered")}),c.strictObject({outcome:c.literal("refused"),category:XG}),c.strictObject({outcome:c.literal("unscreened")})])});function tQ(e){let t=eQ.safeParse(e);if(!t.success)return e;return{...t.data,cards:t.data.cards.filter((r)=>TA.safeParse(r).success)}}var kL,RL,TL,$L,OL,CL,Lc,PL,zL,NL,DL,LL,TA,ZL,jL,BL,eQ,UL;var kd=S(()=>{de();RA();AL();kL=c.object({id:c.string(),toolCallId:c.string().optional(),toolName:c.string(),summary:c.string(),completionSummary:c.string().optional(),preview:c.string().optional(),args:c.unknown()}),RL=c.enum(["approval-requested","approval-responded","output-available","output-denied","output-error"]),TL=c.object({kind:c.literal("tool-approval"),id:c.string(),toolCallId:c.string().optional(),toolName:c.string(),input:c.record(c.string(),c.unknown()).optional(),summary:c.string(),completionSummary:c.string().optional(),preview:c.string().optional(),state:RL,output:c.unknown().optional(),error:c.string().optional()}),$L=c.object({entityType:c.string().optional(),entityId:c.string().optional(),attachmentType:c.string().optional()}),OL=c.object({mediaType:c.string().min(1),url:c.string().min(1),downloadUrl:c.string().min(1).optional(),previewUrl:c.string().min(1).optional(),filename:c.string().min(1).optional(),sizeBytes:c.number().nonnegative().optional(),source:$L.optional()}),CL=c.object({kind:c.literal("attachment"),id:c.string(),jobId:c.string().optional(),title:c.string(),description:c.string().optional(),attachment:OL}),Lc=c.object({id:c.string().min(1),title:c.string().min(1).optional(),source:c.string().min(1),url:c.string().min(1).optional(),entityType:c.string().min(1).optional(),entityId:c.string().min(1).optional(),excerpt:c.string().min(1).optional(),provenance:c.record(c.string(),c.unknown()).optional(),brain:Nc.optional()}),PL=c.object({kind:c.literal("sources"),id:c.string().min(1),title:c.string().min(1).optional(),sources:c.array(Lc).min(1)}),zL=c.object({type:c.literal("prompt"),id:c.string().min(1),label:c.string().min(1),prompt:c.string().min(1),description:c.string().min(1).optional()}),NL=c.object({type:c.literal("event"),id:c.string().min(1),label:c.string().min(1),event:c.string().min(1),fromState:c.string().min(1).optional(),description:c.string().min(1).optional()}),DL=c.discriminatedUnion("type",[zL,NL]),LL=c.object({kind:c.literal("actions"),id:c.string().min(1),title:c.string().min(1).optional(),defaultOpen:c.boolean().optional(),actions:c.array(DL).min(1)}),TA=c.discriminatedUnion("kind",[TL,CL,PL,LL]),ZL=c.object({toolName:c.string(),args:c.record(c.string(),c.unknown()).optional(),jobId:c.string().optional(),data:c.unknown().optional(),error:c.object({message:c.string(),code:c.string().optional()}).optional()}),jL=c.object({faqId:c.string().min(1)}),BL=c.object({text:c.string(),error:c.string().optional(),toolResults:c.array(ZL).optional(),cards:c.array(TA).optional(),pendingConfirmations:c.array(kL).optional(),usage:c.object({promptTokens:c.number(),completionTokens:c.number(),totalTokens:c.number()}),guestSettlement:EL.optional(),guestScreening:IL.optional(),askedBefore:jL.optional()}),eQ=c.looseObject({cards:c.array(c.unknown())});UL=c.preprocess((e)=>tQ(Qh(e)),BL)});function ye(e){return Object.freeze({name:e.channel,schema:e.request,response:e.response,delivery:e.delivery})}function Gn(e,t){return Object.freeze({name:e,schema:t})}var jEe;var tg=S(()=>{de();jEe=c.object({name:c.string(),schema:c.custom((e)=>typeof e==="object"&&e!==null&&("safeParse"in e))})});var rg,rQ,nQ,oQ,iQ,ML,sQ,aQ,cQ,lQ,uQ,dQ,qL,FL,HL,pQ,JL,fQ,KL,mQ,VL,hQ;var WL=S(()=>{de();Ad();kd();tg();rg=c.object({state:c.string(),response:c.string(),sources:c.array(Lc)}),rQ=c.object({agent:c.string().trim().min(1).max(253),question:c.string().trim().min(1).max(4000)}),nQ=ye({channel:"a2a:ask:request",request:rQ,response:rg,delivery:"request"}),oQ=c.object({agent:c.string().trim().min(1).max(253),message:c.string().trim().min(1).max(32000)}),iQ=ye({channel:"a2a:turn:request",request:oQ,response:rg,delivery:"request"}),ML=c.object({entityType:c.string().optional(),entityId:c.string().optional(),actor:Wn.optional(),interfaceType:c.string().optional(),userPermissionLevel:c.enum(["admin","trusted","public"])}),sQ=c.object({agent:c.string().trim().min(1).max(253),instruction:c.string().trim().min(1).max(2000),selection:c.string().min(1).max(8000),...ML.shape}),aQ=ye({channel:"a2a:call:request",request:sQ,response:rg,delivery:"request"}),cQ=c.object({agents:c.array(c.object({id:c.string(),label:c.string()}))}),lQ=ye({channel:"a2a:call:agents",request:ML,response:cQ,delivery:"request"}),uQ=c.object({approvedAt:c.string(),approvedBy:c.string().optional()}),dQ=c.discriminatedUnion("op",[c.object({op:c.literal("get"),entityType:c.string().min(1),id:c.string().min(1)}),c.object({op:c.literal("list")})]),qL=c.object({entities:c.array(c.object({entityType:c.string().min(1),id:c.string().min(1),title:c.string()}))}),FL=c.object({signedAt:c.string().min(1),keyId:c.string().min(1),signature:c.string().min(1)}),HL=c.object({entityType:c.string().min(1),id:c.string().min(1),markdown:c.string(),contentHash:c.string().min(1),attestation:FL}),pQ=c.object({agent:c.string().min(1),entityType:c.string().min(1),id:c.string().min(1)}),JL=c.discriminatedUnion("status",[c.object({status:c.literal("found"),entity:HL}),c.object({status:c.literal("not-found")}),c.object({status:c.literal("refused"),code:c.string(),error:c.string()})]),fQ=ye({channel:"a2a:shared-entity:get",request:pQ,response:JL,delivery:"request"}),KL=c.discriminatedUnion("status",[c.object({status:c.literal("found"),entities:qL.shape.entities}),c.object({status:c.literal("not-found")}),c.object({status:c.literal("refused"),code:c.string(),error:c.string()})]),mQ=ye({channel:"a2a:shared-entity:list",request:c.object({agent:c.string().min(1)}),response:KL,delivery:"request"}),VL=c.object({domain:c.string().min(1),level:c.enum(["trusted","public"])}),hQ=Gn("a2a:peer-trust-changed",VL)});var gQ,GL,yQ,bQ;var QL=S(()=>{de();kd();gQ=c.object({type:c.literal("event"),event:c.string().min(1),fromState:c.string().min(1).optional()}),GL=c.object({conversationId:c.string().min(1),interfaceType:c.string().min(1),channelId:c.string().min(1).optional(),channelName:c.string().min(1),userPermissionLevel:c.enum(["admin","trusted","public"]),isAnchor:c.boolean(),action:gQ}),yQ=UL.nullable(),bQ=ye({channel:"agent:action:request",request:GL,response:yQ,delivery:"request"})});var YL,SQ,XL,vQ;var eZ=S(()=>{de();kd();YL=c.object({question:c.string().trim().min(1)}),SQ=c.object({faqId:c.string().min(1),faqQuestion:c.string().min(1),answer:c.string().trim().min(1),sources:c.array(Lc).default([])}),XL=c.object({hit:SQ.optional()}),vQ=ye({channel:"guest:asked-before",request:YL,response:XL,delivery:"collect"})});var rZ,tZ,nZ,oZ,wQ,iZ,sZ,aZ,xQ;var cZ=S(()=>{de();rZ=c.enum(["studio","drive","file","git"]),tZ=c.enum(["public","shared","restricted"]),nZ=c.object({entityType:c.string().min(1),entityId:c.string().min(1),origin:rZ,actor:c.string().min(1).optional(),base:c.string().min(1).optional(),current:c.string().min(1),text:c.string(),targetVisibility:tZ,declaredVisibility:tZ.optional()}),oZ=c.object({conflictId:c.string().min(1),created:c.boolean()}),wQ=ye({channel:"conflict:record",request:nZ,response:oZ,delivery:"request"}),iZ=c.enum(["apply","keep-current"]),sZ=c.object({conflictId:c.string().min(1),action:iZ,userId:c.string().min(1),permissionLevel:c.enum(["admin","trusted","public"])}),aZ=c.object({resolved:c.literal(!0)}),xQ=ye({channel:"conflict:resolve",request:sZ,response:aZ,delivery:"request"})});var _Q,lZ,uZ,sIe,EQ,IQ;var dZ=S(()=>{de();_Q=c.enum(["admin","trusted","public"]),lZ=c.object({conversationId:c.string().min(1),message:c.string(),interfaceType:c.string().min(1),channelId:c.string().optional(),channelName:c.string().optional(),userPermissionLevel:_Q}),uZ=c.object({id:c.string().min(1),source:c.string().min(1),title:c.string().optional(),content:c.string().min(1),provenance:c.record(c.string(),c.unknown()).optional()}),sIe=c.object({items:c.array(uZ).default([])}),EQ=c.object({items:c.array(c.unknown()).default([]).transform((e)=>e.flatMap((t)=>{let r=uZ.safeParse(t);return r.success?[r.data]:[]}))}),IQ=ye({channel:"agent:context:request",request:lZ,response:EQ,delivery:"collect"})});var AQ,kQ;var pZ=S(()=>{de();AQ=c.strictObject({entityType:c.string().min(1),entityId:c.string().min(1)}),kQ=c.strictObject({startedAt:c.string().datetime(),retrieved:c.array(AQ).max(50)})});var fZ,RQ,mZ,TQ;var hZ=S(()=>{de();Ad();fZ=c.object({actor:Wn}),RQ=c.object({userId:c.string().min(1),personId:c.string().min(1),canonicalId:c.string().min(1).optional(),displayName:c.string().min(1),permissionLevel:c.enum(["admin","trusted","public"])}),mZ=c.object({principal:RQ.nullable()}),TQ=ye({channel:"auth:principal:resolve",request:fZ,response:mZ,delivery:"request"})});var gZ,$Q;var yZ=S(()=>{de();gZ=c.object({type:c.string().regex(/^[a-z][a-z0-9-]*$/),subjectPrefix:c.string().max(32).default(""),subjectSuffix:c.string().max(255).default("")}),$Q=c.object({clientId:c.string().regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/).min(3).max(64),clientSecret:c.string().min(32).max(512),clientName:c.string().trim().min(1).max(200),redirectUris:c.array(c.url()).min(1).max(10),identityClaim:gZ.optional()})});var bZ=()=>{};var SZ=()=>{};var $A,OQ,vZ,CQ,PQ;var wZ=S(()=>{de();$A=c.strictObject({name:c.string().min(1).optional(),address:c.email()}),OQ=c.strictObject({personId:c.string().min(1).max(200),displayName:c.string().trim().min(1).max(200),permissionLevel:c.enum(["admin","trusted","public"])}),vZ=c.strictObject({messageId:c.string().min(1),sourceRef:c.string().min(1),threadId:c.string().min(1).optional(),from:$A,replyTo:$A.optional(),to:c.array($A),subject:c.string(),receivedAt:c.iso.datetime(),text:c.string(),html:c.string().min(1).optional(),headers:c.strictObject({listUnsubscribe:c.string().min(1).optional(),autoSubmitted:c.string().min(1).optional(),precedence:c.string().min(1).optional(),inReplyTo:c.string().min(1).optional(),references:c.array(c.string().min(1)).optional()}),sender:OQ.optional()}),CQ=c.strictObject({}),PQ=ye({channel:"email:inbound",request:vZ,response:CQ,delivery:"request"})});var zQ,NQ,xZ,OA,DQ,_Z,LQ;var EZ=S(()=>{de();zQ=c.strictObject({permissionLevel:c.enum(["admin","trusted","public"])}),NQ=c.custom((e)=>typeof AbortSignal<"u"&&e instanceof AbortSignal),xZ=c.strictObject({sourceRef:c.string().regex(/^imap:[a-f0-9]{64}$/),actor:zQ,signal:NQ.optional()}),OA=c.strictObject({name:c.string().trim().min(1).max(300).optional(),address:c.email().max(320)}),DQ=c.strictObject({messageId:c.string().trim().min(1).max(2000),from:OA,replyTo:OA.optional(),to:c.array(OA).max(100),subject:c.string().max(1000),receivedAt:c.iso.datetime(),text:c.string().max(1e5),inReplyTo:c.string().trim().min(1).max(2000).optional(),references:c.array(c.string().trim().min(1).max(2000)).max(100),truncated:c.boolean()}),_Z=c.discriminatedUnion("kind",[c.strictObject({kind:c.literal("available"),message:DQ}),c.strictObject({kind:c.literal("unavailable")})]),LQ=ye({channel:"email:source-read",request:xZ,response:_Z,delivery:"request"})});var IZ=S(()=>{eg()});var ZQ;var AZ=S(()=>{de();ZQ=c.object({url:c.string(),authToken:c.string().optional()})});var jQ;var kZ=S(()=>{de();jQ=c.object({success:c.boolean(),entityId:c.string().optional(),error:c.string().optional()})});var RZ=()=>{};function ng(e,t="handler_failed"){let r=t,o;try{if(e!==null&&typeof e==="object"){let n=Rd.safeParse(Reflect.get(e,"code"));if(n.success)r=n.data,o=Td.shape.message.safeParse(Reflect.get(e,"publicMessage")).data;else{let i=Reflect.get(e,"name");if(i==="AbortError")r="cancelled";if(i==="TimeoutError")r="deadline_exceeded"}}}catch{}return new Ci(r,{cause:e,...o!==void 0?{publicMessage:o}:{}})}var Rd,$Z=1024,Td,TZ,Ci;var OZ=S(()=>{de();Rd=c.enum(["no_handler","handler_failed","invalid_input","invalid_response","unauthenticated","permission_denied","not_found","conflict","cancelled","deadline_exceeded"]),Td=c.object({code:Rd,message:c.string().max($Z)}),TZ={no_handler:"No handler is available for this capability",handler_failed:"The operation failed",invalid_input:"Invalid input",invalid_response:"Invalid response",unauthenticated:"Authentication required",permission_denied:"Permission denied",not_found:"Not found",conflict:"The operation conflicts with the current state",cancelled:"The operation was cancelled",deadline_exceeded:"The execution deadline was exceeded"};Ci=class Ci extends Error{code;publicMessage;constructor(e,t={}){let r=Rd.parse(e),o=Td.shape.message.parse(t.publicMessage??TZ[r]);super(t.message??o,{cause:t.cause});this.name="SdkError",this.code=r,this.publicMessage=o}toJSON(){let e=Rd.safeParse(this.code),t=e.data??"handler_failed",r=e.success?Td.shape.message.safeParse(this.publicMessage).data:void 0;return{code:t,message:r??TZ[t]}}}});var og,ig;var CA=S(()=>{de();og=c.lazy(()=>c.union([c.null(),c.boolean(),c.number().finite().refine((e)=>!Number.isInteger(e)||Number.isSafeInteger(e),{message:"integer exceeds the JSON-safe range"}),c.string(),c.array(og),c.record(c.string(),og)])),ig=c.record(c.string(),og)});var BQ;var CZ=S(()=>{de();BQ=c.enum(["user","assistant"])});var UQ,To;var PZ=S(()=>{de();UQ=c.object({entityType:c.string().min(1),entityId:c.string().min(1),contentHash:c.string().min(1).optional()}),To=c.object({rootJobId:c.string().min(1),causationId:c.string().min(1),projectionId:c.string().min(1).optional(),projectionLineage:c.array(c.string().min(1)),sourceEntity:UQ.optional(),derivationDepth:c.number().int().nonnegative()}).superRefine((e,t)=>{if(e.derivationDepth!==e.projectionLineage.length)t.addIssue({code:"custom",path:["derivationDepth"],message:"Derivation depth must equal projection lineage length"});let r=e.projectionLineage.at(-1);if(e.projectionId!==r)t.addIssue({code:"custom",path:["projectionId"],message:"Current projection must equal the final projection lineage entry"})})});var PA=10,zZ=82,zA,MQ,qQ,FQ,HQ,JQ,KQ;var NZ=S(()=>{de();zA=c.object({title:c.string().min(1).max(200),lines:c.array(c.string().min(1)).min(1).max(PA),actions:c.array(c.object({label:c.string().min(1).max(80),value:c.string().min(1).max(zZ)})).max(PA)}),MQ=zA.extend({channelId:c.string().min(1),interfaceType:c.string().min(1),reactions:c.array(c.object({messageId:c.string().min(1),emoji:c.string().min(1)}))}),qQ=c.object({messageId:c.string().min(1)}),FQ=c.object({conversationId:c.string().min(1),noticeMessageId:c.string().min(1),value:c.string().min(1),by:c.string().min(1)}),HQ=ye({channel:"chat:space-notice",request:MQ,response:qQ,delivery:"request"}),JQ=zA.nullable(),KQ=ye({channel:"chat:space-notice-action",request:FQ,response:JQ,delivery:"collect"})});var NA,DA,VQ,WQ,GQ,QQ;var DZ=S(()=>{de();tg();NA={progress:"job-progress"},DA={completed:"publish:completed",failed:"publish:failed"},VQ=c.object({entityType:c.string().min(1),entityId:c.string().min(1),result:c.object({id:c.string(),url:c.string().optional()})}),WQ=c.object({entityType:c.string().min(1),entityId:c.string().min(1),error:c.string(),retryCount:c.number(),willRetry:c.boolean()}),GQ=Gn(DA.completed,VQ),QQ=Gn(DA.failed,WQ)});var LA=()=>{};var GIe;var LZ=S(()=>{de();LA();GIe=c.object({public:c.boolean(),preview:c.boolean()})});var ZZ,jZ,XQ;var BZ=S(()=>{de();ZZ=c.object({entityType:c.string().min(1),entityId:c.string(),metadata:c.record(c.string(),c.unknown()).default({}),content:c.string().default("")}),jZ=c.object({relativePath:c.string(),leaf:c.object({start:c.number().int().nonnegative(),end:c.number().int().nonnegative()}).nullable(),owner:c.object({entityType:c.string(),id:c.string()}).optional(),writable:c.boolean().optional()}),XQ=ye({channel:"sync:path:request",request:ZZ,response:jZ,delivery:"request"})});var eY,tY,rY,nY;var UZ=S(()=>{de();eY=c.strictObject({}),tY=c.object({branch:c.string(),hasChanges:c.boolean(),ahead:c.number(),behind:c.number(),lastCommit:c.string().nullable(),remote:c.string().nullable()}),rY=c.object({syncPath:c.string(),isInitialized:c.boolean(),watchEnabled:c.boolean(),lastSync:c.string().nullable(),totalFiles:c.number(),byEntityType:c.record(c.string(),c.number()),git:tY.nullable(),managementUrl:c.string().optional()}),nY=ye({channel:"sync:status:request",request:eY,response:rY,delivery:"request"})});var MZ=()=>{};var qZ,oY,iY;var FZ=S(()=>{de();qZ=c.strictObject({waveId:c.string().trim().min(1),sourceTypes:c.array(c.string().trim().min(1)),changedTargetTypes:c.array(c.string().trim().min(1))}),oY=c.strictObject({}),iY=ye({channel:"projection:wave-ready",request:qZ,response:oY,delivery:"collect"})});var sY,aY,cY,lY;var HZ=S(()=>{de();sY=c.strictObject({}),aY=c.object({entityType:c.string().min(1),entityId:c.string().min(1),previousHash:c.string().min(1),contentHash:c.string().min(1)}),cY=c.object({restated:c.array(aY)}),lY=ye({channel:"stored-content:restate",request:sY,response:cY,delivery:"collect"})});var uY,dY,pY;var JZ=S(()=>{de();uY=c.strictObject({}),dY=c.string(),pY=ye({channel:"plugin:site-builder:head-scripts",request:uY,response:dY,delivery:"collect"})});function KZ(e){return typeof e==="function"}var VZ=".site-build-manifest.json",fY,mY,hY,gY;var WZ=S(()=>{de();fY=`/${VZ}`,mY=ye({channel:"site:build:requested",request:c.object({reason:c.string().min(1)}),response:c.void(),delivery:"command"});hY=c.object({outputDir:c.string(),environment:c.enum(["preview","production"]),routesBuilt:c.number(),siteConfig:c.object({title:c.string().optional(),description:c.string().optional(),url:c.string().optional(),copyright:c.string().optional(),themeMode:c.enum(["light","dark"]).optional()}),generateEntityUrl:c.custom(KZ),reportFailure:c.custom(KZ)}),gY=ye({channel:"site:build:staging",request:hY,response:c.void(),delivery:"command"})});var yY,bY,SY;var GZ=S(()=>{de();yY=c.object({id:c.string().min(1),trigger:c.string().min(1),playbookId:c.string().min(1),once:c.boolean().default(!0),starterText:c.string().min(1),description:c.string().min(1).optional(),starterPrompt:c.string().min(1)}).strict(),bY=c.object({registered:c.boolean(),id:c.string(),ignored:c.boolean().optional(),reason:c.string().optional()}),SY=ye({channel:"playbooks:register-lifecycle-starter",request:yY,response:bY,delivery:"request"})});var vY,wY,xY;var QZ=S(()=>{de();vY=c.object({id:c.string().min(1),markdown:c.string().min(1)}).strict(),wY=c.object({created:c.boolean()}),xY=ye({channel:"playbooks:seed",request:vY,response:wY,delivery:"request"})});var YZ,sg,ZA,XZ,ej,_Y,EY;var tj=S(()=>{de();YZ=["name","headline","industry","location","website","story"],sg=c.enum(YZ),ZA=c.object({name:c.string().optional(),headline:c.string().optional(),industry:c.string().optional(),location:c.string().optional(),website:c.string().optional(),story:c.string().optional()}),XZ=c.enum(["fill","preserve","unchanged"]),ej=c.object({field:sg,current:c.string().nullable(),imported:c.string(),outcome:XZ}),_Y=ye({channel:"@brains/profile:import-preview",request:c.object({fields:ZA}),response:c.object({fields:c.array(ej),changed:c.boolean(),revision:c.string()}),delivery:"request"}),EY=ye({channel:"@brains/profile:import-apply",request:c.object({fields:ZA,revision:c.string()}),response:c.object({filled:c.array(sg),kept:c.array(sg)}),delivery:"request"})});function kY(e){return typeof e==="object"&&e!==null&&"name"in e&&typeof e.name==="string"&&"publish"in e&&typeof e.publish==="function"}var IY,AY,RY,TY,$Y,OY,rj,CY;var nj=S(()=>{de();IY=c.enum(["provider"]),AY=c.object({executionMode:IY.optional(),publishResultIdField:c.string().min(1).optional(),publishTimestampField:c.string().min(1).optional(),enabled:c.boolean().optional()}).strict();RY=c.custom(kY),TY=c.object({entityType:c.string(),provider:RY.optional(),config:AY.optional()}),$Y=ye({channel:"publish:register",request:TY,response:c.void(),delivery:"command"}),OY=c.union([c.string().min(1),c.object({location:c.enum(["metadata","frontmatter"]),field:c.string().min(1)})]),rj=c.object({entityType:c.string().min(1),attachmentType:c.string().min(1),mediaEntityType:c.enum(["image"]),targetEntityField:OY.optional(),requiredWhen:c.object({status:c.string().min(1).optional(),visibility:c.string().min(1).optional()}).optional(),autoGenerate:c.boolean().optional(),requiredForPublish:c.boolean().optional()}),CY=ye({channel:"publish-assets:register",request:rj,response:c.void(),delivery:"command"})});var PY,zY,NY,DY,LY,ZY;var oj=S(()=>{de();PY=c.object({entityType:c.string()}),zY=ye({channel:"generate:execute",request:PY,response:c.void(),delivery:"command"}),NY=c.object({entityType:c.string(),entityId:c.string()}),DY=ye({channel:"generate:report:success",request:NY,response:c.void(),delivery:"command"}),LY=c.object({entityType:c.string(),error:c.string()}),ZY=ye({channel:"generate:report:failure",request:LY,response:c.void(),delivery:"command"})});var ij=()=>{};var sj,aj,cj,jY;var lj=S(()=>{de();Ad();sj=c.record(c.string(),c.unknown()),aj=c.object({entityType:c.string().min(1),source:c.object({entityType:c.string().min(1),entityIds:c.array(c.string().min(1)).min(1).max(51)}),prompt:c.string().trim().min(1).max(2000).optional(),approval:sj.optional(),actor:Wn,interfaceType:c.string().min(1),userPermissionLevel:c.enum(["admin","trusted","public"])}),cj=c.discriminatedUnion("status",[c.object({status:c.literal("confirm"),summary:c.string(),completionSummary:c.string().optional(),preview:c.string(),approval:sj}),c.object({status:c.literal("queued"),entityId:c.string(),jobId:c.string().optional()}),c.object({status:c.literal("refused"),error:c.string(),code:c.string().optional()})]),jY=ye({channel:"generate:from-sources",request:aj,response:cj,delivery:"request"})});var BY,uj,dj,pj;var fj=S(()=>{de();BY=c.object({message:c.string().describe("Natural language response to the query"),summary:c.string().optional().describe("Brief summary if applicable"),topics:c.array(c.string()).optional().describe("Related topics mentioned"),sources:c.array(c.object({id:c.string(),type:c.string(),excerpt:c.string().optional(),relevance:c.number().min(0).max(1).optional()})).optional().describe("Source entities used to answer the query"),metadata:c.record(c.string(),c.unknown()).optional()}).describe("defaultQueryResponse"),uj=c.object({message:c.string()}).describe("simpleTextResponse"),dj=c.object({success:c.boolean(),entityId:c.string().optional(),message:c.string()}).describe("createEntityResponse"),pj=c.object({success:c.boolean(),entityId:c.string(),changes:c.array(c.string()).optional(),message:c.string()}).describe("updateEntityResponse")});var mj,hj,UY,gj,yj,MY;var bj=S(()=>{de();mj=c.discriminatedUnion("type",[c.strictObject({type:c.literal("email"),address:c.email()}),c.strictObject({type:c.literal("matrix"),address:c.string().regex(/^@[a-z0-9._=/+-]+:[A-Za-z0-9.-]+(:[0-9]+)?$/)})]),hj=c.strictObject({recipient:mj.optional(),title:c.string().min(1),body:c.string().min(1),html:c.string().min(1).optional(),sensitivity:c.enum(["normal","secret"]).default("normal"),idempotencyKey:c.string().trim().min(1).max(200).optional(),replyTo:c.email().optional()}),UY=c.enum(["recipient-missing","transport-missing","delivery-failed"]),gj=c.string().regex(/^[a-z0-9_:.-]{1,80}$/u),yj=c.discriminatedUnion("status",[c.strictObject({status:c.literal("sent"),deliveryId:c.string().optional()}),c.strictObject({status:c.literal("failed"),failure:UY,transportCode:gj.optional()})]),MY=ye({channel:"notifications:send",request:hj,response:yj,delivery:"request"})});var qY,Sj,FY;var vj=S(()=>{de();qY=c.strictObject({}),Sj=c.strictObject({titles:c.array(c.string().trim().min(1).max(500)).max(20)}),FY=ye({channel:"topics:public-titles",request:qY,response:Sj,delivery:"request"})});var HY,jA,JY,KY,VY,WY,GY,QY;var wj=S(()=>{de();HY=c.strictObject({}),jA=c.string().trim().min(1).max(100),JY=c.strictObject({types:c.array(jA).max(20)}),KY=ye({channel:"collections:types",request:HY,response:JY,delivery:"collect"}),VY=c.strictObject({entityType:jA,ids:c.array(c.string().min(1).max(500)).min(1).max(200),visibilityScope:c.enum(["public","shared","restricted"])}),WY=c.strictObject({entityType:jA,id:c.string().min(1).max(500)}),GY=c.strictObject({collections:c.array(c.strictObject({id:c.string().min(1).max(500),members:c.array(WY).max(1000)})).max(200)}),QY=ye({channel:"collections:members",request:VY,response:GY,delivery:"collect"})});var YY,XY,eX,tX,rX;var xj=S(()=>{de();YY=c.string().trim().regex(/^[a-z][a-z0-9-]*$/).max(100),XY=c.strictObject({entityType:YY,entityId:c.string().min(1).max(300),visibilityScope:c.enum(["public","shared","restricted"])}),eX=c.strictObject({name:c.string().min(1).max(100),label:c.string().min(1).max(100)}),tX=c.strictObject({title:c.string().max(500),typeLabel:c.string().min(1).max(100),markdown:c.string(),fields:c.array(eX).max(40)}).nullable(),rX=ye({channel:"studio:entry-context",request:XY,response:tX,delivery:"request"})});var nX,oX,iX;var _j=S(()=>{de();nX=c.strictObject({}),oX=c.strictObject({types:c.array(c.string().trim().min(1))}),iX=ye({channel:"topics:source-types",request:nX,response:oX,delivery:"request"})});var Ej,Ij,sX;var Aj=S(()=>{de();Ej=c.strictObject({id:c.string().regex(/^[a-z0-9][a-z0-9-]{0,79}$/),title:c.string().trim().min(1).max(200),body:c.string().trim().min(1).max(20000)}),Ij=c.strictObject({noteId:c.string(),created:c.boolean()}),sX=ye({channel:"note:capture",request:Ej,response:Ij,delivery:"request"})});var Zc,$d,aX,cX,lX,uX,dX,pX;var kj=S(()=>{de();CA();Zc=c.string().regex(/^[a-z][a-z0-9-]{0,63}$/),$d=c.string().min(32).max(512),aX=c.strictObject({provider:Zc,brainState:$d}),cX=c.strictObject({authorizationUrl:c.url({protocol:/^https?$/})}),lX=c.strictObject({provider:Zc,grant:$d}),uX=c.strictObject({provider:Zc,credential:ig}),dX=c.enum(["provider_denied","authorization_incomplete","credential_exchange_failed"]),pX=c.union([c.strictObject({provider:Zc,state:$d,grant:$d}),c.strictObject({provider:Zc,state:$d,error:dX})])});var fX,mX,hX,gX;var Rj=S(()=>{de();fX=c.object({permissionLevel:c.enum(["public","trusted","admin"])}),mX=c.object({id:c.string().min(1),title:c.string().min(1),sub:c.string().optional(),href:c.string().min(1),primary:c.boolean().optional(),keywords:c.array(c.string()).optional()}),hX=c.array(mX),gX=ye({channel:"console:jump-destinations",request:fX,response:hX,delivery:"collect"})});var ag,BA;var Tj=S(()=>{de();ag=c.enum(["github","instagram","linkedin","podcast","email","website"]),BA=c.object({platform:ag.describe("Social media platform"),url:c.string().describe("Profile or contact URL"),label:c.string().optional().describe("Optional display label")})});function Od(e){if(!e.type.includes(":"))throw Error(`Job contract type "${e.type}" must name its owner, as "owner:job"`);return Object.freeze({type:e.type,input:e.input})}var $j,Oj,Cj,yX,bX,Pj,SX;var zj=S(()=>{de();$j=c.enum(["1:1","16:9","9:16","4:3","3:4"]),Oj=c.object({prompt:c.string(),title:c.string().optional(),aspectRatio:$j.optional(),targetEntityType:c.string().optional(),targetEntityId:c.string().optional(),entityTitle:c.string().optional(),entityContent:c.string().optional()}),Cj=c.object({imageId:c.string().min(1)}),yX=Od({type:"image:image-describe",input:Cj}),bX=Od({type:"image:image-generate",input:Oj}),Pj=c.object({sourceEntityType:c.string().min(1),sourceEntityId:c.string().min(1),attachmentType:c.string().min(1),imageId:c.string().min(1),dedupKey:c.string().min(1).optional(),replace:c.boolean().optional(),targetEntityType:c.string().min(1).optional(),targetEntityId:c.string().min(1).optional(),targetImageField:c.enum(["coverImageId","ogImageId"]).optional()}),SX=Od({type:"image:image-render-source",input:Pj})});var vX;var Nj=S(()=>{de();vX=c.enum(["none","low","medium","high","xhigh","max"])});var wX,Dj,xX;var Lj=S(()=>{de();wX=c.object({}),Dj=c.object({userId:c.string().min(1),password:c.string().min(1)}),xX=ye({channel:"matrix:bot-credentials",request:wX,response:Dj,delivery:"request"})});var UA;var Zj=S(()=>{UA=["core","media","automation","web","chat","site","publishing","federation","matrix","team"]});var kke;var jj=S(()=>{de();kke=c.object({series:c.array(c.string()).optional(),publishedAt:c.string().optional()})});var wt=S(()=>{EA();_L();RA();WL();QL();kd();eZ();cZ();dZ();pZ();Ad();hZ();yZ();bZ();SZ();wZ();EZ();IZ();AZ();kZ();RZ();OZ();CA();CZ();PZ();NZ();DZ();tg();LZ();LA();BZ();UZ();MZ();FZ();HZ();AA();JZ();WZ();GZ();QZ();tj();nj();oj();ij();lj();fj();bj();vj();wj();xj();_j();Aj();kj();Rj();Tj();zj();Nj();Lj();Zj();jj()});var AX,kX,Ct,br,Ws,RX,Gs="capability-bundles-v1",MA,TX,$X,OX,CX,Bj,cg,Qs,hn,PX,zX,NX,DX,LX,qA,ZX,jX,lg;var $o=S(()=>{wt();wt();de();AX=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,kX=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Ct=c.string().regex(AX,"expected exact pinned version"),br=c.string().regex(kX,"expected lowercase handle slug"),Ws=c.string().min(1),RX=c.string().startsWith("age1").min(1),MA=c.enum(UA),TX=["professional","team","organization"],$X=c.enum(TX),OX=["person","team","organization"],CX=c.enum(OX),Bj=c.array(MA).min(1),cg=c.array(c.string().min(1)),Qs=c.strictObject({brainVersion:Ct,bundleContract:c.literal(Gs),bundles:Bj,add:cg.optional(),remove:cg.optional(),githubOrg:c.string().min(1),contentRepoPrefix:c.string().min(1),domainSuffix:c.string().min(1),openaiApiKey:Ws,gitSyncToken:Ws,contentRepoAdminToken:Ws,agePublicKey:RX}).superRefine((e,t)=>{if(new Set(e.bundles).size!==e.bundles.length)t.addIssue({code:c.ZodIssueCode.custom,path:["bundles"],message:"canonical bundles must be unique"})}),hn=c.strictObject({members:c.array(br).min(1),brainVersionOverride:Ct.optional(),bundlesOverride:Bj.optional(),addOverride:cg.optional(),removeOverride:cg.optional(),openaiApiKeyOverride:Ws.optional(),gitSyncTokenOverride:Ws.optional()}).superRefine((e,t)=>{if(new Set(e.members).size!==e.members.length)t.addIssue({code:c.ZodIssueCode.custom,path:["members"],message:"cohort members must be unique"});if(e.bundlesOverride&&new Set(e.bundlesOverride).size!==e.bundlesOverride.length)t.addIssue({code:c.ZodIssueCode.custom,path:["bundlesOverride"],message:"canonical bundle overrides must be unique"})}),PX=c.strictObject({platform:ag,url:c.string().min(1),label:c.string().min(1).optional()}),zX=c.strictObject({name:c.string().min(1).optional(),description:c.string().min(1).optional(),website:c.string().min(1).optional(),email:c.string().min(1).optional(),story:c.string().min(1).optional(),socialLinks:c.array(PX).optional()}),NX=c.strictObject({delivery:c.literal("email"),email:c.string().email()}),DX=c.strictObject({enabled:c.boolean().optional(),endpoint:c.string().url().refine((e)=>new URL(e).protocol==="wss:",{message:"Jetstream endpoint must use wss"}).optional(),replayWindowSeconds:c.number().int().min(60).optional(),denyDids:c.array(c.string().startsWith("did:plc:")).optional(),denyDomains:c.array(c.string().min(1)).optional(),skillKeywords:c.array(c.string().min(1)).optional(),queueLimit:c.number().int().min(1).max(1e4).optional(),concurrency:c.number().int().min(1).max(32).optional(),perDidCooldownSeconds:c.number().int().nonnegative().optional(),fetchBudgetPerMinute:c.number().int().min(1).optional(),newAgentsPerHour:c.number().int().min(1).optional(),pendingCandidateCeiling:c.number().int().min(1).optional(),staleCandidateRetentionDays:c.number().int().min(1).optional(),requestTimeoutMs:c.number().int().min(100).optional(),maxResponseBytes:c.number().int().min(1024).optional(),maxRedirects:c.number().int().nonnegative().optional(),retryAttempts:c.number().int().min(1).optional(),heartbeatIntervalHours:c.number().min(1).optional()}),LX=c.strictObject({identifier:c.string().min(1),accountDid:c.string().min(1).optional(),lexiconAuthority:c.boolean().optional(),jetstream:DX.optional()}),qA=c.strictObject({package:c.string().min(1),version:Ct.optional(),theme:c.string().min(1).optional(),themeVersion:Ct.optional()}).superRefine((e,t)=>{let r=e.package.startsWith("@rizom/");if(r&&e.version===void 0)t.addIssue({code:c.ZodIssueCode.custom,path:["version"],message:"external @rizom site packages require an exact version pin"});if(!r&&e.version!==void 0)t.addIssue({code:c.ZodIssueCode.custom,path:["version"],message:"version is valid only for external @rizom site packages"});let o=e.theme?.startsWith("@rizom/")===!0;if(o&&e.themeVersion===void 0)t.addIssue({code:c.ZodIssueCode.custom,path:["themeVersion"],message:"external @rizom themes require an exact version pin"});if(!o&&e.themeVersion!==void 0)t.addIssue({code:c.ZodIssueCode.custom,path:["themeVersion"],message:"themeVersion is valid only for external @rizom themes"})}),ZX=c.strictObject({onboarding:c.boolean().optional()}),jX=c.record(c.string().min(1),c.record(c.string(),c.unknown())),lg=c.strictObject({handle:br,discord:c.strictObject({enabled:c.boolean(),anchorUserId:c.string().min(1).optional()}),openaiApiKeyOverride:Ws.optional(),gitSyncTokenOverride:Ws.optional(),domainOverride:c.string().min(1).optional(),cloudflareZoneId:c.string().min(1).optional(),contentRepoOverride:c.string().min(1).optional(),profileKind:$X.optional(),anchorKind:CX.optional(),plugins:jX.optional(),spaces:c.array(c.string().min(1)).optional(),embeddingEnabled:c.boolean().optional(),embeddingModel:c.string().optional(),topicExtractionEnabled:c.boolean().optional(),skillDerivationEnabled:c.boolean().optional(),swotDerivationEnabled:c.boolean().optional(),addOverride:c.array(c.string().min(1)).optional(),removeOverride:c.array(c.string().min(1)).optional(),siteOverride:qA.optional(),setup:NX.optional(),atproto:LX.optional(),playbooks:ZX.optional(),anchorProfile:zX.optional()})});import{access as BX}from"fs/promises";async function Ar(e){try{return await BX(e),!0}catch{return!1}}function jc(e){return e.replaceAll("\\","/")}var Ys=()=>{};import{readdir as UX,readFile as MX}from"fs/promises";import{basename as FA,join as Cd,relative as qX}from"path";async function xt(e,t={}){let[r,o,n]=await Promise.all([HA(Cd(e,"pilot.yaml"),Qs),HX(e),JX(e)]),i=KX(o,n),s=n.map((l)=>({id:l.id,members:[...l.data.members].sort(),...$c({brainVersionOverride:l.data.brainVersionOverride,bundlesOverride:l.data.bundlesOverride,addOverride:l.data.addOverride,removeOverride:l.data.removeOverride,openaiApiKeyOverride:l.data.openaiApiKeyOverride,gitSyncTokenOverride:l.data.gitSyncTokenOverride})})).sort((l,u)=>l.id.localeCompare(u.id)),a=await Promise.all(o.map(async(l)=>{let u=i.get(l.data.handle);if(!u)throw new Xs(`User ${l.data.handle} must belong to exactly one cohort`);let d={...FX(l.data,u,r),snapshotStatus:await GX(e,l.data.handle)},p=await t.resolveStatus?.(d);return{...d,serverStatus:p?.serverStatus??"unknown",deployStatus:p?.deployStatus??"unknown",dnsStatus:p?.dnsStatus??"unknown",mcpStatus:p?.mcpStatus??"unknown"}}));return a.sort((l,u)=>l.handle.localeCompare(u.handle)),{pilot:r,cohorts:s,users:a}}function FX(e,t,r){let o=t.data.bundlesOverride===void 0;return{handle:e.handle,cohort:t.id,brainVersion:t.data.brainVersionOverride??r.brainVersion,bundleContract:r.bundleContract,bundles:[...t.data.bundlesOverride??r.bundles],add:Uj(t.data.addOverride??(o?r.add:void 0),e.addOverride),remove:Uj(t.data.removeOverride??(o?r.remove:void 0),e.removeOverride),domain:e.domainOverride??`${e.handle}${r.domainSuffix}`,...$c({cloudflareZoneId:e.cloudflareZoneId}),contentRepo:e.contentRepoOverride??`${r.contentRepoPrefix}${e.handle}-content`,...$c({profileKind:e.profileKind,anchorKind:e.anchorKind,embeddingEnabled:e.embeddingEnabled,embeddingModel:e.embeddingModel,spaces:e.spaces,plugins:e.plugins,topicExtractionEnabled:e.topicExtractionEnabled,skillDerivationEnabled:e.skillDerivationEnabled,swotDerivationEnabled:e.swotDerivationEnabled,siteOverride:e.siteOverride&&{...e.siteOverride}}),discordEnabled:e.discord.enabled,...$c({discordAnchorUserId:e.discord.anchorUserId}),effectiveOpenaiApiKey:e.openaiApiKeyOverride??t.data.openaiApiKeyOverride??r.openaiApiKey,effectiveGitSyncToken:e.gitSyncTokenOverride??t.data.gitSyncTokenOverride??r.gitSyncToken,...$c({setup:e.setup,atproto:e.atproto,playbooks:e.playbooks}),anchorProfile:VX(e.handle,e.anchorProfile)}}function Uj(e,t){return QX([...e??[],...t??[]])}async function HX(e){let t=Cd(e,"users"),r=(await Mj(t)).filter((n)=>!FA(n).endsWith(".secrets.yaml"));return(await Promise.all(r.map(async(n)=>{let i=qj(FA(n)),s=await HA(n,lg);if(s.handle!==i){let a=jc(qX(e,n));throw new Xs(`${a} must declare handle: ${i}`)}return{id:i,data:s}}))).sort((n,i)=>n.id.localeCompare(i.id))}async function JX(e){let t=Cd(e,"cohorts"),r=await Mj(t);return(await Promise.all(r.map(async(n)=>({id:qj(FA(n)),data:await HA(n,hn)})))).sort((n,i)=>n.id.localeCompare(i.id))}function KX(e,t){let r=new Map(e.map((n)=>[n.data.handle,n])),o=new Map;for(let n of t)for(let i of n.data.members){if(!r.has(i))throw new Xs(`Cohort ${n.id} references unknown user ${i}`);if(o.has(i))throw new Xs(`User ${i} must belong to exactly one cohort`);o.set(i,n)}for(let n of e)if(!o.has(n.data.handle))throw new Xs(`User ${n.data.handle} must belong to exactly one cohort`);return o}function VX(e,t){return{name:t?.name??WX(e),...t?.description?{description:t.description}:{},...t?.website?{website:t.website}:{},...t?.email?{email:t.email}:{},...t?.story?{story:t.story}:{},...t?.socialLinks?{socialLinks:t.socialLinks.map((r)=>({platform:r.platform,url:r.url,...r.label?{label:r.label}:{}}))}:{}}}function WX(e){return e.split("-").filter((t)=>t.length>0).map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}async function GX(e,t){let r=Cd(e,"users",t,"brain.yaml");return await Ar(r)?"present":"missing"}async function Mj(e){return(await UX(e,{withFileTypes:!0})).filter((r)=>r.isFile()&&r.name.endsWith(".yaml")).map((r)=>Cd(e,r.name)).sort((r,o)=>r.localeCompare(o))}async function HA(e,t){let r=await MX(e,"utf8"),o=yr(r,t);if(!o.ok)throw new Xs(`${jc(e)}: ${o.error}`);return o.data}function QX(e){return[...new Set(e)]}function qj(e){return e.replace(/\.ya?ml$/,"")}var Xs;var gn=S(()=>{Vn();$o();Ys();Xs=class Xs extends Error{}});import{mkdir as nee,writeFile as oee}from"fs/promises";import{join as Kj}from"path";async function Pi(e,t={}){let o=(t.registry??await xt(e,t)).users.map((i)=>{let s=i.discordEnabled?"on":"off";return[i.handle,i.cohort,i.bundles.join(","),i.add.join(","),i.remove.join(","),i.brainVersion,i.domain,i.contentRepo,s,i.serverStatus,i.deployStatus,i.dnsStatus,i.mcpStatus]}),n=["<!-- generated by brains-ops; do not edit -->","",iee,see,...o.map((i)=>`| ${i.join(" | ")} |`),""].join(`
|
|
283
283
|
`);await nee(Kj(e,"views"),{recursive:!0}),await oee(Kj(e,"views","users.md"),n)}var iee="| handle | cohort | bundles | add | remove | brainVersion | domain | contentRepo | discord | serverStatus | deployStatus | dnsStatus | mcpStatus |",see="| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |";var Pd=S(()=>{gn()});var Qj=S(()=>{Mn()});function zd(e){if(e===null||typeof e!=="object"||Array.isArray(e))return!1;let t=Ree(e);return t===Object.prototype||t===null}function Tee(e){return e instanceof Error&&"code"in e&&typeof e.code==="string"}function dg(e){return Tee(e)&&e.code==="ENOENT"}var Ree;var Nd=S(()=>{Ree=Object.getPrototypeOf});import{lstat as GA,mkdir as Yj,readFile as Xj,unlink as $ee,writeFile as eB}from"fs/promises";import{join as yn}from"path";import{isDeepStrictEqual as Oee}from"util";function oB(e){return yn("deploy","runtime",Cee.parse(e.tag))}function iB(e){let t={"@rizom/brain":Ct.parse(e.brainVersion)};for(let r of[...e.sitePackages].sort()){let o=r.lastIndexOf("@"),n=rB.parse(r.slice(0,o)),i=Ct.parse(r.slice(o+1));if(t[n]!==void 0&&t[n]!==i)throw Error(`Conflicting runtime dependency pin: ${r}`);t[n]=i}return nB.parse({name:"rover-pilot-runtime",private:!0,packageManager:"bun@1.4.0",dependencies:t,overrides:{"postcss-selector-parser":"7.1.6"}})}async function QA(e){try{return await GA(e),!0}catch(t){if(dg(t))return!1;throw t}}async function tB(e){if(!(await GA(e)).isFile())throw Error(`Runtime lock input must be a regular file: ${e}`)}async function sB(e){if(!(await GA(e)).isDirectory())throw Error(`Runtime lock input must be a directory: ${e}`)}async function aB(e){for(let t of["deploy",yn("deploy","runtime")]){let r=yn(e,t);if(await QA(r))await sB(r)}}async function WA(e,t){let r=yn(e,"package.json"),o=yn(e,"bun.lock");await tB(r),await tB(o);let n=nB.parse(JSON.parse(await Xj(r,"utf8")));if(!Oee(n,iB(t)))throw Error(`Runtime dependency manifest does not match ${t.tag}`);if(!(await Xj(o,"utf8")).trim())throw Error(`Empty runtime dependency lock: ${o}`)}async function cB(e,t){await aB(e);let r=yn(e,oB(t));if(await sB(r),await QA(yn(r,".incomplete")))throw Error(`Incomplete runtime dependency lock: ${r}`);await WA(r,t)}async function lB(e,t,r=tr){if(Bun.version!=="1.4.0")throw Error("Runtime dependency locks must be generated with Bun 1.4.0");let o=iB(t);await aB(e);let n=yn(e,oB(t));if(await QA(n))return await cB(e,t),"existing";await Yj(yn(e,"deploy","runtime"),{recursive:!0}),await Yj(n);let i=yn(n,".incomplete");return await eB(i,`Runtime dependency resolution has not completed.
|
|
284
284
|
`,{flag:"wx"}),await eB(yn(n,"package.json"),`${JSON.stringify(o,null,2)}
|
|
285
|
-
`,{flag:"wx"}),await r(process.execPath,["install","--lockfile-only","--ignore-scripts"],{cwd:n}),await WA(n,t),await r(process.execPath,["install","--frozen-lockfile","--ignore-scripts","--dry-run"],{cwd:n}),await WA(n,t),await $ee(i),"created"}var Cee,rB,nB;var YA=S(()=>{Nd();de()
|
|
285
|
+
`,{flag:"wx"}),await r(process.execPath,["install","--lockfile-only","--ignore-scripts"],{cwd:n}),await WA(n,t),await r(process.execPath,["install","--frozen-lockfile","--ignore-scripts","--dry-run"],{cwd:n}),await WA(n,t),await $ee(i),"created"}var Cee,rB,nB;var YA=S(()=>{Nd();de();$o();Mn();Cee=c.string().regex(/^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$/),rB=c.string().regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/),nB=c.strictObject({name:c.literal("rover-pilot-runtime"),private:c.literal(!0),packageManager:c.literal("bun@1.4.0"),dependencies:c.record(rB,Ct),overrides:c.strictObject({"postcss-selector-parser":c.literal("7.1.6")})})});function pg(e,t=[]){let r=`brain-${e}`,o=[...new Set(t)].sort();if(o.length===0)return r;let n=`${r}--${o.map((a)=>a.replace(/^@/,"").replace("/","-").replace(/@(?=[^@]*$)/,"-")).join("--")}`,s=`--s${Xh(JSON.stringify([e,...o])).slice(0,12)}`;return`${n.length+s.length<=Pee?n:r}${s}`}function XA(e){if(!e)return[];return[uB(e.package,e.version),uB(e.theme,e.themeVersion)].filter((t)=>t!==void 0)}function uB(e,t){if(!e?.startsWith("@rizom/"))return;if(t===void 0)throw Error(`Package ${e} has no explicit version pin`);return`${e}@${t}`}function zee(e){let t=new Map;for(let r of e){let o=[...new Set(XA(r.siteOverride))].sort(),n=pg(r.brainVersion,o),i=t.get(n);if(i&&(i.brainVersion!==r.brainVersion||!Bun.deepEquals(i.sitePackages,o)))throw Error(`Image tag collision for distinct runtime requirements: ${n}`);t.set(n,{tag:n,brainVersion:r.brainVersion,sitePackages:o})}return[...t.values()].sort((r,o)=>r.tag.localeCompare(o.tag))}function Nee(e,t){let r=new Map;for(let o of[...e,...t]){let n=o.lastIndexOf("@"),i=n>0?o.slice(0,n):o,s=r.get(i);if(s&&s!==o)throw Error(`Fleet shared images have conflicting pins for ${i}: ${s} and ${o}`);r.set(i,o)}return[...r.values()].sort()}async function dB(e){let t=e.brainVersionInput?.trim()??"";if(t){let o=Nee([],(e.sitePackagesInput??"").split(/\s+/).filter(Boolean)),n=pg(t,o);if(!e.allowTagOverwrite&&await e.imageExists(n))throw Error(`Image tag ${n} already exists; published tags are immutable. Pick a new version, or pass overwrite=true only when replacing a tag whose containers were never deployed.`);return[{tag:n,brainVersion:t,sitePackages:o}]}let r=[];for(let o of zee(e.users))if(!await e.imageExists(o.tag))r.push(o);else await e.verifyImage(o);return r}var Pee=128;var ek=S(()=>{Qj();YA();gn();Mn();eg()});function tk(e,t){let r=e.indexOf("/");if(r===-1)return{org:t,name:e};return{org:e.slice(0,r),name:e.slice(r+1)}}function hB(e,t){let{org:r,name:o}=tk(e,t);return`${r}/${o}`}import{mkdtemp as jee,mkdir as Bee,readFile as Uee,rm as Mee,writeFile as qee}from"fs/promises";import{tmpdir as Fee}from"os";import{dirname as Hee,join as bB}from"path";async function SB(e,t,r,o,n={}){if(o.length===0)return;let i=n.env??process.env,s=Lr(e),a=gB(i,s,r.effectiveGitSyncToken),l=n.contentRepoAdminTokenSelector?gB(i,s,n.contentRepoAdminTokenSelector):void 0,u=tk(r.contentRepo,t),d=n.contentRepoRemoteResolver?.(r,t,a)??Wee(u,a);if(!d)return;let p=await jee(bB(Fee(),`brains-ops-content-sync-${r.handle}-`)),m=n.runCommand??tr,h=n.fetchImpl??fetch;try{if(!n.contentRepoRemoteResolver){if(!l)throw Error(`${n.contentRepoAdminTokenSelector??"CONTENT_REPO_ADMIN_TOKEN"} is required to check or create content repos`);await Gee(u,l,h)}await m("git",["clone",d,p]),await Qee(p,m),await m("git",["config","user.name","brains-ops[bot]"],{cwd:p}),await m("git",["config","user.email","41898282+github-actions[bot]@users.noreply.github.com"],{cwd:p});let b=!1;for(let y of o)if(await Kee(p,y))b=!0;if(!b)return;await m("git",["add","."],{cwd:p}),await m("git",["commit","-m",`chore(content): seed ${r.handle} anchor profile`],{cwd:p}),await m("git",["push","origin","HEAD:main"],{cwd:p})}finally{await Mee(p,{recursive:!0,force:!0})}}async function Kee(e,t){let r=bB(e,t.path),o=await Uee(r,"utf8").catch(()=>{return});if(o===t.content)return!1;if(o!==void 0&&!Vee(o))return!1;return await Bee(Hee(r),{recursive:!0}),await qee(r,t.content),!0}function Vee(e){return Jee.some((t)=>e.includes(t))}function gB(e,t,r){return jt(r,e,t)}function Wee(e,t){if(!t)return;return`https://x-access-token:${encodeURIComponent(t)}@github.com/${e.org}/${e.name}.git`}async function Gee(e,t,r){let{org:o,name:n}=e,s=`https://api.github.com/repos/${`${encodeURIComponent(o)}/${encodeURIComponent(n)}`}`,a={Accept:"application/vnd.github+json",Authorization:`Bearer ${t}`,"User-Agent":"brains-ops","X-GitHub-Api-Version":"2022-11-28"},l=await r(s,{headers:a});if(l.ok)return;if(l.status!==404)throw Error(`Failed to check GitHub repo ${o}/${n}: ${l.status} ${await yB(l)}`);let u=await r(`https://api.github.com/orgs/${encodeURIComponent(o)}/repos`,{method:"POST",headers:a,body:JSON.stringify({name:n,private:!0,auto_init:!1})});if(u.ok){console.log(`Created missing content repo ${o}/${n}`);return}if(u.status===422){if((await r(s,{headers:a})).ok)return}throw Error(`Failed to create GitHub repo ${o}/${n}: ${u.status} ${await yB(u)}`)}async function yB(e){let t=await e.text();return t.trim().length===0?e.statusText:t}async function Qee(e,t){try{await t("git",["checkout","-B","main","origin/main"],{cwd:e})}catch{await t("git",["checkout","-B","main"],{cwd:e})}}var Jee;var vB=S(()=>{wi();Mn();Jee=["name: Your Name Here","Delete this and write your own"]});function rk(e,t,r={}){let o={...e};for(let n of Object.keys(t)){let i=t[n];if(i===null&&r.nulls!=="preserve")delete o[n];else if(zd(o[n])&&zd(i))o[n]=rk(o[n],i,r);else o[n]=i}return o}var wB=S(()=>{Nd()});function fg(e){return async(t)=>({brainYaml:Yee(t,e),envFile:tte(t,e),contentRepoFiles:Xee(t)})}function Yee(e,t){let r={...e.setup?.delivery==="email"?{"auth-service":{setupEmail:e.setup.email},notifications:{defaultRecipient:{type:"email",address:e.setup.email}},email:{transport:"resend",apiKey:"${SETUP_EMAIL_API_KEY}",from:"${SETUP_EMAIL_FROM}"}}:{},...e.playbooks?.onboarding?{onboarding:{enabled:!0}}:{},...e.topicExtractionEnabled!==void 0?{topics:{enableAutoExtraction:e.topicExtractionEnabled}}:{},...e.skillDerivationEnabled!==void 0?{agents:{enableSkillDerivation:e.skillDerivationEnabled}}:{},...e.swotDerivationEnabled!==void 0?{assessment:{enableSwotDerivation:e.swotDerivationEnabled}}:{},"directory-sync":{git:{repo:xB(e,t),authToken:"${GIT_SYNC_TOKEN}"}},...e.atproto?{atproto:{...e.atproto,appPassword:"${ATPROTO_APP_PASSWORD}"}}:{}};return zc({brain:"brain",bundleContract:e.bundleContract,kind:e.profileKind??"professional",domain:e.domain,bundles:e.bundles,...e.anchorKind?{anchor:e.anchorKind}:{},...e.embeddingEnabled!==void 0?{embedding:{enabled:e.embeddingEnabled}}:{},...e.embeddingModel?{embeddingModel:e.embeddingModel}:{},...e.add.length>0?{add:e.add}:{},...e.remove.length>0?{remove:e.remove}:{},...e.siteOverride?{site:{package:e.siteOverride.package,...e.siteOverride.theme?{theme:e.siteOverride.theme}:{}}}:{},...e.spaces&&e.spaces.length>0?{spaces:e.spaces}:{},anchors:e.discordEnabled&&e.discordAnchorUserId?[`discord:${e.discordAnchorUserId}`]:[],plugins:rk(r,e.plugins??{},{nulls:"preserve"})})}function xB(e,t){return hB(e.contentRepo,t)}function Xee(e){return[{path:"anchor-profile/anchor-profile.md",content:ete(e)}]}function ete(e){let t={name:e.anchorProfile.name,...e.anchorProfile.description?{description:e.anchorProfile.description}:{},...e.anchorProfile.website?{website:e.anchorProfile.website}:{},...e.anchorProfile.email?{email:e.anchorProfile.email}:{},...e.anchorProfile.socialLinks?{socialLinks:e.anchorProfile.socialLinks}:{}},r=e.anchorProfile.story??"This profile was initialized by brains-ops. Edit it in your content repo.";return`---
|
|
286
286
|
${zc(t).trimEnd()}
|
|
287
287
|
---
|
|
288
288
|
|
|
@@ -290,7 +290,7 @@ ${r}
|
|
|
290
290
|
`}function tte(e,t){let r=XA(e.siteOverride);return[`BRAIN_VERSION=${e.brainVersion}`,...r.length>0?[`IMAGE_TAG=${pg(e.brainVersion,r)}`]:[],`CONTENT_REPO=${xB(e,t)}`,""].join(`
|
|
291
291
|
`)}var nk=S(()=>{wB();ek();Vn()});import{mkdir as rte,writeFile as nte}from"fs/promises";import{dirname as ote,join as _B}from"path";import{isDeepStrictEqual as ite}from"util";async function Uc(e,t,r,o,n={}){let i=fg(t.pilot.githubOrg);for(let s of r){let a={};if(o){let m=await o(s);if(m!==void 0)a=m}let l=await i(s),u=a.brainYaml??l.brainYaml,d=a.envFile??l.envFile,p=a.contentRepoFiles??l.contentRepoFiles??[];if(d)await ok(e,s.handle,".env",d);if(u)await ok(e,s.handle,"brain.yaml",u);await SB(e,t.pilot.githubOrg,s,p,{contentRepoAdminTokenSelector:t.pilot.contentRepoAdminToken,...n});for(let m of p)await ok(e,s.handle,_B("content",m.path),m.content)}}async function ok(e,t,r,o){let n=_B(e,"users",t,r),i=Bun.file(n);if(r==="brain.yaml"&&await i.exists()){let s=yr(await i.text()),a=yr(o);if(s.ok&&a.ok&&ite(s.data,a.data))return}await rte(ote(n),{recursive:!0}),await nte(n,o)}async function mg(e,t){let r=await xt(e),o=r.users.find((n)=>n.handle===t);if(!o)throw Error(`Unknown user handle: ${t}`);return{registry:r,user:o}}async function EB(e,t){let r=await xt(e),o=r.cohorts.find((n)=>n.id===t);if(!o)throw Error(`Unknown cohort: ${t}`);return{registry:r,users:r.users.filter((n)=>n.cohort===o.id)}}async function IB(e){let t=await xt(e);return{registry:t,users:t.users}}var Ld=S(()=>{Vn();vB();nk();gn()});function CB(e){return Object.keys(e)}import{readFileSync as jd}from"fs";import{rm as wte,writeFile as DB}from"fs/promises";import{join as sk,relative as PB}from"path";async function ZB(e,t,r={}){let{registry:o,user:n}=await mg(e,t),i=r.env??process.env,s=r.logger??console.log,a=Lr(e),l=sk(e,"users",`${t}.secrets.yaml.age`),u=sk(e,"users",`${t}.secrets.yaml`),d=jc(PB(e,l)),p=jc(PB(e,u)),m=Ete(u),h=await Ite(l,e,i,a),b=await Ar(u),y={sharedOpenaiApiKeySelector:o.pilot.openaiApiKey,sharedGitSyncTokenSelector:o.pilot.gitSyncToken,effectiveOpenaiApiKeySelector:n.effectiveOpenaiApiKey,effectiveGitSyncTokenSelector:n.effectiveGitSyncToken,discordEnabled:n.discordEnabled},v;try{v=xte(e,i,a,m,h,y)}catch(z){if(!r.dryRun&&m===void 0&&z instanceof Error){let J=kte(y);if(J.length>0)throw await Rte(u,J),Error(`Missing required secrets for ${t}. Created ${p}; fill it in and rerun secrets:encrypt. ${z.message}`,{cause:z})}throw z}let x=`${zc(v).trimEnd()}
|
|
292
292
|
`;Ate(x,v);let _=CB(v);if(r.dryRun){if(s(`Dry run: would encrypt ${_.length} secrets to ${d}.`),s(_.length>0?`Keys: ${_.join(", ")}`:"Keys: (none \u2014 shared defaults only)"),b)s(`Would remove plaintext file ${p}.`);return{encryptedPath:d,plaintextPath:p,deletedPlaintext:b,encryptedKeys:_,dryRun:!0}}let k=new Ou;k.addRecipient(o.pilot.agePublicKey);let O=await k.encrypt(x),L=bi.encode(O);if(await DB(l,L),await wte(u,{force:!0}),s(`Encrypted ${_.length} secrets to ${d}.`),b)s(`Removed plaintext file ${p}.`);return{encryptedPath:d,plaintextPath:p,deletedPlaintext:b,encryptedKeys:_}}function xte(e,t,r,o,n,i){let s=zB(e,t,r,o,n,"openaiApiKey",i.effectiveOpenaiApiKeySelector,i.sharedOpenaiApiKeySelector),a=zB(e,t,r,o,n,"gitSyncToken",i.effectiveGitSyncTokenSelector,i.sharedGitSyncTokenSelector),l=i.discordEnabled?gg(e,t,r,o,n,"discordBotToken","DISCORD_BOT_TOKEN"):void 0,u=i.discordEnabled?gg(e,t,r,o,n,"discordPublicKey","DISCORD_PUBLIC_KEY"):void 0,d=i.discordEnabled?gg(e,t,r,o,n,"discordApplicationId","DISCORD_APPLICATION_ID"):void 0,p=yg(e,t,r,o,n,"atprotoAppPassword","ATPROTO_APP_PASSWORD"),m=NB(yg(e,t,r,o,n,"certificatePem","CERTIFICATE_PEM")),h=NB(yg(e,t,r,o,n,"privateKeyPem","PRIVATE_KEY_PEM"));return LB.parse({...s?{openaiApiKey:s}:{},...a?{gitSyncToken:a}:{},...l?{discordBotToken:l}:{},...u?{discordPublicKey:u}:{},...d?{discordApplicationId:d}:{},...p?{atprotoAppPassword:p}:{},...m?{certificatePem:m}:{},...h?{privateKeyPem:h}:{}})}function zB(e,t,r,o,n,i,s,a){if(s===a)return;return gg(e,t,r,o,n,i,s)}function gg(e,t,r,o,n,i,s){let a=yg(e,t,r,o,n,i,s);if(a===void 0||a.trim().length===0)throw Error(`Missing required secret value for ${String(i)}. Set it in users/<handle>.secrets.yaml or fall back to ${s}/${s}_FILE before running secrets:encrypt.`);return a}function NB(e){return e?.replace(/\r\n?|\n/g,"\\n")}function yg(e,t,r,o,n,i,s){return _te(o,n,i,s,t,r,e)}function _te(e,t,r,o,n,i,s){let a=e?.[r];if(a!==void 0&&a.trim().length>0)return a;let l=jt(`${o}_FILE`,n,i);if(l&&l.trim().length>0)return jd(vi(l,s),"utf8");let u=jt(o,n,i);if(u!==void 0&&u.trim().length>0)return u;let d=t?.[r];if(d!==void 0&&d.trim().length>0)return d;return}function Ete(e){let t;try{t=jd(e,"utf8")}catch{return}try{return ck(t)}catch(r){throw Error(`Unable to parse plaintext secrets file ${e}: ${Ve(r)}`,{cause:r})}}async function Ite(e,t,r,o){if(!await Ar(e))return;let n=ak(t,r,o);if(!n)return;let i;try{let s=jd(e,"utf8"),a=bi.decode(s),l=new Cu;l.addIdentity(n),i=await l.decrypt(a,"text")}catch{return}try{return ck(i)}catch(s){throw Error(`Unable to parse decrypted secrets from ${e}: ${Ve(s)}`,{cause:s})}}function ak(e,t,r){let o=jt("AGE_SECRET_KEY_FILE",t,r);if(o&&o.trim().length>0)return zu(jd(vi(o,e),"utf8"));let n=jt("AGE_SECRET_KEY",t,r);if(n&&n.trim().length>0)return zu(n);try{return zu(jd(sk(e,".brains-ops","age","identity.txt"),"utf8"))}catch{return}}function ck(e){let t=fL(e),r={};if(t!==null&&typeof t==="object"&&!Array.isArray(t)){for(let[o,n]of Object.entries(t))if(typeof n==="string")r[o]=n}return LB.partial().parse(r)}function Ate(e,t){let r={...t},o={...ck(e)},n=new Set([...Object.keys(r),...Object.keys(o)]);for(let i of n)if(r[i]!==o[i])throw Error(`secrets:encrypt round-trip verification failed for ${i}; refusing to write a corrupted encrypted payload`)}function kte(e){return[...e.effectiveOpenaiApiKeySelector!==e.sharedOpenaiApiKeySelector?["openaiApiKey"]:[],...e.effectiveGitSyncTokenSelector!==e.sharedGitSyncTokenSelector?["gitSyncToken"]:[],...e.discordEnabled?["discordBotToken","discordPublicKey","discordApplicationId"]:[]]}async function Rte(e,t){let r=["# local per-user secret staging file","# fill values, run `bunx brains-ops secrets:encrypt . <handle>`, then the plaintext file will be removed",...t.map((o)=>`${o}: `),""].join(`
|
|
293
|
-
`);await DB(e,r,{flag:"wx"})}var LB;var lk=S(()=>{yi();wi();Vn();de();Nv();Ld();Ys();LB=c.strictObject({gitSyncToken:c.string().min(1).optional(),discordBotToken:c.string().min(1).optional(),discordPublicKey:c.string().min(1).optional(),discordApplicationId:c.string().min(1).optional(),openaiApiKey:c.string().min(1).optional(),atprotoAppPassword:c.string().min(1).optional(),certificatePem:c.string().min(1).optional(),privateKeyPem:c.string().min(1).optional()})});function FB(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}var bg=()=>{};var YB={};Lt(YB,{upgradePilotRepo:()=>lre});import{readFile as ire}from"fs/promises";import{join as sre}from"path";async function QB(e){let t=sre(e,"package.json"),o=are.parse(JSON.parse(await ire(t,"utf8"))).devDependencies?.["@rizom/ops"];if(!o)throw Error(`${t} does not pin @rizom/ops as a devDependency`);return o}async function cre(e,t){let o=await Bun.spawn(e,{cwd:t,stdout:"inherit",stderr:"inherit"}).exited;if(o!==0)throw Error(`${e.join(" ")} failed with exit ${o}`)}async function lre(e,t={}){let r=t.exec??cre,o=await QB(e),n=t.version??"latest";await r(["bun","add","--dev","--exact",`@rizom/ops@${n}`],e);let i=await QB(e);return await r(["bun","x","brains-ops","init","."],e),{from:o,to:i}}var are;var XB=S(()=>{de();are=c.object({devDependencies:c.record(c.string(),c.string()).optional()})});var qe=ge(function(yre){var pk=Symbol.for("yaml.alias"),eU=Symbol.for("yaml.document"),vg=Symbol.for("yaml.map"),tU=Symbol.for("yaml.pair"),fk=Symbol.for("yaml.scalar"),wg=Symbol.for("yaml.seq")
|
|
293
|
+
`);await DB(e,r,{flag:"wx"})}var LB;var lk=S(()=>{yi();wi();Vn();de();Nv();Ld();Ys();LB=c.strictObject({gitSyncToken:c.string().min(1).optional(),discordBotToken:c.string().min(1).optional(),discordPublicKey:c.string().min(1).optional(),discordApplicationId:c.string().min(1).optional(),openaiApiKey:c.string().min(1).optional(),atprotoAppPassword:c.string().min(1).optional(),certificatePem:c.string().min(1).optional(),privateKeyPem:c.string().min(1).optional()})});function FB(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}var bg=()=>{};var YB={};Lt(YB,{upgradePilotRepo:()=>lre});import{readFile as ire}from"fs/promises";import{join as sre}from"path";async function QB(e){let t=sre(e,"package.json"),o=are.parse(JSON.parse(await ire(t,"utf8"))).devDependencies?.["@rizom/ops"];if(!o)throw Error(`${t} does not pin @rizom/ops as a devDependency`);return o}async function cre(e,t){let o=await Bun.spawn(e,{cwd:t,stdout:"inherit",stderr:"inherit"}).exited;if(o!==0)throw Error(`${e.join(" ")} failed with exit ${o}`)}async function lre(e,t={}){let r=t.exec??cre,o=await QB(e),n=t.version??"latest";await r(["bun","add","--dev","--exact",`@rizom/ops@${n}`],e);let i=await QB(e);return await r(["bun","x","brains-ops","init","."],e),{from:o,to:i}}var are;var XB=S(()=>{de();are=c.object({devDependencies:c.record(c.string(),c.string()).optional()})});var qe=ge(function(yre){var pk=Symbol.for("yaml.alias"),eU=Symbol.for("yaml.document"),vg=Symbol.for("yaml.map"),tU=Symbol.for("yaml.pair"),fk=Symbol.for("yaml.scalar"),wg=Symbol.for("yaml.seq"),Oo=Symbol.for("yaml.node.type"),ure=(e)=>!!e&&typeof e==="object"&&e[Oo]===pk,dre=(e)=>!!e&&typeof e==="object"&&e[Oo]===eU,pre=(e)=>!!e&&typeof e==="object"&&e[Oo]===vg,fre=(e)=>!!e&&typeof e==="object"&&e[Oo]===tU,rU=(e)=>!!e&&typeof e==="object"&&e[Oo]===fk,mre=(e)=>!!e&&typeof e==="object"&&e[Oo]===wg;function nU(e){if(e&&typeof e==="object")switch(e[Oo]){case vg:case wg:return!0}return!1}function hre(e){if(e&&typeof e==="object")switch(e[Oo]){case pk:case vg:case fk:case wg:return!0}return!1}var gre=(e)=>(rU(e)||nU(e))&&!!e.anchor;yre.ALIAS=pk;yre.DOC=eU;yre.MAP=vg;yre.NODE_TYPE=Oo;yre.PAIR=tU;yre.SCALAR=fk;yre.SEQ=wg;yre.hasAnchor=gre;yre.isAlias=ure;yre.isCollection=nU;yre.isDocument=dre;yre.isMap=pre;yre.isNode=hre;yre.isPair=fre;yre.isScalar=rU;yre.isSeq=mre});var Bd=ge(function(zre){var Pt=qe(),kr=Symbol("break visit"),oU=Symbol("skip children"),Yn=Symbol("remove node");function xg(e,t){let r=iU(t);if(Pt.isDocument(e)){if(qc(null,e.contents,r,Object.freeze([e]))===Yn)e.contents=null}else qc(null,e,r,Object.freeze([]))}xg.BREAK=kr;xg.SKIP=oU;xg.REMOVE=Yn;function qc(e,t,r,o){let n=sU(e,t,r,o);if(Pt.isNode(n)||Pt.isPair(n))return aU(e,o,n),qc(e,n,r,o);if(typeof n!=="symbol"){if(Pt.isCollection(t)){o=Object.freeze(o.concat(t));for(let i=0;i<t.items.length;++i){let s=qc(i,t.items[i],r,o);if(typeof s==="number")i=s-1;else if(s===kr)return kr;else if(s===Yn)t.items.splice(i,1),i-=1}}else if(Pt.isPair(t)){o=Object.freeze(o.concat(t));let i=qc("key",t.key,r,o);if(i===kr)return kr;else if(i===Yn)t.key=null;let s=qc("value",t.value,r,o);if(s===kr)return kr;else if(s===Yn)t.value=null}}return n}async function _g(e,t){let r=iU(t);if(Pt.isDocument(e)){if(await Fc(null,e.contents,r,Object.freeze([e]))===Yn)e.contents=null}else await Fc(null,e,r,Object.freeze([]))}_g.BREAK=kr;_g.SKIP=oU;_g.REMOVE=Yn;async function Fc(e,t,r,o){let n=await sU(e,t,r,o);if(Pt.isNode(n)||Pt.isPair(n))return aU(e,o,n),Fc(e,n,r,o);if(typeof n!=="symbol"){if(Pt.isCollection(t)){o=Object.freeze(o.concat(t));for(let i=0;i<t.items.length;++i){let s=await Fc(i,t.items[i],r,o);if(typeof s==="number")i=s-1;else if(s===kr)return kr;else if(s===Yn)t.items.splice(i,1),i-=1}}else if(Pt.isPair(t)){o=Object.freeze(o.concat(t));let i=await Fc("key",t.key,r,o);if(i===kr)return kr;else if(i===Yn)t.key=null;let s=await Fc("value",t.value,r,o);if(s===kr)return kr;else if(s===Yn)t.value=null}}return n}function iU(e){if(typeof e==="object"&&(e.Collection||e.Node||e.Value))return 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);return e}function sU(e,t,r,o){if(typeof r==="function")return r(e,t,o);if(Pt.isMap(t))return r.Map?.(e,t,o);if(Pt.isSeq(t))return r.Seq?.(e,t,o);if(Pt.isPair(t))return r.Pair?.(e,t,o);if(Pt.isScalar(t))return r.Scalar?.(e,t,o);if(Pt.isAlias(t))return r.Alias?.(e,t,o);return}function aU(e,t,r){let o=t[t.length-1];if(Pt.isCollection(o))o.items[e]=r;else if(Pt.isPair(o))if(e==="key")o.key=r;else o.value=r;else if(Pt.isDocument(o))o.contents=r;else{let n=Pt.isAlias(o)?"alias":"scalar";throw Error(`Cannot replace node with ${n} parent`)}}zre.visit=xg;zre.visitAsync=_g});var mk=ge(function(Bre){var cU=qe(),Lre=Bd(),Zre={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},jre=(e)=>e.replace(/[!,[\]{}]/g,(t)=>Zre[t]);class Xr{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Xr.defaultYaml,e),this.tags=Object.assign({},Xr.defaultTags,t)}clone(){let e=new Xr(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Xr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Xr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Xr.defaultTags);break}return e}add(e,t){if(this.atNextDocument)this.yaml={explicit:Xr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Xr.defaultTags),this.atNextDocument=!1;let r=e.trim().split(/[ \t]+/),o=r.shift();switch(o){case"%TAG":{if(r.length!==2){if(t(0,"%TAG directive should contain exactly two parts"),r.length<2)return!1}let[n,i]=r;return this.tags[n]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[n]=r;if(n==="1.1"||n==="1.2")return this.yaml.version=n,!0;else{let i=/^\d+\.\d+$/.test(n);return t(6,`Unsupported YAML version ${n}`,i),!1}}default:return t(0,`Unknown directive ${o}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let i=e.slice(2,-1);if(i==="!"||i==="!!")return t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null;if(e[e.length-1]!==">")t("Verbatim tags must end with a >");return i}let[,r,o]=e.match(/^(.*!)([^!]*)$/s);if(!o)t(`The ${e} tag has no suffix`);let n=this.tags[r];if(n)try{return n+decodeURIComponent(o)}catch(i){return t(String(i)),null}if(r==="!")return e;return t(`Could not resolve tag: ${e}`),null}tagString(e){for(let[t,r]of Object.entries(this.tags))if(e.startsWith(r))return t+jre(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),o;if(e&&r.length>0&&cU.isNode(e.contents)){let n={};Lre.visit(e.contents,(i,s)=>{if(cU.isNode(s)&&s.tag)n[s.tag]=!0}),o=Object.keys(n)}else o=[];for(let[n,i]of r){if(n==="!!"&&i==="tag:yaml.org,2002:")continue;if(!e||o.some((s)=>s.startsWith(i)))t.push(`%TAG ${n} ${i}`)}return t.join(`
|
|
294
294
|
`)}}Xr.defaultYaml={explicit:!1,version:"1.2"};Xr.defaultTags={"!!":"tag:yaml.org,2002:"};Bre.Directives=Xr});var Eg=ge(function(Hre){var lU=qe(),Mre=Bd();function qre(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(r)}return!0}function uU(e){let t=new Set;return Mre.visit(e,{Value(r,o){if(o.anchor)t.add(o.anchor)}}),t}function dU(e,t){for(let r=1;;++r){let o=`${e}${r}`;if(!t.has(o))return o}}function Fre(e,t){let r=[],o=new Map,n=null;return{onAnchor:(i)=>{r.push(i),n??(n=uU(e));let s=dU(t,n);return n.add(s),s},setAnchors:()=>{for(let i of r){let s=o.get(i);if(typeof s==="object"&&s.anchor&&(lU.isScalar(s.node)||lU.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:o}}Hre.anchorIsValid=qre;Hre.anchorNames=uU;Hre.createNodeAnchors=Fre;Hre.findNewAnchor=dU});var hk=ge(function(Gre){function Ud(e,t,r,o){if(o&&typeof o==="object")if(Array.isArray(o))for(let n=0,i=o.length;n<i;++n){let s=o[n],a=Ud(e,o,String(n),s);if(a===void 0)delete o[n];else if(a!==s)o[n]=a}else if(o instanceof Map)for(let n of Array.from(o.keys())){let i=o.get(n),s=Ud(e,o,n,i);if(s===void 0)o.delete(n);else if(s!==i)o.set(n,s)}else if(o instanceof Set)for(let n of Array.from(o)){let i=Ud(e,o,n,n);if(i===void 0)o.delete(n);else if(i!==n)o.delete(n),o.add(i)}else for(let[n,i]of Object.entries(o)){let s=Ud(e,o,n,i);if(s===void 0)delete o[n];else if(s!==i)o[n]=s}return e.call(t,r,o)}Gre.applyReviver=Ud});var zi=ge(function(Xre){var Yre=qe();function pU(e,t,r){if(Array.isArray(e))return e.map((o,n)=>pU(o,String(n),r));if(e&&typeof e.toJSON==="function"){if(!r||!Yre.hasAnchor(e))return e.toJSON(t,r);let o={aliasCount:0,count:1,res:void 0};r.anchors.set(e,o),r.onCreate=(i)=>{o.res=i,delete r.onCreate};let n=e.toJSON(t,r);if(r.onCreate)r.onCreate(n);return n}if(typeof e==="bigint"&&!r?.keep)return Number(e);return e}Xre.toJS=pU});var Ig=ge(function(nne){var tne=hk(),fU=qe(),rne=zi();class mU{constructor(e){Object.defineProperty(this,fU.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)e.range=this.range.slice();return e}toJS(e,{mapAsMap:t,maxAliasCount:r,onAnchor:o,reviver:n}={}){if(!fU.isDocument(e))throw TypeError("A document argument is required");let i={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof r==="number"?r:100},s=rne.toJS(this,"",i);if(typeof o==="function")for(let{count:a,res:l}of i.anchors.values())o(l,a);return typeof n==="function"?tne.applyReviver(n,{"":s},"",s):s}}nne.NodeBase=mU});var Md=ge(function(lne){var ine=Eg(),sne=Bd(),Hc=qe(),ane=Ig(),cne=zi();class hU extends ane.NodeBase{constructor(e){super(Hc.ALIAS);this.source=e,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let r;if(t?.aliasResolveCache)r=t.aliasResolveCache;else if(r=[],sne.visit(e,{Node:(n,i)=>{if(Hc.isAlias(i)||Hc.hasAnchor(i))r.push(i)}}),t)t.aliasResolveCache=r;let o=void 0;for(let n of r){if(n===this)break;if(n.anchor===this.source)o=n}return o}toJSON(e,t){if(!t)return{source:this.source};let{anchors:r,doc:o,maxAliasCount:n}=t,i=this.resolve(o,t);if(!i){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(a)}let s=r.get(i);if(!s)cne.toJS(i,null,t),s=r.get(i);if(s?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(n>=0){if(s.count+=1,s.aliasCount===0)s.aliasCount=Ag(o,i,r);if(s.count*s.aliasCount>n)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return s.res}toString(e,t,r){let o=`*${this.source}`;if(e){if(ine.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let n=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(n)}if(e.implicitKey)return`${o} `}return o}}function Ag(e,t,r){if(Hc.isAlias(t)){let o=t.resolve(e),n=r&&o&&r.get(o);return n?n.count*n.aliasCount:0}else if(Hc.isCollection(t)){let o=0;for(let n of t.items){let i=Ag(e,n,r);if(i>o)o=i}return o}else if(Hc.isPair(t)){let o=Ag(e,t.key,r),n=Ag(e,t.value,r);return Math.max(o,n)}return 1}lne.Alias=hU});var At=ge(function(hne){var dne=qe(),pne=Ig(),fne=zi(),mne=(e)=>!e||typeof e!=="function"&&typeof e!=="object";class ea extends pne.NodeBase{constructor(e){super(dne.SCALAR);this.value=e}toJSON(e,t){return t?.keep?this.value:fne.toJS(this.value,e,t)}toString(){return String(this.value)}}ea.BLOCK_FOLDED="BLOCK_FOLDED";ea.BLOCK_LITERAL="BLOCK_LITERAL";ea.PLAIN="PLAIN";ea.QUOTE_DOUBLE="QUOTE_DOUBLE";ea.QUOTE_SINGLE="QUOTE_SINGLE";hne.Scalar=ea;hne.isScalarValue=mne});var qd=ge(function(xne){var bne=Md(),ta=qe(),gU=At(),Sne="tag:yaml.org,2002:";function vne(e,t,r){if(t){let o=r.filter((i)=>i.tag===t),n=o.find((i)=>!i.format)??o[0];if(!n)throw Error(`Tag ${t} not found`);return n}return r.find((o)=>o.identify?.(e)&&!o.format)}function wne(e,t,r){if(ta.isDocument(e))e=e.contents;if(ta.isNode(e))return e;if(ta.isPair(e)){let p=r.schema[ta.MAP].createNode?.(r.schema,null,r);return p.items.push(e),p}if(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)e=e.valueOf();let{aliasDuplicateObjects:o,onAnchor:n,onTagObj:i,schema:s,sourceObjects:a}=r,l=void 0;if(o&&e&&typeof e==="object")if(l=a.get(e),l)return l.anchor??(l.anchor=n(e)),new bne.Alias(l.anchor);else l={anchor:null,node:null},a.set(e,l);if(t?.startsWith("!!"))t=Sne+t.slice(2);let u=vne(e,t,s.tags);if(!u){if(e&&typeof e.toJSON==="function")e=e.toJSON();if(!e||typeof e!=="object"){let p=new gU.Scalar(e);if(l)l.node=p;return p}u=e instanceof Map?s[ta.MAP]:(Symbol.iterator in Object(e))?s[ta.SEQ]:s[ta.MAP]}if(i)i(u),delete r.onTagObj;let d=u?.createNode?u.createNode(r.schema,e,r):typeof u?.nodeClass?.from==="function"?u.nodeClass.from(r.schema,e,r):new gU.Scalar(e);if(t)d.tag=t;else if(!u.default)d.tag=u.tag;if(l)l.node=d;return d}xne.createNode=wne});var kg=ge(function(Ane){var Ene=qd(),Xn=qe(),Ine=Ig();function gk(e,t,r){let o=r;for(let n=t.length-1;n>=0;--n){let i=t[n];if(typeof i==="number"&&Number.isInteger(i)&&i>=0){let s=[];s[i]=o,o=s}else o=new Map([[i,o]])}return Ene.createNode(o,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var yU=(e)=>e==null||typeof e==="object"&&!!e[Symbol.iterator]().next().done;class bU extends Ine.NodeBase{constructor(e,t){super(e);Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(e)t.schema=e;if(t.items=t.items.map((r)=>Xn.isNode(r)||Xn.isPair(r)?r.clone(e):r),this.range)t.range=this.range.slice();return t}addIn(e,t){if(yU(e))this.add(t);else{let[r,...o]=e,n=this.get(r,!0);if(Xn.isCollection(n))n.addIn(o,t);else if(n===void 0&&this.schema)this.set(r,gk(this.schema,o,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let o=this.get(t,!0);if(Xn.isCollection(o))return o.deleteIn(r);else throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...o]=e,n=this.get(r,!0);if(o.length===0)return!t&&Xn.isScalar(n)?n.value:n;else return Xn.isCollection(n)?n.getIn(o,t):void 0}hasAllNullValues(e){return this.items.every((t)=>{if(!Xn.isPair(t))return!1;let r=t.value;return r==null||e&&Xn.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let o=this.get(t,!0);return Xn.isCollection(o)?o.hasIn(r):!1}setIn(e,t){let[r,...o]=e;if(o.length===0)this.set(r,t);else{let n=this.get(r,!0);if(Xn.isCollection(n))n.setIn(o,t);else if(n===void 0&&this.schema)this.set(r,gk(this.schema,o,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}}Ane.Collection=bU;Ane.collectionFromPath=gk;Ane.isEmptyPath=yU});var Fd=ge(function(Cne){var $ne=(e)=>e.replace(/^(?!$)(?: $)?/gm,"#");function yk(e,t){if(/^\n+$/.test(e))return e.substring(1);return t?e.replace(/^(?! *$)/gm,t):e}var One=(e,t,r)=>e.endsWith(`
|
|
295
295
|
`)?yk(r,t):r.includes(`
|
|
296
296
|
`)?`
|
|
@@ -323,14 +323,14 @@ ${u}${_}${r}${h}`}function qne(e,t,r,o){let{type:n,value:i}=e,{actualString:s,im
|
|
|
323
323
|
`)?Jc(i,t):Rg(e,t,r,o);if(!a&&!d&&n!==bn.Scalar.PLAIN&&i.includes(`
|
|
324
324
|
`))return Rg(e,t,r,o);if($g(i)){if(l==="")return t.forceBlockIndent=!0,Rg(e,t,r,o);else if(a&&l===u)return Jc(i,t)}let p=i.replace(/\n+/g,`$&
|
|
325
325
|
${l}`);if(s){let m=(y)=>y.default&&y.tag!=="tag:yaml.org,2002:str"&&y.test?.test(p),{compat:h,tags:b}=t.doc.schema;if(b.some(m)||h?.some(m))return Jc(i,t)}return a?p:Ni.foldFlowLines(p,l,Ni.FOLD_FLOW,Tg(t,!1))}function Fne(e,t,r,o){let{implicitKey:n,inFlow:i}=t,s=typeof e.value==="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;if(a!==bn.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value))a=bn.Scalar.QUOTE_DOUBLE}let l=(d)=>{switch(d){case bn.Scalar.BLOCK_FOLDED:case bn.Scalar.BLOCK_LITERAL:return n||i?Jc(s.value,t):Rg(s,t,r,o);case bn.Scalar.QUOTE_DOUBLE:return Hd(s.value,t);case bn.Scalar.QUOTE_SINGLE:return bk(s.value,t);case bn.Scalar.PLAIN:return qne(s,t,r,o);default:return null}},u=l(a);if(u===null){let{defaultKeyType:d,defaultStringType:p}=t.options,m=n&&d||p;if(u=l(m),u===null)throw Error(`Unsupported default string type ${m}`)}return u}Hne.stringifyString=Fne});var Kd=ge(function(eoe){var Kne=Eg(),Di=qe(),Vne=Fd(),Wne=Jd();function Gne(e,t){let r=Object.assign({blockQuote:!0,commentString:Vne.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),o;switch(r.collectionStyle){case"block":o=!1;break;case"flow":o=!0;break;default:o=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent==="number"?" ".repeat(r.indent):" ",inFlow:o,options:r}}function Qne(e,t){if(t.tag){let n=e.filter((i)=>i.tag===t.tag);if(n.length>0)return n.find((i)=>i.format===t.format)??n[0]}let r=void 0,o;if(Di.isScalar(t)){o=t.value;let n=e.filter((i)=>i.identify?.(o));if(n.length>1){let i=n.filter((s)=>s.test);if(i.length>0)n=i}r=n.find((i)=>i.format===t.format)??n.find((i)=>!i.format)}else o=t,r=e.find((n)=>n.nodeClass&&o instanceof n.nodeClass);if(!r){let n=o?.constructor?.name??(o===null?"null":typeof o);throw Error(`Tag not resolved for ${n} value`)}return r}function Yne(e,t,{anchors:r,doc:o}){if(!o.directives)return"";let n=[],i=(Di.isScalar(e)||Di.isCollection(e))&&e.anchor;if(i&&Kne.anchorIsValid(i))r.add(i),n.push(`&${i}`);let s=e.tag??(t.default?null:t.tag);if(s)n.push(o.directives.tagString(s));return n.join(" ")}function Xne(e,t,r,o){if(Di.isPair(e))return e.toString(t,r,o);if(Di.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(t.resolvedAliases)t.resolvedAliases.add(e);else t.resolvedAliases=new Set([e]);e=e.resolve(t.doc)}}let n=void 0,i=Di.isNode(e)?e:t.doc.createNode(e,{onTagObj:(l)=>n=l});n??(n=Qne(t.doc.schema.tags,i));let s=Yne(i,n,t);if(s.length>0)t.indentAtStart=(t.indentAtStart??0)+s.length+1;let a=typeof n.stringify==="function"?n.stringify(i,t,r,o):Di.isScalar(i)?Wne.stringifyString(i,t,r,o):i.toString(t,r,o);if(!s)return a;return Di.isScalar(i)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
326
|
-
${t.indent}${a}`}eoe.createStringifyContext=Gne;eoe.stringify=Xne});var _U=ge(function(ooe){var
|
|
327
|
-
${a}:`}else if(v=`${v}:`,m)v+=Vd.lineComment(v,r.indent,u(m));let x,_,k;if(
|
|
326
|
+
${t.indent}${a}`}eoe.createStringifyContext=Gne;eoe.stringify=Xne});var _U=ge(function(ooe){var Co=qe(),wU=At(),xU=Kd(),Vd=Fd();function noe({key:e,value:t},r,o,n){let{allNullValues:i,doc:s,indent:a,indentStep:l,options:{commentString:u,indentSeq:d,simpleKeys:p}}=r,m=Co.isNode(e)&&e.comment||null;if(p){if(m)throw Error("With simple keys, key nodes cannot have comments");if(Co.isCollection(e)||!Co.isNode(e)&&typeof e==="object")throw Error("With simple keys, collection cannot be used as a key value")}let h=!p&&(!e||m&&t==null&&!r.inFlow||Co.isCollection(e)||(Co.isScalar(e)?e.type===wU.Scalar.BLOCK_FOLDED||e.type===wU.Scalar.BLOCK_LITERAL:typeof e==="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!h&&(p||!i),indent:a+l});let b=!1,y=!1,v=xU.stringify(e,r,()=>b=!0,()=>y=!0);if(!h&&!r.inFlow&&v.length>1024){if(p)throw Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(r.inFlow){if(i||t==null){if(b&&o)o();return v===""?"?":h?`? ${v}`:v}}else if(i&&!p||t==null&&h){if(v=`? ${v}`,m&&!b)v+=Vd.lineComment(v,r.indent,u(m));else if(y&&n)n();return v}if(b)m=null;if(h){if(m)v+=Vd.lineComment(v,r.indent,u(m));v=`? ${v}
|
|
327
|
+
${a}:`}else if(v=`${v}:`,m)v+=Vd.lineComment(v,r.indent,u(m));let x,_,k;if(Co.isNode(t))x=!!t.spaceBefore,_=t.commentBefore,k=t.comment;else if(x=!1,_=null,k=null,t&&typeof t==="object")t=s.createNode(t);if(r.implicitKey=!1,!h&&!m&&Co.isScalar(t))r.indentAtStart=v.length+1;if(y=!1,!d&&l.length>=2&&!r.inFlow&&!h&&Co.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor)r.indent=r.indent.substring(2);let O=!1,L=xU.stringify(t,r,()=>O=!0,()=>y=!0),z=" ";if(m||x||_){if(z=x?`
|
|
328
328
|
`:"",_){let J=u(_);z+=`
|
|
329
329
|
${Vd.indentComment(J,r.indent)}`}if(L===""&&!r.inFlow){if(z===`
|
|
330
330
|
`&&k)z=`
|
|
331
331
|
|
|
332
332
|
`}else z+=`
|
|
333
|
-
${r.indent}`}else if(!h&&
|
|
333
|
+
${r.indent}`}else if(!h&&Co.isCollection(t)){let J=L[0],P=L.indexOf(`
|
|
334
334
|
`),W=P!==-1,ee=r.inFlow??t.flow??t.items.length===0;if(W||!ee){let j=!1;if(W&&(J==="&"||J==="!")){let T=L.indexOf(" ");if(J==="&"&&T!==-1&&T<P&&L[T+1]==="!")T=L.indexOf(" ",T+1);if(T===-1||P<T)j=!0}if(!j)z=`
|
|
335
335
|
${r.indent}`}}else if(L===""||L[0]===`
|
|
336
336
|
`)z="";if(v+=z+L,r.inFlow){if(O&&o)o()}else if(k&&!O)v+=Vd.lineComment(v,r.indent,u(k));else if(y&&n)n();return v}ooe.stringifyPair=noe});var vk=ge(function(coe){var EU=Fr("process");function soe(e,...t){if(e==="debug")console.log(...t)}function aoe(e,t){if(e==="debug"||e==="warn")if(typeof EU.emitWarning==="function")EU.emitWarning(t);else console.warn(t)}coe.debug=soe;coe.warn=aoe});var zg=ge(function(poe){var Pg=qe(),IU=At(),Og="<<",Cg={identify:(e)=>e===Og||typeof e==="symbol"&&e.description===Og,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new IU.Scalar(Symbol(Og)),{addToJSMap:AU}),stringify:()=>Og},doe=(e,t)=>(Cg.identify(t)||Pg.isScalar(t)&&(!t.type||t.type===IU.Scalar.PLAIN)&&Cg.identify(t.value))&&e?.doc.schema.tags.some((r)=>r.tag===Cg.tag&&r.default);function AU(e,t,r){let o=kU(e,r);if(Pg.isSeq(o))for(let n of o.items)wk(e,t,n);else if(Array.isArray(o))for(let n of o)wk(e,t,n);else wk(e,t,o)}function wk(e,t,r){let o=kU(e,r);if(!Pg.isMap(o))throw Error("Merge sources must be maps or map aliases");let n=o.toJSON(null,e,Map);for(let[i,s]of n)if(t instanceof Map){if(!t.has(i))t.set(i,s)}else if(t instanceof Set)t.add(i);else if(!Object.prototype.hasOwnProperty.call(t,i))Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function kU(e,t){return e&&Pg.isAlias(t)?t.resolve(e.doc,e):t}poe.addMergeToJSMap=AU;poe.isMergeKey=doe;poe.merge=Cg});var _k=ge(function(voe){var goe=vk(),RU=zg(),yoe=Kd(),TU=qe(),xk=zi();function boe(e,t,{key:r,value:o}){if(TU.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(RU.isMergeKey(e,r))RU.addMergeToJSMap(e,t,o);else{let n=xk.toJS(r,"",e);if(t instanceof Map)t.set(n,xk.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=Soe(r,n,e),s=xk.toJS(o,i,e);if(i in t)Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0});else t[i]=s}}return t}function Soe(e,t,r){if(t===null)return"";if(typeof t!=="object")return String(t);if(TU.isNode(e)&&r?.doc){let o=yoe.createStringifyContext(r.doc,{});o.anchors=new Set;for(let i of r.anchors.keys())o.anchors.add(i.anchor);o.inFlow=!0,o.inStringifyKey=!0;let n=e.toString(o);if(!r.mapKeyWarned){let i=JSON.stringify(n);if(i.length>40)i=i.substring(0,36)+'..."';goe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return n}return JSON.stringify(t)}voe.addPairToJSMap=boe});var Li=ge(function(Ioe){var $U=qd(),xoe=_U(),_oe=_k(),Ng=qe();function Eoe(e,t,r){let o=$U.createNode(e,void 0,r),n=$U.createNode(t,void 0,r);return new Dg(o,n)}class Dg{constructor(e,t=null){Object.defineProperty(this,Ng.NODE_TYPE,{value:Ng.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:r}=this;if(Ng.isNode(t))t=t.clone(e);if(Ng.isNode(r))r=r.clone(e);return new Dg(t,r)}toJSON(e,t){let r=t?.mapAsMap?new Map:{};return _oe.addPairToJSMap(t,r,this)}toString(e,t,r){return e?.doc?xoe.stringifyPair(this,e,t,r):JSON.stringify(this)}}Ioe.Pair=Dg;Ioe.createPair=Eoe});var Ek=ge(function(Ooe){var ra=qe(),OU=Kd(),Lg=Fd();function Roe(e,t,r){return(t.inFlow??e.flow?$oe:Toe)(e,t,r)}function Toe({comment:e,items:t},r,{blockItemPrefix:o,flowChars:n,itemIndent:i,onChompKeep:s,onComment:a}){let{indent:l,options:{commentString:u}}=r,d=Object.assign({},r,{indent:i,type:null}),p=!1,m=[];for(let b=0;b<t.length;++b){let y=t[b],v=null;if(ra.isNode(y)){if(!p&&y.spaceBefore)m.push("");if(Zg(r,m,y.commentBefore,p),y.comment)v=y.comment}else if(ra.isPair(y)){let _=ra.isNode(y.key)?y.key:null;if(_){if(!p&&_.spaceBefore)m.push("");Zg(r,m,_.commentBefore,p)}}p=!1;let x=OU.stringify(y,d,()=>v=null,()=>p=!0);if(v)x+=Lg.lineComment(x,i,u(v));if(p&&v)p=!1;m.push(o+x)}let h;if(m.length===0)h=n.start+n.end;else{h=m[0];for(let b=1;b<m.length;++b){let y=m[b];h+=y?`
|
|
@@ -428,8 +428,8 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
428
428
|
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
429
429
|
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){ay(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,o=r&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",n=[];if(o&&t.sep&&!t.value){let i=[];for(let s=0;s<t.sep.length;++s){let a=t.sep[s];switch(a.type){case"newline":i.push(s);break;case"space":break;case"comment":if(a.indent>e.indent)i.length=0;break;default:i.length=0}}if(i.length>=2)n=t.sep.splice(i[1])}switch(this.type){case"anchor":case"tag":if(o||t.value)n.push(this.sourceToken),e.items.push({start:n}),this.onKeyLine=!0;else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"explicit-key-ind":if(!t.sep&&!t.explicitKey)t.start.push(this.sourceToken),t.explicitKey=!0;else if(o||t.value)n.push(this.sourceToken),e.items.push({start:n,explicitKey:!0});else 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(t.explicitKey)if(!t.sep)if(Ui(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let i=Xc(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ui(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]});else if(tM(t.key)&&!Ui(t.sep,"newline")){let i=Xc(t.start),s=t.key,a=t.sep;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:s,sep:a}]})}else if(n.length>0)t.sep=t.sep.concat(n,this.sourceToken);else t.sep.push(this.sourceToken);else if(!t.sep)Object.assign(t,{key:null,sep:[this.sourceToken]});else if(t.value||o)e.items.push({start:n,key:null,sep:[this.sourceToken]});else if(Ui(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else t.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);if(o||t.value)e.items.push({start:n,key:i,sep:[]}),this.onKeyLine=!0;else if(t.sep)this.stack.push(i);else Object.assign(t,{key:i,sep:[]}),this.onKeyLine=!0;return}default:{let i=this.startBlockValue(e);if(i){if(i.type==="block-seq"){if(!t.explicitKey&&t.sep&&!Ui(t.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 if(r)e.items.push({start:n});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let r="end"in t.value?t.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){ay(o,t.start),o.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;if(t.value||Ui(t.start,"seq-item-ind"))e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!t||t.sep)e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return;case"map-value-ind":if(!t||t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!t||t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);if(!t||t.value)e.items.push({start:[],key:o,sep:[]});else if(t.sep)this.stack.push(o);else Object.assign(t,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);if(r)this.stack.push(r);else yield*this.pop(),yield*this.step()}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let o=sy(r),n=Xc(o);eM(e);let i=e.end.splice(1,e.end.length);i.push(this.sourceToken);let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
430
430
|
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
431
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){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 t=sy(e),r=Xc(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=sy(e),r=Xc(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((r)=>r.type==="newline"||r.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){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;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}aue.Parser=rM});var aM=ge(function(gue){var nM=uR(),lue=rp(),cp=np(),uue=vk(),due=qe(),pue=vR(),oM=wR();function iM(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new pue.LineCounter||null,prettyErrors:t}}function fue(e,t={}){let{lineCounter:r,prettyErrors:o}=iM(t),n=new oM.Parser(r?.addNewLine),i=new nM.Composer(t),s=Array.from(i.compose(n.parse(e)));if(o&&r)for(let a of s)a.errors.forEach(cp.prettifyError(e,r)),a.warnings.forEach(cp.prettifyError(e,r));if(s.length>0)return s;return Object.assign([],{empty:!0},i.streamInfo())}function sM(e,t={}){let{lineCounter:r,prettyErrors:o}=iM(t),n=new oM.Parser(r?.addNewLine),i=new nM.Composer(t),s=null;for(let a of i.compose(n.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new cp.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(o&&r)s.errors.forEach(cp.prettifyError(e,r)),s.warnings.forEach(cp.prettifyError(e,r));return s}function mue(e,t,r){let o=void 0;if(typeof t==="function")o=t;else if(r===void 0&&t&&typeof t==="object")r=t;let n=sM(e,r);if(!n)return null;if(n.warnings.forEach((i)=>uue.warn(n.options.logLevel,i)),n.errors.length>0)if(n.options.logLevel!=="silent")throw n.errors[0];else n.errors=[];return n.toJS(Object.assign({reviver:o},r))}function hue(e,t,r){let o=null;if(typeof t==="function"||Array.isArray(t))o=t;else if(r===void 0&&t)r=t;if(typeof r==="string")r=r.length;if(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}if(due.isDocument(e)&&!o)return e.toString(r);return new lue.Document(e,o,r).toString(r)}gue.parse=mue;gue.parseAllDocuments=fue;gue.parseDocument=sM;gue.stringify=hue});var wue,xue,_ue,xR,Eue,Mi,Iue,Aue,kue,Rue,$Pe,Tue,$ue,Oue,cy,cM,Cue,Pue,zue,Nue,Due,Lue,Zue,jue,Bue,Uue,vn,
|
|
432
|
-
`)}function bM(e,t,r,o){if(!vn(e.contents))throw Error("Desired-state YAML must contain a mapping");let n=e.contents.items.findIndex((s)=>Po(s.key)&&s.key.value===t),i=e.createPair(r,[...o]);if(n>=0){let s=e.contents.items[n];fM(s?.key,i.key),fM(s?.value,i.value),e.contents.items.splice(n,1,i)}else e.contents.add(i);return i}function SM(e){let t=yM(e),r=pde(t.toJS()),o=RR(t,"schemaVersion"),n=RR(t,"model");mM(o,RR(t,"brainVersion")?.key),t.delete("schemaVersion"),t.set("bundleContract",Gs);let i=bM(t,"preset","bundles",r.bundles);if(mM(n,i.key),t.delete("model"),r.add)t.set("add",r.add);else t.delete("add");if(r.remove)t.set("remove",r.remove);else t.delete("remove");return qi(t),Qs.parse(t.toJS()),t.toString({lineWidth:0})}function vM(e){let t=yM(e),r=fde(t.toJS());if(r.bundlesOverride)bM(t,"presetOverride","bundlesOverride",r.bundlesOverride);else t.delete("presetOverride"),t.delete("bundlesOverride");if(r.addOverride)t.set("addOverride",r.addOverride);else t.delete("addOverride");if(r.removeOverride)t.set("removeOverride",r.removeOverride);else t.delete("removeOverride");return qi(t),hn.parse(t.toJS()),t.toString({lineWidth:0})}var hM,lp,lde,ude,dde;var wM=S(()=>{py();Vn();de();el();To();hM=c.enum(["core","default","pro"]),lp=c.string().min(1),lde=c.strictObject({schemaVersion:c.literal(1),brainVersion:Ct,model:c.literal("rover"),githubOrg:c.string().min(1),contentRepoPrefix:c.string().min(1),domainSuffix:c.string().min(1),preset:hM,aiApiKey:lp,gitSyncToken:lp,contentRepoAdminToken:lp,agePublicKey:c.string().startsWith("age1").min(1)}),ude=c.strictObject({members:c.array(br).min(1),brainVersionOverride:Ct.optional(),presetOverride:hM.optional(),aiApiKeyOverride:lp.optional(),gitSyncTokenOverride:lp.optional()}).superRefine((e,t)=>{if(new Set(e.members).size!==e.members.length)t.addIssue({code:c.ZodIssueCode.custom,path:["members"],message:"cohort members must be unique"})}),dde=["series","portfolio","content-pipeline","social-media","newsletter","stock-photo"]});function _M(e,t){let r=tn(e,{keepSourceTokens:!0});if(r.errors.length>0||!vn(r.contents))throw Error(`Invalid ${t} YAML`);return r}function bde(e,t){return e.length===t.length&&e.every((r,o)=>r===t[o])}function EM(e,t,r){if(!bde(t,r.sourceBundles))throw Error(`${e} source bundles changed after review: expected [${r.sourceBundles.join(", ")}], received [${t.join(", ")}]`)}function IM(e){let t=yr(e,yde);if(!t.ok)throw Error(`Invalid capability bundle review: ${t.error}`);return t.data}function AM(e,t){let r=_M(e,"pilot desired-state"),o=hde.parse(r.toJS());return EM("pilot.yaml",o.bundles,t),r.set("bundleContract",Gs),r.set("bundles",t.targetBundles),qi(r),Qs.parse(r.toJS()),r.toString({lineWidth:0})}function kM(e,t,r){let o=_M(e,`cohort ${t}`),n=gde.parse(o.toJS());if(n.bundlesOverride===void 0){if(r!==void 0)throw Error(`Capability bundle review names inheriting cohort ${t}`)}else{if(r===void 0)throw Error(`Cohort ${t} has an explicit legacy bundle selection but no reviewed mapping`);EM(`cohort ${t}`,n.bundlesOverride,r),o.set("bundlesOverride",r.targetBundles)}return qi(o),hn.parse(o.toJS()),o.toString({lineWidth:0})}var mde,TR,fy,hde,gde,xM,yde;var RM=S(()=>{py();Vn();de();el();To();mde=c.enum(["core","site","publishing","team"]),TR=c.array(mde).min(1),fy=c.array(c.string().min(1)),hde=c.strictObject({brainVersion:Ct,bundles:TR,add:fy.optional(),remove:fy.optional(),githubOrg:c.string().min(1),contentRepoPrefix:c.string().min(1),domainSuffix:c.string().min(1),aiApiKey:c.string().min(1),gitSyncToken:c.string().min(1),contentRepoAdminToken:c.string().min(1),agePublicKey:c.string().startsWith("age1").min(1)}),gde=c.strictObject({members:c.array(br).min(1),brainVersionOverride:Ct.optional(),bundlesOverride:TR.optional(),addOverride:fy.optional(),removeOverride:fy.optional(),aiApiKeyOverride:c.string().min(1).optional(),gitSyncTokenOverride:c.string().min(1).optional()}),xM=c.strictObject({sourceBundles:TR,targetBundles:c.array(MA).min(1)}),yde=c.strictObject({bundleContract:c.literal(Gs),pilot:xM,cohorts:c.record(br,xM)})});var PM={};Lt(PM,{loadCapabilityBundleReview:()=>kde,loadReviewedSitePins:()=>Ade,parseReviewedSitePins:()=>CM,stageLegacyCrossover:()=>Tde});import{access as Sde,cp as vde,mkdir as TM,readFile as rl,readdir as OM,writeFile as tl}from"fs/promises";import{basename as wde,join as eo,relative as my,resolve as $M}from"path";import{fileURLToPath as xde}from"url";function CM(e){let t=yr(e,_de);if(!t.ok)throw Error(`Invalid reviewed site pins: ${t.error}`);return t.data.sites}async function Ade(e){return CM(await rl(e,"utf8"))}async function kde(e){return IM(await rl(e,"utf8"))}async function Rde(e,t){let r=eo(e,"users"),o=(await OM(r,{withFileTypes:!0})).filter((s)=>s.isFile()&&/\.ya?ml$/.test(s.name)).map((s)=>s.name).sort(),n=new Set(Object.keys(t??{})),i=[];for(let s of o){let a=eo(r,s),l=await rl(a,"utf8"),u=tn(l,{keepSourceTokens:!0});if(u.errors.length>0||!vn(u.contents))throw Error(`Invalid user desired-state YAML: ${s}`);let d=Ede.parse(u.toJS());if(!d.siteOverride)continue;let p=t?.[d.handle];if(!p)throw Error(`User ${d.handle} has a siteOverride but no reviewed site pin`);if(n.delete(d.handle),p.package!==d.siteOverride.package||p.theme!==d.siteOverride.theme)throw Error(`Reviewed site pin identity does not match user ${d.handle}`);if(d.siteOverride.version!==void 0&&d.siteOverride.version!==p.version)throw Error(`Reviewed site version does not match the existing pin for user ${d.handle}`);if(d.siteOverride.themeVersion!==void 0&&d.siteOverride.themeVersion!==p.themeVersion)throw Error(`Reviewed theme version does not match the existing pin for user ${d.handle}`);if(u.setIn(["siteOverride","version"],p.version),p.themeVersion!==void 0)u.setIn(["siteOverride","themeVersion"],p.themeVersion);else u.deleteIn(["siteOverride","themeVersion"]);lg.parse(u.toJS());let m=u.toString({lineWidth:0});if(m!==l)await tl(a,m),i.push(my(e,a))}if(n.size>0)throw Error(`Reviewed site pins do not match site users: ${[...n].sort().join(", ")}`);return i}async function Tde(e,t,r={}){let o=$M(e),n=$M(t);if(o===n||n.startsWith(`${o}/`))throw Error("Crossover output must be outside the source repository");await vde(o,n,{recursive:!0,errorOnExist:!0,force:!1,filter:(k)=>{let O=wde(k);return O!==".git"&&O!==".operator"&&O!==".brains-ops"&&O!==".turbo"&&O!=="dist"&&O!=="node_modules"&&O!==".env"&&O!==".env.local"&&!O.endsWith(".secrets.yaml")}});let i=[],s=eo(n,"docs","canonical-crossover-record.md");try{await Sde(s)}catch{await TM(eo(n,"docs"),{recursive:!0}),await tl(s,await rl(Ide,"utf8")),i.push("docs/canonical-crossover-record.md")}let a=eo(n,"pilot.yaml"),l=await rl(a,"utf8"),d=tn(l).toJS();if(!zd(d))throw Error(`${a} is not a YAML mapping`);let p=Array.isArray(d.bundles),m=r.bundleReview,h;if(p){if(!m)throw Error("Current canonical desired state requires an explicit capability bundle review manifest");h=AM(l,m.pilot)}else h=SM(l);await tl(a,h),i.push("pilot.yaml");let b=eo(n,"cohorts"),y=(await OM(b,{withFileTypes:!0})).filter((k)=>k.isFile()&&/\.ya?ml$/.test(k.name)).map((k)=>k.name).sort(),v=new Set(Object.keys(m?.cohorts??{}));for(let k of y){let O=eo(b,k),L=await rl(O,"utf8"),z=k.replace(/\.ya?ml$/,""),J=m?.cohorts[z];if(J)v.delete(z);await tl(O,p?kM(L,z,J):vM(L)),i.push(my(n,O))}if(p&&v.size>0)throw Error(`Capability bundle review names unknown cohorts: ${[...v].sort().join(", ")}`);i.push(...await Rde(n,r.sitePins));let x=await xt(n),_=fg(x.pilot.githubOrg);for(let k of x.users){let O=await _(k),L=eo(n,"users",k.handle);if(await TM(L,{recursive:!0}),O.brainYaml){let z=eo(L,"brain.yaml");await tl(z,O.brainYaml),i.push(my(n,z))}if(O.envFile){let z=eo(L,".env");await tl(z,O.envFile),i.push(my(n,z))}}return await Pi(n,{registry:x}),i.push("views/users.md"),{outputDir:n,changedFiles:[...new Set(i)].sort()}}var _de,Ede,Ide;var zM=S(()=>{Vn();Nd();de();el();nk();wM();RM();gn();Pd();To();_de=c.strictObject({sites:c.record(br,qA)}),Ede=c.object({handle:br,siteOverride:c.object({package:c.string().min(1),version:Ct.optional(),theme:c.string().min(1).optional(),themeVersion:Ct.optional()}).optional()}).passthrough(),Ide=xde(new URL("../templates/rover-pilot/docs/canonical-crossover-record.md",import.meta.url))});var DM,$de,Ode,Cde,No,up,Pde,$R,zde,Nde,NM,Dde,Lde,LM,pze,ZM;var hy=S(()=>{YI();DM=["primary","secondary"],$de=c.custom((e)=>typeof e==="function","Expected a React component"),Ode=c.strictObject({show:c.boolean().optional(),label:c.string().min(1).optional(),slot:c.enum(DM).optional(),priority:c.number().optional()}),Cde=c.strictObject({id:c.string().min(1),template:c.string().min(1),content:c.unknown().optional(),dataQuery:c.looseObject({entityType:c.string().optional(),template:c.string().optional(),query:c.record(c.string(),c.unknown()).optional()}).optional(),order:c.number().optional()}),No=c.string().regex(/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/,{message:"must be a language tag such as en or zh-TW"}),up=c.strictObject({title:c.string().optional(),description:c.string().optional(),navigationLabel:c.string().optional()}),Pde=c.strictObject({id:c.string().min(1),path:c.string().startsWith("/"),title:c.string().optional(),pageLabel:c.string().optional(),description:c.string().optional(),sections:c.array(Cde).optional(),layout:c.string().min(1).optional(),fullscreen:c.boolean().optional(),pluginId:c.string().optional(),sourceEntityType:c.string().optional(),external:c.boolean().optional(),navigation:Ode.optional(),translations:c.record(No,up).optional()}),$R=c.strictObject({label:c.string().min(1),pluralName:c.string().min(1).optional(),layout:c.string().min(1).optional(),detailTemplate:c.string().min(1).optional(),paginate:c.boolean().optional(),pageSize:c.number().int().positive().optional(),citable:c.boolean().optional(),navigation:c.strictObject({show:c.boolean().optional(),slot:c.enum(DM).optional(),priority:c.number().optional()}).optional()}),zde=c.strictObject({schema:c.custom((e)=>e instanceof c.ZodType,"Expected a Zod schema"),component:c.custom((e)=>typeof e==="function","Expected a React component"),title:c.string().min(1),description:c.string(),requiredPermission:c.enum(["admin","trusted","public"]).optional(),fullscreen:c.boolean().optional(),dataSource:c.string().min(1).optional()}),Nde=c.custom((e)=>typeof e==="object"&&e!==null&&Reflect.get(e,"kind")==="rizom-data-source"&&typeof Reflect.get(e,"id")==="string"&&typeof Reflect.get(e,"fetch")==="function","Expected a fetching data source declared with defineDataSource"),NM=c.strictObject({namespace:c.string().min(1),sections:c.record(c.string(),zde)}),Dde=c.record(c.string(),c.json()),Lde=c.record(c.string(),c.record(c.string(),Dde)),LM={layouts:c.record(c.string(),$de).refine((e)=>typeof e.default==="function",{message:'Site layouts must include a "default" component'}),routes:c.array(Pde),content:Lde.optional(),sections:c.union([NM,c.array(NM)]).optional(),themeOverride:c.string().optional(),headScripts:c.array(c.string()).optional(),entityDisplay:c.record(c.string(),$R),staticAssets:c.record(c.string(),c.string()).optional(),languages:c.array(No).min(1).optional(),dataSources:c.array(Nde).readonly().optional()},pze=c.strictObject(LM).partial(),ZM=c.strictObject(LM).superRefine((e,t)=>{let r=e.languages??[],o=new Set;for(let[u,d]of r.entries()){let p=d.toLowerCase();if(o.has(p))t.addIssue({code:"custom",path:["languages",u],message:`Language "${d}" is declared twice`});o.add(p)}let n=r.slice(1).map((u)=>`/${u.toLowerCase()}`),i=new Set;for(let[u,d]of e.routes.entries()){if(i.has(d.id))t.addIssue({code:"custom",path:["routes",u,"id"],message:`Duplicate route id "${d.id}"`});i.add(d.id);let p=d.path.toLowerCase(),m=n.find((b)=>p===b||p.startsWith(`${b}/`));if(m)t.addIssue({code:"custom",path:["routes",u,"path"],message:`Route path "${d.path}" is under ${m}, where another language's pages are built`});let h=d.layout??"default";if(!e.layouts[h])t.addIssue({code:"custom",path:["routes",u,"layout"],message:`Unknown layout "${h}"`});for(let[b,y]of(d.sections??[]).entries()){let v=/^([^:.\s]+)\.([^:.\s]+)$/.exec(y.template);if(v)t.addIssue({code:"custom",path:["routes",u,"sections",b,"template"],message:`Section template "${y.template}" is written "${v[1]}:${v[2]}"`})}}let s=Array.isArray(e.sections)?e.sections:e.sections?[e.sections]:[],a=new Map(s.map((u)=>[u.namespace,u]));if(a.size!==s.length)t.addIssue({code:"custom",path:["sections"],message:"Section group namespaces must be unique"});let l=new Set;for(let[u,d]of(e.dataSources??[]).entries()){if(l.has(d.id))t.addIssue({code:"custom",path:["dataSources",u],message:`Data source "${d.id}" is declared twice`});l.add(d.id)}for(let u of s)for(let[d,p]of Object.entries(u.sections))if(p.dataSource&&!l.has(p.dataSource))t.addIssue({code:"custom",path:["sections",u.namespace,d,"dataSource"],message:`Section "${u.namespace}:${d}" reads data source "${p.dataSource}", which the site does not declare`});for(let[u,d]of Object.entries(e.content??{})){let p=a.get(u);if(!p){t.addIssue({code:"custom",path:["content",u],message:`Content namespace "${u}" has no section group`});continue}for(let[m,h]of Object.entries(d)){let b=p.sections[m];if(!b){t.addIssue({code:"custom",path:["content",u,m],message:`Content section "${u}:${m}" is not defined`});continue}let y=b.schema.safeParse(h);if(!y.success)t.addIssue({code:"custom",path:["content",u,m],message:`Content does not satisfy the "${u}:${m}" schema: ${c.prettifyError(y.error)}`})}}})});var jM,BM,UM,gy,MM,jde,qM,FM,Bde,HM,JM,Ude,yy;var OR=S(()=>{wt();de();hy();hy();jM=c.object({id:c.string(),template:c.string(),content:c.unknown().optional(),dataQuery:c.looseObject({entityType:c.string().optional(),template:c.string().optional(),query:c.looseObject({id:c.string().optional(),limit:c.number().optional(),offset:c.number().optional()}).optional()}).optional(),order:c.number().optional()}),BM=["primary","secondary"],UM=c.object({show:c.boolean().default(!1),label:c.string().optional(),slot:c.enum(BM).default("primary"),priority:c.number().min(0).max(100).default(50)}).optional(),gy=c.object({id:c.string(),path:c.string(),title:c.string().default(""),pageLabel:c.string().optional(),description:c.string().default(""),sections:c.array(jM).default([]),layout:c.string().default("default"),fullscreen:c.boolean().optional(),pluginId:c.string().optional(),sourceEntityType:c.string().optional(),external:c.boolean().optional(),navigation:UM,translations:c.record(No,up).optional(),languages:c.array(No).optional()}),MM=c.object({routes:c.array(gy),pluginId:c.string()}),jde=ye({channel:"plugin:site-builder:route:register",request:MM,response:c.void(),delivery:"command"}),qM=c.strictObject({}),FM=c.array(gy),Bde=ye({channel:"site-builder:routes:list",request:qM,response:FM,delivery:"request"}),HM=c.strictObject({}),JM=c.array(gy),Ude=ye({channel:"plugin:site-builder:pages",request:HM,response:JM,delivery:"collect"}),yy=c.object({label:c.string(),href:c.string(),priority:c.number()})});var KM,VM,WM,Mde;var GM=S(()=>{wt();de();KM=c.object({pluginId:c.string(),slotName:c.string(),render:c.custom((e)=>typeof e==="function"),priority:c.number().optional()}),VM=c.strictObject({}),WM=c.array(KM),Mde=ye({channel:"plugin:site-builder:slots",request:VM,response:WM,delivery:"collect"})});var QM="site:metadata:updated",by,YM,XM,nl,eq,qde,Fde,Hde;var CR=S(()=>{wt();de();OR();by=c.object({heading:c.string().describe("Main CTA heading text"),subtitle:c.string().optional().describe("A line under the CTA heading"),buttonText:c.string().describe("Call-to-action button text"),buttonLink:c.string().describe("URL or anchor for the CTA button")}),YM=c.object({title:c.string().optional(),description:c.string().optional(),copyright:c.string().optional(),cta:by.optional()}),XM=c.object({blurb:c.string().optional().describe("Short italic subtitle under the section title")}),nl=c.object({represents:c.enum(["brain","anchor"]).default("anchor").describe("Identity represented by the site"),title:c.string().describe("The site's title"),description:c.string().describe("The site's description"),url:c.string().optional().describe("Canonical site URL"),copyright:c.string().optional().describe("Copyright notice text"),logo:c.boolean().optional().describe("Whether to display logo instead of title text in header"),themeMode:c.enum(["light","dark"]).optional().describe("Default theme mode"),analyticsScript:c.string().optional().describe("Analytics script HTML"),cta:by.optional().describe("Call-to-action configuration"),sections:c.record(c.string(),XM).optional().describe("Optional per-section blurbs, keyed by section id (e.g. 'essays', 'presentations', 'about'). Used by homepage templates that render editorial section headers."),translations:c.record(No,YM).optional().describe("The site's title, description, copyright and call to action in its other languages, keyed by language tag. A site is built in a language only once it has one.")}),eq=c.strictObject({}),qde=ye({channel:"site:metadata:get",request:eq,response:nl,delivery:"request"}),Fde=Gn(QM,nl),Hde=nl.extend({copyright:c.string(),navigation:c.object({primary:c.array(yy),secondary:c.array(yy)}),socialLinks:c.array(BA).optional().describe("Social media links from profile metadata"),photo:c.string().optional().describe("The anchor's photo, as ")})});var kze;var PR=S(()=>{de();kze=c.record(c.string(),c.unknown())});var dp=S(()=>{PR()});var tq=S(()=>{wt();dp()});var rq=S(()=>{dp();wt()});var nq=S(()=>{dp();wt()});var qze,Fze;var zR=S(()=>{de();qze=c.record(c.string(),c.unknown()),Fze=c.object({label:c.string().optional(),line:c.boolean().optional(),itemTitle:c.string().optional(),itemLabel:c.string().optional()}).loose()});var Kze;var oq=S(()=>{de();Pc();Kze=c.record(c.string(),c.unknown())});var iq=S(()=>{Pc()});var aq=S(()=>{de();zR()});var cq;var lq=S(()=>{wt();de();cq=c.object({id:c.string().min(1),title:c.string().min(1),url:c.url().optional(),brain:Nc.optional()})});var wy=S(()=>{dp();tq();rq();nq();zR();oq();iq();aq();lq();PR()});var ipe;var uq=S(()=>{de();ipe=c.object({slug:c.string(),title:c.string(),type:c.string(),entityId:c.string(),contentHash:c.string()})});var NR=S(()=>{wy();uq();wy();wy()});var dq=S(()=>{NR();de()});var DR=()=>{};var spe,ape,cpe;var xy=S(()=>{de();wt();spe={url:c.string(),typeLabel:c.string(),listUrl:c.string(),listLabel:c.string()},ape={url:c.string().nullable().default(null),typeLabel:c.string().nullable().default(null),listUrl:c.string().nullable().default(null),listLabel:c.string().nullable().default(null)},cpe=c.object({name:c.string(),description:c.string(),schema:c.unknown(),basePrompt:c.string().optional(),useKnowledgeContext:c.boolean().optional(),requiredPermission:c.enum(["admin","trusted","public"]),formatter:c.unknown().optional(),overlayFormatter:c.unknown().optional(),layout:c.object({component:c.unknown().optional(),fullscreen:c.boolean().optional(),formats:c.unknown().optional()}).optional(),dataSourceId:c.string().optional()})});var _y=S(()=>{xy()});var mq=S(()=>{_y()});var LR=()=>{};var upe,dpe,ol,hq,ppe;var gq=S(()=>{wt();de();LR();upe=c.enum(["admin","trusted","public"]),dpe=c.enum(["create","update","delete","extract","publish"]),ol=c.enum(["never","admin","trusted","public"]),hq=c.strictObject({create:ol.optional(),update:ol.optional(),delete:ol.optional(),extract:ol.optional(),publish:ol.optional()}),ppe=c.record(c.string(),hq)});var yq=S(()=>{_y();xy()});var fpe,mpe,Ey,hpe,gpe,ype;var bq=S(()=>{de();fpe=c.enum(["site-content-preview","site-content-production"]),mpe=c.enum(["web","image","pdf","epub"]),Ey=c.custom((e)=>typeof e==="function"),hpe=c.object({name:c.string(),schema:c.unknown(),description:c.string().optional(),pluginId:c.string(),renderers:c.object({web:c.union([Ey,c.string()]).optional(),image:c.union([Ey,c.string()]).optional(),pdf:c.union([Ey,c.string()]).optional(),epub:c.union([Ey,c.string()]).optional()})}),gpe=c.object({enableContentGeneration:c.boolean().default(!1),outputDir:c.string(),workingDir:c.string().optional(),environment:c.enum(["preview","production"]).default("preview"),siteConfig:c.object({title:c.string(),description:c.string(),url:c.string().optional()}).optional()}),ype=c.object({success:c.boolean(),routesBuilt:c.number(),errors:c.array(c.string()).optional(),warnings:c.array(c.string()).optional()})});var Sq=S(()=>{xy();mq();_y();gq();LR();yq();bq()});var ZR=ge(function(Spe,Iy){(function(){function e(g,E){Object.defineProperty(o.prototype,g,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",E[0],E[1])}})}function t(g){if(g===null||typeof g!=="object")return null;return g=De&&g[De]||g["@@iterator"],typeof g==="function"?g:null}function r(g,E){g=(g=g.constructor)&&(g.displayName||g.name)||"ReactClass";var D=g+"."+E;Qe[D]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",E,g),Qe[D]=!0)}function o(g,E,D){this.props=g,this.context=E,this.refs=Dt,this.updater=D||bt}function n(){}function i(g,E,D){this.props=g,this.context=E,this.refs=Dt,this.updater=D||bt}function s(){}function a(g){return""+g}function l(g){try{a(g);var E=!1}catch(M){E=!0}if(E){E=console;var D=E.error,H=typeof Symbol==="function"&&Symbol.toStringTag&&g[Symbol.toStringTag]||g.constructor.name||"Object";return D.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",H),a(g)}}function u(g){if(g==null)return null;if(typeof g==="function")return g.$$typeof===$n?null:g.displayName||g.name||null;if(typeof g==="string")return g;switch(g){case K:return"Fragment";case re:return"Profiler";case G:return"StrictMode";case xe:return"Suspense";case ke:return"SuspenseList";case Ue:return"Activity"}if(typeof g==="object")switch(typeof g.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),g.$$typeof){case N:return"Portal";case me:return g.displayName||"Context";case ae:return(g._context.displayName||"Context")+".Consumer";case Se:var E=g.render;return g=g.displayName,g||(g=E.displayName||E.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case Ae:return E=g.displayName||null,E!==null?E:u(g.type)||"Memo";case _e:E=g._payload,g=g._init;try{return u(g(E))}catch(D){}}return null}function d(g){if(g===K)return"<>";if(typeof g==="object"&&g!==null&&g.$$typeof===_e)return"<...>";try{var E=u(g);return E?"<"+E+">":"<...>"}catch(D){return"<...>"}}function p(){var g=Le.A;return g===null?null:g.getOwner()}function m(){return Error("react-stack-top-frame")}function h(g){if(lo.call(g,"key")){var E=Object.getOwnPropertyDescriptor(g,"key").get;if(E&&E.isReactWarning)return!1}return g.key!==void 0}function b(g,E){function D(){ls||(ls=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}D.isReactWarning=!0,Object.defineProperty(g,"key",{get:D,configurable:!0})}function y(){var g=u(this.type);return us[g]||(us[g]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),g=this.props.ref,g!==void 0?g:null}function v(g,E,D,H,M,te){var se=D.ref;return g={$$typeof:q,type:g,key:E,props:D,_owner:H},(se!==void 0?se:null)!==null?Object.defineProperty(g,"ref",{enumerable:!1,get:y}):Object.defineProperty(g,"ref",{enumerable:!1,value:null}),g._store={},Object.defineProperty(g._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(g,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(g,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(g,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.freeze&&(Object.freeze(g.props),Object.freeze(g)),g}function x(g,E){return E=v(g.type,E,g.props,g._owner,g._debugStack,g._debugTask),g._store&&(E._store.validated=g._store.validated),E}function _(g){k(g)?g._store&&(g._store.validated=1):typeof g==="object"&&g!==null&&g.$$typeof===_e&&(g._payload.status==="fulfilled"?k(g._payload.value)&&g._payload.value._store&&(g._payload.value._store.validated=1):g._store&&(g._store.validated=1))}function k(g){return typeof g==="object"&&g!==null&&g.$$typeof===q}function O(g){var E={"=":"=0",":":"=2"};return"$"+g.replace(/[=:]/g,function(D){return E[D]})}function L(g,E){return typeof g==="object"&&g!==null&&g.key!=null?(l(g.key),O(""+g.key)):E.toString(36)}function z(g){switch(g.status){case"fulfilled":return g.value;case"rejected":throw g.reason;default:switch(typeof g.status==="string"?g.then(s,s):(g.status="pending",g.then(function(E){g.status==="pending"&&(g.status="fulfilled",g.value=E)},function(E){g.status==="pending"&&(g.status="rejected",g.reason=E)})),g.status){case"fulfilled":return g.value;case"rejected":throw g.reason}}throw g}function J(g,E,D,H,M){var te=typeof g;if(te==="undefined"||te==="boolean")g=null;var se=!1;if(g===null)se=!0;else switch(te){case"bigint":case"string":case"number":se=!0;break;case"object":switch(g.$$typeof){case q:case N:se=!0;break;case _e:return se=g._init,J(se(g._payload),E,D,H,M)}}if(se){se=g,M=M(se);var be=H===""?"."+L(se,0):H;return Or(M)?(D="",be!=null&&(D=be.replace(Ea,"$&/")+"/"),J(M,E,D,"",function(Te){return Te})):M!=null&&(k(M)&&(M.key!=null&&(se&&se.key===M.key||l(M.key)),D=x(M,D+(M.key==null||se&&se.key===M.key?"":(""+M.key).replace(Ea,"$&/")+"/")+be),H!==""&&se!=null&&k(se)&&se.key==null&&se._store&&!se._store.validated&&(D._store.validated=2),M=D),E.push(M)),1}if(se=0,be=H===""?".":H+":",Or(g))for(var fe=0;fe<g.length;fe++)H=g[fe],te=be+L(H,fe),se+=J(H,E,D,te,M);else if(fe=t(g),typeof fe==="function")for(fe===g.entries&&(Qo||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Qo=!0),g=fe.call(g),fe=0;!(H=g.next()).done;)H=H.value,te=be+L(H,fe++),se+=J(H,E,D,te,M);else if(te==="object"){if(typeof g.then==="function")return J(z(g),E,D,H,M);throw E=String(g),Error("Objects are not valid as a React child (found: "+(E==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":E)+"). If you meant to render a collection of children, use an array instead.")}return se}function P(g,E,D){if(g==null)return g;var H=[],M=0;return J(g,H,"","",function(te){return E.call(D,te,M++)}),H}function W(g){if(g._status===-1){var E=g._ioInfo;E!=null&&(E.start=E.end=performance.now()),E=g._result;var D=E();if(D.then(function(M){if(g._status===0||g._status===-1){g._status=1,g._result=M;var te=g._ioInfo;te!=null&&(te.end=performance.now()),D.status===void 0&&(D.status="fulfilled",D.value=M)}},function(M){if(g._status===0||g._status===-1){g._status=2,g._result=M;var te=g._ioInfo;te!=null&&(te.end=performance.now()),D.status===void 0&&(D.status="rejected",D.reason=M)}}),E=g._ioInfo,E!=null){E.value=D;var H=D.displayName;typeof H==="string"&&(E.name=H)}g._status===-1&&(g._status=0,g._result=D)}if(g._status===1)return E=g._result,E===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
431
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){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 t=sy(e),r=Xc(t);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=sy(e),r=Xc(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((r)=>r.type==="newline"||r.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){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;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}aue.Parser=rM});var aM=ge(function(gue){var nM=uR(),lue=rp(),cp=np(),uue=vk(),due=qe(),pue=vR(),oM=wR();function iM(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new pue.LineCounter||null,prettyErrors:t}}function fue(e,t={}){let{lineCounter:r,prettyErrors:o}=iM(t),n=new oM.Parser(r?.addNewLine),i=new nM.Composer(t),s=Array.from(i.compose(n.parse(e)));if(o&&r)for(let a of s)a.errors.forEach(cp.prettifyError(e,r)),a.warnings.forEach(cp.prettifyError(e,r));if(s.length>0)return s;return Object.assign([],{empty:!0},i.streamInfo())}function sM(e,t={}){let{lineCounter:r,prettyErrors:o}=iM(t),n=new oM.Parser(r?.addNewLine),i=new nM.Composer(t),s=null;for(let a of i.compose(n.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new cp.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(o&&r)s.errors.forEach(cp.prettifyError(e,r)),s.warnings.forEach(cp.prettifyError(e,r));return s}function mue(e,t,r){let o=void 0;if(typeof t==="function")o=t;else if(r===void 0&&t&&typeof t==="object")r=t;let n=sM(e,r);if(!n)return null;if(n.warnings.forEach((i)=>uue.warn(n.options.logLevel,i)),n.errors.length>0)if(n.options.logLevel!=="silent")throw n.errors[0];else n.errors=[];return n.toJS(Object.assign({reviver:o},r))}function hue(e,t,r){let o=null;if(typeof t==="function"||Array.isArray(t))o=t;else if(r===void 0&&t)r=t;if(typeof r==="string")r=r.length;if(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}if(due.isDocument(e)&&!o)return e.toString(r);return new lue.Document(e,o,r).toString(r)}gue.parse=mue;gue.parseAllDocuments=fue;gue.parseDocument=sM;gue.stringify=hue});var wue,xue,_ue,xR,Eue,Mi,Iue,Aue,kue,Rue,$Pe,Tue,$ue,Oue,cy,cM,Cue,Pue,zue,Nue,Due,Lue,Zue,jue,Bue,Uue,vn,Po,Mue,zo,_R,que,Fue,Hue,Jue,Kue,Vue,Wue,Gue,Que,tn,Yue,Xue,ede;var el=S(()=>{wue=uR(),xue=rp(),_ue=Vk(),xR=np(),Eue=Md(),Mi=qe(),Iue=Li(),Aue=At(),kue=ji(),Rue=Bi(),$Pe=oy(),Tue=SR(),$ue=vR(),Oue=wR(),cy=aM(),cM=Bd();Cue=wue.Composer,Pue=xue.Document,zue=_ue.Schema,Nue=xR.YAMLError,Due=xR.YAMLParseError,Lue=xR.YAMLWarning,Zue=Eue.Alias,jue=Mi.isAlias,Bue=Mi.isCollection,Uue=Mi.isDocument,vn=Mi.isMap,Po=Mi.isNode,Mue=Mi.isPair,zo=Mi.isScalar,_R=Mi.isSeq,que=Iue.Pair,Fue=Aue.Scalar,Hue=kue.YAMLMap,Jue=Rue.YAMLSeq,Kue=Tue.Lexer,Vue=$ue.LineCounter,Wue=Oue.Parser,Gue=cy.parse,Que=cy.parseAllDocuments,tn=cy.parseDocument,Yue=cy.stringify,Xue=cM.visit,ede=cM.visitAsync});var pM={};Lt(pM,{migratePilotDeploySecrets:()=>uM,migratePilotEnvSchema:()=>dM,migratePilotRepoProviderKeys:()=>cde,migrateProviderKeyFieldsYaml:()=>AR,openaiSelectorFor:()=>kR,renameProviderKeyFields:()=>qi});import{readdir as tde,readFile as ER,writeFile as lM}from"fs/promises";import{join as No}from"path";function AR(e){let t=tn(e,{keepSourceTokens:!0});return qi(t)?t.toString({lineWidth:0}):e}function qi(e){if(!vn(e.contents))return!1;return e.contents.items.filter((r)=>{if(!zo(r.key)||typeof r.key.value!=="string")return!1;let o=rde[r.key.value];if(!o)return!1;if(r.key.value==="aiApiKey"&&zo(r.value)&&r.value.value===uy)r.value.value=dy;return r.key.value=o,!0}).length>0}function kR(e){return e===uy?dy:e}function uM(e){return e.replace(new RegExp(`^(\\s+- )${uy}$`,"m"),`$1${dy}`)}function dM(e){return e.replace(new RegExp(`^${uy}=`,"m"),`${dy}=`)}async function ly(e){try{return(await tde(e)).filter((r)=>r.endsWith(".yaml")).sort()}catch{return[]}}async function IR(e){try{return await ER(e,"utf8")}catch{return}}async function sde(e){let t=await ly(No(e,"cohorts")),r=await Promise.all(t.map(async(i)=>{let s=yr(await ER(No(e,"cohorts",i),"utf8"),ode);return s.ok&&s.data.aiApiKeyOverride?s.data.members:[]})),o=(await ly(No(e,"users"))).filter((i)=>!i.endsWith(".secrets.yaml")),n=await Promise.all(o.map(async(i)=>{let s=yr(await ER(No(e,"users",i),"utf8"),nde);return s.ok&&s.data.aiApiKeyOverride?[i.replace(/\.yaml$/,"")]:[]}));return[...new Set([...r.flat(),...n.flat()])]}async function ade(e,t,r,o){let n=No(e,"users",`${t}.secrets.yaml.age`),i=await IR(n);if(i===void 0)return!1;if(!r)throw Error(`users/${t}.secrets.yaml.age may hold the legacy AI key; set AGE_SECRET_KEY or AGE_SECRET_KEY_FILE to migrate it`);let s=new Cu;s.addIdentity(r);let a=await s.decrypt(bi.decode(i),"text"),l=AR(a);if(l===a)return!1;let u=new Ou;return u.addRecipient(o),await lM(n,bi.encode(await u.encrypt(l))),!0}async function cde(e,t){let r=["pilot.yaml",...(await ly(No(e,"cohorts"))).map((l)=>`cohorts/${l}`),...(await ly(No(e,"users"))).filter((l)=>!l.endsWith(".secrets.yaml")).map((l)=>`users/${l}`)],o=await sde(e),n=await Promise.all([...r.map((l)=>({file:l,migrate:AR})),{file:".env.schema",migrate:dM},{file:"deploy/kamal/deploy.yml",migrate:uM}].map(async({file:l,migrate:u})=>{let d=No(e,l),p=await IR(d);if(p===void 0)return[];let m=u(p);if(m===p)return[];return await lM(d,m),[l]})),i=yr(await IR(No(e,"pilot.yaml"))??"",ide),s=ak(e,t,Lr(e)),a=o.length===0?[]:await Promise.all(o.map(async(l)=>{if(!i.ok)throw Error("pilot.yaml needs agePublicKey to re-encrypt secrets");return await ade(e,l,s,i.data.agePublicKey)?[`users/${l}.secrets.yaml.age`]:[]}));return[...n.flat(),...a.flat()]}var uy="AI_API_KEY",dy="OPENAI_API_KEY",rde,nde,ode,ide;var py=S(()=>{yi();wi();Vn();de();el();lk();rde={aiApiKey:"openaiApiKey",aiApiKeyOverride:"openaiApiKeyOverride"};nde=c.looseObject({aiApiKeyOverride:c.string().optional()}),ode=c.looseObject({members:c.array(c.string()).default([]),aiApiKeyOverride:c.string().optional()}),ide=c.looseObject({agePublicKey:c.string()})});function gM(e){if(e==="core")return{bundles:["core","media","web","chat"]};if(e==="default")return{bundles:["core","media","automation","web","chat","site","publishing","federation"],remove:[...dde]};return{bundles:["core","media","automation","web","chat","site","publishing","federation"]}}function pde(e){let t=lde.parse(e);return Qs.parse({brainVersion:t.brainVersion,bundleContract:Gs,...gM(t.preset),githubOrg:t.githubOrg,contentRepoPrefix:t.contentRepoPrefix,domainSuffix:t.domainSuffix,openaiApiKey:kR(t.aiApiKey),gitSyncToken:t.gitSyncToken,contentRepoAdminToken:t.contentRepoAdminToken,agePublicKey:t.agePublicKey})}function fde(e){let t=ude.parse(e),r=t.presetOverride?gM(t.presetOverride):void 0;return hn.parse({members:[...t.members],...t.brainVersionOverride?{brainVersionOverride:t.brainVersionOverride}:{},...r?{bundlesOverride:r.bundles,...r.add?{addOverride:r.add}:{},...r.remove?{removeOverride:r.remove}:{}}:{},...t.aiApiKeyOverride?{openaiApiKeyOverride:t.aiApiKeyOverride}:{},...t.gitSyncTokenOverride?{gitSyncTokenOverride:t.gitSyncTokenOverride}:{}})}function yM(e){let t=tn(e,{keepSourceTokens:!0});if(t.errors.length>0)throw Error(`Invalid desired-state YAML: ${t.errors[0]?.message}`);if(!vn(t.contents))throw Error("Desired-state YAML must contain a mapping");return t}function RR(e,t){if(!vn(e.contents))return;return e.contents.items.find((r)=>zo(r.key)&&r.key.value===t)}function fM(e,t){if(!Po(e)||!Po(t))return;if(e.commentBefore!==void 0)t.commentBefore=e.commentBefore;if(e.comment!==void 0)t.comment=e.comment;if(e.spaceBefore!==void 0)t.spaceBefore=e.spaceBefore}function mM(e,t){if(!e||!Po(t))return;let r=[Po(e.key)?e.key.commentBefore:void 0,Po(e.key)?e.key.comment:void 0,Po(e.value)?e.value.commentBefore:void 0,Po(e.value)?e.value.comment:void 0].filter((o)=>o!==void 0);if(r.length===0)return;t.commentBefore=[t.commentBefore,...r].filter((o)=>o!==void 0).join(`
|
|
432
|
+
`)}function bM(e,t,r,o){if(!vn(e.contents))throw Error("Desired-state YAML must contain a mapping");let n=e.contents.items.findIndex((s)=>zo(s.key)&&s.key.value===t),i=e.createPair(r,[...o]);if(n>=0){let s=e.contents.items[n];fM(s?.key,i.key),fM(s?.value,i.value),e.contents.items.splice(n,1,i)}else e.contents.add(i);return i}function SM(e){let t=yM(e),r=pde(t.toJS()),o=RR(t,"schemaVersion"),n=RR(t,"model");mM(o,RR(t,"brainVersion")?.key),t.delete("schemaVersion"),t.set("bundleContract",Gs);let i=bM(t,"preset","bundles",r.bundles);if(mM(n,i.key),t.delete("model"),r.add)t.set("add",r.add);else t.delete("add");if(r.remove)t.set("remove",r.remove);else t.delete("remove");return qi(t),Qs.parse(t.toJS()),t.toString({lineWidth:0})}function vM(e){let t=yM(e),r=fde(t.toJS());if(r.bundlesOverride)bM(t,"presetOverride","bundlesOverride",r.bundlesOverride);else t.delete("presetOverride"),t.delete("bundlesOverride");if(r.addOverride)t.set("addOverride",r.addOverride);else t.delete("addOverride");if(r.removeOverride)t.set("removeOverride",r.removeOverride);else t.delete("removeOverride");return qi(t),hn.parse(t.toJS()),t.toString({lineWidth:0})}var hM,lp,lde,ude,dde;var wM=S(()=>{py();Vn();de();el();$o();hM=c.enum(["core","default","pro"]),lp=c.string().min(1),lde=c.strictObject({schemaVersion:c.literal(1),brainVersion:Ct,model:c.literal("rover"),githubOrg:c.string().min(1),contentRepoPrefix:c.string().min(1),domainSuffix:c.string().min(1),preset:hM,aiApiKey:lp,gitSyncToken:lp,contentRepoAdminToken:lp,agePublicKey:c.string().startsWith("age1").min(1)}),ude=c.strictObject({members:c.array(br).min(1),brainVersionOverride:Ct.optional(),presetOverride:hM.optional(),aiApiKeyOverride:lp.optional(),gitSyncTokenOverride:lp.optional()}).superRefine((e,t)=>{if(new Set(e.members).size!==e.members.length)t.addIssue({code:c.ZodIssueCode.custom,path:["members"],message:"cohort members must be unique"})}),dde=["series","portfolio","content-pipeline","social-media","newsletter","stock-photo"]});function _M(e,t){let r=tn(e,{keepSourceTokens:!0});if(r.errors.length>0||!vn(r.contents))throw Error(`Invalid ${t} YAML`);return r}function bde(e,t){return e.length===t.length&&e.every((r,o)=>r===t[o])}function EM(e,t,r){if(!bde(t,r.sourceBundles))throw Error(`${e} source bundles changed after review: expected [${r.sourceBundles.join(", ")}], received [${t.join(", ")}]`)}function IM(e){let t=yr(e,yde);if(!t.ok)throw Error(`Invalid capability bundle review: ${t.error}`);return t.data}function AM(e,t){let r=_M(e,"pilot desired-state"),o=hde.parse(r.toJS());return EM("pilot.yaml",o.bundles,t),r.set("bundleContract",Gs),r.set("bundles",t.targetBundles),qi(r),Qs.parse(r.toJS()),r.toString({lineWidth:0})}function kM(e,t,r){let o=_M(e,`cohort ${t}`),n=gde.parse(o.toJS());if(n.bundlesOverride===void 0){if(r!==void 0)throw Error(`Capability bundle review names inheriting cohort ${t}`)}else{if(r===void 0)throw Error(`Cohort ${t} has an explicit legacy bundle selection but no reviewed mapping`);EM(`cohort ${t}`,n.bundlesOverride,r),o.set("bundlesOverride",r.targetBundles)}return qi(o),hn.parse(o.toJS()),o.toString({lineWidth:0})}var mde,TR,fy,hde,gde,xM,yde;var RM=S(()=>{py();Vn();de();el();$o();mde=c.enum(["core","site","publishing","team"]),TR=c.array(mde).min(1),fy=c.array(c.string().min(1)),hde=c.strictObject({brainVersion:Ct,bundles:TR,add:fy.optional(),remove:fy.optional(),githubOrg:c.string().min(1),contentRepoPrefix:c.string().min(1),domainSuffix:c.string().min(1),aiApiKey:c.string().min(1),gitSyncToken:c.string().min(1),contentRepoAdminToken:c.string().min(1),agePublicKey:c.string().startsWith("age1").min(1)}),gde=c.strictObject({members:c.array(br).min(1),brainVersionOverride:Ct.optional(),bundlesOverride:TR.optional(),addOverride:fy.optional(),removeOverride:fy.optional(),aiApiKeyOverride:c.string().min(1).optional(),gitSyncTokenOverride:c.string().min(1).optional()}),xM=c.strictObject({sourceBundles:TR,targetBundles:c.array(MA).min(1)}),yde=c.strictObject({bundleContract:c.literal(Gs),pilot:xM,cohorts:c.record(br,xM)})});var PM={};Lt(PM,{loadCapabilityBundleReview:()=>kde,loadReviewedSitePins:()=>Ade,parseReviewedSitePins:()=>CM,stageLegacyCrossover:()=>Tde});import{access as Sde,cp as vde,mkdir as TM,readFile as rl,readdir as OM,writeFile as tl}from"fs/promises";import{basename as wde,join as eo,relative as my,resolve as $M}from"path";import{fileURLToPath as xde}from"url";function CM(e){let t=yr(e,_de);if(!t.ok)throw Error(`Invalid reviewed site pins: ${t.error}`);return t.data.sites}async function Ade(e){return CM(await rl(e,"utf8"))}async function kde(e){return IM(await rl(e,"utf8"))}async function Rde(e,t){let r=eo(e,"users"),o=(await OM(r,{withFileTypes:!0})).filter((s)=>s.isFile()&&/\.ya?ml$/.test(s.name)).map((s)=>s.name).sort(),n=new Set(Object.keys(t??{})),i=[];for(let s of o){let a=eo(r,s),l=await rl(a,"utf8"),u=tn(l,{keepSourceTokens:!0});if(u.errors.length>0||!vn(u.contents))throw Error(`Invalid user desired-state YAML: ${s}`);let d=Ede.parse(u.toJS());if(!d.siteOverride)continue;let p=t?.[d.handle];if(!p)throw Error(`User ${d.handle} has a siteOverride but no reviewed site pin`);if(n.delete(d.handle),p.package!==d.siteOverride.package||p.theme!==d.siteOverride.theme)throw Error(`Reviewed site pin identity does not match user ${d.handle}`);if(d.siteOverride.version!==void 0&&d.siteOverride.version!==p.version)throw Error(`Reviewed site version does not match the existing pin for user ${d.handle}`);if(d.siteOverride.themeVersion!==void 0&&d.siteOverride.themeVersion!==p.themeVersion)throw Error(`Reviewed theme version does not match the existing pin for user ${d.handle}`);if(u.setIn(["siteOverride","version"],p.version),p.themeVersion!==void 0)u.setIn(["siteOverride","themeVersion"],p.themeVersion);else u.deleteIn(["siteOverride","themeVersion"]);lg.parse(u.toJS());let m=u.toString({lineWidth:0});if(m!==l)await tl(a,m),i.push(my(e,a))}if(n.size>0)throw Error(`Reviewed site pins do not match site users: ${[...n].sort().join(", ")}`);return i}async function Tde(e,t,r={}){let o=$M(e),n=$M(t);if(o===n||n.startsWith(`${o}/`))throw Error("Crossover output must be outside the source repository");await vde(o,n,{recursive:!0,errorOnExist:!0,force:!1,filter:(k)=>{let O=wde(k);return O!==".git"&&O!==".operator"&&O!==".brains-ops"&&O!==".turbo"&&O!=="dist"&&O!=="node_modules"&&O!==".env"&&O!==".env.local"&&!O.endsWith(".secrets.yaml")}});let i=[],s=eo(n,"docs","canonical-crossover-record.md");try{await Sde(s)}catch{await TM(eo(n,"docs"),{recursive:!0}),await tl(s,await rl(Ide,"utf8")),i.push("docs/canonical-crossover-record.md")}let a=eo(n,"pilot.yaml"),l=await rl(a,"utf8"),d=tn(l).toJS();if(!zd(d))throw Error(`${a} is not a YAML mapping`);let p=Array.isArray(d.bundles),m=r.bundleReview,h;if(p){if(!m)throw Error("Current canonical desired state requires an explicit capability bundle review manifest");h=AM(l,m.pilot)}else h=SM(l);await tl(a,h),i.push("pilot.yaml");let b=eo(n,"cohorts"),y=(await OM(b,{withFileTypes:!0})).filter((k)=>k.isFile()&&/\.ya?ml$/.test(k.name)).map((k)=>k.name).sort(),v=new Set(Object.keys(m?.cohorts??{}));for(let k of y){let O=eo(b,k),L=await rl(O,"utf8"),z=k.replace(/\.ya?ml$/,""),J=m?.cohorts[z];if(J)v.delete(z);await tl(O,p?kM(L,z,J):vM(L)),i.push(my(n,O))}if(p&&v.size>0)throw Error(`Capability bundle review names unknown cohorts: ${[...v].sort().join(", ")}`);i.push(...await Rde(n,r.sitePins));let x=await xt(n),_=fg(x.pilot.githubOrg);for(let k of x.users){let O=await _(k),L=eo(n,"users",k.handle);if(await TM(L,{recursive:!0}),O.brainYaml){let z=eo(L,"brain.yaml");await tl(z,O.brainYaml),i.push(my(n,z))}if(O.envFile){let z=eo(L,".env");await tl(z,O.envFile),i.push(my(n,z))}}return await Pi(n,{registry:x}),i.push("views/users.md"),{outputDir:n,changedFiles:[...new Set(i)].sort()}}var _de,Ede,Ide;var zM=S(()=>{Vn();Nd();de();el();nk();wM();RM();gn();Pd();$o();_de=c.strictObject({sites:c.record(br,qA)}),Ede=c.object({handle:br,siteOverride:c.object({package:c.string().min(1),version:Ct.optional(),theme:c.string().min(1).optional(),themeVersion:Ct.optional()}).optional()}).passthrough(),Ide=xde(new URL("../templates/rover-pilot/docs/canonical-crossover-record.md",import.meta.url))});var DM,$de,Ode,Cde,to,up,Pde,$R,zde,Nde,NM,Dde,Lde,LM,pze,ZM;var hy=S(()=>{YI();DM=["primary","secondary"],$de=c.custom((e)=>typeof e==="function","Expected a React component"),Ode=c.strictObject({show:c.boolean().optional(),label:c.string().min(1).optional(),slot:c.enum(DM).optional(),priority:c.number().optional()}),Cde=c.strictObject({id:c.string().min(1),template:c.string().min(1),content:c.unknown().optional(),dataQuery:c.looseObject({entityType:c.string().optional(),template:c.string().optional(),query:c.record(c.string(),c.unknown()).optional()}).optional(),order:c.number().optional()}),to=c.string().regex(/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/,{message:"must be a language tag such as en or zh-TW"}),up=c.strictObject({title:c.string().optional(),description:c.string().optional(),navigationLabel:c.string().optional()}),Pde=c.strictObject({id:c.string().min(1),path:c.string().startsWith("/"),title:c.string().optional(),pageLabel:c.string().optional(),description:c.string().optional(),sections:c.array(Cde).optional(),layout:c.string().min(1).optional(),fullscreen:c.boolean().optional(),pluginId:c.string().optional(),sourceEntityType:c.string().optional(),external:c.boolean().optional(),navigation:Ode.optional(),translations:c.record(to,up).optional()}),$R=c.strictObject({label:c.string().min(1),pluralName:c.string().min(1).optional(),layout:c.string().min(1).optional(),detailTemplate:c.string().min(1).optional(),paginate:c.boolean().optional(),pageSize:c.number().int().positive().optional(),citable:c.boolean().optional(),navigation:c.strictObject({show:c.boolean().optional(),slot:c.enum(DM).optional(),priority:c.number().optional()}).optional()}),zde=c.strictObject({schema:c.custom((e)=>e instanceof c.ZodType,"Expected a Zod schema"),component:c.custom((e)=>typeof e==="function","Expected a React component"),title:c.string().min(1),description:c.string(),requiredPermission:c.enum(["admin","trusted","public"]).optional(),fullscreen:c.boolean().optional(),dataSource:c.string().min(1).optional(),components:c.record(to,c.custom((e)=>typeof e==="function","Expected a React component")).optional()}),Nde=c.custom((e)=>typeof e==="object"&&e!==null&&Reflect.get(e,"kind")==="rizom-data-source"&&typeof Reflect.get(e,"id")==="string"&&typeof Reflect.get(e,"fetch")==="function","Expected a fetching data source declared with defineDataSource"),NM=c.strictObject({namespace:c.string().min(1),sections:c.record(c.string(),zde)}),Dde=c.record(c.string(),c.json()),Lde=c.record(c.string(),c.record(c.string(),Dde)),LM={layouts:c.record(c.string(),$de).refine((e)=>typeof e.default==="function",{message:'Site layouts must include a "default" component'}),routes:c.array(Pde),content:Lde.optional(),sections:c.union([NM,c.array(NM)]).optional(),themeOverride:c.string().optional(),headScripts:c.array(c.string()).optional(),entityDisplay:c.record(c.string(),$R),staticAssets:c.record(c.string(),c.string()).optional(),languages:c.array(to).min(1).optional(),dataSources:c.array(Nde).readonly().optional()},pze=c.strictObject(LM).partial(),ZM=c.strictObject(LM).superRefine((e,t)=>{let r=e.languages??[],o=new Set;for(let[u,d]of r.entries()){let p=d.toLowerCase();if(o.has(p))t.addIssue({code:"custom",path:["languages",u],message:`Language "${d}" is declared twice`});o.add(p)}let n=r.slice(1).map((u)=>`/${u.toLowerCase()}`),i=new Set;for(let[u,d]of e.routes.entries()){if(i.has(d.id))t.addIssue({code:"custom",path:["routes",u,"id"],message:`Duplicate route id "${d.id}"`});i.add(d.id);let p=d.path.toLowerCase(),m=n.find((b)=>p===b||p.startsWith(`${b}/`));if(m)t.addIssue({code:"custom",path:["routes",u,"path"],message:`Route path "${d.path}" is under ${m}, where another language's pages are built`});let h=d.layout??"default";if(!e.layouts[h])t.addIssue({code:"custom",path:["routes",u,"layout"],message:`Unknown layout "${h}"`});for(let[b,y]of(d.sections??[]).entries()){let v=/^([^:.\s]+)\.([^:.\s]+)$/.exec(y.template);if(v)t.addIssue({code:"custom",path:["routes",u,"sections",b,"template"],message:`Section template "${y.template}" is written "${v[1]}:${v[2]}"`})}}let s=Array.isArray(e.sections)?e.sections:e.sections?[e.sections]:[],a=new Map(s.map((u)=>[u.namespace,u]));if(a.size!==s.length)t.addIssue({code:"custom",path:["sections"],message:"Section group namespaces must be unique"});let l=new Set;for(let[u,d]of(e.dataSources??[]).entries()){if(l.has(d.id))t.addIssue({code:"custom",path:["dataSources",u],message:`Data source "${d.id}" is declared twice`});l.add(d.id)}for(let u of s)for(let[d,p]of Object.entries(u.sections))if(p.dataSource&&!l.has(p.dataSource))t.addIssue({code:"custom",path:["sections",u.namespace,d,"dataSource"],message:`Section "${u.namespace}:${d}" reads data source "${p.dataSource}", which the site does not declare`});for(let[u,d]of Object.entries(e.content??{})){let p=a.get(u);if(!p){t.addIssue({code:"custom",path:["content",u],message:`Content namespace "${u}" has no section group`});continue}for(let[m,h]of Object.entries(d)){let b=p.sections[m];if(!b){t.addIssue({code:"custom",path:["content",u,m],message:`Content section "${u}:${m}" is not defined`});continue}let y=b.schema.safeParse(h);if(!y.success)t.addIssue({code:"custom",path:["content",u,m],message:`Content does not satisfy the "${u}:${m}" schema: ${c.prettifyError(y.error)}`})}}})});var jM,BM,UM,gy,MM,jde,qM,FM,Bde,HM,JM,Ude,yy;var OR=S(()=>{wt();de();hy();hy();jM=c.object({id:c.string(),template:c.string(),content:c.unknown().optional(),dataQuery:c.looseObject({entityType:c.string().optional(),template:c.string().optional(),query:c.looseObject({id:c.string().optional(),limit:c.number().optional(),offset:c.number().optional()}).optional()}).optional(),order:c.number().optional()}),BM=["primary","secondary"],UM=c.object({show:c.boolean().default(!1),label:c.string().optional(),slot:c.enum(BM).default("primary"),priority:c.number().min(0).max(100).default(50)}).optional(),gy=c.object({id:c.string(),path:c.string(),title:c.string().default(""),pageLabel:c.string().optional(),description:c.string().default(""),sections:c.array(jM).default([]),layout:c.string().default("default"),fullscreen:c.boolean().optional(),pluginId:c.string().optional(),sourceEntityType:c.string().optional(),external:c.boolean().optional(),navigation:UM,translations:c.record(to,up).optional(),languages:c.array(to).optional()}),MM=c.object({routes:c.array(gy),pluginId:c.string()}),jde=ye({channel:"plugin:site-builder:route:register",request:MM,response:c.void(),delivery:"command"}),qM=c.strictObject({}),FM=c.array(gy),Bde=ye({channel:"site-builder:routes:list",request:qM,response:FM,delivery:"request"}),HM=c.strictObject({}),JM=c.array(gy),Ude=ye({channel:"plugin:site-builder:pages",request:HM,response:JM,delivery:"collect"}),yy=c.object({label:c.string(),href:c.string(),priority:c.number()})});var KM,VM,WM,Mde;var GM=S(()=>{wt();de();KM=c.object({pluginId:c.string(),slotName:c.string(),render:c.custom((e)=>typeof e==="function"),priority:c.number().optional()}),VM=c.strictObject({}),WM=c.array(KM),Mde=ye({channel:"plugin:site-builder:slots",request:VM,response:WM,delivery:"collect"})});var QM="site:metadata:updated",by,YM,XM,nl,eq,qde,Fde,Hde;var CR=S(()=>{wt();de();OR();by=c.object({heading:c.string().describe("Main CTA heading text"),subtitle:c.string().optional().describe("A line under the CTA heading"),buttonText:c.string().describe("Call-to-action button text"),buttonLink:c.string().describe("URL or anchor for the CTA button")}),YM=c.object({title:c.string().optional(),description:c.string().optional(),copyright:c.string().optional(),cta:by.optional()}),XM=c.object({blurb:c.string().optional().describe("Short italic subtitle under the section title")}),nl=c.object({represents:c.enum(["brain","anchor"]).default("anchor").describe("Identity represented by the site"),title:c.string().describe("The site's title"),description:c.string().describe("The site's description"),url:c.string().optional().describe("Canonical site URL"),copyright:c.string().optional().describe("Copyright notice text"),logo:c.boolean().optional().describe("Whether to display logo instead of title text in header"),themeMode:c.enum(["light","dark"]).optional().describe("Default theme mode"),analyticsScript:c.string().optional().describe("Analytics script HTML"),cta:by.optional().describe("Call-to-action configuration"),sections:c.record(c.string(),XM).optional().describe("Optional per-section blurbs, keyed by section id (e.g. 'essays', 'presentations', 'about'). Used by homepage templates that render editorial section headers."),translations:c.record(to,YM).optional().describe("The site's title, description, copyright and call to action in its other languages, keyed by language tag. A site is built in a language only once it has one.")}),eq=c.strictObject({}),qde=ye({channel:"site:metadata:get",request:eq,response:nl,delivery:"request"}),Fde=Gn(QM,nl),Hde=nl.extend({copyright:c.string(),navigation:c.object({primary:c.array(yy),secondary:c.array(yy)}),socialLinks:c.array(BA).optional().describe("Social media links from profile metadata"),photo:c.string().optional().describe("The anchor's photo, as ")})});var kze;var PR=S(()=>{de();kze=c.record(c.string(),c.unknown())});var dp=S(()=>{PR()});var tq=S(()=>{wt();dp()});var rq=S(()=>{dp();wt()});var nq=S(()=>{dp();wt()});var qze,Fze;var zR=S(()=>{de();qze=c.record(c.string(),c.unknown()),Fze=c.object({label:c.string().optional(),line:c.boolean().optional(),itemTitle:c.string().optional(),itemLabel:c.string().optional()}).loose()});var Kze;var oq=S(()=>{de();Pc();Kze=c.record(c.string(),c.unknown())});var iq=S(()=>{Pc()});var aq=S(()=>{de();zR()});var cq;var lq=S(()=>{wt();de();cq=c.object({id:c.string().min(1),title:c.string().min(1),url:c.url().optional(),brain:Nc.optional()})});var wy=S(()=>{dp();tq();rq();nq();zR();oq();iq();aq();lq();PR()});var ipe;var uq=S(()=>{de();ipe=c.object({slug:c.string(),title:c.string(),type:c.string(),entityId:c.string(),contentHash:c.string()})});var NR=S(()=>{wy();uq();wy();wy()});var dq=S(()=>{NR();de()});var DR=()=>{};var spe,ape,cpe;var xy=S(()=>{de();wt();spe={url:c.string(),typeLabel:c.string(),listUrl:c.string(),listLabel:c.string()},ape={url:c.string().nullable().default(null),typeLabel:c.string().nullable().default(null),listUrl:c.string().nullable().default(null),listLabel:c.string().nullable().default(null)},cpe=c.object({name:c.string(),description:c.string(),schema:c.unknown(),basePrompt:c.string().optional(),useKnowledgeContext:c.boolean().optional(),requiredPermission:c.enum(["admin","trusted","public"]),formatter:c.unknown().optional(),overlayFormatter:c.unknown().optional(),layout:c.object({component:c.unknown().optional(),fullscreen:c.boolean().optional(),formats:c.unknown().optional()}).optional(),dataSourceId:c.string().optional()})});var _y=S(()=>{xy()});var mq=S(()=>{_y()});var LR=()=>{};var upe,dpe,ol,hq,ppe;var gq=S(()=>{wt();de();LR();upe=c.enum(["admin","trusted","public"]),dpe=c.enum(["create","update","delete","extract","publish"]),ol=c.enum(["never","admin","trusted","public"]),hq=c.strictObject({create:ol.optional(),update:ol.optional(),delete:ol.optional(),extract:ol.optional(),publish:ol.optional()}),ppe=c.record(c.string(),hq)});var yq=S(()=>{_y();xy()});var fpe,mpe,Ey,hpe,gpe,ype;var bq=S(()=>{de();fpe=c.enum(["site-content-preview","site-content-production"]),mpe=c.enum(["web","image","pdf","epub"]),Ey=c.custom((e)=>typeof e==="function"),hpe=c.object({name:c.string(),schema:c.unknown(),description:c.string().optional(),pluginId:c.string(),renderers:c.object({web:c.union([Ey,c.string()]).optional(),image:c.union([Ey,c.string()]).optional(),pdf:c.union([Ey,c.string()]).optional(),epub:c.union([Ey,c.string()]).optional()})}),gpe=c.object({enableContentGeneration:c.boolean().default(!1),outputDir:c.string(),workingDir:c.string().optional(),environment:c.enum(["preview","production"]).default("preview"),siteConfig:c.object({title:c.string(),description:c.string(),url:c.string().optional()}).optional()}),ype=c.object({success:c.boolean(),routesBuilt:c.number(),errors:c.array(c.string()).optional(),warnings:c.array(c.string()).optional()})});var Sq=S(()=>{xy();mq();_y();gq();LR();yq();bq()});var ZR=ge(function(Spe,Iy){(function(){function e(g,E){Object.defineProperty(o.prototype,g,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",E[0],E[1])}})}function t(g){if(g===null||typeof g!=="object")return null;return g=De&&g[De]||g["@@iterator"],typeof g==="function"?g:null}function r(g,E){g=(g=g.constructor)&&(g.displayName||g.name)||"ReactClass";var D=g+"."+E;Qe[D]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",E,g),Qe[D]=!0)}function o(g,E,D){this.props=g,this.context=E,this.refs=Dt,this.updater=D||bt}function n(){}function i(g,E,D){this.props=g,this.context=E,this.refs=Dt,this.updater=D||bt}function s(){}function a(g){return""+g}function l(g){try{a(g);var E=!1}catch(M){E=!0}if(E){E=console;var D=E.error,H=typeof Symbol==="function"&&Symbol.toStringTag&&g[Symbol.toStringTag]||g.constructor.name||"Object";return D.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",H),a(g)}}function u(g){if(g==null)return null;if(typeof g==="function")return g.$$typeof===$n?null:g.displayName||g.name||null;if(typeof g==="string")return g;switch(g){case K:return"Fragment";case re:return"Profiler";case G:return"StrictMode";case xe:return"Suspense";case ke:return"SuspenseList";case Ue:return"Activity"}if(typeof g==="object")switch(typeof g.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),g.$$typeof){case N:return"Portal";case me:return g.displayName||"Context";case ae:return(g._context.displayName||"Context")+".Consumer";case Se:var E=g.render;return g=g.displayName,g||(g=E.displayName||E.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case Ae:return E=g.displayName||null,E!==null?E:u(g.type)||"Memo";case _e:E=g._payload,g=g._init;try{return u(g(E))}catch(D){}}return null}function d(g){if(g===K)return"<>";if(typeof g==="object"&&g!==null&&g.$$typeof===_e)return"<...>";try{var E=u(g);return E?"<"+E+">":"<...>"}catch(D){return"<...>"}}function p(){var g=Le.A;return g===null?null:g.getOwner()}function m(){return Error("react-stack-top-frame")}function h(g){if(uo.call(g,"key")){var E=Object.getOwnPropertyDescriptor(g,"key").get;if(E&&E.isReactWarning)return!1}return g.key!==void 0}function b(g,E){function D(){ls||(ls=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}D.isReactWarning=!0,Object.defineProperty(g,"key",{get:D,configurable:!0})}function y(){var g=u(this.type);return us[g]||(us[g]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),g=this.props.ref,g!==void 0?g:null}function v(g,E,D,H,M,te){var se=D.ref;return g={$$typeof:q,type:g,key:E,props:D,_owner:H},(se!==void 0?se:null)!==null?Object.defineProperty(g,"ref",{enumerable:!1,get:y}):Object.defineProperty(g,"ref",{enumerable:!1,value:null}),g._store={},Object.defineProperty(g._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(g,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(g,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(g,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.freeze&&(Object.freeze(g.props),Object.freeze(g)),g}function x(g,E){return E=v(g.type,E,g.props,g._owner,g._debugStack,g._debugTask),g._store&&(E._store.validated=g._store.validated),E}function _(g){k(g)?g._store&&(g._store.validated=1):typeof g==="object"&&g!==null&&g.$$typeof===_e&&(g._payload.status==="fulfilled"?k(g._payload.value)&&g._payload.value._store&&(g._payload.value._store.validated=1):g._store&&(g._store.validated=1))}function k(g){return typeof g==="object"&&g!==null&&g.$$typeof===q}function O(g){var E={"=":"=0",":":"=2"};return"$"+g.replace(/[=:]/g,function(D){return E[D]})}function L(g,E){return typeof g==="object"&&g!==null&&g.key!=null?(l(g.key),O(""+g.key)):E.toString(36)}function z(g){switch(g.status){case"fulfilled":return g.value;case"rejected":throw g.reason;default:switch(typeof g.status==="string"?g.then(s,s):(g.status="pending",g.then(function(E){g.status==="pending"&&(g.status="fulfilled",g.value=E)},function(E){g.status==="pending"&&(g.status="rejected",g.reason=E)})),g.status){case"fulfilled":return g.value;case"rejected":throw g.reason}}throw g}function J(g,E,D,H,M){var te=typeof g;if(te==="undefined"||te==="boolean")g=null;var se=!1;if(g===null)se=!0;else switch(te){case"bigint":case"string":case"number":se=!0;break;case"object":switch(g.$$typeof){case q:case N:se=!0;break;case _e:return se=g._init,J(se(g._payload),E,D,H,M)}}if(se){se=g,M=M(se);var be=H===""?"."+L(se,0):H;return Or(M)?(D="",be!=null&&(D=be.replace(Ea,"$&/")+"/"),J(M,E,D,"",function(Te){return Te})):M!=null&&(k(M)&&(M.key!=null&&(se&&se.key===M.key||l(M.key)),D=x(M,D+(M.key==null||se&&se.key===M.key?"":(""+M.key).replace(Ea,"$&/")+"/")+be),H!==""&&se!=null&&k(se)&&se.key==null&&se._store&&!se._store.validated&&(D._store.validated=2),M=D),E.push(M)),1}if(se=0,be=H===""?".":H+":",Or(g))for(var fe=0;fe<g.length;fe++)H=g[fe],te=be+L(H,fe),se+=J(H,E,D,te,M);else if(fe=t(g),typeof fe==="function")for(fe===g.entries&&(Qo||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Qo=!0),g=fe.call(g),fe=0;!(H=g.next()).done;)H=H.value,te=be+L(H,fe++),se+=J(H,E,D,te,M);else if(te==="object"){if(typeof g.then==="function")return J(z(g),E,D,H,M);throw E=String(g),Error("Objects are not valid as a React child (found: "+(E==="[object Object]"?"object with keys {"+Object.keys(g).join(", ")+"}":E)+"). If you meant to render a collection of children, use an array instead.")}return se}function P(g,E,D){if(g==null)return g;var H=[],M=0;return J(g,H,"","",function(te){return E.call(D,te,M++)}),H}function W(g){if(g._status===-1){var E=g._ioInfo;E!=null&&(E.start=E.end=performance.now()),E=g._result;var D=E();if(D.then(function(M){if(g._status===0||g._status===-1){g._status=1,g._result=M;var te=g._ioInfo;te!=null&&(te.end=performance.now()),D.status===void 0&&(D.status="fulfilled",D.value=M)}},function(M){if(g._status===0||g._status===-1){g._status=2,g._result=M;var te=g._ioInfo;te!=null&&(te.end=performance.now()),D.status===void 0&&(D.status="rejected",D.reason=M)}}),E=g._ioInfo,E!=null){E.value=D;var H=D.displayName;typeof H==="string"&&(E.name=H)}g._status===-1&&(g._status=0,g._result=D)}if(g._status===1)return E=g._result,E===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
433
433
|
|
|
434
434
|
Your code should look like:
|
|
435
435
|
const MyComponent = lazy(() => import('./MyComponent'))
|
|
@@ -441,9 +441,9 @@ Your code should look like:
|
|
|
441
441
|
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
442
442
|
2. You might be breaking the Rules of Hooks
|
|
443
443
|
3. You might have more than one copy of React in the same app
|
|
444
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),g}function j(){Le.asyncTransitions--}function T(g){if(U===null)try{var E=("require"+Math.random()).slice(0,7);U=(Iy&&Iy[E]).call(Iy,"timers").setImmediate}catch(D){U=function(H){f===!1&&(f=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var M=new MessageChannel;M.port1.onmessage=H,M.port2.postMessage(void 0)}}return U(g)}function Z(g){return 1<g.length&&typeof AggregateError==="function"?AggregateError(g):g[0]}function I(g,E){E!==ne-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),ne=E}function R(g,E,D){var H=Le.actQueue;if(H!==null)if(H.length!==0)try{A(H),T(function(){return R(g,E,D)});return}catch(M){Le.thrownErrors.push(M)}else Le.actQueue=null;0<Le.thrownErrors.length?(H=Z(Le.thrownErrors),Le.thrownErrors.length=0,D(H)):E(g)}function A(g){if(!X){X=!0;var E=0;try{for(;E<g.length;E++){var D=g[E];do{Le.didUsePromise=!1;var H=D(!1);if(H!==null){if(Le.didUsePromise){g[E]=D,g.splice(0,E);return}D=H}else break}while(1)}g.length=0}catch(M){g.splice(0,E+1),Le.thrownErrors.push(M)}finally{X=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var q=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),K=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),re=Symbol.for("react.profiler"),ae=Symbol.for("react.consumer"),me=Symbol.for("react.context"),Se=Symbol.for("react.forward_ref"),xe=Symbol.for("react.suspense"),ke=Symbol.for("react.suspense_list"),Ae=Symbol.for("react.memo"),_e=Symbol.for("react.lazy"),Ue=Symbol.for("react.activity"),De=Symbol.iterator,Qe={},bt={isMounted:function(){return!1},enqueueForceUpdate:function(g){r(g,"forceUpdate")},enqueueReplaceState:function(g){r(g,"replaceState")},enqueueSetState:function(g){r(g,"setState")}},Tt=Object.assign,Dt={};Object.freeze(Dt),o.prototype.isReactComponent={},o.prototype.setState=function(g,E){if(typeof g!=="object"&&typeof g!=="function"&&g!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,g,E,"setState")},o.prototype.forceUpdate=function(g){this.updater.enqueueForceUpdate(this,g,"forceUpdate")};var lt={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(V in lt)lt.hasOwnProperty(V)&&e(V,lt[V]);n.prototype=o.prototype,lt=i.prototype=new n,lt.constructor=i,Tt(lt,o.prototype),lt.isPureReactComponent=!0;var Or=Array.isArray,$n=Symbol.for("react.client.reference"),Le={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},lo=Object.prototype.hasOwnProperty,cs=console.createTask?console.createTask:function(){return null};lt={react_stack_bottom_frame:function(g){return g()}};var ls,_a,us={},On=lt.react_stack_bottom_frame.bind(lt,m)(),Fl=cs(d(m)),Qo=!1,Ea=/\/+/g,Ia=typeof reportError==="function"?reportError:function(g){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var E=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof g==="object"&&g!==null&&typeof g.message==="string"?String(g.message):String(g),error:g});if(!window.dispatchEvent(E))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",g);return}console.error(g)},f=!1,U=null,ne=0,ie=!1,X=!1,w=typeof queueMicrotask==="function"?function(g){queueMicrotask(function(){return queueMicrotask(g)})}:T;lt=Object.freeze({__proto__:null,c:function(g){return ee().useMemoCache(g)}});var V={map:P,forEach:function(g,E,D){P(g,function(){E.apply(this,arguments)},D)},count:function(g){var E=0;return P(g,function(){E++}),E},toArray:function(g){return P(g,function(E){return E})||[]},only:function(g){if(!k(g))throw Error("React.Children.only expected to receive a single React element child.");return g}};Spe.Activity=Ue,Spe.Children=V,Spe.Component=o,Spe.Fragment=K,Spe.Profiler=re,Spe.PureComponent=i,Spe.StrictMode=G,Spe.Suspense=xe,Spe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Le,Spe.__COMPILER_RUNTIME=lt,Spe.act=function(g){var E=Le.actQueue,D=ne;ne++;var H=Le.actQueue=E!==null?E:[],M=!1;try{var te=g()}catch(fe){Le.thrownErrors.push(fe)}if(0<Le.thrownErrors.length)throw I(E,D),g=Z(Le.thrownErrors),Le.thrownErrors.length=0,g;if(te!==null&&typeof te==="object"&&typeof te.then==="function"){var se=te;return w(function(){M||ie||(ie=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(fe,Te){M=!0,se.then(function(ze){if(I(E,D),D===0){try{A(H),T(function(){return R(ze,fe,Te)})}catch(ds){Le.thrownErrors.push(ds)}if(0<Le.thrownErrors.length){var Cn=Z(Le.thrownErrors);Le.thrownErrors.length=0,Te(Cn)}}else fe(ze)},function(ze){I(E,D),0<Le.thrownErrors.length?(ze=Z(Le.thrownErrors),Le.thrownErrors.length=0,Te(ze)):Te(ze)})}}}var be=te;if(I(E,D),D===0&&(A(H),H.length!==0&&w(function(){M||ie||(ie=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),Le.actQueue=null),0<Le.thrownErrors.length)throw g=Z(Le.thrownErrors),Le.thrownErrors.length=0,g;return{then:function(fe,Te){M=!0,D===0?(Le.actQueue=H,T(function(){return R(be,fe,Te)})):fe(be)}}},Spe.cache=function(g){return function(){return g.apply(null,arguments)}},Spe.cacheSignal=function(){return null},Spe.captureOwnerStack=function(){var g=Le.getCurrentStack;return g===null?null:g()},Spe.cloneElement=function(g,E,D){if(g===null||g===void 0)throw Error("The argument must be a React element, but you passed "+g+".");var H=Tt({},g.props),M=g.key,te=g._owner;if(E!=null){var se;e:{if(lo.call(E,"ref")&&(se=Object.getOwnPropertyDescriptor(E,"ref").get)&&se.isReactWarning){se=!1;break e}se=E.ref!==void 0}se&&(te=p()),h(E)&&(l(E.key),M=""+E.key);for(be in E)!lo.call(E,be)||be==="key"||be==="__self"||be==="__source"||be==="ref"&&E.ref===void 0||(H[be]=E[be])}var be=arguments.length-2;if(be===1)H.children=D;else if(1<be){se=Array(be);for(var fe=0;fe<be;fe++)se[fe]=arguments[fe+2];H.children=se}H=v(g.type,M,H,te,g._debugStack,g._debugTask);for(M=2;M<arguments.length;M++)_(arguments[M]);return H},Spe.createContext=function(g){return g={$$typeof:me,_currentValue:g,_currentValue2:g,_threadCount:0,Provider:null,Consumer:null},g.Provider=g,g.Consumer={$$typeof:ae,_context:g},g._currentRenderer=null,g._currentRenderer2=null,g},Spe.createElement=function(g,E,D){for(var H=2;H<arguments.length;H++)_(arguments[H]);H={};var M=null;if(E!=null)for(fe in _a||!("__self"in E)||"key"in E||(_a=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),h(E)&&(l(E.key),M=""+E.key),E)lo.call(E,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(H[fe]=E[fe]);var te=arguments.length-2;if(te===1)H.children=D;else if(1<te){for(var se=Array(te),be=0;be<te;be++)se[be]=arguments[be+2];Object.freeze&&Object.freeze(se),H.children=se}if(g&&g.defaultProps)for(fe in te=g.defaultProps,te)H[fe]===void 0&&(H[fe]=te[fe]);M&&b(H,typeof g==="function"?g.displayName||g.name||"Unknown":g);var fe=1e4>Le.recentlyCreatedOwnerStacks++;return v(g,M,H,p(),fe?Error("react-stack-top-frame"):On,fe?cs(d(g)):Fl)},Spe.createRef=function(){var g={current:null};return Object.seal(g),g},Spe.forwardRef=function(g){g!=null&&g.$$typeof===Ae?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof g!=="function"?console.error("forwardRef requires a render function but was given %s.",g===null?"null":typeof g):g.length!==0&&g.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",g.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),g!=null&&g.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var E={$$typeof:Se,render:g},D;return Object.defineProperty(E,"displayName",{enumerable:!1,configurable:!0,get:function(){return D},set:function(H){D=H,g.name||g.displayName||(Object.defineProperty(g,"name",{value:H}),g.displayName=H)}}),E},Spe.isValidElement=k,Spe.lazy=function(g){g={_status:-1,_result:g};var E={$$typeof:_e,_payload:g,_init:W},D={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return g._ioInfo=D,E._debugInfo=[{awaited:D}],E},Spe.memo=function(g,E){g==null&&console.error("memo: The first argument must be a component. Instead received: %s",g===null?"null":typeof g),E={$$typeof:Ae,type:g,compare:E===void 0?null:E};var D;return Object.defineProperty(E,"displayName",{enumerable:!1,configurable:!0,get:function(){return D},set:function(H){D=H,g.name||g.displayName||(Object.defineProperty(g,"name",{value:H}),g.displayName=H)}}),E},Spe.startTransition=function(g){var E=Le.T,D={};D._updatedFibers=new Set,Le.T=D;try{var H=g(),M=Le.S;M!==null&&M(D,H),typeof H==="object"&&H!==null&&typeof H.then==="function"&&(Le.asyncTransitions++,H.then(j,j),H.then(s,Ia))}catch(te){Ia(te)}finally{E===null&&D._updatedFibers&&(g=D._updatedFibers.size,D._updatedFibers.clear(),10<g&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),E!==null&&D.types!==null&&(E.types!==null&&E.types!==D.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),E.types=D.types),Le.T=E}},Spe.unstable_useCacheRefresh=function(){return ee().useCacheRefresh()},Spe.use=function(g){return ee().use(g)},Spe.useActionState=function(g,E,D){return ee().useActionState(g,E,D)},Spe.useCallback=function(g,E){return ee().useCallback(g,E)},Spe.useContext=function(g){var E=ee();return g.$$typeof===ae&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),E.useContext(g)},Spe.useDebugValue=function(g,E){return ee().useDebugValue(g,E)},Spe.useDeferredValue=function(g,E){return ee().useDeferredValue(g,E)},Spe.useEffect=function(g,E){return g==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),ee().useEffect(g,E)},Spe.useEffectEvent=function(g){return ee().useEffectEvent(g)},Spe.useId=function(){return ee().useId()},Spe.useImperativeHandle=function(g,E,D){return ee().useImperativeHandle(g,E,D)},Spe.useInsertionEffect=function(g,E){return g==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),ee().useInsertionEffect(g,E)},Spe.useLayoutEffect=function(g,E){return g==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),ee().useLayoutEffect(g,E)},Spe.useMemo=function(g,E){return ee().useMemo(g,E)},Spe.useOptimistic=function(g,E){return ee().useOptimistic(g,E)},Spe.useReducer=function(g,E,D){return ee().useReducer(g,E,D)},Spe.useRef=function(g){return ee().useRef(g)},Spe.useState=function(g){return ee().useState(g)},Spe.useSyncExternalStore=function(g,E,D){return ee().useSyncExternalStore(g,E,D)},Spe.useTransition=function(){return ee().useTransition()},Spe.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var vq,wq;var jR=S(()=>{vq=Jl(ZR(),1),wq=vq.createContext(void 0)});var vpe;var xq=S(()=>{NR();Sq();jR();de();vpe=Jl(ZR(),1)});var wpe,xpe;var _q=S(()=>{wt();de();CR();wpe=nl.omit({url:!0,analyticsScript:!0}),xpe=wpe.extend({title:c.string().optional().describe("Optional site title override"),description:c.string().optional().describe("Optional site description override")})});function BR(e,t={}){let r=Eq(e),o=Eq(t.sharedDomain??"rizom.ai").replace(/^\./,""),n=`.${o}`;if(r.endsWith(n)){let i=r.slice(0,-n.length);if(i.length>0&&!i.includes("."))return`${i}-preview.${o}`}return`preview.${r}`}function Eq(e){return e.trim().replace(/^https?:\/\//i,"").replace(/\/$/,"").toLowerCase()}var Iq=S(()=>{bg()});var Ipe,Ape;var Aq=S(()=>{de();hy();DR();Ipe=c.string(),Ape=c.custom((e)=>Vs(e)&&ZM.safeParse(e).success)});var kpe;var kq=S(()=>{bg();de();kpe=c.object({title:c.string().min(1),slug:c.string().min(1),description:c.string(),content:c.string(),author:c.string(),publishedAt:c.iso.datetime({offset:!0}),category:c.string().min(1).optional()})});var Rq=S(()=>{OR();GM();CR();dq();DR();xq();_q();Iq();Aq();jR();kq()});function Tq(e,t={}){return BR(e,t)}var $q=S(()=>{Rq()});var Dq={};Lt(Dq,{assertPilotUsersRemoved:()=>Nq,createPilotOffboardDriver:()=>Cq,offboardPilotUsers:()=>Cpe});import{readdir as Rpe,readFile as Tpe,rm as pp,writeFile as $pe}from"fs/promises";import{basename as Ope,join as Do}from"path";async function Cpe(e,t){let r=[...new Set(t.handles.map((p)=>br.parse(p)))].sort((p,m)=>p.localeCompare(m));if(r.length===0)throw Error("At least one pilot handle is required");let o=t.dryRun??!0,n=`sunset:${r.join(",")}`;if(!o&&t.confirmation!==n)throw Error(`Exact confirmation required: ${n}`);let i=t.env??process.env,s=t.logger??console.info,a=await xt(e),l=r.map((p)=>Ppe(a,p,i)),u=t.driver??Cq({env:i,fetchImpl:t.fetchImpl,contentRepoTokenName:a.pilot.contentRepoAdminToken}),d=await Promise.all(l.map(async(p)=>({target:p,inspection:await u.inspect(p)})));if(Npe(d),Dpe(d,o,s),!o){for(let p of d)if(!p.inspection.contentRepoArchived)await u.archiveContentRepo(p.target),s(`[${p.target.handle}] archived ${p.target.contentRepo}`);for(let p of d)for(let m of p.inspection.dnsRecords)await u.deleteDnsRecord(p.target,m),s(`[${p.target.handle}] deleted DNS ${m.name}`);for(let p of d)if(p.inspection.server)await u.deleteServer(p.target,p.inspection.server),s(`[${p.target.handle}] deleted ${p.target.instanceName}`);await zpe(l,u,t.sleep??((p)=>new Promise((m)=>setTimeout(m,p)))),await Lpe(e,r),await Pi(e),await Nq(e,r),s(`Removed desired state for ${r.length} pilot user(s)`)}return{dryRun:o,handles:r,confirmation:n,plans:d}}function Ppe(e,t,r){let o=e.users.find((d)=>d.handle===t),n=`${t}${e.pilot.domainSuffix}`,i=o?.domain??n,s=Tq(i,{sharedDomain:e.pilot.domainSuffix}),a=o?.cloudflareZoneId??Ay(r,"CF_ZONE_ID"),l=o?.contentRepo??`${e.pilot.contentRepoPrefix}${t}-content`,u=l.includes("/")?l:`${e.pilot.githubOrg}/${l}`;return{handle:t,instanceName:`rover-${t}`,domain:i,previewDomain:s,...i===n?{}:{wwwDomain:`www.${i}`},contentRepo:u,cloudflareZoneId:a}}async function zpe(e,t,r){for(let o of e)for(let n=1;n<=20;n+=1){let i=await t.inspect(o);if(!i.server&&i.dnsRecords.length===0&&i.contentRepoArchived)break;if(n===20)throw Error(`[${o.handle}] provider cleanup did not converge`);await r(1500)}}function Npe(e){for(let{target:t,inspection:r}of e){if(r.server&&r.server.name!==t.instanceName)throw Error(`[${t.handle}] unexpected server name: ${r.server.name}`);let o=new Set([t.domain,t.previewDomain,...t.wwwDomain?[t.wwwDomain]:[]]);for(let n of r.dnsRecords){if(!o.has(n.name))throw Error(`[${t.handle}] refusing unexpected DNS record ${n.name}`);if(n.type==="A"&&r.server?.ip&&n.content!==r.server.ip)throw Error(`[${t.handle}] ${n.name} does not point to the retiring server`)}}}function Dpe(e,t,r){r(`${t?"Dry run":"Apply"}: ${e.map(({target:o})=>o.handle).join(", ")}`);for(let{target:o,inspection:n}of e){let i=n.server?`delete ${o.instanceName}`:"already absent",s=n.dnsRecords.length>0?n.dnsRecords.map((l)=>`${l.type} ${l.name}`).join(", "):"already absent",a=n.contentRepoArchived?"already archived":`archive ${o.contentRepo}`;r(`[${o.handle}] server: ${i}; DNS: ${s}; repo: ${a}`)}r("Runtime backups: none")}async function Lpe(e,t){let r=new Set(t),o=Do(e,"cohorts");for(let n of(await Rpe(o)).filter((i)=>i.endsWith(".yaml"))){let i=Do(o,n),s=await Tpe(i,"utf8"),a=tn(s);if(a.errors.length>0)throw Error(`${n}: ${a.errors[0]?.message??"invalid YAML"}`);let l=a.get("members",!0);if(!_R(l))throw Error(`${n}: members must be a sequence`);let u=l.items.filter((d)=>!Po(d)||typeof d.value!=="string"||!r.has(d.value));if(u.length===l.items.length)continue;if(u.length===0){await pp(i);continue}l.items=u,hn.parse(a.toJS()),await $pe(i,a.toString())}for(let n of t)await Promise.all([pp(Do(e,"users",`${n}.yaml`),{force:!0}),pp(Do(e,"users",`${n}.secrets.yaml`),{force:!0}),pp(Do(e,"users",`${n}.secrets.yaml.age`),{force:!0}),pp(Do(e,"users",n),{recursive:!0,force:!0})])}function Cq(e){let t=e.fetchImpl??fetch,r=Ay(e.env,"HCLOUD_TOKEN"),o=Ay(e.env,"CF_API_TOKEN"),n=Ay(e.env,e.contentRepoTokenName);return{async inspect(i){let[s,a,l]=await Promise.all([Zpe(t,r,i.instanceName),Promise.all([i.domain,i.previewDomain,...i.wwwDomain?[i.wwwDomain]:[]].map((u)=>jpe(t,o,i.cloudflareZoneId,u))).then((u)=>u.flat()),Bpe(t,n,i.contentRepo)]);if(s.length>1)throw Error(`[${i.handle}] expected at most one server, found ${s.length}`);return{...s[0]?{server:s[0]}:{},dnsRecords:a,contentRepoArchived:l.archived}},async archiveContentRepo(i){await il(t,`https://api.github.com/repos/${i.contentRepo}`,{method:"PATCH",headers:Pq(n),body:JSON.stringify({archived:!0})},"GitHub repository archive")},async deleteDnsRecord(i,s){if(sl(await il(t,`https://api.cloudflare.com/client/v4/zones/${i.cloudflareZoneId}/dns_records/${s.id}`,{method:"DELETE",headers:zq(o)},"Cloudflare DNS delete")).success!==!0)throw Error(`Cloudflare DNS delete failed for ${s.name}`)},async deleteServer(i,s){await il(t,`https://api.hetzner.cloud/v1/servers/${s.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}},"Hetzner server delete",!0)}}}async function Zpe(e,t,r){let o=new URL("https://api.hetzner.cloud/v1/servers");o.searchParams.set("label_selector",`brain=${r}`);let i=sl(await il(e,o.toString(),{headers:{Authorization:`Bearer ${t}`}},"Hetzner server lookup")).servers;if(!Array.isArray(i))throw Error("Hetzner server lookup returned an invalid payload");return i.map((s)=>{let a=sl(s),l=Oq(a.public_net),u=Oq(l?.ipv4);return{id:Upe(a.id,"Hetzner server id"),name:fp(a.name,"Hetzner server name"),...typeof u?.ip==="string"?{ip:u.ip}:{}}})}async function jpe(e,t,r,o){let n=new URL(`https://api.cloudflare.com/client/v4/zones/${r}/dns_records`);n.searchParams.set("name",o);let i=sl(await il(e,n.toString(),{headers:zq(t)},"Cloudflare DNS lookup")),s=i.result;if(i.success!==!0||!Array.isArray(s))throw Error(`Cloudflare DNS lookup failed for ${o}`);return s.map((a)=>{let l=sl(a),u=fp(l.type,"Cloudflare record type");if(u!=="A"&&u!=="CNAME")throw Error(`Unsupported Cloudflare record type ${u} for ${o}`);return{id:fp(l.id,"Cloudflare record id"),name:fp(l.name,"Cloudflare record name"),type:u,content:fp(l.content,"Cloudflare record content")}})}async function Bpe(e,t,r){let o=sl(await il(e,`https://api.github.com/repos/${r}`,{headers:Pq(t)},"GitHub repository lookup"));if(typeof o.archived!=="boolean")throw Error(`Invalid repository archive state for ${r}`);return{archived:o.archived}}async function il(e,t,r,o,n=!1){let i=await e(t,r),s=await i.text();if(!i.ok)throw Error(`${o} failed (${i.status}): ${s}`);if(!s&&n)return{};try{return JSON.parse(s)}catch{throw Error(`${o} returned an invalid JSON response`)}}function Pq(e){return{Accept:"application/vnd.github+json",Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"}}function zq(e){return{Authorization:`Bearer ${e}`}}function Ay(e,t){let r=e[t];if(!r)throw Error(`Missing required environment variable: ${t}`);return r}function sl(e){if(!Vs(e))throw Error("Provider returned an unexpected payload");return e}function Oq(e){return Vs(e)?e:void 0}function fp(e,t){if(typeof e!=="string"||e.length===0)throw Error(`Missing ${t}`);return e}function Upe(e,t){if(typeof e!=="number")throw Error(`Missing ${t}`);return e}async function Nq(e,t){for(let r of t)for(let o of[Do(e,"users",`${r}.yaml`),Do(e,"users",`${r}.secrets.yaml.age`),Do(e,"users",r)])if(await Ar(o))throw Error(`Offboarded user state remains: ${Ope(o)}`)}var Lq=S(()=>{el();gn();$q();Pd();To();Ys()});var Zq="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";import{webcrypto as jq}from"crypto";function qpe(e){if(e<0)throw RangeError("Wrong ID size");try{if(!Fi||Fi.length<e)Fi=Buffer.allocUnsafe(e*Mpe),jq.getRandomValues(Fi),al=0;else if(al+e>Fi.length)jq.getRandomValues(Fi),al=0}catch(t){throw Fi=void 0,t}al+=e}function Bq(e=21){qpe(e|=0);let t="";for(let r=al-e;r<al;r++)t+=Zq[Fi[r]&63];return t}var Mpe=128,Fi,al;var Uq=()=>{};function Lo(e=12){return Bq(e)}var mp=S(()=>{Uq()});import{openSync as Fpe,writeSync as Hpe}from"fs";function Jpe(e){return cl?`[${cl}] ${e}`:e}class Rr{static instance=null;level;context;useStderr;format;logFile;fileHandle;constructor(e={},t){if(this.level=e.level??aa.INFO,this.context=e.context??void 0,this.useStderr=e.useStderr??!1,this.format=e.format??"text",this.logFile=e.logFile,t!==void 0)this.fileHandle=t;else if(this.logFile)try{this.fileHandle=Fpe(this.logFile,"a")}catch{}}static getInstance(e){if(!Rr.instance)Rr.instance=new Rr(e);else{if(e?.useStderr!==void 0)Rr.instance.useStderr=e.useStderr;if(e?.level!==void 0)Rr.instance.level=e.level}return Rr.instance}static resetInstance(){Rr.instance=null,cl=void 0}static setProcessRole(e){cl=e}static createFresh(e){return new Rr(e)}formatEntry(e,t,r){if(this.format==="json")return this.formatJsonEntry(e,t,r);return Jpe([`[${new Date().toISOString()}]`,...this.context?[`[${this.context}]`]:[],t].join(" "))}write(e,t,r,o){if(this.format==="json")e(this.formatEntry(t,r,o));else if(o.length>0)e(this.formatEntry(t,r,[]),...o);else e(this.formatEntry(t,r,[]));if(this.fileHandle!==void 0){let n=this.formatJsonEntry(t,r,o);try{Hpe(this.fileHandle,n+`
|
|
445
|
-
`)}catch{}}}formatJsonEntry(e,t,r){let o={ts:new Date().toISOString(),level:e,...cl&&{role:cl},msg:t};if(this.context)o.ctx=this.context;if(r.length>0)o.data=r;return JSON.stringify(o)}debugStream(){return this.useStderr?console.error.bind(console):console.debug.bind(console)}silly(e,...t){if(this.level<=aa.SILLY)this.write(this.debugStream(),"silly",e,t)}verbose(e,...t){if(this.level<=aa.VERBOSE)this.write(this.debugStream(),"verbose",e,t)}debug(e,...t){if(this.level<=aa.DEBUG)this.write(this.debugStream(),"debug",e,t)}info(e,...t){if(this.level<=aa.INFO){let r=this.useStderr?console.error.bind(console):console.info.bind(console);this.write(r,"info",e,t)}}warn(e,...t){if(this.level<=aa.WARN)this.write(console.warn.bind(console),"warn",e,t)}error(e,...t){if(this.level<=aa.ERROR)this.write(console.error.bind(console),"error",e,t)}child(e){return new Rr({level:this.level,context:e,useStderr:this.useStderr,format:this.format},this.fileHandle)}setUseStderr(e){this.useStderr=e}}var aa,cl,yLe;var UR=S(()=>{aa={SILLY:0,VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};yLe=Rr.getInstance()});var MR,Kpe,ll,wLe;var hp=S(()=>{wt();de();MR=c.enum(["file_operations","content_operations","data_processing","batch_processing"]),Kpe=c.looseObject({pluginId:c.string().optional(),progressToken:c.union([c.string(),c.number()]).optional(),operationType:MR,operationTarget:c.string().optional(),interfaceType:c.string().optional(),interfaceId:c.string().optional(),conversationId:c.string().optional(),channelId:c.string().optional(),requestedByActor:Wn.optional(),requestedByUserId:c.string().optional(),requestedByInterface:c.string().optional(),silent:c.boolean().optional(),provenance:Ro.optional()}),ll=c.looseObject({pluginId:c.string().optional(),progressToken:c.union([c.string(),c.number()]).optional(),operationType:MR,operationTarget:c.string().optional(),interfaceType:c.string().optional(),interfaceId:c.string().optional(),conversationId:c.string().optional(),channelId:c.string().optional(),requestedByActor:Wn.optional(),requestedByUserId:c.string().optional(),requestedByInterface:c.string().optional(),silent:c.boolean().optional(),provenance:Ro.optional(),rootJobId:c.string()}),wLe=c.enum(["none","skip","replace","coalesce"])});var Vpe,Hi=15000;var gp=S(()=>{hp();de();Vpe=c.object({id:c.string(),type:c.string(),data:c.string(),status:c.enum(["pending","processing","completed","failed"]),source:c.string().nullable(),priority:c.number(),retryCount:c.number(),maxRetries:c.number(),lastError:c.string().nullable(),lastErrorPublic:c.unknown(),createdAt:c.number(),scheduledFor:c.number(),startedAt:c.number().nullable(),completedAt:c.number().nullable(),attemptId:c.string().nullable(),workerSlotId:c.string().nullable(),workerSessionId:c.string().nullable(),leaseExpiresAt:c.number().nullable(),attemptHeartbeatAt:c.number().nullable(),runtimeUpdatedAt:c.number().nullable(),metadata:ll,progress:c.custom((e)=>typeof e==="object"&&e!==null&&("progress"in e)&&typeof e.progress==="number").nullable(),result:c.unknown().nullable().optional()})});var qR,Mq,Oe,Wpe,Gpe,qq,Fq,Hq;var Zo=S(()=>{wt();de();hp();qR=c.enum(["pending","processing","completed","failed"]),Mq=c.enum(["completed","failed"]),Oe={PENDING:"pending",PROCESSING:"processing",COMPLETED:"completed",FAILED:"failed"},Wpe=c.object({id:c.string(),type:c.string(),status:qR,data:c.unknown(),result:c.unknown().optional(),lastError:c.string().optional().nullable(),attempts:c.number(),maxRetries:c.number(),priority:c.number(),createdAt:c.date(),updatedAt:c.date(),processedAt:c.date().optional().nullable(),completedAt:c.date().optional().nullable(),failedAt:c.date().optional().nullable()}),Gpe=c.object({jobId:c.string(),type:c.string(),status:Mq,result:c.unknown().optional(),error:c.string().optional()}),qq=c.object({success:c.literal(!1),error:c.string().optional()}),Fq=c.object({id:c.string(),type:c.enum(["job","batch"]),status:qR,message:c.string().optional(),progress:c.object({current:c.number(),total:c.number(),percentage:c.number()}).optional(),aggregationKey:c.string().optional(),batchDetails:c.object({totalOperations:c.number(),completedOperations:c.number(),failedOperations:c.number(),currentOperation:c.string().optional(),errors:c.array(c.string()).optional()}).optional(),jobDetails:c.object({jobType:c.string(),priority:c.number(),retryCount:c.number()}).optional(),metadata:ll}),Hq=Gn(NA.progress,Fq)});var Ce,Wt;var wn=S(()=>{Ce=class Ce extends Error{code;extendedCode;rawCode;constructor(e,t,r,o,n){if(t!==void 0)e=`${t}: ${e}`;super(e,{cause:n});this.code=t,this.extendedCode=r,this.rawCode=o,this.name="LibsqlError"}};Wt=class Wt extends Ce{statementIndex;constructor(e,t,r,o,n,i){super(e,r,o,n,i);this.statementIndex=t,this.name="LibsqlBatchError"}}});function Jq(e){let t=Qpe.exec(e);if(t===null)throw new Ce(`The URL '${e}' is not in a valid format`,"URL_INVALID");let r=t.groups,o=r.scheme,n=r.authority!==void 0?Ype(r.authority):void 0,i=ca(r.path),s=r.query!==void 0?efe(r.query):void 0,a=r.fragment!==void 0?ca(r.fragment):void 0;return{scheme:o,authority:n,path:i,query:s,fragment:a}}function Ype(e){let t=Xpe.exec(e);if(t===null)throw new Ce("The authority part of the URL is not in a valid format","URL_INVALID");let r=t.groups,o=ca(r.host_br??r.host),n=r.port?parseInt(r.port,10):void 0,i=r.username!==void 0?{username:ca(r.username),password:r.password!==void 0?ca(r.password):void 0}:void 0;return{host:o,port:n,userinfo:i}}function efe(e){let t=e.split("&"),r=[];for(let o of t){if(o==="")continue;let n,i,s=o.indexOf("=");if(s<0)n=o,i="";else n=o.substring(0,s),i=o.substring(s+1);r.push({key:ca(n.replaceAll("+"," ")),value:ca(i.replaceAll("+"," "))})}return{pairs:r}}function ca(e){try{return decodeURIComponent(e)}catch(t){if(t instanceof URIError)throw new Ce(`URL component has invalid percent encoding: ${t}`,"URL_INVALID",void 0,void 0,t);throw t}}function yp(e,t,r){if(t===void 0)throw new Ce(`URL with scheme ${JSON.stringify(e+":")} requires authority (the "//" part)`,"URL_INVALID");let o=`${e}:`,n=tfe(t.host),i=rfe(t.port),a=`//${nfe(t.userinfo)}${n}${i}`,l=r.split("/").map(encodeURIComponent).join("/");if(l!==""&&!l.startsWith("/"))l="/"+l;return new URL(`${o}${a}${l}`)}function tfe(e){return e.includes(":")?`[${encodeURI(e)}]`:encodeURI(e)}function rfe(e){return e!==void 0?`:${e}`:""}function nfe(e){if(e===void 0)return"";let t=encodeURIComponent(e.username),r=e.password!==void 0?`:${encodeURIComponent(e.password)}`:"";return`${t}${r}@`}var Qpe,Xpe;var ky=S(()=>{wn();Qpe=(()=>new RegExp("^(?<scheme>[A-Za-z][A-Za-z.+-]*):(//(?<authority>[^/?#]*))?(?<path>[^?#]*)(\\?(?<query>[^#]*))?(#(?<fragment>.*))?$","su"))();Xpe=(()=>new RegExp("^((?<username>[^:]*)(:(?<password>.*))?@)?((?<host>[^:\\[\\]]*)|(\\[(?<host_br>[^\\[\\]]*)\\]))(:(?<port>[0-9]*))?$","su"))()});var dl,Kq,Vq,bp,Ry,ofe,Gt,Wq,Yq=(e)=>e.replace(/=/g,"").replace(/[+\/]/g,(t)=>t=="+"?"-":"_"),Xq=(e)=>e.replace(/[^A-Za-z0-9\+\/]/g,""),e4=(e)=>{let t,r,o,n,i="",s=e.length%3;for(let a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255)throw TypeError("invalid character found");t=r<<16|o<<8|n,i+=bp[t>>18&63]+bp[t>>12&63]+bp[t>>6&63]+bp[t&63]}return s?i.slice(0,s-3)+"===".substring(s):i},JR,FR,Ty=(e,t=!1)=>t?Yq(FR(e)):FR(e),ife=(e)=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?Gt(192|t>>>6)+Gt(128|t&63):Gt(224|t>>>12&15)+Gt(128|t>>>6&63)+Gt(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return Gt(240|t>>>18&7)+Gt(128|t>>>12&63)+Gt(128|t>>>6&63)+Gt(128|t&63)}},sfe,t4=(e)=>e.replace(sfe,ife),Gq,ul=(e,t=!1)=>t?Yq(Gq(e)):Gq(e),Qq=(e)=>ul(e,!0),afe,cfe=(e)=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return Gt((r>>>10)+55296)+Gt((r&1023)+56320);case 3:return Gt((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Gt((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},r4=(e)=>e.replace(afe,cfe),n4=(e)=>{if(e=e.replace(/\s+/g,""),!ofe.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r,o,n=[];for(let i=0;i<e.length;)if(t=Ry[e.charAt(i++)]<<18|Ry[e.charAt(i++)]<<12|(r=Ry[e.charAt(i++)])<<6|(o=Ry[e.charAt(i++)]),r===64)n.push(Gt(t>>16&255));else if(o===64)n.push(Gt(t>>16&255,t>>8&255));else n.push(Gt(t>>16&255,t>>8&255,t&255));return n.join("")},KR,o4,i4=(e)=>o4(s4(e)),lfe,s4=(e)=>Xq(e.replace(/[-_]/g,(t)=>t=="-"?"+":"/")),HR=(e)=>lfe(s4(e)),ufe=(e)=>{if(typeof e!=="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},a4=(e)=>({value:e,enumerable:!1,writable:!0,configurable:!0}),c4=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,a4(r));e("fromBase64",function(){return HR(this)}),e("toBase64",function(t){return ul(this,t)}),e("toBase64URI",function(){return ul(this,!0)}),e("toBase64URL",function(){return ul(this,!0)}),e("toUint8Array",function(){return i4(this)})},l4=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,a4(r));e("toBase64",function(t){return Ty(this,t)}),e("toBase64URI",function(){return Ty(this,!0)}),e("toBase64URL",function(){return Ty(this,!0)})},dfe=()=>{c4(),l4()},pl;var $y=S(()=>{dl=typeof Buffer==="function",Kq=typeof TextDecoder==="function"?new TextDecoder("utf-8",{ignoreBOM:!0}):void 0,Vq=typeof TextEncoder==="function"?new TextEncoder:void 0,bp=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Ry=((e)=>{let t={};return e.forEach((r,o)=>t[r]=o),t})(bp),ofe=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Gt=String.fromCharCode.bind(String),Wq=typeof Uint8Array.from==="function"?Uint8Array.from.bind(Uint8Array):(e)=>new Uint8Array(Array.prototype.slice.call(e,0)),JR=typeof btoa==="function"?(e)=>btoa(e):dl?(e)=>Buffer.from(e,"binary").toString("base64"):e4,FR=dl?(e)=>Buffer.from(e).toString("base64"):(e)=>{let r=[];for(let o=0,n=e.length;o<n;o+=4096)r.push(Gt.apply(null,e.subarray(o,o+4096)));return JR(r.join(""))},sfe=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gq=dl?(e)=>Buffer.from(e,"utf8").toString("base64"):Vq?(e)=>FR(Vq.encode(e)):(e)=>JR(t4(e)),afe=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,KR=typeof atob==="function"?(e)=>atob(Xq(e)):dl?(e)=>Buffer.from(e,"base64").toString("binary"):n4,o4=dl?(e)=>Wq(Buffer.from(e,"base64")):(e)=>Wq(KR(e).split("").map((t)=>t.charCodeAt(0))),lfe=dl?(e)=>Buffer.from(e,"base64").toString("utf8"):Kq?(e)=>Kq.decode(o4(e)):(e)=>r4(KR(e)),pl={version:"3.8.0",VERSION:"3.8.0",atob:KR,atobPolyfill:n4,btoa:JR,btoaPolyfill:e4,fromBase64:HR,toBase64:ul,encode:ul,encodeURI:Qq,encodeURL:Qq,utob:t4,btou:r4,decode:HR,isValid:ufe,fromUint8Array:Ty,toUint8Array:i4,extendString:c4,extendUint8Array:l4,extendBuiltins:dfe}});function Ji(e){if(e==="write")return"BEGIN IMMEDIATE";else if(e==="read")return"BEGIN TRANSACTION READONLY";else if(e==="deferred")return"BEGIN DEFERRED";else throw RangeError('Unknown transaction mode, supported values are "write", "read" and "deferred"')}class fl{columns;columnTypes;rows;rowsAffected;lastInsertRowid;constructor(e,t,r,o,n){this.columns=e,this.columnTypes=t,this.rows=r,this.rowsAffected=o,this.lastInsertRowid=n}toJSON(){return{columns:this.columns,columnTypes:this.columnTypes,rows:this.rows.map(pfe),rowsAffected:this.rowsAffected,lastInsertRowid:this.lastInsertRowid!==void 0?""+this.lastInsertRowid:null}}}function pfe(e){return Array.prototype.map.call(e,ffe)}function ffe(e){if(typeof e==="bigint")return""+e;else if(e instanceof ArrayBuffer)return pl.fromUint8Array(new Uint8Array(e));else return e}var to="https://github.com/libsql/libsql-client-ts#supported-urls";var ml=S(()=>{$y()});function d4(e){return e.scheme==="file"&&(e.path===":memory:"||e.path.startsWith(":memory:?"))}function Sp(e,t){if(typeof e!=="object")throw TypeError(`Expected client configuration as object, got ${typeof e}`);let{url:r,authToken:o,tls:n,intMode:i,concurrency:s}=e;s=Math.max(0,s||20),i??="number";let a=[];if(r===u4)r="file::memory:";let l=Jq(r),u=l.scheme.toLowerCase(),d=u==="file"&&l.path===u4&&l.authority===void 0,p;if(d)p={cache:{values:["shared","private"],update:(y,v)=>a.push(`${y}=${v}`)}};else p={tls:{values:["0","1"],update:(y,v)=>n=v==="1"},authToken:{update:(y,v)=>o=v}};for(let{key:y,value:v}of l.query?.pairs??[]){if(!Object.hasOwn(p,y))throw new Ce(`Unsupported URL query parameter ${JSON.stringify(y)}`,"URL_PARAM_NOT_SUPPORTED");let x=p[y];if(x.values!==void 0&&!x.values.includes(v))throw new Ce(`Unknown value for the "${y}" query argument: ${JSON.stringify(v)}. Supported values are: [${x.values.map((_)=>'"'+_+'"').join(", ")}]`,"URL_INVALID");if(x.update!==void 0)x?.update(y,v)}let m=a.length===0?"":`?${a.join("&")}`,h=l.path+m,b;if(u==="libsql")if(n===!1){if(l.authority?.port===void 0)throw new Ce('A "libsql:" URL with ?tls=0 must specify an explicit port',"URL_INVALID");b=t?"http":"ws"}else b=t?"https":"wss";else b=u;if(b==="http"||b==="ws")n??=!1;else n??=!0;if(b!=="http"&&b!=="ws"&&b!=="https"&&b!=="wss"&&b!=="file")throw new Ce(`The client supports only "libsql:", "wss:", "ws:", "https:", "http:" and "file:" URLs, got ${JSON.stringify(l.scheme+":")}. For more information, please read ${to}`,"URL_SCHEME_NOT_SUPPORTED");if(i!=="number"&&i!=="bigint"&&i!=="string")throw TypeError(`Invalid value for intMode, expected "number", "bigint" or "string", got ${JSON.stringify(i)}`);if(l.fragment!==void 0)throw new Ce(`URL fragments are not supported: ${JSON.stringify("#"+l.fragment)}`,"URL_INVALID");if(d)return{scheme:"file",tls:!1,path:h,intMode:i,concurrency:s,syncUrl:e.syncUrl,syncInterval:e.syncInterval,readYourWrites:e.readYourWrites,offline:e.offline,fetch:e.fetch,timeout:e.timeout,authToken:void 0,encryptionKey:void 0,remoteEncryptionKey:void 0,authority:void 0};return{scheme:b,tls:n,authority:l.authority,path:h,authToken:o,intMode:i,concurrency:s,encryptionKey:e.encryptionKey,remoteEncryptionKey:e.remoteEncryptionKey,syncUrl:e.syncUrl,syncInterval:e.syncInterval,readYourWrites:e.readYourWrites,offline:e.offline,fetch:e.fetch,timeout:e.timeout}}var u4=":memory:";var vp=S(()=>{wn();ky();ml()});var f4=ge(function(rn){var mfe=rn&&rn.__createBinding||(Object.create?function(e,t,r,o){if(o===void 0)o=r;var n=Object.getOwnPropertyDescriptor(t,r);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable))n={enumerable:!0,get:function(){return t[r]}};Object.defineProperty(e,o,n)}:function(e,t,r,o){if(o===void 0)o=r;e[o]=t[r]}),hfe=rn&&rn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),p4=rn&&rn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null){for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))mfe(t,e,r)}return hfe(t,e),t};Object.defineProperty(rn,"__esModule",{value:!0});rn.load=rn.currentTarget=void 0;var gfe=p4(Fr("path")),yfe=p4(Fr("fs"));function bfe(){let e=null;switch(process.platform){case"android":switch(process.arch){case"arm":return"android-arm-eabi";case"arm64":return"android-arm64"}e="Android";break;case"win32":switch(process.arch){case"x64":return"win32-x64-msvc";case"arm64":return"win32-arm64-msvc";case"ia32":return"win32-ia32-msvc"}e="Windows";break;case"darwin":switch(process.arch){case"x64":return"darwin-x64";case"arm64":return"darwin-arm64"}e="macOS";break;case"linux":switch(process.arch){case"x64":case"arm64":return Sfe()?`linux-${process.arch}-gnu`:`linux-${process.arch}-musl`;case"arm":return"linux-arm-gnueabihf"}e="Linux";break;case"freebsd":if(process.arch==="x64")return"freebsd-x64";e="FreeBSD";break}if(e)throw Error(`Neon: unsupported ${e} architecture: ${process.arch}`);throw Error(`Neon: unsupported system: ${process.platform}`)}rn.currentTarget=bfe;function Sfe(){let e=process.report?.getReport();if(typeof e!=="object"||!e||!("header"in e))return!1;let t=e.header;return typeof t==="object"&&!!t&&"glibcVersionRuntime"in t}function vfe(e){let t=gfe.join(e,"index.node");return yfe.existsSync(t)?Fr(t):null}rn.load=vfe});var g4=ge(function(MLe,h4){var m4=()=>process.platform==="linux",VR=null,wfe=()=>{if(!VR)VR=m4()&&process.report?process.report.getReport():{};return VR};h4.exports={isLinux:m4,getReport:wfe}});var S4=ge(function(qLe,b4){var y4=Fr("fs"),xfe=(e)=>y4.readFileSync(e,"utf-8"),_fe=(e)=>new Promise((t,r)=>{y4.readFile(e,"utf-8",(o,n)=>{if(o)r(o);else t(n)})});b4.exports={LDD_PATH:"/usr/bin/ldd",readFileSync:xfe,readFile:_fe}});var D4=ge(function(FLe,N4){var w4=Fr("child_process"),{isLinux:hl,getReport:x4}=g4(),{LDD_PATH:Oy,readFile:_4,readFileSync:E4}=S4(),ro,no,Ki="",I4=()=>{if(!Ki)return new Promise((e)=>{w4.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{Ki=t?" ":r,e(Ki)})});return Ki},A4=()=>{if(!Ki)try{Ki=w4.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){Ki=" "}return Ki},jo="glibc",k4=/GLIBC\s(\d+\.\d+)/,la="musl",Efe=jo.toUpperCase(),Ife=la.toLowerCase(),Afe=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),R4=()=>{let e=x4();if(e.header&&e.header.glibcVersionRuntime)return jo;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(Afe))return la}return null},T4=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(jo))return jo;if(r&&r.includes(la))return la;return null},$4=(e)=>{if(e.includes(Ife))return la;if(e.includes(Efe))return jo;return null},kfe=async()=>{if(ro!==void 0)return ro;ro=null;try{let e=await _4(Oy);ro=$4(e)}catch(e){}return ro},Rfe=()=>{if(ro!==void 0)return ro;ro=null;try{let e=E4(Oy);ro=$4(e)}catch(e){}return ro},O4=async()=>{let e=null;if(hl()){if(e=await kfe(),!e)e=R4();if(!e){let t=await I4();e=T4(t)}}return e},C4=()=>{let e=null;if(hl()){if(e=Rfe(),!e)e=R4();if(!e){let t=A4();e=T4(t)}}return e},Tfe=async()=>hl()&&await O4()!==jo,$fe=()=>hl()&&C4()!==jo,Ofe=async()=>{if(no!==void 0)return no;no=null;try{let t=(await _4(Oy)).match(k4);if(t)no=t[1]}catch(e){}return no},Cfe=()=>{if(no!==void 0)return no;no=null;try{let t=E4(Oy).match(k4);if(t)no=t[1]}catch(e){}return no},P4=()=>{let e=x4();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},v4=(e)=>e.trim().split(/\s+/)[1],z4=(e)=>{let[t,r,o]=e.split(/[\r\n]+/);if(t&&t.includes(jo))return v4(t);if(r&&o&&r.includes(la))return v4(o);return null},Pfe=async()=>{let e=null;if(hl()){if(e=await Ofe(),!e)e=P4();if(!e){let t=await I4();e=z4(t)}}return e},zfe=()=>{let e=null;if(hl()){if(e=Cfe(),!e)e=P4();if(!e){let t=A4();e=z4(t)}}return e};N4.exports={GLIBC:jo,MUSL:la,family:O4,familySync:C4,isNonGlibcLinux:Tfe,isNonGlibcLinuxSync:$fe,version:Pfe,versionSync:zfe}});var Z4=ge(function(HLe,L4){var Nfe={ALLOW:0,DENY:1};L4.exports=Nfe});var B4=ge(function(JLe,j4){var WR={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function ua(e,t,r){if(new.target!==ua)return new ua(e,t);if(typeof t!=="string")throw TypeError("Expected second argument to be a string");Error.call(this,e),WR.value=""+e,Object.defineProperty(this,"message",WR),Error.captureStackTrace(this,ua),this.code=t,this.rawCode=r}Object.setPrototypeOf(ua,Error);Object.setPrototypeOf(ua.prototype,Error.prototype);Object.defineProperty(ua.prototype,"name",WR);j4.exports=ua});var V4=ge(function(KLe,Cy){var __dirname="/home/runner/work/brains/brains/node_modules/libsql",{load:Dfe,currentTarget:Lfe}=f4(),{familySync:U4,GLIBC:Zfe,MUSL:jfe}=D4();function Bfe(){if(process.env.LIBSQL_JS_DEV)return Dfe(__dirname);let e=Lfe();if(U4()==Zfe)switch(e){case"linux-x64-musl":e="linux-x64-gnu";break;case"linux-arm64-musl":e="linux-arm64-gnu";break}if(e==="linux-arm-gnueabihf"&&U4()==jfe)e="linux-arm-musleabihf";return Fr(`@libsql/${e}`)}var{databaseOpen:Ufe,databaseOpenWithSync:Mfe,databaseInTransaction:qfe,databaseInterrupt:Ffe,databaseClose:Hfe,databaseSyncSync:Jfe,databaseSyncUntilSync:Kfe,databaseExecSync:Vfe,databasePrepareSync:Wfe,databaseDefaultSafeIntegers:Gfe,databaseAuthorizer:Qfe,databaseLoadExtension:Yfe,databaseMaxWriteReplicationIndex:Xfe,statementRaw:eme,statementIsReader:tme,statementGet:M4,statementRun:q4,statementInterrupt:rme,statementRowsSync:F4,statementColumns:nme,statementSafeIntegers:ome,rowsNext:ime}=Bfe(),sme=Z4(),H4=B4();function gl(e){if(e.libsqlError)return new H4(e.message,e.code,e.rawCode);return e}class J4{constructor(e,t){let r=t?.encryptionCipher??"aes256cbc";if(t&&t.syncUrl){var o="";if(t.syncAuth)console.warn("Warning: The `syncAuth` option is deprecated, please use `authToken` option instead."),o=t.syncAuth;else if(t.authToken)o=t.authToken;let i=t?.encryptionKey??"",s=t?.syncPeriod??0,a=t?.readYourWrites??!0,l=t?.offline??!1,u=t?.remoteEncryptionKey??"";this.db=Mfe(e,t.syncUrl,o,r,i,s,a,l,u)}else{let i=t?.authToken??"",s=t?.encryptionKey??"",a=t?.timeout??0,l=t?.remoteEncryptionKey??"";this.db=Ufe(e,i,r,s,a,l)}this.memory=e===":memory:",this.readonly=!1,this.name="",this.open=!0;let n=this.db;Object.defineProperties(this,{inTransaction:{get(){return qfe(n)}}})}sync(){return Jfe.call(this.db)}syncUntil(e){return Kfe.call(this.db,e)}prepare(e){try{let t=Wfe.call(this.db,e);return new K4(t)}catch(t){throw gl(t)}}transaction(e){if(typeof e!=="function")throw TypeError("Expected first argument to be a function");let t=this,r=(n)=>(...i)=>{t.exec("BEGIN "+n);try{let s=e(...i);return t.exec("COMMIT"),s}catch(s){throw t.exec("ROLLBACK"),s}},o={default:{value:r("")},deferred:{value:r("DEFERRED")},immediate:{value:r("IMMEDIATE")},exclusive:{value:r("EXCLUSIVE")},database:{value:this,enumerable:!0}};return Object.defineProperties(o.default.value,o),Object.defineProperties(o.deferred.value,o),Object.defineProperties(o.immediate.value,o),Object.defineProperties(o.exclusive.value,o),o.default.value}pragma(e,t){if(t==null)t={};if(typeof e!=="string")throw TypeError("Expected first argument to be a string");if(typeof t!=="object")throw TypeError("Expected second argument to be an options object");let r=t.simple,o=this.prepare(`PRAGMA ${e}`,this,!0);return r?o.pluck().get():o.all()}backup(e,t){throw Error("not implemented")}serialize(e){throw Error("not implemented")}function(e,t,r){if(t==null)t={};if(typeof t==="function")r=t,t={};if(typeof e!=="string")throw TypeError("Expected first argument to be a string");if(typeof r!=="function")throw TypeError("Expected last argument to be a function");if(typeof t!=="object")throw TypeError("Expected second argument to be an options object");if(!e)throw TypeError("User-defined function name cannot be an empty string");throw Error("not implemented")}aggregate(e,t){if(typeof e!=="string")throw TypeError("Expected first argument to be a string");if(typeof t!=="object"||t===null)throw TypeError("Expected second argument to be an options object");if(!e)throw TypeError("User-defined function name cannot be an empty string");throw Error("not implemented")}table(e,t){if(typeof e!=="string")throw TypeError("Expected first argument to be a string");if(!e)throw TypeError("Virtual table module name cannot be an empty string");throw Error("not implemented")}authorizer(e){Qfe.call(this.db,e)}loadExtension(...e){Yfe.call(this.db,...e)}maxWriteReplicationIndex(){return Xfe.call(this.db)}exec(e){try{Vfe.call(this.db,e)}catch(t){throw gl(t)}}interrupt(){Ffe.call(this.db)}close(){Hfe.call(this.db),this.open=!1}defaultSafeIntegers(e){return Gfe.call(this.db,e??!0),this}unsafeMode(...e){throw Error("not implemented")}}class K4{constructor(e){this.stmt=e,this.pluckMode=!1}raw(e){return eme.call(this.stmt,e??!0),this}pluck(e){return this.pluckMode=e??!0,this}get reader(){return tme.call(this.stmt)}run(...e){try{if(e.length==1&&typeof e[0]==="object")return q4.call(this.stmt,e[0]);else return q4.call(this.stmt,e.flat())}catch(t){throw gl(t)}}get(...e){try{if(e.length==1&&typeof e[0]==="object")return M4.call(this.stmt,e[0]);else return M4.call(this.stmt,e.flat())}catch(t){throw gl(t)}}iterate(...e){var t=void 0;if(e.length==1&&typeof e[0]==="object")t=F4.call(this.stmt,e[0]);else t=F4.call(this.stmt,e.flat());return{nextRows:Array(100),nextRowIndex:100,next(){try{if(this.nextRowIndex===100)ime.call(t,this.nextRows),this.nextRowIndex=0;let o=this.nextRows[this.nextRowIndex];if(this.nextRows[this.nextRowIndex]=void 0,!o)return{done:!0};return this.nextRowIndex++,{value:o,done:!1}}catch(o){throw gl(o)}},[Symbol.iterator](){return this}}}all(...e){try{let t=[];for(let r of this.iterate(...e))if(this.pluckMode)t.push(r[Object.keys(r)[0]]);else t.push(r);return t}catch(t){throw gl(t)}}interrupt(){rme.call(this.stmt)}columns(){return nme.call(this.stmt)}safeIntegers(e){return ome.call(this.stmt,e??!0),this}}Cy.exports=J4;Cy.exports.Authorization=sme;Cy.exports.SqliteError=H4});import{Buffer as G4}from"buffer";function Q4(e){if(e.scheme!=="file")throw new Ce(`URL scheme ${JSON.stringify(e.scheme+":")} is not supported by the local sqlite3 client. For more information, please read ${to}`,"URL_SCHEME_NOT_SUPPORTED");let t=e.authority;if(t!==void 0){let s=t.host.toLowerCase();if(s!==""&&s!=="localhost")throw new Ce(`Invalid host in file URL: ${JSON.stringify(t.host)}. A "file:" URL with an absolute path should start with one slash ("file:/absolute/path.db") or with three slashes ("file:///absolute/path.db"). For more information, please read ${to}`,"URL_INVALID");if(t.port!==void 0)throw new Ce("File URL cannot have a port","URL_INVALID");if(t.userinfo!==void 0)throw new Ce("File URL cannot have username and password","URL_INVALID")}let r=d4(e);if(r&&e.syncUrl)throw new Ce(`Embedded replica must use file for local db but URI with in-memory mode were provided instead: ${e.path}`,"URL_INVALID");let o=e.path;if(r)o=`${e.scheme}:${e.path}`;let n={authToken:e.authToken,encryptionKey:e.encryptionKey,remoteEncryptionKey:e.remoteEncryptionKey,syncUrl:e.syncUrl,syncPeriod:e.syncInterval,readYourWrites:e.readYourWrites,offline:e.offline,timeout:e.timeout},i=new wp.default(o,n);return zt(i,"SELECT 1 AS checkThatTheDatabaseCanBeOpened",e.intMode),new Y4(o,n,i,e.intMode)}class Y4{#e;#t;#r;#n;closed;protocol;constructor(e,t,r,o){this.#e=e,this.#t=t,this.#r=r,this.#n=o,this.closed=!1,this.protocol="file"}async execute(e,t){let r;if(typeof e==="string")r={sql:e,args:t||[]};else r=e;return this.#o(),zt(this.#i(),r,this.#n)}async batch(e,t="deferred"){this.#o();let r=this.#i();try{zt(r,Ji(t),this.#n);let o=[];for(let n=0;n<e.length;n++)try{if(!r.inTransaction)throw new Wt("The transaction has been rolled back",n,"TRANSACTION_CLOSED");let i=e[n],s=Array.isArray(i)?{sql:i[0],args:i[1]||[]}:i;o.push(zt(r,s,this.#n))}catch(i){if(i instanceof Wt)throw i;if(i instanceof Ce)throw new Wt(i.message,n,i.code,i.extendedCode,i.rawCode,i.cause instanceof Error?i.cause:void 0);throw i}return zt(r,"COMMIT",this.#n),o}finally{if(r.inTransaction)zt(r,"ROLLBACK",this.#n)}}async migrate(e){this.#o();let t=this.#i();try{zt(t,"PRAGMA foreign_keys=off",this.#n),zt(t,Ji("deferred"),this.#n);let r=[];for(let o=0;o<e.length;o++)try{if(!t.inTransaction)throw new Wt("The transaction has been rolled back",o,"TRANSACTION_CLOSED");r.push(zt(t,e[o],this.#n))}catch(n){if(n instanceof Wt)throw n;if(n instanceof Ce)throw new Wt(n.message,o,n.code,n.extendedCode,n.rawCode,n.cause instanceof Error?n.cause:void 0);throw n}return zt(t,"COMMIT",this.#n),r}finally{if(t.inTransaction)zt(t,"ROLLBACK",this.#n);zt(t,"PRAGMA foreign_keys=on",this.#n)}}async transaction(e="write"){let t=this.#i();return zt(t,Ji(e),this.#n),this.#r=null,new X4(t,this.#n)}async executeMultiple(e){this.#o();let t=this.#i();try{return eF(t,e)}finally{if(t.inTransaction)zt(t,"ROLLBACK",this.#n)}}async sync(){this.#o();let e=await this.#i().sync();return{frames_synced:e.frames_synced,frame_no:e.frame_no}}async reconnect(){try{if(!this.closed&&this.#r!==null)this.#r.close()}finally{this.#r=new wp.default(this.#e,this.#t),this.closed=!1}}close(){if(this.closed=!0,this.#r!==null)this.#r.close(),this.#r=null}#o(){if(this.closed)throw new Ce("The client is closed","CLIENT_CLOSED")}#i(){if(this.#r===null)this.#r=new wp.default(this.#e,this.#t);return this.#r}}class X4{#e;#t;constructor(e,t){this.#e=e,this.#t=t}async execute(e,t){let r;if(typeof e==="string")r={sql:e,args:t||[]};else r=e;return this.#r(),zt(this.#e,r,this.#t)}async batch(e){let t=[];for(let r=0;r<e.length;r++)try{this.#r();let o=e[r],n=Array.isArray(o)?{sql:o[0],args:o[1]||[]}:o;t.push(zt(this.#e,n,this.#t))}catch(o){if(o instanceof Wt)throw o;if(o instanceof Ce)throw new Wt(o.message,r,o.code,o.extendedCode,o.rawCode,o.cause instanceof Error?o.cause:void 0);throw o}return t}async executeMultiple(e){return this.#r(),eF(this.#e,e)}async rollback(){if(!this.#e.open)return;this.#r(),zt(this.#e,"ROLLBACK",this.#t)}async commit(){this.#r(),zt(this.#e,"COMMIT",this.#t)}close(){if(this.#e.inTransaction)zt(this.#e,"ROLLBACK",this.#t)}get closed(){return!this.#e.inTransaction}#r(){if(this.closed)throw new Ce("The transaction is closed","TRANSACTION_CLOSED")}}function zt(e,t,r){let o,n;if(typeof t==="string")o=t,n=[];else if(o=t.sql,Array.isArray(t.args))n=t.args.map((i)=>W4(i,r));else{n={};for(let i in t.args){let s=i[0]==="@"||i[0]==="$"||i[0]===":"?i.substring(1):i;n[s]=W4(t.args[i],r)}}try{let i=e.prepare(o);i.safeIntegers(!0);let s=!0;try{i.raw(!0)}catch{s=!1}if(s){let a=Array.from(i.columns().map((m)=>m.name)),l=Array.from(i.columns().map((m)=>m.type??"")),u=i.all(n).map((m)=>ame(m,a,r)),d=0,p=void 0;return new fl(a,l,u,0,void 0)}else{let a=i.run(n),l=a.changes,u=BigInt(a.lastInsertRowid);return new fl([],[],[],l,u)}}catch(i){throw tF(i)}}function ame(e,t,r){let o={};Object.defineProperty(o,"length",{value:e.length});for(let n=0;n<e.length;++n){let i=cme(e[n],r);Object.defineProperty(o,n,{value:i});let s=t[n];if(!Object.hasOwn(o,s))Object.defineProperty(o,s,{value:i,enumerable:!0,configurable:!0,writable:!0})}return o}function cme(e,t){if(typeof e==="bigint")if(t==="number"){if(e<lme||e>ume)throw RangeError("Received integer which cannot be safely represented as a JavaScript number");return Number(e)}else if(t==="bigint")return e;else if(t==="string")return""+e;else throw Error("Invalid value for IntMode");else if(e instanceof G4)return e.buffer;return e}function W4(e,t){if(typeof e==="number"){if(!Number.isFinite(e))throw RangeError("Only finite numbers (not Infinity or NaN) can be passed as arguments");return e}else if(typeof e==="bigint"){if(e<dme||e>pme)throw RangeError("bigint is too large to be represented as a 64-bit integer and passed as argument");return e}else if(typeof e==="boolean")switch(t){case"bigint":return e?1n:0n;case"string":return e?"1":"0";default:return e?1:0}else if(e instanceof ArrayBuffer)return G4.from(e);else if(e instanceof Date)return e.valueOf();else if(e===void 0)throw TypeError("undefined cannot be passed as argument to the database");else return e}function eF(e,t){try{e.exec(t)}catch(r){throw tF(r)}}function tF(e){if(e instanceof wp.default.SqliteError){let t=e.code,r=fme(e.rawCode);return new Ce(e.message,r,t,e.rawCode,e)}return e}function fme(e){if(e===void 0)return"SQLITE_UNKNOWN";let t=e&255;return mme[t]??`SQLITE_UNKNOWN_${t.toString()}`}var wp,lme,ume=9007199254740991n,dme,pme=9223372036854775807n,mme;var rF=S(()=>{wn();vp();ml();wp=Jl(V4(),1);wn();lme=-9007199254740991n;dme=-9223372036854775808n;mme={1:"SQLITE_ERROR",2:"SQLITE_INTERNAL",3:"SQLITE_PERM",4:"SQLITE_ABORT",5:"SQLITE_BUSY",6:"SQLITE_LOCKED",7:"SQLITE_NOMEM",8:"SQLITE_READONLY",9:"SQLITE_INTERRUPT",10:"SQLITE_IOERR",11:"SQLITE_CORRUPT",12:"SQLITE_NOTFOUND",13:"SQLITE_FULL",14:"SQLITE_CANTOPEN",15:"SQLITE_PROTOCOL",16:"SQLITE_EMPTY",17:"SQLITE_SCHEMA",18:"SQLITE_TOOBIG",19:"SQLITE_CONSTRAINT",20:"SQLITE_MISMATCH",21:"SQLITE_MISUSE",22:"SQLITE_NOLFS",23:"SQLITE_AUTH",24:"SQLITE_FORMAT",25:"SQLITE_RANGE",26:"SQLITE_NOTADB",27:"SQLITE_NOTICE",28:"SQLITE_WARNING"}});var Vi;var GR=S(()=>{if(typeof WebSocket<"u")Vi=WebSocket;else if(typeof global<"u")Vi=global.WebSocket;else if(typeof window<"u")Vi=window.WebSocket;else if(typeof self<"u")Vi=self.WebSocket});class yl{constructor(){this.intMode="number"}intMode}var Ge,Pe,xp,_t,_p,bl,da,xn,or,oo;var Et=S(()=>{Ge=class Ge extends Error{constructor(e){super(e);this.name="ClientError"}};Pe=class Pe extends Ge{constructor(e){super(e);this.name="ProtoError"}};xp=class xp extends Ge{code;proto;constructor(e,t){super(e);this.name="ResponseError",this.code=t.code,this.proto=t,this.stack=void 0}};_t=class _t extends Ge{constructor(e,t){if(t!==void 0){super(`${e}: ${t}`);this.cause=t}else super(e);this.name="ClosedError"}};_p=class _p extends Ge{constructor(e){super(e);this.name="WebSocketUnsupportedError"}};bl=class bl extends Ge{constructor(e){super(e);this.name="WebSocketError"}};da=class da extends Ge{status;constructor(e,t){super(e);this.status=t,this.name="HttpServerError"}};xn=class xn extends Ge{constructor(e){super(e);this.name="ProtocolVersionError"}};or=class or extends Ge{constructor(e){super(e);this.name="InternalError"}};oo=class oo extends Ge{constructor(e){super(e);this.name="MisuseError"}}});function Tr(e){if(typeof e==="string")return e;throw Sl(e,"string")}function Ur(e){if(e===null||e===void 0)return;else if(typeof e==="string")return e;throw Sl(e,"string or null")}function Bo(e){if(typeof e==="number")return e;throw Sl(e,"number")}function Wi(e){if(typeof e==="boolean")return e;throw Sl(e,"boolean")}function Ep(e){if(Array.isArray(e))return e;throw Sl(e,"array")}function kt(e){if(e!==null&&typeof e==="object"&&!Array.isArray(e))return e;throw Sl(e,"object")}function _n(e,t){return Ep(e).map((r)=>t(kt(r)))}function Sl(e,t){if(e===void 0)return new Pe(`Expected ${t}, but the property was missing`);let r=typeof e;if(e===null)r="null";else if(Array.isArray(e))r="array";return new Pe(`Expected ${t}, received ${r}`)}function pa(e,t){return t(kt(e))}var vl=S(()=>{Et()});class nF{#e;#t;constructor(e){this.#e=e,this.#t=!1}begin(){this.#e.push("{"),this.#t=!0}end(){this.#e.push("}"),this.#t=!1}#r(e){if(this.#t)this.#e.push('"'),this.#t=!1;else this.#e.push(',"');this.#e.push(e),this.#e.push('":')}string(e,t){this.#r(e),this.#e.push(JSON.stringify(t))}stringRaw(e,t){this.#r(e),this.#e.push('"'),this.#e.push(t),this.#e.push('"')}number(e,t){this.#r(e),this.#e.push(""+t)}boolean(e,t){this.#r(e),this.#e.push(t?"true":"false")}object(e,t,r){this.#r(e),this.begin(),r(this,t),this.end()}arrayObjects(e,t,r){this.#r(e),this.#e.push("[");for(let o=0;o<t.length;++o){if(o!==0)this.#e.push(",");this.begin(),r(this,t[o]),this.end()}this.#e.push("]")}}function Ip(e,t){let r=[],o=new nF(r);return o.begin(),t(o,e),o.end(),r.join("")}var fa=0,Ap=1,kp=2,oF=5;class iF{#e;#t;#r;constructor(e){this.#e=e,this.#t=new DataView(e.buffer,e.byteOffset,e.byteLength),this.#r=0}varint(){let e=0;for(let t=0;;t+=7){let r=this.#e[this.#r++];if(e|=(r&127)<<t,!(r&128))break}return e}varintBig(){let e=0n;for(let t=0n;;t+=7n){let r=this.#e[this.#r++];if(e|=BigInt(r&127)<<t,!(r&128))break}return e}bytes(e){let t=new Uint8Array(this.#e.buffer,this.#e.byteOffset+this.#r,e);return this.#r+=e,t}double(){let e=this.#t.getFloat64(this.#r,!0);return this.#r+=8,e}skipVarint(){for(;;)if(!(this.#e[this.#r++]&128))break}skip(e){this.#r+=e}eof(){return this.#r>=this.#e.byteLength}}class sF{#e;#t;constructor(e){this.#e=e,this.#t=-1}setup(e){this.#t=e}#r(e){if(this.#t!==e)throw new Pe(`Expected wire type ${e}, got ${this.#t}`);this.#t=-1}bytes(){this.#r(kp);let e=this.#e.varint();return this.#e.bytes(e)}string(){return new TextDecoder().decode(this.bytes())}message(e){return Gi(this.bytes(),e)}int32(){return this.#r(fa),this.#e.varint()}uint32(){return this.int32()}bool(){return this.int32()!==0}uint64(){return this.#r(fa),this.#e.varintBig()}sint64(){let e=this.uint64();return e>>1n^-(e&1n)}double(){return this.#r(Ap),this.#e.double()}maybeSkip(){if(this.#t<0)return;else if(this.#t===fa)this.#e.skipVarint();else if(this.#t===Ap)this.#e.skip(8);else if(this.#t===kp){let e=this.#e.varint();this.#e.skip(e)}else if(this.#t===oF)this.#e.skip(4);else throw new Pe(`Unexpected wire type ${this.#t}`);this.#t=-1}}function Gi(e,t){let r=new iF(e),o=new sF(r),n=t.default();while(!r.eof()){let i=r.varint(),s=i>>3,a=i&7;o.setup(a);let l=t[s];if(l!==void 0){let u=l(o,n);if(u!==void 0)n=u}o.maybeSkip()}return n}var QR=S(()=>{Et()});class YR{#e;#t;#r;#n;constructor(){this.#e=new ArrayBuffer(256),this.#t=new Uint8Array(this.#e),this.#r=new DataView(this.#e),this.#n=0}#o(e){if(this.#n+e<=this.#e.byteLength)return;let t=this.#e.byteLength;while(t<this.#n+e)t*=2;let r=new ArrayBuffer(t),o=new Uint8Array(r),n=new DataView(r);o.set(new Uint8Array(this.#e,0,this.#n)),this.#e=r,this.#t=o,this.#r=n}#i(e){this.#o(5),e=0|e;do{let t=e&127;e>>>=7,t|=e?128:0,this.#t[this.#n++]=t}while(e)}#a(e){this.#o(10),e=e&0xffffffffffffffffn;do{let t=Number(e&0x7fn);e>>=7n,t|=e?128:0,this.#t[this.#n++]=t}while(e)}#s(e,t){this.#i(e<<3|t)}bytes(e,t){this.#s(e,kp),this.#i(t.byteLength),this.#o(t.byteLength),this.#t.set(t,this.#n),this.#n+=t.byteLength}string(e,t){this.bytes(e,new TextEncoder().encode(t))}message(e,t,r){let o=new YR;r(o,t),this.bytes(e,o.data())}int32(e,t){this.#s(e,fa),this.#i(t)}uint32(e,t){this.int32(e,t)}bool(e,t){this.int32(e,t?1:0)}sint64(e,t){this.#s(e,fa),this.#a(t<<1n^t>>63n)}double(e,t){this.#s(e,Ap),this.#o(8),this.#r.setFloat64(this.#n,t,!0),this.#n+=8}data(){return new Uint8Array(this.#e,0,this.#n)}}function Rp(e,t){let r=new YR;return t(r,e),r.data()}var aF=()=>{};var XR=S(()=>{vl();QR();aF()});class Qi{#e;#t;constructor(){this.#e=new Set,this.#t=new Set}alloc(){for(let t of this.#t){if(this.#t.delete(t),this.#e.add(t),!this.#e.has(this.#e.size-1))this.#t.add(this.#e.size-1);return t}let e=this.#e.size;return this.#e.add(e),e}free(e){if(!this.#e.delete(e))throw new or("Freeing an id that is not allocated");if(this.#t.delete(this.#e.size),e<this.#e.size)this.#t.add(e)}}var eT=S(()=>{Et()});function Je(e,t){throw new or(t)}var nn=S(()=>{Et()});function wl(e){if(e===null)return null;else if(typeof e==="string")return e;else if(typeof e==="number"){if(!Number.isFinite(e))throw RangeError("Only finite numbers (not Infinity or NaN) can be passed as arguments");return e}else if(typeof e==="bigint"){if(e<gme||e>yme)throw RangeError("This bigint value is too large to be represented as a 64-bit integer and passed as argument");return e}else if(typeof e==="boolean")return e?1n:0n;else if(e instanceof ArrayBuffer)return new Uint8Array(e);else if(e instanceof Uint8Array)return e;else if(e instanceof Date)return+e.valueOf();else if(typeof e==="object")return""+e.toString();else throw TypeError("Unsupported type of value")}function tT(e,t){if(e===null)return null;else if(typeof e==="number")return e;else if(typeof e==="string")return e;else if(typeof e==="bigint")if(t==="number"){let r=Number(e);if(!Number.isSafeInteger(r))throw RangeError("Received integer which is too large to be safely represented as a JavaScript number");return r}else if(t==="bigint")return e;else if(t==="string")return""+e;else throw new oo("Invalid value for IntMode");else if(e instanceof Uint8Array)return e.slice().buffer;else if(e===void 0)throw new Pe("Received unrecognized type of Value");else throw Je(e,"Impossible type of Value")}var gme,yme=9223372036854775807n;var rT=S(()=>{Et();nn();gme=-9223372036854775808n});function ma(e){return{affectedRowCount:e.affectedRowCount,lastInsertRowid:e.lastInsertRowid,columnNames:e.cols.map((t)=>t.name),columnDecltypes:e.cols.map((t)=>t.decltype)}}function zy(e,t){let r=ma(e),o=e.rows.map((n)=>cF(r.columnNames,n,t));return{...r,rows:o}}function Ny(e,t){let r=ma(e),o;if(e.rows.length>0)o=cF(r.columnNames,e.rows[0],t);return{...r,row:o}}function Dy(e,t){let r=ma(e),o;if(e.rows.length>0&&r.columnNames.length>0)o=tT(e.rows[0][0],t);return{...r,value:o}}function cF(e,t,r){let o={};Object.defineProperty(o,"length",{value:t.length});for(let n=0;n<t.length;++n){let i=tT(t[n],r);Object.defineProperty(o,n,{value:i});let s=e[n];if(s!==void 0&&!Object.hasOwn(o,s))Object.defineProperty(o,s,{value:i,enumerable:!0,configurable:!0,writable:!0})}return o}function Uo(e){return new xp(e.message,e)}var Tp=S(()=>{Et();rT()});class ha{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=void 0}_getSqlId(e){if(this.#e!==e)throw new oo("Attempted to use SQL text opened with other object");else if(this.#r!==void 0)throw new _t("SQL text is closed",this.#r);return this.#t}close(){this._setClosed(new Ge("SQL text was manually closed"))}_setClosed(e){if(this.#r===void 0)this.#r=e,this.#e._closeSql(this.#t)}get closed(){return this.#r!==void 0}}function $p(e,t){if(t instanceof ha)return{sqlId:t._getSqlId(e)};else return{sql:""+t}}var xl=S(()=>{Et()});class Yi{#e;#t;constructor(){this.#e=[],this.#t=[]}get length(){return this.#e.length+this.#t.length}push(e){this.#e.push(e)}shift(){if(this.#t.length===0&&this.#e.length>0)this.#t=this.#e.reverse(),this.#e=[];return this.#t.pop()}first(){return this.#t.length!==0?this.#t[this.#t.length-1]:this.#e[0]}}class Op{sql;_args;_namedArgs;constructor(e){this.sql=e,this._args=[],this._namedArgs=new Map}bindIndexes(e){this._args.length=0;for(let t of e)this._args.push(wl(t));return this}bindIndex(e,t){if(e!==(e|0)||e<=0)throw RangeError("Index of a positional argument must be positive integer");while(this._args.length<e)this._args.push(null);return this._args[e-1]=wl(t),this}bindName(e,t){return this._namedArgs.set(e,wl(t)),this}unbindAll(){return this._args.length=0,this._namedArgs.clear(),this}}function Ly(e,t,r){let o,n=[],i=[];if(t instanceof Op){o=t.sql,n=t._args;for(let[l,u]of t._namedArgs.entries())i.push({name:l,value:u})}else if(Array.isArray(t))if(o=t[0],Array.isArray(t[1]))n=t[1].map((l)=>wl(l));else i=Object.entries(t[1]).map(([l,u])=>({name:l,value:wl(u)}));else o=t;let{sql:s,sqlId:a}=$p(e,o);return{sql:s,sqlId:a,args:n,namedArgs:i,wantRows:r}}var Zy=S(()=>{xl();rT()});class jy{_stream;#e;_steps;#t;constructor(e,t){this._stream=e,this.#e=t,this._steps=[],this.#t=!1}step(){return new nT(this)}execute(){if(this.#t)throw new oo("This batch has already been executed");this.#t=!0;let e={steps:this._steps.map((t)=>t.proto)};if(this.#e)return Sme(this._stream,this._steps,e);else return bme(this._stream,this._steps,e)}}function bme(e,t,r){return e._batch(r).then((o)=>{for(let n=0;n<t.length;++n){let i=o.stepResults.get(n),s=o.stepErrors.get(n);t[n].callback(i,s)}})}async function Sme(e,t,r){let o=await e._openCursor(r);try{let n=0,i=void 0,s=[];for(;;){let a=await o.next();if(a===void 0)break;if(a.type==="step_begin"){if(a.step<n||a.step>=t.length)throw new Pe("Server produced StepBeginEntry for unexpected step");else if(i!==void 0)throw new Pe("Server produced StepBeginEntry before terminating previous step");for(let l=n;l<a.step;++l)t[l].callback(void 0,void 0);n=a.step+1,i=a,s=[]}else if(a.type==="step_end"){if(i===void 0)throw new Pe("Server produced StepEndEntry but no step is active");let l={cols:i.cols,rows:s,affectedRowCount:a.affectedRowCount,lastInsertRowid:a.lastInsertRowid};t[i.step].callback(l,void 0),i=void 0,s=[]}else if(a.type==="step_error"){if(i===void 0){if(a.step>=t.length)throw new Pe("Server produced StepErrorEntry for unexpected step");for(let l=n;l<a.step;++l)t[l].callback(void 0,void 0)}else{if(a.step!==i.step)throw new Pe("Server produced StepErrorEntry for unexpected step");i=void 0,s=[]}t[a.step].callback(void 0,a.error),n=a.step+1}else if(a.type==="row"){if(i===void 0)throw new Pe("Server produced RowEntry but no step is active");s.push(a.row)}else if(a.type==="error")throw Uo(a.error);else if(a.type==="none")throw new Pe("Server produced unrecognized CursorEntry");else throw Je(a,"Impossible CursorEntry")}if(i!==void 0)throw new Pe("Server closed Cursor before terminating active step");for(let a=n;a<t.length;++a)t[a].callback(void 0,void 0)}finally{o.close()}}class nT{_batch;#e;_index;constructor(e){this._batch=e,this.#e=[],this._index=void 0}condition(e){return this.#e.push(e._proto),this}query(e){return this.#t(e,!0,zy)}queryRow(e){return this.#t(e,!0,Ny)}queryValue(e){return this.#t(e,!0,Dy)}run(e){return this.#t(e,!1,ma)}#t(e,t,r){if(this._index!==void 0)throw new oo("This BatchStep has already been added to the batch");let o=Ly(this._batch._stream._sqlOwner(),e,t),n;if(this.#e.length===0)n=void 0;else if(this.#e.length===1)n=this.#e[0];else n={type:"and",conds:this.#e.slice()};let i={stmt:o,condition:n};return new Promise((s,a)=>{let l=(u,d)=>{if(u!==void 0&&d!==void 0)a(new Pe("Server returned both result and error"));else if(d!==void 0)a(Uo(d));else if(u!==void 0)s(r(u,this._batch._stream.intMode));else s(void 0)};this._index=this._batch._steps.length,this._batch._steps.push({proto:i,callback:l})})}}class ut{_batch;_proto;constructor(e,t){this._batch=e,this._proto=t}static ok(e){return new ut(e._batch,{type:"ok",step:lF(e)})}static error(e){return new ut(e._batch,{type:"error",step:lF(e)})}static not(e){return new ut(e._batch,{type:"not",cond:e._proto})}static and(e,t){for(let r of t)uF(e,r);return new ut(e,{type:"and",conds:t.map((r)=>r._proto)})}static or(e,t){for(let r of t)uF(e,r);return new ut(e,{type:"or",conds:t.map((r)=>r._proto)})}static isAutocommit(e){return e._stream.client()._ensureVersion(3,"BatchCond.isAutocommit()"),new ut(e,{type:"is_autocommit"})}}function lF(e){if(e._index===void 0)throw new oo("Cannot add a condition referencing a step that has not been added to the batch");return e._index}function uF(e,t){if(t._batch!==e)throw new oo("Cannot mix BatchCond objects for different Batch objects")}var oT=S(()=>{Et();Tp();Zy();nn()});function dF(e){return{paramNames:e.params.map((t)=>t.name),columns:e.cols,isExplain:e.isExplain,isReadonly:e.isReadonly}}class _l{constructor(e){this.intMode=e}query(e){return this.#e(e,!0,zy)}queryRow(e){return this.#e(e,!0,Ny)}queryValue(e){return this.#e(e,!0,Dy)}run(e){return this.#e(e,!1,ma)}#e(e,t,r){let o=Ly(this._sqlOwner(),e,t);return this._execute(o).then((n)=>r(n,this.intMode))}batch(e=!1){return new jy(this,e)}describe(e){let t=$p(this._sqlOwner(),e);return this._describe(t).then(dF)}sequence(e){let t=$p(this._sqlOwner(),e);return this._sequence(t)}intMode}var By=S(()=>{oT();Tp();xl();Zy()});class Cp{}var vme=1000,wme=10,iT;var pF=S(()=>{Et();iT=class iT extends Cp{#e;#t;#r;#n;#o;#i;#a;constructor(e,t,r){super();this.#e=e,this.#t=t,this.#r=r,this.#n=new Yi,this.#o=new Yi,this.#i=void 0,this.#a=!1}async next(){for(;;){if(this.#i!==void 0)throw new _t("Cursor is closed",this.#i);while(!this.#a&&this.#o.length<wme)this.#o.push(this.#s());let e=this.#n.shift();if(this.#a||e!==void 0)return e;await this.#o.shift().then((t)=>{if(t===void 0)return;for(let r of t.entries)this.#n.push(r);this.#a||=t.done})}}#s(){return this.#t._sendCursorRequest(this,{type:"fetch_cursor",cursorId:this.#r,maxCount:vme}).then((e)=>e,(e)=>{this._setClosed(e);return})}_setClosed(e){if(this.#i!==void 0)return;this.#i=e,this.#t._sendCursorRequest(this,{type:"close_cursor",cursorId:this.#r}).catch(()=>{return}),this.#t._cursorClosed(this)}close(){this._setClosed(new Ge("Cursor was manually closed"))}get closed(){return this.#i!==void 0}}});var Pp;var sT=S(()=>{Et();By();pF();Pp=class Pp extends _l{#e;#t;#r;#n;#o;#i;static open(e){let t=e._streamIdAlloc.alloc(),r=new Pp(e,t),o=()=>{return},n=(s)=>r.#l(s),i={type:"open_stream",streamId:t};return e._sendRequest(i,{responseCallback:o,errorCallback:n}),r}constructor(e,t){super(e.intMode);this.#e=e,this.#t=t,this.#r=new Yi,this.#n=void 0,this.#o=!1,this.#i=void 0}client(){return this.#e}_sqlOwner(){return this.#e}_execute(e){return this.#a({type:"execute",streamId:this.#t,stmt:e}).then((t)=>t.result)}_batch(e){return this.#a({type:"batch",streamId:this.#t,batch:e}).then((t)=>t.result)}_describe(e){return this.#e._ensureVersion(2,"describe()"),this.#a({type:"describe",streamId:this.#t,sql:e.sql,sqlId:e.sqlId}).then((t)=>t.result)}_sequence(e){return this.#e._ensureVersion(2,"sequence()"),this.#a({type:"sequence",streamId:this.#t,sql:e.sql,sqlId:e.sqlId}).then((t)=>{return})}getAutocommit(){return this.#e._ensureVersion(3,"getAutocommit()"),this.#a({type:"get_autocommit",streamId:this.#t}).then((e)=>e.isAutocommit)}#a(e){return new Promise((t,r)=>{this.#s({type:"request",request:e,responseCallback:t,errorCallback:r})})}_openCursor(e){return this.#e._ensureVersion(3,"cursor"),new Promise((t,r)=>{this.#s({type:"cursor",batch:e,cursorCallback:t,errorCallback:r})})}_sendCursorRequest(e,t){if(e!==this.#n)throw new or("Cursor not associated with the stream attempted to execute a request");return new Promise((r,o)=>{if(this.#i!==void 0)o(new _t("Stream is closed",this.#i));else this.#e._sendRequest(t,{responseCallback:r,errorCallback:o})})}_cursorClosed(e){if(e!==this.#n)throw new or("Cursor was closed, but it was not associated with the stream");this.#n=void 0,this.#c()}#s(e){if(this.#i!==void 0)e.errorCallback(new _t("Stream is closed",this.#i));else if(this.#o)e.errorCallback(new _t("Stream is closing",void 0));else this.#r.push(e),this.#c()}#c(){for(;;){let e=this.#r.first();if(e===void 0&&this.#n===void 0&&this.#o){this.#l(new Ge("Stream was gracefully closed"));break}else if(e?.type==="request"&&this.#n===void 0){let{request:t,responseCallback:r,errorCallback:o}=e;this.#r.shift(),this.#e._sendRequest(t,{responseCallback:r,errorCallback:o})}else if(e?.type==="cursor"&&this.#n===void 0){let{batch:t,cursorCallback:r}=e;this.#r.shift();let o=this.#e._cursorIdAlloc.alloc(),n=new iT(this.#e,this,o),i={type:"open_cursor",streamId:this.#t,cursorId:o,batch:t},s=()=>{return},a=(l)=>n._setClosed(l);this.#e._sendRequest(i,{responseCallback:s,errorCallback:a}),this.#n=n,r(n)}else break}}#l(e){if(this.#i!==void 0)return;if(this.#i=e,this.#n!==void 0)this.#n._setClosed(e);for(;;){let n=this.#r.shift();if(n!==void 0)n.errorCallback(e);else break}let t={type:"close_stream",streamId:this.#t},r=()=>this.#e._streamIdAlloc.free(this.#t),o=()=>{return};this.#e._sendRequest(t,{responseCallback:r,errorCallback:o})}close(){this.#l(new Ge("Stream was manually closed"))}closeGracefully(){this.#o=!0,this.#c()}get closed(){return this.#i!==void 0||this.#o}}});function zp(e,t){if(t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId);e.arrayObjects("args",t.args,fF),e.arrayObjects("named_args",t.namedArgs,xme),e.boolean("want_rows",t.wantRows)}function xme(e,t){e.string("name",t.name),e.object("value",t.value,fF)}function El(e,t){e.arrayObjects("steps",t.steps,_me)}function _me(e,t){if(t.condition!==void 0)e.object("condition",t.condition,aT);e.object("stmt",t.stmt,zp)}function aT(e,t){if(e.stringRaw("type",t.type),t.type==="ok"||t.type==="error")e.number("step",t.step);else if(t.type==="not")e.object("cond",t.cond,aT);else if(t.type==="and"||t.type==="or")e.arrayObjects("conds",t.conds,aT);else if(t.type==="is_autocommit");else throw Je(t,"Impossible type of BatchCond")}function fF(e,t){if(t===null)e.stringRaw("type","null");else if(typeof t==="bigint")e.stringRaw("type","integer"),e.stringRaw("value",""+t);else if(typeof t==="number")e.stringRaw("type","float"),e.number("value",t);else if(typeof t==="string")e.stringRaw("type","text"),e.string("value",t);else if(t instanceof Uint8Array)e.stringRaw("type","blob"),e.stringRaw("base64",pl.fromUint8Array(t));else if(t===void 0);else throw Je(t,"Impossible type of Value")}var cT=S(()=>{$y();nn()});function mF(e,t){if(e.stringRaw("type",t.type),t.type==="hello"){if(t.jwt!==void 0)e.string("jwt",t.jwt)}else if(t.type==="request")e.number("request_id",t.requestId),e.object("request",t.request,Eme);else throw Je(t,"Impossible type of ClientMsg")}function Eme(e,t){if(e.stringRaw("type",t.type),t.type==="open_stream")e.number("stream_id",t.streamId);else if(t.type==="close_stream")e.number("stream_id",t.streamId);else if(t.type==="execute")e.number("stream_id",t.streamId),e.object("stmt",t.stmt,zp);else if(t.type==="batch")e.number("stream_id",t.streamId),e.object("batch",t.batch,El);else if(t.type==="open_cursor")e.number("stream_id",t.streamId),e.number("cursor_id",t.cursorId),e.object("batch",t.batch,El);else if(t.type==="close_cursor")e.number("cursor_id",t.cursorId);else if(t.type==="fetch_cursor")e.number("cursor_id",t.cursorId),e.number("max_count",t.maxCount);else if(t.type==="sequence"){if(e.number("stream_id",t.streamId),t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId)}else if(t.type==="describe"){if(e.number("stream_id",t.streamId),t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId)}else if(t.type==="store_sql")e.number("sql_id",t.sqlId),e.string("sql",t.sql);else if(t.type==="close_sql")e.number("sql_id",t.sqlId);else if(t.type==="get_autocommit")e.number("stream_id",t.streamId);else throw Je(t,"Impossible type of Request")}var hF=S(()=>{cT();nn()});function Np(e,t){if(t.sql!==void 0)e.string(1,t.sql);if(t.sqlId!==void 0)e.int32(2,t.sqlId);for(let r of t.args)e.message(3,r,yF);for(let r of t.namedArgs)e.message(4,r,Ime);e.bool(5,t.wantRows)}function Ime(e,t){e.string(1,t.name),e.message(2,t.value,yF)}function Il(e,t){for(let r of t.steps)e.message(1,r,Ame)}function Ame(e,t){if(t.condition!==void 0)e.message(1,t.condition,lT);e.message(2,t.stmt,Np)}function lT(e,t){if(t.type==="ok")e.uint32(1,t.step);else if(t.type==="error")e.uint32(2,t.step);else if(t.type==="not")e.message(3,t.cond,lT);else if(t.type==="and")e.message(4,t.conds,gF);else if(t.type==="or")e.message(5,t.conds,gF);else if(t.type==="is_autocommit")e.message(6,void 0,bF);else throw Je(t,"Impossible type of BatchCond")}function gF(e,t){for(let r of t)e.message(1,r,lT)}function yF(e,t){if(t===null)e.message(1,void 0,bF);else if(typeof t==="bigint")e.sint64(2,t);else if(typeof t==="number")e.double(3,t);else if(typeof t==="string")e.string(4,t);else if(t instanceof Uint8Array)e.bytes(5,t);else if(t===void 0);else throw Je(t,"Impossible type of Value")}function bF(e,t){}var uT=S(()=>{nn()});function SF(e,t){if(t.type==="hello")e.message(1,t,kme);else if(t.type==="request")e.message(2,t,Rme);else throw Je(t,"Impossible type of ClientMsg")}function kme(e,t){if(t.jwt!==void 0)e.string(1,t.jwt)}function Rme(e,t){e.int32(1,t.requestId);let r=t.request;if(r.type==="open_stream")e.message(2,r,Tme);else if(r.type==="close_stream")e.message(3,r,$me);else if(r.type==="execute")e.message(4,r,Ome);else if(r.type==="batch")e.message(5,r,Cme);else if(r.type==="open_cursor")e.message(6,r,Pme);else if(r.type==="close_cursor")e.message(7,r,zme);else if(r.type==="fetch_cursor")e.message(8,r,Nme);else if(r.type==="sequence")e.message(9,r,Dme);else if(r.type==="describe")e.message(10,r,Lme);else if(r.type==="store_sql")e.message(11,r,Zme);else if(r.type==="close_sql")e.message(12,r,jme);else if(r.type==="get_autocommit")e.message(13,r,Bme);else throw Je(r,"Impossible type of Request")}function Tme(e,t){e.int32(1,t.streamId)}function $me(e,t){e.int32(1,t.streamId)}function Ome(e,t){e.int32(1,t.streamId),e.message(2,t.stmt,Np)}function Cme(e,t){e.int32(1,t.streamId),e.message(2,t.batch,Il)}function Pme(e,t){e.int32(1,t.streamId),e.int32(2,t.cursorId),e.message(3,t.batch,Il)}function zme(e,t){e.int32(1,t.cursorId)}function Nme(e,t){e.int32(1,t.cursorId),e.uint32(2,t.maxCount)}function Dme(e,t){if(e.int32(1,t.streamId),t.sql!==void 0)e.string(2,t.sql);if(t.sqlId!==void 0)e.int32(3,t.sqlId)}function Lme(e,t){if(e.int32(1,t.streamId),t.sql!==void 0)e.string(2,t.sql);if(t.sqlId!==void 0)e.int32(3,t.sqlId)}function Zme(e,t){e.int32(1,t.sqlId),e.string(2,t.sql)}function jme(e,t){e.int32(1,t.sqlId)}function Bme(e,t){e.int32(1,t.streamId)}var vF=S(()=>{uT();nn()});function Xi(e){let t=Tr(e.message),r=Ur(e.code);return{message:t,code:r}}function Dp(e){let t=_n(e.cols,wF),r=Ep(e.rows).map((s)=>_n(s,xF)),o=Bo(e.affected_row_count),n=Ur(e.last_insert_rowid),i=n!==void 0?BigInt(n):void 0;return{cols:t,rows:r,affectedRowCount:o,lastInsertRowid:i}}function wF(e){let t=Ur(e.name),r=Ur(e.decltype);return{name:t,decltype:r}}function Uy(e){let t=new Map;Ep(e.step_results).forEach((o,n)=>{if(o!==null)t.set(n,Dp(kt(o)))});let r=new Map;return Ep(e.step_errors).forEach((o,n)=>{if(o!==null)r.set(n,Xi(kt(o)))}),{stepResults:t,stepErrors:r}}function My(e){let t=Tr(e.type);if(t==="step_begin"){let r=Bo(e.step),o=_n(e.cols,wF);return{type:"step_begin",step:r,cols:o}}else if(t==="step_end"){let r=Bo(e.affected_row_count),o=Ur(e.last_insert_rowid),n=o!==void 0?BigInt(o):void 0;return{type:"step_end",affectedRowCount:r,lastInsertRowid:n}}else if(t==="step_error"){let r=Bo(e.step),o=Xi(kt(e.error));return{type:"step_error",step:r,error:o}}else if(t==="row")return{type:"row",row:_n(e.row,xF)};else if(t==="error")return{type:"error",error:Xi(kt(e.error))};else throw new Pe("Unexpected type of CursorEntry")}function qy(e){let t=_n(e.params,Ume),r=_n(e.cols,Mme),o=Wi(e.is_explain),n=Wi(e.is_readonly);return{params:t,cols:r,isExplain:o,isReadonly:n}}function Ume(e){return{name:Ur(e.name)}}function Mme(e){let t=Tr(e.name),r=Ur(e.decltype);return{name:t,decltype:r}}function xF(e){let t=Tr(e.type);if(t==="null")return null;else if(t==="integer"){let r=Tr(e.value);return BigInt(r)}else if(t==="float")return Bo(e.value);else if(t==="text")return Tr(e.value);else if(t==="blob")return pl.toUint8Array(Tr(e.base64));else throw new Pe("Unexpected type of Value")}var Fy=S(()=>{$y();Et();vl()});function _F(e){let t=Tr(e.type);if(t==="hello_ok")return{type:"hello_ok"};else if(t==="hello_error")return{type:"hello_error",error:Xi(kt(e.error))};else if(t==="response_ok"){let r=Bo(e.request_id),o=qme(kt(e.response));return{type:"response_ok",requestId:r,response:o}}else if(t==="response_error"){let r=Bo(e.request_id),o=Xi(kt(e.error));return{type:"response_error",requestId:r,error:o}}else throw new Pe("Unexpected type of ServerMsg")}function qme(e){let t=Tr(e.type);if(t==="open_stream")return{type:"open_stream"};else if(t==="close_stream")return{type:"close_stream"};else if(t==="execute")return{type:"execute",result:Dp(kt(e.result))};else if(t==="batch")return{type:"batch",result:Uy(kt(e.result))};else if(t==="open_cursor")return{type:"open_cursor"};else if(t==="close_cursor")return{type:"close_cursor"};else if(t==="fetch_cursor"){let r=_n(e.entries,My),o=Wi(e.done);return{type:"fetch_cursor",entries:r,done:o}}else if(t==="sequence")return{type:"sequence"};else if(t==="describe")return{type:"describe",result:qy(kt(e.result))};else if(t==="store_sql")return{type:"store_sql"};else if(t==="close_sql")return{type:"close_sql"};else if(t==="get_autocommit")return{type:"get_autocommit",isAutocommit:Wi(e.is_autocommit)};else throw new Pe("Unexpected type of Response")}var EF=S(()=>{Et();vl();Fy()});var on,es,IF,AF,Al,Fme,Hme,Hy,Jme,Kme,Vme,kl,Wme,Gme,Qme;var Jy=S(()=>{on={default(){return{message:"",code:void 0}},1(e,t){t.message=e.string()},2(e,t){t.code=e.string()}},es={default(){return{cols:[],rows:[],affectedRowCount:0,lastInsertRowid:void 0}},1(e,t){t.cols.push(e.message(IF))},2(e,t){t.rows.push(e.message(AF))},3(e,t){t.affectedRowCount=Number(e.uint64())},4(e,t){t.lastInsertRowid=e.sint64()}},IF={default(){return{name:void 0,decltype:void 0}},1(e,t){t.name=e.string()},2(e,t){t.decltype=e.string()}},AF={default(){return[]},1(e,t){t.push(e.message(Qme))}},Al={default(){return{stepResults:new Map,stepErrors:new Map}},1(e,t){let[r,o]=e.message(Fme);t.stepResults.set(r,o)},2(e,t){let[r,o]=e.message(Hme);t.stepErrors.set(r,o)}},Fme={default(){return[0,es.default()]},1(e,t){t[0]=e.uint32()},2(e,t){t[1]=e.message(es)}},Hme={default(){return[0,on.default()]},1(e,t){t[0]=e.uint32()},2(e,t){t[1]=e.message(on)}},Hy={default(){return{type:"none"}},1(e){return e.message(Jme)},2(e){return e.message(Kme)},3(e){return e.message(Vme)},4(e){return{type:"row",row:e.message(AF)}},5(e){return{type:"error",error:e.message(on)}}},Jme={default(){return{type:"step_begin",step:0,cols:[]}},1(e,t){t.step=e.uint32()},2(e,t){t.cols.push(e.message(IF))}},Kme={default(){return{type:"step_end",affectedRowCount:0,lastInsertRowid:void 0}},1(e,t){t.affectedRowCount=e.uint32()},2(e,t){t.lastInsertRowid=e.uint64()}},Vme={default(){return{type:"step_error",step:0,error:on.default()}},1(e,t){t.step=e.uint32()},2(e,t){t.error=e.message(on)}},kl={default(){return{params:[],cols:[],isExplain:!1,isReadonly:!1}},1(e,t){t.params.push(e.message(Wme))},2(e,t){t.cols.push(e.message(Gme))},3(e,t){t.isExplain=e.bool()},4(e,t){t.isReadonly=e.bool()}},Wme={default(){return{name:void 0}},1(e,t){t.name=e.string()}},Gme={default(){return{name:"",decltype:void 0}},1(e,t){t.name=e.string()},2(e,t){t.decltype=e.string()}},Qme={default(){return},1(e){return null},2(e){return e.sint64()},3(e){return e.double()},4(e){return e.string()},5(e){return e.bytes()}}});var kF,Yme,Xme,ehe,the,rhe,nhe,ohe,ihe;var RF=S(()=>{Jy();kF={default(){return{type:"none"}},1(e){return{type:"hello_ok"}},2(e){return e.message(Yme)},3(e){return e.message(ehe)},4(e){return e.message(Xme)}},Yme={default(){return{type:"hello_error",error:on.default()}},1(e,t){t.error=e.message(on)}},Xme={default(){return{type:"response_error",requestId:0,error:on.default()}},1(e,t){t.requestId=e.int32()},2(e,t){t.error=e.message(on)}},ehe={default(){return{type:"response_ok",requestId:0,response:{type:"none"}}},1(e,t){t.requestId=e.int32()},2(e,t){t.response={type:"open_stream"}},3(e,t){t.response={type:"close_stream"}},4(e,t){t.response=e.message(the)},5(e,t){t.response=e.message(rhe)},6(e,t){t.response={type:"open_cursor"}},7(e,t){t.response={type:"close_cursor"}},8(e,t){t.response=e.message(nhe)},9(e,t){t.response={type:"sequence"}},10(e,t){t.response=e.message(ohe)},11(e,t){t.response={type:"store_sql"}},12(e,t){t.response={type:"close_sql"}},13(e,t){t.response=e.message(ihe)}},the={default(){return{type:"execute",result:es.default()}},1(e,t){t.result=e.message(es)}},rhe={default(){return{type:"batch",result:Al.default()}},1(e,t){t.result=e.message(Al)}},nhe={default(){return{type:"fetch_cursor",entries:[],done:!1}},1(e,t){t.entries.push(e.message(Hy))},2(e,t){t.done=e.bool()}},ohe={default(){return{type:"describe",result:kl.default()}},1(e,t){t.result=e.message(kl)}},ihe={default(){return{type:"get_autocommit",isAutocommit:!1}},1(e,t){t.isAutocommit=e.bool()}}});var TF,dT,Ky;var Vy=S(()=>{XR();Et();eT();Tp();xl();nn();sT();hF();vF();EF();RF();TF=new Map([["hrana2",{version:2,encoding:"json"}],["hrana1",{version:1,encoding:"json"}]]),dT=new Map([["hrana3-protobuf",{version:3,encoding:"protobuf"}],["hrana3",{version:3,encoding:"json"}],["hrana2",{version:2,encoding:"json"}],["hrana1",{version:1,encoding:"json"}]]);Ky=class Ky extends yl{#e;#t;#r;#n;#o;#i;#a;#s;#c;_streamIdAlloc;_cursorIdAlloc;#l;constructor(e,t){super();this.#e=e,this.#t=[],this.#r=!1,this.#n=void 0,this.#o=!1,this.#i=void 0,this.#a=!1,this.#s=new Map,this.#c=new Qi,this._streamIdAlloc=new Qi,this._cursorIdAlloc=new Qi,this.#l=new Qi,this.#e.binaryType="arraybuffer",this.#e.addEventListener("open",()=>this.#p()),this.#e.addEventListener("close",(r)=>this.#g(r)),this.#e.addEventListener("error",(r)=>this.#f(r)),this.#e.addEventListener("message",(r)=>this.#y(r)),this.#d({type:"hello",jwt:t})}#d(e){if(this.#n!==void 0)throw new or("Trying to send a message on a closed client");if(this.#r)this.#m(e);else{let t=()=>this.#m(e),r=()=>{return};this.#t.push({openCallback:t,errorCallback:r})}}#p(){let e=this.#e.protocol;if(e===void 0){this.#u(new Ge("The `WebSocket.protocol` property is undefined. This most likely means that the WebSocket implementation provided by the environment is broken. If you are using Miniflare 2, please update to Miniflare 3, which fixes this problem."));return}else if(e==="")this.#i={version:1,encoding:"json"};else if(this.#i=dT.get(e),this.#i===void 0){this.#u(new Pe(`Unrecognized WebSocket subprotocol: ${JSON.stringify(e)}`));return}for(let t of this.#t)t.openCallback();this.#t.length=0,this.#r=!0}#m(e){let t=this.#i.encoding;if(t==="json"){let r=Ip(e,mF);this.#e.send(r)}else if(t==="protobuf"){let r=Rp(e,SF);this.#e.send(r)}else throw Je(t,"Impossible encoding")}getVersion(){return new Promise((e,t)=>{if(this.#a=!0,this.#n!==void 0)t(this.#n);else if(!this.#r){let r=()=>e(this.#i.version);this.#t.push({openCallback:r,errorCallback:t})}else e(this.#i.version)})}_ensureVersion(e,t){if(this.#i===void 0||!this.#a)throw new xn(`${t} is supported only on protocol version ${e} and higher, but the version supported by the WebSocket server is not yet known. Use Client.getVersion() to wait until the version is available.`);else if(this.#i.version<e)throw new xn(`${t} is supported on protocol version ${e} and higher, but the WebSocket server only supports version ${this.#i.version}`)}_sendRequest(e,t){if(this.#n!==void 0){t.errorCallback(new _t("Client is closed",this.#n));return}let r=this.#c.alloc();this.#s.set(r,{...t,type:e.type}),this.#d({type:"request",requestId:r,request:e})}#f(e){let r=e.message??"WebSocket was closed due to an error";this.#u(new bl(r))}#g(e){let t=`WebSocket was closed with code ${e.code}`;if(e.reason)t+=`: ${e.reason}`;this.#u(new bl(t))}#u(e){if(this.#n!==void 0)return;this.#n=e;for(let t of this.#t)t.errorCallback(e);this.#t.length=0;for(let[t,r]of this.#s.entries())r.errorCallback(e),this.#c.free(t);this.#s.clear(),this.#e.close()}#y(e){if(this.#n!==void 0)return;try{let t,r=this.#i.encoding;if(r==="json"){if(typeof e.data!=="string"){this.#e.close(3003,"Only text messages are accepted with JSON encoding"),this.#u(new Pe("Received non-text message from server with JSON encoding"));return}t=pa(JSON.parse(e.data),_F)}else if(r==="protobuf"){if(!(e.data instanceof ArrayBuffer)){this.#e.close(3003,"Only binary messages are accepted with Protobuf encoding"),this.#u(new Pe("Received non-binary message from server with Protobuf encoding"));return}t=Gi(new Uint8Array(e.data),kF)}else throw Je(r,"Impossible encoding");this.#b(t)}catch(t){this.#e.close(3007,"Could not handle message"),this.#u(t)}}#b(e){if(e.type==="none")throw new Pe("Received an unrecognized ServerMsg");else if(e.type==="hello_ok"||e.type==="hello_error"){if(this.#o)throw new Pe("Received a duplicated hello response");if(this.#o=!0,e.type==="hello_error")throw Uo(e.error);return}else if(!this.#o)throw new Pe("Received a non-hello message before a hello response");if(e.type==="response_ok"){let t=e.requestId,r=this.#s.get(t);if(this.#s.delete(t),r===void 0)throw new Pe("Received unexpected OK response");this.#c.free(t);try{if(r.type!==e.response.type)throw console.dir({responseState:r,msg:e}),new Pe("Received unexpected type of response");r.responseCallback(e.response)}catch(o){throw r.errorCallback(o),o}}else if(e.type==="response_error"){let t=e.requestId,r=this.#s.get(t);if(this.#s.delete(t),r===void 0)throw new Pe("Received unexpected error response");this.#c.free(t),r.errorCallback(Uo(e.error))}else throw Je(e,"Impossible ServerMsg type")}openStream(){return Pp.open(this)}storeSql(e){this._ensureVersion(2,"storeSql()");let t=this.#l.alloc(),r=new ha(this,t),o=()=>{return},n=(s)=>r._setClosed(s),i={type:"store_sql",sqlId:t,sql:e};return this._sendRequest(i,{responseCallback:o,errorCallback:n}),r}_closeSql(e){if(this.#n!==void 0)return;let t=()=>this.#l.free(e),r=(n)=>this.#u(n),o={type:"close_sql",sqlId:e};this._sendRequest(o,{responseCallback:t,errorCallback:r})}close(){this.#u(new Ge("Client was manually closed"))}get closed(){return this.#n!==void 0}}});var ga;var $F=S(()=>{if(typeof queueMicrotask<"u")ga=queueMicrotask;else{let e=Promise.resolve();ga=(t)=>{e.then(t)}}});class pT{#e;#t;#r;constructor(e){this.#e=new Uint8Array(new ArrayBuffer(e)),this.#t=0,this.#r=0}get length(){return this.#r-this.#t}data(){return this.#e.slice(this.#t,this.#r)}push(e){this.#n(e.byteLength),this.#e.set(e,this.#r),this.#r+=e.byteLength}#n(e){if(this.#r+e<=this.#e.byteLength)return;let t=this.#r-this.#t;if(t+e<=this.#e.byteLength&&2*this.#r>=this.#e.byteLength)this.#e.copyWithin(0,this.#t,this.#r);else{let r=this.#e.byteLength;do r*=2;while(t+e>r);let o=new Uint8Array(new ArrayBuffer(r));o.set(this.#e.slice(this.#t,this.#r),0),this.#e=o}this.#r=t,this.#t=0}shift(e){this.#t+=e}}function OF(e){let t=Ur(e.baton),r=Ur(e.base_url),o=_n(e.results,she);return{baton:t,baseUrl:r,results:o}}function she(e){let t=Tr(e.type);if(t==="ok")return{type:"ok",response:ahe(kt(e.response))};else if(t==="error")return{type:"error",error:Xi(kt(e.error))};else throw new Pe("Unexpected type of StreamResult")}function ahe(e){let t=Tr(e.type);if(t==="close")return{type:"close"};else if(t==="execute")return{type:"execute",result:Dp(kt(e.result))};else if(t==="batch")return{type:"batch",result:Uy(kt(e.result))};else if(t==="sequence")return{type:"sequence"};else if(t==="describe")return{type:"describe",result:qy(kt(e.result))};else if(t==="store_sql")return{type:"store_sql"};else if(t==="close_sql")return{type:"close_sql"};else if(t==="get_autocommit")return{type:"get_autocommit",isAutocommit:Wi(e.is_autocommit)};else throw new Pe("Unexpected type of StreamResponse")}function CF(e){let t=Ur(e.baton),r=Ur(e.base_url);return{baton:t,baseUrl:r}}var fT=S(()=>{Et();vl();Fy()});var PF,che,lhe,uhe,dhe,phe,fhe,zF;var mT=S(()=>{Jy();PF={default(){return{baton:void 0,baseUrl:void 0,results:[]}},1(e,t){t.baton=e.string()},2(e,t){t.baseUrl=e.string()},3(e,t){t.results.push(e.message(che))}},che={default(){return{type:"none"}},1(e){return{type:"ok",response:e.message(lhe)}},2(e){return{type:"error",error:e.message(on)}}},lhe={default(){return{type:"none"}},1(e){return{type:"close"}},2(e){return e.message(uhe)},3(e){return e.message(dhe)},4(e){return{type:"sequence"}},5(e){return e.message(phe)},6(e){return{type:"store_sql"}},7(e){return{type:"close_sql"}},8(e){return e.message(fhe)}},uhe={default(){return{type:"execute",result:es.default()}},1(e,t){t.result=e.message(es)}},dhe={default(){return{type:"batch",result:Al.default()}},1(e,t){t.result=e.message(Al)}},phe={default(){return{type:"describe",result:kl.default()}},1(e,t){t.result=e.message(kl)}},fhe={default(){return{type:"get_autocommit",isAutocommit:!1}},1(e,t){t.isAutocommit=e.bool()}},zF={default(){return{baton:void 0,baseUrl:void 0}},1(e,t){t.baton=e.string()},2(e,t){t.baseUrl=e.string()}}});var hT;var NF=S(()=>{vl();QR();Et();nn();fT();mT();Fy();Jy();hT=class hT extends Cp{#e;#t;#r;#n;#o;#i;constructor(e,t){super();this.#e=e,this.#t=t,this.#r=void 0,this.#n=new pT(16384),this.#o=void 0,this.#i=!1}async open(e){if(e.body===null)throw new Pe("No response body for cursor request");this.#r=e.body[Symbol.asyncIterator]();let t=await this.#a(CF,zF);if(t===void 0)throw new Pe("Empty response to cursor request");return t}next(){return this.#a(My,Hy)}close(){this._setClosed(new Ge("Cursor was manually closed"))}_setClosed(e){if(this.#o!==void 0)return;if(this.#o=e,this.#e._cursorClosed(this),this.#r!==void 0)this.#r.return()}get closed(){return this.#o!==void 0}async#a(e,t){for(;;){if(this.#i)return;else if(this.#o!==void 0)throw new _t("Cursor is closed",this.#o);if(this.#t==="json"){let n=this.#s();if(n!==void 0){let i=new TextDecoder().decode(n),s=JSON.parse(i);return pa(s,e)}}else if(this.#t==="protobuf"){let n=this.#c();if(n!==void 0)return Gi(n,t)}else throw Je(this.#t,"Impossible encoding");if(this.#r===void 0)throw new or("Attempted to read from HTTP cursor before it was opened");let{value:r,done:o}=await this.#r.next();if(o&&this.#n.length===0)this.#i=!0;else if(o)throw new Pe("Unexpected end of cursor stream");else this.#n.push(r)}}#s(){let e=this.#n.data(),t=10,r=e.indexOf(10);if(r<0)return;let o=e.slice(0,r);return this.#n.shift(r+1),o}#c(){let e=this.#n.data(),t=0,r=0;for(;;){if(r>=e.byteLength)return;let n=e[r];if(t|=(n&127)<<7*r,r+=1,!(n&128))break}if(e.byteLength<r+t)return;let o=e.slice(r,r+t);return this.#n.shift(r+t),o}}});function DF(e,t){if(t.baton!==void 0)e.string("baton",t.baton);e.arrayObjects("requests",t.requests,mhe)}function mhe(e,t){if(e.stringRaw("type",t.type),t.type==="close");else if(t.type==="execute")e.object("stmt",t.stmt,zp);else if(t.type==="batch")e.object("batch",t.batch,El);else if(t.type==="sequence"){if(t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId)}else if(t.type==="describe"){if(t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId)}else if(t.type==="store_sql")e.number("sql_id",t.sqlId),e.string("sql",t.sql);else if(t.type==="close_sql")e.number("sql_id",t.sqlId);else if(t.type==="get_autocommit");else throw Je(t,"Impossible type of StreamRequest")}function LF(e,t){if(t.baton!==void 0)e.string("baton",t.baton);e.object("batch",t.batch,El)}var gT=S(()=>{cT();nn()});function ZF(e,t){if(t.baton!==void 0)e.string(1,t.baton);for(let r of t.requests)e.message(2,r,hhe)}function hhe(e,t){if(t.type==="close")e.message(1,t,ghe);else if(t.type==="execute")e.message(2,t,yhe);else if(t.type==="batch")e.message(3,t,bhe);else if(t.type==="sequence")e.message(4,t,She);else if(t.type==="describe")e.message(5,t,vhe);else if(t.type==="store_sql")e.message(6,t,whe);else if(t.type==="close_sql")e.message(7,t,xhe);else if(t.type==="get_autocommit")e.message(8,t,_he);else throw Je(t,"Impossible type of StreamRequest")}function ghe(e,t){}function yhe(e,t){e.message(1,t.stmt,Np)}function bhe(e,t){e.message(1,t.batch,Il)}function She(e,t){if(t.sql!==void 0)e.string(1,t.sql);if(t.sqlId!==void 0)e.int32(2,t.sqlId)}function vhe(e,t){if(t.sql!==void 0)e.string(1,t.sql);if(t.sqlId!==void 0)e.int32(2,t.sqlId)}function whe(e,t){e.int32(1,t.sqlId),e.string(2,t.sql)}function xhe(e,t){e.int32(1,t.sqlId)}function _he(e,t){}function jF(e,t){if(t.baton!==void 0)e.string(1,t.baton);e.message(2,t.batch,Il)}var yT=S(()=>{uT();nn()});function Ehe(e,t){if(t.results.length!==e.length)throw new Pe("Server returned unexpected number of pipeline results");for(let r=0;r<e.length;++r){let o=t.results[r],n=e[r];if(o.type==="ok"){if(o.response.type!==n.request.type)throw new Pe("Received unexpected type of response");n.responseCallback(o.response)}else if(o.type==="error")n.errorCallback(Uo(o.error));else if(o.type==="none")throw new Pe("Received unrecognized type of StreamResult");else throw Je(o,"Received impossible type of StreamResult")}}async function Ihe(e,t){if(t==="json"){let r=await e.json();return pa(r,OF)}if(t==="protobuf"){let r=await e.arrayBuffer();return Gi(new Uint8Array(r),PF)}throw await e.body?.cancel(),Je(t,"Impossible encoding")}async function Ahe(e){let t=e.headers.get("content-type")??"text/plain",r=`Server returned HTTP status ${e.status}`;if(t==="application/json"){let o=await e.json();if("message"in o)return Uo(o);return new da(r,e.status)}if(t==="text/plain"){let o=(await e.text()).trim();if(o!=="")r+=`: ${o}`;return new da(r,e.status)}return await e.body?.cancel(),new da(r,e.status)}var Wy;var bT=S(()=>{Et();XR();eT();$F();Tp();xl();By();nn();NF();gT();yT();gT();yT();fT();mT();Wy=class Wy extends _l{#e;#t;#r;#n;#o;#i;#a;#s;#c;#l;#d;#p;#m;constructor(e,t,r,o,n){super(e.intMode);this.#e=e,this.#t=t.toString(),this.#r=r,this.#n=o,this.#o=n,this.#i=void 0,this.#a=new Yi,this.#s=!1,this.#l=!1,this.#d=!1,this.#p=void 0,this.#m=new Qi}client(){return this.#e}_sqlOwner(){return this}storeSql(e){let t=this.#m.alloc();return this.#f({type:"store_sql",sqlId:t,sql:e}).then(()=>{return},(r)=>this._setClosed(r)),new ha(this,t)}_closeSql(e){if(this.#p!==void 0)return;this.#f({type:"close_sql",sqlId:e}).then(()=>this.#m.free(e),(t)=>this._setClosed(t))}_execute(e){return this.#f({type:"execute",stmt:e}).then((t)=>t.result)}_batch(e){return this.#f({type:"batch",batch:e}).then((t)=>t.result)}_describe(e){return this.#f({type:"describe",sql:e.sql,sqlId:e.sqlId}).then((t)=>t.result)}_sequence(e){return this.#f({type:"sequence",sql:e.sql,sqlId:e.sqlId}).then((t)=>{return})}getAutocommit(){return this.#e._ensureVersion(3,"getAutocommit()"),this.#f({type:"get_autocommit"}).then((e)=>e.isAutocommit)}#f(e){return new Promise((t,r)=>{this.#g({type:"pipeline",request:e,responseCallback:t,errorCallback:r})})}_openCursor(e){return new Promise((t,r)=>{this.#g({type:"cursor",batch:e,cursorCallback:t,errorCallback:r})})}_cursorClosed(e){if(e!==this.#c)throw new or("Cursor was closed, but it was not associated with the stream");this.#c=void 0,ga(()=>this.#u())}close(){this._setClosed(new Ge("Stream was manually closed"))}closeGracefully(){this.#l=!0,ga(()=>this.#u())}get closed(){return this.#p!==void 0||this.#l}_setClosed(e){if(this.#p!==void 0)return;if(this.#p=e,this.#c!==void 0)this.#c._setClosed(e);this.#e._streamClosed(this);for(;;){let t=this.#a.shift();if(t!==void 0)t.errorCallback(e);else break}if((this.#i!==void 0||this.#s)&&!this.#d)this.#a.push({type:"pipeline",request:{type:"close"},responseCallback:()=>{return},errorCallback:()=>{return}}),this.#d=!0,ga(()=>this.#u())}#g(e){if(this.#p!==void 0)throw new _t("Stream is closed",this.#p);else if(this.#l)throw new _t("Stream is closing",void 0);else this.#a.push(e),ga(()=>this.#u())}#u(){if(this.#s||this.#c!==void 0)return;if(this.#l&&this.#a.length===0){this._setClosed(new Ge("Stream was gracefully closed"));return}let e=this.#e._endpoint;if(e===void 0){this.#e._endpointPromise.then(()=>this.#u(),(r)=>this._setClosed(r));return}let t=this.#a.shift();if(t===void 0)return;else if(t.type==="pipeline"){let r=[t];for(;;){let o=this.#a.first();if(o!==void 0&&o.type==="pipeline")r.push(o),this.#a.shift();else if(o===void 0&&this.#l&&!this.#d){r.push({type:"pipeline",request:{type:"close"},responseCallback:()=>{return},errorCallback:()=>{return}}),this.#d=!0;break}else break}this.#y(e,r)}else if(t.type==="cursor")this.#b(e,t);else throw Je(t,"Impossible type of QueueEntry")}#y(e,t){this.#h(()=>this.#S(t,e),(r)=>Ihe(r,e.encoding),(r)=>r.baton,(r)=>r.baseUrl,(r)=>Ehe(t,r),(r)=>t.forEach((o)=>o.errorCallback(r)))}#b(e,t){let r=new hT(this,e.encoding);this.#c=r,this.#h(()=>this.#v(t,e),(o)=>r.open(o),(o)=>o.baton,(o)=>o.baseUrl,(o)=>t.cursorCallback(r),(o)=>t.errorCallback(o))}#h(e,t,r,o,n,i){let s;try{let a=e(),l=this.#n;s=l(a)}catch(a){s=Promise.reject(a)}this.#s=!0,s.then((a)=>{if(!a.ok)return Ahe(a).then((l)=>{throw l});return t(a)}).then((a)=>{this.#i=r(a),this.#t=o(a)??this.#t,n(a)}).catch((a)=>{this._setClosed(a),i(a)}).finally(()=>{this.#s=!1,this.#u()})}#S(e,t){return this.#w(new URL(t.pipelinePath,this.#t),{baton:this.#i,requests:e.map((r)=>r.request)},t.encoding,DF,ZF)}#v(e,t){if(t.cursorPath===void 0)throw new xn(`Cursors are supported only on protocol version 3 and higher, but the HTTP server only supports version ${t.version}.`);return this.#w(new URL(t.cursorPath,this.#t),{baton:this.#i,batch:e.batch},t.encoding,LF,jF)}#w(e,t,r,o,n){let i,s;if(r==="json")i=Ip(t,o),s="application/json";else if(r==="protobuf")i=Rp(t,n),s="application/x-protobuf";else throw Je(r,"Impossible encoding");let a=new Headers;if(a.set("content-type",s),this.#r!==void 0)a.set("authorization",`Bearer ${this.#r}`);if(this.#o!==void 0)a.set("x-turso-encryption-key",this.#o);return new Request(e.toString(),{method:"POST",headers:a,body:i})}}});async function Rhe(e,t){let r=e;for(let o of khe){let n=new URL(o.versionPath,t),i=new Request(n.toString(),{method:"GET"}),s=await r(i);if(await s.arrayBuffer(),s.ok)return o}return ST}var khe,ST,Gy;var vT=S(()=>{Et();bT();khe=[{versionPath:"v3-protobuf",pipelinePath:"v3-protobuf/pipeline",cursorPath:"v3-protobuf/cursor",version:3,encoding:"protobuf"}],ST={versionPath:"v2",pipelinePath:"v2/pipeline",cursorPath:void 0,version:2,encoding:"json"};Gy=class Gy extends yl{#e;#t;#r;#n;#o;#i;_endpointPromise;_endpoint;constructor(e,t,r,o,n=2){super();if(this.#e=e,this.#t=t,this.#r=r??globalThis.fetch,this.#n=o,this.#o=void 0,this.#i=new Set,n==3)this._endpointPromise=Rhe(this.#r,this.#e),this._endpointPromise.then((i)=>this._endpoint=i,(i)=>this.#a(i));else this._endpointPromise=Promise.resolve(ST),this._endpointPromise.then((i)=>this._endpoint=i,(i)=>this.#a(i))}async getVersion(){if(this._endpoint!==void 0)return this._endpoint.version;return(await this._endpointPromise).version}_ensureVersion(e,t){if(e<=ST.version)return;else if(this._endpoint===void 0)throw new xn(`${t} is supported only on protocol version ${e} and higher, but the version supported by the HTTP server is not yet known. Use Client.getVersion() to wait until the version is available.`);else if(this._endpoint.version<e)throw new xn(`${t} is supported only on protocol version ${e} and higher, but the HTTP server only supports version ${this._endpoint.version}.`)}openStream(){if(this.#o!==void 0)throw new _t("Client is closed",this.#o);let e=new Wy(this,this.#e,this.#t,this.#r,this.#n);return this.#i.add(e),e}_streamClosed(e){this.#i.delete(e)}close(){this.#a(new Ge("Client was manually closed"))}get closed(){return this.#o!==void 0}#a(e){if(this.#o!==void 0)return;this.#o=e;for(let t of Array.from(this.#i))t._setClosed(new _t("Client was closed",e))}}});var BF=S(()=>{Et()});function wT(e,t,r=2){if(typeof Vi>"u")throw new _p("WebSockets are not supported in this environment");var o=void 0;if(r==3)o=Array.from(dT.keys());else o=Array.from(TF.keys());let n=new Vi(e,o);return new Ky(n,t)}function xT(e,t,r,o,n=2){return new Gy(e instanceof URL?e:new URL(e),t,r,o,n)}var Qy=S(()=>{GR();Vy();Et();vT();Vy();GR();oT();BF();xl();Zy();By();vT();bT();Vy();sT();Et()});class Lp{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=void 0}execute(e){return this.batch([e]).then((t)=>t[0])}async batch(e){let t=this._getStream();if(t.closed)throw new Ce("Cannot execute statements because the transaction is closed","TRANSACTION_CLOSED");try{let r=e.map(Mo),o;if(this.#r===void 0){this._getSqlCache().apply(r);let i=t.batch(this.#t>=3),s=i.step(),a=s.run(Ji(this.#e)),l=s;o=r.map((u)=>{let d=i.step().condition(ut.ok(l));if(this.#t>=3)d.condition(ut.not(ut.isAutocommit(i)));let p=d.query(u);return p.catch(()=>{return}),l=d,p}),this.#r=i.execute().then(()=>a).then(()=>{return});try{await this.#r}catch(u){throw this.close(),u}}else{if(this.#t<3)await this.#r;this._getSqlCache().apply(r);let i=t.batch(this.#t>=3),s=void 0;o=r.map((a)=>{let l=i.step();if(s!==void 0)l.condition(ut.ok(s));if(this.#t>=3)l.condition(ut.not(ut.isAutocommit(i)));let u=l.query(a);return u.catch(()=>{return}),s=l,u}),await i.execute()}let n=[];for(let i=0;i<o.length;i++)try{let s=await o[i];if(s===void 0)throw new Wt("Statement in a transaction was not executed, probably because the transaction has been rolled back",i,"TRANSACTION_CLOSED");n.push(Tl(s))}catch(s){if(s instanceof Wt)throw s;let a=st(s);if(a instanceof Ce)throw new Wt(a.message,i,a.code,a.extendedCode,a.rawCode,a.cause instanceof Error?a.cause:void 0);throw a}return n}catch(r){throw st(r)}}async executeMultiple(e){let t=this._getStream();if(t.closed)throw new Ce("Cannot execute statements because the transaction is closed","TRANSACTION_CLOSED");try{if(this.#r===void 0){this.#r=t.run(Ji(this.#e)).then(()=>{return});try{await this.#r}catch(r){throw this.close(),r}}else await this.#r;await t.sequence(e)}catch(r){throw st(r)}}async rollback(){try{let e=this._getStream();if(e.closed)return;if(this.#r!==void 0);else return;let t=e.run("ROLLBACK").catch((r)=>{throw st(r)});e.closeGracefully(),await t}catch(e){throw st(e)}finally{this.close()}}async commit(){try{let e=this._getStream();if(e.closed)throw new Ce("Cannot commit the transaction because it is already closed","TRANSACTION_CLOSED");if(this.#r!==void 0)await this.#r;else return;let t=e.run("COMMIT").catch((r)=>{throw st(r)});e.closeGracefully(),await t}catch(e){throw st(e)}finally{this.close()}}}async function Rl(e,t,r,o,n=!1){if(n)r.step().run("PRAGMA foreign_keys=off");let i=r.step(),s=i.run(Ji(e)),a=i,l=o.map((h)=>{let b=r.step().condition(ut.ok(a));if(t>=3)b.condition(ut.not(ut.isAutocommit(r)));let y=b.query(h);return a=b,y}),u=r.step().condition(ut.ok(a));if(t>=3)u.condition(ut.not(ut.isAutocommit(r)));let d=u.run("COMMIT");if(r.step().condition(ut.not(ut.ok(u))).run("ROLLBACK").catch((h)=>{return}),n)r.step().run("PRAGMA foreign_keys=on");await r.execute();let m=[];await s;for(let h=0;h<l.length;h++)try{let b=await l[h];if(b===void 0)throw new Wt("Statement in a batch was not executed, probably because the transaction has been rolled back",h,"TRANSACTION_CLOSED");m.push(Tl(b))}catch(b){if(b instanceof Wt)throw b;let y=st(b);if(y instanceof Ce)throw new Wt(y.message,h,y.code,y.extendedCode,y.rawCode,y.cause instanceof Error?y.cause:void 0);throw y}return await d,m}function Mo(e){let t,r;if(Array.isArray(e))[t,r]=e;else if(typeof e==="string")t=e;else t=e.sql,r=e.args;let o=new Op(t);if(r)if(Array.isArray(r))o.bindIndexes(r);else for(let[n,i]of Object.entries(r))o.bindName(n,i);return o}function Tl(e){let t=e.columnNames.map((s)=>s??""),r=e.columnDecltypes.map((s)=>s??""),o=e.rows,n=e.affectedRowCount,i=e.lastInsertRowid!==void 0?e.lastInsertRowid:void 0;return new fl(t,r,o,n,i)}function st(e){if(e instanceof Ge){let t=UF(e);return new Ce(e.message,t,void 0,void 0,e)}return e}function UF(e){if(e instanceof xp&&e.code!==void 0)return e.code;else if(e instanceof Pe)return"HRANA_PROTO_ERROR";else if(e instanceof _t)return e.cause instanceof Ge?UF(e.cause):"HRANA_CLOSED_ERROR";else if(e instanceof bl)return"HRANA_WEBSOCKET_ERROR";else if(e instanceof da)return"SERVER_ERROR";else if(e instanceof xn)return"PROTOCOL_VERSION_ERROR";else if(e instanceof or)return"INTERNAL_ERROR";else return"UNKNOWN"}var ET=S(()=>{Qy();wn();ml()});class $l{#e;#t;capacity;constructor(e,t){this.#e=e,this.#t=new MF,this.capacity=t}apply(e){if(this.capacity<=0)return;let t=new Set;for(let r of e){if(typeof r.sql!=="string")continue;let o=r.sql;if(o.length>=5000)continue;let n=this.#t.get(o);if(n===void 0){while(this.#t.size+1>this.capacity){let[i,s]=this.#t.peekLru();if(t.has(s))break;s.close(),this.#t.delete(i)}if(this.#t.size+1<=this.capacity)n=this.#e.storeSql(o),this.#t.set(o,n)}if(n!==void 0)r.sql=n,t.add(n)}}}class MF{#e;constructor(){this.#e=new Map}get(e){let t=this.#e.get(e);if(t!==void 0)this.#e.delete(e),this.#e.set(e,t);return t}set(e,t){this.#e.set(e,t)}peekLru(){for(let e of this.#e.entries())return e;return}delete(e){this.#e.delete(e)}get size(){return this.#e.size}}var IT=ge(function(KBe,FF){function The(e){var t=0,r=[];function o(){if(t--,t<e)n()}function n(){var l=r.shift();if(a.queue=r.length,l)s(l.fn).then(l.resolve).catch(l.reject)}function i(l){return new Promise(function(u,d){r.push({fn:l,resolve:u,reject:d}),a.queue=r.length})}function s(l){t++;try{return Promise.resolve(l()).then(function(u){return o(),u},function(u){throw o(),u})}catch(u){return o(),Promise.reject(u)}}var a=function(l){if(t>=e)return i(l);else return s(l)};return a}function $he(e,t){var r=!1,o=this;return Promise.all(e.map(function(){var n=arguments;return o(function(){if(!r)return t.apply(void 0,n).catch(function(i){throw r=!0,i})})}))}function qF(e){return e.queue=0,e.map=$he,e}FF.exports=function(e){if(e)return qF(The(e));else return qF(function(t){return t()})}});function KF(e){if(e.scheme!=="wss"&&e.scheme!=="ws")throw new Ce(`The WebSocket client supports only "libsql:", "wss:" and "ws:" URLs, got ${JSON.stringify(e.scheme+":")}. For more information, please read ${to}`,"URL_SCHEME_NOT_SUPPORTED");if(e.encryptionKey!==void 0)throw new Ce("Encryption key is not supported by the remote client.","ENCRYPTION_KEY_NOT_SUPPORTED");if(e.scheme==="ws"&&e.tls)throw new Ce('A "ws:" URL cannot opt into TLS by using ?tls=1',"URL_INVALID");else if(e.scheme==="wss"&&!e.tls)throw new Ce('A "wss:" URL cannot opt out of TLS by using ?tls=0',"URL_INVALID");let t=yp(e.scheme,e.authority,e.path),r;try{r=wT(t,e.authToken)}catch(o){if(o instanceof _p){let n=e.scheme==="wss"?"https":"http",i=yp(n,e.authority,e.path);throw new Ce(`This environment does not support WebSockets, please switch to the HTTP client by using a "${n}:" URL (${JSON.stringify(i)}). For more information, please read ${to}`,"WEBSOCKETS_NOT_SUPPORTED")}throw st(o)}return new VF(r,t,e.authToken,e.intMode,e.concurrency)}class VF{#e;#t;#r;#n;#o;closed;protocol;#i;#a;constructor(e,t,r,o,n){this.#e=t,this.#t=r,this.#r=o,this.#n=this.#c(e),this.#o=void 0,this.closed=!1,this.protocol="ws",this.#a=JF.default(n)}async limit(e){return this.#a(e)}async execute(e,t){let r;if(typeof e==="string")r={sql:e,args:t||[]};else r=e;return this.limit(async()=>{let o=await this.#s();try{let n=Mo(r);o.conn.sqlCache.apply([n]);let i=o.stream.query(n);o.stream.closeGracefully();let s=await i;return Tl(s)}catch(n){throw st(n)}finally{this._closeStream(o)}})}async batch(e,t="deferred"){return this.limit(async()=>{let r=await this.#s();try{let n=e.map((u)=>{if(Array.isArray(u))return{sql:u[0],args:u[1]||[]};return u}).map(Mo),i=await r.conn.client.getVersion();r.conn.sqlCache.apply(n);let s=r.stream.batch(i>=3);return await Rl(t,i,s,n)}catch(o){throw st(o)}finally{this._closeStream(r)}})}async migrate(e){return this.limit(async()=>{let t=await this.#s();try{let r=e.map(Mo),o=await t.conn.client.getVersion(),n=t.stream.batch(o>=3);return await Rl("deferred",o,n,r,!0)}catch(r){throw st(r)}finally{this._closeStream(t)}})}async transaction(e="write"){return this.limit(async()=>{let t=await this.#s();try{let r=await t.conn.client.getVersion();return new WF(this,t,e,r)}catch(r){throw this._closeStream(t),st(r)}})}async executeMultiple(e){return this.limit(async()=>{let t=await this.#s();try{let r=t.stream.sequence(e);t.stream.closeGracefully(),await r}catch(r){throw st(r)}finally{this._closeStream(t)}})}sync(){throw new Ce("sync not supported in ws mode","SYNC_NOT_SUPPORTED")}async#s(){if(this.closed)throw new Ce("The client is closed","CLIENT_CLOSED");if(new Date().valueOf()-this.#n.openTime.valueOf()>Ohe&&this.#o===void 0){let o=this.#c();this.#o=o,o.client.getVersion().then((n)=>{if(this.#n!==o){if(this.#n.streamStates.size===0)this.#n.client.close()}this.#n=o,this.#o=void 0},(n)=>{this.#o=void 0})}if(this.#n.client.closed)try{if(this.#o!==void 0)this.#n=this.#o;else this.#n=this.#c()}catch(o){throw st(o)}let r=this.#n;try{if(r.useSqlCache===void 0){if(r.useSqlCache=await r.client.getVersion()>=2,r.useSqlCache)r.sqlCache.capacity=HF}let o=r.client.openStream();o.intMode=this.#r;let n={conn:r,stream:o};return r.streamStates.add(n),n}catch(o){throw st(o)}}#c(e){try{return e??=wT(this.#e,this.#t),{client:e,useSqlCache:void 0,sqlCache:new $l(e,0),openTime:new Date,streamStates:new Set}}catch(t){throw st(t)}}async reconnect(){try{for(let r of Array.from(this.#n.streamStates))try{r.stream.close()}catch{}this.#n.client.close()}catch{}if(this.#o){try{this.#o.client.close()}catch{}this.#o=void 0}let e=this.#c(),t=await e.client.getVersion();if(e.useSqlCache=t>=2,e.useSqlCache)e.sqlCache.capacity=HF;this.#n=e,this.closed=!1}_closeStream(e){e.stream.close();let t=e.conn;if(t.streamStates.delete(e),t.streamStates.size===0&&t!==this.#n)t.client.close()}close(){if(this.#n.client.close(),this.closed=!0,this.#o){try{this.#o.client.close()}catch{}this.#o=void 0}this.closed=!0}}var JF,Ohe=60000,HF=100,WF;var GF=S(()=>{Qy();wn();vp();ET();ky();ml();JF=Jl(IT(),1);wn();WF=class WF extends Lp{#e;#t;constructor(e,t,r,o){super(r,o);this.#e=e,this.#t=t}_getStream(){return this.#t.stream}_getSqlCache(){return this.#t.conn.sqlCache}close(){this.#e._closeStream(this.#t)}get closed(){return this.#t.stream.closed}}});function YF(e){if(e.scheme!=="https"&&e.scheme!=="http")throw new Ce(`The HTTP client supports only "libsql:", "https:" and "http:" URLs, got ${JSON.stringify(e.scheme+":")}. For more information, please read ${to}`,"URL_SCHEME_NOT_SUPPORTED");if(e.encryptionKey!==void 0)throw new Ce("Encryption key is not supported by the remote client.","ENCRYPTION_KEY_NOT_SUPPORTED");if(e.scheme==="http"&&e.tls)throw new Ce('A "http:" URL cannot opt into TLS by using ?tls=1',"URL_INVALID");else if(e.scheme==="https"&&!e.tls)throw new Ce('A "https:" URL cannot opt out of TLS by using ?tls=0',"URL_INVALID");let t=yp(e.scheme,e.authority,e.path);return new e3(t,e.authToken,e.intMode,e.fetch,e.concurrency,e.remoteEncryptionKey)}class e3{#e;protocol;#t;#r;#n;#o;#i;#a;#s;constructor(e,t,r,o,n,i){this.#t=e,this.#i=t,this.#r=r,this.#n=o,this.#o=n,this.#a=i,this.#e=xT(this.#t,this.#i,this.#n,i),this.#e.intMode=this.#r,this.protocol="http",this.#s=QF.default(this.#o)}async limit(e){return this.#s(e)}async execute(e,t){let r;if(typeof e==="string")r={sql:e,args:t||[]};else r=e;return this.limit(async()=>{try{let o=Mo(r),n,i=this.#e.openStream();try{n=i.query(o)}finally{i.closeGracefully()}let s=await n;return Tl(s)}catch(o){throw st(o)}})}async batch(e,t="deferred"){return this.limit(async()=>{try{let o=e.map((l)=>{if(Array.isArray(l))return{sql:l[0],args:l[1]||[]};return l}).map(Mo),n=await this.#e.getVersion(),i,s=this.#e.openStream();try{new $l(s,XF).apply(o);let u=s.batch(!1);i=Rl(t,n,u,o)}finally{s.closeGracefully()}return await i}catch(r){throw st(r)}})}async migrate(e){return this.limit(async()=>{try{let t=e.map(Mo),r=await this.#e.getVersion(),o,n=this.#e.openStream();try{let s=n.batch(!1);o=Rl("deferred",r,s,t,!0)}finally{n.closeGracefully()}return await o}catch(t){throw st(t)}})}async transaction(e="write"){return this.limit(async()=>{try{let t=await this.#e.getVersion();return new t3(this.#e.openStream(),e,t)}catch(t){throw st(t)}})}async executeMultiple(e){return this.limit(async()=>{try{let t,r=this.#e.openStream();try{t=r.sequence(e)}finally{r.closeGracefully()}await t}catch(t){throw st(t)}})}sync(){throw new Ce("sync not supported in http mode","SYNC_NOT_SUPPORTED")}close(){this.#e.close()}async reconnect(){try{if(!this.closed)this.#e.close()}finally{this.#e=xT(this.#t,this.#i,this.#n,this.#a),this.#e.intMode=this.#r}}get closed(){return this.#e.closed}}var QF,XF=30,t3;var r3=S(()=>{Qy();wn();vp();ET();ky();ml();QF=Jl(IT(),1);wn();t3=class t3 extends Lp{#e;#t;constructor(e,t,r){super(t,r);this.#e=e,this.#t=new $l(e,XF)}_getStream(){return this.#e}_getSqlCache(){return this.#t}close(){this.#e.close()}get closed(){return this.#e.closed}}});function Ol(e){return Che(Sp(e,!0))}function Che(e){if(e.scheme==="wss"||e.scheme==="ws")return KF(e);else if(e.scheme==="https"||e.scheme==="http")return YF(e);else return Q4(e)}var AT=S(()=>{vp();rF();GF();r3();wn()});function oe(e,t){if(!e||typeof e!=="object")return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,F))throw Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let r=Object.getPrototypeOf(e).constructor;if(r)while(r){if(F in r&&r[F]===t[F])return!0;r=Object.getPrototypeOf(r)}return!1}var F;var $e=S(()=>{F=Symbol.for("drizzle:entityKind")});var Ke;var En=S(()=>{$e();Ke=class Ke{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[F]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}});var Zp;var Yy=S(()=>{$e();Zp=class Zp{static[F]="ColumnBuilder";config;constructor(e,t,r){this.config={name:e,keyAsName:e==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:r,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){if(this.config.name!=="")return;this.config.name=e}}});var ir;var Cl=S(()=>{ir=Symbol.for("drizzle:Name")});var kT,n3;var o3=S(()=>{$e();Cl();kT=class kT{static[F]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){if(this.reference=()=>{let{name:r,columns:o,foreignColumns:n}=e();return{name:r,columns:o,foreignTable:n[0].table,foreignColumns:n}},t)this._onUpdate=t.onUpdate,this._onDelete=t.onDelete}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new n3(e,this)}};n3=class n3{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[F]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:r}=this.reference(),o=t.map((s)=>s.name),n=r.map((s)=>s.name),i=[this.table[ir],...o,r[0].table[ir],...n];return e??`${i.join("_")}_fk`}}});function Xy(e,...t){return e(...t)}var RT=()=>{};function TT(e,t){return`${e[ir]}_${t.join("_")}_unique`}var i3,Phe,s3;var a3=S(()=>{$e();Cl();i3=class i3{constructor(e,t){this.name=t,this.columns=e}static[F]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new s3(e,this.columns,this.nullsNotDistinctConfig,this.name)}};Phe=class Phe{static[F]="PgUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new i3(e,this.name)}};s3=class s3{constructor(e,t,r,o){this.table=e,this.columns=t,this.name=o??TT(this.table,this.columns.map((n)=>n.name)),this.nullsNotDistinct=r}static[F]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}}});function c3(e,t,r){for(let o=t;o<e.length;o++){let n=e[o];if(n==="\\"){o++;continue}if(n==='"')return[e.slice(t,o).replace(/\\/g,""),o+1];if(r)continue;if(n===","||n==="}")return[e.slice(t,o).replace(/\\/g,""),o]}return[e.slice(t).replace(/\\/g,""),e.length]}function l3(e,t=0){let r=[],o=t,n=!1;while(o<e.length){let i=e[o];if(i===","){if(n||o===t)r.push("");n=!0,o++;continue}if(n=!1,i==="\\"){o+=2;continue}if(i==='"'){let[l,u]=c3(e,o+1,!0);r.push(l),o=u;continue}if(i==="}")return[r,o+1];if(i==="{"){let[l,u]=l3(e,o+1);r.push(l),o=u;continue}let[s,a]=c3(e,o,!1);r.push(s),o=a}return[r,o]}function u3(e){let[t]=l3(e,1);return t}function $T(e){return`{${e.map((t)=>{if(Array.isArray(t))return $T(t);if(typeof t==="string")return`"${t.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${t}`}).join(",")}}`}var d3=()=>{};var jp,Pl,p3,zhe,f3,OT;var m3=S(()=>{Yy();En();$e();o3();RT();a3();d3();jp=class jp extends Zp{foreignKeyConfigs=[];static[F]="PgColumnBuilder";array(e){return new f3(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:r,actions:o})=>Xy((n,i)=>{let s=new kT(()=>{let a=n();return{columns:[e],foreignColumns:[a]}});if(i.onUpdate)s.onUpdate(i.onUpdate);if(i.onDelete)s.onDelete(i.onDelete);return s.build(t)},r,o))}buildExtraConfigColumn(e){return new p3(e,this.config)}};Pl=class Pl extends Ke{constructor(e,t){if(!t.uniqueName)t.uniqueName=TT(e,[t.name]);super(e,t);this.table=e}static[F]="PgColumn"};p3=class p3 extends Pl{static[F]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}};zhe=class zhe{static[F]="IndexedColumn";constructor(e,t,r,o){this.name=e,this.keyAsName=t,this.type=r,this.indexConfig=o}name;keyAsName;type;indexConfig};f3=class f3 extends jp{static[F]="PgArrayBuilder";constructor(e,t,r){super(e,"array","PgArray");this.config.baseBuilder=t,this.config.size=r}build(e){let t=this.config.baseBuilder.build(e);return new OT(e,this.config,t)}};OT=class OT extends Pl{constructor(e,t,r,o){super(e,t);this.baseColumn=r,this.range=o,this.size=t.size}size;static[F]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue(e){if(typeof e==="string")e=u3(e);return e.map((t)=>this.baseColumn.mapFromDriverValue(t))}mapToDriverValue(e,t=!1){let r=e.map((o)=>o===null?null:oe(this.baseColumn,OT)?this.baseColumn.mapToDriverValue(o,!0):this.baseColumn.mapToDriverValue(o));if(t)return r;return $T(r)}}});function y3(e){return!!e&&typeof e==="function"&&h3 in e&&e[h3]===!0}var Nhe,g3,h3,Dhe,b3;var S3=S(()=>{$e();m3();Nhe=class Nhe extends jp{static[F]="PgEnumObjectColumnBuilder";constructor(e,t){super(e,"string","PgEnumObjectColumn");this.config.enum=t}build(e){return new g3(e,this.config)}};g3=class g3 extends Pl{static[F]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t);this.enum=t.enum}getSQLType(){return this.enum.enumName}};h3=Symbol.for("drizzle:isPgEnum");Dhe=class Dhe extends jp{static[F]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn");this.config.enum=t}build(e){return new b3(e,this.config)}};b3=class b3 extends Pl{static[F]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t);this.enum=t.enum}getSQLType(){return this.enum.enumName}}});var dt,Bp;var In=S(()=>{$e();dt=class dt{static[F]="Subquery";constructor(e,t,r,o=!1,n=[]){this._={brand:"Subquery",sql:e,selectedFields:t,alias:r,isWith:o,usedTables:n}}};Bp=class Bp extends dt{static[F]="WithSubquery"}});var v3="0.45.2";var w3=()=>{};var CT,PT,x3;var _3=S(()=>{RT();w3();x3={startActiveSpan(e,t){if(!CT)return t();if(!PT)PT=CT.trace.getTracer("drizzle-orm",v3);return Xy((r,o)=>o.startActiveSpan(e,(n)=>{try{return t(n)}catch(i){throw n.setStatus({code:r.SpanStatusCode.ERROR,message:i instanceof Error?i.message:"Unknown error"}),i}finally{n.end()}}),CT,PT)}}});var pt;var qo=S(()=>{pt=Symbol.for("drizzle:ViewBaseConfig")});function ts(e){return e[ir]}function ya(e){return`${e[eb]??"public"}.${e[ir]}`}var eb,tb,E3,zT,NT,Up,I3,Lhe,he;var sr=S(()=>{$e();Cl();eb=Symbol.for("drizzle:Schema"),tb=Symbol.for("drizzle:Columns"),E3=Symbol.for("drizzle:ExtraConfigColumns"),zT=Symbol.for("drizzle:OriginalName"),NT=Symbol.for("drizzle:BaseName"),Up=Symbol.for("drizzle:IsAlias"),I3=Symbol.for("drizzle:ExtraConfigBuilder"),Lhe=Symbol.for("drizzle:IsDrizzleTable");he=class he{static[F]="Table";static Symbol={Name:ir,Schema:eb,OriginalName:zT,Columns:tb,ExtraConfigColumns:E3,BaseName:NT,IsAlias:Up,ExtraConfigBuilder:I3};[ir];[zT];[eb];[tb];[E3];[NT];[Up]=!1;[Lhe]=!0;[I3]=void 0;constructor(e,t,r){this[ir]=this[zT]=e,this[eb]=t,this[NT]=r}}});function DT(e){return e!==null&&e!==void 0&&typeof e.getSQL==="function"}function jhe(e){let t={sql:"",params:[]};for(let r of e)if(t.sql+=r.sql,t.params.push(...r.params),r.typings?.length){if(!t.typings)t.typings=[];t.typings.push(...r.typings)}return t}function A3(e){return typeof e==="object"&&e!==null&&"mapToDriverValue"in e&&typeof e.mapToDriverValue==="function"}function C(e,...t){let r=[];if(t.length>0||e.length>0&&e[0]!=="")r.push(new Nt(e[0]));for(let[o,n]of t.entries())r.push(n,new Nt(e[o+1]));return new Ee(r)}function Mp(e,t){return e.map((r)=>{if(oe(r,rs)){if(!(r.name in t))throw Error(`No value for placeholder "${r.name}" was provided`);return t[r.name]}if(oe(r,Mr)&&oe(r.value,rs)){if(!(r.value.name in t))throw Error(`No value for placeholder "${r.value.name}" was provided`);return r.encoder.mapToDriverValue(t[r.value.name])}return r})}var Zhe,Nt,Ee,rb,k3,R3,o6e,Mr,rs,Bhe,sn;var Qt=S(()=>{$e();S3();In();_3();qo();En();sr();Zhe=class Zhe{static[F]="FakePrimitiveParam"};Nt=class Nt{static[F]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new Ee([this])}};Ee=class Ee{constructor(e){this.queryChunks=e;for(let t of e)if(oe(t,he)){let r=t[he.Symbol.Schema];this.usedTables.push(r===void 0?t[he.Symbol.Name]:r+"."+t[he.Symbol.Name])}}static[F]="SQL";decoder=k3;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return x3.startActiveSpan("drizzle.buildSQL",(t)=>{let r=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":r.sql,"drizzle.query.params":JSON.stringify(r.params)}),r})}buildQueryFromSourceParams(e,t){let r=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:o,escapeName:n,escapeParam:i,prepareTyping:s,inlineParams:a,paramStartIndex:l}=r;return jhe(e.map((u)=>{if(oe(u,Nt))return{sql:u.value.join(""),params:[]};if(oe(u,rb))return{sql:n(u.value),params:[]};if(u===void 0)return{sql:"",params:[]};if(Array.isArray(u)){let d=[new Nt("(")];for(let[p,m]of u.entries())if(d.push(m),p<u.length-1)d.push(new Nt(", "));return d.push(new Nt(")")),this.buildQueryFromSourceParams(d,r)}if(oe(u,Ee))return this.buildQueryFromSourceParams(u.queryChunks,{...r,inlineParams:a||u.shouldInlineParams});if(oe(u,he)){let d=u[he.Symbol.Schema],p=u[he.Symbol.Name];return{sql:d===void 0||u[Up]?n(p):n(d)+"."+n(p),params:[]}}if(oe(u,Ke)){let d=o.getColumnCasing(u);if(t.invokeSource==="indexes")return{sql:n(d),params:[]};let p=u.table[he.Symbol.Schema];return{sql:u.table[Up]||p===void 0?n(u.table[he.Symbol.Name])+"."+n(d):n(p)+"."+n(u.table[he.Symbol.Name])+"."+n(d),params:[]}}if(oe(u,sn)){let d=u[pt].schema,p=u[pt].name;return{sql:d===void 0||u[pt].isAlias?n(p):n(d)+"."+n(p),params:[]}}if(oe(u,Mr)){if(oe(u.value,rs))return{sql:i(l.value++,u),params:[u],typings:["none"]};let d=u.value===null?null:u.encoder.mapToDriverValue(u.value);if(oe(d,Ee))return this.buildQueryFromSourceParams([d],r);if(a)return{sql:this.mapInlineParam(d,r),params:[]};let p=["none"];if(s)p=[s(u.encoder)];return{sql:i(l.value++,d),params:[d],typings:p}}if(oe(u,rs))return{sql:i(l.value++,u),params:[u],typings:["none"]};if(oe(u,Ee.Aliased)&&u.fieldAlias!==void 0)return{sql:n(u.fieldAlias),params:[]};if(oe(u,dt)){if(u._.isWith)return{sql:n(u._.alias),params:[]};return this.buildQueryFromSourceParams([new Nt("("),u._.sql,new Nt(") "),new rb(u._.alias)],r)}if(y3(u)){if(u.schema)return{sql:n(u.schema)+"."+n(u.enumName),params:[]};return{sql:n(u.enumName),params:[]}}if(DT(u)){if(u.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([u.getSQL()],r);return this.buildQueryFromSourceParams([new Nt("("),u.getSQL(),new Nt(")")],r)}if(a)return{sql:this.mapInlineParam(u,r),params:[]};return{sql:i(l.value++,u),params:[u],typings:["none"]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return"null";if(typeof e==="number"||typeof e==="boolean")return e.toString();if(typeof e==="string")return t(e);if(typeof e==="object"){let r=e.toString();if(r==="[object Object]")return t(JSON.stringify(e));return t(r)}throw Error("Unexpected param value: "+e)}getSQL(){return this}as(e){if(e===void 0)return this;return new Ee.Aliased(this,e)}mapWith(e){return this.decoder=typeof e==="function"?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}};rb=class rb{constructor(e){this.value=e}static[F]="Name";brand;getSQL(){return new Ee([this])}};k3={mapFromDriverValue:(e)=>e},R3={mapToDriverValue:(e)=>e},o6e={...k3,...R3};Mr=class Mr{constructor(e,t=R3){this.value=e,this.encoder=t}static[F]="Param";brand;getSQL(){return new Ee([this])}};((e)=>{function t(){return new Ee([])}e.empty=t;function r(l){return new Ee(l)}e.fromList=r;function o(l){return new Ee([new Nt(l)])}e.raw=o;function n(l,u){let d=[];for(let[p,m]of l.entries()){if(p>0&&u!==void 0)d.push(u);d.push(m)}return new Ee(d)}e.join=n;function i(l){return new rb(l)}e.identifier=i;function s(l){return new rs(l)}e.placeholder=s;function a(l,u){return new Mr(l,u)}e.param=a})(C||(C={}));((e)=>{class t{constructor(r,o){this.sql=r,this.fieldAlias=o}static[F]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(Ee||(Ee={}));rs=class rs{constructor(e){this.name=e}static[F]="Placeholder";getSQL(){return new Ee([this])}};Bhe=Symbol.for("drizzle:IsDrizzleView");sn=class sn{static[F]="View";[pt];[Bhe]=!0;constructor({name:e,schema:t,selectedFields:r,query:o}){this[pt]={name:e,originalName:e,schema:t,selectedFields:r,query:o,isExisting:!o,isAlias:!1}}getSQL(){return new Ee([this])}};Ke.prototype.getSQL=function(){return new Ee([this])};he.prototype.getSQL=function(){return new Ee([this])};dt.prototype.getSQL=function(){return new Ee([this])}});function LT(e,t,r){let o={},n=e.reduce((i,{path:s,field:a},l)=>{let u;if(oe(a,Ke))u=a;else if(oe(a,Ee))u=a.decoder;else if(oe(a,dt))u=a._.sql.decoder;else u=a.sql.decoder;let d=i;for(let[p,m]of s.entries())if(p<s.length-1){if(!(m in d))d[m]={};d=d[m]}else{let h=t[l],b=d[m]=h===null?null:u.mapFromDriverValue(h);if(r&&oe(a,Ke)&&s.length===2){let y=s[0];if(!(y in o))o[y]=b===null?ts(a.table):!1;else if(typeof o[y]==="string"&&o[y]!==ts(a.table))o[y]=!1}}return i},{});if(r&&Object.keys(o).length>0){for(let[i,s]of Object.entries(o))if(typeof s==="string"&&!r[s])n[i]=null}return n}function an(e,t){return Object.entries(e).reduce((r,[o,n])=>{if(typeof o!=="string")return r;let i=t?[...t,o]:[o];if(oe(n,Ke)||oe(n,Ee)||oe(n,Ee.Aliased)||oe(n,dt))r.push({path:i,field:n});else if(oe(n,he))r.push(...an(n[he.Symbol.Columns],i));else r.push(...an(n,i));return r},[])}function qp(e,t){let r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let[n,i]of r.entries())if(i!==o[n])return!1;return!0}function nb(e,t){let r=Object.entries(t).filter(([,o])=>o!==void 0).map(([o,n])=>{if(oe(n,Ee)||oe(n,Ke))return[o,n];else return[o,new Mr(n,e[he.Symbol.Columns][o])]});if(r.length===0)throw Error("No values to set");return Object.fromEntries(r)}function T3(e,t){for(let r of t)for(let o of Object.getOwnPropertyNames(r.prototype)){if(o==="constructor")continue;Object.defineProperty(e.prototype,o,Object.getOwnPropertyDescriptor(r.prototype,o)||Object.create(null))}}function ob(e){return e[he.Symbol.Columns]}function Fp(e){return oe(e,dt)?e._.alias:oe(e,sn)?e[pt].name:oe(e,Ee)?void 0:e[he.Symbol.IsAlias]?e[he.Symbol.Name]:e[he.Symbol.BaseName]}function io(e,t){return{name:typeof e==="string"&&e.length>0?e:"",config:typeof e==="object"?e:t}}function $3(e){if(typeof e!=="object"||e===null)return!1;if(e.constructor.name!=="Object")return!1;if("logger"in e){let t=typeof e.logger;if(t!=="boolean"&&(t!=="object"||typeof e.logger.logQuery!=="function")&&t!=="undefined")return!1;return!0}if("schema"in e){let t=typeof e.schema;if(t!=="object"&&t!=="undefined")return!1;return!0}if("casing"in e){let t=typeof e.casing;if(t!=="string"&&t!=="undefined")return!1;return!0}if("mode"in e){if(e.mode!=="default"||e.mode!=="planetscale"||e.mode!==void 0)return!1;return!0}if("connection"in e){let t=typeof e.connection;if(t!=="string"&&t!=="object"&&t!=="undefined")return!1;return!0}if("client"in e){let t=typeof e.client;if(t!=="object"&&t!=="function"&&t!=="undefined")return!1;return!0}if(Object.keys(e).length===0)return!0;return!1}var ZT;var Sr=S(()=>{En();$e();Qt();In();sr();qo();ZT=typeof TextDecoder>"u"?null:new TextDecoder});var O3,jT,BT;var ib=S(()=>{$e();O3=class O3{static[F]="ConsoleLogWriter";write(e){console.log(e)}};jT=class jT{static[F]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new O3}logQuery(e,t){let r=t.map((n)=>{try{return JSON.stringify(n)}catch{return String(n)}}),o=r.length?` -- params: [${r.join(", ")}]`:"";this.writer.write(`Query: ${e}${o}`)}};BT=class BT{static[F]="NoopLogger";logQuery(){}}});var C3,P3,UT;var z3=S(()=>{$e();sr();C3=Symbol.for("drizzle:PgInlineForeignKeys"),P3=Symbol.for("drizzle:EnableRLS");UT=class UT extends he{static[F]="PgTable";static Symbol=Object.assign({},he.Symbol,{InlineForeignKeys:C3,EnableRLS:P3});[C3]=[];[P3]=!1;[he.Symbol.ExtraConfigBuilder]=void 0;[he.Symbol.ExtraConfigColumns]={}}});var MT,N3;var D3=S(()=>{$e();z3();MT=class MT{static[F]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new N3(e,this.columns,this.name)}};N3=class N3{constructor(e,t,r){this.table=e,this.columns=t,this.name=r}static[F]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[UT.Symbol.Name]}_${this.columns.map((e)=>e.name).join("_")}_pk`}}});function $r(e,t){if(A3(t)&&!DT(e)&&!oe(e,Mr)&&!oe(e,rs)&&!oe(e,Ke)&&!oe(e,he)&&!oe(e,sn))return new Mr(e,t);return e}function tt(...e){let t=e.filter((r)=>r!==void 0);if(t.length===0)return;if(t.length===1)return new Ee(t);return new Ee([new Nt("("),C.join(t,new Nt(" and ")),new Nt(")")])}function cn(...e){let t=e.filter((r)=>r!==void 0);if(t.length===0)return;if(t.length===1)return new Ee(t);return new Ee([new Nt("("),C.join(t,new Nt(" or ")),new Nt(")")])}function Z3(e){return C`not ${e}`}function os(e,t){if(Array.isArray(t)){if(t.length===0)return C`false`;return C`${e} in ${t.map((r)=>$r(r,e))}`}return C`${e} in ${$r(t,e)}`}function sb(e,t){if(Array.isArray(t)){if(t.length===0)return C`true`;return C`${e} not in ${t.map((r)=>$r(r,e))}`}return C`${e} not in ${$r(t,e)}`}function qr(e){return C`${e} is null`}function U3(e){return C`${e} is not null`}function ab(e){return C`exists ${e}`}function is(e){return C`not exists ${e}`}function M3(e,t,r){return C`${e} between ${$r(t,e)} and ${$r(r,e)}`}function q3(e,t,r){return C`${e} not between ${$r(t,e)} and ${$r(r,e)}`}function F3(e,t){return C`${e} like ${t}`}function H3(e,t){return C`${e} not like ${t}`}function J3(e,t){return C`${e} ilike ${t}`}function K3(e,t){return C`${e} not ilike ${t}`}var je=(e,t)=>C`${e} = ${$r(t,e)}`,L3=(e,t)=>C`${e} <> ${$r(t,e)}`,An=(e,t)=>C`${e} > ${$r(t,e)}`,j3=(e,t)=>C`${e} >= ${$r(t,e)}`,B3=(e,t)=>C`${e} < ${$r(t,e)}`,ns=(e,t)=>C`${e} <= ${$r(t,e)}`;var V3=S(()=>{En();$e();sr();Qt()});function Fo(e){return C`${e} asc`}function ba(e){return C`${e} desc`}var W3=S(()=>{Qt()});var qT=S(()=>{V3();W3()});function Q3(){return{and:tt,between:M3,eq:je,exists:ab,gt:An,gte:j3,ilike:J3,inArray:os,isNull:qr,isNotNull:U3,like:F3,lt:B3,lte:ns,ne:L3,not:Z3,notBetween:q3,notExists:is,notLike:H3,notIlike:K3,notInArray:sb,or:cn,sql:C}}function Y3(){return{sql:C,asc:Fo,desc:ba}}function X3(e,t){if(Object.keys(e).length===1&&"default"in e&&!oe(e.default,he))e=e.default;let r={},o={},n={};for(let[i,s]of Object.entries(e))if(oe(s,he)){let a=ya(s),l=o[a];r[a]=i,n[i]={tsName:i,dbName:s[he.Symbol.Name],schema:s[he.Symbol.Schema],columns:s[he.Symbol.Columns],relations:l?.relations??{},primaryKey:l?.primaryKey??[]};for(let d of Object.values(s[he.Symbol.Columns]))if(d.primary)n[i].primaryKey.push(d);let u=s[he.Symbol.ExtraConfigBuilder]?.(s[he.Symbol.ExtraConfigColumns]);if(u){for(let d of Object.values(u))if(oe(d,MT))n[i].primaryKey.push(...d.columns)}}else if(oe(s,G3)){let a=ya(s.table),l=r[a],u=s.config(t(s.table)),d;for(let[p,m]of Object.entries(u))if(l){let h=n[l];if(h.relations[p]=m,d)h.primaryKey.push(...d)}else{if(!(a in o))o[a]={relations:{},primaryKey:d};o[a].relations[p]=m}}return{tables:n,tableNamesMap:r}}function Uhe(e){return function(r,o){return new ss(e,r,o,o?.fields.reduce((n,i)=>n&&i.notNull,!0)??!1)}}function Mhe(e){return function(r,o){return new Hp(e,r,o)}}function e5(e,t,r){if(oe(r,ss)&&r.config)return{fields:r.config.fields,references:r.config.references};let o=t[ya(r.referencedTable)];if(!o)throw Error(`Table "${r.referencedTable[he.Symbol.Name]}" not found in schema`);let n=e[o];if(!n)throw Error(`Table "${o}" not found in schema`);let i=r.sourceTable,s=t[ya(i)];if(!s)throw Error(`Table "${i[he.Symbol.Name]}" not found in schema`);let a=[];for(let l of Object.values(n.relations))if(r.relationName&&r!==l&&l.relationName===r.relationName||!r.relationName&&l.referencedTable===r.sourceTable)a.push(l);if(a.length>1)throw r.relationName?Error(`There are multiple relations with name "${r.relationName}" in table "${o}"`):Error(`There are multiple relations between "${o}" and "${r.sourceTable[he.Symbol.Name]}". Please specify relation name`);if(a[0]&&oe(a[0],ss)&&a[0].config)return{fields:a[0].config.references,references:a[0].config.fields};throw Error(`There is not enough information to infer relation "${s}.${r.fieldName}"`)}function t5(e){return{one:Uhe(e),many:Mhe(e)}}function cb(e,t,r,o,n=(i)=>i){let i={};for(let[s,a]of o.entries())if(a.isJson){let l=t.relations[a.tsKey],u=r[s],d=typeof u==="string"?JSON.parse(u):u;i[a.tsKey]=oe(l,ss)?d&&cb(e,e[a.relationTableTsKey],d,a.selection,n):d.map((p)=>cb(e,e[a.relationTableTsKey],p,a.selection,n))}else{let l=n(r[s]),u=a.field,d;if(oe(u,Ke))d=u;else if(oe(u,Ee))d=u.decoder;else d=u.sql.decoder;i[a.tsKey]=l===null?null:d.mapFromDriverValue(l)}return i}var FT,G3,ss,Hp;var Jp=S(()=>{sr();En();$e();D3();qT();Qt();FT=class FT{constructor(e,t,r){this.sourceTable=e,this.referencedTable=t,this.relationName=r,this.referencedTableName=t[he.Symbol.Name]}static[F]="Relation";referencedTableName;fieldName};G3=class G3{constructor(e,t){this.table=e,this.config=t}static[F]="Relations"};ss=class ss extends FT{constructor(e,t,r,o){super(e,t,r?.relationName);this.config=r,this.isNullable=o}static[F]="One";withFieldName(e){let t=new ss(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}};Hp=class Hp extends FT{constructor(e,t,r){super(e,t,r?.relationName);this.config=r}static[F]="Many";withFieldName(e){let t=new Hp(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}});function Kp(e,t){return new Proxy(e,new Sa(t,!1))}function so(e,t){return new Proxy(e,new zl(new Proxy(e.table,new Sa(t,!1))))}function HT(e,t){return new Ee.Aliased(Vp(e.sql,t),e.fieldAlias)}function Vp(e,t){return C.join(e.queryChunks.map((r)=>{if(oe(r,Ke))return so(r,t);if(oe(r,Ee))return Vp(r,t);if(oe(r,Ee.Aliased))return HT(r,t);return r}))}var zl,Sa,qhe;var Wp=S(()=>{En();$e();Qt();sr();qo();zl=class zl{constructor(e){this.table=e}static[F]="ColumnAliasProxyHandler";get(e,t){if(t==="table")return this.table;return e[t]}};Sa=class Sa{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static[F]="TableAliasProxyHandler";get(e,t){if(t===he.Symbol.IsAlias)return!0;if(t===he.Symbol.Name)return this.alias;if(this.replaceOriginalName&&t===he.Symbol.OriginalName)return this.alias;if(t===pt)return{...e[pt],name:this.alias,isAlias:!0};if(t===he.Symbol.Columns){let o=e[he.Symbol.Columns];if(!o)return o;let n={};return Object.keys(o).map((i)=>{n[i]=new Proxy(o[i],new zl(new Proxy(e,this)))}),n}let r=e[t];if(oe(r,Ke))return new Proxy(r,new zl(new Proxy(e,this)));return r}};qhe=class qhe{constructor(e){this.alias=e}static[F]="RelationTableAliasProxyHandler";get(e,t){if(t==="sourceTable")return Kp(e.sourceTable,this.alias);return e[t]}}});var at;var va=S(()=>{Wp();En();$e();Qt();In();qo();at=class at{static[F]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if(t==="_")return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===pt)return{...e[pt],selectedFields:new Proxy(e[pt].selectedFields,this)};if(typeof t==="symbol")return e[t];let o=(oe(e,dt)?e._.selectedFields:oe(e,sn)?e[pt].selectedFields:e)[t];if(oe(o,Ee.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!o.isSelectionField)return o.sql;let n=o.clone();return n.isSelectionField=!0,n}if(oe(o,Ee)){if(this.config.sqlBehavior==="sql")return o;throw Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(oe(o,Ke)){if(this.config.alias)return new Proxy(o,new zl(new Proxy(o.table,new Sa(this.config.alias,this.config.replaceOriginalName??!1))));return o}if(typeof o!=="object"||o===null)return o;return new Proxy(o,new at(this.config))}}});var vr;var Ho=S(()=>{$e();vr=class vr{static[F]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then((t)=>(e?.(),t),(t)=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}});var JT,r5;var KT=S(()=>{$e();Cl();JT=class JT{static[F]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){if(this.reference=()=>{let{name:r,columns:o,foreignColumns:n}=e();return{name:r,columns:o,foreignTable:n[0].table,foreignColumns:n}},t)this._onUpdate=t.onUpdate,this._onDelete=t.onDelete}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new r5(e,this)}};r5=class r5{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[F]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:r}=this.reference(),o=t.map((s)=>s.name),n=r.map((s)=>s.name),i=[this.table[ir],...o,r[0].table[ir],...n];return e??`${i.join("_")}_fk`}}});function VT(e,t){return`${e[ir]}_${t.join("_")}_unique`}var n5,Fhe,o5;var WT=S(()=>{$e();Cl();n5=class n5{constructor(e,t){this.name=t,this.columns=e}static[F]="SQLiteUniqueConstraintBuilder";columns;build(e){return new o5(e,this.columns,this.name)}};Fhe=class Fhe{static[F]="SQLiteUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new n5(e,this.name)}};o5=class o5{constructor(e,t,r){this.table=e,this.columns=t,this.name=r??VT(this.table,this.columns.map((o)=>o.name))}static[F]="SQLiteUniqueConstraint";columns;name;getName(){return this.name}}});var Bt,yt;var as=S(()=>{Yy();En();$e();KT();WT();Bt=class Bt extends Zp{static[F]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:r,actions:o})=>((n,i)=>{let s=new JT(()=>{let a=n();return{columns:[e],foreignColumns:[a]}});if(i.onUpdate)s.onUpdate(i.onUpdate);if(i.onDelete)s.onDelete(i.onDelete);return s.build(t)})(r,o))}};yt=class yt extends Ke{constructor(e,t){if(!t.uniqueName)t.uniqueName=VT(e,[t.name]);super(e,t);this.table=e}static[F]="SQLiteColumn"}});function d5(e,t){let{name:r,config:o}=io(e,t);if(o?.mode==="json")return new a5(r);if(o?.mode==="bigint")return new i5(r);return new l5(r)}var i5,s5,a5,c5,l5,u5;var GT=S(()=>{$e();Sr();as();i5=class i5 extends Bt{static[F]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint","SQLiteBigInt")}build(e){return new s5(e,this.config)}};s5=class s5 extends yt{static[F]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(e){if(typeof Buffer<"u"&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return BigInt(t.toString("utf8"))}return BigInt(ZT.decode(e))}mapToDriverValue(e){return Buffer.from(e.toString())}};a5=class a5 extends Bt{static[F]="SQLiteBlobJsonBuilder";constructor(e){super(e,"json","SQLiteBlobJson")}build(e){return new c5(e,this.config)}};c5=class c5 extends yt{static[F]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(e){if(typeof Buffer<"u"&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return JSON.parse(t.toString("utf8"))}return JSON.parse(ZT.decode(e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}};l5=class l5 extends Bt{static[F]="SQLiteBlobBufferBuilder";constructor(e){super(e,"buffer","SQLiteBlobBuffer")}build(e){return new u5(e,this.config)}};u5=class u5 extends yt{static[F]="SQLiteBlobBuffer";mapFromDriverValue(e){if(Buffer.isBuffer(e))return e;return Buffer.from(e)}getSQLType(){return"blob"}}});function m5(e){return(t,r)=>{let{name:o,config:n}=io(t,r);return new p5(o,n,e)}}var p5,f5;var QT=S(()=>{$e();Sr();as();p5=class p5 extends Bt{static[F]="SQLiteCustomColumnBuilder";constructor(e,t,r){super(e,"custom","SQLiteCustomColumn");this.config.fieldConfig=t,this.config.customTypeParams=r}build(e){return new f5(e,this.config)}};f5=class f5 extends yt{static[F]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t);this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom==="function"?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo==="function"?this.mapTo(e):e}}});function ar(e,t){let{name:r,config:o}=io(e,t);if(o?.mode==="timestamp"||o?.mode==="timestamp_ms")return new y5(r,o.mode);if(o?.mode==="boolean")return new S5(r,o.mode);return new h5(r)}var lb,ub,h5,g5,y5,b5,S5,v5;var YT=S(()=>{$e();Qt();Sr();as();lb=class lb extends Bt{static[F]="SQLiteBaseIntegerBuilder";constructor(e,t,r){super(e,t,r);this.config.autoIncrement=!1}primaryKey(e){if(e?.autoIncrement)this.config.autoIncrement=!0;return this.config.hasDefault=!0,super.primaryKey()}};ub=class ub extends yt{static[F]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}};h5=class h5 extends lb{static[F]="SQLiteIntegerBuilder";constructor(e){super(e,"number","SQLiteInteger")}build(e){return new g5(e,this.config)}};g5=class g5 extends ub{static[F]="SQLiteInteger"};y5=class y5 extends lb{static[F]="SQLiteTimestampBuilder";constructor(e,t){super(e,"date","SQLiteTimestamp");this.config.mode=t}defaultNow(){return this.default(C`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new b5(e,this.config)}};b5=class b5 extends ub{static[F]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(e){if(this.config.mode==="timestamp")return new Date(e*1000);return new Date(e)}mapToDriverValue(e){let t=e.getTime();if(this.config.mode==="timestamp")return Math.floor(t/1000);return t}};S5=class S5 extends lb{static[F]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean");this.config.mode=t}build(e){return new v5(e,this.config)}};v5=class v5 extends ub{static[F]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(e){return Number(e)===1}mapToDriverValue(e){return e?1:0}}});function k5(e,t){let{name:r,config:o}=io(e,t),n=o?.mode;return n==="number"?new _5(r):n==="bigint"?new I5(r):new w5(r)}var w5,x5,_5,E5,I5,A5;var XT=S(()=>{$e();Sr();as();w5=class w5 extends Bt{static[F]="SQLiteNumericBuilder";constructor(e){super(e,"string","SQLiteNumeric")}build(e){return new x5(e,this.config)}};x5=class x5 extends yt{static[F]="SQLiteNumeric";mapFromDriverValue(e){if(typeof e==="string")return e;return String(e)}getSQLType(){return"numeric"}};_5=class _5 extends Bt{static[F]="SQLiteNumericNumberBuilder";constructor(e){super(e,"number","SQLiteNumericNumber")}build(e){return new E5(e,this.config)}};E5=class E5 extends yt{static[F]="SQLiteNumericNumber";mapFromDriverValue(e){if(typeof e==="number")return e;return Number(e)}mapToDriverValue=String;getSQLType(){return"numeric"}};I5=class I5 extends Bt{static[F]="SQLiteNumericBigIntBuilder";constructor(e){super(e,"bigint","SQLiteNumericBigInt")}build(e){return new A5(e,this.config)}};A5=class A5 extends yt{static[F]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}});function $5(e){return new R5(e??"")}var R5,T5;var e$=S(()=>{$e();as();R5=class R5 extends Bt{static[F]="SQLiteRealBuilder";constructor(e){super(e,"number","SQLiteReal")}build(e){return new T5(e,this.config)}};T5=class T5 extends yt{static[F]="SQLiteReal";getSQLType(){return"real"}}});function ft(e,t={}){let{name:r,config:o}=io(e,t);if(o.mode==="json")return new P5(r);return new O5(r,o)}var O5,C5,P5,z5;var t$=S(()=>{$e();Sr();as();O5=class O5 extends Bt{static[F]="SQLiteTextBuilder";constructor(e,t){super(e,"string","SQLiteText");this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new C5(e,this.config)}};C5=class C5 extends yt{static[F]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}};P5=class P5 extends Bt{static[F]="SQLiteTextJsonBuilder";constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new z5(e,this.config)}};z5=class z5 extends yt{static[F]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}}});function N5(){return{blob:d5,customType:m5,integer:ar,numeric:k5,real:$5,text:ft}}var D5=S(()=>{GT();QT();YT();XT();e$();t$()});function Hhe(e,t,r,o,n=e){let i=new Rt(e,o,n),s=typeof t==="function"?t(N5()):t,a=Object.fromEntries(Object.entries(s).map(([u,d])=>{let p=d;p.setName(u);let m=p.build(i);return i[r$].push(...p.buildForeignKeys(m,i)),[u,m]})),l=Object.assign(i,a);if(l[he.Symbol.Columns]=a,l[he.Symbol.ExtraConfigColumns]=a,r)l[Rt.Symbol.ExtraConfigBuilder]=r;return l}var r$,Rt,Gp=(e,t,r)=>Hhe(e,t,r);var Jo=S(()=>{$e();sr();D5();r$=Symbol.for("drizzle:SQLiteInlineForeignKeys");Rt=class Rt extends he{static[F]="SQLiteTable";static Symbol=Object.assign({},he.Symbol,{InlineForeignKeys:r$});[he.Symbol.Columns];[r$]=[];[he.Symbol.ExtraConfigBuilder]=void 0}});var Jhe,L5;var Z5=S(()=>{$e();Jhe=class Jhe{constructor(e,t){this.name=e,this.value=t}static[F]="SQLiteCheckBuilder";brand;build(e){return new L5(e,this)}};L5=class L5{constructor(e,t){this.table=e,this.name=t.name,this.value=t.value}static[F]="SQLiteCheck";name;value}});function Ko(e){return new j5(e,!1)}var j5,B5,U5;var M5=S(()=>{$e();j5=class j5{constructor(e,t){this.name=e,this.unique=t}static[F]="SQLiteIndexBuilderOn";on(...e){return new B5(this.name,e,this.unique)}};B5=class B5{static[F]="SQLiteIndexBuilder";config;constructor(e,t,r){this.config={name:e,columns:t,unique:r,where:void 0}}where(e){return this.config.where=e,this}build(e){return new U5(this.config,e)}};U5=class U5{static[F]="SQLiteIndex";config;constructor(e,t){this.config={...e,table:t}}}});var Khe,q5;var F5=S(()=>{$e();Jo();Khe=class Khe{static[F]="SQLitePrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new q5(e,this.columns,this.name)}};q5=class q5{constructor(e,t,r){this.table=e,this.columns=t,this.name=r}static[F]="SQLitePrimaryKey";columns;name;getName(){return this.name??`${this.table[Rt.Symbol.Name]}_${this.columns.map((e)=>e.name).join("_")}_pk`}}});function kn(e){if(oe(e,Rt))return[`${e[he.Symbol.BaseName]}`];if(oe(e,dt))return e._.usedTables??[];if(oe(e,Ee))return e.usedTables??[];return[]}var Nl=S(()=>{$e();Qt();In();sr();Jo()});var db;var H5=S(()=>{$e();Ho();va();Jo();sr();Sr();Nl();db=class db extends vr{constructor(e,t,r,o){super();this.table=e,this.session=t,this.dialect=r,this.config={table:e,withList:o}}static[F]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]==="function"){let t=e[0](new Proxy(this.config.table[he.Symbol.Columns],new at({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),r=Array.isArray(t)?t:[t];this.config.orderBy=r}else{let t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[Rt.Symbol.Columns]){return this.config.returning=an(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:kn(this.config.table)})}prepare(){return this._prepare(!1)}run=(e)=>this._prepare().run(e);all=(e)=>this._prepare().all(e);get=(e)=>this._prepare().get(e);values=(e)=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}});function Vhe(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((r)=>r.toLowerCase()).join("_")}function Whe(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((r,o,n)=>{let i=n===0?o.toLowerCase():`${o[0].toUpperCase()}${o.slice(1)}`;return r+i},"")}function Ghe(e){return e}var n$;var J5=S(()=>{$e();sr();n$=class n${static[F]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert=e==="snake_case"?Vhe:e==="camelCase"?Whe:Ghe}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[he.Symbol.Schema]??"public",r=e.table[he.Symbol.OriginalName],o=`${t}.${r}.${e.name}`;if(!this.cache[o])this.cacheTable(e.table);return this.cache[o]}cacheTable(e){let t=e[he.Symbol.Schema]??"public",r=e[he.Symbol.OriginalName],o=`${t}.${r}`;if(!this.cachedTables[o]){for(let n of Object.values(e[he.Symbol.Columns])){let i=`${o}.${n.name}`;this.cache[i]=this.convert(n.name)}this.cachedTables[o]=!0}}clearCache(){this.cache={},this.cachedTables={}}}});var Dl,Vo,o$;var pb=S(()=>{$e();Dl=class Dl extends Error{static[F]="DrizzleError";constructor({message:e,cause:t}){super(e);this.name="DrizzleError",this.cause=t}};Vo=class Vo extends Error{constructor(e,t,r){super(`Failed query: ${e}
|
|
446
|
-
params: ${t}`);if(this.query=e,this.params=t,this.cause=r,Error.captureStackTrace(this,Vo),r)this.cause=r}};o$=class o$ extends Dl{static[F]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}});var K5=()=>{};var V5=()=>{};var W5=S(()=>{K5();V5()});var i$=S(()=>{qT();W5();Qt()});var s$=S(()=>{GT();as();QT();YT();XT();e$();t$()});var Wo;var Qp=S(()=>{$e();Qt();Wo=class Wo extends sn{static[F]="SQLiteViewBase"}});var Ll,a$,c$;var fb=S(()=>{Wp();J5();En();$e();pb();Jp();i$();Qt();s$();Jo();In();sr();Sr();qo();Qp();Ll=class Ll{static[F]="SQLiteDialect";casing;constructor(e){this.casing=new n$(e?.casing)}escapeName(e){return`"${e.replace(/"/g,'""')}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[C`with `];for(let[r,o]of e.entries())if(t.push(C`${C.identifier(o._.alias)} as (${o._.sql})`),r<e.length-1)t.push(C`, `);return t.push(C` `),C.join(t)}buildDeleteQuery({table:e,where:t,returning:r,withList:o,limit:n,orderBy:i}){let s=this.buildWithCTE(o),a=r?C` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,l=t?C` where ${t}`:void 0,u=this.buildOrderBy(i),d=this.buildLimit(n);return C`${s}delete from ${e}${l}${a}${u}${d}`}buildUpdateSet(e,t){let r=e[he.Symbol.Columns],o=Object.keys(r).filter((i)=>t[i]!==void 0||r[i]?.onUpdateFn!==void 0),n=o.length;return C.join(o.flatMap((i,s)=>{let a=r[i],l=a.onUpdateFn?.(),u=t[i]??(oe(l,Ee)?l:C.param(l,a)),d=C`${C.identifier(this.casing.getColumnCasing(a))} = ${u}`;if(s<n-1)return[d,C.raw(", ")];return[d]}))}buildUpdateQuery({table:e,set:t,where:r,returning:o,withList:n,joins:i,from:s,limit:a,orderBy:l}){let u=this.buildWithCTE(n),d=this.buildUpdateSet(e,t),p=s&&C.join([C.raw(" from "),this.buildFromTable(s)]),m=this.buildJoins(i),h=o?C` returning ${this.buildSelection(o,{isSingleTable:!0})}`:void 0,b=r?C` where ${r}`:void 0,y=this.buildOrderBy(l),v=this.buildLimit(a);return C`${u}update ${e} set ${d}${p}${m}${b}${h}${y}${v}`}buildSelection(e,{isSingleTable:t=!1}={}){let r=e.length,o=e.flatMap(({field:n},i)=>{let s=[];if(oe(n,Ee.Aliased)&&n.isSelectionField)s.push(C.identifier(n.fieldAlias));else if(oe(n,Ee.Aliased)||oe(n,Ee)){let a=oe(n,Ee.Aliased)?n.sql:n;if(t)s.push(new Ee(a.queryChunks.map((l)=>{if(oe(l,Ke))return C.identifier(this.casing.getColumnCasing(l));return l})));else s.push(a);if(oe(n,Ee.Aliased))s.push(C` as ${C.identifier(n.fieldAlias)}`)}else if(oe(n,Ke)){let a=n.table[he.Symbol.Name];if(n.columnType==="SQLiteNumericBigInt")if(t)s.push(C`cast(${C.identifier(this.casing.getColumnCasing(n))} as text)`);else s.push(C`cast(${C.identifier(a)}.${C.identifier(this.casing.getColumnCasing(n))} as text)`);else if(t)s.push(C.identifier(this.casing.getColumnCasing(n)));else s.push(C`${C.identifier(a)}.${C.identifier(this.casing.getColumnCasing(n))}`)}else if(oe(n,dt)){let a=Object.entries(n._.selectedFields);if(a.length===1){let l=a[0][1],u=oe(l,Ee)?l.decoder:oe(l,Ke)?{mapFromDriverValue:(d)=>l.mapFromDriverValue(d)}:l.sql.decoder;if(u)n._.sql.decoder=u}s.push(n)}if(i<r-1)s.push(C`, `);return s});return C.join(o)}buildJoins(e){if(!e||e.length===0)return;let t=[];if(e)for(let[r,o]of e.entries()){if(r===0)t.push(C` `);let n=o.table,i=o.on?C` on ${o.on}`:void 0;if(oe(n,Rt)){let s=n[Rt.Symbol.Name],a=n[Rt.Symbol.Schema],l=n[Rt.Symbol.OriginalName],u=s===l?void 0:o.alias;t.push(C`${C.raw(o.joinType)} join ${a?C`${C.identifier(a)}.`:void 0}${C.identifier(l)}${u&&C` ${C.identifier(u)}`}${i}`)}else t.push(C`${C.raw(o.joinType)} join ${n}${i}`);if(r<e.length-1)t.push(C` `)}return C.join(t)}buildLimit(e){return typeof e==="object"||typeof e==="number"&&e>=0?C` limit ${e}`:void 0}buildOrderBy(e){let t=[];if(e){for(let[r,o]of e.entries())if(t.push(o),r<e.length-1)t.push(C`, `)}return t.length>0?C` order by ${C.join(t)}`:void 0}buildFromTable(e){if(oe(e,he)&&e[he.Symbol.IsAlias])return C`${C`${C.identifier(e[he.Symbol.Schema]??"")}.`.if(e[he.Symbol.Schema])}${C.identifier(e[he.Symbol.OriginalName])} ${C.identifier(e[he.Symbol.Name])}`;return e}buildSelectQuery({withList:e,fields:t,fieldsFlat:r,where:o,having:n,table:i,joins:s,orderBy:a,groupBy:l,limit:u,offset:d,distinct:p,setOperators:m}){let h=r??an(t);for(let T of h)if(oe(T.field,Ke)&&ts(T.field.table)!==(oe(i,dt)?i._.alias:oe(i,Wo)?i[pt].name:oe(i,Ee)?void 0:ts(i))&&!((Z)=>s?.some(({alias:I})=>I===(Z[he.Symbol.IsAlias]?ts(Z):Z[he.Symbol.BaseName])))(T.field.table)){let Z=ts(T.field.table);throw Error(`Your "${T.path.join("->")}" field references a column "${Z}"."${T.field.name}", but the table "${Z}" is not part of the query! Did you forget to join it?`)}let b=!s||s.length===0,y=this.buildWithCTE(e),v=p?C` distinct`:void 0,x=this.buildSelection(h,{isSingleTable:b}),_=this.buildFromTable(i),k=this.buildJoins(s),O=o?C` where ${o}`:void 0,L=n?C` having ${n}`:void 0,z=[];if(l){for(let[T,Z]of l.entries())if(z.push(Z),T<l.length-1)z.push(C`, `)}let J=z.length>0?C` group by ${C.join(z)}`:void 0,P=this.buildOrderBy(a),W=this.buildLimit(u),ee=d?C` offset ${d}`:void 0,j=C`${y}select${v} ${x} from ${_}${k}${O}${J}${L}${P}${W}${ee}`;if(m.length>0)return this.buildSetOperations(j,m);return j}buildSetOperations(e,t){let[r,...o]=t;if(!r)throw Error("Cannot pass undefined values to any set operator");if(o.length===0)return this.buildSetOperationQuery({leftSelect:e,setOperator:r});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:r}),o)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:r,rightSelect:o,limit:n,orderBy:i,offset:s}}){let a=C`${e.getSQL()} `,l=C`${o.getSQL()}`,u;if(i&&i.length>0){let h=[];for(let b of i)if(oe(b,yt))h.push(C.identifier(b.name));else if(oe(b,Ee)){for(let y=0;y<b.queryChunks.length;y++){let v=b.queryChunks[y];if(oe(v,yt))b.queryChunks[y]=C.identifier(this.casing.getColumnCasing(v))}h.push(C`${b}`)}else h.push(C`${b}`);u=C` order by ${C.join(h,C`, `)}`}let d=typeof n==="object"||typeof n==="number"&&n>=0?C` limit ${n}`:void 0,p=C.raw(`${t} ${r?"all ":""}`),m=s?C` offset ${s}`:void 0;return C`${a}${p}${l}${u}${d}${m}`}buildInsertQuery({table:e,values:t,onConflict:r,returning:o,withList:n,select:i}){let s=[],a=e[he.Symbol.Columns],l=Object.entries(a).filter(([b,y])=>!y.shouldDisableInsert()),u=l.map(([,b])=>C.identifier(this.casing.getColumnCasing(b)));if(i){let b=t;if(oe(b,Ee))s.push(b);else s.push(b.getSQL())}else{let b=t;s.push(C.raw("values "));for(let[y,v]of b.entries()){let x=[];for(let[_,k]of l){let O=v[_];if(O===void 0||oe(O,Mr)&&O.value===void 0){let L;if(k.default!==null&&k.default!==void 0)L=oe(k.default,Ee)?k.default:C.param(k.default,k);else if(k.defaultFn!==void 0){let z=k.defaultFn();L=oe(z,Ee)?z:C.param(z,k)}else if(!k.default&&k.onUpdateFn!==void 0){let z=k.onUpdateFn();L=oe(z,Ee)?z:C.param(z,k)}else L=C`null`;x.push(L)}else x.push(O)}if(s.push(x),y<b.length-1)s.push(C`, `)}}let d=this.buildWithCTE(n),p=C.join(s),m=o?C` returning ${this.buildSelection(o,{isSingleTable:!0})}`:void 0,h=r?.length?C.join(r):void 0;return C`${d}insert into ${e} ${u} ${p}${h}${m}`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:t})}buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:r,table:o,tableConfig:n,queryConfig:i,tableAlias:s,nestedQueryRelation:a,joinOn:l}){let u=[],d,p,m=[],h,b=[];if(i===!0)u=Object.entries(n.columns).map(([x,_])=>({dbKey:_.name,tsKey:x,field:so(_,s),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let v=Object.fromEntries(Object.entries(n.columns).map(([z,J])=>[z,so(J,s)]));if(i.where){let z=typeof i.where==="function"?i.where(v,Q3()):i.where;h=z&&Vp(z,s)}let x=[],_=[];if(i.columns){let z=!1;for(let[J,P]of Object.entries(i.columns)){if(P===void 0)continue;if(J in n.columns){if(!z&&P===!0)z=!0;_.push(J)}}if(_.length>0)_=z?_.filter((J)=>i.columns?.[J]===!0):Object.keys(n.columns).filter((J)=>!_.includes(J))}else _=Object.keys(n.columns);for(let z of _){let J=n.columns[z];x.push({tsKey:z,value:J})}let k=[];if(i.with)k=Object.entries(i.with).filter((z)=>!!z[1]).map(([z,J])=>({tsKey:z,queryConfig:J,relation:n.relations[z]}));let O;if(i.extras){O=typeof i.extras==="function"?i.extras(v,{sql:C}):i.extras;for(let[z,J]of Object.entries(O))x.push({tsKey:z,value:HT(J,s)})}for(let{tsKey:z,value:J}of x)u.push({dbKey:oe(J,Ee.Aliased)?J.fieldAlias:n.columns[z].name,tsKey:z,field:oe(J,Ke)?so(J,s):J,relationTableTsKey:void 0,isJson:!1,selection:[]});let L=typeof i.orderBy==="function"?i.orderBy(v,Y3()):i.orderBy??[];if(!Array.isArray(L))L=[L];m=L.map((z)=>{if(oe(z,Ke))return so(z,s);return Vp(z,s)}),d=i.limit,p=i.offset;for(let{tsKey:z,queryConfig:J,relation:P}of k){let W=e5(t,r,P),ee=ya(P.referencedTable),j=r[ee],T=`${s}_${z}`,Z=tt(...W.fields.map((A,q)=>je(so(W.references[q],T),so(A,s)))),I=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:r,table:e[j],tableConfig:t[j],queryConfig:oe(P,ss)?J===!0?{limit:1}:{...J,limit:1}:J,tableAlias:T,joinOn:Z,nestedQueryRelation:P}),R=C`(${I.sql})`.as(z);u.push({dbKey:z,tsKey:z,field:R,relationTableTsKey:j,isJson:!0,selection:I.selection})}}if(u.length===0)throw new Dl({message:`No fields selected for table "${n.tsName}" ("${s}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let y;if(h=tt(l,h),a){let v=C`json_array(${C.join(u.map(({field:k})=>oe(k,yt)?C.identifier(this.casing.getColumnCasing(k)):oe(k,Ee.Aliased)?k.sql:k),C`, `)})`;if(oe(a,Hp))v=C`coalesce(json_group_array(${v}), json_array())`;let x=[{dbKey:"data",tsKey:"data",field:v.as("data"),isJson:!0,relationTableTsKey:n.tsName,selection:u}];if(d!==void 0||p!==void 0||m.length>0)y=this.buildSelectQuery({table:Kp(o,s),fields:{},fieldsFlat:[{path:[],field:C.raw("*")}],where:h,limit:d,offset:p,orderBy:m,setOperators:[]}),h=void 0,d=void 0,p=void 0,m=void 0;else y=Kp(o,s);y=this.buildSelectQuery({table:oe(y,Rt)?y:new dt(y,{},s),fields:{},fieldsFlat:x.map(({field:k})=>({path:[],field:oe(k,Ke)?so(k,s):k})),joins:b,where:h,limit:d,offset:p,orderBy:m,setOperators:[]})}else y=this.buildSelectQuery({table:Kp(o,s),fields:{},fieldsFlat:u.map(({field:v})=>({path:[],field:oe(v,Ke)?so(v,s):v})),joins:b,where:h,limit:d,offset:p,orderBy:m,setOperators:[]});return{tableTsKey:n.tsName,sql:y,selection:u}}};a$=class a$ extends Ll{static[F]="SQLiteSyncDialect";migrate(e,t,r){let o=r===void 0?"__drizzle_migrations":typeof r==="string"?"__drizzle_migrations":r.migrationsTable??"__drizzle_migrations",n=C`
|
|
444
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`),g}function j(){Le.asyncTransitions--}function T(g){if(U===null)try{var E=("require"+Math.random()).slice(0,7);U=(Iy&&Iy[E]).call(Iy,"timers").setImmediate}catch(D){U=function(H){f===!1&&(f=!0,typeof MessageChannel>"u"&&console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var M=new MessageChannel;M.port1.onmessage=H,M.port2.postMessage(void 0)}}return U(g)}function Z(g){return 1<g.length&&typeof AggregateError==="function"?AggregateError(g):g[0]}function I(g,E){E!==ne-1&&console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),ne=E}function R(g,E,D){var H=Le.actQueue;if(H!==null)if(H.length!==0)try{A(H),T(function(){return R(g,E,D)});return}catch(M){Le.thrownErrors.push(M)}else Le.actQueue=null;0<Le.thrownErrors.length?(H=Z(Le.thrownErrors),Le.thrownErrors.length=0,D(H)):E(g)}function A(g){if(!X){X=!0;var E=0;try{for(;E<g.length;E++){var D=g[E];do{Le.didUsePromise=!1;var H=D(!1);if(H!==null){if(Le.didUsePromise){g[E]=D,g.splice(0,E);return}D=H}else break}while(1)}g.length=0}catch(M){g.splice(0,E+1),Le.thrownErrors.push(M)}finally{X=!1}}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var q=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),K=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),re=Symbol.for("react.profiler"),ae=Symbol.for("react.consumer"),me=Symbol.for("react.context"),Se=Symbol.for("react.forward_ref"),xe=Symbol.for("react.suspense"),ke=Symbol.for("react.suspense_list"),Ae=Symbol.for("react.memo"),_e=Symbol.for("react.lazy"),Ue=Symbol.for("react.activity"),De=Symbol.iterator,Qe={},bt={isMounted:function(){return!1},enqueueForceUpdate:function(g){r(g,"forceUpdate")},enqueueReplaceState:function(g){r(g,"replaceState")},enqueueSetState:function(g){r(g,"setState")}},Tt=Object.assign,Dt={};Object.freeze(Dt),o.prototype.isReactComponent={},o.prototype.setState=function(g,E){if(typeof g!=="object"&&typeof g!=="function"&&g!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,g,E,"setState")},o.prototype.forceUpdate=function(g){this.updater.enqueueForceUpdate(this,g,"forceUpdate")};var lt={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]};for(V in lt)lt.hasOwnProperty(V)&&e(V,lt[V]);n.prototype=o.prototype,lt=i.prototype=new n,lt.constructor=i,Tt(lt,o.prototype),lt.isPureReactComponent=!0;var Or=Array.isArray,$n=Symbol.for("react.client.reference"),Le={H:null,A:null,T:null,S:null,actQueue:null,asyncTransitions:0,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1,didUsePromise:!1,thrownErrors:[],getCurrentStack:null,recentlyCreatedOwnerStacks:0},uo=Object.prototype.hasOwnProperty,cs=console.createTask?console.createTask:function(){return null};lt={react_stack_bottom_frame:function(g){return g()}};var ls,_a,us={},On=lt.react_stack_bottom_frame.bind(lt,m)(),Fl=cs(d(m)),Qo=!1,Ea=/\/+/g,Ia=typeof reportError==="function"?reportError:function(g){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var E=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof g==="object"&&g!==null&&typeof g.message==="string"?String(g.message):String(g),error:g});if(!window.dispatchEvent(E))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",g);return}console.error(g)},f=!1,U=null,ne=0,ie=!1,X=!1,w=typeof queueMicrotask==="function"?function(g){queueMicrotask(function(){return queueMicrotask(g)})}:T;lt=Object.freeze({__proto__:null,c:function(g){return ee().useMemoCache(g)}});var V={map:P,forEach:function(g,E,D){P(g,function(){E.apply(this,arguments)},D)},count:function(g){var E=0;return P(g,function(){E++}),E},toArray:function(g){return P(g,function(E){return E})||[]},only:function(g){if(!k(g))throw Error("React.Children.only expected to receive a single React element child.");return g}};Spe.Activity=Ue,Spe.Children=V,Spe.Component=o,Spe.Fragment=K,Spe.Profiler=re,Spe.PureComponent=i,Spe.StrictMode=G,Spe.Suspense=xe,Spe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Le,Spe.__COMPILER_RUNTIME=lt,Spe.act=function(g){var E=Le.actQueue,D=ne;ne++;var H=Le.actQueue=E!==null?E:[],M=!1;try{var te=g()}catch(fe){Le.thrownErrors.push(fe)}if(0<Le.thrownErrors.length)throw I(E,D),g=Z(Le.thrownErrors),Le.thrownErrors.length=0,g;if(te!==null&&typeof te==="object"&&typeof te.then==="function"){var se=te;return w(function(){M||ie||(ie=!0,console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),{then:function(fe,Te){M=!0,se.then(function(ze){if(I(E,D),D===0){try{A(H),T(function(){return R(ze,fe,Te)})}catch(ds){Le.thrownErrors.push(ds)}if(0<Le.thrownErrors.length){var Cn=Z(Le.thrownErrors);Le.thrownErrors.length=0,Te(Cn)}}else fe(ze)},function(ze){I(E,D),0<Le.thrownErrors.length?(ze=Z(Le.thrownErrors),Le.thrownErrors.length=0,Te(ze)):Te(ze)})}}}var be=te;if(I(E,D),D===0&&(A(H),H.length!==0&&w(function(){M||ie||(ie=!0,console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"))}),Le.actQueue=null),0<Le.thrownErrors.length)throw g=Z(Le.thrownErrors),Le.thrownErrors.length=0,g;return{then:function(fe,Te){M=!0,D===0?(Le.actQueue=H,T(function(){return R(be,fe,Te)})):fe(be)}}},Spe.cache=function(g){return function(){return g.apply(null,arguments)}},Spe.cacheSignal=function(){return null},Spe.captureOwnerStack=function(){var g=Le.getCurrentStack;return g===null?null:g()},Spe.cloneElement=function(g,E,D){if(g===null||g===void 0)throw Error("The argument must be a React element, but you passed "+g+".");var H=Tt({},g.props),M=g.key,te=g._owner;if(E!=null){var se;e:{if(uo.call(E,"ref")&&(se=Object.getOwnPropertyDescriptor(E,"ref").get)&&se.isReactWarning){se=!1;break e}se=E.ref!==void 0}se&&(te=p()),h(E)&&(l(E.key),M=""+E.key);for(be in E)!uo.call(E,be)||be==="key"||be==="__self"||be==="__source"||be==="ref"&&E.ref===void 0||(H[be]=E[be])}var be=arguments.length-2;if(be===1)H.children=D;else if(1<be){se=Array(be);for(var fe=0;fe<be;fe++)se[fe]=arguments[fe+2];H.children=se}H=v(g.type,M,H,te,g._debugStack,g._debugTask);for(M=2;M<arguments.length;M++)_(arguments[M]);return H},Spe.createContext=function(g){return g={$$typeof:me,_currentValue:g,_currentValue2:g,_threadCount:0,Provider:null,Consumer:null},g.Provider=g,g.Consumer={$$typeof:ae,_context:g},g._currentRenderer=null,g._currentRenderer2=null,g},Spe.createElement=function(g,E,D){for(var H=2;H<arguments.length;H++)_(arguments[H]);H={};var M=null;if(E!=null)for(fe in _a||!("__self"in E)||"key"in E||(_a=!0,console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")),h(E)&&(l(E.key),M=""+E.key),E)uo.call(E,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(H[fe]=E[fe]);var te=arguments.length-2;if(te===1)H.children=D;else if(1<te){for(var se=Array(te),be=0;be<te;be++)se[be]=arguments[be+2];Object.freeze&&Object.freeze(se),H.children=se}if(g&&g.defaultProps)for(fe in te=g.defaultProps,te)H[fe]===void 0&&(H[fe]=te[fe]);M&&b(H,typeof g==="function"?g.displayName||g.name||"Unknown":g);var fe=1e4>Le.recentlyCreatedOwnerStacks++;return v(g,M,H,p(),fe?Error("react-stack-top-frame"):On,fe?cs(d(g)):Fl)},Spe.createRef=function(){var g={current:null};return Object.seal(g),g},Spe.forwardRef=function(g){g!=null&&g.$$typeof===Ae?console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof g!=="function"?console.error("forwardRef requires a render function but was given %s.",g===null?"null":typeof g):g.length!==0&&g.length!==2&&console.error("forwardRef render functions accept exactly two parameters: props and ref. %s",g.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),g!=null&&g.defaultProps!=null&&console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");var E={$$typeof:Se,render:g},D;return Object.defineProperty(E,"displayName",{enumerable:!1,configurable:!0,get:function(){return D},set:function(H){D=H,g.name||g.displayName||(Object.defineProperty(g,"name",{value:H}),g.displayName=H)}}),E},Spe.isValidElement=k,Spe.lazy=function(g){g={_status:-1,_result:g};var E={$$typeof:_e,_payload:g,_init:W},D={name:"lazy",start:-1,end:-1,value:null,owner:null,debugStack:Error("react-stack-top-frame"),debugTask:console.createTask?console.createTask("lazy()"):null};return g._ioInfo=D,E._debugInfo=[{awaited:D}],E},Spe.memo=function(g,E){g==null&&console.error("memo: The first argument must be a component. Instead received: %s",g===null?"null":typeof g),E={$$typeof:Ae,type:g,compare:E===void 0?null:E};var D;return Object.defineProperty(E,"displayName",{enumerable:!1,configurable:!0,get:function(){return D},set:function(H){D=H,g.name||g.displayName||(Object.defineProperty(g,"name",{value:H}),g.displayName=H)}}),E},Spe.startTransition=function(g){var E=Le.T,D={};D._updatedFibers=new Set,Le.T=D;try{var H=g(),M=Le.S;M!==null&&M(D,H),typeof H==="object"&&H!==null&&typeof H.then==="function"&&(Le.asyncTransitions++,H.then(j,j),H.then(s,Ia))}catch(te){Ia(te)}finally{E===null&&D._updatedFibers&&(g=D._updatedFibers.size,D._updatedFibers.clear(),10<g&&console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")),E!==null&&D.types!==null&&(E.types!==null&&E.types!==D.types&&console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."),E.types=D.types),Le.T=E}},Spe.unstable_useCacheRefresh=function(){return ee().useCacheRefresh()},Spe.use=function(g){return ee().use(g)},Spe.useActionState=function(g,E,D){return ee().useActionState(g,E,D)},Spe.useCallback=function(g,E){return ee().useCallback(g,E)},Spe.useContext=function(g){var E=ee();return g.$$typeof===ae&&console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"),E.useContext(g)},Spe.useDebugValue=function(g,E){return ee().useDebugValue(g,E)},Spe.useDeferredValue=function(g,E){return ee().useDeferredValue(g,E)},Spe.useEffect=function(g,E){return g==null&&console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"),ee().useEffect(g,E)},Spe.useEffectEvent=function(g){return ee().useEffectEvent(g)},Spe.useId=function(){return ee().useId()},Spe.useImperativeHandle=function(g,E,D){return ee().useImperativeHandle(g,E,D)},Spe.useInsertionEffect=function(g,E){return g==null&&console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"),ee().useInsertionEffect(g,E)},Spe.useLayoutEffect=function(g,E){return g==null&&console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"),ee().useLayoutEffect(g,E)},Spe.useMemo=function(g,E){return ee().useMemo(g,E)},Spe.useOptimistic=function(g,E){return ee().useOptimistic(g,E)},Spe.useReducer=function(g,E,D){return ee().useReducer(g,E,D)},Spe.useRef=function(g){return ee().useRef(g)},Spe.useState=function(g){return ee().useState(g)},Spe.useSyncExternalStore=function(g,E,D){return ee().useSyncExternalStore(g,E,D)},Spe.useTransition=function(){return ee().useTransition()},Spe.version="19.2.7",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var vq,wq;var jR=S(()=>{vq=Jl(ZR(),1),wq=vq.createContext(void 0)});var vpe;var xq=S(()=>{NR();Sq();jR();de();vpe=Jl(ZR(),1)});var wpe,xpe;var _q=S(()=>{wt();de();CR();wpe=nl.omit({url:!0,analyticsScript:!0}),xpe=wpe.extend({title:c.string().optional().describe("Optional site title override"),description:c.string().optional().describe("Optional site description override")})});function BR(e,t={}){let r=Eq(e),o=Eq(t.sharedDomain??"rizom.ai").replace(/^\./,""),n=`.${o}`;if(r.endsWith(n)){let i=r.slice(0,-n.length);if(i.length>0&&!i.includes("."))return`${i}-preview.${o}`}return`preview.${r}`}function Eq(e){return e.trim().replace(/^https?:\/\//i,"").replace(/\/$/,"").toLowerCase()}var Iq=S(()=>{bg()});var Ipe,Ape;var Aq=S(()=>{de();hy();DR();Ipe=c.string(),Ape=c.custom((e)=>Vs(e)&&ZM.safeParse(e).success)});var kpe;var kq=S(()=>{bg();de();kpe=c.object({title:c.string().min(1),slug:c.string().min(1),description:c.string(),content:c.string(),author:c.string(),publishedAt:c.iso.datetime({offset:!0}),category:c.string().min(1).optional()})});var Rq=S(()=>{OR();GM();CR();dq();DR();xq();_q();Iq();Aq();jR();kq()});function Tq(e,t={}){return BR(e,t)}var $q=S(()=>{Rq()});var Dq={};Lt(Dq,{assertPilotUsersRemoved:()=>Nq,createPilotOffboardDriver:()=>Cq,offboardPilotUsers:()=>Cpe});import{readdir as Rpe,readFile as Tpe,rm as pp,writeFile as $pe}from"fs/promises";import{basename as Ope,join as Do}from"path";async function Cpe(e,t){let r=[...new Set(t.handles.map((p)=>br.parse(p)))].sort((p,m)=>p.localeCompare(m));if(r.length===0)throw Error("At least one pilot handle is required");let o=t.dryRun??!0,n=`sunset:${r.join(",")}`;if(!o&&t.confirmation!==n)throw Error(`Exact confirmation required: ${n}`);let i=t.env??process.env,s=t.logger??console.info,a=await xt(e),l=r.map((p)=>Ppe(a,p,i)),u=t.driver??Cq({env:i,fetchImpl:t.fetchImpl,contentRepoTokenName:a.pilot.contentRepoAdminToken}),d=await Promise.all(l.map(async(p)=>({target:p,inspection:await u.inspect(p)})));if(Npe(d),Dpe(d,o,s),!o){for(let p of d)if(!p.inspection.contentRepoArchived)await u.archiveContentRepo(p.target),s(`[${p.target.handle}] archived ${p.target.contentRepo}`);for(let p of d)for(let m of p.inspection.dnsRecords)await u.deleteDnsRecord(p.target,m),s(`[${p.target.handle}] deleted DNS ${m.name}`);for(let p of d)if(p.inspection.server)await u.deleteServer(p.target,p.inspection.server),s(`[${p.target.handle}] deleted ${p.target.instanceName}`);await zpe(l,u,t.sleep??((p)=>new Promise((m)=>setTimeout(m,p)))),await Lpe(e,r),await Pi(e),await Nq(e,r),s(`Removed desired state for ${r.length} pilot user(s)`)}return{dryRun:o,handles:r,confirmation:n,plans:d}}function Ppe(e,t,r){let o=e.users.find((d)=>d.handle===t),n=`${t}${e.pilot.domainSuffix}`,i=o?.domain??n,s=Tq(i,{sharedDomain:e.pilot.domainSuffix}),a=o?.cloudflareZoneId??Ay(r,"CF_ZONE_ID"),l=o?.contentRepo??`${e.pilot.contentRepoPrefix}${t}-content`,u=l.includes("/")?l:`${e.pilot.githubOrg}/${l}`;return{handle:t,instanceName:`rover-${t}`,domain:i,previewDomain:s,...i===n?{}:{wwwDomain:`www.${i}`},contentRepo:u,cloudflareZoneId:a}}async function zpe(e,t,r){for(let o of e)for(let n=1;n<=20;n+=1){let i=await t.inspect(o);if(!i.server&&i.dnsRecords.length===0&&i.contentRepoArchived)break;if(n===20)throw Error(`[${o.handle}] provider cleanup did not converge`);await r(1500)}}function Npe(e){for(let{target:t,inspection:r}of e){if(r.server&&r.server.name!==t.instanceName)throw Error(`[${t.handle}] unexpected server name: ${r.server.name}`);let o=new Set([t.domain,t.previewDomain,...t.wwwDomain?[t.wwwDomain]:[]]);for(let n of r.dnsRecords){if(!o.has(n.name))throw Error(`[${t.handle}] refusing unexpected DNS record ${n.name}`);if(n.type==="A"&&r.server?.ip&&n.content!==r.server.ip)throw Error(`[${t.handle}] ${n.name} does not point to the retiring server`)}}}function Dpe(e,t,r){r(`${t?"Dry run":"Apply"}: ${e.map(({target:o})=>o.handle).join(", ")}`);for(let{target:o,inspection:n}of e){let i=n.server?`delete ${o.instanceName}`:"already absent",s=n.dnsRecords.length>0?n.dnsRecords.map((l)=>`${l.type} ${l.name}`).join(", "):"already absent",a=n.contentRepoArchived?"already archived":`archive ${o.contentRepo}`;r(`[${o.handle}] server: ${i}; DNS: ${s}; repo: ${a}`)}r("Runtime backups: none")}async function Lpe(e,t){let r=new Set(t),o=Do(e,"cohorts");for(let n of(await Rpe(o)).filter((i)=>i.endsWith(".yaml"))){let i=Do(o,n),s=await Tpe(i,"utf8"),a=tn(s);if(a.errors.length>0)throw Error(`${n}: ${a.errors[0]?.message??"invalid YAML"}`);let l=a.get("members",!0);if(!_R(l))throw Error(`${n}: members must be a sequence`);let u=l.items.filter((d)=>!zo(d)||typeof d.value!=="string"||!r.has(d.value));if(u.length===l.items.length)continue;if(u.length===0){await pp(i);continue}l.items=u,hn.parse(a.toJS()),await $pe(i,a.toString())}for(let n of t)await Promise.all([pp(Do(e,"users",`${n}.yaml`),{force:!0}),pp(Do(e,"users",`${n}.secrets.yaml`),{force:!0}),pp(Do(e,"users",`${n}.secrets.yaml.age`),{force:!0}),pp(Do(e,"users",n),{recursive:!0,force:!0})])}function Cq(e){let t=e.fetchImpl??fetch,r=Ay(e.env,"HCLOUD_TOKEN"),o=Ay(e.env,"CF_API_TOKEN"),n=Ay(e.env,e.contentRepoTokenName);return{async inspect(i){let[s,a,l]=await Promise.all([Zpe(t,r,i.instanceName),Promise.all([i.domain,i.previewDomain,...i.wwwDomain?[i.wwwDomain]:[]].map((u)=>jpe(t,o,i.cloudflareZoneId,u))).then((u)=>u.flat()),Bpe(t,n,i.contentRepo)]);if(s.length>1)throw Error(`[${i.handle}] expected at most one server, found ${s.length}`);return{...s[0]?{server:s[0]}:{},dnsRecords:a,contentRepoArchived:l.archived}},async archiveContentRepo(i){await il(t,`https://api.github.com/repos/${i.contentRepo}`,{method:"PATCH",headers:Pq(n),body:JSON.stringify({archived:!0})},"GitHub repository archive")},async deleteDnsRecord(i,s){if(sl(await il(t,`https://api.cloudflare.com/client/v4/zones/${i.cloudflareZoneId}/dns_records/${s.id}`,{method:"DELETE",headers:zq(o)},"Cloudflare DNS delete")).success!==!0)throw Error(`Cloudflare DNS delete failed for ${s.name}`)},async deleteServer(i,s){await il(t,`https://api.hetzner.cloud/v1/servers/${s.id}`,{method:"DELETE",headers:{Authorization:`Bearer ${r}`}},"Hetzner server delete",!0)}}}async function Zpe(e,t,r){let o=new URL("https://api.hetzner.cloud/v1/servers");o.searchParams.set("label_selector",`brain=${r}`);let i=sl(await il(e,o.toString(),{headers:{Authorization:`Bearer ${t}`}},"Hetzner server lookup")).servers;if(!Array.isArray(i))throw Error("Hetzner server lookup returned an invalid payload");return i.map((s)=>{let a=sl(s),l=Oq(a.public_net),u=Oq(l?.ipv4);return{id:Upe(a.id,"Hetzner server id"),name:fp(a.name,"Hetzner server name"),...typeof u?.ip==="string"?{ip:u.ip}:{}}})}async function jpe(e,t,r,o){let n=new URL(`https://api.cloudflare.com/client/v4/zones/${r}/dns_records`);n.searchParams.set("name",o);let i=sl(await il(e,n.toString(),{headers:zq(t)},"Cloudflare DNS lookup")),s=i.result;if(i.success!==!0||!Array.isArray(s))throw Error(`Cloudflare DNS lookup failed for ${o}`);return s.map((a)=>{let l=sl(a),u=fp(l.type,"Cloudflare record type");if(u!=="A"&&u!=="CNAME")throw Error(`Unsupported Cloudflare record type ${u} for ${o}`);return{id:fp(l.id,"Cloudflare record id"),name:fp(l.name,"Cloudflare record name"),type:u,content:fp(l.content,"Cloudflare record content")}})}async function Bpe(e,t,r){let o=sl(await il(e,`https://api.github.com/repos/${r}`,{headers:Pq(t)},"GitHub repository lookup"));if(typeof o.archived!=="boolean")throw Error(`Invalid repository archive state for ${r}`);return{archived:o.archived}}async function il(e,t,r,o,n=!1){let i=await e(t,r),s=await i.text();if(!i.ok)throw Error(`${o} failed (${i.status}): ${s}`);if(!s&&n)return{};try{return JSON.parse(s)}catch{throw Error(`${o} returned an invalid JSON response`)}}function Pq(e){return{Accept:"application/vnd.github+json",Authorization:`Bearer ${e}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"}}function zq(e){return{Authorization:`Bearer ${e}`}}function Ay(e,t){let r=e[t];if(!r)throw Error(`Missing required environment variable: ${t}`);return r}function sl(e){if(!Vs(e))throw Error("Provider returned an unexpected payload");return e}function Oq(e){return Vs(e)?e:void 0}function fp(e,t){if(typeof e!=="string"||e.length===0)throw Error(`Missing ${t}`);return e}function Upe(e,t){if(typeof e!=="number")throw Error(`Missing ${t}`);return e}async function Nq(e,t){for(let r of t)for(let o of[Do(e,"users",`${r}.yaml`),Do(e,"users",`${r}.secrets.yaml.age`),Do(e,"users",r)])if(await Ar(o))throw Error(`Offboarded user state remains: ${Ope(o)}`)}var Lq=S(()=>{el();gn();$q();Pd();$o();Ys()});var Zq="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";import{webcrypto as jq}from"crypto";function qpe(e){if(e<0)throw RangeError("Wrong ID size");try{if(!Fi||Fi.length<e)Fi=Buffer.allocUnsafe(e*Mpe),jq.getRandomValues(Fi),al=0;else if(al+e>Fi.length)jq.getRandomValues(Fi),al=0}catch(t){throw Fi=void 0,t}al+=e}function Bq(e=21){qpe(e|=0);let t="";for(let r=al-e;r<al;r++)t+=Zq[Fi[r]&63];return t}var Mpe=128,Fi,al;var Uq=()=>{};function Lo(e=12){return Bq(e)}var mp=S(()=>{Uq()});import{openSync as Fpe,writeSync as Hpe}from"fs";function Jpe(e){return cl?`[${cl}] ${e}`:e}class Rr{static instance=null;level;context;useStderr;format;logFile;fileHandle;constructor(e={},t){if(this.level=e.level??aa.INFO,this.context=e.context??void 0,this.useStderr=e.useStderr??!1,this.format=e.format??"text",this.logFile=e.logFile,t!==void 0)this.fileHandle=t;else if(this.logFile)try{this.fileHandle=Fpe(this.logFile,"a")}catch{}}static getInstance(e){if(!Rr.instance)Rr.instance=new Rr(e);else{if(e?.useStderr!==void 0)Rr.instance.useStderr=e.useStderr;if(e?.level!==void 0)Rr.instance.level=e.level}return Rr.instance}static resetInstance(){Rr.instance=null,cl=void 0}static setProcessRole(e){cl=e}static createFresh(e){return new Rr(e)}formatEntry(e,t,r){if(this.format==="json")return this.formatJsonEntry(e,t,r);return Jpe([`[${new Date().toISOString()}]`,...this.context?[`[${this.context}]`]:[],t].join(" "))}write(e,t,r,o){if(this.format==="json")e(this.formatEntry(t,r,o));else if(o.length>0)e(this.formatEntry(t,r,[]),...o);else e(this.formatEntry(t,r,[]));if(this.fileHandle!==void 0){let n=this.formatJsonEntry(t,r,o);try{Hpe(this.fileHandle,n+`
|
|
445
|
+
`)}catch{}}}formatJsonEntry(e,t,r){let o={ts:new Date().toISOString(),level:e,...cl&&{role:cl},msg:t};if(this.context)o.ctx=this.context;if(r.length>0)o.data=r;return JSON.stringify(o)}debugStream(){return this.useStderr?console.error.bind(console):console.debug.bind(console)}silly(e,...t){if(this.level<=aa.SILLY)this.write(this.debugStream(),"silly",e,t)}verbose(e,...t){if(this.level<=aa.VERBOSE)this.write(this.debugStream(),"verbose",e,t)}debug(e,...t){if(this.level<=aa.DEBUG)this.write(this.debugStream(),"debug",e,t)}info(e,...t){if(this.level<=aa.INFO){let r=this.useStderr?console.error.bind(console):console.info.bind(console);this.write(r,"info",e,t)}}warn(e,...t){if(this.level<=aa.WARN)this.write(console.warn.bind(console),"warn",e,t)}error(e,...t){if(this.level<=aa.ERROR)this.write(console.error.bind(console),"error",e,t)}child(e){return new Rr({level:this.level,context:e,useStderr:this.useStderr,format:this.format},this.fileHandle)}setUseStderr(e){this.useStderr=e}}var aa,cl,yLe;var UR=S(()=>{aa={SILLY:0,VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};yLe=Rr.getInstance()});var MR,Kpe,ll,wLe;var hp=S(()=>{wt();de();MR=c.enum(["file_operations","content_operations","data_processing","batch_processing"]),Kpe=c.looseObject({pluginId:c.string().optional(),progressToken:c.union([c.string(),c.number()]).optional(),operationType:MR,operationTarget:c.string().optional(),interfaceType:c.string().optional(),interfaceId:c.string().optional(),conversationId:c.string().optional(),channelId:c.string().optional(),requestedByActor:Wn.optional(),requestedByUserId:c.string().optional(),requestedByInterface:c.string().optional(),silent:c.boolean().optional(),provenance:To.optional()}),ll=c.looseObject({pluginId:c.string().optional(),progressToken:c.union([c.string(),c.number()]).optional(),operationType:MR,operationTarget:c.string().optional(),interfaceType:c.string().optional(),interfaceId:c.string().optional(),conversationId:c.string().optional(),channelId:c.string().optional(),requestedByActor:Wn.optional(),requestedByUserId:c.string().optional(),requestedByInterface:c.string().optional(),silent:c.boolean().optional(),provenance:To.optional(),rootJobId:c.string()}),wLe=c.enum(["none","skip","replace","coalesce"])});var Vpe,Hi=15000;var gp=S(()=>{hp();de();Vpe=c.object({id:c.string(),type:c.string(),data:c.string(),status:c.enum(["pending","processing","completed","failed"]),source:c.string().nullable(),priority:c.number(),retryCount:c.number(),maxRetries:c.number(),lastError:c.string().nullable(),lastErrorPublic:c.unknown(),createdAt:c.number(),scheduledFor:c.number(),startedAt:c.number().nullable(),completedAt:c.number().nullable(),attemptId:c.string().nullable(),workerSlotId:c.string().nullable(),workerSessionId:c.string().nullable(),leaseExpiresAt:c.number().nullable(),attemptHeartbeatAt:c.number().nullable(),runtimeUpdatedAt:c.number().nullable(),metadata:ll,progress:c.custom((e)=>typeof e==="object"&&e!==null&&("progress"in e)&&typeof e.progress==="number").nullable(),result:c.unknown().nullable().optional()})});var qR,Mq,Oe,Wpe,Gpe,qq,Fq,Hq;var Zo=S(()=>{wt();de();hp();qR=c.enum(["pending","processing","completed","failed"]),Mq=c.enum(["completed","failed"]),Oe={PENDING:"pending",PROCESSING:"processing",COMPLETED:"completed",FAILED:"failed"},Wpe=c.object({id:c.string(),type:c.string(),status:qR,data:c.unknown(),result:c.unknown().optional(),lastError:c.string().optional().nullable(),attempts:c.number(),maxRetries:c.number(),priority:c.number(),createdAt:c.date(),updatedAt:c.date(),processedAt:c.date().optional().nullable(),completedAt:c.date().optional().nullable(),failedAt:c.date().optional().nullable()}),Gpe=c.object({jobId:c.string(),type:c.string(),status:Mq,result:c.unknown().optional(),error:c.string().optional()}),qq=c.object({success:c.literal(!1),error:c.string().optional()}),Fq=c.object({id:c.string(),type:c.enum(["job","batch"]),status:qR,message:c.string().optional(),progress:c.object({current:c.number(),total:c.number(),percentage:c.number()}).optional(),aggregationKey:c.string().optional(),batchDetails:c.object({totalOperations:c.number(),completedOperations:c.number(),failedOperations:c.number(),currentOperation:c.string().optional(),errors:c.array(c.string()).optional()}).optional(),jobDetails:c.object({jobType:c.string(),priority:c.number(),retryCount:c.number()}).optional(),metadata:ll}),Hq=Gn(NA.progress,Fq)});var Ce,Wt;var wn=S(()=>{Ce=class Ce extends Error{code;extendedCode;rawCode;constructor(e,t,r,o,n){if(t!==void 0)e=`${t}: ${e}`;super(e,{cause:n});this.code=t,this.extendedCode=r,this.rawCode=o,this.name="LibsqlError"}};Wt=class Wt extends Ce{statementIndex;constructor(e,t,r,o,n,i){super(e,r,o,n,i);this.statementIndex=t,this.name="LibsqlBatchError"}}});function Jq(e){let t=Qpe.exec(e);if(t===null)throw new Ce(`The URL '${e}' is not in a valid format`,"URL_INVALID");let r=t.groups,o=r.scheme,n=r.authority!==void 0?Ype(r.authority):void 0,i=ca(r.path),s=r.query!==void 0?efe(r.query):void 0,a=r.fragment!==void 0?ca(r.fragment):void 0;return{scheme:o,authority:n,path:i,query:s,fragment:a}}function Ype(e){let t=Xpe.exec(e);if(t===null)throw new Ce("The authority part of the URL is not in a valid format","URL_INVALID");let r=t.groups,o=ca(r.host_br??r.host),n=r.port?parseInt(r.port,10):void 0,i=r.username!==void 0?{username:ca(r.username),password:r.password!==void 0?ca(r.password):void 0}:void 0;return{host:o,port:n,userinfo:i}}function efe(e){let t=e.split("&"),r=[];for(let o of t){if(o==="")continue;let n,i,s=o.indexOf("=");if(s<0)n=o,i="";else n=o.substring(0,s),i=o.substring(s+1);r.push({key:ca(n.replaceAll("+"," ")),value:ca(i.replaceAll("+"," "))})}return{pairs:r}}function ca(e){try{return decodeURIComponent(e)}catch(t){if(t instanceof URIError)throw new Ce(`URL component has invalid percent encoding: ${t}`,"URL_INVALID",void 0,void 0,t);throw t}}function yp(e,t,r){if(t===void 0)throw new Ce(`URL with scheme ${JSON.stringify(e+":")} requires authority (the "//" part)`,"URL_INVALID");let o=`${e}:`,n=tfe(t.host),i=rfe(t.port),a=`//${nfe(t.userinfo)}${n}${i}`,l=r.split("/").map(encodeURIComponent).join("/");if(l!==""&&!l.startsWith("/"))l="/"+l;return new URL(`${o}${a}${l}`)}function tfe(e){return e.includes(":")?`[${encodeURI(e)}]`:encodeURI(e)}function rfe(e){return e!==void 0?`:${e}`:""}function nfe(e){if(e===void 0)return"";let t=encodeURIComponent(e.username),r=e.password!==void 0?`:${encodeURIComponent(e.password)}`:"";return`${t}${r}@`}var Qpe,Xpe;var ky=S(()=>{wn();Qpe=(()=>new RegExp("^(?<scheme>[A-Za-z][A-Za-z.+-]*):(//(?<authority>[^/?#]*))?(?<path>[^?#]*)(\\?(?<query>[^#]*))?(#(?<fragment>.*))?$","su"))();Xpe=(()=>new RegExp("^((?<username>[^:]*)(:(?<password>.*))?@)?((?<host>[^:\\[\\]]*)|(\\[(?<host_br>[^\\[\\]]*)\\]))(:(?<port>[0-9]*))?$","su"))()});var dl,Kq,Vq,bp,Ry,ofe,Gt,Wq,Yq=(e)=>e.replace(/=/g,"").replace(/[+\/]/g,(t)=>t=="+"?"-":"_"),Xq=(e)=>e.replace(/[^A-Za-z0-9\+\/]/g,""),e4=(e)=>{let t,r,o,n,i="",s=e.length%3;for(let a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255)throw TypeError("invalid character found");t=r<<16|o<<8|n,i+=bp[t>>18&63]+bp[t>>12&63]+bp[t>>6&63]+bp[t&63]}return s?i.slice(0,s-3)+"===".substring(s):i},JR,FR,Ty=(e,t=!1)=>t?Yq(FR(e)):FR(e),ife=(e)=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?Gt(192|t>>>6)+Gt(128|t&63):Gt(224|t>>>12&15)+Gt(128|t>>>6&63)+Gt(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return Gt(240|t>>>18&7)+Gt(128|t>>>12&63)+Gt(128|t>>>6&63)+Gt(128|t&63)}},sfe,t4=(e)=>e.replace(sfe,ife),Gq,ul=(e,t=!1)=>t?Yq(Gq(e)):Gq(e),Qq=(e)=>ul(e,!0),afe,cfe=(e)=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return Gt((r>>>10)+55296)+Gt((r&1023)+56320);case 3:return Gt((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Gt((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},r4=(e)=>e.replace(afe,cfe),n4=(e)=>{if(e=e.replace(/\s+/g,""),!ofe.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r,o,n=[];for(let i=0;i<e.length;)if(t=Ry[e.charAt(i++)]<<18|Ry[e.charAt(i++)]<<12|(r=Ry[e.charAt(i++)])<<6|(o=Ry[e.charAt(i++)]),r===64)n.push(Gt(t>>16&255));else if(o===64)n.push(Gt(t>>16&255,t>>8&255));else n.push(Gt(t>>16&255,t>>8&255,t&255));return n.join("")},KR,o4,i4=(e)=>o4(s4(e)),lfe,s4=(e)=>Xq(e.replace(/[-_]/g,(t)=>t=="-"?"+":"/")),HR=(e)=>lfe(s4(e)),ufe=(e)=>{if(typeof e!=="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},a4=(e)=>({value:e,enumerable:!1,writable:!0,configurable:!0}),c4=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,a4(r));e("fromBase64",function(){return HR(this)}),e("toBase64",function(t){return ul(this,t)}),e("toBase64URI",function(){return ul(this,!0)}),e("toBase64URL",function(){return ul(this,!0)}),e("toUint8Array",function(){return i4(this)})},l4=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,a4(r));e("toBase64",function(t){return Ty(this,t)}),e("toBase64URI",function(){return Ty(this,!0)}),e("toBase64URL",function(){return Ty(this,!0)})},dfe=()=>{c4(),l4()},pl;var $y=S(()=>{dl=typeof Buffer==="function",Kq=typeof TextDecoder==="function"?new TextDecoder("utf-8",{ignoreBOM:!0}):void 0,Vq=typeof TextEncoder==="function"?new TextEncoder:void 0,bp=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),Ry=((e)=>{let t={};return e.forEach((r,o)=>t[r]=o),t})(bp),ofe=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Gt=String.fromCharCode.bind(String),Wq=typeof Uint8Array.from==="function"?Uint8Array.from.bind(Uint8Array):(e)=>new Uint8Array(Array.prototype.slice.call(e,0)),JR=typeof btoa==="function"?(e)=>btoa(e):dl?(e)=>Buffer.from(e,"binary").toString("base64"):e4,FR=dl?(e)=>Buffer.from(e).toString("base64"):(e)=>{let r=[];for(let o=0,n=e.length;o<n;o+=4096)r.push(Gt.apply(null,e.subarray(o,o+4096)));return JR(r.join(""))},sfe=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Gq=dl?(e)=>Buffer.from(e,"utf8").toString("base64"):Vq?(e)=>FR(Vq.encode(e)):(e)=>JR(t4(e)),afe=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,KR=typeof atob==="function"?(e)=>atob(Xq(e)):dl?(e)=>Buffer.from(e,"base64").toString("binary"):n4,o4=dl?(e)=>Wq(Buffer.from(e,"base64")):(e)=>Wq(KR(e).split("").map((t)=>t.charCodeAt(0))),lfe=dl?(e)=>Buffer.from(e,"base64").toString("utf8"):Kq?(e)=>Kq.decode(o4(e)):(e)=>r4(KR(e)),pl={version:"3.8.0",VERSION:"3.8.0",atob:KR,atobPolyfill:n4,btoa:JR,btoaPolyfill:e4,fromBase64:HR,toBase64:ul,encode:ul,encodeURI:Qq,encodeURL:Qq,utob:t4,btou:r4,decode:HR,isValid:ufe,fromUint8Array:Ty,toUint8Array:i4,extendString:c4,extendUint8Array:l4,extendBuiltins:dfe}});function Ji(e){if(e==="write")return"BEGIN IMMEDIATE";else if(e==="read")return"BEGIN TRANSACTION READONLY";else if(e==="deferred")return"BEGIN DEFERRED";else throw RangeError('Unknown transaction mode, supported values are "write", "read" and "deferred"')}class fl{columns;columnTypes;rows;rowsAffected;lastInsertRowid;constructor(e,t,r,o,n){this.columns=e,this.columnTypes=t,this.rows=r,this.rowsAffected=o,this.lastInsertRowid=n}toJSON(){return{columns:this.columns,columnTypes:this.columnTypes,rows:this.rows.map(pfe),rowsAffected:this.rowsAffected,lastInsertRowid:this.lastInsertRowid!==void 0?""+this.lastInsertRowid:null}}}function pfe(e){return Array.prototype.map.call(e,ffe)}function ffe(e){if(typeof e==="bigint")return""+e;else if(e instanceof ArrayBuffer)return pl.fromUint8Array(new Uint8Array(e));else return e}var ro="https://github.com/libsql/libsql-client-ts#supported-urls";var ml=S(()=>{$y()});function d4(e){return e.scheme==="file"&&(e.path===":memory:"||e.path.startsWith(":memory:?"))}function Sp(e,t){if(typeof e!=="object")throw TypeError(`Expected client configuration as object, got ${typeof e}`);let{url:r,authToken:o,tls:n,intMode:i,concurrency:s}=e;s=Math.max(0,s||20),i??="number";let a=[];if(r===u4)r="file::memory:";let l=Jq(r),u=l.scheme.toLowerCase(),d=u==="file"&&l.path===u4&&l.authority===void 0,p;if(d)p={cache:{values:["shared","private"],update:(y,v)=>a.push(`${y}=${v}`)}};else p={tls:{values:["0","1"],update:(y,v)=>n=v==="1"},authToken:{update:(y,v)=>o=v}};for(let{key:y,value:v}of l.query?.pairs??[]){if(!Object.hasOwn(p,y))throw new Ce(`Unsupported URL query parameter ${JSON.stringify(y)}`,"URL_PARAM_NOT_SUPPORTED");let x=p[y];if(x.values!==void 0&&!x.values.includes(v))throw new Ce(`Unknown value for the "${y}" query argument: ${JSON.stringify(v)}. Supported values are: [${x.values.map((_)=>'"'+_+'"').join(", ")}]`,"URL_INVALID");if(x.update!==void 0)x?.update(y,v)}let m=a.length===0?"":`?${a.join("&")}`,h=l.path+m,b;if(u==="libsql")if(n===!1){if(l.authority?.port===void 0)throw new Ce('A "libsql:" URL with ?tls=0 must specify an explicit port',"URL_INVALID");b=t?"http":"ws"}else b=t?"https":"wss";else b=u;if(b==="http"||b==="ws")n??=!1;else n??=!0;if(b!=="http"&&b!=="ws"&&b!=="https"&&b!=="wss"&&b!=="file")throw new Ce(`The client supports only "libsql:", "wss:", "ws:", "https:", "http:" and "file:" URLs, got ${JSON.stringify(l.scheme+":")}. For more information, please read ${ro}`,"URL_SCHEME_NOT_SUPPORTED");if(i!=="number"&&i!=="bigint"&&i!=="string")throw TypeError(`Invalid value for intMode, expected "number", "bigint" or "string", got ${JSON.stringify(i)}`);if(l.fragment!==void 0)throw new Ce(`URL fragments are not supported: ${JSON.stringify("#"+l.fragment)}`,"URL_INVALID");if(d)return{scheme:"file",tls:!1,path:h,intMode:i,concurrency:s,syncUrl:e.syncUrl,syncInterval:e.syncInterval,readYourWrites:e.readYourWrites,offline:e.offline,fetch:e.fetch,timeout:e.timeout,authToken:void 0,encryptionKey:void 0,remoteEncryptionKey:void 0,authority:void 0};return{scheme:b,tls:n,authority:l.authority,path:h,authToken:o,intMode:i,concurrency:s,encryptionKey:e.encryptionKey,remoteEncryptionKey:e.remoteEncryptionKey,syncUrl:e.syncUrl,syncInterval:e.syncInterval,readYourWrites:e.readYourWrites,offline:e.offline,fetch:e.fetch,timeout:e.timeout}}var u4=":memory:";var vp=S(()=>{wn();ky();ml()});var f4=ge(function(rn){var mfe=rn&&rn.__createBinding||(Object.create?function(e,t,r,o){if(o===void 0)o=r;var n=Object.getOwnPropertyDescriptor(t,r);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable))n={enumerable:!0,get:function(){return t[r]}};Object.defineProperty(e,o,n)}:function(e,t,r,o){if(o===void 0)o=r;e[o]=t[r]}),hfe=rn&&rn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),p4=rn&&rn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null){for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))mfe(t,e,r)}return hfe(t,e),t};Object.defineProperty(rn,"__esModule",{value:!0});rn.load=rn.currentTarget=void 0;var gfe=p4(Fr("path")),yfe=p4(Fr("fs"));function bfe(){let e=null;switch(process.platform){case"android":switch(process.arch){case"arm":return"android-arm-eabi";case"arm64":return"android-arm64"}e="Android";break;case"win32":switch(process.arch){case"x64":return"win32-x64-msvc";case"arm64":return"win32-arm64-msvc";case"ia32":return"win32-ia32-msvc"}e="Windows";break;case"darwin":switch(process.arch){case"x64":return"darwin-x64";case"arm64":return"darwin-arm64"}e="macOS";break;case"linux":switch(process.arch){case"x64":case"arm64":return Sfe()?`linux-${process.arch}-gnu`:`linux-${process.arch}-musl`;case"arm":return"linux-arm-gnueabihf"}e="Linux";break;case"freebsd":if(process.arch==="x64")return"freebsd-x64";e="FreeBSD";break}if(e)throw Error(`Neon: unsupported ${e} architecture: ${process.arch}`);throw Error(`Neon: unsupported system: ${process.platform}`)}rn.currentTarget=bfe;function Sfe(){let e=process.report?.getReport();if(typeof e!=="object"||!e||!("header"in e))return!1;let t=e.header;return typeof t==="object"&&!!t&&"glibcVersionRuntime"in t}function vfe(e){let t=gfe.join(e,"index.node");return yfe.existsSync(t)?Fr(t):null}rn.load=vfe});var g4=ge(function(MLe,h4){var m4=()=>process.platform==="linux",VR=null,wfe=()=>{if(!VR)VR=m4()&&process.report?process.report.getReport():{};return VR};h4.exports={isLinux:m4,getReport:wfe}});var S4=ge(function(qLe,b4){var y4=Fr("fs"),xfe=(e)=>y4.readFileSync(e,"utf-8"),_fe=(e)=>new Promise((t,r)=>{y4.readFile(e,"utf-8",(o,n)=>{if(o)r(o);else t(n)})});b4.exports={LDD_PATH:"/usr/bin/ldd",readFileSync:xfe,readFile:_fe}});var D4=ge(function(FLe,N4){var w4=Fr("child_process"),{isLinux:hl,getReport:x4}=g4(),{LDD_PATH:Oy,readFile:_4,readFileSync:E4}=S4(),no,oo,Ki="",I4=()=>{if(!Ki)return new Promise((e)=>{w4.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{Ki=t?" ":r,e(Ki)})});return Ki},A4=()=>{if(!Ki)try{Ki=w4.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){Ki=" "}return Ki},jo="glibc",k4=/GLIBC\s(\d+\.\d+)/,la="musl",Efe=jo.toUpperCase(),Ife=la.toLowerCase(),Afe=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),R4=()=>{let e=x4();if(e.header&&e.header.glibcVersionRuntime)return jo;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(Afe))return la}return null},T4=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(jo))return jo;if(r&&r.includes(la))return la;return null},$4=(e)=>{if(e.includes(Ife))return la;if(e.includes(Efe))return jo;return null},kfe=async()=>{if(no!==void 0)return no;no=null;try{let e=await _4(Oy);no=$4(e)}catch(e){}return no},Rfe=()=>{if(no!==void 0)return no;no=null;try{let e=E4(Oy);no=$4(e)}catch(e){}return no},O4=async()=>{let e=null;if(hl()){if(e=await kfe(),!e)e=R4();if(!e){let t=await I4();e=T4(t)}}return e},C4=()=>{let e=null;if(hl()){if(e=Rfe(),!e)e=R4();if(!e){let t=A4();e=T4(t)}}return e},Tfe=async()=>hl()&&await O4()!==jo,$fe=()=>hl()&&C4()!==jo,Ofe=async()=>{if(oo!==void 0)return oo;oo=null;try{let t=(await _4(Oy)).match(k4);if(t)oo=t[1]}catch(e){}return oo},Cfe=()=>{if(oo!==void 0)return oo;oo=null;try{let t=E4(Oy).match(k4);if(t)oo=t[1]}catch(e){}return oo},P4=()=>{let e=x4();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},v4=(e)=>e.trim().split(/\s+/)[1],z4=(e)=>{let[t,r,o]=e.split(/[\r\n]+/);if(t&&t.includes(jo))return v4(t);if(r&&o&&r.includes(la))return v4(o);return null},Pfe=async()=>{let e=null;if(hl()){if(e=await Ofe(),!e)e=P4();if(!e){let t=await I4();e=z4(t)}}return e},zfe=()=>{let e=null;if(hl()){if(e=Cfe(),!e)e=P4();if(!e){let t=A4();e=z4(t)}}return e};N4.exports={GLIBC:jo,MUSL:la,family:O4,familySync:C4,isNonGlibcLinux:Tfe,isNonGlibcLinuxSync:$fe,version:Pfe,versionSync:zfe}});var Z4=ge(function(HLe,L4){var Nfe={ALLOW:0,DENY:1};L4.exports=Nfe});var B4=ge(function(JLe,j4){var WR={value:"SqliteError",writable:!0,enumerable:!1,configurable:!0};function ua(e,t,r){if(new.target!==ua)return new ua(e,t);if(typeof t!=="string")throw TypeError("Expected second argument to be a string");Error.call(this,e),WR.value=""+e,Object.defineProperty(this,"message",WR),Error.captureStackTrace(this,ua),this.code=t,this.rawCode=r}Object.setPrototypeOf(ua,Error);Object.setPrototypeOf(ua.prototype,Error.prototype);Object.defineProperty(ua.prototype,"name",WR);j4.exports=ua});var V4=ge(function(KLe,Cy){var __dirname="/home/runner/work/brains/brains/node_modules/libsql",{load:Dfe,currentTarget:Lfe}=f4(),{familySync:U4,GLIBC:Zfe,MUSL:jfe}=D4();function Bfe(){if(process.env.LIBSQL_JS_DEV)return Dfe(__dirname);let e=Lfe();if(U4()==Zfe)switch(e){case"linux-x64-musl":e="linux-x64-gnu";break;case"linux-arm64-musl":e="linux-arm64-gnu";break}if(e==="linux-arm-gnueabihf"&&U4()==jfe)e="linux-arm-musleabihf";return Fr(`@libsql/${e}`)}var{databaseOpen:Ufe,databaseOpenWithSync:Mfe,databaseInTransaction:qfe,databaseInterrupt:Ffe,databaseClose:Hfe,databaseSyncSync:Jfe,databaseSyncUntilSync:Kfe,databaseExecSync:Vfe,databasePrepareSync:Wfe,databaseDefaultSafeIntegers:Gfe,databaseAuthorizer:Qfe,databaseLoadExtension:Yfe,databaseMaxWriteReplicationIndex:Xfe,statementRaw:eme,statementIsReader:tme,statementGet:M4,statementRun:q4,statementInterrupt:rme,statementRowsSync:F4,statementColumns:nme,statementSafeIntegers:ome,rowsNext:ime}=Bfe(),sme=Z4(),H4=B4();function gl(e){if(e.libsqlError)return new H4(e.message,e.code,e.rawCode);return e}class J4{constructor(e,t){let r=t?.encryptionCipher??"aes256cbc";if(t&&t.syncUrl){var o="";if(t.syncAuth)console.warn("Warning: The `syncAuth` option is deprecated, please use `authToken` option instead."),o=t.syncAuth;else if(t.authToken)o=t.authToken;let i=t?.encryptionKey??"",s=t?.syncPeriod??0,a=t?.readYourWrites??!0,l=t?.offline??!1,u=t?.remoteEncryptionKey??"";this.db=Mfe(e,t.syncUrl,o,r,i,s,a,l,u)}else{let i=t?.authToken??"",s=t?.encryptionKey??"",a=t?.timeout??0,l=t?.remoteEncryptionKey??"";this.db=Ufe(e,i,r,s,a,l)}this.memory=e===":memory:",this.readonly=!1,this.name="",this.open=!0;let n=this.db;Object.defineProperties(this,{inTransaction:{get(){return qfe(n)}}})}sync(){return Jfe.call(this.db)}syncUntil(e){return Kfe.call(this.db,e)}prepare(e){try{let t=Wfe.call(this.db,e);return new K4(t)}catch(t){throw gl(t)}}transaction(e){if(typeof e!=="function")throw TypeError("Expected first argument to be a function");let t=this,r=(n)=>(...i)=>{t.exec("BEGIN "+n);try{let s=e(...i);return t.exec("COMMIT"),s}catch(s){throw t.exec("ROLLBACK"),s}},o={default:{value:r("")},deferred:{value:r("DEFERRED")},immediate:{value:r("IMMEDIATE")},exclusive:{value:r("EXCLUSIVE")},database:{value:this,enumerable:!0}};return Object.defineProperties(o.default.value,o),Object.defineProperties(o.deferred.value,o),Object.defineProperties(o.immediate.value,o),Object.defineProperties(o.exclusive.value,o),o.default.value}pragma(e,t){if(t==null)t={};if(typeof e!=="string")throw TypeError("Expected first argument to be a string");if(typeof t!=="object")throw TypeError("Expected second argument to be an options object");let r=t.simple,o=this.prepare(`PRAGMA ${e}`,this,!0);return r?o.pluck().get():o.all()}backup(e,t){throw Error("not implemented")}serialize(e){throw Error("not implemented")}function(e,t,r){if(t==null)t={};if(typeof t==="function")r=t,t={};if(typeof e!=="string")throw TypeError("Expected first argument to be a string");if(typeof r!=="function")throw TypeError("Expected last argument to be a function");if(typeof t!=="object")throw TypeError("Expected second argument to be an options object");if(!e)throw TypeError("User-defined function name cannot be an empty string");throw Error("not implemented")}aggregate(e,t){if(typeof e!=="string")throw TypeError("Expected first argument to be a string");if(typeof t!=="object"||t===null)throw TypeError("Expected second argument to be an options object");if(!e)throw TypeError("User-defined function name cannot be an empty string");throw Error("not implemented")}table(e,t){if(typeof e!=="string")throw TypeError("Expected first argument to be a string");if(!e)throw TypeError("Virtual table module name cannot be an empty string");throw Error("not implemented")}authorizer(e){Qfe.call(this.db,e)}loadExtension(...e){Yfe.call(this.db,...e)}maxWriteReplicationIndex(){return Xfe.call(this.db)}exec(e){try{Vfe.call(this.db,e)}catch(t){throw gl(t)}}interrupt(){Ffe.call(this.db)}close(){Hfe.call(this.db),this.open=!1}defaultSafeIntegers(e){return Gfe.call(this.db,e??!0),this}unsafeMode(...e){throw Error("not implemented")}}class K4{constructor(e){this.stmt=e,this.pluckMode=!1}raw(e){return eme.call(this.stmt,e??!0),this}pluck(e){return this.pluckMode=e??!0,this}get reader(){return tme.call(this.stmt)}run(...e){try{if(e.length==1&&typeof e[0]==="object")return q4.call(this.stmt,e[0]);else return q4.call(this.stmt,e.flat())}catch(t){throw gl(t)}}get(...e){try{if(e.length==1&&typeof e[0]==="object")return M4.call(this.stmt,e[0]);else return M4.call(this.stmt,e.flat())}catch(t){throw gl(t)}}iterate(...e){var t=void 0;if(e.length==1&&typeof e[0]==="object")t=F4.call(this.stmt,e[0]);else t=F4.call(this.stmt,e.flat());return{nextRows:Array(100),nextRowIndex:100,next(){try{if(this.nextRowIndex===100)ime.call(t,this.nextRows),this.nextRowIndex=0;let o=this.nextRows[this.nextRowIndex];if(this.nextRows[this.nextRowIndex]=void 0,!o)return{done:!0};return this.nextRowIndex++,{value:o,done:!1}}catch(o){throw gl(o)}},[Symbol.iterator](){return this}}}all(...e){try{let t=[];for(let r of this.iterate(...e))if(this.pluckMode)t.push(r[Object.keys(r)[0]]);else t.push(r);return t}catch(t){throw gl(t)}}interrupt(){rme.call(this.stmt)}columns(){return nme.call(this.stmt)}safeIntegers(e){return ome.call(this.stmt,e??!0),this}}Cy.exports=J4;Cy.exports.Authorization=sme;Cy.exports.SqliteError=H4});import{Buffer as G4}from"buffer";function Q4(e){if(e.scheme!=="file")throw new Ce(`URL scheme ${JSON.stringify(e.scheme+":")} is not supported by the local sqlite3 client. For more information, please read ${ro}`,"URL_SCHEME_NOT_SUPPORTED");let t=e.authority;if(t!==void 0){let s=t.host.toLowerCase();if(s!==""&&s!=="localhost")throw new Ce(`Invalid host in file URL: ${JSON.stringify(t.host)}. A "file:" URL with an absolute path should start with one slash ("file:/absolute/path.db") or with three slashes ("file:///absolute/path.db"). For more information, please read ${ro}`,"URL_INVALID");if(t.port!==void 0)throw new Ce("File URL cannot have a port","URL_INVALID");if(t.userinfo!==void 0)throw new Ce("File URL cannot have username and password","URL_INVALID")}let r=d4(e);if(r&&e.syncUrl)throw new Ce(`Embedded replica must use file for local db but URI with in-memory mode were provided instead: ${e.path}`,"URL_INVALID");let o=e.path;if(r)o=`${e.scheme}:${e.path}`;let n={authToken:e.authToken,encryptionKey:e.encryptionKey,remoteEncryptionKey:e.remoteEncryptionKey,syncUrl:e.syncUrl,syncPeriod:e.syncInterval,readYourWrites:e.readYourWrites,offline:e.offline,timeout:e.timeout},i=new wp.default(o,n);return zt(i,"SELECT 1 AS checkThatTheDatabaseCanBeOpened",e.intMode),new Y4(o,n,i,e.intMode)}class Y4{#e;#t;#r;#n;closed;protocol;constructor(e,t,r,o){this.#e=e,this.#t=t,this.#r=r,this.#n=o,this.closed=!1,this.protocol="file"}async execute(e,t){let r;if(typeof e==="string")r={sql:e,args:t||[]};else r=e;return this.#o(),zt(this.#i(),r,this.#n)}async batch(e,t="deferred"){this.#o();let r=this.#i();try{zt(r,Ji(t),this.#n);let o=[];for(let n=0;n<e.length;n++)try{if(!r.inTransaction)throw new Wt("The transaction has been rolled back",n,"TRANSACTION_CLOSED");let i=e[n],s=Array.isArray(i)?{sql:i[0],args:i[1]||[]}:i;o.push(zt(r,s,this.#n))}catch(i){if(i instanceof Wt)throw i;if(i instanceof Ce)throw new Wt(i.message,n,i.code,i.extendedCode,i.rawCode,i.cause instanceof Error?i.cause:void 0);throw i}return zt(r,"COMMIT",this.#n),o}finally{if(r.inTransaction)zt(r,"ROLLBACK",this.#n)}}async migrate(e){this.#o();let t=this.#i();try{zt(t,"PRAGMA foreign_keys=off",this.#n),zt(t,Ji("deferred"),this.#n);let r=[];for(let o=0;o<e.length;o++)try{if(!t.inTransaction)throw new Wt("The transaction has been rolled back",o,"TRANSACTION_CLOSED");r.push(zt(t,e[o],this.#n))}catch(n){if(n instanceof Wt)throw n;if(n instanceof Ce)throw new Wt(n.message,o,n.code,n.extendedCode,n.rawCode,n.cause instanceof Error?n.cause:void 0);throw n}return zt(t,"COMMIT",this.#n),r}finally{if(t.inTransaction)zt(t,"ROLLBACK",this.#n);zt(t,"PRAGMA foreign_keys=on",this.#n)}}async transaction(e="write"){let t=this.#i();return zt(t,Ji(e),this.#n),this.#r=null,new X4(t,this.#n)}async executeMultiple(e){this.#o();let t=this.#i();try{return eF(t,e)}finally{if(t.inTransaction)zt(t,"ROLLBACK",this.#n)}}async sync(){this.#o();let e=await this.#i().sync();return{frames_synced:e.frames_synced,frame_no:e.frame_no}}async reconnect(){try{if(!this.closed&&this.#r!==null)this.#r.close()}finally{this.#r=new wp.default(this.#e,this.#t),this.closed=!1}}close(){if(this.closed=!0,this.#r!==null)this.#r.close(),this.#r=null}#o(){if(this.closed)throw new Ce("The client is closed","CLIENT_CLOSED")}#i(){if(this.#r===null)this.#r=new wp.default(this.#e,this.#t);return this.#r}}class X4{#e;#t;constructor(e,t){this.#e=e,this.#t=t}async execute(e,t){let r;if(typeof e==="string")r={sql:e,args:t||[]};else r=e;return this.#r(),zt(this.#e,r,this.#t)}async batch(e){let t=[];for(let r=0;r<e.length;r++)try{this.#r();let o=e[r],n=Array.isArray(o)?{sql:o[0],args:o[1]||[]}:o;t.push(zt(this.#e,n,this.#t))}catch(o){if(o instanceof Wt)throw o;if(o instanceof Ce)throw new Wt(o.message,r,o.code,o.extendedCode,o.rawCode,o.cause instanceof Error?o.cause:void 0);throw o}return t}async executeMultiple(e){return this.#r(),eF(this.#e,e)}async rollback(){if(!this.#e.open)return;this.#r(),zt(this.#e,"ROLLBACK",this.#t)}async commit(){this.#r(),zt(this.#e,"COMMIT",this.#t)}close(){if(this.#e.inTransaction)zt(this.#e,"ROLLBACK",this.#t)}get closed(){return!this.#e.inTransaction}#r(){if(this.closed)throw new Ce("The transaction is closed","TRANSACTION_CLOSED")}}function zt(e,t,r){let o,n;if(typeof t==="string")o=t,n=[];else if(o=t.sql,Array.isArray(t.args))n=t.args.map((i)=>W4(i,r));else{n={};for(let i in t.args){let s=i[0]==="@"||i[0]==="$"||i[0]===":"?i.substring(1):i;n[s]=W4(t.args[i],r)}}try{let i=e.prepare(o);i.safeIntegers(!0);let s=!0;try{i.raw(!0)}catch{s=!1}if(s){let a=Array.from(i.columns().map((m)=>m.name)),l=Array.from(i.columns().map((m)=>m.type??"")),u=i.all(n).map((m)=>ame(m,a,r)),d=0,p=void 0;return new fl(a,l,u,0,void 0)}else{let a=i.run(n),l=a.changes,u=BigInt(a.lastInsertRowid);return new fl([],[],[],l,u)}}catch(i){throw tF(i)}}function ame(e,t,r){let o={};Object.defineProperty(o,"length",{value:e.length});for(let n=0;n<e.length;++n){let i=cme(e[n],r);Object.defineProperty(o,n,{value:i});let s=t[n];if(!Object.hasOwn(o,s))Object.defineProperty(o,s,{value:i,enumerable:!0,configurable:!0,writable:!0})}return o}function cme(e,t){if(typeof e==="bigint")if(t==="number"){if(e<lme||e>ume)throw RangeError("Received integer which cannot be safely represented as a JavaScript number");return Number(e)}else if(t==="bigint")return e;else if(t==="string")return""+e;else throw Error("Invalid value for IntMode");else if(e instanceof G4)return e.buffer;return e}function W4(e,t){if(typeof e==="number"){if(!Number.isFinite(e))throw RangeError("Only finite numbers (not Infinity or NaN) can be passed as arguments");return e}else if(typeof e==="bigint"){if(e<dme||e>pme)throw RangeError("bigint is too large to be represented as a 64-bit integer and passed as argument");return e}else if(typeof e==="boolean")switch(t){case"bigint":return e?1n:0n;case"string":return e?"1":"0";default:return e?1:0}else if(e instanceof ArrayBuffer)return G4.from(e);else if(e instanceof Date)return e.valueOf();else if(e===void 0)throw TypeError("undefined cannot be passed as argument to the database");else return e}function eF(e,t){try{e.exec(t)}catch(r){throw tF(r)}}function tF(e){if(e instanceof wp.default.SqliteError){let t=e.code,r=fme(e.rawCode);return new Ce(e.message,r,t,e.rawCode,e)}return e}function fme(e){if(e===void 0)return"SQLITE_UNKNOWN";let t=e&255;return mme[t]??`SQLITE_UNKNOWN_${t.toString()}`}var wp,lme,ume=9007199254740991n,dme,pme=9223372036854775807n,mme;var rF=S(()=>{wn();vp();ml();wp=Jl(V4(),1);wn();lme=-9007199254740991n;dme=-9223372036854775808n;mme={1:"SQLITE_ERROR",2:"SQLITE_INTERNAL",3:"SQLITE_PERM",4:"SQLITE_ABORT",5:"SQLITE_BUSY",6:"SQLITE_LOCKED",7:"SQLITE_NOMEM",8:"SQLITE_READONLY",9:"SQLITE_INTERRUPT",10:"SQLITE_IOERR",11:"SQLITE_CORRUPT",12:"SQLITE_NOTFOUND",13:"SQLITE_FULL",14:"SQLITE_CANTOPEN",15:"SQLITE_PROTOCOL",16:"SQLITE_EMPTY",17:"SQLITE_SCHEMA",18:"SQLITE_TOOBIG",19:"SQLITE_CONSTRAINT",20:"SQLITE_MISMATCH",21:"SQLITE_MISUSE",22:"SQLITE_NOLFS",23:"SQLITE_AUTH",24:"SQLITE_FORMAT",25:"SQLITE_RANGE",26:"SQLITE_NOTADB",27:"SQLITE_NOTICE",28:"SQLITE_WARNING"}});var Vi;var GR=S(()=>{if(typeof WebSocket<"u")Vi=WebSocket;else if(typeof global<"u")Vi=global.WebSocket;else if(typeof window<"u")Vi=window.WebSocket;else if(typeof self<"u")Vi=self.WebSocket});class yl{constructor(){this.intMode="number"}intMode}var Ge,Pe,xp,_t,_p,bl,da,xn,or,io;var Et=S(()=>{Ge=class Ge extends Error{constructor(e){super(e);this.name="ClientError"}};Pe=class Pe extends Ge{constructor(e){super(e);this.name="ProtoError"}};xp=class xp extends Ge{code;proto;constructor(e,t){super(e);this.name="ResponseError",this.code=t.code,this.proto=t,this.stack=void 0}};_t=class _t extends Ge{constructor(e,t){if(t!==void 0){super(`${e}: ${t}`);this.cause=t}else super(e);this.name="ClosedError"}};_p=class _p extends Ge{constructor(e){super(e);this.name="WebSocketUnsupportedError"}};bl=class bl extends Ge{constructor(e){super(e);this.name="WebSocketError"}};da=class da extends Ge{status;constructor(e,t){super(e);this.status=t,this.name="HttpServerError"}};xn=class xn extends Ge{constructor(e){super(e);this.name="ProtocolVersionError"}};or=class or extends Ge{constructor(e){super(e);this.name="InternalError"}};io=class io extends Ge{constructor(e){super(e);this.name="MisuseError"}}});function Tr(e){if(typeof e==="string")return e;throw Sl(e,"string")}function Ur(e){if(e===null||e===void 0)return;else if(typeof e==="string")return e;throw Sl(e,"string or null")}function Bo(e){if(typeof e==="number")return e;throw Sl(e,"number")}function Wi(e){if(typeof e==="boolean")return e;throw Sl(e,"boolean")}function Ep(e){if(Array.isArray(e))return e;throw Sl(e,"array")}function kt(e){if(e!==null&&typeof e==="object"&&!Array.isArray(e))return e;throw Sl(e,"object")}function _n(e,t){return Ep(e).map((r)=>t(kt(r)))}function Sl(e,t){if(e===void 0)return new Pe(`Expected ${t}, but the property was missing`);let r=typeof e;if(e===null)r="null";else if(Array.isArray(e))r="array";return new Pe(`Expected ${t}, received ${r}`)}function pa(e,t){return t(kt(e))}var vl=S(()=>{Et()});class nF{#e;#t;constructor(e){this.#e=e,this.#t=!1}begin(){this.#e.push("{"),this.#t=!0}end(){this.#e.push("}"),this.#t=!1}#r(e){if(this.#t)this.#e.push('"'),this.#t=!1;else this.#e.push(',"');this.#e.push(e),this.#e.push('":')}string(e,t){this.#r(e),this.#e.push(JSON.stringify(t))}stringRaw(e,t){this.#r(e),this.#e.push('"'),this.#e.push(t),this.#e.push('"')}number(e,t){this.#r(e),this.#e.push(""+t)}boolean(e,t){this.#r(e),this.#e.push(t?"true":"false")}object(e,t,r){this.#r(e),this.begin(),r(this,t),this.end()}arrayObjects(e,t,r){this.#r(e),this.#e.push("[");for(let o=0;o<t.length;++o){if(o!==0)this.#e.push(",");this.begin(),r(this,t[o]),this.end()}this.#e.push("]")}}function Ip(e,t){let r=[],o=new nF(r);return o.begin(),t(o,e),o.end(),r.join("")}var fa=0,Ap=1,kp=2,oF=5;class iF{#e;#t;#r;constructor(e){this.#e=e,this.#t=new DataView(e.buffer,e.byteOffset,e.byteLength),this.#r=0}varint(){let e=0;for(let t=0;;t+=7){let r=this.#e[this.#r++];if(e|=(r&127)<<t,!(r&128))break}return e}varintBig(){let e=0n;for(let t=0n;;t+=7n){let r=this.#e[this.#r++];if(e|=BigInt(r&127)<<t,!(r&128))break}return e}bytes(e){let t=new Uint8Array(this.#e.buffer,this.#e.byteOffset+this.#r,e);return this.#r+=e,t}double(){let e=this.#t.getFloat64(this.#r,!0);return this.#r+=8,e}skipVarint(){for(;;)if(!(this.#e[this.#r++]&128))break}skip(e){this.#r+=e}eof(){return this.#r>=this.#e.byteLength}}class sF{#e;#t;constructor(e){this.#e=e,this.#t=-1}setup(e){this.#t=e}#r(e){if(this.#t!==e)throw new Pe(`Expected wire type ${e}, got ${this.#t}`);this.#t=-1}bytes(){this.#r(kp);let e=this.#e.varint();return this.#e.bytes(e)}string(){return new TextDecoder().decode(this.bytes())}message(e){return Gi(this.bytes(),e)}int32(){return this.#r(fa),this.#e.varint()}uint32(){return this.int32()}bool(){return this.int32()!==0}uint64(){return this.#r(fa),this.#e.varintBig()}sint64(){let e=this.uint64();return e>>1n^-(e&1n)}double(){return this.#r(Ap),this.#e.double()}maybeSkip(){if(this.#t<0)return;else if(this.#t===fa)this.#e.skipVarint();else if(this.#t===Ap)this.#e.skip(8);else if(this.#t===kp){let e=this.#e.varint();this.#e.skip(e)}else if(this.#t===oF)this.#e.skip(4);else throw new Pe(`Unexpected wire type ${this.#t}`);this.#t=-1}}function Gi(e,t){let r=new iF(e),o=new sF(r),n=t.default();while(!r.eof()){let i=r.varint(),s=i>>3,a=i&7;o.setup(a);let l=t[s];if(l!==void 0){let u=l(o,n);if(u!==void 0)n=u}o.maybeSkip()}return n}var QR=S(()=>{Et()});class YR{#e;#t;#r;#n;constructor(){this.#e=new ArrayBuffer(256),this.#t=new Uint8Array(this.#e),this.#r=new DataView(this.#e),this.#n=0}#o(e){if(this.#n+e<=this.#e.byteLength)return;let t=this.#e.byteLength;while(t<this.#n+e)t*=2;let r=new ArrayBuffer(t),o=new Uint8Array(r),n=new DataView(r);o.set(new Uint8Array(this.#e,0,this.#n)),this.#e=r,this.#t=o,this.#r=n}#i(e){this.#o(5),e=0|e;do{let t=e&127;e>>>=7,t|=e?128:0,this.#t[this.#n++]=t}while(e)}#a(e){this.#o(10),e=e&0xffffffffffffffffn;do{let t=Number(e&0x7fn);e>>=7n,t|=e?128:0,this.#t[this.#n++]=t}while(e)}#s(e,t){this.#i(e<<3|t)}bytes(e,t){this.#s(e,kp),this.#i(t.byteLength),this.#o(t.byteLength),this.#t.set(t,this.#n),this.#n+=t.byteLength}string(e,t){this.bytes(e,new TextEncoder().encode(t))}message(e,t,r){let o=new YR;r(o,t),this.bytes(e,o.data())}int32(e,t){this.#s(e,fa),this.#i(t)}uint32(e,t){this.int32(e,t)}bool(e,t){this.int32(e,t?1:0)}sint64(e,t){this.#s(e,fa),this.#a(t<<1n^t>>63n)}double(e,t){this.#s(e,Ap),this.#o(8),this.#r.setFloat64(this.#n,t,!0),this.#n+=8}data(){return new Uint8Array(this.#e,0,this.#n)}}function Rp(e,t){let r=new YR;return t(r,e),r.data()}var aF=()=>{};var XR=S(()=>{vl();QR();aF()});class Qi{#e;#t;constructor(){this.#e=new Set,this.#t=new Set}alloc(){for(let t of this.#t){if(this.#t.delete(t),this.#e.add(t),!this.#e.has(this.#e.size-1))this.#t.add(this.#e.size-1);return t}let e=this.#e.size;return this.#e.add(e),e}free(e){if(!this.#e.delete(e))throw new or("Freeing an id that is not allocated");if(this.#t.delete(this.#e.size),e<this.#e.size)this.#t.add(e)}}var eT=S(()=>{Et()});function Je(e,t){throw new or(t)}var nn=S(()=>{Et()});function wl(e){if(e===null)return null;else if(typeof e==="string")return e;else if(typeof e==="number"){if(!Number.isFinite(e))throw RangeError("Only finite numbers (not Infinity or NaN) can be passed as arguments");return e}else if(typeof e==="bigint"){if(e<gme||e>yme)throw RangeError("This bigint value is too large to be represented as a 64-bit integer and passed as argument");return e}else if(typeof e==="boolean")return e?1n:0n;else if(e instanceof ArrayBuffer)return new Uint8Array(e);else if(e instanceof Uint8Array)return e;else if(e instanceof Date)return+e.valueOf();else if(typeof e==="object")return""+e.toString();else throw TypeError("Unsupported type of value")}function tT(e,t){if(e===null)return null;else if(typeof e==="number")return e;else if(typeof e==="string")return e;else if(typeof e==="bigint")if(t==="number"){let r=Number(e);if(!Number.isSafeInteger(r))throw RangeError("Received integer which is too large to be safely represented as a JavaScript number");return r}else if(t==="bigint")return e;else if(t==="string")return""+e;else throw new io("Invalid value for IntMode");else if(e instanceof Uint8Array)return e.slice().buffer;else if(e===void 0)throw new Pe("Received unrecognized type of Value");else throw Je(e,"Impossible type of Value")}var gme,yme=9223372036854775807n;var rT=S(()=>{Et();nn();gme=-9223372036854775808n});function ma(e){return{affectedRowCount:e.affectedRowCount,lastInsertRowid:e.lastInsertRowid,columnNames:e.cols.map((t)=>t.name),columnDecltypes:e.cols.map((t)=>t.decltype)}}function zy(e,t){let r=ma(e),o=e.rows.map((n)=>cF(r.columnNames,n,t));return{...r,rows:o}}function Ny(e,t){let r=ma(e),o;if(e.rows.length>0)o=cF(r.columnNames,e.rows[0],t);return{...r,row:o}}function Dy(e,t){let r=ma(e),o;if(e.rows.length>0&&r.columnNames.length>0)o=tT(e.rows[0][0],t);return{...r,value:o}}function cF(e,t,r){let o={};Object.defineProperty(o,"length",{value:t.length});for(let n=0;n<t.length;++n){let i=tT(t[n],r);Object.defineProperty(o,n,{value:i});let s=e[n];if(s!==void 0&&!Object.hasOwn(o,s))Object.defineProperty(o,s,{value:i,enumerable:!0,configurable:!0,writable:!0})}return o}function Uo(e){return new xp(e.message,e)}var Tp=S(()=>{Et();rT()});class ha{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=void 0}_getSqlId(e){if(this.#e!==e)throw new io("Attempted to use SQL text opened with other object");else if(this.#r!==void 0)throw new _t("SQL text is closed",this.#r);return this.#t}close(){this._setClosed(new Ge("SQL text was manually closed"))}_setClosed(e){if(this.#r===void 0)this.#r=e,this.#e._closeSql(this.#t)}get closed(){return this.#r!==void 0}}function $p(e,t){if(t instanceof ha)return{sqlId:t._getSqlId(e)};else return{sql:""+t}}var xl=S(()=>{Et()});class Yi{#e;#t;constructor(){this.#e=[],this.#t=[]}get length(){return this.#e.length+this.#t.length}push(e){this.#e.push(e)}shift(){if(this.#t.length===0&&this.#e.length>0)this.#t=this.#e.reverse(),this.#e=[];return this.#t.pop()}first(){return this.#t.length!==0?this.#t[this.#t.length-1]:this.#e[0]}}class Op{sql;_args;_namedArgs;constructor(e){this.sql=e,this._args=[],this._namedArgs=new Map}bindIndexes(e){this._args.length=0;for(let t of e)this._args.push(wl(t));return this}bindIndex(e,t){if(e!==(e|0)||e<=0)throw RangeError("Index of a positional argument must be positive integer");while(this._args.length<e)this._args.push(null);return this._args[e-1]=wl(t),this}bindName(e,t){return this._namedArgs.set(e,wl(t)),this}unbindAll(){return this._args.length=0,this._namedArgs.clear(),this}}function Ly(e,t,r){let o,n=[],i=[];if(t instanceof Op){o=t.sql,n=t._args;for(let[l,u]of t._namedArgs.entries())i.push({name:l,value:u})}else if(Array.isArray(t))if(o=t[0],Array.isArray(t[1]))n=t[1].map((l)=>wl(l));else i=Object.entries(t[1]).map(([l,u])=>({name:l,value:wl(u)}));else o=t;let{sql:s,sqlId:a}=$p(e,o);return{sql:s,sqlId:a,args:n,namedArgs:i,wantRows:r}}var Zy=S(()=>{xl();rT()});class jy{_stream;#e;_steps;#t;constructor(e,t){this._stream=e,this.#e=t,this._steps=[],this.#t=!1}step(){return new nT(this)}execute(){if(this.#t)throw new io("This batch has already been executed");this.#t=!0;let e={steps:this._steps.map((t)=>t.proto)};if(this.#e)return Sme(this._stream,this._steps,e);else return bme(this._stream,this._steps,e)}}function bme(e,t,r){return e._batch(r).then((o)=>{for(let n=0;n<t.length;++n){let i=o.stepResults.get(n),s=o.stepErrors.get(n);t[n].callback(i,s)}})}async function Sme(e,t,r){let o=await e._openCursor(r);try{let n=0,i=void 0,s=[];for(;;){let a=await o.next();if(a===void 0)break;if(a.type==="step_begin"){if(a.step<n||a.step>=t.length)throw new Pe("Server produced StepBeginEntry for unexpected step");else if(i!==void 0)throw new Pe("Server produced StepBeginEntry before terminating previous step");for(let l=n;l<a.step;++l)t[l].callback(void 0,void 0);n=a.step+1,i=a,s=[]}else if(a.type==="step_end"){if(i===void 0)throw new Pe("Server produced StepEndEntry but no step is active");let l={cols:i.cols,rows:s,affectedRowCount:a.affectedRowCount,lastInsertRowid:a.lastInsertRowid};t[i.step].callback(l,void 0),i=void 0,s=[]}else if(a.type==="step_error"){if(i===void 0){if(a.step>=t.length)throw new Pe("Server produced StepErrorEntry for unexpected step");for(let l=n;l<a.step;++l)t[l].callback(void 0,void 0)}else{if(a.step!==i.step)throw new Pe("Server produced StepErrorEntry for unexpected step");i=void 0,s=[]}t[a.step].callback(void 0,a.error),n=a.step+1}else if(a.type==="row"){if(i===void 0)throw new Pe("Server produced RowEntry but no step is active");s.push(a.row)}else if(a.type==="error")throw Uo(a.error);else if(a.type==="none")throw new Pe("Server produced unrecognized CursorEntry");else throw Je(a,"Impossible CursorEntry")}if(i!==void 0)throw new Pe("Server closed Cursor before terminating active step");for(let a=n;a<t.length;++a)t[a].callback(void 0,void 0)}finally{o.close()}}class nT{_batch;#e;_index;constructor(e){this._batch=e,this.#e=[],this._index=void 0}condition(e){return this.#e.push(e._proto),this}query(e){return this.#t(e,!0,zy)}queryRow(e){return this.#t(e,!0,Ny)}queryValue(e){return this.#t(e,!0,Dy)}run(e){return this.#t(e,!1,ma)}#t(e,t,r){if(this._index!==void 0)throw new io("This BatchStep has already been added to the batch");let o=Ly(this._batch._stream._sqlOwner(),e,t),n;if(this.#e.length===0)n=void 0;else if(this.#e.length===1)n=this.#e[0];else n={type:"and",conds:this.#e.slice()};let i={stmt:o,condition:n};return new Promise((s,a)=>{let l=(u,d)=>{if(u!==void 0&&d!==void 0)a(new Pe("Server returned both result and error"));else if(d!==void 0)a(Uo(d));else if(u!==void 0)s(r(u,this._batch._stream.intMode));else s(void 0)};this._index=this._batch._steps.length,this._batch._steps.push({proto:i,callback:l})})}}class ut{_batch;_proto;constructor(e,t){this._batch=e,this._proto=t}static ok(e){return new ut(e._batch,{type:"ok",step:lF(e)})}static error(e){return new ut(e._batch,{type:"error",step:lF(e)})}static not(e){return new ut(e._batch,{type:"not",cond:e._proto})}static and(e,t){for(let r of t)uF(e,r);return new ut(e,{type:"and",conds:t.map((r)=>r._proto)})}static or(e,t){for(let r of t)uF(e,r);return new ut(e,{type:"or",conds:t.map((r)=>r._proto)})}static isAutocommit(e){return e._stream.client()._ensureVersion(3,"BatchCond.isAutocommit()"),new ut(e,{type:"is_autocommit"})}}function lF(e){if(e._index===void 0)throw new io("Cannot add a condition referencing a step that has not been added to the batch");return e._index}function uF(e,t){if(t._batch!==e)throw new io("Cannot mix BatchCond objects for different Batch objects")}var oT=S(()=>{Et();Tp();Zy();nn()});function dF(e){return{paramNames:e.params.map((t)=>t.name),columns:e.cols,isExplain:e.isExplain,isReadonly:e.isReadonly}}class _l{constructor(e){this.intMode=e}query(e){return this.#e(e,!0,zy)}queryRow(e){return this.#e(e,!0,Ny)}queryValue(e){return this.#e(e,!0,Dy)}run(e){return this.#e(e,!1,ma)}#e(e,t,r){let o=Ly(this._sqlOwner(),e,t);return this._execute(o).then((n)=>r(n,this.intMode))}batch(e=!1){return new jy(this,e)}describe(e){let t=$p(this._sqlOwner(),e);return this._describe(t).then(dF)}sequence(e){let t=$p(this._sqlOwner(),e);return this._sequence(t)}intMode}var By=S(()=>{oT();Tp();xl();Zy()});class Cp{}var vme=1000,wme=10,iT;var pF=S(()=>{Et();iT=class iT extends Cp{#e;#t;#r;#n;#o;#i;#a;constructor(e,t,r){super();this.#e=e,this.#t=t,this.#r=r,this.#n=new Yi,this.#o=new Yi,this.#i=void 0,this.#a=!1}async next(){for(;;){if(this.#i!==void 0)throw new _t("Cursor is closed",this.#i);while(!this.#a&&this.#o.length<wme)this.#o.push(this.#s());let e=this.#n.shift();if(this.#a||e!==void 0)return e;await this.#o.shift().then((t)=>{if(t===void 0)return;for(let r of t.entries)this.#n.push(r);this.#a||=t.done})}}#s(){return this.#t._sendCursorRequest(this,{type:"fetch_cursor",cursorId:this.#r,maxCount:vme}).then((e)=>e,(e)=>{this._setClosed(e);return})}_setClosed(e){if(this.#i!==void 0)return;this.#i=e,this.#t._sendCursorRequest(this,{type:"close_cursor",cursorId:this.#r}).catch(()=>{return}),this.#t._cursorClosed(this)}close(){this._setClosed(new Ge("Cursor was manually closed"))}get closed(){return this.#i!==void 0}}});var Pp;var sT=S(()=>{Et();By();pF();Pp=class Pp extends _l{#e;#t;#r;#n;#o;#i;static open(e){let t=e._streamIdAlloc.alloc(),r=new Pp(e,t),o=()=>{return},n=(s)=>r.#l(s),i={type:"open_stream",streamId:t};return e._sendRequest(i,{responseCallback:o,errorCallback:n}),r}constructor(e,t){super(e.intMode);this.#e=e,this.#t=t,this.#r=new Yi,this.#n=void 0,this.#o=!1,this.#i=void 0}client(){return this.#e}_sqlOwner(){return this.#e}_execute(e){return this.#a({type:"execute",streamId:this.#t,stmt:e}).then((t)=>t.result)}_batch(e){return this.#a({type:"batch",streamId:this.#t,batch:e}).then((t)=>t.result)}_describe(e){return this.#e._ensureVersion(2,"describe()"),this.#a({type:"describe",streamId:this.#t,sql:e.sql,sqlId:e.sqlId}).then((t)=>t.result)}_sequence(e){return this.#e._ensureVersion(2,"sequence()"),this.#a({type:"sequence",streamId:this.#t,sql:e.sql,sqlId:e.sqlId}).then((t)=>{return})}getAutocommit(){return this.#e._ensureVersion(3,"getAutocommit()"),this.#a({type:"get_autocommit",streamId:this.#t}).then((e)=>e.isAutocommit)}#a(e){return new Promise((t,r)=>{this.#s({type:"request",request:e,responseCallback:t,errorCallback:r})})}_openCursor(e){return this.#e._ensureVersion(3,"cursor"),new Promise((t,r)=>{this.#s({type:"cursor",batch:e,cursorCallback:t,errorCallback:r})})}_sendCursorRequest(e,t){if(e!==this.#n)throw new or("Cursor not associated with the stream attempted to execute a request");return new Promise((r,o)=>{if(this.#i!==void 0)o(new _t("Stream is closed",this.#i));else this.#e._sendRequest(t,{responseCallback:r,errorCallback:o})})}_cursorClosed(e){if(e!==this.#n)throw new or("Cursor was closed, but it was not associated with the stream");this.#n=void 0,this.#c()}#s(e){if(this.#i!==void 0)e.errorCallback(new _t("Stream is closed",this.#i));else if(this.#o)e.errorCallback(new _t("Stream is closing",void 0));else this.#r.push(e),this.#c()}#c(){for(;;){let e=this.#r.first();if(e===void 0&&this.#n===void 0&&this.#o){this.#l(new Ge("Stream was gracefully closed"));break}else if(e?.type==="request"&&this.#n===void 0){let{request:t,responseCallback:r,errorCallback:o}=e;this.#r.shift(),this.#e._sendRequest(t,{responseCallback:r,errorCallback:o})}else if(e?.type==="cursor"&&this.#n===void 0){let{batch:t,cursorCallback:r}=e;this.#r.shift();let o=this.#e._cursorIdAlloc.alloc(),n=new iT(this.#e,this,o),i={type:"open_cursor",streamId:this.#t,cursorId:o,batch:t},s=()=>{return},a=(l)=>n._setClosed(l);this.#e._sendRequest(i,{responseCallback:s,errorCallback:a}),this.#n=n,r(n)}else break}}#l(e){if(this.#i!==void 0)return;if(this.#i=e,this.#n!==void 0)this.#n._setClosed(e);for(;;){let n=this.#r.shift();if(n!==void 0)n.errorCallback(e);else break}let t={type:"close_stream",streamId:this.#t},r=()=>this.#e._streamIdAlloc.free(this.#t),o=()=>{return};this.#e._sendRequest(t,{responseCallback:r,errorCallback:o})}close(){this.#l(new Ge("Stream was manually closed"))}closeGracefully(){this.#o=!0,this.#c()}get closed(){return this.#i!==void 0||this.#o}}});function zp(e,t){if(t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId);e.arrayObjects("args",t.args,fF),e.arrayObjects("named_args",t.namedArgs,xme),e.boolean("want_rows",t.wantRows)}function xme(e,t){e.string("name",t.name),e.object("value",t.value,fF)}function El(e,t){e.arrayObjects("steps",t.steps,_me)}function _me(e,t){if(t.condition!==void 0)e.object("condition",t.condition,aT);e.object("stmt",t.stmt,zp)}function aT(e,t){if(e.stringRaw("type",t.type),t.type==="ok"||t.type==="error")e.number("step",t.step);else if(t.type==="not")e.object("cond",t.cond,aT);else if(t.type==="and"||t.type==="or")e.arrayObjects("conds",t.conds,aT);else if(t.type==="is_autocommit");else throw Je(t,"Impossible type of BatchCond")}function fF(e,t){if(t===null)e.stringRaw("type","null");else if(typeof t==="bigint")e.stringRaw("type","integer"),e.stringRaw("value",""+t);else if(typeof t==="number")e.stringRaw("type","float"),e.number("value",t);else if(typeof t==="string")e.stringRaw("type","text"),e.string("value",t);else if(t instanceof Uint8Array)e.stringRaw("type","blob"),e.stringRaw("base64",pl.fromUint8Array(t));else if(t===void 0);else throw Je(t,"Impossible type of Value")}var cT=S(()=>{$y();nn()});function mF(e,t){if(e.stringRaw("type",t.type),t.type==="hello"){if(t.jwt!==void 0)e.string("jwt",t.jwt)}else if(t.type==="request")e.number("request_id",t.requestId),e.object("request",t.request,Eme);else throw Je(t,"Impossible type of ClientMsg")}function Eme(e,t){if(e.stringRaw("type",t.type),t.type==="open_stream")e.number("stream_id",t.streamId);else if(t.type==="close_stream")e.number("stream_id",t.streamId);else if(t.type==="execute")e.number("stream_id",t.streamId),e.object("stmt",t.stmt,zp);else if(t.type==="batch")e.number("stream_id",t.streamId),e.object("batch",t.batch,El);else if(t.type==="open_cursor")e.number("stream_id",t.streamId),e.number("cursor_id",t.cursorId),e.object("batch",t.batch,El);else if(t.type==="close_cursor")e.number("cursor_id",t.cursorId);else if(t.type==="fetch_cursor")e.number("cursor_id",t.cursorId),e.number("max_count",t.maxCount);else if(t.type==="sequence"){if(e.number("stream_id",t.streamId),t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId)}else if(t.type==="describe"){if(e.number("stream_id",t.streamId),t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId)}else if(t.type==="store_sql")e.number("sql_id",t.sqlId),e.string("sql",t.sql);else if(t.type==="close_sql")e.number("sql_id",t.sqlId);else if(t.type==="get_autocommit")e.number("stream_id",t.streamId);else throw Je(t,"Impossible type of Request")}var hF=S(()=>{cT();nn()});function Np(e,t){if(t.sql!==void 0)e.string(1,t.sql);if(t.sqlId!==void 0)e.int32(2,t.sqlId);for(let r of t.args)e.message(3,r,yF);for(let r of t.namedArgs)e.message(4,r,Ime);e.bool(5,t.wantRows)}function Ime(e,t){e.string(1,t.name),e.message(2,t.value,yF)}function Il(e,t){for(let r of t.steps)e.message(1,r,Ame)}function Ame(e,t){if(t.condition!==void 0)e.message(1,t.condition,lT);e.message(2,t.stmt,Np)}function lT(e,t){if(t.type==="ok")e.uint32(1,t.step);else if(t.type==="error")e.uint32(2,t.step);else if(t.type==="not")e.message(3,t.cond,lT);else if(t.type==="and")e.message(4,t.conds,gF);else if(t.type==="or")e.message(5,t.conds,gF);else if(t.type==="is_autocommit")e.message(6,void 0,bF);else throw Je(t,"Impossible type of BatchCond")}function gF(e,t){for(let r of t)e.message(1,r,lT)}function yF(e,t){if(t===null)e.message(1,void 0,bF);else if(typeof t==="bigint")e.sint64(2,t);else if(typeof t==="number")e.double(3,t);else if(typeof t==="string")e.string(4,t);else if(t instanceof Uint8Array)e.bytes(5,t);else if(t===void 0);else throw Je(t,"Impossible type of Value")}function bF(e,t){}var uT=S(()=>{nn()});function SF(e,t){if(t.type==="hello")e.message(1,t,kme);else if(t.type==="request")e.message(2,t,Rme);else throw Je(t,"Impossible type of ClientMsg")}function kme(e,t){if(t.jwt!==void 0)e.string(1,t.jwt)}function Rme(e,t){e.int32(1,t.requestId);let r=t.request;if(r.type==="open_stream")e.message(2,r,Tme);else if(r.type==="close_stream")e.message(3,r,$me);else if(r.type==="execute")e.message(4,r,Ome);else if(r.type==="batch")e.message(5,r,Cme);else if(r.type==="open_cursor")e.message(6,r,Pme);else if(r.type==="close_cursor")e.message(7,r,zme);else if(r.type==="fetch_cursor")e.message(8,r,Nme);else if(r.type==="sequence")e.message(9,r,Dme);else if(r.type==="describe")e.message(10,r,Lme);else if(r.type==="store_sql")e.message(11,r,Zme);else if(r.type==="close_sql")e.message(12,r,jme);else if(r.type==="get_autocommit")e.message(13,r,Bme);else throw Je(r,"Impossible type of Request")}function Tme(e,t){e.int32(1,t.streamId)}function $me(e,t){e.int32(1,t.streamId)}function Ome(e,t){e.int32(1,t.streamId),e.message(2,t.stmt,Np)}function Cme(e,t){e.int32(1,t.streamId),e.message(2,t.batch,Il)}function Pme(e,t){e.int32(1,t.streamId),e.int32(2,t.cursorId),e.message(3,t.batch,Il)}function zme(e,t){e.int32(1,t.cursorId)}function Nme(e,t){e.int32(1,t.cursorId),e.uint32(2,t.maxCount)}function Dme(e,t){if(e.int32(1,t.streamId),t.sql!==void 0)e.string(2,t.sql);if(t.sqlId!==void 0)e.int32(3,t.sqlId)}function Lme(e,t){if(e.int32(1,t.streamId),t.sql!==void 0)e.string(2,t.sql);if(t.sqlId!==void 0)e.int32(3,t.sqlId)}function Zme(e,t){e.int32(1,t.sqlId),e.string(2,t.sql)}function jme(e,t){e.int32(1,t.sqlId)}function Bme(e,t){e.int32(1,t.streamId)}var vF=S(()=>{uT();nn()});function Xi(e){let t=Tr(e.message),r=Ur(e.code);return{message:t,code:r}}function Dp(e){let t=_n(e.cols,wF),r=Ep(e.rows).map((s)=>_n(s,xF)),o=Bo(e.affected_row_count),n=Ur(e.last_insert_rowid),i=n!==void 0?BigInt(n):void 0;return{cols:t,rows:r,affectedRowCount:o,lastInsertRowid:i}}function wF(e){let t=Ur(e.name),r=Ur(e.decltype);return{name:t,decltype:r}}function Uy(e){let t=new Map;Ep(e.step_results).forEach((o,n)=>{if(o!==null)t.set(n,Dp(kt(o)))});let r=new Map;return Ep(e.step_errors).forEach((o,n)=>{if(o!==null)r.set(n,Xi(kt(o)))}),{stepResults:t,stepErrors:r}}function My(e){let t=Tr(e.type);if(t==="step_begin"){let r=Bo(e.step),o=_n(e.cols,wF);return{type:"step_begin",step:r,cols:o}}else if(t==="step_end"){let r=Bo(e.affected_row_count),o=Ur(e.last_insert_rowid),n=o!==void 0?BigInt(o):void 0;return{type:"step_end",affectedRowCount:r,lastInsertRowid:n}}else if(t==="step_error"){let r=Bo(e.step),o=Xi(kt(e.error));return{type:"step_error",step:r,error:o}}else if(t==="row")return{type:"row",row:_n(e.row,xF)};else if(t==="error")return{type:"error",error:Xi(kt(e.error))};else throw new Pe("Unexpected type of CursorEntry")}function qy(e){let t=_n(e.params,Ume),r=_n(e.cols,Mme),o=Wi(e.is_explain),n=Wi(e.is_readonly);return{params:t,cols:r,isExplain:o,isReadonly:n}}function Ume(e){return{name:Ur(e.name)}}function Mme(e){let t=Tr(e.name),r=Ur(e.decltype);return{name:t,decltype:r}}function xF(e){let t=Tr(e.type);if(t==="null")return null;else if(t==="integer"){let r=Tr(e.value);return BigInt(r)}else if(t==="float")return Bo(e.value);else if(t==="text")return Tr(e.value);else if(t==="blob")return pl.toUint8Array(Tr(e.base64));else throw new Pe("Unexpected type of Value")}var Fy=S(()=>{$y();Et();vl()});function _F(e){let t=Tr(e.type);if(t==="hello_ok")return{type:"hello_ok"};else if(t==="hello_error")return{type:"hello_error",error:Xi(kt(e.error))};else if(t==="response_ok"){let r=Bo(e.request_id),o=qme(kt(e.response));return{type:"response_ok",requestId:r,response:o}}else if(t==="response_error"){let r=Bo(e.request_id),o=Xi(kt(e.error));return{type:"response_error",requestId:r,error:o}}else throw new Pe("Unexpected type of ServerMsg")}function qme(e){let t=Tr(e.type);if(t==="open_stream")return{type:"open_stream"};else if(t==="close_stream")return{type:"close_stream"};else if(t==="execute")return{type:"execute",result:Dp(kt(e.result))};else if(t==="batch")return{type:"batch",result:Uy(kt(e.result))};else if(t==="open_cursor")return{type:"open_cursor"};else if(t==="close_cursor")return{type:"close_cursor"};else if(t==="fetch_cursor"){let r=_n(e.entries,My),o=Wi(e.done);return{type:"fetch_cursor",entries:r,done:o}}else if(t==="sequence")return{type:"sequence"};else if(t==="describe")return{type:"describe",result:qy(kt(e.result))};else if(t==="store_sql")return{type:"store_sql"};else if(t==="close_sql")return{type:"close_sql"};else if(t==="get_autocommit")return{type:"get_autocommit",isAutocommit:Wi(e.is_autocommit)};else throw new Pe("Unexpected type of Response")}var EF=S(()=>{Et();vl();Fy()});var on,es,IF,AF,Al,Fme,Hme,Hy,Jme,Kme,Vme,kl,Wme,Gme,Qme;var Jy=S(()=>{on={default(){return{message:"",code:void 0}},1(e,t){t.message=e.string()},2(e,t){t.code=e.string()}},es={default(){return{cols:[],rows:[],affectedRowCount:0,lastInsertRowid:void 0}},1(e,t){t.cols.push(e.message(IF))},2(e,t){t.rows.push(e.message(AF))},3(e,t){t.affectedRowCount=Number(e.uint64())},4(e,t){t.lastInsertRowid=e.sint64()}},IF={default(){return{name:void 0,decltype:void 0}},1(e,t){t.name=e.string()},2(e,t){t.decltype=e.string()}},AF={default(){return[]},1(e,t){t.push(e.message(Qme))}},Al={default(){return{stepResults:new Map,stepErrors:new Map}},1(e,t){let[r,o]=e.message(Fme);t.stepResults.set(r,o)},2(e,t){let[r,o]=e.message(Hme);t.stepErrors.set(r,o)}},Fme={default(){return[0,es.default()]},1(e,t){t[0]=e.uint32()},2(e,t){t[1]=e.message(es)}},Hme={default(){return[0,on.default()]},1(e,t){t[0]=e.uint32()},2(e,t){t[1]=e.message(on)}},Hy={default(){return{type:"none"}},1(e){return e.message(Jme)},2(e){return e.message(Kme)},3(e){return e.message(Vme)},4(e){return{type:"row",row:e.message(AF)}},5(e){return{type:"error",error:e.message(on)}}},Jme={default(){return{type:"step_begin",step:0,cols:[]}},1(e,t){t.step=e.uint32()},2(e,t){t.cols.push(e.message(IF))}},Kme={default(){return{type:"step_end",affectedRowCount:0,lastInsertRowid:void 0}},1(e,t){t.affectedRowCount=e.uint32()},2(e,t){t.lastInsertRowid=e.uint64()}},Vme={default(){return{type:"step_error",step:0,error:on.default()}},1(e,t){t.step=e.uint32()},2(e,t){t.error=e.message(on)}},kl={default(){return{params:[],cols:[],isExplain:!1,isReadonly:!1}},1(e,t){t.params.push(e.message(Wme))},2(e,t){t.cols.push(e.message(Gme))},3(e,t){t.isExplain=e.bool()},4(e,t){t.isReadonly=e.bool()}},Wme={default(){return{name:void 0}},1(e,t){t.name=e.string()}},Gme={default(){return{name:"",decltype:void 0}},1(e,t){t.name=e.string()},2(e,t){t.decltype=e.string()}},Qme={default(){return},1(e){return null},2(e){return e.sint64()},3(e){return e.double()},4(e){return e.string()},5(e){return e.bytes()}}});var kF,Yme,Xme,ehe,the,rhe,nhe,ohe,ihe;var RF=S(()=>{Jy();kF={default(){return{type:"none"}},1(e){return{type:"hello_ok"}},2(e){return e.message(Yme)},3(e){return e.message(ehe)},4(e){return e.message(Xme)}},Yme={default(){return{type:"hello_error",error:on.default()}},1(e,t){t.error=e.message(on)}},Xme={default(){return{type:"response_error",requestId:0,error:on.default()}},1(e,t){t.requestId=e.int32()},2(e,t){t.error=e.message(on)}},ehe={default(){return{type:"response_ok",requestId:0,response:{type:"none"}}},1(e,t){t.requestId=e.int32()},2(e,t){t.response={type:"open_stream"}},3(e,t){t.response={type:"close_stream"}},4(e,t){t.response=e.message(the)},5(e,t){t.response=e.message(rhe)},6(e,t){t.response={type:"open_cursor"}},7(e,t){t.response={type:"close_cursor"}},8(e,t){t.response=e.message(nhe)},9(e,t){t.response={type:"sequence"}},10(e,t){t.response=e.message(ohe)},11(e,t){t.response={type:"store_sql"}},12(e,t){t.response={type:"close_sql"}},13(e,t){t.response=e.message(ihe)}},the={default(){return{type:"execute",result:es.default()}},1(e,t){t.result=e.message(es)}},rhe={default(){return{type:"batch",result:Al.default()}},1(e,t){t.result=e.message(Al)}},nhe={default(){return{type:"fetch_cursor",entries:[],done:!1}},1(e,t){t.entries.push(e.message(Hy))},2(e,t){t.done=e.bool()}},ohe={default(){return{type:"describe",result:kl.default()}},1(e,t){t.result=e.message(kl)}},ihe={default(){return{type:"get_autocommit",isAutocommit:!1}},1(e,t){t.isAutocommit=e.bool()}}});var TF,dT,Ky;var Vy=S(()=>{XR();Et();eT();Tp();xl();nn();sT();hF();vF();EF();RF();TF=new Map([["hrana2",{version:2,encoding:"json"}],["hrana1",{version:1,encoding:"json"}]]),dT=new Map([["hrana3-protobuf",{version:3,encoding:"protobuf"}],["hrana3",{version:3,encoding:"json"}],["hrana2",{version:2,encoding:"json"}],["hrana1",{version:1,encoding:"json"}]]);Ky=class Ky extends yl{#e;#t;#r;#n;#o;#i;#a;#s;#c;_streamIdAlloc;_cursorIdAlloc;#l;constructor(e,t){super();this.#e=e,this.#t=[],this.#r=!1,this.#n=void 0,this.#o=!1,this.#i=void 0,this.#a=!1,this.#s=new Map,this.#c=new Qi,this._streamIdAlloc=new Qi,this._cursorIdAlloc=new Qi,this.#l=new Qi,this.#e.binaryType="arraybuffer",this.#e.addEventListener("open",()=>this.#p()),this.#e.addEventListener("close",(r)=>this.#g(r)),this.#e.addEventListener("error",(r)=>this.#f(r)),this.#e.addEventListener("message",(r)=>this.#y(r)),this.#d({type:"hello",jwt:t})}#d(e){if(this.#n!==void 0)throw new or("Trying to send a message on a closed client");if(this.#r)this.#m(e);else{let t=()=>this.#m(e),r=()=>{return};this.#t.push({openCallback:t,errorCallback:r})}}#p(){let e=this.#e.protocol;if(e===void 0){this.#u(new Ge("The `WebSocket.protocol` property is undefined. This most likely means that the WebSocket implementation provided by the environment is broken. If you are using Miniflare 2, please update to Miniflare 3, which fixes this problem."));return}else if(e==="")this.#i={version:1,encoding:"json"};else if(this.#i=dT.get(e),this.#i===void 0){this.#u(new Pe(`Unrecognized WebSocket subprotocol: ${JSON.stringify(e)}`));return}for(let t of this.#t)t.openCallback();this.#t.length=0,this.#r=!0}#m(e){let t=this.#i.encoding;if(t==="json"){let r=Ip(e,mF);this.#e.send(r)}else if(t==="protobuf"){let r=Rp(e,SF);this.#e.send(r)}else throw Je(t,"Impossible encoding")}getVersion(){return new Promise((e,t)=>{if(this.#a=!0,this.#n!==void 0)t(this.#n);else if(!this.#r){let r=()=>e(this.#i.version);this.#t.push({openCallback:r,errorCallback:t})}else e(this.#i.version)})}_ensureVersion(e,t){if(this.#i===void 0||!this.#a)throw new xn(`${t} is supported only on protocol version ${e} and higher, but the version supported by the WebSocket server is not yet known. Use Client.getVersion() to wait until the version is available.`);else if(this.#i.version<e)throw new xn(`${t} is supported on protocol version ${e} and higher, but the WebSocket server only supports version ${this.#i.version}`)}_sendRequest(e,t){if(this.#n!==void 0){t.errorCallback(new _t("Client is closed",this.#n));return}let r=this.#c.alloc();this.#s.set(r,{...t,type:e.type}),this.#d({type:"request",requestId:r,request:e})}#f(e){let r=e.message??"WebSocket was closed due to an error";this.#u(new bl(r))}#g(e){let t=`WebSocket was closed with code ${e.code}`;if(e.reason)t+=`: ${e.reason}`;this.#u(new bl(t))}#u(e){if(this.#n!==void 0)return;this.#n=e;for(let t of this.#t)t.errorCallback(e);this.#t.length=0;for(let[t,r]of this.#s.entries())r.errorCallback(e),this.#c.free(t);this.#s.clear(),this.#e.close()}#y(e){if(this.#n!==void 0)return;try{let t,r=this.#i.encoding;if(r==="json"){if(typeof e.data!=="string"){this.#e.close(3003,"Only text messages are accepted with JSON encoding"),this.#u(new Pe("Received non-text message from server with JSON encoding"));return}t=pa(JSON.parse(e.data),_F)}else if(r==="protobuf"){if(!(e.data instanceof ArrayBuffer)){this.#e.close(3003,"Only binary messages are accepted with Protobuf encoding"),this.#u(new Pe("Received non-binary message from server with Protobuf encoding"));return}t=Gi(new Uint8Array(e.data),kF)}else throw Je(r,"Impossible encoding");this.#b(t)}catch(t){this.#e.close(3007,"Could not handle message"),this.#u(t)}}#b(e){if(e.type==="none")throw new Pe("Received an unrecognized ServerMsg");else if(e.type==="hello_ok"||e.type==="hello_error"){if(this.#o)throw new Pe("Received a duplicated hello response");if(this.#o=!0,e.type==="hello_error")throw Uo(e.error);return}else if(!this.#o)throw new Pe("Received a non-hello message before a hello response");if(e.type==="response_ok"){let t=e.requestId,r=this.#s.get(t);if(this.#s.delete(t),r===void 0)throw new Pe("Received unexpected OK response");this.#c.free(t);try{if(r.type!==e.response.type)throw console.dir({responseState:r,msg:e}),new Pe("Received unexpected type of response");r.responseCallback(e.response)}catch(o){throw r.errorCallback(o),o}}else if(e.type==="response_error"){let t=e.requestId,r=this.#s.get(t);if(this.#s.delete(t),r===void 0)throw new Pe("Received unexpected error response");this.#c.free(t),r.errorCallback(Uo(e.error))}else throw Je(e,"Impossible ServerMsg type")}openStream(){return Pp.open(this)}storeSql(e){this._ensureVersion(2,"storeSql()");let t=this.#l.alloc(),r=new ha(this,t),o=()=>{return},n=(s)=>r._setClosed(s),i={type:"store_sql",sqlId:t,sql:e};return this._sendRequest(i,{responseCallback:o,errorCallback:n}),r}_closeSql(e){if(this.#n!==void 0)return;let t=()=>this.#l.free(e),r=(n)=>this.#u(n),o={type:"close_sql",sqlId:e};this._sendRequest(o,{responseCallback:t,errorCallback:r})}close(){this.#u(new Ge("Client was manually closed"))}get closed(){return this.#n!==void 0}}});var ga;var $F=S(()=>{if(typeof queueMicrotask<"u")ga=queueMicrotask;else{let e=Promise.resolve();ga=(t)=>{e.then(t)}}});class pT{#e;#t;#r;constructor(e){this.#e=new Uint8Array(new ArrayBuffer(e)),this.#t=0,this.#r=0}get length(){return this.#r-this.#t}data(){return this.#e.slice(this.#t,this.#r)}push(e){this.#n(e.byteLength),this.#e.set(e,this.#r),this.#r+=e.byteLength}#n(e){if(this.#r+e<=this.#e.byteLength)return;let t=this.#r-this.#t;if(t+e<=this.#e.byteLength&&2*this.#r>=this.#e.byteLength)this.#e.copyWithin(0,this.#t,this.#r);else{let r=this.#e.byteLength;do r*=2;while(t+e>r);let o=new Uint8Array(new ArrayBuffer(r));o.set(this.#e.slice(this.#t,this.#r),0),this.#e=o}this.#r=t,this.#t=0}shift(e){this.#t+=e}}function OF(e){let t=Ur(e.baton),r=Ur(e.base_url),o=_n(e.results,she);return{baton:t,baseUrl:r,results:o}}function she(e){let t=Tr(e.type);if(t==="ok")return{type:"ok",response:ahe(kt(e.response))};else if(t==="error")return{type:"error",error:Xi(kt(e.error))};else throw new Pe("Unexpected type of StreamResult")}function ahe(e){let t=Tr(e.type);if(t==="close")return{type:"close"};else if(t==="execute")return{type:"execute",result:Dp(kt(e.result))};else if(t==="batch")return{type:"batch",result:Uy(kt(e.result))};else if(t==="sequence")return{type:"sequence"};else if(t==="describe")return{type:"describe",result:qy(kt(e.result))};else if(t==="store_sql")return{type:"store_sql"};else if(t==="close_sql")return{type:"close_sql"};else if(t==="get_autocommit")return{type:"get_autocommit",isAutocommit:Wi(e.is_autocommit)};else throw new Pe("Unexpected type of StreamResponse")}function CF(e){let t=Ur(e.baton),r=Ur(e.base_url);return{baton:t,baseUrl:r}}var fT=S(()=>{Et();vl();Fy()});var PF,che,lhe,uhe,dhe,phe,fhe,zF;var mT=S(()=>{Jy();PF={default(){return{baton:void 0,baseUrl:void 0,results:[]}},1(e,t){t.baton=e.string()},2(e,t){t.baseUrl=e.string()},3(e,t){t.results.push(e.message(che))}},che={default(){return{type:"none"}},1(e){return{type:"ok",response:e.message(lhe)}},2(e){return{type:"error",error:e.message(on)}}},lhe={default(){return{type:"none"}},1(e){return{type:"close"}},2(e){return e.message(uhe)},3(e){return e.message(dhe)},4(e){return{type:"sequence"}},5(e){return e.message(phe)},6(e){return{type:"store_sql"}},7(e){return{type:"close_sql"}},8(e){return e.message(fhe)}},uhe={default(){return{type:"execute",result:es.default()}},1(e,t){t.result=e.message(es)}},dhe={default(){return{type:"batch",result:Al.default()}},1(e,t){t.result=e.message(Al)}},phe={default(){return{type:"describe",result:kl.default()}},1(e,t){t.result=e.message(kl)}},fhe={default(){return{type:"get_autocommit",isAutocommit:!1}},1(e,t){t.isAutocommit=e.bool()}},zF={default(){return{baton:void 0,baseUrl:void 0}},1(e,t){t.baton=e.string()},2(e,t){t.baseUrl=e.string()}}});var hT;var NF=S(()=>{vl();QR();Et();nn();fT();mT();Fy();Jy();hT=class hT extends Cp{#e;#t;#r;#n;#o;#i;constructor(e,t){super();this.#e=e,this.#t=t,this.#r=void 0,this.#n=new pT(16384),this.#o=void 0,this.#i=!1}async open(e){if(e.body===null)throw new Pe("No response body for cursor request");this.#r=e.body[Symbol.asyncIterator]();let t=await this.#a(CF,zF);if(t===void 0)throw new Pe("Empty response to cursor request");return t}next(){return this.#a(My,Hy)}close(){this._setClosed(new Ge("Cursor was manually closed"))}_setClosed(e){if(this.#o!==void 0)return;if(this.#o=e,this.#e._cursorClosed(this),this.#r!==void 0)this.#r.return()}get closed(){return this.#o!==void 0}async#a(e,t){for(;;){if(this.#i)return;else if(this.#o!==void 0)throw new _t("Cursor is closed",this.#o);if(this.#t==="json"){let n=this.#s();if(n!==void 0){let i=new TextDecoder().decode(n),s=JSON.parse(i);return pa(s,e)}}else if(this.#t==="protobuf"){let n=this.#c();if(n!==void 0)return Gi(n,t)}else throw Je(this.#t,"Impossible encoding");if(this.#r===void 0)throw new or("Attempted to read from HTTP cursor before it was opened");let{value:r,done:o}=await this.#r.next();if(o&&this.#n.length===0)this.#i=!0;else if(o)throw new Pe("Unexpected end of cursor stream");else this.#n.push(r)}}#s(){let e=this.#n.data(),t=10,r=e.indexOf(10);if(r<0)return;let o=e.slice(0,r);return this.#n.shift(r+1),o}#c(){let e=this.#n.data(),t=0,r=0;for(;;){if(r>=e.byteLength)return;let n=e[r];if(t|=(n&127)<<7*r,r+=1,!(n&128))break}if(e.byteLength<r+t)return;let o=e.slice(r,r+t);return this.#n.shift(r+t),o}}});function DF(e,t){if(t.baton!==void 0)e.string("baton",t.baton);e.arrayObjects("requests",t.requests,mhe)}function mhe(e,t){if(e.stringRaw("type",t.type),t.type==="close");else if(t.type==="execute")e.object("stmt",t.stmt,zp);else if(t.type==="batch")e.object("batch",t.batch,El);else if(t.type==="sequence"){if(t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId)}else if(t.type==="describe"){if(t.sql!==void 0)e.string("sql",t.sql);if(t.sqlId!==void 0)e.number("sql_id",t.sqlId)}else if(t.type==="store_sql")e.number("sql_id",t.sqlId),e.string("sql",t.sql);else if(t.type==="close_sql")e.number("sql_id",t.sqlId);else if(t.type==="get_autocommit");else throw Je(t,"Impossible type of StreamRequest")}function LF(e,t){if(t.baton!==void 0)e.string("baton",t.baton);e.object("batch",t.batch,El)}var gT=S(()=>{cT();nn()});function ZF(e,t){if(t.baton!==void 0)e.string(1,t.baton);for(let r of t.requests)e.message(2,r,hhe)}function hhe(e,t){if(t.type==="close")e.message(1,t,ghe);else if(t.type==="execute")e.message(2,t,yhe);else if(t.type==="batch")e.message(3,t,bhe);else if(t.type==="sequence")e.message(4,t,She);else if(t.type==="describe")e.message(5,t,vhe);else if(t.type==="store_sql")e.message(6,t,whe);else if(t.type==="close_sql")e.message(7,t,xhe);else if(t.type==="get_autocommit")e.message(8,t,_he);else throw Je(t,"Impossible type of StreamRequest")}function ghe(e,t){}function yhe(e,t){e.message(1,t.stmt,Np)}function bhe(e,t){e.message(1,t.batch,Il)}function She(e,t){if(t.sql!==void 0)e.string(1,t.sql);if(t.sqlId!==void 0)e.int32(2,t.sqlId)}function vhe(e,t){if(t.sql!==void 0)e.string(1,t.sql);if(t.sqlId!==void 0)e.int32(2,t.sqlId)}function whe(e,t){e.int32(1,t.sqlId),e.string(2,t.sql)}function xhe(e,t){e.int32(1,t.sqlId)}function _he(e,t){}function jF(e,t){if(t.baton!==void 0)e.string(1,t.baton);e.message(2,t.batch,Il)}var yT=S(()=>{uT();nn()});function Ehe(e,t){if(t.results.length!==e.length)throw new Pe("Server returned unexpected number of pipeline results");for(let r=0;r<e.length;++r){let o=t.results[r],n=e[r];if(o.type==="ok"){if(o.response.type!==n.request.type)throw new Pe("Received unexpected type of response");n.responseCallback(o.response)}else if(o.type==="error")n.errorCallback(Uo(o.error));else if(o.type==="none")throw new Pe("Received unrecognized type of StreamResult");else throw Je(o,"Received impossible type of StreamResult")}}async function Ihe(e,t){if(t==="json"){let r=await e.json();return pa(r,OF)}if(t==="protobuf"){let r=await e.arrayBuffer();return Gi(new Uint8Array(r),PF)}throw await e.body?.cancel(),Je(t,"Impossible encoding")}async function Ahe(e){let t=e.headers.get("content-type")??"text/plain",r=`Server returned HTTP status ${e.status}`;if(t==="application/json"){let o=await e.json();if("message"in o)return Uo(o);return new da(r,e.status)}if(t==="text/plain"){let o=(await e.text()).trim();if(o!=="")r+=`: ${o}`;return new da(r,e.status)}return await e.body?.cancel(),new da(r,e.status)}var Wy;var bT=S(()=>{Et();XR();eT();$F();Tp();xl();By();nn();NF();gT();yT();gT();yT();fT();mT();Wy=class Wy extends _l{#e;#t;#r;#n;#o;#i;#a;#s;#c;#l;#d;#p;#m;constructor(e,t,r,o,n){super(e.intMode);this.#e=e,this.#t=t.toString(),this.#r=r,this.#n=o,this.#o=n,this.#i=void 0,this.#a=new Yi,this.#s=!1,this.#l=!1,this.#d=!1,this.#p=void 0,this.#m=new Qi}client(){return this.#e}_sqlOwner(){return this}storeSql(e){let t=this.#m.alloc();return this.#f({type:"store_sql",sqlId:t,sql:e}).then(()=>{return},(r)=>this._setClosed(r)),new ha(this,t)}_closeSql(e){if(this.#p!==void 0)return;this.#f({type:"close_sql",sqlId:e}).then(()=>this.#m.free(e),(t)=>this._setClosed(t))}_execute(e){return this.#f({type:"execute",stmt:e}).then((t)=>t.result)}_batch(e){return this.#f({type:"batch",batch:e}).then((t)=>t.result)}_describe(e){return this.#f({type:"describe",sql:e.sql,sqlId:e.sqlId}).then((t)=>t.result)}_sequence(e){return this.#f({type:"sequence",sql:e.sql,sqlId:e.sqlId}).then((t)=>{return})}getAutocommit(){return this.#e._ensureVersion(3,"getAutocommit()"),this.#f({type:"get_autocommit"}).then((e)=>e.isAutocommit)}#f(e){return new Promise((t,r)=>{this.#g({type:"pipeline",request:e,responseCallback:t,errorCallback:r})})}_openCursor(e){return new Promise((t,r)=>{this.#g({type:"cursor",batch:e,cursorCallback:t,errorCallback:r})})}_cursorClosed(e){if(e!==this.#c)throw new or("Cursor was closed, but it was not associated with the stream");this.#c=void 0,ga(()=>this.#u())}close(){this._setClosed(new Ge("Stream was manually closed"))}closeGracefully(){this.#l=!0,ga(()=>this.#u())}get closed(){return this.#p!==void 0||this.#l}_setClosed(e){if(this.#p!==void 0)return;if(this.#p=e,this.#c!==void 0)this.#c._setClosed(e);this.#e._streamClosed(this);for(;;){let t=this.#a.shift();if(t!==void 0)t.errorCallback(e);else break}if((this.#i!==void 0||this.#s)&&!this.#d)this.#a.push({type:"pipeline",request:{type:"close"},responseCallback:()=>{return},errorCallback:()=>{return}}),this.#d=!0,ga(()=>this.#u())}#g(e){if(this.#p!==void 0)throw new _t("Stream is closed",this.#p);else if(this.#l)throw new _t("Stream is closing",void 0);else this.#a.push(e),ga(()=>this.#u())}#u(){if(this.#s||this.#c!==void 0)return;if(this.#l&&this.#a.length===0){this._setClosed(new Ge("Stream was gracefully closed"));return}let e=this.#e._endpoint;if(e===void 0){this.#e._endpointPromise.then(()=>this.#u(),(r)=>this._setClosed(r));return}let t=this.#a.shift();if(t===void 0)return;else if(t.type==="pipeline"){let r=[t];for(;;){let o=this.#a.first();if(o!==void 0&&o.type==="pipeline")r.push(o),this.#a.shift();else if(o===void 0&&this.#l&&!this.#d){r.push({type:"pipeline",request:{type:"close"},responseCallback:()=>{return},errorCallback:()=>{return}}),this.#d=!0;break}else break}this.#y(e,r)}else if(t.type==="cursor")this.#b(e,t);else throw Je(t,"Impossible type of QueueEntry")}#y(e,t){this.#h(()=>this.#S(t,e),(r)=>Ihe(r,e.encoding),(r)=>r.baton,(r)=>r.baseUrl,(r)=>Ehe(t,r),(r)=>t.forEach((o)=>o.errorCallback(r)))}#b(e,t){let r=new hT(this,e.encoding);this.#c=r,this.#h(()=>this.#v(t,e),(o)=>r.open(o),(o)=>o.baton,(o)=>o.baseUrl,(o)=>t.cursorCallback(r),(o)=>t.errorCallback(o))}#h(e,t,r,o,n,i){let s;try{let a=e(),l=this.#n;s=l(a)}catch(a){s=Promise.reject(a)}this.#s=!0,s.then((a)=>{if(!a.ok)return Ahe(a).then((l)=>{throw l});return t(a)}).then((a)=>{this.#i=r(a),this.#t=o(a)??this.#t,n(a)}).catch((a)=>{this._setClosed(a),i(a)}).finally(()=>{this.#s=!1,this.#u()})}#S(e,t){return this.#w(new URL(t.pipelinePath,this.#t),{baton:this.#i,requests:e.map((r)=>r.request)},t.encoding,DF,ZF)}#v(e,t){if(t.cursorPath===void 0)throw new xn(`Cursors are supported only on protocol version 3 and higher, but the HTTP server only supports version ${t.version}.`);return this.#w(new URL(t.cursorPath,this.#t),{baton:this.#i,batch:e.batch},t.encoding,LF,jF)}#w(e,t,r,o,n){let i,s;if(r==="json")i=Ip(t,o),s="application/json";else if(r==="protobuf")i=Rp(t,n),s="application/x-protobuf";else throw Je(r,"Impossible encoding");let a=new Headers;if(a.set("content-type",s),this.#r!==void 0)a.set("authorization",`Bearer ${this.#r}`);if(this.#o!==void 0)a.set("x-turso-encryption-key",this.#o);return new Request(e.toString(),{method:"POST",headers:a,body:i})}}});async function Rhe(e,t){let r=e;for(let o of khe){let n=new URL(o.versionPath,t),i=new Request(n.toString(),{method:"GET"}),s=await r(i);if(await s.arrayBuffer(),s.ok)return o}return ST}var khe,ST,Gy;var vT=S(()=>{Et();bT();khe=[{versionPath:"v3-protobuf",pipelinePath:"v3-protobuf/pipeline",cursorPath:"v3-protobuf/cursor",version:3,encoding:"protobuf"}],ST={versionPath:"v2",pipelinePath:"v2/pipeline",cursorPath:void 0,version:2,encoding:"json"};Gy=class Gy extends yl{#e;#t;#r;#n;#o;#i;_endpointPromise;_endpoint;constructor(e,t,r,o,n=2){super();if(this.#e=e,this.#t=t,this.#r=r??globalThis.fetch,this.#n=o,this.#o=void 0,this.#i=new Set,n==3)this._endpointPromise=Rhe(this.#r,this.#e),this._endpointPromise.then((i)=>this._endpoint=i,(i)=>this.#a(i));else this._endpointPromise=Promise.resolve(ST),this._endpointPromise.then((i)=>this._endpoint=i,(i)=>this.#a(i))}async getVersion(){if(this._endpoint!==void 0)return this._endpoint.version;return(await this._endpointPromise).version}_ensureVersion(e,t){if(e<=ST.version)return;else if(this._endpoint===void 0)throw new xn(`${t} is supported only on protocol version ${e} and higher, but the version supported by the HTTP server is not yet known. Use Client.getVersion() to wait until the version is available.`);else if(this._endpoint.version<e)throw new xn(`${t} is supported only on protocol version ${e} and higher, but the HTTP server only supports version ${this._endpoint.version}.`)}openStream(){if(this.#o!==void 0)throw new _t("Client is closed",this.#o);let e=new Wy(this,this.#e,this.#t,this.#r,this.#n);return this.#i.add(e),e}_streamClosed(e){this.#i.delete(e)}close(){this.#a(new Ge("Client was manually closed"))}get closed(){return this.#o!==void 0}#a(e){if(this.#o!==void 0)return;this.#o=e;for(let t of Array.from(this.#i))t._setClosed(new _t("Client was closed",e))}}});var BF=S(()=>{Et()});function wT(e,t,r=2){if(typeof Vi>"u")throw new _p("WebSockets are not supported in this environment");var o=void 0;if(r==3)o=Array.from(dT.keys());else o=Array.from(TF.keys());let n=new Vi(e,o);return new Ky(n,t)}function xT(e,t,r,o,n=2){return new Gy(e instanceof URL?e:new URL(e),t,r,o,n)}var Qy=S(()=>{GR();Vy();Et();vT();Vy();GR();oT();BF();xl();Zy();By();vT();bT();Vy();sT();Et()});class Lp{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=void 0}execute(e){return this.batch([e]).then((t)=>t[0])}async batch(e){let t=this._getStream();if(t.closed)throw new Ce("Cannot execute statements because the transaction is closed","TRANSACTION_CLOSED");try{let r=e.map(Mo),o;if(this.#r===void 0){this._getSqlCache().apply(r);let i=t.batch(this.#t>=3),s=i.step(),a=s.run(Ji(this.#e)),l=s;o=r.map((u)=>{let d=i.step().condition(ut.ok(l));if(this.#t>=3)d.condition(ut.not(ut.isAutocommit(i)));let p=d.query(u);return p.catch(()=>{return}),l=d,p}),this.#r=i.execute().then(()=>a).then(()=>{return});try{await this.#r}catch(u){throw this.close(),u}}else{if(this.#t<3)await this.#r;this._getSqlCache().apply(r);let i=t.batch(this.#t>=3),s=void 0;o=r.map((a)=>{let l=i.step();if(s!==void 0)l.condition(ut.ok(s));if(this.#t>=3)l.condition(ut.not(ut.isAutocommit(i)));let u=l.query(a);return u.catch(()=>{return}),s=l,u}),await i.execute()}let n=[];for(let i=0;i<o.length;i++)try{let s=await o[i];if(s===void 0)throw new Wt("Statement in a transaction was not executed, probably because the transaction has been rolled back",i,"TRANSACTION_CLOSED");n.push(Tl(s))}catch(s){if(s instanceof Wt)throw s;let a=st(s);if(a instanceof Ce)throw new Wt(a.message,i,a.code,a.extendedCode,a.rawCode,a.cause instanceof Error?a.cause:void 0);throw a}return n}catch(r){throw st(r)}}async executeMultiple(e){let t=this._getStream();if(t.closed)throw new Ce("Cannot execute statements because the transaction is closed","TRANSACTION_CLOSED");try{if(this.#r===void 0){this.#r=t.run(Ji(this.#e)).then(()=>{return});try{await this.#r}catch(r){throw this.close(),r}}else await this.#r;await t.sequence(e)}catch(r){throw st(r)}}async rollback(){try{let e=this._getStream();if(e.closed)return;if(this.#r!==void 0);else return;let t=e.run("ROLLBACK").catch((r)=>{throw st(r)});e.closeGracefully(),await t}catch(e){throw st(e)}finally{this.close()}}async commit(){try{let e=this._getStream();if(e.closed)throw new Ce("Cannot commit the transaction because it is already closed","TRANSACTION_CLOSED");if(this.#r!==void 0)await this.#r;else return;let t=e.run("COMMIT").catch((r)=>{throw st(r)});e.closeGracefully(),await t}catch(e){throw st(e)}finally{this.close()}}}async function Rl(e,t,r,o,n=!1){if(n)r.step().run("PRAGMA foreign_keys=off");let i=r.step(),s=i.run(Ji(e)),a=i,l=o.map((h)=>{let b=r.step().condition(ut.ok(a));if(t>=3)b.condition(ut.not(ut.isAutocommit(r)));let y=b.query(h);return a=b,y}),u=r.step().condition(ut.ok(a));if(t>=3)u.condition(ut.not(ut.isAutocommit(r)));let d=u.run("COMMIT");if(r.step().condition(ut.not(ut.ok(u))).run("ROLLBACK").catch((h)=>{return}),n)r.step().run("PRAGMA foreign_keys=on");await r.execute();let m=[];await s;for(let h=0;h<l.length;h++)try{let b=await l[h];if(b===void 0)throw new Wt("Statement in a batch was not executed, probably because the transaction has been rolled back",h,"TRANSACTION_CLOSED");m.push(Tl(b))}catch(b){if(b instanceof Wt)throw b;let y=st(b);if(y instanceof Ce)throw new Wt(y.message,h,y.code,y.extendedCode,y.rawCode,y.cause instanceof Error?y.cause:void 0);throw y}return await d,m}function Mo(e){let t,r;if(Array.isArray(e))[t,r]=e;else if(typeof e==="string")t=e;else t=e.sql,r=e.args;let o=new Op(t);if(r)if(Array.isArray(r))o.bindIndexes(r);else for(let[n,i]of Object.entries(r))o.bindName(n,i);return o}function Tl(e){let t=e.columnNames.map((s)=>s??""),r=e.columnDecltypes.map((s)=>s??""),o=e.rows,n=e.affectedRowCount,i=e.lastInsertRowid!==void 0?e.lastInsertRowid:void 0;return new fl(t,r,o,n,i)}function st(e){if(e instanceof Ge){let t=UF(e);return new Ce(e.message,t,void 0,void 0,e)}return e}function UF(e){if(e instanceof xp&&e.code!==void 0)return e.code;else if(e instanceof Pe)return"HRANA_PROTO_ERROR";else if(e instanceof _t)return e.cause instanceof Ge?UF(e.cause):"HRANA_CLOSED_ERROR";else if(e instanceof bl)return"HRANA_WEBSOCKET_ERROR";else if(e instanceof da)return"SERVER_ERROR";else if(e instanceof xn)return"PROTOCOL_VERSION_ERROR";else if(e instanceof or)return"INTERNAL_ERROR";else return"UNKNOWN"}var ET=S(()=>{Qy();wn();ml()});class $l{#e;#t;capacity;constructor(e,t){this.#e=e,this.#t=new MF,this.capacity=t}apply(e){if(this.capacity<=0)return;let t=new Set;for(let r of e){if(typeof r.sql!=="string")continue;let o=r.sql;if(o.length>=5000)continue;let n=this.#t.get(o);if(n===void 0){while(this.#t.size+1>this.capacity){let[i,s]=this.#t.peekLru();if(t.has(s))break;s.close(),this.#t.delete(i)}if(this.#t.size+1<=this.capacity)n=this.#e.storeSql(o),this.#t.set(o,n)}if(n!==void 0)r.sql=n,t.add(n)}}}class MF{#e;constructor(){this.#e=new Map}get(e){let t=this.#e.get(e);if(t!==void 0)this.#e.delete(e),this.#e.set(e,t);return t}set(e,t){this.#e.set(e,t)}peekLru(){for(let e of this.#e.entries())return e;return}delete(e){this.#e.delete(e)}get size(){return this.#e.size}}var IT=ge(function(KBe,FF){function The(e){var t=0,r=[];function o(){if(t--,t<e)n()}function n(){var l=r.shift();if(a.queue=r.length,l)s(l.fn).then(l.resolve).catch(l.reject)}function i(l){return new Promise(function(u,d){r.push({fn:l,resolve:u,reject:d}),a.queue=r.length})}function s(l){t++;try{return Promise.resolve(l()).then(function(u){return o(),u},function(u){throw o(),u})}catch(u){return o(),Promise.reject(u)}}var a=function(l){if(t>=e)return i(l);else return s(l)};return a}function $he(e,t){var r=!1,o=this;return Promise.all(e.map(function(){var n=arguments;return o(function(){if(!r)return t.apply(void 0,n).catch(function(i){throw r=!0,i})})}))}function qF(e){return e.queue=0,e.map=$he,e}FF.exports=function(e){if(e)return qF(The(e));else return qF(function(t){return t()})}});function KF(e){if(e.scheme!=="wss"&&e.scheme!=="ws")throw new Ce(`The WebSocket client supports only "libsql:", "wss:" and "ws:" URLs, got ${JSON.stringify(e.scheme+":")}. For more information, please read ${ro}`,"URL_SCHEME_NOT_SUPPORTED");if(e.encryptionKey!==void 0)throw new Ce("Encryption key is not supported by the remote client.","ENCRYPTION_KEY_NOT_SUPPORTED");if(e.scheme==="ws"&&e.tls)throw new Ce('A "ws:" URL cannot opt into TLS by using ?tls=1',"URL_INVALID");else if(e.scheme==="wss"&&!e.tls)throw new Ce('A "wss:" URL cannot opt out of TLS by using ?tls=0',"URL_INVALID");let t=yp(e.scheme,e.authority,e.path),r;try{r=wT(t,e.authToken)}catch(o){if(o instanceof _p){let n=e.scheme==="wss"?"https":"http",i=yp(n,e.authority,e.path);throw new Ce(`This environment does not support WebSockets, please switch to the HTTP client by using a "${n}:" URL (${JSON.stringify(i)}). For more information, please read ${ro}`,"WEBSOCKETS_NOT_SUPPORTED")}throw st(o)}return new VF(r,t,e.authToken,e.intMode,e.concurrency)}class VF{#e;#t;#r;#n;#o;closed;protocol;#i;#a;constructor(e,t,r,o,n){this.#e=t,this.#t=r,this.#r=o,this.#n=this.#c(e),this.#o=void 0,this.closed=!1,this.protocol="ws",this.#a=JF.default(n)}async limit(e){return this.#a(e)}async execute(e,t){let r;if(typeof e==="string")r={sql:e,args:t||[]};else r=e;return this.limit(async()=>{let o=await this.#s();try{let n=Mo(r);o.conn.sqlCache.apply([n]);let i=o.stream.query(n);o.stream.closeGracefully();let s=await i;return Tl(s)}catch(n){throw st(n)}finally{this._closeStream(o)}})}async batch(e,t="deferred"){return this.limit(async()=>{let r=await this.#s();try{let n=e.map((u)=>{if(Array.isArray(u))return{sql:u[0],args:u[1]||[]};return u}).map(Mo),i=await r.conn.client.getVersion();r.conn.sqlCache.apply(n);let s=r.stream.batch(i>=3);return await Rl(t,i,s,n)}catch(o){throw st(o)}finally{this._closeStream(r)}})}async migrate(e){return this.limit(async()=>{let t=await this.#s();try{let r=e.map(Mo),o=await t.conn.client.getVersion(),n=t.stream.batch(o>=3);return await Rl("deferred",o,n,r,!0)}catch(r){throw st(r)}finally{this._closeStream(t)}})}async transaction(e="write"){return this.limit(async()=>{let t=await this.#s();try{let r=await t.conn.client.getVersion();return new WF(this,t,e,r)}catch(r){throw this._closeStream(t),st(r)}})}async executeMultiple(e){return this.limit(async()=>{let t=await this.#s();try{let r=t.stream.sequence(e);t.stream.closeGracefully(),await r}catch(r){throw st(r)}finally{this._closeStream(t)}})}sync(){throw new Ce("sync not supported in ws mode","SYNC_NOT_SUPPORTED")}async#s(){if(this.closed)throw new Ce("The client is closed","CLIENT_CLOSED");if(new Date().valueOf()-this.#n.openTime.valueOf()>Ohe&&this.#o===void 0){let o=this.#c();this.#o=o,o.client.getVersion().then((n)=>{if(this.#n!==o){if(this.#n.streamStates.size===0)this.#n.client.close()}this.#n=o,this.#o=void 0},(n)=>{this.#o=void 0})}if(this.#n.client.closed)try{if(this.#o!==void 0)this.#n=this.#o;else this.#n=this.#c()}catch(o){throw st(o)}let r=this.#n;try{if(r.useSqlCache===void 0){if(r.useSqlCache=await r.client.getVersion()>=2,r.useSqlCache)r.sqlCache.capacity=HF}let o=r.client.openStream();o.intMode=this.#r;let n={conn:r,stream:o};return r.streamStates.add(n),n}catch(o){throw st(o)}}#c(e){try{return e??=wT(this.#e,this.#t),{client:e,useSqlCache:void 0,sqlCache:new $l(e,0),openTime:new Date,streamStates:new Set}}catch(t){throw st(t)}}async reconnect(){try{for(let r of Array.from(this.#n.streamStates))try{r.stream.close()}catch{}this.#n.client.close()}catch{}if(this.#o){try{this.#o.client.close()}catch{}this.#o=void 0}let e=this.#c(),t=await e.client.getVersion();if(e.useSqlCache=t>=2,e.useSqlCache)e.sqlCache.capacity=HF;this.#n=e,this.closed=!1}_closeStream(e){e.stream.close();let t=e.conn;if(t.streamStates.delete(e),t.streamStates.size===0&&t!==this.#n)t.client.close()}close(){if(this.#n.client.close(),this.closed=!0,this.#o){try{this.#o.client.close()}catch{}this.#o=void 0}this.closed=!0}}var JF,Ohe=60000,HF=100,WF;var GF=S(()=>{Qy();wn();vp();ET();ky();ml();JF=Jl(IT(),1);wn();WF=class WF extends Lp{#e;#t;constructor(e,t,r,o){super(r,o);this.#e=e,this.#t=t}_getStream(){return this.#t.stream}_getSqlCache(){return this.#t.conn.sqlCache}close(){this.#e._closeStream(this.#t)}get closed(){return this.#t.stream.closed}}});function YF(e){if(e.scheme!=="https"&&e.scheme!=="http")throw new Ce(`The HTTP client supports only "libsql:", "https:" and "http:" URLs, got ${JSON.stringify(e.scheme+":")}. For more information, please read ${ro}`,"URL_SCHEME_NOT_SUPPORTED");if(e.encryptionKey!==void 0)throw new Ce("Encryption key is not supported by the remote client.","ENCRYPTION_KEY_NOT_SUPPORTED");if(e.scheme==="http"&&e.tls)throw new Ce('A "http:" URL cannot opt into TLS by using ?tls=1',"URL_INVALID");else if(e.scheme==="https"&&!e.tls)throw new Ce('A "https:" URL cannot opt out of TLS by using ?tls=0',"URL_INVALID");let t=yp(e.scheme,e.authority,e.path);return new e3(t,e.authToken,e.intMode,e.fetch,e.concurrency,e.remoteEncryptionKey)}class e3{#e;protocol;#t;#r;#n;#o;#i;#a;#s;constructor(e,t,r,o,n,i){this.#t=e,this.#i=t,this.#r=r,this.#n=o,this.#o=n,this.#a=i,this.#e=xT(this.#t,this.#i,this.#n,i),this.#e.intMode=this.#r,this.protocol="http",this.#s=QF.default(this.#o)}async limit(e){return this.#s(e)}async execute(e,t){let r;if(typeof e==="string")r={sql:e,args:t||[]};else r=e;return this.limit(async()=>{try{let o=Mo(r),n,i=this.#e.openStream();try{n=i.query(o)}finally{i.closeGracefully()}let s=await n;return Tl(s)}catch(o){throw st(o)}})}async batch(e,t="deferred"){return this.limit(async()=>{try{let o=e.map((l)=>{if(Array.isArray(l))return{sql:l[0],args:l[1]||[]};return l}).map(Mo),n=await this.#e.getVersion(),i,s=this.#e.openStream();try{new $l(s,XF).apply(o);let u=s.batch(!1);i=Rl(t,n,u,o)}finally{s.closeGracefully()}return await i}catch(r){throw st(r)}})}async migrate(e){return this.limit(async()=>{try{let t=e.map(Mo),r=await this.#e.getVersion(),o,n=this.#e.openStream();try{let s=n.batch(!1);o=Rl("deferred",r,s,t,!0)}finally{n.closeGracefully()}return await o}catch(t){throw st(t)}})}async transaction(e="write"){return this.limit(async()=>{try{let t=await this.#e.getVersion();return new t3(this.#e.openStream(),e,t)}catch(t){throw st(t)}})}async executeMultiple(e){return this.limit(async()=>{try{let t,r=this.#e.openStream();try{t=r.sequence(e)}finally{r.closeGracefully()}await t}catch(t){throw st(t)}})}sync(){throw new Ce("sync not supported in http mode","SYNC_NOT_SUPPORTED")}close(){this.#e.close()}async reconnect(){try{if(!this.closed)this.#e.close()}finally{this.#e=xT(this.#t,this.#i,this.#n,this.#a),this.#e.intMode=this.#r}}get closed(){return this.#e.closed}}var QF,XF=30,t3;var r3=S(()=>{Qy();wn();vp();ET();ky();ml();QF=Jl(IT(),1);wn();t3=class t3 extends Lp{#e;#t;constructor(e,t,r){super(t,r);this.#e=e,this.#t=new $l(e,XF)}_getStream(){return this.#e}_getSqlCache(){return this.#t}close(){this.#e.close()}get closed(){return this.#e.closed}}});function Ol(e){return Che(Sp(e,!0))}function Che(e){if(e.scheme==="wss"||e.scheme==="ws")return KF(e);else if(e.scheme==="https"||e.scheme==="http")return YF(e);else return Q4(e)}var AT=S(()=>{vp();rF();GF();r3();wn()});function oe(e,t){if(!e||typeof e!=="object")return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,F))throw Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let r=Object.getPrototypeOf(e).constructor;if(r)while(r){if(F in r&&r[F]===t[F])return!0;r=Object.getPrototypeOf(r)}return!1}var F;var $e=S(()=>{F=Symbol.for("drizzle:entityKind")});var Ke;var En=S(()=>{$e();Ke=class Ke{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[F]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}});var Zp;var Yy=S(()=>{$e();Zp=class Zp{static[F]="ColumnBuilder";config;constructor(e,t,r){this.config={name:e,keyAsName:e==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:r,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){if(this.config.name!=="")return;this.config.name=e}}});var ir;var Cl=S(()=>{ir=Symbol.for("drizzle:Name")});var kT,n3;var o3=S(()=>{$e();Cl();kT=class kT{static[F]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){if(this.reference=()=>{let{name:r,columns:o,foreignColumns:n}=e();return{name:r,columns:o,foreignTable:n[0].table,foreignColumns:n}},t)this._onUpdate=t.onUpdate,this._onDelete=t.onDelete}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new n3(e,this)}};n3=class n3{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[F]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:r}=this.reference(),o=t.map((s)=>s.name),n=r.map((s)=>s.name),i=[this.table[ir],...o,r[0].table[ir],...n];return e??`${i.join("_")}_fk`}}});function Xy(e,...t){return e(...t)}var RT=()=>{};function TT(e,t){return`${e[ir]}_${t.join("_")}_unique`}var i3,Phe,s3;var a3=S(()=>{$e();Cl();i3=class i3{constructor(e,t){this.name=t,this.columns=e}static[F]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new s3(e,this.columns,this.nullsNotDistinctConfig,this.name)}};Phe=class Phe{static[F]="PgUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new i3(e,this.name)}};s3=class s3{constructor(e,t,r,o){this.table=e,this.columns=t,this.name=o??TT(this.table,this.columns.map((n)=>n.name)),this.nullsNotDistinct=r}static[F]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}}});function c3(e,t,r){for(let o=t;o<e.length;o++){let n=e[o];if(n==="\\"){o++;continue}if(n==='"')return[e.slice(t,o).replace(/\\/g,""),o+1];if(r)continue;if(n===","||n==="}")return[e.slice(t,o).replace(/\\/g,""),o]}return[e.slice(t).replace(/\\/g,""),e.length]}function l3(e,t=0){let r=[],o=t,n=!1;while(o<e.length){let i=e[o];if(i===","){if(n||o===t)r.push("");n=!0,o++;continue}if(n=!1,i==="\\"){o+=2;continue}if(i==='"'){let[l,u]=c3(e,o+1,!0);r.push(l),o=u;continue}if(i==="}")return[r,o+1];if(i==="{"){let[l,u]=l3(e,o+1);r.push(l),o=u;continue}let[s,a]=c3(e,o,!1);r.push(s),o=a}return[r,o]}function u3(e){let[t]=l3(e,1);return t}function $T(e){return`{${e.map((t)=>{if(Array.isArray(t))return $T(t);if(typeof t==="string")return`"${t.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${t}`}).join(",")}}`}var d3=()=>{};var jp,Pl,p3,zhe,f3,OT;var m3=S(()=>{Yy();En();$e();o3();RT();a3();d3();jp=class jp extends Zp{foreignKeyConfigs=[];static[F]="PgColumnBuilder";array(e){return new f3(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:r,actions:o})=>Xy((n,i)=>{let s=new kT(()=>{let a=n();return{columns:[e],foreignColumns:[a]}});if(i.onUpdate)s.onUpdate(i.onUpdate);if(i.onDelete)s.onDelete(i.onDelete);return s.build(t)},r,o))}buildExtraConfigColumn(e){return new p3(e,this.config)}};Pl=class Pl extends Ke{constructor(e,t){if(!t.uniqueName)t.uniqueName=TT(e,[t.name]);super(e,t);this.table=e}static[F]="PgColumn"};p3=class p3 extends Pl{static[F]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}};zhe=class zhe{static[F]="IndexedColumn";constructor(e,t,r,o){this.name=e,this.keyAsName=t,this.type=r,this.indexConfig=o}name;keyAsName;type;indexConfig};f3=class f3 extends jp{static[F]="PgArrayBuilder";constructor(e,t,r){super(e,"array","PgArray");this.config.baseBuilder=t,this.config.size=r}build(e){let t=this.config.baseBuilder.build(e);return new OT(e,this.config,t)}};OT=class OT extends Pl{constructor(e,t,r,o){super(e,t);this.baseColumn=r,this.range=o,this.size=t.size}size;static[F]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==="number"?this.size:""}]`}mapFromDriverValue(e){if(typeof e==="string")e=u3(e);return e.map((t)=>this.baseColumn.mapFromDriverValue(t))}mapToDriverValue(e,t=!1){let r=e.map((o)=>o===null?null:oe(this.baseColumn,OT)?this.baseColumn.mapToDriverValue(o,!0):this.baseColumn.mapToDriverValue(o));if(t)return r;return $T(r)}}});function y3(e){return!!e&&typeof e==="function"&&h3 in e&&e[h3]===!0}var Nhe,g3,h3,Dhe,b3;var S3=S(()=>{$e();m3();Nhe=class Nhe extends jp{static[F]="PgEnumObjectColumnBuilder";constructor(e,t){super(e,"string","PgEnumObjectColumn");this.config.enum=t}build(e){return new g3(e,this.config)}};g3=class g3 extends Pl{static[F]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t);this.enum=t.enum}getSQLType(){return this.enum.enumName}};h3=Symbol.for("drizzle:isPgEnum");Dhe=class Dhe extends jp{static[F]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn");this.config.enum=t}build(e){return new b3(e,this.config)}};b3=class b3 extends Pl{static[F]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t);this.enum=t.enum}getSQLType(){return this.enum.enumName}}});var dt,Bp;var In=S(()=>{$e();dt=class dt{static[F]="Subquery";constructor(e,t,r,o=!1,n=[]){this._={brand:"Subquery",sql:e,selectedFields:t,alias:r,isWith:o,usedTables:n}}};Bp=class Bp extends dt{static[F]="WithSubquery"}});var v3="0.45.2";var w3=()=>{};var CT,PT,x3;var _3=S(()=>{RT();w3();x3={startActiveSpan(e,t){if(!CT)return t();if(!PT)PT=CT.trace.getTracer("drizzle-orm",v3);return Xy((r,o)=>o.startActiveSpan(e,(n)=>{try{return t(n)}catch(i){throw n.setStatus({code:r.SpanStatusCode.ERROR,message:i instanceof Error?i.message:"Unknown error"}),i}finally{n.end()}}),CT,PT)}}});var pt;var qo=S(()=>{pt=Symbol.for("drizzle:ViewBaseConfig")});function ts(e){return e[ir]}function ya(e){return`${e[eb]??"public"}.${e[ir]}`}var eb,tb,E3,zT,NT,Up,I3,Lhe,he;var sr=S(()=>{$e();Cl();eb=Symbol.for("drizzle:Schema"),tb=Symbol.for("drizzle:Columns"),E3=Symbol.for("drizzle:ExtraConfigColumns"),zT=Symbol.for("drizzle:OriginalName"),NT=Symbol.for("drizzle:BaseName"),Up=Symbol.for("drizzle:IsAlias"),I3=Symbol.for("drizzle:ExtraConfigBuilder"),Lhe=Symbol.for("drizzle:IsDrizzleTable");he=class he{static[F]="Table";static Symbol={Name:ir,Schema:eb,OriginalName:zT,Columns:tb,ExtraConfigColumns:E3,BaseName:NT,IsAlias:Up,ExtraConfigBuilder:I3};[ir];[zT];[eb];[tb];[E3];[NT];[Up]=!1;[Lhe]=!0;[I3]=void 0;constructor(e,t,r){this[ir]=this[zT]=e,this[eb]=t,this[NT]=r}}});function DT(e){return e!==null&&e!==void 0&&typeof e.getSQL==="function"}function jhe(e){let t={sql:"",params:[]};for(let r of e)if(t.sql+=r.sql,t.params.push(...r.params),r.typings?.length){if(!t.typings)t.typings=[];t.typings.push(...r.typings)}return t}function A3(e){return typeof e==="object"&&e!==null&&"mapToDriverValue"in e&&typeof e.mapToDriverValue==="function"}function C(e,...t){let r=[];if(t.length>0||e.length>0&&e[0]!=="")r.push(new Nt(e[0]));for(let[o,n]of t.entries())r.push(n,new Nt(e[o+1]));return new Ee(r)}function Mp(e,t){return e.map((r)=>{if(oe(r,rs)){if(!(r.name in t))throw Error(`No value for placeholder "${r.name}" was provided`);return t[r.name]}if(oe(r,Mr)&&oe(r.value,rs)){if(!(r.value.name in t))throw Error(`No value for placeholder "${r.value.name}" was provided`);return r.encoder.mapToDriverValue(t[r.value.name])}return r})}var Zhe,Nt,Ee,rb,k3,R3,o6e,Mr,rs,Bhe,sn;var Qt=S(()=>{$e();S3();In();_3();qo();En();sr();Zhe=class Zhe{static[F]="FakePrimitiveParam"};Nt=class Nt{static[F]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new Ee([this])}};Ee=class Ee{constructor(e){this.queryChunks=e;for(let t of e)if(oe(t,he)){let r=t[he.Symbol.Schema];this.usedTables.push(r===void 0?t[he.Symbol.Name]:r+"."+t[he.Symbol.Name])}}static[F]="SQL";decoder=k3;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return x3.startActiveSpan("drizzle.buildSQL",(t)=>{let r=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":r.sql,"drizzle.query.params":JSON.stringify(r.params)}),r})}buildQueryFromSourceParams(e,t){let r=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:o,escapeName:n,escapeParam:i,prepareTyping:s,inlineParams:a,paramStartIndex:l}=r;return jhe(e.map((u)=>{if(oe(u,Nt))return{sql:u.value.join(""),params:[]};if(oe(u,rb))return{sql:n(u.value),params:[]};if(u===void 0)return{sql:"",params:[]};if(Array.isArray(u)){let d=[new Nt("(")];for(let[p,m]of u.entries())if(d.push(m),p<u.length-1)d.push(new Nt(", "));return d.push(new Nt(")")),this.buildQueryFromSourceParams(d,r)}if(oe(u,Ee))return this.buildQueryFromSourceParams(u.queryChunks,{...r,inlineParams:a||u.shouldInlineParams});if(oe(u,he)){let d=u[he.Symbol.Schema],p=u[he.Symbol.Name];return{sql:d===void 0||u[Up]?n(p):n(d)+"."+n(p),params:[]}}if(oe(u,Ke)){let d=o.getColumnCasing(u);if(t.invokeSource==="indexes")return{sql:n(d),params:[]};let p=u.table[he.Symbol.Schema];return{sql:u.table[Up]||p===void 0?n(u.table[he.Symbol.Name])+"."+n(d):n(p)+"."+n(u.table[he.Symbol.Name])+"."+n(d),params:[]}}if(oe(u,sn)){let d=u[pt].schema,p=u[pt].name;return{sql:d===void 0||u[pt].isAlias?n(p):n(d)+"."+n(p),params:[]}}if(oe(u,Mr)){if(oe(u.value,rs))return{sql:i(l.value++,u),params:[u],typings:["none"]};let d=u.value===null?null:u.encoder.mapToDriverValue(u.value);if(oe(d,Ee))return this.buildQueryFromSourceParams([d],r);if(a)return{sql:this.mapInlineParam(d,r),params:[]};let p=["none"];if(s)p=[s(u.encoder)];return{sql:i(l.value++,d),params:[d],typings:p}}if(oe(u,rs))return{sql:i(l.value++,u),params:[u],typings:["none"]};if(oe(u,Ee.Aliased)&&u.fieldAlias!==void 0)return{sql:n(u.fieldAlias),params:[]};if(oe(u,dt)){if(u._.isWith)return{sql:n(u._.alias),params:[]};return this.buildQueryFromSourceParams([new Nt("("),u._.sql,new Nt(") "),new rb(u._.alias)],r)}if(y3(u)){if(u.schema)return{sql:n(u.schema)+"."+n(u.enumName),params:[]};return{sql:n(u.enumName),params:[]}}if(DT(u)){if(u.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([u.getSQL()],r);return this.buildQueryFromSourceParams([new Nt("("),u.getSQL(),new Nt(")")],r)}if(a)return{sql:this.mapInlineParam(u,r),params:[]};return{sql:i(l.value++,u),params:[u],typings:["none"]}}))}mapInlineParam(e,{escapeString:t}){if(e===null)return"null";if(typeof e==="number"||typeof e==="boolean")return e.toString();if(typeof e==="string")return t(e);if(typeof e==="object"){let r=e.toString();if(r==="[object Object]")return t(JSON.stringify(e));return t(r)}throw Error("Unexpected param value: "+e)}getSQL(){return this}as(e){if(e===void 0)return this;return new Ee.Aliased(this,e)}mapWith(e){return this.decoder=typeof e==="function"?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}};rb=class rb{constructor(e){this.value=e}static[F]="Name";brand;getSQL(){return new Ee([this])}};k3={mapFromDriverValue:(e)=>e},R3={mapToDriverValue:(e)=>e},o6e={...k3,...R3};Mr=class Mr{constructor(e,t=R3){this.value=e,this.encoder=t}static[F]="Param";brand;getSQL(){return new Ee([this])}};((e)=>{function t(){return new Ee([])}e.empty=t;function r(l){return new Ee(l)}e.fromList=r;function o(l){return new Ee([new Nt(l)])}e.raw=o;function n(l,u){let d=[];for(let[p,m]of l.entries()){if(p>0&&u!==void 0)d.push(u);d.push(m)}return new Ee(d)}e.join=n;function i(l){return new rb(l)}e.identifier=i;function s(l){return new rs(l)}e.placeholder=s;function a(l,u){return new Mr(l,u)}e.param=a})(C||(C={}));((e)=>{class t{constructor(r,o){this.sql=r,this.fieldAlias=o}static[F]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(Ee||(Ee={}));rs=class rs{constructor(e){this.name=e}static[F]="Placeholder";getSQL(){return new Ee([this])}};Bhe=Symbol.for("drizzle:IsDrizzleView");sn=class sn{static[F]="View";[pt];[Bhe]=!0;constructor({name:e,schema:t,selectedFields:r,query:o}){this[pt]={name:e,originalName:e,schema:t,selectedFields:r,query:o,isExisting:!o,isAlias:!1}}getSQL(){return new Ee([this])}};Ke.prototype.getSQL=function(){return new Ee([this])};he.prototype.getSQL=function(){return new Ee([this])};dt.prototype.getSQL=function(){return new Ee([this])}});function LT(e,t,r){let o={},n=e.reduce((i,{path:s,field:a},l)=>{let u;if(oe(a,Ke))u=a;else if(oe(a,Ee))u=a.decoder;else if(oe(a,dt))u=a._.sql.decoder;else u=a.sql.decoder;let d=i;for(let[p,m]of s.entries())if(p<s.length-1){if(!(m in d))d[m]={};d=d[m]}else{let h=t[l],b=d[m]=h===null?null:u.mapFromDriverValue(h);if(r&&oe(a,Ke)&&s.length===2){let y=s[0];if(!(y in o))o[y]=b===null?ts(a.table):!1;else if(typeof o[y]==="string"&&o[y]!==ts(a.table))o[y]=!1}}return i},{});if(r&&Object.keys(o).length>0){for(let[i,s]of Object.entries(o))if(typeof s==="string"&&!r[s])n[i]=null}return n}function an(e,t){return Object.entries(e).reduce((r,[o,n])=>{if(typeof o!=="string")return r;let i=t?[...t,o]:[o];if(oe(n,Ke)||oe(n,Ee)||oe(n,Ee.Aliased)||oe(n,dt))r.push({path:i,field:n});else if(oe(n,he))r.push(...an(n[he.Symbol.Columns],i));else r.push(...an(n,i));return r},[])}function qp(e,t){let r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let[n,i]of r.entries())if(i!==o[n])return!1;return!0}function nb(e,t){let r=Object.entries(t).filter(([,o])=>o!==void 0).map(([o,n])=>{if(oe(n,Ee)||oe(n,Ke))return[o,n];else return[o,new Mr(n,e[he.Symbol.Columns][o])]});if(r.length===0)throw Error("No values to set");return Object.fromEntries(r)}function T3(e,t){for(let r of t)for(let o of Object.getOwnPropertyNames(r.prototype)){if(o==="constructor")continue;Object.defineProperty(e.prototype,o,Object.getOwnPropertyDescriptor(r.prototype,o)||Object.create(null))}}function ob(e){return e[he.Symbol.Columns]}function Fp(e){return oe(e,dt)?e._.alias:oe(e,sn)?e[pt].name:oe(e,Ee)?void 0:e[he.Symbol.IsAlias]?e[he.Symbol.Name]:e[he.Symbol.BaseName]}function so(e,t){return{name:typeof e==="string"&&e.length>0?e:"",config:typeof e==="object"?e:t}}function $3(e){if(typeof e!=="object"||e===null)return!1;if(e.constructor.name!=="Object")return!1;if("logger"in e){let t=typeof e.logger;if(t!=="boolean"&&(t!=="object"||typeof e.logger.logQuery!=="function")&&t!=="undefined")return!1;return!0}if("schema"in e){let t=typeof e.schema;if(t!=="object"&&t!=="undefined")return!1;return!0}if("casing"in e){let t=typeof e.casing;if(t!=="string"&&t!=="undefined")return!1;return!0}if("mode"in e){if(e.mode!=="default"||e.mode!=="planetscale"||e.mode!==void 0)return!1;return!0}if("connection"in e){let t=typeof e.connection;if(t!=="string"&&t!=="object"&&t!=="undefined")return!1;return!0}if("client"in e){let t=typeof e.client;if(t!=="object"&&t!=="function"&&t!=="undefined")return!1;return!0}if(Object.keys(e).length===0)return!0;return!1}var ZT;var Sr=S(()=>{En();$e();Qt();In();sr();qo();ZT=typeof TextDecoder>"u"?null:new TextDecoder});var O3,jT,BT;var ib=S(()=>{$e();O3=class O3{static[F]="ConsoleLogWriter";write(e){console.log(e)}};jT=class jT{static[F]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new O3}logQuery(e,t){let r=t.map((n)=>{try{return JSON.stringify(n)}catch{return String(n)}}),o=r.length?` -- params: [${r.join(", ")}]`:"";this.writer.write(`Query: ${e}${o}`)}};BT=class BT{static[F]="NoopLogger";logQuery(){}}});var C3,P3,UT;var z3=S(()=>{$e();sr();C3=Symbol.for("drizzle:PgInlineForeignKeys"),P3=Symbol.for("drizzle:EnableRLS");UT=class UT extends he{static[F]="PgTable";static Symbol=Object.assign({},he.Symbol,{InlineForeignKeys:C3,EnableRLS:P3});[C3]=[];[P3]=!1;[he.Symbol.ExtraConfigBuilder]=void 0;[he.Symbol.ExtraConfigColumns]={}}});var MT,N3;var D3=S(()=>{$e();z3();MT=class MT{static[F]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new N3(e,this.columns,this.name)}};N3=class N3{constructor(e,t,r){this.table=e,this.columns=t,this.name=r}static[F]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[UT.Symbol.Name]}_${this.columns.map((e)=>e.name).join("_")}_pk`}}});function $r(e,t){if(A3(t)&&!DT(e)&&!oe(e,Mr)&&!oe(e,rs)&&!oe(e,Ke)&&!oe(e,he)&&!oe(e,sn))return new Mr(e,t);return e}function tt(...e){let t=e.filter((r)=>r!==void 0);if(t.length===0)return;if(t.length===1)return new Ee(t);return new Ee([new Nt("("),C.join(t,new Nt(" and ")),new Nt(")")])}function cn(...e){let t=e.filter((r)=>r!==void 0);if(t.length===0)return;if(t.length===1)return new Ee(t);return new Ee([new Nt("("),C.join(t,new Nt(" or ")),new Nt(")")])}function Z3(e){return C`not ${e}`}function os(e,t){if(Array.isArray(t)){if(t.length===0)return C`false`;return C`${e} in ${t.map((r)=>$r(r,e))}`}return C`${e} in ${$r(t,e)}`}function sb(e,t){if(Array.isArray(t)){if(t.length===0)return C`true`;return C`${e} not in ${t.map((r)=>$r(r,e))}`}return C`${e} not in ${$r(t,e)}`}function qr(e){return C`${e} is null`}function U3(e){return C`${e} is not null`}function ab(e){return C`exists ${e}`}function is(e){return C`not exists ${e}`}function M3(e,t,r){return C`${e} between ${$r(t,e)} and ${$r(r,e)}`}function q3(e,t,r){return C`${e} not between ${$r(t,e)} and ${$r(r,e)}`}function F3(e,t){return C`${e} like ${t}`}function H3(e,t){return C`${e} not like ${t}`}function J3(e,t){return C`${e} ilike ${t}`}function K3(e,t){return C`${e} not ilike ${t}`}var je=(e,t)=>C`${e} = ${$r(t,e)}`,L3=(e,t)=>C`${e} <> ${$r(t,e)}`,An=(e,t)=>C`${e} > ${$r(t,e)}`,j3=(e,t)=>C`${e} >= ${$r(t,e)}`,B3=(e,t)=>C`${e} < ${$r(t,e)}`,ns=(e,t)=>C`${e} <= ${$r(t,e)}`;var V3=S(()=>{En();$e();sr();Qt()});function Fo(e){return C`${e} asc`}function ba(e){return C`${e} desc`}var W3=S(()=>{Qt()});var qT=S(()=>{V3();W3()});function Q3(){return{and:tt,between:M3,eq:je,exists:ab,gt:An,gte:j3,ilike:J3,inArray:os,isNull:qr,isNotNull:U3,like:F3,lt:B3,lte:ns,ne:L3,not:Z3,notBetween:q3,notExists:is,notLike:H3,notIlike:K3,notInArray:sb,or:cn,sql:C}}function Y3(){return{sql:C,asc:Fo,desc:ba}}function X3(e,t){if(Object.keys(e).length===1&&"default"in e&&!oe(e.default,he))e=e.default;let r={},o={},n={};for(let[i,s]of Object.entries(e))if(oe(s,he)){let a=ya(s),l=o[a];r[a]=i,n[i]={tsName:i,dbName:s[he.Symbol.Name],schema:s[he.Symbol.Schema],columns:s[he.Symbol.Columns],relations:l?.relations??{},primaryKey:l?.primaryKey??[]};for(let d of Object.values(s[he.Symbol.Columns]))if(d.primary)n[i].primaryKey.push(d);let u=s[he.Symbol.ExtraConfigBuilder]?.(s[he.Symbol.ExtraConfigColumns]);if(u){for(let d of Object.values(u))if(oe(d,MT))n[i].primaryKey.push(...d.columns)}}else if(oe(s,G3)){let a=ya(s.table),l=r[a],u=s.config(t(s.table)),d;for(let[p,m]of Object.entries(u))if(l){let h=n[l];if(h.relations[p]=m,d)h.primaryKey.push(...d)}else{if(!(a in o))o[a]={relations:{},primaryKey:d};o[a].relations[p]=m}}return{tables:n,tableNamesMap:r}}function Uhe(e){return function(r,o){return new ss(e,r,o,o?.fields.reduce((n,i)=>n&&i.notNull,!0)??!1)}}function Mhe(e){return function(r,o){return new Hp(e,r,o)}}function e5(e,t,r){if(oe(r,ss)&&r.config)return{fields:r.config.fields,references:r.config.references};let o=t[ya(r.referencedTable)];if(!o)throw Error(`Table "${r.referencedTable[he.Symbol.Name]}" not found in schema`);let n=e[o];if(!n)throw Error(`Table "${o}" not found in schema`);let i=r.sourceTable,s=t[ya(i)];if(!s)throw Error(`Table "${i[he.Symbol.Name]}" not found in schema`);let a=[];for(let l of Object.values(n.relations))if(r.relationName&&r!==l&&l.relationName===r.relationName||!r.relationName&&l.referencedTable===r.sourceTable)a.push(l);if(a.length>1)throw r.relationName?Error(`There are multiple relations with name "${r.relationName}" in table "${o}"`):Error(`There are multiple relations between "${o}" and "${r.sourceTable[he.Symbol.Name]}". Please specify relation name`);if(a[0]&&oe(a[0],ss)&&a[0].config)return{fields:a[0].config.references,references:a[0].config.fields};throw Error(`There is not enough information to infer relation "${s}.${r.fieldName}"`)}function t5(e){return{one:Uhe(e),many:Mhe(e)}}function cb(e,t,r,o,n=(i)=>i){let i={};for(let[s,a]of o.entries())if(a.isJson){let l=t.relations[a.tsKey],u=r[s],d=typeof u==="string"?JSON.parse(u):u;i[a.tsKey]=oe(l,ss)?d&&cb(e,e[a.relationTableTsKey],d,a.selection,n):d.map((p)=>cb(e,e[a.relationTableTsKey],p,a.selection,n))}else{let l=n(r[s]),u=a.field,d;if(oe(u,Ke))d=u;else if(oe(u,Ee))d=u.decoder;else d=u.sql.decoder;i[a.tsKey]=l===null?null:d.mapFromDriverValue(l)}return i}var FT,G3,ss,Hp;var Jp=S(()=>{sr();En();$e();D3();qT();Qt();FT=class FT{constructor(e,t,r){this.sourceTable=e,this.referencedTable=t,this.relationName=r,this.referencedTableName=t[he.Symbol.Name]}static[F]="Relation";referencedTableName;fieldName};G3=class G3{constructor(e,t){this.table=e,this.config=t}static[F]="Relations"};ss=class ss extends FT{constructor(e,t,r,o){super(e,t,r?.relationName);this.config=r,this.isNullable=o}static[F]="One";withFieldName(e){let t=new ss(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}};Hp=class Hp extends FT{constructor(e,t,r){super(e,t,r?.relationName);this.config=r}static[F]="Many";withFieldName(e){let t=new Hp(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}});function Kp(e,t){return new Proxy(e,new Sa(t,!1))}function ao(e,t){return new Proxy(e,new zl(new Proxy(e.table,new Sa(t,!1))))}function HT(e,t){return new Ee.Aliased(Vp(e.sql,t),e.fieldAlias)}function Vp(e,t){return C.join(e.queryChunks.map((r)=>{if(oe(r,Ke))return ao(r,t);if(oe(r,Ee))return Vp(r,t);if(oe(r,Ee.Aliased))return HT(r,t);return r}))}var zl,Sa,qhe;var Wp=S(()=>{En();$e();Qt();sr();qo();zl=class zl{constructor(e){this.table=e}static[F]="ColumnAliasProxyHandler";get(e,t){if(t==="table")return this.table;return e[t]}};Sa=class Sa{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static[F]="TableAliasProxyHandler";get(e,t){if(t===he.Symbol.IsAlias)return!0;if(t===he.Symbol.Name)return this.alias;if(this.replaceOriginalName&&t===he.Symbol.OriginalName)return this.alias;if(t===pt)return{...e[pt],name:this.alias,isAlias:!0};if(t===he.Symbol.Columns){let o=e[he.Symbol.Columns];if(!o)return o;let n={};return Object.keys(o).map((i)=>{n[i]=new Proxy(o[i],new zl(new Proxy(e,this)))}),n}let r=e[t];if(oe(r,Ke))return new Proxy(r,new zl(new Proxy(e,this)));return r}};qhe=class qhe{constructor(e){this.alias=e}static[F]="RelationTableAliasProxyHandler";get(e,t){if(t==="sourceTable")return Kp(e.sourceTable,this.alias);return e[t]}}});var at;var va=S(()=>{Wp();En();$e();Qt();In();qo();at=class at{static[F]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if(t==="_")return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===pt)return{...e[pt],selectedFields:new Proxy(e[pt].selectedFields,this)};if(typeof t==="symbol")return e[t];let o=(oe(e,dt)?e._.selectedFields:oe(e,sn)?e[pt].selectedFields:e)[t];if(oe(o,Ee.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!o.isSelectionField)return o.sql;let n=o.clone();return n.isSelectionField=!0,n}if(oe(o,Ee)){if(this.config.sqlBehavior==="sql")return o;throw Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(oe(o,Ke)){if(this.config.alias)return new Proxy(o,new zl(new Proxy(o.table,new Sa(this.config.alias,this.config.replaceOriginalName??!1))));return o}if(typeof o!=="object"||o===null)return o;return new Proxy(o,new at(this.config))}}});var vr;var Ho=S(()=>{$e();vr=class vr{static[F]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then((t)=>(e?.(),t),(t)=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}});var JT,r5;var KT=S(()=>{$e();Cl();JT=class JT{static[F]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){if(this.reference=()=>{let{name:r,columns:o,foreignColumns:n}=e();return{name:r,columns:o,foreignTable:n[0].table,foreignColumns:n}},t)this._onUpdate=t.onUpdate,this._onDelete=t.onDelete}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new r5(e,this)}};r5=class r5{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[F]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:r}=this.reference(),o=t.map((s)=>s.name),n=r.map((s)=>s.name),i=[this.table[ir],...o,r[0].table[ir],...n];return e??`${i.join("_")}_fk`}}});function VT(e,t){return`${e[ir]}_${t.join("_")}_unique`}var n5,Fhe,o5;var WT=S(()=>{$e();Cl();n5=class n5{constructor(e,t){this.name=t,this.columns=e}static[F]="SQLiteUniqueConstraintBuilder";columns;build(e){return new o5(e,this.columns,this.name)}};Fhe=class Fhe{static[F]="SQLiteUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new n5(e,this.name)}};o5=class o5{constructor(e,t,r){this.table=e,this.columns=t,this.name=r??VT(this.table,this.columns.map((o)=>o.name))}static[F]="SQLiteUniqueConstraint";columns;name;getName(){return this.name}}});var Bt,yt;var as=S(()=>{Yy();En();$e();KT();WT();Bt=class Bt extends Zp{static[F]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:r,actions:o})=>((n,i)=>{let s=new JT(()=>{let a=n();return{columns:[e],foreignColumns:[a]}});if(i.onUpdate)s.onUpdate(i.onUpdate);if(i.onDelete)s.onDelete(i.onDelete);return s.build(t)})(r,o))}};yt=class yt extends Ke{constructor(e,t){if(!t.uniqueName)t.uniqueName=VT(e,[t.name]);super(e,t);this.table=e}static[F]="SQLiteColumn"}});function d5(e,t){let{name:r,config:o}=so(e,t);if(o?.mode==="json")return new a5(r);if(o?.mode==="bigint")return new i5(r);return new l5(r)}var i5,s5,a5,c5,l5,u5;var GT=S(()=>{$e();Sr();as();i5=class i5 extends Bt{static[F]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint","SQLiteBigInt")}build(e){return new s5(e,this.config)}};s5=class s5 extends yt{static[F]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(e){if(typeof Buffer<"u"&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return BigInt(t.toString("utf8"))}return BigInt(ZT.decode(e))}mapToDriverValue(e){return Buffer.from(e.toString())}};a5=class a5 extends Bt{static[F]="SQLiteBlobJsonBuilder";constructor(e){super(e,"json","SQLiteBlobJson")}build(e){return new c5(e,this.config)}};c5=class c5 extends yt{static[F]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(e){if(typeof Buffer<"u"&&Buffer.from){let t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return JSON.parse(t.toString("utf8"))}return JSON.parse(ZT.decode(e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}};l5=class l5 extends Bt{static[F]="SQLiteBlobBufferBuilder";constructor(e){super(e,"buffer","SQLiteBlobBuffer")}build(e){return new u5(e,this.config)}};u5=class u5 extends yt{static[F]="SQLiteBlobBuffer";mapFromDriverValue(e){if(Buffer.isBuffer(e))return e;return Buffer.from(e)}getSQLType(){return"blob"}}});function m5(e){return(t,r)=>{let{name:o,config:n}=so(t,r);return new p5(o,n,e)}}var p5,f5;var QT=S(()=>{$e();Sr();as();p5=class p5 extends Bt{static[F]="SQLiteCustomColumnBuilder";constructor(e,t,r){super(e,"custom","SQLiteCustomColumn");this.config.fieldConfig=t,this.config.customTypeParams=r}build(e){return new f5(e,this.config)}};f5=class f5 extends yt{static[F]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t);this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return typeof this.mapFrom==="function"?this.mapFrom(e):e}mapToDriverValue(e){return typeof this.mapTo==="function"?this.mapTo(e):e}}});function ar(e,t){let{name:r,config:o}=so(e,t);if(o?.mode==="timestamp"||o?.mode==="timestamp_ms")return new y5(r,o.mode);if(o?.mode==="boolean")return new S5(r,o.mode);return new h5(r)}var lb,ub,h5,g5,y5,b5,S5,v5;var YT=S(()=>{$e();Qt();Sr();as();lb=class lb extends Bt{static[F]="SQLiteBaseIntegerBuilder";constructor(e,t,r){super(e,t,r);this.config.autoIncrement=!1}primaryKey(e){if(e?.autoIncrement)this.config.autoIncrement=!0;return this.config.hasDefault=!0,super.primaryKey()}};ub=class ub extends yt{static[F]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}};h5=class h5 extends lb{static[F]="SQLiteIntegerBuilder";constructor(e){super(e,"number","SQLiteInteger")}build(e){return new g5(e,this.config)}};g5=class g5 extends ub{static[F]="SQLiteInteger"};y5=class y5 extends lb{static[F]="SQLiteTimestampBuilder";constructor(e,t){super(e,"date","SQLiteTimestamp");this.config.mode=t}defaultNow(){return this.default(C`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new b5(e,this.config)}};b5=class b5 extends ub{static[F]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(e){if(this.config.mode==="timestamp")return new Date(e*1000);return new Date(e)}mapToDriverValue(e){let t=e.getTime();if(this.config.mode==="timestamp")return Math.floor(t/1000);return t}};S5=class S5 extends lb{static[F]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean");this.config.mode=t}build(e){return new v5(e,this.config)}};v5=class v5 extends ub{static[F]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(e){return Number(e)===1}mapToDriverValue(e){return e?1:0}}});function k5(e,t){let{name:r,config:o}=so(e,t),n=o?.mode;return n==="number"?new _5(r):n==="bigint"?new I5(r):new w5(r)}var w5,x5,_5,E5,I5,A5;var XT=S(()=>{$e();Sr();as();w5=class w5 extends Bt{static[F]="SQLiteNumericBuilder";constructor(e){super(e,"string","SQLiteNumeric")}build(e){return new x5(e,this.config)}};x5=class x5 extends yt{static[F]="SQLiteNumeric";mapFromDriverValue(e){if(typeof e==="string")return e;return String(e)}getSQLType(){return"numeric"}};_5=class _5 extends Bt{static[F]="SQLiteNumericNumberBuilder";constructor(e){super(e,"number","SQLiteNumericNumber")}build(e){return new E5(e,this.config)}};E5=class E5 extends yt{static[F]="SQLiteNumericNumber";mapFromDriverValue(e){if(typeof e==="number")return e;return Number(e)}mapToDriverValue=String;getSQLType(){return"numeric"}};I5=class I5 extends Bt{static[F]="SQLiteNumericBigIntBuilder";constructor(e){super(e,"bigint","SQLiteNumericBigInt")}build(e){return new A5(e,this.config)}};A5=class A5 extends yt{static[F]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}});function $5(e){return new R5(e??"")}var R5,T5;var e$=S(()=>{$e();as();R5=class R5 extends Bt{static[F]="SQLiteRealBuilder";constructor(e){super(e,"number","SQLiteReal")}build(e){return new T5(e,this.config)}};T5=class T5 extends yt{static[F]="SQLiteReal";getSQLType(){return"real"}}});function ft(e,t={}){let{name:r,config:o}=so(e,t);if(o.mode==="json")return new P5(r);return new O5(r,o)}var O5,C5,P5,z5;var t$=S(()=>{$e();Sr();as();O5=class O5 extends Bt{static[F]="SQLiteTextBuilder";constructor(e,t){super(e,"string","SQLiteText");this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new C5(e,this.config)}};C5=class C5 extends yt{static[F]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}};P5=class P5 extends Bt{static[F]="SQLiteTextJsonBuilder";constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new z5(e,this.config)}};z5=class z5 extends yt{static[F]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}}});function N5(){return{blob:d5,customType:m5,integer:ar,numeric:k5,real:$5,text:ft}}var D5=S(()=>{GT();QT();YT();XT();e$();t$()});function Hhe(e,t,r,o,n=e){let i=new Rt(e,o,n),s=typeof t==="function"?t(N5()):t,a=Object.fromEntries(Object.entries(s).map(([u,d])=>{let p=d;p.setName(u);let m=p.build(i);return i[r$].push(...p.buildForeignKeys(m,i)),[u,m]})),l=Object.assign(i,a);if(l[he.Symbol.Columns]=a,l[he.Symbol.ExtraConfigColumns]=a,r)l[Rt.Symbol.ExtraConfigBuilder]=r;return l}var r$,Rt,Gp=(e,t,r)=>Hhe(e,t,r);var Jo=S(()=>{$e();sr();D5();r$=Symbol.for("drizzle:SQLiteInlineForeignKeys");Rt=class Rt extends he{static[F]="SQLiteTable";static Symbol=Object.assign({},he.Symbol,{InlineForeignKeys:r$});[he.Symbol.Columns];[r$]=[];[he.Symbol.ExtraConfigBuilder]=void 0}});var Jhe,L5;var Z5=S(()=>{$e();Jhe=class Jhe{constructor(e,t){this.name=e,this.value=t}static[F]="SQLiteCheckBuilder";brand;build(e){return new L5(e,this)}};L5=class L5{constructor(e,t){this.table=e,this.name=t.name,this.value=t.value}static[F]="SQLiteCheck";name;value}});function Ko(e){return new j5(e,!1)}var j5,B5,U5;var M5=S(()=>{$e();j5=class j5{constructor(e,t){this.name=e,this.unique=t}static[F]="SQLiteIndexBuilderOn";on(...e){return new B5(this.name,e,this.unique)}};B5=class B5{static[F]="SQLiteIndexBuilder";config;constructor(e,t,r){this.config={name:e,columns:t,unique:r,where:void 0}}where(e){return this.config.where=e,this}build(e){return new U5(this.config,e)}};U5=class U5{static[F]="SQLiteIndex";config;constructor(e,t){this.config={...e,table:t}}}});var Khe,q5;var F5=S(()=>{$e();Jo();Khe=class Khe{static[F]="SQLitePrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new q5(e,this.columns,this.name)}};q5=class q5{constructor(e,t,r){this.table=e,this.columns=t,this.name=r}static[F]="SQLitePrimaryKey";columns;name;getName(){return this.name??`${this.table[Rt.Symbol.Name]}_${this.columns.map((e)=>e.name).join("_")}_pk`}}});function kn(e){if(oe(e,Rt))return[`${e[he.Symbol.BaseName]}`];if(oe(e,dt))return e._.usedTables??[];if(oe(e,Ee))return e.usedTables??[];return[]}var Nl=S(()=>{$e();Qt();In();sr();Jo()});var db;var H5=S(()=>{$e();Ho();va();Jo();sr();Sr();Nl();db=class db extends vr{constructor(e,t,r,o){super();this.table=e,this.session=t,this.dialect=r,this.config={table:e,withList:o}}static[F]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]==="function"){let t=e[0](new Proxy(this.config.table[he.Symbol.Columns],new at({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),r=Array.isArray(t)?t:[t];this.config.orderBy=r}else{let t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[Rt.Symbol.Columns]){return this.config.returning=an(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:kn(this.config.table)})}prepare(){return this._prepare(!1)}run=(e)=>this._prepare().run(e);all=(e)=>this._prepare().all(e);get=(e)=>this._prepare().get(e);values=(e)=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}});function Vhe(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((r)=>r.toLowerCase()).join("_")}function Whe(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((r,o,n)=>{let i=n===0?o.toLowerCase():`${o[0].toUpperCase()}${o.slice(1)}`;return r+i},"")}function Ghe(e){return e}var n$;var J5=S(()=>{$e();sr();n$=class n${static[F]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert=e==="snake_case"?Vhe:e==="camelCase"?Whe:Ghe}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[he.Symbol.Schema]??"public",r=e.table[he.Symbol.OriginalName],o=`${t}.${r}.${e.name}`;if(!this.cache[o])this.cacheTable(e.table);return this.cache[o]}cacheTable(e){let t=e[he.Symbol.Schema]??"public",r=e[he.Symbol.OriginalName],o=`${t}.${r}`;if(!this.cachedTables[o]){for(let n of Object.values(e[he.Symbol.Columns])){let i=`${o}.${n.name}`;this.cache[i]=this.convert(n.name)}this.cachedTables[o]=!0}}clearCache(){this.cache={},this.cachedTables={}}}});var Dl,Vo,o$;var pb=S(()=>{$e();Dl=class Dl extends Error{static[F]="DrizzleError";constructor({message:e,cause:t}){super(e);this.name="DrizzleError",this.cause=t}};Vo=class Vo extends Error{constructor(e,t,r){super(`Failed query: ${e}
|
|
446
|
+
params: ${t}`);if(this.query=e,this.params=t,this.cause=r,Error.captureStackTrace(this,Vo),r)this.cause=r}};o$=class o$ extends Dl{static[F]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}});var K5=()=>{};var V5=()=>{};var W5=S(()=>{K5();V5()});var i$=S(()=>{qT();W5();Qt()});var s$=S(()=>{GT();as();QT();YT();XT();e$();t$()});var Wo;var Qp=S(()=>{$e();Qt();Wo=class Wo extends sn{static[F]="SQLiteViewBase"}});var Ll,a$,c$;var fb=S(()=>{Wp();J5();En();$e();pb();Jp();i$();Qt();s$();Jo();In();sr();Sr();qo();Qp();Ll=class Ll{static[F]="SQLiteDialect";casing;constructor(e){this.casing=new n$(e?.casing)}escapeName(e){return`"${e.replace(/"/g,'""')}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[C`with `];for(let[r,o]of e.entries())if(t.push(C`${C.identifier(o._.alias)} as (${o._.sql})`),r<e.length-1)t.push(C`, `);return t.push(C` `),C.join(t)}buildDeleteQuery({table:e,where:t,returning:r,withList:o,limit:n,orderBy:i}){let s=this.buildWithCTE(o),a=r?C` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,l=t?C` where ${t}`:void 0,u=this.buildOrderBy(i),d=this.buildLimit(n);return C`${s}delete from ${e}${l}${a}${u}${d}`}buildUpdateSet(e,t){let r=e[he.Symbol.Columns],o=Object.keys(r).filter((i)=>t[i]!==void 0||r[i]?.onUpdateFn!==void 0),n=o.length;return C.join(o.flatMap((i,s)=>{let a=r[i],l=a.onUpdateFn?.(),u=t[i]??(oe(l,Ee)?l:C.param(l,a)),d=C`${C.identifier(this.casing.getColumnCasing(a))} = ${u}`;if(s<n-1)return[d,C.raw(", ")];return[d]}))}buildUpdateQuery({table:e,set:t,where:r,returning:o,withList:n,joins:i,from:s,limit:a,orderBy:l}){let u=this.buildWithCTE(n),d=this.buildUpdateSet(e,t),p=s&&C.join([C.raw(" from "),this.buildFromTable(s)]),m=this.buildJoins(i),h=o?C` returning ${this.buildSelection(o,{isSingleTable:!0})}`:void 0,b=r?C` where ${r}`:void 0,y=this.buildOrderBy(l),v=this.buildLimit(a);return C`${u}update ${e} set ${d}${p}${m}${b}${h}${y}${v}`}buildSelection(e,{isSingleTable:t=!1}={}){let r=e.length,o=e.flatMap(({field:n},i)=>{let s=[];if(oe(n,Ee.Aliased)&&n.isSelectionField)s.push(C.identifier(n.fieldAlias));else if(oe(n,Ee.Aliased)||oe(n,Ee)){let a=oe(n,Ee.Aliased)?n.sql:n;if(t)s.push(new Ee(a.queryChunks.map((l)=>{if(oe(l,Ke))return C.identifier(this.casing.getColumnCasing(l));return l})));else s.push(a);if(oe(n,Ee.Aliased))s.push(C` as ${C.identifier(n.fieldAlias)}`)}else if(oe(n,Ke)){let a=n.table[he.Symbol.Name];if(n.columnType==="SQLiteNumericBigInt")if(t)s.push(C`cast(${C.identifier(this.casing.getColumnCasing(n))} as text)`);else s.push(C`cast(${C.identifier(a)}.${C.identifier(this.casing.getColumnCasing(n))} as text)`);else if(t)s.push(C.identifier(this.casing.getColumnCasing(n)));else s.push(C`${C.identifier(a)}.${C.identifier(this.casing.getColumnCasing(n))}`)}else if(oe(n,dt)){let a=Object.entries(n._.selectedFields);if(a.length===1){let l=a[0][1],u=oe(l,Ee)?l.decoder:oe(l,Ke)?{mapFromDriverValue:(d)=>l.mapFromDriverValue(d)}:l.sql.decoder;if(u)n._.sql.decoder=u}s.push(n)}if(i<r-1)s.push(C`, `);return s});return C.join(o)}buildJoins(e){if(!e||e.length===0)return;let t=[];if(e)for(let[r,o]of e.entries()){if(r===0)t.push(C` `);let n=o.table,i=o.on?C` on ${o.on}`:void 0;if(oe(n,Rt)){let s=n[Rt.Symbol.Name],a=n[Rt.Symbol.Schema],l=n[Rt.Symbol.OriginalName],u=s===l?void 0:o.alias;t.push(C`${C.raw(o.joinType)} join ${a?C`${C.identifier(a)}.`:void 0}${C.identifier(l)}${u&&C` ${C.identifier(u)}`}${i}`)}else t.push(C`${C.raw(o.joinType)} join ${n}${i}`);if(r<e.length-1)t.push(C` `)}return C.join(t)}buildLimit(e){return typeof e==="object"||typeof e==="number"&&e>=0?C` limit ${e}`:void 0}buildOrderBy(e){let t=[];if(e){for(let[r,o]of e.entries())if(t.push(o),r<e.length-1)t.push(C`, `)}return t.length>0?C` order by ${C.join(t)}`:void 0}buildFromTable(e){if(oe(e,he)&&e[he.Symbol.IsAlias])return C`${C`${C.identifier(e[he.Symbol.Schema]??"")}.`.if(e[he.Symbol.Schema])}${C.identifier(e[he.Symbol.OriginalName])} ${C.identifier(e[he.Symbol.Name])}`;return e}buildSelectQuery({withList:e,fields:t,fieldsFlat:r,where:o,having:n,table:i,joins:s,orderBy:a,groupBy:l,limit:u,offset:d,distinct:p,setOperators:m}){let h=r??an(t);for(let T of h)if(oe(T.field,Ke)&&ts(T.field.table)!==(oe(i,dt)?i._.alias:oe(i,Wo)?i[pt].name:oe(i,Ee)?void 0:ts(i))&&!((Z)=>s?.some(({alias:I})=>I===(Z[he.Symbol.IsAlias]?ts(Z):Z[he.Symbol.BaseName])))(T.field.table)){let Z=ts(T.field.table);throw Error(`Your "${T.path.join("->")}" field references a column "${Z}"."${T.field.name}", but the table "${Z}" is not part of the query! Did you forget to join it?`)}let b=!s||s.length===0,y=this.buildWithCTE(e),v=p?C` distinct`:void 0,x=this.buildSelection(h,{isSingleTable:b}),_=this.buildFromTable(i),k=this.buildJoins(s),O=o?C` where ${o}`:void 0,L=n?C` having ${n}`:void 0,z=[];if(l){for(let[T,Z]of l.entries())if(z.push(Z),T<l.length-1)z.push(C`, `)}let J=z.length>0?C` group by ${C.join(z)}`:void 0,P=this.buildOrderBy(a),W=this.buildLimit(u),ee=d?C` offset ${d}`:void 0,j=C`${y}select${v} ${x} from ${_}${k}${O}${J}${L}${P}${W}${ee}`;if(m.length>0)return this.buildSetOperations(j,m);return j}buildSetOperations(e,t){let[r,...o]=t;if(!r)throw Error("Cannot pass undefined values to any set operator");if(o.length===0)return this.buildSetOperationQuery({leftSelect:e,setOperator:r});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:r}),o)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:r,rightSelect:o,limit:n,orderBy:i,offset:s}}){let a=C`${e.getSQL()} `,l=C`${o.getSQL()}`,u;if(i&&i.length>0){let h=[];for(let b of i)if(oe(b,yt))h.push(C.identifier(b.name));else if(oe(b,Ee)){for(let y=0;y<b.queryChunks.length;y++){let v=b.queryChunks[y];if(oe(v,yt))b.queryChunks[y]=C.identifier(this.casing.getColumnCasing(v))}h.push(C`${b}`)}else h.push(C`${b}`);u=C` order by ${C.join(h,C`, `)}`}let d=typeof n==="object"||typeof n==="number"&&n>=0?C` limit ${n}`:void 0,p=C.raw(`${t} ${r?"all ":""}`),m=s?C` offset ${s}`:void 0;return C`${a}${p}${l}${u}${d}${m}`}buildInsertQuery({table:e,values:t,onConflict:r,returning:o,withList:n,select:i}){let s=[],a=e[he.Symbol.Columns],l=Object.entries(a).filter(([b,y])=>!y.shouldDisableInsert()),u=l.map(([,b])=>C.identifier(this.casing.getColumnCasing(b)));if(i){let b=t;if(oe(b,Ee))s.push(b);else s.push(b.getSQL())}else{let b=t;s.push(C.raw("values "));for(let[y,v]of b.entries()){let x=[];for(let[_,k]of l){let O=v[_];if(O===void 0||oe(O,Mr)&&O.value===void 0){let L;if(k.default!==null&&k.default!==void 0)L=oe(k.default,Ee)?k.default:C.param(k.default,k);else if(k.defaultFn!==void 0){let z=k.defaultFn();L=oe(z,Ee)?z:C.param(z,k)}else if(!k.default&&k.onUpdateFn!==void 0){let z=k.onUpdateFn();L=oe(z,Ee)?z:C.param(z,k)}else L=C`null`;x.push(L)}else x.push(O)}if(s.push(x),y<b.length-1)s.push(C`, `)}}let d=this.buildWithCTE(n),p=C.join(s),m=o?C` returning ${this.buildSelection(o,{isSingleTable:!0})}`:void 0,h=r?.length?C.join(r):void 0;return C`${d}insert into ${e} ${u} ${p}${h}${m}`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:t})}buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:r,table:o,tableConfig:n,queryConfig:i,tableAlias:s,nestedQueryRelation:a,joinOn:l}){let u=[],d,p,m=[],h,b=[];if(i===!0)u=Object.entries(n.columns).map(([x,_])=>({dbKey:_.name,tsKey:x,field:ao(_,s),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let v=Object.fromEntries(Object.entries(n.columns).map(([z,J])=>[z,ao(J,s)]));if(i.where){let z=typeof i.where==="function"?i.where(v,Q3()):i.where;h=z&&Vp(z,s)}let x=[],_=[];if(i.columns){let z=!1;for(let[J,P]of Object.entries(i.columns)){if(P===void 0)continue;if(J in n.columns){if(!z&&P===!0)z=!0;_.push(J)}}if(_.length>0)_=z?_.filter((J)=>i.columns?.[J]===!0):Object.keys(n.columns).filter((J)=>!_.includes(J))}else _=Object.keys(n.columns);for(let z of _){let J=n.columns[z];x.push({tsKey:z,value:J})}let k=[];if(i.with)k=Object.entries(i.with).filter((z)=>!!z[1]).map(([z,J])=>({tsKey:z,queryConfig:J,relation:n.relations[z]}));let O;if(i.extras){O=typeof i.extras==="function"?i.extras(v,{sql:C}):i.extras;for(let[z,J]of Object.entries(O))x.push({tsKey:z,value:HT(J,s)})}for(let{tsKey:z,value:J}of x)u.push({dbKey:oe(J,Ee.Aliased)?J.fieldAlias:n.columns[z].name,tsKey:z,field:oe(J,Ke)?ao(J,s):J,relationTableTsKey:void 0,isJson:!1,selection:[]});let L=typeof i.orderBy==="function"?i.orderBy(v,Y3()):i.orderBy??[];if(!Array.isArray(L))L=[L];m=L.map((z)=>{if(oe(z,Ke))return ao(z,s);return Vp(z,s)}),d=i.limit,p=i.offset;for(let{tsKey:z,queryConfig:J,relation:P}of k){let W=e5(t,r,P),ee=ya(P.referencedTable),j=r[ee],T=`${s}_${z}`,Z=tt(...W.fields.map((A,q)=>je(ao(W.references[q],T),ao(A,s)))),I=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:r,table:e[j],tableConfig:t[j],queryConfig:oe(P,ss)?J===!0?{limit:1}:{...J,limit:1}:J,tableAlias:T,joinOn:Z,nestedQueryRelation:P}),R=C`(${I.sql})`.as(z);u.push({dbKey:z,tsKey:z,field:R,relationTableTsKey:j,isJson:!0,selection:I.selection})}}if(u.length===0)throw new Dl({message:`No fields selected for table "${n.tsName}" ("${s}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let y;if(h=tt(l,h),a){let v=C`json_array(${C.join(u.map(({field:k})=>oe(k,yt)?C.identifier(this.casing.getColumnCasing(k)):oe(k,Ee.Aliased)?k.sql:k),C`, `)})`;if(oe(a,Hp))v=C`coalesce(json_group_array(${v}), json_array())`;let x=[{dbKey:"data",tsKey:"data",field:v.as("data"),isJson:!0,relationTableTsKey:n.tsName,selection:u}];if(d!==void 0||p!==void 0||m.length>0)y=this.buildSelectQuery({table:Kp(o,s),fields:{},fieldsFlat:[{path:[],field:C.raw("*")}],where:h,limit:d,offset:p,orderBy:m,setOperators:[]}),h=void 0,d=void 0,p=void 0,m=void 0;else y=Kp(o,s);y=this.buildSelectQuery({table:oe(y,Rt)?y:new dt(y,{},s),fields:{},fieldsFlat:x.map(({field:k})=>({path:[],field:oe(k,Ke)?ao(k,s):k})),joins:b,where:h,limit:d,offset:p,orderBy:m,setOperators:[]})}else y=this.buildSelectQuery({table:Kp(o,s),fields:{},fieldsFlat:u.map(({field:v})=>({path:[],field:oe(v,Ke)?ao(v,s):v})),joins:b,where:h,limit:d,offset:p,orderBy:m,setOperators:[]});return{tableTsKey:n.tsName,sql:y,selection:u}}};a$=class a$ extends Ll{static[F]="SQLiteSyncDialect";migrate(e,t,r){let o=r===void 0?"__drizzle_migrations":typeof r==="string"?"__drizzle_migrations":r.migrationsTable??"__drizzle_migrations",n=C`
|
|
447
447
|
CREATE TABLE IF NOT EXISTS ${C.identifier(o)} (
|
|
448
448
|
id SERIAL PRIMARY KEY,
|
|
449
449
|
hash text NOT NULL,
|
|
@@ -455,11 +455,11 @@ params: ${t}`);if(this.query=e,this.params=t,this.cause=r,Error.captureStackTrac
|
|
|
455
455
|
hash text NOT NULL,
|
|
456
456
|
created_at numeric
|
|
457
457
|
)
|
|
458
|
-
`;await t.run(n);let s=(await t.values(C`SELECT id, hash, created_at FROM ${C.identifier(o)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await t.transaction(async(a)=>{for(let l of e)if(!s||Number(s[2])<l.folderMillis){for(let u of l.sql)await a.run(C.raw(u));await a.run(C`INSERT INTO ${C.identifier(o)} ("hash", "created_at") VALUES(${l.hash}, ${l.folderMillis})`)}})}}});var l$;var G5=S(()=>{$e();l$=class l${static[F]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}});function mb(e,t){return(r,o,...n)=>{let i=[o,...n].map((s)=>({type:e,isAll:t,rightSelect:s}));for(let s of i)if(!qp(r.getSelectedFields(),s.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return r.addSetOperators(i)}}var Rn,Q5,u$,Qhe=()=>({union:Yhe,unionAll:Xhe,intersect:ege,except:tge}),Yhe,Xhe,ege,tge;var d$=S(()=>{$e();G5();Ho();va();Qt();In();sr();Sr();qo();Nl();Qp();Rn=class Rn{static[F]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let t=!!this.fields,r;if(this.fields)r=this.fields;else if(oe(e,dt))r=Object.fromEntries(Object.keys(e._.selectedFields).map((o)=>[o,e[o]]));else if(oe(e,Wo))r=e[pt].selectedFields;else if(oe(e,Ee))r={};else r=ob(e);return new u$({table:e,fields:r,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}};Q5=class Q5 extends l${static[F]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:r,session:o,dialect:n,withList:i,distinct:s}){super();this.config={withList:i,table:e,fields:{...t},distinct:s,setOperators:[]},this.isPartialSelect=r,this.session=o,this.dialect=n,this._={selectedFields:t,config:this.config},this.tableName=Fp(e),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let a of kn(e))this.usedTables.add(a)}getUsedTables(){return[...this.usedTables]}createJoin(e){return(t,r)=>{let o=this.tableName,n=Fp(t);for(let i of kn(t))this.usedTables.add(i);if(typeof n==="string"&&this.config.joins?.some((i)=>i.alias===n))throw Error(`Alias "${n}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof o==="string")this.config.fields={[o]:this.config.fields};if(typeof n==="string"&&!oe(t,Ee)){let i=oe(t,dt)?t._.selectedFields:oe(t,sn)?t[pt].selectedFields:t[he.Symbol.Columns];this.config.fields[n]=i}}if(typeof r==="function")r=r(new Proxy(this.config.fields,new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:r,table:t,joinType:e,alias:n}),typeof n==="string")switch(e){case"left":{this.joinsNotNullableMap[n]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([i])=>[i,!1])),this.joinsNotNullableMap[n]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[n]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([i])=>[i,!1])),this.joinsNotNullableMap[n]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return(r)=>{let o=typeof r==="function"?r(Qhe()):r;if(!qp(this.getSelectedFields(),o.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:o}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){if(typeof e==="function")e=e(new Proxy(this.config.fields,new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=e,this}having(e){if(typeof e==="function")e=e(new Proxy(this.config.fields,new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=e,this}groupBy(...e){if(typeof e[0]==="function"){let t=e[0](new Proxy(this.config.fields,new at({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]==="function"){let t=e[0](new Proxy(this.config.fields,new at({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),r=Array.isArray(t)?t:[t];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=r;else this.config.orderBy=r}else{let t=e;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=t;else this.config.orderBy=t}return this}limit(e){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=e;else this.config.limit=e;return this}offset(e){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=e;else this.config.offset=e;return this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...kn(this.config.table)),this.config.joins)for(let r of this.config.joins)t.push(...kn(r.table));return new Proxy(new dt(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new at({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new at({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}};u$=class u$ extends Q5{static[F]="SQLiteSelect";_prepare(e=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let t=an(this.config.fields),r=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return r.joinsNotNullableMap=this.joinsNotNullableMap,r}$withCache(e){return this.cacheConfig=e===void 0?{config:{},enable:!0,autoInvalidate:!0}:e===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...e},this}prepare(){return this._prepare(!1)}run=(e)=>this._prepare().run(e);all=(e)=>this._prepare().all(e);get=(e)=>this._prepare().get(e);values=(e)=>this._prepare().values(e);async execute(){return this.all()}};T3(u$,[vr]);Yhe=mb("union",!1),Xhe=mb("union",!0),ege=mb("intersect",!1),tge=mb("except",!1)});var wa;var hb=S(()=>{$e();va();fb();In();d$();wa=class wa{static[F]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=oe(e,Ll)?e:void 0,this.dialectConfig=oe(e,Ll)?void 0:e}$with=(e,t)=>{let r=this;return{as:(n)=>{if(typeof n==="function")n=n(r);return new Proxy(new Bp(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,!0),new at({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...e){let t=this;function r(n){return new Rn({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e})}function o(n){return new Rn({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}return{select:r,selectDistinct:o}}select(e){return new Rn({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new Rn({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){if(!this.dialect)this.dialect=new a$(this.dialectConfig);return this.dialect}}});var gb,p$;var Y5=S(()=>{$e();Ho();Qt();Jo();sr();Sr();Nl();hb();gb=class gb{constructor(e,t,r,o){this.table=e,this.session=t,this.dialect=r,this.withList=o}static[F]="SQLiteInsertBuilder";values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw Error("values() must be called with at least one value");let t=e.map((r)=>{let o={},n=this.table[he.Symbol.Columns];for(let i of Object.keys(r)){let s=r[i];o[i]=oe(s,Ee)?s:new Mr(s,n[i])}return o});return new p$(this.table,t,this.session,this.dialect,this.withList)}select(e){let t=typeof e==="function"?e(new wa):e;if(!oe(t,Ee)&&!qp(this.table[tb],t._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new p$(this.table,t,this.session,this.dialect,this.withList,!0)}};p$=class p$ extends vr{constructor(e,t,r,o,n,i){super();this.session=r,this.dialect=o,this.config={table:e,values:t,withList:n,select:i}}static[F]="SQLiteInsert";config;returning(e=this.config.table[Rt.Symbol.Columns]){return this.config.returning=an(e),this}onConflictDoNothing(e={}){if(!this.config.onConflict)this.config.onConflict=[];if(e.target===void 0)this.config.onConflict.push(C` on conflict do nothing`);else{let t=Array.isArray(e.target)?C`${e.target}`:C`${[e.target]}`,r=e.where?C` where ${e.where}`:C``;this.config.onConflict.push(C` on conflict ${t} do nothing${r}`)}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');if(!this.config.onConflict)this.config.onConflict=[];let t=e.where?C` where ${e.where}`:void 0,r=e.targetWhere?C` where ${e.targetWhere}`:void 0,o=e.setWhere?C` where ${e.setWhere}`:void 0,n=Array.isArray(e.target)?C`${e.target}`:C`${[e.target]}`,i=this.dialect.buildUpdateSet(this.config.table,nb(this.config.table,e.set));return this.config.onConflict.push(C` on conflict ${n}${r} do update set ${i}${t}${o}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:kn(this.config.table)})}prepare(){return this._prepare(!1)}run=(e)=>this._prepare().run(e);all=(e)=>this._prepare().all(e);get=(e)=>this._prepare().get(e);values=(e)=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}});var yb,X5;var e8=S(()=>{$e();Ho();va();Jo();In();sr();Sr();qo();Nl();Qp();yb=class yb{constructor(e,t,r,o){this.table=e,this.session=t,this.dialect=r,this.withList=o}static[F]="SQLiteUpdateBuilder";set(e){return new X5(this.table,nb(this.table,e),this.session,this.dialect,this.withList)}};X5=class X5 extends vr{constructor(e,t,r,o,n){super();this.session=r,this.dialect=o,this.config={set:t,table:e,withList:n,joins:[]}}static[F]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return(t,r)=>{let o=Fp(t);if(typeof o==="string"&&this.config.joins.some((n)=>n.alias===o))throw Error(`Alias "${o}" is already used in this query`);if(typeof r==="function"){let n=this.config.from?oe(t,Rt)?t[he.Symbol.Columns]:oe(t,dt)?t._.selectedFields:oe(t,Wo)?t[pt].selectedFields:void 0:void 0;r=r(new Proxy(this.config.table[he.Symbol.Columns],new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),n&&new Proxy(n,new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:r,table:t,joinType:e,alias:o}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]==="function"){let t=e[0](new Proxy(this.config.table[he.Symbol.Columns],new at({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),r=Array.isArray(t)?t:[t];this.config.orderBy=r}else{let t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[Rt.Symbol.Columns]){return this.config.returning=an(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:kn(this.config.table)})}prepare(){return this._prepare(!1)}run=(e)=>this._prepare().run(e);all=(e)=>this._prepare().all(e);get=(e)=>this._prepare().get(e);values=(e)=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}});var f$=S(()=>{H5();Y5();hb();d$();e8()});var Yp;var t8=S(()=>{$e();Qt();Yp=class Yp extends Ee{constructor(e){super(Yp.buildEmbeddedCount(e.source,e.filters).queryChunks);this.params=e,this.session=e.session,this.sql=Yp.buildCount(e.source,e.filters)}sql;static[F]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return C`(select count(*) from ${e}${C.raw(" where ").if(t)}${t})`}static buildCount(e,t){return C`select count(*) from ${e}${C.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then((t)=>(e?.(),t),(t)=>{throw e?.(),t})}}});var h$,bb,m$;var r8=S(()=>{$e();Ho();Jp();h$=class h${constructor(e,t,r,o,n,i,s,a){this.mode=e,this.fullSchema=t,this.schema=r,this.tableNamesMap=o,this.table=n,this.tableConfig=i,this.dialect=s,this.session=a}static[F]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return this.mode==="sync"?new m$(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?e:{},"many"):new bb(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?e:{},"many")}findFirst(e){return this.mode==="sync"?new m$(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new bb(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}};bb=class bb extends vr{constructor(e,t,r,o,n,i,s,a,l){super();this.fullSchema=e,this.schema=t,this.tableNamesMap=r,this.table=o,this.tableConfig=n,this.dialect=i,this.session=s,this.config=a,this.mode=l}static[F]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=!1){let{query:t,builtQuery:r}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](r,void 0,this.mode==="first"?"get":"all",!0,(o,n)=>{let i=o.map((s)=>cb(this.schema,this.tableConfig,s,t.selection,n));if(this.mode==="first")return i[0];return i})}prepare(){return this._prepare(!1)}_toSQL(){let e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare(!1).get();return this._prepare(!1).all()}async execute(){return this.executeRaw()}};m$=class m$ extends bb{static[F]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}});var Zl;var n8=S(()=>{$e();Ho();Zl=class Zl extends vr{constructor(e,t,r,o,n){super();this.execute=e,this.getSQL=t,this.dialect=o,this.mapBatchResult=n,this.config={action:r}}static[F]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}}});var Xp;var Sb=S(()=>{$e();va();Qt();f$();In();t8();r8();n8();Xp=class Xp{constructor(e,t,r,o){this.resultKind=e,this.dialect=t,this.session=r,this._=o?{schema:o.schema,fullSchema:o.fullSchema,tableNamesMap:o.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};let n=this.query;if(this._.schema)for(let[i,s]of Object.entries(this._.schema))n[i]=new h$(e,o.fullSchema,this._.schema,this._.tableNamesMap,o.fullSchema[i],s,t,r);this.$cache={invalidate:async(i)=>{}}}static[F]="BaseSQLiteDatabase";query;$with=(e,t)=>{let r=this;return{as:(n)=>{if(typeof n==="function")n=n(new wa(r.dialect));return new Proxy(new Bp(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,!0),new at({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count(e,t){return new Yp({source:e,filters:t,session:this.session})}with(...e){let t=this;function r(a){return new Rn({fields:a??void 0,session:t.session,dialect:t.dialect,withList:e})}function o(a){return new Rn({fields:a??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})}function n(a){return new yb(a,t.session,t.dialect,e)}function i(a){return new gb(a,t.session,t.dialect,e)}function s(a){return new db(a,t.session,t.dialect,e)}return{select:r,selectDistinct:o,update:n,insert:i,delete:s}}select(e){return new Rn({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new Rn({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(e){return new yb(e,this.session,this.dialect)}$cache;insert(e){return new gb(e,this.session,this.dialect)}delete(e){return new db(e,this.session,this.dialect)}run(e){let t=typeof e==="string"?C.raw(e):e.getSQL();if(this.resultKind==="async")return new Zl(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session));return this.session.run(t)}all(e){let t=typeof e==="string"?C.raw(e):e.getSQL();if(this.resultKind==="async")return new Zl(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session));return this.session.all(t)}get(e){let t=typeof e==="string"?C.raw(e):e.getSQL();if(this.resultKind==="async")return new Zl(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session));return this.session.get(t)}values(e){let t=typeof e==="string"?C.raw(e):e.getSQL();if(this.resultKind==="async")return new Zl(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session));return this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}}});async function g$(e,t){let r=`${e}-${JSON.stringify(t)}`,n=new TextEncoder().encode(r),i=await crypto.subtle.digest("SHA-256",n);return[...new Uint8Array(i)].map((l)=>l.toString(16).padStart(2,"0")).join("")}var o8,ef;var y$=S(()=>{$e();o8=class o8{static[F]="Cache"};ef=class ef extends o8{strategy(){return"all"}static[F]="NoopCache";async get(e){return}async put(e,t,r,o){}async onMutate(e){}}});var i8=S(()=>{y$()});function vb(e,t){return new Proxy(e,new Sa(t,!1))}var s8=S(()=>{Wp()});var a8,b$,S$,v$;var w$=S(()=>{y$();$e();pb();Ho();Sb();a8=class a8 extends vr{constructor(e){super();this.resultCb=e}static[F]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}};b$=class b${constructor(e,t,r,o,n,i){if(this.mode=e,this.executeMethod=t,this.query=r,this.cache=o,this.queryMetadata=n,this.cacheConfig=i,o&&o.strategy()==="all"&&i===void 0)this.cacheConfig={enable:!0,autoInvalidate:!0};if(!this.cacheConfig?.enable)this.cacheConfig=void 0}static[F]="PreparedQuery";joinsNotNullableMap;async queryWithCache(e,t,r){if(this.cache===void 0||oe(this.cache,ef)||this.queryMetadata===void 0)try{return await r()}catch(o){throw new Vo(e,t,o)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await r()}catch(o){throw new Vo(e,t,o)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[o]=await Promise.all([r(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return o}catch(o){throw new Vo(e,t,o)}if(!this.cacheConfig)try{return await r()}catch(o){throw new Vo(e,t,o)}if(this.queryMetadata.type==="select"){let o=await this.cache.get(this.cacheConfig.tag??await g$(e,t),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(o===void 0){let n;try{n=await r()}catch(i){throw new Vo(e,t,i)}return await this.cache.put(this.cacheConfig.tag??await g$(e,t),n,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),n}return o}try{return await r()}catch(o){throw new Vo(e,t,o)}}getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw Error("Not implemented")}mapGetResult(e,t){throw Error("Not implemented")}execute(e){if(this.mode==="async")return this[this.executeMethod](e);return new a8(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case"run":return this.mapRunResult(e,t);case"all":return this.mapAllResult(e,t);case"get":return this.mapGetResult(e,t)}}};S$=class S${constructor(e){this.dialect=e}static[F]="SQLiteSession";prepareOneTimeQuery(e,t,r,o,n,i,s){return this.prepareQuery(e,t,r,o,n,i,s)}run(e){let t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(r){throw new Dl({cause:r,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(e){throw Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(e){throw Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).values()}async count(e){return(await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw Error("Not implemented")}};v$=class v$ extends Xp{constructor(e,t,r,o,n=0){super(e,t,r,o);this.schema=o,this.nestedIndex=n}static[F]="SQLiteTransaction";rollback(){throw new o$}}});var x$,rge,nge,wb;var c8=S(()=>{$e();va();Sr();hb();Jo();Qp();x$=class x${constructor(e){this.name=e}static[F]="SQLiteViewBuilderCore";config={}};rge=class rge extends x${static[F]="SQLiteViewBuilder";as(e){if(typeof e==="function")e=e(new wa);let t=new at({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}),r=e.getSelectedFields();return new Proxy(new wb({config:{name:this.name,schema:void 0,selectedFields:r,query:e.getSQL().inlineParams()}}),t)}};nge=class nge extends x${static[F]="SQLiteManualViewBuilder";columns;constructor(e,t){super(e);this.columns=ob(Gp(e,t))}existing(){return new Proxy(new wb({config:{name:this.name,schema:void 0,selectedFields:this.columns,query:void 0}}),new at({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}as(e){return new Proxy(new wb({config:{name:this.name,schema:void 0,selectedFields:this.columns,query:e.inlineParams()}}),new at({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}};wb=class wb extends Wo{static[F]="SQLiteView";constructor({config:e}){super(e)}}});var xb=S(()=>{s8();Z5();s$();Sb();fb();KT();M5();F5();f$();w$();Jo();WT();Nl();c8()});function l8(e){return Object.keys(e).reduce((t,r)=>{if(Object.prototype.propertyIsEnumerable.call(e,r))t[r]=e[r];return t},{})}function _b(e){if(typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer){if(typeof Buffer<"u"){if(!(e instanceof Buffer))return Buffer.from(e);return e}if(typeof TextDecoder<"u")return new TextDecoder().decode(e);throw Error("TextDecoder is not available. Please provide either Buffer or TextDecoder polyfill.")}return e}var Eb,_$,u8;var E$=S(()=>{i8();$e();ib();Qt();xb();w$();Sr();Eb=class Eb extends S${constructor(e,t,r,o,n){super(t);this.client=e,this.schema=r,this.options=o,this.tx=n,this.logger=o.logger??new BT,this.cache=o.cache??new ef}static[F]="LibSQLSession";logger;cache;prepareQuery(e,t,r,o,n,i,s){return new u8(this.client,e,this.logger,this.cache,i,s,t,this.tx,r,o,n)}async batch(e){let t=[],r=[];for(let n of e){let i=n._prepare(),s=i.getQuery();t.push(i),r.push({sql:s.sql,args:s.params})}return(await this.client.batch(r)).map((n,i)=>t[i].mapResult(n,!0))}async migrate(e){let t=[],r=[];for(let n of e){let i=n._prepare(),s=i.getQuery();t.push(i),r.push({sql:s.sql,args:s.params})}return(await this.client.migrate(r)).map((n,i)=>t[i].mapResult(n,!0))}async transaction(e,t){let r=await this.client.transaction(),o=new Eb(this.client,this.dialect,this.schema,this.options,r),n=new _$("async",this.dialect,o,this.schema);try{let i=await e(n);return await r.commit(),i}catch(i){throw await r.rollback(),i}}extractRawAllValueFromBatchResult(e){return e.rows}extractRawGetValueFromBatchResult(e){return e.rows[0]}extractRawValuesValueFromBatchResult(e){return e.rows}};_$=class _$ extends v${static[F]="LibSQLTransaction";async transaction(e){let t=`sp${this.nestedIndex}`,r=new _$("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(C.raw(`savepoint ${t}`));try{let o=await e(r);return await this.session.run(C.raw(`release savepoint ${t}`)),o}catch(o){throw await this.session.run(C.raw(`rollback to savepoint ${t}`)),o}}};u8=class u8 extends b${constructor(e,t,r,o,n,i,s,a,l,u,d){super("async",l,t,o,n,i);this.client=e,this.logger=r,this.fields=s,this.tx=a,this._isResponseInArrayMode=u,this.customResultMapper=d,this.customResultMapper=d,this.fields=s}static[F]="LibSQLPreparedQuery";async run(e){let t=Mp(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>{let r={sql:this.query.sql,args:t};return this.tx?this.tx.execute(r):this.client.execute(r)})}async all(e){let{fields:t,logger:r,query:o,tx:n,client:i,customResultMapper:s}=this;if(!t&&!s){let l=Mp(o.params,e??{});return r.logQuery(o.sql,l),await this.queryWithCache(o.sql,l,async()=>{let u={sql:o.sql,args:l};return(n?n.execute(u):i.execute(u)).then(({rows:d})=>this.mapAllResult(d))})}let a=await this.values(e);return this.mapAllResult(a)}mapAllResult(e,t){if(t)e=e.rows;if(!this.fields&&!this.customResultMapper)return e.map((r)=>l8(r));if(this.customResultMapper)return this.customResultMapper(e,_b);return e.map((r)=>LT(this.fields,Array.prototype.slice.call(r).map((o)=>_b(o)),this.joinsNotNullableMap))}async get(e){let{fields:t,logger:r,query:o,tx:n,client:i,customResultMapper:s}=this;if(!t&&!s){let l=Mp(o.params,e??{});return r.logQuery(o.sql,l),await this.queryWithCache(o.sql,l,async()=>{let u={sql:o.sql,args:l};return(n?n.execute(u):i.execute(u)).then(({rows:d})=>this.mapGetResult(d))})}let a=await this.values(e);return this.mapGetResult(a)}mapGetResult(e,t){if(t)e=e.rows;let r=e[0];if(!this.fields&&!this.customResultMapper)return l8(r);if(!r)return;if(this.customResultMapper)return this.customResultMapper(e,_b);return LT(this.fields,Array.prototype.slice.call(r).map((o)=>_b(o)),this.joinsNotNullableMap)}async values(e){let t=Mp(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>{let r={sql:this.query.sql,args:t};return(this.tx?this.tx.execute(r):this.client.execute(r)).then(({rows:o})=>o)})}isResponseInArrayMode(){return this._isResponseInArrayMode}}});function jl(e,t={}){let r=new c$({casing:t.casing}),o;if(t.logger===!0)o=new jT;else if(t.logger!==!1)o=t.logger;let n;if(t.schema){let a=X3(t.schema,t5);n={fullSchema:t.schema,schema:a.tables,tableNamesMap:a.tableNamesMap}}let i=new Eb(e,r,n,{logger:o,cache:t.cache},void 0),s=new d8("async",r,i,n);if(s.$client=e,s.$cache=t.cache,s.$cache)s.$cache.invalidate=t.cache?.onMutate;return s}var d8;var p8=S(()=>{$e();ib();Jp();Sb();fb();E$();d8=class d8 extends Xp{static[F]="LibSQLDatabase";async batch(e){return this.session.batch(e)}}});function Ib(...e){if(typeof e[0]==="string"){let t=Ol({url:e[0]});return jl(t,e[1])}if($3(e[0])){let{connection:t,client:r,...o}=e[0];if(r)return jl(r,o);let n=typeof t==="string"?Ol({url:t}):Ol(t);return jl(n,o)}return jl(e[0],e[1])}var f8=S(()=>{AT();Sr();p8();((e)=>{function t(r){return jl({},r)}e.mock=t})(Ib||(Ib={}))});var m8=S(()=>{f8();E$()});function oge(){return new Promise((e)=>setTimeout(e,0))}function sge(){if(I$)return;I$=!0,setTimeout(()=>{I$=!1,A$=performance.now()},0)}async function tf(e=ige){if(sge(),performance.now()-A$<e)return;await oge(),A$=performance.now()}var ige=50,A$,I$=!1;var h8=S(()=>{A$=performance.now()});function g8(e){if(e.authToken!==void 0)return e.authToken;if(e.authTokenEnv===void 0)return;return process.env[e.authTokenEnv]}function uge(e){return e instanceof Ce&&/^SQLITE_(?:BUSY|LOCKED)$/u.test(e.code)}async function Ab(e,t){let r=Date.now()+(t.budgetMs??age),o=async(n)=>{if(t.isClosed())throw new Ce("The client is closed","CLIENT_CLOSED");try{return await e()}catch(i){if(t.isClosed()||!uge(i))throw i;await t.afterRefusal?.();let s=Math.min(cge*2**(n-1),lge),a=s/2+Math.random()*(s/2);if(t.isClosed()||Date.now()+a>=r)throw i;if(await new Promise((l)=>setTimeout(l,a)),t.isClosed()||Date.now()>=r)throw i;return o(n+1)}};return o(1)}function k$(e,t={}){let r=Ol({...e,...e.url.startsWith("file:")?{timeout:0}:{}});if(e.url.startsWith("file:")&&e.syncUrl===void 0){let o=r.transaction.bind(r),n=()=>r.closed,i=t.contentionRetryBudgetMs,s=r.execute.bind(r),a=r.batch.bind(r),l=r.migrate.bind(r),u={isClosed:n,budgetMs:i,afterRefusal:async()=>{await Promise.resolve(r.reconnect())}};async function d(p,m){return await tf(),Ab(()=>typeof p==="string"?s(p,m):s(p),u)}r.execute=d,r.batch=async(p,m)=>(await tf(),Ab(()=>a(p,m),u)),r.migrate=async(p)=>(await tf(),Ab(()=>l(p),u)),r.transaction=async(p)=>(await tf(),Ab(()=>o(p),u))}return r}function kb(e){let{url:t,schema:r}=e,o=g8(e),n={contentionRetryBudgetMs:e.contentionRetryBudgetMs},i=o?k$({url:t,authToken:o},n):k$({url:t},n);return{db:Ib(i,{schema:r}),client:i,url:t}}async function Rb(e,t){if(!t.startsWith("file:"))return;for(let r of["PRAGMA busy_timeout = 0","PRAGMA journal_mode = WAL"])await e.execute(r)}var age=5000,cge=5,lge=40;var R$=S(()=>{AT();m8();h8()});var y8=S(()=>{UR();R$()});var T$=S(()=>{R$();y8()});var $$=S(()=>{Wp();Yy();En();$e();pb();ib();Ho();Jp();i$();In();sr();Sr();qo()});var Y,Me;var O$=S(()=>{xb();$$();mp();Y=Gp("job_queue",{id:ft("id").primaryKey().$defaultFn(()=>Lo()),type:ft("type").notNull(),data:ft("data").notNull(),result:ft("result",{mode:"json"}),progress:ft("progress",{mode:"json"}).$type(),source:ft("source"),metadata:ft("metadata",{mode:"json"}).$type().notNull(),status:ft("status",{enum:["pending","processing","completed","failed"]}).notNull().default("pending"),priority:ar("priority").notNull().default(0),retryCount:ar("retryCount").notNull().default(0),maxRetries:ar("maxRetries").notNull().default(3),lastError:ft("lastError"),lastErrorPublic:ft("lastErrorPublic",{mode:"json"}),createdAt:ar("createdAt").notNull().$defaultFn(()=>Date.now()),scheduledFor:ar("scheduledFor").notNull().$defaultFn(()=>Date.now()),startedAt:ar("startedAt"),completedAt:ar("completedAt"),attemptId:ft("attemptId"),workerSlotId:ft("workerSlotId"),workerSessionId:ft("workerSessionId"),leaseExpiresAt:ar("leaseExpiresAt"),attemptHeartbeatAt:ar("attemptHeartbeatAt"),runtimeUpdatedAt:ar("runtimeUpdatedAt"),brainVersion:ft("brainVersion"),brainVersionSortKey:ft("brainVersionSortKey")},(e)=>({queueReadyIdx:Ko("idx_job_queue_ready").on(e.status,e.priority,e.scheduledFor),jobTypeIdx:Ko("idx_job_queue_type").on(e.type,e.status),runtimeUpdatesIdx:Ko("idx_job_queue_runtime_updates").on(e.runtimeUpdatedAt,e.id),jobSourceIdx:Ko("idx_job_queue_source").on(e.source),rootJobIdx:Ko("idx_job_queue_root_job").on(C`json_extract(${e.metadata}, '$.rootJobId')`,e.createdAt,e.id),deduplicationIdx:Ko("idx_job_queue_deduplication").on(e.type,C`json_extract(${e.metadata}, '$.deduplicationKey')`,e.status)})),Me=Gp("job_worker_sessions",{slotId:ft("slotId").primaryKey(),sessionId:ft("sessionId").notNull().unique(),startedAt:ar("startedAt").notNull(),heartbeatAt:ar("heartbeatAt").notNull(),expiresAt:ar("expiresAt").notNull().default(0),brainVersion:ft("brainVersion"),brainVersionSortKey:ft("brainVersionSortKey"),stableSlotId:ft("stableSlotId")},(e)=>({heartbeatIdx:Ko("idx_job_worker_sessions_heartbeat").on(e.heartbeatAt),expiresIdx:Ko("idx_job_worker_sessions_expires").on(e.expiresAt)}))});function b8(e){return kb({url:e.url,schema:{jobQueue:Y,jobWorkerSessions:Me},authToken:e.authToken,authTokenEnv:"JOB_QUEUE_DATABASE_AUTH_TOKEN",contentionRetryBudgetMs:0})}var S8=S(()=>{T$();O$()});class C${declarations=new Map;handlers=new Map;validators=new Map;logger;mode;finalizedRegistrations;constructor(e,t){this.logger=e.child("HandlerRegistry"),this.mode=t}registerHandler(e,t,r){if(this.finalizedRegistrations)throw Error("Job handler registrations are finalized");if(this.declarations.has(e))throw Error(`Job handler is already registered for type: ${e}`);if(this.declarations.set(e,{handler:t,pluginId:r}),this.validators.set(e,t),this.mode!=="validation-only")this.handlers.set(e,t);this.logger.debug("Registered job execution declaration",{type:e,pluginId:r,mode:this.mode})}unregisterHandler(e){this.declarations.delete(e),this.handlers.delete(e),this.validators.delete(e),this.logger.debug("Unregistered job handler",{type:e})}unregisterPluginHandlers(e){let t=[...this.declarations.entries()].filter(([,r])=>r.pluginId===e).map(([r])=>r);for(let r of t)this.declarations.delete(r),this.handlers.delete(r),this.validators.delete(r);if(t.length>0)this.logger.debug("Unregistered plugin handlers",{pluginId:e,count:t.length,types:t})}finalizeRegistrations(){return this.finalizedRegistrations??=Object.freeze([...this.declarations.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>Object.freeze({type:e,pluginId:t.pluginId}))),this.finalizedRegistrations}getExecutionRegistrations(){return this.finalizedRegistrations}getRegisteredTypes(){return[...this.handlers.keys()]}getExclusiveTypes(){return[...this.handlers].filter(([,e])=>e.exclusive===!0).map(([e])=>e)}getHandler(e){return this.handlers.get(e)}getValidator(e){return this.validators.get(e)}}class P${tails=new Map;async run(e,t){let r=this.tails.get(e),o=()=>{},n=new Promise((i)=>{o=i});this.tails.set(e,n),await r;try{return await t()}finally{if(o(),this.tails.get(e)===n)this.tails.delete(e)}}}class z${findDuplicate(e,t,r){if(!t||t==="none")return null;let o=this.filterByDeduplicationKey(e,r).sort((i,s)=>s.createdAt-i.createdAt||s.id.localeCompare(i.id)),n=o.find((i)=>i.status===Oe.PENDING)??null;if(t==="skip"||t==="replace")return n;return n??o[0]??null}filterByDeduplicationKey(e,t){if(!t)return e;return e.filter((r)=>{let o=dge.safeParse(r.metadata);return o.success&&o.data.deduplicationKey===t})}}var dge;var v8=S(()=>{de();Zo();dge=c.looseObject({deduplicationKey:c.string().optional()})});function _8(e){return`${String(e.length).padStart(2,"0")}${e}`}function fge(e){return pge.test(e)?`0${_8(e)}`:`1${e}`}function rf(e){let t=w8.exec(e);if(!t)throw Error(`Invalid brain version "${e}"`);let[,r="",o="",n="",i]=t,s=[r,o,n].map(_8).join("");return i===void 0?`${s}~`:`${s}-${i.split(".").map(fge).join("!")}`}var w8,pge,x8;var N$=S(()=>{de();w8=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/u,pge=/^\d+$/u,x8=c.string().regex(w8,"Brain version must be a semver version")});function E8(e){return JSON.stringify(new Ci(e).toJSON())}class D${db;transactionClient;databaseUrl;logger;deduplicator=new z$;writeRetryBudgetMs;constructor(e,t,r,o,n){this.db=e,this.transactionClient=t,this.databaseUrl=r,this.logger=o.child("JobQueueRepository"),this.writeRetryBudgetMs=n?.writeRetryBudgetMs??mge}async insert(e){await this.write("insert",async()=>this.db.insert(Y).values(e))}async enqueueAtomic(e){return bge.run(this.databaseUrl,async()=>{let t=Date.now()+this.writeRetryBudgetMs;return this.attemptEnqueue(e,t,1)})}async attemptEnqueue(e,t,r){let o=await this.runEnqueueTransaction(e,t,r);if(o.retry)return this.attemptEnqueue(e,t,r+1);return o.decision}async runEnqueueTransaction(e,t,r){let o=await this.acquireWriteTransaction(e,t),n={prepared:!1},i=!1;try{let s=await this.decideEnqueue(o,e,()=>{n.prepared=!0});return i=!0,await o.commit(),{retry:!1,decision:s}}catch(s){let a=i&&this.isSerializationConflict(s)&&!o.closed,l=!0;if(!o.closed)try{await o.rollback()}catch(u){l=!1,this.logger.error("Failed to roll back atomic enqueue",{type:e.jobData.type,rollbackError:u})}if(n.prepared)e.onInsertRollback?.();if(!a||!l)throw s;return await this.waitForConflictRetry("commit",e,t,r,s),{retry:!0}}finally{o.close()}}async decideEnqueue(e,t,r){let{jobData:o,strategy:n,deduplicationKey:i,beforeInsert:s}=t,a=n??"none",l=async()=>{await s?.(),r()},u=async()=>{await l(),await this.insertJob(e,o)};if(a==="none")return await u(),{kind:"inserted",jobId:o.id};let d=await this.getActiveDeduplicationCandidates(e,o.type,i),p=this.deduplicator.findDuplicate(d,a,i);if(!p)return await u(),{kind:"inserted",jobId:o.id};if(a==="skip")return await this.raiseBrainVersion(e,p.id,o),{kind:"skipped",jobId:p.id};if(a==="coalesce"){if(await this.raiseBrainVersion(e,p.id,o),(await e.execute({sql:"UPDATE `job_queue` SET `scheduledFor` = ? WHERE `id` = ? AND `status` = ?",args:[Date.now(),p.id,p.status]})).rowsAffected!==1)throw Error(`Atomic coalesce lost selected job ${p.id}`);return{kind:"coalesced",jobId:p.id}}await l();let m=Date.now();if((await e.execute({sql:"UPDATE `job_queue`\n SET `status` = ?,\n `lastError` = ?,\n `lastErrorPublic` = ?,\n `completedAt` = ?,\n `runtimeUpdatedAt` = max(?, coalesce((SELECT max(`runtimeUpdatedAt`) FROM `job_queue`), 0) + 1)\n WHERE `id` = ? AND `status` = ?",args:[Oe.FAILED,"Replaced by newer job",E8("cancelled"),m,m,p.id,Oe.PENDING]})).rowsAffected!==1)throw Error(`Atomic replace lost selected job ${p.id}`);return await this.insertJob(e,o),{kind:"replaced",jobId:o.id,replacedJobId:p.id}}async getActiveDeduplicationCandidates(e,t,r){return(await e.execute(r?{sql:"SELECT `id`, `status`, `createdAt`, `metadata`\n FROM `job_queue`\n WHERE `type` = ?\n AND json_extract(`metadata`, '$.deduplicationKey') = ?\n AND `status` IN (?, ?)",args:[t,r,Oe.PENDING,Oe.PROCESSING]}:{sql:"SELECT `id`, `status`, `createdAt`, `metadata`\n FROM `job_queue`\n WHERE `type` = ? AND `status` IN (?, ?)",args:[t,Oe.PENDING,Oe.PROCESSING]})).rows.map((n)=>this.parseDeduplicationCandidate(n))}parseDeduplicationCandidate(e){let{id:t,status:r,createdAt:o,metadata:n}=e;if(typeof t!=="string"||r!==Oe.PENDING&&r!==Oe.PROCESSING||typeof o!=="number"&&typeof o!=="bigint"||typeof n!=="string")throw Error("Invalid active job row returned during atomic enqueue");let i=JSON.parse(n);return{id:t,status:r,createdAt:Number(o),metadata:i}}async raiseBrainVersion(e,t,r){if(!r.brainVersion)return;let o=rf(r.brainVersion);await e.execute({sql:"UPDATE `job_queue`\n SET `brainVersion` = ?, `brainVersionSortKey` = ?\n WHERE `id` = ?\n AND (`brainVersionSortKey` IS NULL OR `brainVersionSortKey` < ?)",args:[r.brainVersion,o,t,o]})}async insertJob(e,t){if((await e.execute({sql:"INSERT INTO `job_queue` (\n `id`, `type`, `data`, `result`, `source`, `metadata`,\n `status`, `priority`, `retryCount`, `maxRetries`,\n `lastError`, `createdAt`, `scheduledFor`, `startedAt`,\n `completedAt`, `brainVersion`, `brainVersionSortKey`\n ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",args:[t.id,t.type,t.data,this.serializeJson(t.result),t.source,JSON.stringify(t.metadata),t.status,t.priority,t.retryCount,t.maxRetries,t.lastError,t.createdAt,t.scheduledFor,t.startedAt,t.completedAt,t.brainVersion??null,t.brainVersion?rf(t.brainVersion):null]})).rowsAffected!==1)throw Error(`Atomic enqueue did not insert job ${t.id}`)}serializeJson(e){if(e===void 0||e===null)return null;return JSON.stringify(e)}acquireWriteTransaction(e,t){return this.retryOnConflict("acquire",e,()=>this.transactionClient.transaction("write"),(r)=>this.isSerializationConflict(r),t)}async waitForConflictRetry(e,t,r,o,n){let i=Math.min(hge*2**(o-1),gge),s=i/2+Math.random()*(i/2);if(Date.now()+s>=r)throw this.transactionConflictError(e,t,o,n);await new Promise((a)=>setTimeout(a,s))}async retryOnConflict(e,t,r,o,n=Date.now()+this.writeRetryBudgetMs,i=1){try{return await r()}catch(s){if(!o(s))throw s;return await this.waitForConflictRetry(e,t,n,i,s),this.retryOnConflict(e,t,r,o,n,i+1)}}transactionConflictError(e,t,r,o){if(typeof t==="string")return Error(`Failed job queue write "${t}" within ${this.writeRetryBudgetMs}ms after ${r} attempts`,{cause:o});let n=t.strategy??"none",i=t.deduplicationKey?"present":"absent";return Error(`Failed to ${e} atomic enqueue transaction for type "${t.jobData.type}" within ${this.writeRetryBudgetMs}ms after ${r} attempts (strategy: ${n}, key: ${i})`,{cause:o})}write(e,t){return this.retryOnConflict("write",e,t,(r)=>{let o=new Set;for(let n=r;n!==void 0&&!o.has(n);){if(o.add(n),typeof n==="object"&&n!==null&&"code"in n&&/^SQLITE_(?:BUSY|LOCKED)(?:_|$)/u.test(String(n.code)))return!0;n=n instanceof Error?n.cause:void 0}return!1})}isSerializationConflict(e){for(let t=e;t!==void 0;){let r=typeof t==="object"&&t!==null&&"code"in t?String(t.code):"",o=Ve(t,"");if(/SQLITE_(?:BUSY|LOCKED)/u.test(r)||/SQLITE_(?:BUSY|LOCKED)|database is locked|transaction (?:busy|conflict)/iu.test(o))return!0;t=t instanceof Error?t.cause:void 0}return!1}async startWorkerSession(e,t,r=Date.now(),o=Hi,n,i){let s=r+o,a={brainVersion:n??null,brainVersionSortKey:n?rf(n):null,stableSlotId:i??null};await this.write("start worker session",async()=>{await this.db.insert(Me).values({slotId:e,sessionId:t,startedAt:r,heartbeatAt:r,expiresAt:s,...a}).onConflictDoUpdate({target:Me.slotId,set:{sessionId:t,startedAt:r,heartbeatAt:r,expiresAt:s,...a}}),await this.pruneDeadWorkerSessions(r,o)})}async heartbeatWorkerSession(e,t,r=Date.now(),o=Hi){return(await this.write("heartbeat worker session",async()=>{let i=await this.db.update(Me).set({heartbeatAt:r,expiresAt:r+o}).where(tt(je(Me.slotId,e),je(Me.sessionId,t))).returning({slotId:Me.slotId});return await this.pruneDeadWorkerSessions(r,o),i})).length===1}async pruneDeadWorkerSessions(e,t){let r=this.db.select({id:Y.id}).from(Y).where(tt(je(Y.workerSlotId,Me.slotId),je(Y.workerSessionId,Me.sessionId),je(Y.status,Oe.PROCESSING),An(Y.leaseExpiresAt,e)));await this.db.delete(Me).where(tt(ns(Me.expiresAt,e-t),is(r)))}async endWorkerSession(e,t){return(await this.write("end worker session",async()=>this.db.delete(Me).where(tt(je(Me.slotId,e),je(Me.sessionId,t))).returning({slotId:Me.slotId}))).length===1}async complete(e,t,r){let o=Date.now(),i=(await this.write("complete",async()=>this.db.update(Y).set({status:Oe.COMPLETED,result:t,lastError:null,lastErrorPublic:null,completedAt:o,runtimeUpdatedAt:this.nextRuntimeUpdatedAt(o)}).where(this.attemptWriteGuard(e,r)).returning({id:Y.id}))).length===1;if(i)this.logger.debug("Job completed",{jobId:e,hasResult:t!==void 0});return i}async update(e,t,r){let n=(await this.write("update",async()=>this.db.update(Y).set({data:JSON.stringify(t)}).where(this.attemptWriteGuard(e,r)).returning({id:Y.id}))).length===1;if(n)this.logger.debug("Job data updated",{jobId:e});return n}async recordAttemptProgress(e,t,r,o=Date.now()){return(await this.write("record progress",async()=>this.db.update(Y).set({attemptHeartbeatAt:o,runtimeUpdatedAt:this.nextRuntimeUpdatedAt(o),progress:r}).where(this.attemptWriteGuard(e,t)).returning({id:Y.id}))).length===1}async renewAttemptLease(e,t,r,o){return(await this.write("renew attempt lease",async()=>this.db.update(Y).set({attemptHeartbeatAt:r,leaseExpiresAt:r+o}).where(this.attemptWriteGuard(e,t)).returning({id:Y.id}))).length===1}async release(e,t,r=Date.now()){return(await this.write("release",async()=>this.db.update(Y).set({status:Oe.PENDING,scheduledFor:r,startedAt:null,attemptId:null,workerSlotId:null,workerSessionId:null,leaseExpiresAt:null,attemptHeartbeatAt:null}).where(this.attemptWriteGuard(e,t)).returning({id:Y.id}))).length===1}async fail(e,t,r,o=Date.now()){let i=(await this.db.select({retryCount:Y.retryCount,maxRetries:Y.maxRetries,type:Y.type,scheduledFor:Y.scheduledFor,startedAt:Y.startedAt,runtimeUpdatedAt:Y.runtimeUpdatedAt}).from(Y).where(this.attemptWriteGuard(e,r)).limit(1))[0];if(!i)return!1;let s=i.retryCount<i.maxRetries,a=s?i.retryCount+1:i.retryCount,l=Math.min(1000*2**i.retryCount,60000),u=s?o+l:i.scheduledFor;if((await this.write("fail",async()=>this.db.update(Y).set({status:s?Oe.PENDING:Oe.FAILED,retryCount:a,lastError:t.message,lastErrorPublic:ng(t).toJSON(),scheduledFor:u,completedAt:s?null:o,runtimeUpdatedAt:s?i.runtimeUpdatedAt:this.nextRuntimeUpdatedAt(o),startedAt:s?null:i.startedAt,attemptId:null,workerSlotId:null,workerSessionId:null,leaseExpiresAt:null,attemptHeartbeatAt:null}).where(tt(this.attemptWriteGuard(e,r),je(Y.retryCount,i.retryCount))).returning({id:Y.id}))).length!==1)return!1;if(s)this.logger.debug("Job scheduled for retry",{jobId:e,retryCount:a,backoffMs:l,scheduledFor:new Date(u).toISOString()});else this.logger.error("Job failed after max retries",{jobId:e,type:i.type,retryCount:i.retryCount,error:t.message});return!0}async retireUnownedActiveJob(e){let t=e.reason.trim();if(t.length===0)throw Error("Retired job reason must not be empty");let o=(await this.write("retire unowned job",async()=>this.db.update(Y).set({status:Oe.FAILED,lastError:t,lastErrorPublic:new Ci("no_handler").toJSON(),completedAt:e.now,runtimeUpdatedAt:this.nextRuntimeUpdatedAt(e.now)}).where(tt(je(Y.id,e.jobId),je(Y.type,e.expectedType),cn(je(Y.status,Oe.PENDING),je(Y.status,Oe.PROCESSING)),qr(Y.attemptId),qr(Y.workerSlotId),qr(Y.workerSessionId),qr(Y.leaseExpiresAt),qr(Y.attemptHeartbeatAt),qr(Y.progress),qr(Y.result))).returning()))[0]??null;if(o)this.logger.warn("Retired unowned legacy job",{jobId:o.id,type:o.type,reason:t});return o}async getStatus(e){return(await this.db.select().from(Y).where(je(Y.id,e)).limit(1))[0]??null}async getJobsByRootJobId(e){return this.db.select().from(Y).where(C`json_extract(${Y.metadata}, '$.rootJobId') = ${e}`).orderBy(Fo(Y.createdAt),Fo(Y.id))}async getStatusByEntityId(e){return(await this.db.select().from(Y).where(C`json_extract(${Y.data}, '$.id') = ${e}`).orderBy(ba(Y.createdAt)).limit(1))[0]??null}async getStats(){let e=await this.db.select({status:Y.status,count:C`count(*)`}).from(Y).groupBy(Y.status),t={pending:0,processing:0,failed:0,completed:0,total:0};for(let r of e){let o=Number(r.count);t[r.status]=o,t.total+=o}return t}async getDiagnostics(e=Date.now()){let[t,r,o]=await Promise.all([this.db.select({type:Y.type,status:Y.status,count:C`count(*)`}).from(Y).groupBy(Y.type,Y.status),this.db.select({oldestPendingAt:C`min(case when ${Y.status} = ${Oe.PENDING} then ${Y.createdAt} end)`,duePending:C`coalesce(sum(case when ${Y.status} = ${Oe.PENDING} and ${Y.scheduledFor} <= ${e} then 1 else 0 end), 0)`,oldestDuePendingAt:C`min(case when ${Y.status} = ${Oe.PENDING} and ${Y.scheduledFor} <= ${e} then ${Y.scheduledFor} end)`,latestClaimAt:C`max(${Y.startedAt})`,oldestProcessingAt:C`min(case when ${Y.status} = ${Oe.PROCESSING} then ${Y.startedAt} end)`,staleLeaseCount:C`coalesce(sum(case when ${Y.status} = ${Oe.PROCESSING} and ${Y.leaseExpiresAt} is not null and ${Y.leaseExpiresAt} <= ${e} then 1 else 0 end), 0)`}).from(Y),this.db.select({total:C`count(*)`,active:C`coalesce(sum(case when ${Me.expiresAt} > ${e} then 1 else 0 end), 0)`,stale:C`coalesce(sum(case when ${Me.expiresAt} <= ${e} then 1 else 0 end), 0)`,latestHeartbeatAt:C`max(${Me.heartbeatAt})`}).from(Me)]),n={pending:0,processing:0,completed:0,failed:0},i=t.map((u)=>{let d=Number(u.count);return n[u.status]+=d,{type:u.type,status:u.status,count:d}}),s=r[0],a=o[0],l=(u)=>u===null||u===void 0?null:Math.max(0,e-Number(u));return{totals:n,byType:i,oldestPendingAgeMs:l(s?.oldestPendingAt),duePending:Number(s?.duePending??0),oldestDuePendingAgeMs:l(s?.oldestDuePendingAt),latestClaimAgeMs:l(s?.latestClaimAt),oldestProcessingAgeMs:l(s?.oldestProcessingAt),staleLeaseCount:Number(s?.staleLeaseCount??0),workerSessions:{total:Number(a?.total??0),active:Number(a?.active??0),stale:Number(a?.stale??0),latestHeartbeatAgeMs:l(a?.latestHeartbeatAt)}}}async getRuntimeUpdates(e,t){let r=yge.parse(t);if(r===0)return[];return(await this.db.select().from(Y).where(C`(${Y.runtimeUpdatedAt}, ${Y.id}) > (${e.updatedAt}, ${e.jobId})`).orderBy(Fo(Y.runtimeUpdatedAt),Fo(Y.id)).limit(r)).map((n)=>({job:n,cursor:{updatedAt:n.runtimeUpdatedAt??0,jobId:n.id}}))}async cleanup(e){let t=Date.now()-e;return(await this.write("cleanup",async()=>this.db.delete(Y).where(tt(cn(je(Y.status,Oe.COMPLETED),je(Y.status,Oe.FAILED)),ns(Y.completedAt,t))))).rowsAffected}async getActiveJobs(e){let t=cn(je(Y.status,Oe.PENDING),je(Y.status,Oe.PROCESSING)),r=e&&e.length>0?tt(t,os(Y.type,e)):t;return this.db.select().from(Y).where(r).orderBy(ba(Y.createdAt))}async getRecentJobs(e,t=20){let r=e&&e.length>0?os(Y.type,e):void 0;return this.db.select().from(Y).where(r).orderBy(ba(Y.createdAt)).limit(t)}async getFailedJobs(e){let t=je(Y.status,Oe.FAILED),r=e&&e.length>0?tt(t,os(Y.type,e)):t;return this.db.select().from(Y).where(r).orderBy(ba(Y.createdAt))}async claimNextReady(e){let{now:t,attemptId:r,workerSlotId:o,workerSessionId:n,leaseDurationMs:i,executableTypes:s,exclusiveTypes:a=[],brainVersion:l}=e,u=l?this.brainVersionGate(l,t):{admissible:void 0,noNewerWorker:void 0},d=this.db.select({slotId:Me.slotId}).from(Me).where(tt(je(Me.slotId,o),je(Me.sessionId,n),An(Me.expiresAt,t))),p=this.noNewerLiveInstance(o,n,t),m=this.db.select({slotId:Me.slotId}).from(Me).where(tt(je(Me.slotId,Y.workerSlotId),je(Me.sessionId,Y.workerSessionId))),h=tt(je(Y.status,Oe.PROCESSING),cn(qr(Y.attemptId),is(m),ns(Y.leaseExpiresAt,t))),b=vb(Y,"running"),y=this.db.select({id:b.id}).from(b).where(tt(je(b.type,Y.type),je(b.status,Oe.PROCESSING),An(b.leaseExpiresAt,t),C`${b.id} <> ${Y.id}`)),v=a.length===0?void 0:cn(sb(Y.type,[...a]),is(y)),x=C`${Y.status} = ${Oe.PROCESSING} AND ${Y.retryCount} + 1 > ${Y.maxRetries}`,_=this.db.select({id:Y.id}).from(Y).where(tt(os(Y.type,s),v,u.admissible,cn(tt(je(Y.status,Oe.PENDING),ns(Y.scheduledFor,t)),h))).orderBy(Fo(Y.priority),Fo(Y.createdAt)).limit(1),O=(await this.write("claim",async()=>this.db.update(Y).set({status:C`CASE WHEN ${x} THEN ${Oe.FAILED} ELSE ${Oe.PROCESSING} END`,retryCount:C`CASE WHEN ${Y.status} = ${Oe.PROCESSING} THEN ${Y.retryCount} + 1 ELSE ${Y.retryCount} END`,lastError:C`CASE WHEN ${Y.status} = ${Oe.PROCESSING} THEN 'Attempt lease expired' ELSE ${Y.lastError} END`,lastErrorPublic:C`CASE WHEN ${Y.status} = ${Oe.PROCESSING} THEN ${E8("deadline_exceeded")} ELSE ${Y.lastErrorPublic} END`,startedAt:C`CASE WHEN ${x} THEN ${Y.startedAt} ELSE ${t} END`,completedAt:C`CASE WHEN ${x} THEN ${t} ELSE NULL END`,attemptId:C`CASE WHEN ${x} THEN ${Y.attemptId} ELSE ${r} END`,workerSlotId:C`CASE WHEN ${x} THEN ${Y.workerSlotId} ELSE ${o} END`,workerSessionId:C`CASE WHEN ${x} THEN ${Y.workerSessionId} ELSE ${n} END`,leaseExpiresAt:C`CASE WHEN ${x} THEN ${Y.leaseExpiresAt} ELSE ${t+i} END`,attemptHeartbeatAt:C`CASE WHEN ${x} THEN ${Y.attemptHeartbeatAt} ELSE ${t} END`,runtimeUpdatedAt:C`CASE WHEN ${x} THEN ${this.nextRuntimeUpdatedAt(t)} ELSE ${Y.runtimeUpdatedAt} END`}).where(tt(os(Y.id,_),ab(d),p,u.noNewerWorker)).returning()))[0];if(!O)return null;if(O.status===Oe.FAILED)return O;return this.logger.debug("Job claimed",{jobId:O.id,attemptId:O.attemptId,workerSlotId:o,workerSessionId:n}),O}noNewerLiveInstance(e,t,r){let o=vb(Me,"claimer"),n=vb(Me,"peer"),i=this.db.select({slotId:n.slotId}).from(n).innerJoin(o,tt(je(o.slotId,e),je(o.sessionId,t))).where(tt(je(n.stableSlotId,o.stableSlotId),An(n.expiresAt,r),cn(An(n.startedAt,o.startedAt),tt(je(n.startedAt,o.startedAt),An(n.slotId,o.slotId)))));return is(i)}brainVersionGate(e,t){let r=rf(e),o=this.db.select({slotId:Me.slotId}).from(Me).where(tt(An(Me.expiresAt,t),An(Me.brainVersionSortKey,r)));return{admissible:cn(qr(Y.brainVersionSortKey),ns(Y.brainVersionSortKey,r)),noNewerWorker:is(o)}}nextRuntimeUpdatedAt(e){return C`max(${e}, coalesce((select max(${Y.runtimeUpdatedAt}) from ${Y}), 0) + 1)`}attemptWriteGuard(e,t){return t?tt(je(Y.id,e),je(Y.status,Oe.PROCESSING),je(Y.attemptId,t)):tt(je(Y.id,e),qr(Y.attemptId),cn(je(Y.status,Oe.PENDING),je(Y.status,Oe.PROCESSING)))}}var mge=2000,hge=5,gge=40,yge,bge;var I8=S(()=>{$$();xb();O$();wt();de();Zo();gp();v8();N$();yge=c.number().int().min(0).max(1000),bge=new P$});import{AsyncLocalStorage as Sge}from"async_hooks";class Bl{storage=new Sge;static createFresh(){return new Bl}constructor(){}current(){return this.storage.getStore()}run(e,t,r){if(t.length===0)throw Error("Operation ID must not be empty");let o=Ro.parse(e),n=vge(o);return this.storage.run(Object.freeze({provenance:n,operationId:t}),r)}}function vge(e){if(Object.freeze(e.projectionLineage),e.sourceEntity)Object.freeze(e.sourceEntity);return Object.freeze(e)}var Tb=S(()=>{wt()});class nf{client;logger;handlerRegistry;repository;walInitialization=null;walInitializationSettled=!1;closeRequested=!1;clientClosed=!1;inFlightEnqueues=0;databaseUrl;operationContext;projectionAdmission;directWorkerSlotId=`direct:${Lo()}`;directWorkerSessionId=Lo();directLeaseDurationMs;directSessionStart=null;brainVersion;close(){this.closeRequested=!0,this.closeClientWhenReady()}static createFresh(e,t,r){return new nf(e,t??Rr.getInstance(),r)}constructor(e,t,r){this.brainVersion=e.brainVersion===void 0?void 0:x8.parse(e.brainVersion);let{db:o,client:n,url:i}=b8(e);this.client=n,this.databaseUrl=i,this.logger=t.child("JobQueueService"),this.operationContext=r?.operationContext??Bl.createFresh(),this.projectionAdmission=r?.projectionAdmission,this.handlerRegistry=new C$(this.logger,r?.handlerRegistrationMode??"combined"),this.repository=new D$(o,n,i,this.logger),this.directLeaseDurationMs=e.claimTimeoutMs??300000}initialize(){if(this.closeRequested)return Promise.resolve();return this.walInitialization??=this.initializeWALMode(),this.walInitialization}async initializeWALMode(){try{await Rb(this.client,this.databaseUrl)}catch(e){this.logger.warn("Failed to enable WAL mode (non-fatal)",e)}finally{this.walInitializationSettled=!0,this.closeClientWhenReady()}}closeClientWhenReady(){if(!this.closeRequested||this.inFlightEnqueues>0||this.walInitialization!==null&&!this.walInitializationSettled)return;this.closeClient()}closeClient(){if(this.clientClosed)return;this.clientClosed=!0,this.client.close()}registerHandler(e,t,r){this.handlerRegistry.registerHandler(e,t,r)}unregisterHandler(e){this.handlerRegistry.unregisterHandler(e)}unregisterPluginHandlers(e){this.handlerRegistry.unregisterPluginHandlers(e)}getRegisteredTypes(){return this.handlerRegistry.getRegisteredTypes()}getHandler(e){return this.handlerRegistry.getHandler(e)}getValidator(e){return this.handlerRegistry.getValidator(e)}finalizeHandlerRegistrations(){return this.handlerRegistry.finalizeRegistrations()}getExecutionRegistrations(){return this.handlerRegistry.getExecutionRegistrations()}async enqueue(e){if(this.closeRequested)throw Error("Cannot enqueue a job after the queue service is closed");this.inFlightEnqueues++;try{return await this.enqueueValidated(e)}finally{this.inFlightEnqueues--,this.closeClientWhenReady()}}async enqueueValidated(e){let{type:t,data:r,options:o}=e,n=this.handlerRegistry.getValidator(t);if(!n)throw Error(`No job type declared: ${t}`);let i=n.validateAndParse(r);if(i===null)throw Error(`Invalid job data for type: ${t}`);let s=Date.now(),a=Lo(),l=o?.rootJobId??(o?.detached?a:this.operationContext.current()?.provenance.rootJobId)??a,u=this.createJobProvenance(a,l,o),d=o?.metadata??{operationType:"data_processing"},{provenance:p,...m}=d,h={id:a,type:t,data:JSON.stringify(i),status:Oe.PENDING,priority:o?.priority??0,maxRetries:o?.maxRetries??3,retryCount:0,source:o?.source??null,metadata:{...m,...o?.deduplicationKey&&{deduplicationKey:o.deduplicationKey},rootJobId:l,provenance:u},createdAt:s,scheduledFor:o?.delayMs?s+o.delayMs:s,result:null,lastError:null,startedAt:null,completedAt:null,brainVersion:this.brainVersion},b,y=()=>{b?.rollback(),b=void 0};try{let v=await this.repository.enqueueAtomic({jobData:h,strategy:o?.deduplication,deduplicationKey:o?.deduplicationKey,beforeInsert:async()=>{b=await this.projectionAdmission?.reserveJobAdmission(u)},onInsertRollback:y});if(b?.commit(),b=void 0,v.kind==="skipped")this.logger.debug("Skipping duplicate job (already pending)",{type:t,existingJobId:v.jobId});else if(v.kind==="coalesced")this.logger.debug("Coalescing with existing job",{type:t,existingJobId:v.jobId});else{if(v.kind==="replaced")this.logger.debug("Replacing duplicate job",{type:t,oldJobId:v.replacedJobId});this.logger.debug("Job enqueued",{id:v.jobId,type:t,priority:h.priority,rootJobId:h.metadata.rootJobId})}return v.jobId}catch(v){throw y(),this.logger.error("Failed to enqueue job",{type:t,error:Ve(v)}),v}}createJobProvenance(e,t,r){let o=this.operationContext.current(),n=r?.metadata.provenance??o?.provenance,i=n?.rootJobId===t?n:void 0,s=o?.provenance.rootJobId===t?o.operationId:void 0,a=r?.projection,l=a?[...i?.projectionLineage??[],a.id]:[...i?.projectionLineage??[]],u=a?.id??i?.projectionId;return Ro.parse({rootJobId:t,causationId:s??i?.causationId??e,...u?{projectionId:u}:{},projectionLineage:l,...a?.sourceEntity?{sourceEntity:a.sourceEntity}:i?.sourceEntity?{sourceEntity:i.sourceEntity}:{},derivationDepth:l.length})}async dequeue(e){let t=this.handlerRegistry.getRegisteredTypes();if(t.length===0)return null;let{onTerminalReclaim:r,...o}=e??await this.getDirectClaimOptions(),n=Date.now(),i=await this.repository.claimNextReady({...o,workerSlotId:this.sessionSlotId(o.workerSlotId,o.workerSessionId),brainVersion:this.brainVersion,now:n,attemptId:Lo(),executableTypes:t,exclusiveTypes:this.handlerRegistry.getExclusiveTypes()});if(!i)return null;if(i.status===Oe.FAILED)return this.logger.warn("Expired attempt failed terminally on reclaim",{id:i.id,type:i.type,retryCount:i.retryCount}),await r?.(i),null;return this.logger.debug("Job dequeued",{id:i.id,type:i.type,priority:i.priority,retryCount:i.retryCount,attemptId:i.attemptId,workerSlotId:i.workerSlotId,workerSessionId:i.workerSessionId}),i}async startWorkerSession(e,t,r=Hi){await this.repository.startWorkerSession(this.sessionSlotId(e,t),t,Date.now(),r,this.brainVersion,this.versionedSlotId(e))}heartbeatWorkerSession(e,t,r=Hi){return this.repository.heartbeatWorkerSession(this.sessionSlotId(e,t),t,Date.now(),r)}endWorkerSession(e,t){return this.repository.endWorkerSession(this.sessionSlotId(e,t),t)}versionedSlotId(e){return this.brainVersion?`${e}@${this.brainVersion}`:e}sessionSlotId(e,t){return`${this.versionedSlotId(e)}#${t}`}renewAttemptLease(e,t,r){return this.repository.renewAttemptLease(e,t,Date.now(),r)}recordAttemptProgress(e,t,r){return this.repository.recordAttemptProgress(e,t,r)}complete(e,t,r){return this.repository.complete(e,t,r)}update(e,t,r){return this.repository.update(e,t,r)}fail(e,t,r){return this.repository.fail(e,t,r)}release(e,t){return this.repository.release(e,t)}retireUnownedActiveJob(e){return this.repository.retireUnownedActiveJob(e)}async getDirectClaimOptions(){return this.directSessionStart??=this.repository.startWorkerSession(this.sessionSlotId(this.directWorkerSlotId,this.directWorkerSessionId),this.directWorkerSessionId,Date.now(),this.directLeaseDurationMs,this.brainVersion),await this.directSessionStart,{workerSlotId:this.directWorkerSlotId,workerSessionId:this.directWorkerSessionId,leaseDurationMs:this.directLeaseDurationMs}}async getStatus(e){return this.repository.getStatus(e)}async getJobsByRootJobId(e){return this.repository.getJobsByRootJobId(e)}async getStatusByEntityId(e){return this.repository.getStatusByEntityId(e)}async getStats(){return this.repository.getStats()}getDiagnostics(e){return this.repository.getDiagnostics(e)}async waitForIdle(e={}){let t=e.quietMs??250,r=e.pollIntervalMs??25,o=Date.now()+(e.timeoutMs??30000),n=async(i)=>{e.signal?.throwIfAborted();let{totals:s}=await this.getDiagnostics(),l=s.pending===0&&s.processing===0?i??Date.now():null;if(l!==null&&Date.now()-l>=t)return;if(Date.now()>=o)throw Error(`Timed out waiting for the job queue to settle: ${s.pending} pending, ${s.processing} processing`);return await Bun.sleep(r),n(l)};return n(null)}getRuntimeUpdates(e,t=1000){return this.repository.getRuntimeUpdates(e,t)}async cleanup(e){let t=await this.repository.cleanup(e);if(t>0)this.logger.info("Cleaned up old jobs",{deletedCount:t,olderThanMs:e});return t}async getActiveJobs(e){return this.repository.getActiveJobs(e)}async getRecentJobs(e,t){return this.repository.getRecentJobs(e,t)}async getFailedJobs(e){return this.repository.getFailedJobs(e)}}var A8=S(()=>{mp();UR();gp();Zo();T$();S8();I8();wt();Tb();N$()});var L$=()=>{};var k8=S(()=>{mp();Zo();gp();Zo();L$();Tb()});var R8=S(()=>{Zo();L$()});var $b,T8;var Z$=S(()=>{de();$b=c.object({success:c.boolean(),data:c.unknown().optional(),error:c.string().optional(),code:c.string().optional()}),T8=c.object({id:c.string().min(1),timestamp:c.string(),type:c.string().min(1),source:c.string().min(1),target:c.string().optional(),metadata:c.record(c.string(),c.unknown()).optional()})});var o8e;var $8=S(()=>{de();Z$();o8e=c.union([c.object({noop:c.literal(!0)}),$b])});var Ob=S(()=>{$8()});var O8=S(()=>{Ob()});var C8=S(()=>{Ob()});var P8=S(()=>{C8()});var x8e;var j$=S(()=>{de();x8e=c.looseObject({issues:c.array(c.looseObject({message:c.string()})).optional()})});var z8=S(()=>{O8();Ob();P8();j$();wt();Tb()});var $ge;var N8=S(()=>{de();Z$();$ge=c.object({id:c.string().min(1),requestId:c.string().min(1),success:c.boolean(),data:c.unknown().optional(),error:c.object({message:c.string(),code:c.string().optional()}).optional(),timestamp:c.string().datetime()})});var B8e;var D8=S(()=>{wt();B8e=new Ci("invalid_response").toJSON()});var L8=S(()=>{z8();N8();j$();D8()});var iHe;var Z8=S(()=>{de();L8();hp();Zo();iHe=c.preprocess((e)=>{if(typeof e!=="string")return e;return JSON.parse(e)},c.record(c.string(),c.unknown()))});var cHe;var j8=S(()=>{de();cHe=c.record(c.string(),c.unknown())});var B8=S(()=>{wt();mp()});var U8=S(()=>{A8();k8();R8();Z8();j8();gp();Zo();hp();B8()});var B$={};Lt(B$,{LEGACY_PROJECTION_JOB_TYPES:()=>q8,LEGACY_PROJECTION_RETIREMENT_REASON:()=>H8,legacyProjectionJobTypeSchema:()=>F8,retireLegacyProjectionJob:()=>Nge});import{existsSync as Cge}from"fs";import{resolve as Pge}from"path";function M8(e){return{id:e.id,type:e.type,status:e.status,retryCount:e.retryCount,maxRetries:e.maxRetries,createdAt:e.createdAt,startedAt:e.startedAt,completedAt:e.completedAt}}function zge(e,t){if(e.type!==t)throw Error(`Job ${e.id} has type ${e.type}; expected ${t}`);if(e.status!=="pending"&&e.status!=="processing")throw Error(`Job ${e.id} is already terminal (${e.status})`);if(e.attemptId!==null||e.workerSlotId!==null||e.workerSessionId!==null||e.leaseExpiresAt!==null||e.attemptHeartbeatAt!==null)throw Error(`Job ${e.id} still has attempt ownership`);if(e.progress!==null||e.result!=null)throw Error(`Job ${e.id} contains partial progress or a result`)}async function Nge(e){let t=Pge(e.databasePath);if(!Cge(t))throw Error(`Job database does not exist: ${t}`);let r=F8.parse(e.jobType),o=nf.createFresh({url:`file:${t}`});try{let n=await o.getStatus(e.jobId);if(!n)throw Error(`Job not found: ${e.jobId}`);if(zge(n,r),e.dryRun){if(e.confirmation!==void 0)throw Error("Dry-run recovery must not include confirmation");return{databasePath:t,job:M8(n),retired:!1}}let i=`retire:${n.id}`;if(e.confirmation!==i)throw Error(`Refusing to retire ${n.id}; expected --confirm ${i}`);let s=await o.retireUnownedActiveJob({jobId:n.id,expectedType:r,reason:H8,now:e.now?.()??Date.now()});if(!s)throw Error(`Job ${n.id} changed or acquired ownership before retirement`);return{databasePath:t,job:M8(s),retired:!0}}finally{o.close()}}var q8,F8,H8="Retired legacy projection job superseded by scheduler-owned projections";var U$=S(()=>{U8();de();q8=["conversation-memory:project","skill:project","swot:derive","topic:project"],F8=c.enum(q8)});function Ut(e,t,r,o,n){return K8.parse({id:e,operation:t,count:r,targetProbeCount:o,settleMs:n})}function Q8(e){return zb.parse(structuredClone(Bge[e]))}function Nb(e){let t=`stress:${e.handle}`;if(e.confirmation!==t)throw Error(`Directory-sync stress requires --confirm ${t}`);let r=/(^|[-_.])smoke($|[-_.])/i;if(!r.test(e.handle)||!r.test(e.domain)||!r.test(e.contentRepo))throw Error("Directory-sync stress is smoke-only; handle, domain, and content repository must all identify smoke")}async function q$(e,t={}){let r=t.fetchImpl??fetch,o=t.now??(()=>new Date),n=t.timeoutMs??20000,i=o(),s=new AbortController,a=setTimeout(()=>s.abort(),n);try{let l=await r(e,{method:"GET",signal:s.signal});return await l.arrayBuffer(),M$.parse({timestamp:i.toISOString(),endpoint:new URL(e).pathname,status:l.status,durationMs:Math.max(0,o().getTime()-i.getTime()),ok:l.ok})}catch(l){return M$.parse({timestamp:i.toISOString(),endpoint:new URL(e).pathname,status:0,durationMs:Math.max(0,o().getTime()-i.getTime()),ok:!1,error:Mge(l)})}finally{clearTimeout(a)}}async function Y8(e,t){let r=zb.parse(e),o=[],n,i=await t.prepare(r),s,a;try{try{await t.startMonitoring()}catch(l){n=`monitor: ${Cb(l)}`}if(!n)for(let l of r.phases)try{let u=V8.parse(await t.executePhase(l,i));if(o.push(u),!u.success){n=`${l.id}: ${u.error??"phase failed"}`;break}}catch(u){let d=Cb(u);o.push({id:l.id,operation:l.operation,count:l.count,success:!1,error:d}),n=`${l.id}: ${d}`;break}}finally{try{if(s=W8.parse(await t.cleanup(i)),!s.success&&!n)n=s.error??"cleanup failed"}catch(l){let u=Cb(l);s={success:!1,probesRemaining:0,error:u},n??=`cleanup: ${u}`}try{a=G8.parse(await t.stopMonitoring())}catch(l){let u=Cb(l);a={health:[],runtime:[]},n??=`monitor: ${u}`}}return n??=Uge(a,r.maximumExternalAiCalls??0),jge.parse({profile:r.profile,success:n===void 0&&o.length===r.phases.length&&s.success,baseline:i,phases:o,cleanup:s,metrics:a,...n?{failure:n}:{}})}function Uge(e,t=0){let r=e.health.find((i)=>!i.ok);if(r)return`health: ${r.endpoint} unavailable`;let o=e.externalAiCalls??0;if(o>t)return t===0?`external AI: observed ${o} call(s)`:`external AI: observed ${o} call(s), cap ${t}`;if(e.container?.oomKilled)return"container: OOM killed";let n=e.container?.restartCount??0;if(n>0)return`container: restarted ${n} time(s)`;if(e.container&&e.container.status!=="running")return`container: ${e.container.status}`;return}function Mge(e){if(e instanceof Error)return`${e.name}: ${e.message}`;return String(e)}function Cb(e){return Ve(e)}var Pb,J8,K8,zb,Dge,M$,Lge,V8,W8,Zge,G8,jge,Bge;var F$=S(()=>{de();Pb=c.enum(["regression","load","stress"]),J8=c.enum(["add","update","rename","delete"]),K8=c.object({id:c.string().min(1),operation:J8,count:c.number().int().positive().max(700),targetProbeCount:c.number().int().min(0).max(700),settleMs:c.number().int().nonnegative().max(300000)}),zb=c.object({profile:Pb,maximumProbeCount:c.number().int().positive().max(700),maximumExternalAiCalls:c.number().int().nonnegative().max(1e4).optional(),phases:c.array(K8).min(1)}),Dge=c.object({entities:c.number().int().nonnegative(),notes:c.number().int().nonnegative(),version:c.string().min(1)}),M$=c.object({timestamp:c.iso.datetime(),endpoint:c.string().startsWith("/"),status:c.number().int().nonnegative(),durationMs:c.number().nonnegative(),ok:c.boolean(),error:c.string().optional()}),Lge=c.object({timestamp:c.iso.datetime(),cpuPercent:c.number().nonnegative(),memoryPercent:c.number().nonnegative(),pids:c.number().int().nonnegative()}),V8=c.object({id:c.string().min(1),operation:J8,count:c.number().int().positive(),success:c.boolean(),commitLatencyMs:c.number().nonnegative().optional(),persistenceLatencyMs:c.number().nonnegative().optional(),error:c.string().optional()}),W8=c.object({success:c.boolean(),probesRemaining:c.number().int().nonnegative(),finalEntities:c.number().int().nonnegative().optional(),finalNotes:c.number().int().nonnegative().optional(),contentTreeRestored:c.boolean().optional(),error:c.string().optional()}),Zge=c.object({status:c.string(),restartCount:c.number().int().nonnegative(),oomKilled:c.boolean()}),G8=c.object({health:c.array(M$),runtime:c.array(Lge),externalAiCalls:c.number().int().nonnegative().optional(),container:Zge.optional()}),jge=c.object({profile:Pb,success:c.boolean(),baseline:Dge,phases:c.array(V8),cleanup:W8,metrics:G8,failure:c.string().optional()}),Bge={regression:{profile:"regression",maximumProbeCount:20,phases:[Ut("add20","add",20,20,0),Ut("update20","update",20,20,30000),Ut("delete20","delete",20,0,150000)]},load:{profile:"load",maximumProbeCount:350,phases:[Ut("add50","add",50,50,0),Ut("add150","add",100,150,0),Ut("add350","add",200,350,0),Ut("update350a","update",350,350,45000),Ut("rename100","rename",100,350,45000),Ut("update350b","update",350,350,45000),Ut("delete350","delete",350,0,150000)]},stress:{profile:"stress",maximumProbeCount:700,phases:[Ut("add50","add",50,50,0),Ut("add150","add",100,150,0),Ut("add350","add",200,350,0),Ut("add700","add",350,700,0),Ut("update700a","update",700,700,45000),Ut("rename200","rename",200,700,45000),Ut("update700b","update",700,700,45000),Ut("delete700","delete",700,0,150000)]}}});import{spawn as qge}from"child_process";async function X8(e,t,r,o){let n=await e(t,r,o);if(n.exitCode!==0)throw ao(t,r,n);return n}function ao(e,t,r){let o=r.stderr.trim()||r.stdout.trim();return Error(`${e} ${t.join(" ")} exited with ${r.exitCode}${o?`: ${o}`:""}`)}var Go=async(e,t,r={})=>new Promise((o,n)=>{let i=qge(e,[...t],{cwd:r.cwd,env:r.env?{...process.env,...r.env}:process.env,stdio:["pipe","pipe","pipe"]}),s="",a="";i.stdout.setEncoding("utf8"),i.stderr.setEncoding("utf8"),i.stdout.on("data",(l)=>{s+=l}),i.stderr.on("data",(l)=>{a+=l}),i.on("error",n),i.on("close",(l)=>{o({exitCode:l??1,stdout:s,stderr:a})}),i.stdin.end(r.stdin)});var of=()=>{};class Ul{#e;#t;dir;constructor(e,t,r){this.#e=e,this.dir=t,this.#t=r}static async clone(e,t,r,o){let n=new Ul(e,r,o);return await X8(e,"git",["-c","credential.helper=","-c",`credential.helper=${eH}`,"clone","--branch","main","--single-branch",`https://github.com/${t}.git`,r],{env:n.environment()}),await n.run(["config","--local","credential.helper",eH]),await n.run(["reset","--hard","origin/main"]),n}async run(e,t=!0){let r=await this.#e("git",e,{cwd:this.dir,env:this.environment()});if(t&&r.exitCode!==0)throw ao("git",e,r);return r}async output(e){return(await this.run(e)).stdout.trim()}async sync(e=!1){if(await this.run(["fetch","origin","main"]),e)await this.run(["reset","--hard","origin/main"]);else await this.run(["pull","--rebase","origin","main"])}async commitAll(e){await this.run(["add","-A"]),await this.run(["-c","user.name=brains-ops","-c","user.email=ops@rizom.ai","commit","-m",e])}async pushMainWithRebase(){for(let e=1;e<=5;e+=1){if((await this.run(["push","origin","main"],!1)).exitCode===0)return;await this.run(["pull","--rebase","origin","main"])}throw Error("Unable to push content main after five rebase attempts")}async pruneStressBackupBranches(){let t=(await this.run(["ls-remote","--heads","origin","refs/heads/ops/directory-sync-stress-backup-*"])).stdout.split(/\r?\n/).map((r)=>r.match(/\trefs\/heads\/(ops\/directory-sync-stress-backup-[^\s]+)$/)?.[1]).filter((r)=>r!==void 0).sort();for(let r of t)await this.run(["push","origin","--delete",r]);return t}environment(){return{GH_TOKEN:this.#t,GITHUB_TOKEN:this.#t}}}var eH='!f() { test "$1" = get && echo username=x-access-token && echo "password=$GH_TOKEN"; }; f';var tH=S(()=>{of()});function sf(e){return e.entityCounts.find((t)=>t.entityType==="note")?.count??0}class H${#e;#t=[];#r=[];#n=new Set(["/health/ready"]);#o=!0;#i;#a;#s="";#c=0;#l;constructor(e){this.#e=e}get startedAt(){return this.#s}get error(){return this.#a}get healthSamples(){return this.#t}get runtimeSamples(){return this.#r}gateHealthSamples(){return this.#t.slice(this.#c,this.#l??this.#t.length)}markGateEnd(){this.#l=this.#t.length}async discoverEndpoints(){for(let e of["/health/live","/health/operate"])if((await q$(`https://${this.#e.domain}${e}`,{fetchImpl:this.#e.fetchImpl,now:this.#e.now,timeoutMs:5000})).status!==404)this.#n.add(e)}start(){this.#o=!1,this.#a=void 0,this.#c=this.#t.length,this.#l=void 0,this.#s=this.#e.now().toISOString(),this.#i=Promise.all([this.#m(),this.#f()]).then(()=>{return}).catch((e)=>{this.#a=e,this.#o=!0})}async stop(){this.#o=!0,await this.#i}async waitForHealthSnapshot(e){return this.waitForEntityBaseline(void 0,void 0,e)}async waitForEntityBaseline(e,t,r){let o=this.#e.now().getTime();while(this.#e.now().getTime()-o<r){let n=await this.fetchHealthPayload();if(this.#p(n,e,t))return n;await this.#e.sleep(5000)}return}async waitForStableEntityBaseline(e,t,r){let o=this.#e.now().getTime(),n=0;while(this.#e.now().getTime()-o<r){let i=await this.fetchHealthPayload();if(this.#p(i,e,t)){if(n+=1,n===2)return i}else n=0;await this.#e.sleep(5000)}return}async fetchHealthPayload(){let e=await this.#d();if(e===void 0)return;let t=await this.#e.readEntityCounts();if(!t)return;return{version:e,entities:t.reduce((r,o)=>r+o.count,0),entityCounts:t}}async#d(){let e=this.#e.now(),t=new AbortController,r=setTimeout(()=>t.abort(),20000);try{let o=await this.#e.fetchImpl(`https://${this.#e.domain}/health/operate`,{signal:t.signal}),n=await o.text();if(this.#t.push({timestamp:e.toISOString(),endpoint:"/health/operate",status:o.status,durationMs:Math.max(0,this.#e.now().getTime()-e.getTime()),ok:o.ok}),!o.ok)return;return Fge.parse(JSON.parse(n)).app.version}catch(o){this.#t.push({timestamp:e.toISOString(),endpoint:"/health/operate",status:0,durationMs:Math.max(0,this.#e.now().getTime()-e.getTime()),ok:!1,error:o instanceof Error?`${o.name}: ${o.message}`:String(o)});return}finally{clearTimeout(r)}}#p(e,t,r){return e!==void 0&&(t===void 0||sf(e)===t)&&(r===void 0||e.entities===r)}async#m(){while(!this.#o){for(let e of this.#n)this.#t.push(await q$(`https://${this.#e.domain}${e}`,{fetchImpl:this.#e.fetchImpl,now:this.#e.now,timeoutMs:20000}));await this.#e.sleep(4000)}}async#f(){while(!this.#o){let e=await this.#e.sampleRuntime();if(e)this.#r.push(e);await this.#e.sleep(1000)}}}var rH,Fge;var nH=S(()=>{de();F$();rH=c.array(c.object({entityType:c.string(),count:c.number().int().nonnegative()})),Fge=c.object({status:c.literal("ready"),operationalStatus:c.literal("operational"),app:c.object({version:c.string()})})});var Db={};Lt(Db,{applyDirectorySyncStressPhase:()=>aH,cleanupDirectorySyncStress:()=>tye,listProbeFiles:()=>xa,parseStressRuntimeSample:()=>cH,removeProbeFiles:()=>Y$,runDeployedDirectorySyncStress:()=>Xge,runStressCommand:()=>Go,verifyDirectorySyncStressAccess:()=>eye});import{chmod as Hge,mkdir as K$,mkdtemp as V$,readFile as Jge,readdir as Kge,rename as Vge,rm as cf,writeFile as Tn}from"fs/promises";import{tmpdir as W$}from"os";import{join as ct,resolve as G$}from"path";async function Xge(e){let t=e.now??(()=>new Date),r=t().toISOString(),o=X$(r),n=G$(e.artifactsDir??ct(e.rootDir,".brains-ops","stress",o));await K$(n,{recursive:!0});let{pilot:i,user:s}=await Q$(e.rootDir,e.handle);Nb({handle:s.handle,domain:s.domain,contentRepo:s.contentRepo,confirmation:e.confirmation});let a=Pb.parse(e.profile),l=e.plan?zb.parse(e.plan):Q8(a);if(l.profile!==a)throw Error(`Directory-sync stress plan profile ${l.profile} does not match requested profile ${a}`);if((l.maximumExternalAiCalls??0)===0)sH(s);let u=Wge.parse(e.env??process.env),d=new iH({runId:o,artifactsDir:n,user:s,githubOrg:i.githubOrg,serverLabel:`${i.contentRepoPrefix}${s.handle}`,environment:u,fetchImpl:e.fetchImpl??fetch,commandRunner:e.commandRunner??Go,logger:e.logger??console.info,now:t,sleep:e.sleep??Bun.sleep}),p;try{p=await Y8(l,d)}finally{await d.dispose()}let m={runId:o,artifactsDir:n,target:{handle:s.handle,domain:s.domain,contentRepo:`${i.githubOrg}/${s.contentRepo}`},startedAt:r,completedAt:t().toISOString(),report:p};return await oye(m),m}async function eye(e){let r=(e.now??(()=>new Date))().toISOString(),o=X$(r),n=G$(e.artifactsDir??ct(e.rootDir,".brains-ops","stress",`access-check-${o}`));await K$(n,{recursive:!0});let{pilot:i,user:s}=await Q$(e.rootDir,e.handle);Nb({handle:s.handle,domain:s.domain,contentRepo:s.contentRepo,confirmation:e.confirmation}),sH(s);let a=(e.env??process.env).CONTENT_REPO_ADMIN_TOKEN;if(!a)throw Error("Missing CONTENT_REPO_ADMIN_TOKEN");let l=await V$(ct(W$(),"brains-ops-directory-sync-access-check-"));try{let u=await Ul.clone(e.commandRunner??Go,`${i.githubOrg}/${s.contentRepo}`,ct(l,"content"),a),d=await u.output(["rev-parse","HEAD"]);await u.run(["push","--dry-run","origin",`HEAD:refs/heads/ops/directory-sync-stress-access-check-${o}`]);let p={success:!0,artifactsDir:n,checkedAt:r,remoteHead:d,target:{handle:s.handle,domain:s.domain,contentRepo:`${i.githubOrg}/${s.contentRepo}`}};return await Tn(ct(n,"access-check.json"),`${JSON.stringify(p,null,2)}
|
|
458
|
+
`;await t.run(n);let s=(await t.values(C`SELECT id, hash, created_at FROM ${C.identifier(o)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await t.transaction(async(a)=>{for(let l of e)if(!s||Number(s[2])<l.folderMillis){for(let u of l.sql)await a.run(C.raw(u));await a.run(C`INSERT INTO ${C.identifier(o)} ("hash", "created_at") VALUES(${l.hash}, ${l.folderMillis})`)}})}}});var l$;var G5=S(()=>{$e();l$=class l${static[F]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}});function mb(e,t){return(r,o,...n)=>{let i=[o,...n].map((s)=>({type:e,isAll:t,rightSelect:s}));for(let s of i)if(!qp(r.getSelectedFields(),s.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return r.addSetOperators(i)}}var Rn,Q5,u$,Qhe=()=>({union:Yhe,unionAll:Xhe,intersect:ege,except:tge}),Yhe,Xhe,ege,tge;var d$=S(()=>{$e();G5();Ho();va();Qt();In();sr();Sr();qo();Nl();Qp();Rn=class Rn{static[F]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){let t=!!this.fields,r;if(this.fields)r=this.fields;else if(oe(e,dt))r=Object.fromEntries(Object.keys(e._.selectedFields).map((o)=>[o,e[o]]));else if(oe(e,Wo))r=e[pt].selectedFields;else if(oe(e,Ee))r={};else r=ob(e);return new u$({table:e,fields:r,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}};Q5=class Q5 extends l${static[F]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:r,session:o,dialect:n,withList:i,distinct:s}){super();this.config={withList:i,table:e,fields:{...t},distinct:s,setOperators:[]},this.isPartialSelect=r,this.session=o,this.dialect=n,this._={selectedFields:t,config:this.config},this.tableName=Fp(e),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let a of kn(e))this.usedTables.add(a)}getUsedTables(){return[...this.usedTables]}createJoin(e){return(t,r)=>{let o=this.tableName,n=Fp(t);for(let i of kn(t))this.usedTables.add(i);if(typeof n==="string"&&this.config.joins?.some((i)=>i.alias===n))throw Error(`Alias "${n}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof o==="string")this.config.fields={[o]:this.config.fields};if(typeof n==="string"&&!oe(t,Ee)){let i=oe(t,dt)?t._.selectedFields:oe(t,sn)?t[pt].selectedFields:t[he.Symbol.Columns];this.config.fields[n]=i}}if(typeof r==="function")r=r(new Proxy(this.config.fields,new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:r,table:t,joinType:e,alias:n}),typeof n==="string")switch(e){case"left":{this.joinsNotNullableMap[n]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([i])=>[i,!1])),this.joinsNotNullableMap[n]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[n]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([i])=>[i,!1])),this.joinsNotNullableMap[n]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return(r)=>{let o=typeof r==="function"?r(Qhe()):r;if(!qp(this.getSelectedFields(),o.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:o}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){if(typeof e==="function")e=e(new Proxy(this.config.fields,new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=e,this}having(e){if(typeof e==="function")e=e(new Proxy(this.config.fields,new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=e,this}groupBy(...e){if(typeof e[0]==="function"){let t=e[0](new Proxy(this.config.fields,new at({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]==="function"){let t=e[0](new Proxy(this.config.fields,new at({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),r=Array.isArray(t)?t:[t];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=r;else this.config.orderBy=r}else{let t=e;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=t;else this.config.orderBy=t}return this}limit(e){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=e;else this.config.limit=e;return this}offset(e){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=e;else this.config.offset=e;return this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...kn(this.config.table)),this.config.joins)for(let r of this.config.joins)t.push(...kn(r.table));return new Proxy(new dt(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new at({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new at({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}};u$=class u$ extends Q5{static[F]="SQLiteSelect";_prepare(e=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let t=an(this.config.fields),r=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return r.joinsNotNullableMap=this.joinsNotNullableMap,r}$withCache(e){return this.cacheConfig=e===void 0?{config:{},enable:!0,autoInvalidate:!0}:e===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...e},this}prepare(){return this._prepare(!1)}run=(e)=>this._prepare().run(e);all=(e)=>this._prepare().all(e);get=(e)=>this._prepare().get(e);values=(e)=>this._prepare().values(e);async execute(){return this.all()}};T3(u$,[vr]);Yhe=mb("union",!1),Xhe=mb("union",!0),ege=mb("intersect",!1),tge=mb("except",!1)});var wa;var hb=S(()=>{$e();va();fb();In();d$();wa=class wa{static[F]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=oe(e,Ll)?e:void 0,this.dialectConfig=oe(e,Ll)?void 0:e}$with=(e,t)=>{let r=this;return{as:(n)=>{if(typeof n==="function")n=n(r);return new Proxy(new Bp(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,!0),new at({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...e){let t=this;function r(n){return new Rn({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e})}function o(n){return new Rn({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}return{select:r,selectDistinct:o}}select(e){return new Rn({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new Rn({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){if(!this.dialect)this.dialect=new a$(this.dialectConfig);return this.dialect}}});var gb,p$;var Y5=S(()=>{$e();Ho();Qt();Jo();sr();Sr();Nl();hb();gb=class gb{constructor(e,t,r,o){this.table=e,this.session=t,this.dialect=r,this.withList=o}static[F]="SQLiteInsertBuilder";values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw Error("values() must be called with at least one value");let t=e.map((r)=>{let o={},n=this.table[he.Symbol.Columns];for(let i of Object.keys(r)){let s=r[i];o[i]=oe(s,Ee)?s:new Mr(s,n[i])}return o});return new p$(this.table,t,this.session,this.dialect,this.withList)}select(e){let t=typeof e==="function"?e(new wa):e;if(!oe(t,Ee)&&!qp(this.table[tb],t._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new p$(this.table,t,this.session,this.dialect,this.withList,!0)}};p$=class p$ extends vr{constructor(e,t,r,o,n,i){super();this.session=r,this.dialect=o,this.config={table:e,values:t,withList:n,select:i}}static[F]="SQLiteInsert";config;returning(e=this.config.table[Rt.Symbol.Columns]){return this.config.returning=an(e),this}onConflictDoNothing(e={}){if(!this.config.onConflict)this.config.onConflict=[];if(e.target===void 0)this.config.onConflict.push(C` on conflict do nothing`);else{let t=Array.isArray(e.target)?C`${e.target}`:C`${[e.target]}`,r=e.where?C` where ${e.where}`:C``;this.config.onConflict.push(C` on conflict ${t} do nothing${r}`)}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');if(!this.config.onConflict)this.config.onConflict=[];let t=e.where?C` where ${e.where}`:void 0,r=e.targetWhere?C` where ${e.targetWhere}`:void 0,o=e.setWhere?C` where ${e.setWhere}`:void 0,n=Array.isArray(e.target)?C`${e.target}`:C`${[e.target]}`,i=this.dialect.buildUpdateSet(this.config.table,nb(this.config.table,e.set));return this.config.onConflict.push(C` on conflict ${n}${r} do update set ${i}${t}${o}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:kn(this.config.table)})}prepare(){return this._prepare(!1)}run=(e)=>this._prepare().run(e);all=(e)=>this._prepare().all(e);get=(e)=>this._prepare().get(e);values=(e)=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}});var yb,X5;var e8=S(()=>{$e();Ho();va();Jo();In();sr();Sr();qo();Nl();Qp();yb=class yb{constructor(e,t,r,o){this.table=e,this.session=t,this.dialect=r,this.withList=o}static[F]="SQLiteUpdateBuilder";set(e){return new X5(this.table,nb(this.table,e),this.session,this.dialect,this.withList)}};X5=class X5 extends vr{constructor(e,t,r,o,n){super();this.session=r,this.dialect=o,this.config={set:t,table:e,withList:n,joins:[]}}static[F]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return(t,r)=>{let o=Fp(t);if(typeof o==="string"&&this.config.joins.some((n)=>n.alias===o))throw Error(`Alias "${o}" is already used in this query`);if(typeof r==="function"){let n=this.config.from?oe(t,Rt)?t[he.Symbol.Columns]:oe(t,dt)?t._.selectedFields:oe(t,Wo)?t[pt].selectedFields:void 0:void 0;r=r(new Proxy(this.config.table[he.Symbol.Columns],new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),n&&new Proxy(n,new at({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:r,table:t,joinType:e,alias:o}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if(typeof e[0]==="function"){let t=e[0](new Proxy(this.config.table[he.Symbol.Columns],new at({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),r=Array.isArray(t)?t:[t];this.config.orderBy=r}else{let t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[Rt.Symbol.Columns]){return this.config.returning=an(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:kn(this.config.table)})}prepare(){return this._prepare(!1)}run=(e)=>this._prepare().run(e);all=(e)=>this._prepare().all(e);get=(e)=>this._prepare().get(e);values=(e)=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}});var f$=S(()=>{H5();Y5();hb();d$();e8()});var Yp;var t8=S(()=>{$e();Qt();Yp=class Yp extends Ee{constructor(e){super(Yp.buildEmbeddedCount(e.source,e.filters).queryChunks);this.params=e,this.session=e.session,this.sql=Yp.buildCount(e.source,e.filters)}sql;static[F]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return C`(select count(*) from ${e}${C.raw(" where ").if(t)}${t})`}static buildCount(e,t){return C`select count(*) from ${e}${C.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then((t)=>(e?.(),t),(t)=>{throw e?.(),t})}}});var h$,bb,m$;var r8=S(()=>{$e();Ho();Jp();h$=class h${constructor(e,t,r,o,n,i,s,a){this.mode=e,this.fullSchema=t,this.schema=r,this.tableNamesMap=o,this.table=n,this.tableConfig=i,this.dialect=s,this.session=a}static[F]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return this.mode==="sync"?new m$(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?e:{},"many"):new bb(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?e:{},"many")}findFirst(e){return this.mode==="sync"?new m$(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new bb(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}};bb=class bb extends vr{constructor(e,t,r,o,n,i,s,a,l){super();this.fullSchema=e,this.schema=t,this.tableNamesMap=r,this.table=o,this.tableConfig=n,this.dialect=i,this.session=s,this.config=a,this.mode=l}static[F]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=!1){let{query:t,builtQuery:r}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](r,void 0,this.mode==="first"?"get":"all",!0,(o,n)=>{let i=o.map((s)=>cb(this.schema,this.tableConfig,s,t.selection,n));if(this.mode==="first")return i[0];return i})}prepare(){return this._prepare(!1)}_toSQL(){let e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare(!1).get();return this._prepare(!1).all()}async execute(){return this.executeRaw()}};m$=class m$ extends bb{static[F]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}});var Zl;var n8=S(()=>{$e();Ho();Zl=class Zl extends vr{constructor(e,t,r,o,n){super();this.execute=e,this.getSQL=t,this.dialect=o,this.mapBatchResult=n,this.config={action:r}}static[F]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}}});var Xp;var Sb=S(()=>{$e();va();Qt();f$();In();t8();r8();n8();Xp=class Xp{constructor(e,t,r,o){this.resultKind=e,this.dialect=t,this.session=r,this._=o?{schema:o.schema,fullSchema:o.fullSchema,tableNamesMap:o.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};let n=this.query;if(this._.schema)for(let[i,s]of Object.entries(this._.schema))n[i]=new h$(e,o.fullSchema,this._.schema,this._.tableNamesMap,o.fullSchema[i],s,t,r);this.$cache={invalidate:async(i)=>{}}}static[F]="BaseSQLiteDatabase";query;$with=(e,t)=>{let r=this;return{as:(n)=>{if(typeof n==="function")n=n(new wa(r.dialect));return new Proxy(new Bp(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,!0),new at({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count(e,t){return new Yp({source:e,filters:t,session:this.session})}with(...e){let t=this;function r(a){return new Rn({fields:a??void 0,session:t.session,dialect:t.dialect,withList:e})}function o(a){return new Rn({fields:a??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})}function n(a){return new yb(a,t.session,t.dialect,e)}function i(a){return new gb(a,t.session,t.dialect,e)}function s(a){return new db(a,t.session,t.dialect,e)}return{select:r,selectDistinct:o,update:n,insert:i,delete:s}}select(e){return new Rn({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new Rn({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(e){return new yb(e,this.session,this.dialect)}$cache;insert(e){return new gb(e,this.session,this.dialect)}delete(e){return new db(e,this.session,this.dialect)}run(e){let t=typeof e==="string"?C.raw(e):e.getSQL();if(this.resultKind==="async")return new Zl(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session));return this.session.run(t)}all(e){let t=typeof e==="string"?C.raw(e):e.getSQL();if(this.resultKind==="async")return new Zl(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session));return this.session.all(t)}get(e){let t=typeof e==="string"?C.raw(e):e.getSQL();if(this.resultKind==="async")return new Zl(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session));return this.session.get(t)}values(e){let t=typeof e==="string"?C.raw(e):e.getSQL();if(this.resultKind==="async")return new Zl(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session));return this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}}});async function g$(e,t){let r=`${e}-${JSON.stringify(t)}`,n=new TextEncoder().encode(r),i=await crypto.subtle.digest("SHA-256",n);return[...new Uint8Array(i)].map((l)=>l.toString(16).padStart(2,"0")).join("")}var o8,ef;var y$=S(()=>{$e();o8=class o8{static[F]="Cache"};ef=class ef extends o8{strategy(){return"all"}static[F]="NoopCache";async get(e){return}async put(e,t,r,o){}async onMutate(e){}}});var i8=S(()=>{y$()});function vb(e,t){return new Proxy(e,new Sa(t,!1))}var s8=S(()=>{Wp()});var a8,b$,S$,v$;var w$=S(()=>{y$();$e();pb();Ho();Sb();a8=class a8 extends vr{constructor(e){super();this.resultCb=e}static[F]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}};b$=class b${constructor(e,t,r,o,n,i){if(this.mode=e,this.executeMethod=t,this.query=r,this.cache=o,this.queryMetadata=n,this.cacheConfig=i,o&&o.strategy()==="all"&&i===void 0)this.cacheConfig={enable:!0,autoInvalidate:!0};if(!this.cacheConfig?.enable)this.cacheConfig=void 0}static[F]="PreparedQuery";joinsNotNullableMap;async queryWithCache(e,t,r){if(this.cache===void 0||oe(this.cache,ef)||this.queryMetadata===void 0)try{return await r()}catch(o){throw new Vo(e,t,o)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await r()}catch(o){throw new Vo(e,t,o)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[o]=await Promise.all([r(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return o}catch(o){throw new Vo(e,t,o)}if(!this.cacheConfig)try{return await r()}catch(o){throw new Vo(e,t,o)}if(this.queryMetadata.type==="select"){let o=await this.cache.get(this.cacheConfig.tag??await g$(e,t),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(o===void 0){let n;try{n=await r()}catch(i){throw new Vo(e,t,i)}return await this.cache.put(this.cacheConfig.tag??await g$(e,t),n,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),n}return o}try{return await r()}catch(o){throw new Vo(e,t,o)}}getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw Error("Not implemented")}mapGetResult(e,t){throw Error("Not implemented")}execute(e){if(this.mode==="async")return this[this.executeMethod](e);return new a8(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case"run":return this.mapRunResult(e,t);case"all":return this.mapAllResult(e,t);case"get":return this.mapGetResult(e,t)}}};S$=class S${constructor(e){this.dialect=e}static[F]="SQLiteSession";prepareOneTimeQuery(e,t,r,o,n,i,s){return this.prepareQuery(e,t,r,o,n,i,s)}run(e){let t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(r){throw new Dl({cause:r,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(e){throw Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(e){throw Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).values()}async count(e){return(await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw Error("Not implemented")}};v$=class v$ extends Xp{constructor(e,t,r,o,n=0){super(e,t,r,o);this.schema=o,this.nestedIndex=n}static[F]="SQLiteTransaction";rollback(){throw new o$}}});var x$,rge,nge,wb;var c8=S(()=>{$e();va();Sr();hb();Jo();Qp();x$=class x${constructor(e){this.name=e}static[F]="SQLiteViewBuilderCore";config={}};rge=class rge extends x${static[F]="SQLiteViewBuilder";as(e){if(typeof e==="function")e=e(new wa);let t=new at({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}),r=e.getSelectedFields();return new Proxy(new wb({config:{name:this.name,schema:void 0,selectedFields:r,query:e.getSQL().inlineParams()}}),t)}};nge=class nge extends x${static[F]="SQLiteManualViewBuilder";columns;constructor(e,t){super(e);this.columns=ob(Gp(e,t))}existing(){return new Proxy(new wb({config:{name:this.name,schema:void 0,selectedFields:this.columns,query:void 0}}),new at({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}as(e){return new Proxy(new wb({config:{name:this.name,schema:void 0,selectedFields:this.columns,query:e.inlineParams()}}),new at({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}};wb=class wb extends Wo{static[F]="SQLiteView";constructor({config:e}){super(e)}}});var xb=S(()=>{s8();Z5();s$();Sb();fb();KT();M5();F5();f$();w$();Jo();WT();Nl();c8()});function l8(e){return Object.keys(e).reduce((t,r)=>{if(Object.prototype.propertyIsEnumerable.call(e,r))t[r]=e[r];return t},{})}function _b(e){if(typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer){if(typeof Buffer<"u"){if(!(e instanceof Buffer))return Buffer.from(e);return e}if(typeof TextDecoder<"u")return new TextDecoder().decode(e);throw Error("TextDecoder is not available. Please provide either Buffer or TextDecoder polyfill.")}return e}var Eb,_$,u8;var E$=S(()=>{i8();$e();ib();Qt();xb();w$();Sr();Eb=class Eb extends S${constructor(e,t,r,o,n){super(t);this.client=e,this.schema=r,this.options=o,this.tx=n,this.logger=o.logger??new BT,this.cache=o.cache??new ef}static[F]="LibSQLSession";logger;cache;prepareQuery(e,t,r,o,n,i,s){return new u8(this.client,e,this.logger,this.cache,i,s,t,this.tx,r,o,n)}async batch(e){let t=[],r=[];for(let n of e){let i=n._prepare(),s=i.getQuery();t.push(i),r.push({sql:s.sql,args:s.params})}return(await this.client.batch(r)).map((n,i)=>t[i].mapResult(n,!0))}async migrate(e){let t=[],r=[];for(let n of e){let i=n._prepare(),s=i.getQuery();t.push(i),r.push({sql:s.sql,args:s.params})}return(await this.client.migrate(r)).map((n,i)=>t[i].mapResult(n,!0))}async transaction(e,t){let r=await this.client.transaction(),o=new Eb(this.client,this.dialect,this.schema,this.options,r),n=new _$("async",this.dialect,o,this.schema);try{let i=await e(n);return await r.commit(),i}catch(i){throw await r.rollback(),i}}extractRawAllValueFromBatchResult(e){return e.rows}extractRawGetValueFromBatchResult(e){return e.rows[0]}extractRawValuesValueFromBatchResult(e){return e.rows}};_$=class _$ extends v${static[F]="LibSQLTransaction";async transaction(e){let t=`sp${this.nestedIndex}`,r=new _$("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(C.raw(`savepoint ${t}`));try{let o=await e(r);return await this.session.run(C.raw(`release savepoint ${t}`)),o}catch(o){throw await this.session.run(C.raw(`rollback to savepoint ${t}`)),o}}};u8=class u8 extends b${constructor(e,t,r,o,n,i,s,a,l,u,d){super("async",l,t,o,n,i);this.client=e,this.logger=r,this.fields=s,this.tx=a,this._isResponseInArrayMode=u,this.customResultMapper=d,this.customResultMapper=d,this.fields=s}static[F]="LibSQLPreparedQuery";async run(e){let t=Mp(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>{let r={sql:this.query.sql,args:t};return this.tx?this.tx.execute(r):this.client.execute(r)})}async all(e){let{fields:t,logger:r,query:o,tx:n,client:i,customResultMapper:s}=this;if(!t&&!s){let l=Mp(o.params,e??{});return r.logQuery(o.sql,l),await this.queryWithCache(o.sql,l,async()=>{let u={sql:o.sql,args:l};return(n?n.execute(u):i.execute(u)).then(({rows:d})=>this.mapAllResult(d))})}let a=await this.values(e);return this.mapAllResult(a)}mapAllResult(e,t){if(t)e=e.rows;if(!this.fields&&!this.customResultMapper)return e.map((r)=>l8(r));if(this.customResultMapper)return this.customResultMapper(e,_b);return e.map((r)=>LT(this.fields,Array.prototype.slice.call(r).map((o)=>_b(o)),this.joinsNotNullableMap))}async get(e){let{fields:t,logger:r,query:o,tx:n,client:i,customResultMapper:s}=this;if(!t&&!s){let l=Mp(o.params,e??{});return r.logQuery(o.sql,l),await this.queryWithCache(o.sql,l,async()=>{let u={sql:o.sql,args:l};return(n?n.execute(u):i.execute(u)).then(({rows:d})=>this.mapGetResult(d))})}let a=await this.values(e);return this.mapGetResult(a)}mapGetResult(e,t){if(t)e=e.rows;let r=e[0];if(!this.fields&&!this.customResultMapper)return l8(r);if(!r)return;if(this.customResultMapper)return this.customResultMapper(e,_b);return LT(this.fields,Array.prototype.slice.call(r).map((o)=>_b(o)),this.joinsNotNullableMap)}async values(e){let t=Mp(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>{let r={sql:this.query.sql,args:t};return(this.tx?this.tx.execute(r):this.client.execute(r)).then(({rows:o})=>o)})}isResponseInArrayMode(){return this._isResponseInArrayMode}}});function jl(e,t={}){let r=new c$({casing:t.casing}),o;if(t.logger===!0)o=new jT;else if(t.logger!==!1)o=t.logger;let n;if(t.schema){let a=X3(t.schema,t5);n={fullSchema:t.schema,schema:a.tables,tableNamesMap:a.tableNamesMap}}let i=new Eb(e,r,n,{logger:o,cache:t.cache},void 0),s=new d8("async",r,i,n);if(s.$client=e,s.$cache=t.cache,s.$cache)s.$cache.invalidate=t.cache?.onMutate;return s}var d8;var p8=S(()=>{$e();ib();Jp();Sb();fb();E$();d8=class d8 extends Xp{static[F]="LibSQLDatabase";async batch(e){return this.session.batch(e)}}});function Ib(...e){if(typeof e[0]==="string"){let t=Ol({url:e[0]});return jl(t,e[1])}if($3(e[0])){let{connection:t,client:r,...o}=e[0];if(r)return jl(r,o);let n=typeof t==="string"?Ol({url:t}):Ol(t);return jl(n,o)}return jl(e[0],e[1])}var f8=S(()=>{AT();Sr();p8();((e)=>{function t(r){return jl({},r)}e.mock=t})(Ib||(Ib={}))});var m8=S(()=>{f8();E$()});function oge(){return new Promise((e)=>setTimeout(e,0))}function sge(){if(I$)return;I$=!0,setTimeout(()=>{I$=!1,A$=performance.now()},0)}async function tf(e=ige){if(sge(),performance.now()-A$<e)return;await oge(),A$=performance.now()}var ige=50,A$,I$=!1;var h8=S(()=>{A$=performance.now()});function g8(e){if(e.authToken!==void 0)return e.authToken;if(e.authTokenEnv===void 0)return;return process.env[e.authTokenEnv]}function uge(e){return e instanceof Ce&&/^SQLITE_(?:BUSY|LOCKED)$/u.test(e.code)}async function Ab(e,t){let r=Date.now()+(t.budgetMs??age),o=async(n)=>{if(t.isClosed())throw new Ce("The client is closed","CLIENT_CLOSED");try{return await e()}catch(i){if(t.isClosed()||!uge(i))throw i;await t.afterRefusal?.();let s=Math.min(cge*2**(n-1),lge),a=s/2+Math.random()*(s/2);if(t.isClosed()||Date.now()+a>=r)throw i;if(await new Promise((l)=>setTimeout(l,a)),t.isClosed()||Date.now()>=r)throw i;return o(n+1)}};return o(1)}function k$(e,t={}){let r=Ol({...e,...e.url.startsWith("file:")?{timeout:0}:{}});if(e.url.startsWith("file:")&&e.syncUrl===void 0){let o=r.transaction.bind(r),n=()=>r.closed,i=t.contentionRetryBudgetMs,s=r.execute.bind(r),a=r.batch.bind(r),l=r.migrate.bind(r),u={isClosed:n,budgetMs:i,afterRefusal:async()=>{await Promise.resolve(r.reconnect())}};async function d(p,m){return await tf(),Ab(()=>typeof p==="string"?s(p,m):s(p),u)}r.execute=d,r.batch=async(p,m)=>(await tf(),Ab(()=>a(p,m),u)),r.migrate=async(p)=>(await tf(),Ab(()=>l(p),u)),r.transaction=async(p)=>(await tf(),Ab(()=>o(p),u))}return r}function kb(e){let{url:t,schema:r}=e,o=g8(e),n={contentionRetryBudgetMs:e.contentionRetryBudgetMs},i=o?k$({url:t,authToken:o},n):k$({url:t},n);return{db:Ib(i,{schema:r}),client:i,url:t}}async function Rb(e,t){if(!t.startsWith("file:"))return;for(let r of["PRAGMA busy_timeout = 0","PRAGMA journal_mode = WAL"])await e.execute(r)}var age=5000,cge=5,lge=40;var R$=S(()=>{AT();m8();h8()});var y8=S(()=>{UR();R$()});var T$=S(()=>{R$();y8()});var $$=S(()=>{Wp();Yy();En();$e();pb();ib();Ho();Jp();i$();In();sr();Sr();qo()});var Y,Me;var O$=S(()=>{xb();$$();mp();Y=Gp("job_queue",{id:ft("id").primaryKey().$defaultFn(()=>Lo()),type:ft("type").notNull(),data:ft("data").notNull(),result:ft("result",{mode:"json"}),progress:ft("progress",{mode:"json"}).$type(),source:ft("source"),metadata:ft("metadata",{mode:"json"}).$type().notNull(),status:ft("status",{enum:["pending","processing","completed","failed"]}).notNull().default("pending"),priority:ar("priority").notNull().default(0),retryCount:ar("retryCount").notNull().default(0),maxRetries:ar("maxRetries").notNull().default(3),lastError:ft("lastError"),lastErrorPublic:ft("lastErrorPublic",{mode:"json"}),createdAt:ar("createdAt").notNull().$defaultFn(()=>Date.now()),scheduledFor:ar("scheduledFor").notNull().$defaultFn(()=>Date.now()),startedAt:ar("startedAt"),completedAt:ar("completedAt"),attemptId:ft("attemptId"),workerSlotId:ft("workerSlotId"),workerSessionId:ft("workerSessionId"),leaseExpiresAt:ar("leaseExpiresAt"),attemptHeartbeatAt:ar("attemptHeartbeatAt"),runtimeUpdatedAt:ar("runtimeUpdatedAt"),brainVersion:ft("brainVersion"),brainVersionSortKey:ft("brainVersionSortKey")},(e)=>({queueReadyIdx:Ko("idx_job_queue_ready").on(e.status,e.priority,e.scheduledFor),jobTypeIdx:Ko("idx_job_queue_type").on(e.type,e.status),runtimeUpdatesIdx:Ko("idx_job_queue_runtime_updates").on(e.runtimeUpdatedAt,e.id),jobSourceIdx:Ko("idx_job_queue_source").on(e.source),rootJobIdx:Ko("idx_job_queue_root_job").on(C`json_extract(${e.metadata}, '$.rootJobId')`,e.createdAt,e.id),deduplicationIdx:Ko("idx_job_queue_deduplication").on(e.type,C`json_extract(${e.metadata}, '$.deduplicationKey')`,e.status)})),Me=Gp("job_worker_sessions",{slotId:ft("slotId").primaryKey(),sessionId:ft("sessionId").notNull().unique(),startedAt:ar("startedAt").notNull(),heartbeatAt:ar("heartbeatAt").notNull(),expiresAt:ar("expiresAt").notNull().default(0),brainVersion:ft("brainVersion"),brainVersionSortKey:ft("brainVersionSortKey"),stableSlotId:ft("stableSlotId")},(e)=>({heartbeatIdx:Ko("idx_job_worker_sessions_heartbeat").on(e.heartbeatAt),expiresIdx:Ko("idx_job_worker_sessions_expires").on(e.expiresAt)}))});function b8(e){return kb({url:e.url,schema:{jobQueue:Y,jobWorkerSessions:Me},authToken:e.authToken,authTokenEnv:"JOB_QUEUE_DATABASE_AUTH_TOKEN",contentionRetryBudgetMs:0})}var S8=S(()=>{T$();O$()});class C${declarations=new Map;handlers=new Map;validators=new Map;logger;mode;finalizedRegistrations;constructor(e,t){this.logger=e.child("HandlerRegistry"),this.mode=t}registerHandler(e,t,r){if(this.finalizedRegistrations)throw Error("Job handler registrations are finalized");if(this.declarations.has(e))throw Error(`Job handler is already registered for type: ${e}`);if(this.declarations.set(e,{handler:t,pluginId:r}),this.validators.set(e,t),this.mode!=="validation-only")this.handlers.set(e,t);this.logger.debug("Registered job execution declaration",{type:e,pluginId:r,mode:this.mode})}unregisterHandler(e){this.declarations.delete(e),this.handlers.delete(e),this.validators.delete(e),this.logger.debug("Unregistered job handler",{type:e})}unregisterPluginHandlers(e){let t=[...this.declarations.entries()].filter(([,r])=>r.pluginId===e).map(([r])=>r);for(let r of t)this.declarations.delete(r),this.handlers.delete(r),this.validators.delete(r);if(t.length>0)this.logger.debug("Unregistered plugin handlers",{pluginId:e,count:t.length,types:t})}finalizeRegistrations(){return this.finalizedRegistrations??=Object.freeze([...this.declarations.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>Object.freeze({type:e,pluginId:t.pluginId}))),this.finalizedRegistrations}getExecutionRegistrations(){return this.finalizedRegistrations}getRegisteredTypes(){return[...this.handlers.keys()]}getExclusiveTypes(){return[...this.handlers].filter(([,e])=>e.exclusive===!0).map(([e])=>e)}getHandler(e){return this.handlers.get(e)}getValidator(e){return this.validators.get(e)}}class P${tails=new Map;async run(e,t){let r=this.tails.get(e),o=()=>{},n=new Promise((i)=>{o=i});this.tails.set(e,n),await r;try{return await t()}finally{if(o(),this.tails.get(e)===n)this.tails.delete(e)}}}class z${findDuplicate(e,t,r){if(!t||t==="none")return null;let o=this.filterByDeduplicationKey(e,r).sort((i,s)=>s.createdAt-i.createdAt||s.id.localeCompare(i.id)),n=o.find((i)=>i.status===Oe.PENDING)??null;if(t==="skip"||t==="replace")return n;return n??o[0]??null}filterByDeduplicationKey(e,t){if(!t)return e;return e.filter((r)=>{let o=dge.safeParse(r.metadata);return o.success&&o.data.deduplicationKey===t})}}var dge;var v8=S(()=>{de();Zo();dge=c.looseObject({deduplicationKey:c.string().optional()})});function _8(e){return`${String(e.length).padStart(2,"0")}${e}`}function fge(e){return pge.test(e)?`0${_8(e)}`:`1${e}`}function rf(e){let t=w8.exec(e);if(!t)throw Error(`Invalid brain version "${e}"`);let[,r="",o="",n="",i]=t,s=[r,o,n].map(_8).join("");return i===void 0?`${s}~`:`${s}-${i.split(".").map(fge).join("!")}`}var w8,pge,x8;var N$=S(()=>{de();w8=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/u,pge=/^\d+$/u,x8=c.string().regex(w8,"Brain version must be a semver version")});function E8(e){return JSON.stringify(new Ci(e).toJSON())}class D${db;transactionClient;databaseUrl;logger;deduplicator=new z$;writeRetryBudgetMs;constructor(e,t,r,o,n){this.db=e,this.transactionClient=t,this.databaseUrl=r,this.logger=o.child("JobQueueRepository"),this.writeRetryBudgetMs=n?.writeRetryBudgetMs??mge}async insert(e){await this.write("insert",async()=>this.db.insert(Y).values(e))}async enqueueAtomic(e){return bge.run(this.databaseUrl,async()=>{let t=Date.now()+this.writeRetryBudgetMs;return this.attemptEnqueue(e,t,1)})}async attemptEnqueue(e,t,r){let o=await this.runEnqueueTransaction(e,t,r);if(o.retry)return this.attemptEnqueue(e,t,r+1);return o.decision}async runEnqueueTransaction(e,t,r){let o=await this.acquireWriteTransaction(e,t),n={prepared:!1},i=!1;try{let s=await this.decideEnqueue(o,e,()=>{n.prepared=!0});return i=!0,await o.commit(),{retry:!1,decision:s}}catch(s){let a=i&&this.isSerializationConflict(s)&&!o.closed,l=!0;if(!o.closed)try{await o.rollback()}catch(u){l=!1,this.logger.error("Failed to roll back atomic enqueue",{type:e.jobData.type,rollbackError:u})}if(n.prepared)e.onInsertRollback?.();if(!a||!l)throw s;return await this.waitForConflictRetry("commit",e,t,r,s),{retry:!0}}finally{o.close()}}async decideEnqueue(e,t,r){let{jobData:o,strategy:n,deduplicationKey:i,beforeInsert:s}=t,a=n??"none",l=async()=>{await s?.(),r()},u=async()=>{await l(),await this.insertJob(e,o)};if(a==="none")return await u(),{kind:"inserted",jobId:o.id};let d=await this.getActiveDeduplicationCandidates(e,o.type,i),p=this.deduplicator.findDuplicate(d,a,i);if(!p)return await u(),{kind:"inserted",jobId:o.id};if(a==="skip")return await this.raiseBrainVersion(e,p.id,o),{kind:"skipped",jobId:p.id};if(a==="coalesce"){if(await this.raiseBrainVersion(e,p.id,o),(await e.execute({sql:"UPDATE `job_queue` SET `scheduledFor` = ? WHERE `id` = ? AND `status` = ?",args:[Date.now(),p.id,p.status]})).rowsAffected!==1)throw Error(`Atomic coalesce lost selected job ${p.id}`);return{kind:"coalesced",jobId:p.id}}await l();let m=Date.now();if((await e.execute({sql:"UPDATE `job_queue`\n SET `status` = ?,\n `lastError` = ?,\n `lastErrorPublic` = ?,\n `completedAt` = ?,\n `runtimeUpdatedAt` = max(?, coalesce((SELECT max(`runtimeUpdatedAt`) FROM `job_queue`), 0) + 1)\n WHERE `id` = ? AND `status` = ?",args:[Oe.FAILED,"Replaced by newer job",E8("cancelled"),m,m,p.id,Oe.PENDING]})).rowsAffected!==1)throw Error(`Atomic replace lost selected job ${p.id}`);return await this.insertJob(e,o),{kind:"replaced",jobId:o.id,replacedJobId:p.id}}async getActiveDeduplicationCandidates(e,t,r){return(await e.execute(r?{sql:"SELECT `id`, `status`, `createdAt`, `metadata`\n FROM `job_queue`\n WHERE `type` = ?\n AND json_extract(`metadata`, '$.deduplicationKey') = ?\n AND `status` IN (?, ?)",args:[t,r,Oe.PENDING,Oe.PROCESSING]}:{sql:"SELECT `id`, `status`, `createdAt`, `metadata`\n FROM `job_queue`\n WHERE `type` = ? AND `status` IN (?, ?)",args:[t,Oe.PENDING,Oe.PROCESSING]})).rows.map((n)=>this.parseDeduplicationCandidate(n))}parseDeduplicationCandidate(e){let{id:t,status:r,createdAt:o,metadata:n}=e;if(typeof t!=="string"||r!==Oe.PENDING&&r!==Oe.PROCESSING||typeof o!=="number"&&typeof o!=="bigint"||typeof n!=="string")throw Error("Invalid active job row returned during atomic enqueue");let i=JSON.parse(n);return{id:t,status:r,createdAt:Number(o),metadata:i}}async raiseBrainVersion(e,t,r){if(!r.brainVersion)return;let o=rf(r.brainVersion);await e.execute({sql:"UPDATE `job_queue`\n SET `brainVersion` = ?, `brainVersionSortKey` = ?\n WHERE `id` = ?\n AND (`brainVersionSortKey` IS NULL OR `brainVersionSortKey` < ?)",args:[r.brainVersion,o,t,o]})}async insertJob(e,t){if((await e.execute({sql:"INSERT INTO `job_queue` (\n `id`, `type`, `data`, `result`, `source`, `metadata`,\n `status`, `priority`, `retryCount`, `maxRetries`,\n `lastError`, `createdAt`, `scheduledFor`, `startedAt`,\n `completedAt`, `brainVersion`, `brainVersionSortKey`\n ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",args:[t.id,t.type,t.data,this.serializeJson(t.result),t.source,JSON.stringify(t.metadata),t.status,t.priority,t.retryCount,t.maxRetries,t.lastError,t.createdAt,t.scheduledFor,t.startedAt,t.completedAt,t.brainVersion??null,t.brainVersion?rf(t.brainVersion):null]})).rowsAffected!==1)throw Error(`Atomic enqueue did not insert job ${t.id}`)}serializeJson(e){if(e===void 0||e===null)return null;return JSON.stringify(e)}acquireWriteTransaction(e,t){return this.retryOnConflict("acquire",e,()=>this.transactionClient.transaction("write"),(r)=>this.isSerializationConflict(r),t)}async waitForConflictRetry(e,t,r,o,n){let i=Math.min(hge*2**(o-1),gge),s=i/2+Math.random()*(i/2);if(Date.now()+s>=r)throw this.transactionConflictError(e,t,o,n);await new Promise((a)=>setTimeout(a,s))}async retryOnConflict(e,t,r,o,n=Date.now()+this.writeRetryBudgetMs,i=1){try{return await r()}catch(s){if(!o(s))throw s;return await this.waitForConflictRetry(e,t,n,i,s),this.retryOnConflict(e,t,r,o,n,i+1)}}transactionConflictError(e,t,r,o){if(typeof t==="string")return Error(`Failed job queue write "${t}" within ${this.writeRetryBudgetMs}ms after ${r} attempts`,{cause:o});let n=t.strategy??"none",i=t.deduplicationKey?"present":"absent";return Error(`Failed to ${e} atomic enqueue transaction for type "${t.jobData.type}" within ${this.writeRetryBudgetMs}ms after ${r} attempts (strategy: ${n}, key: ${i})`,{cause:o})}write(e,t){return this.retryOnConflict("write",e,t,(r)=>{let o=new Set;for(let n=r;n!==void 0&&!o.has(n);){if(o.add(n),typeof n==="object"&&n!==null&&"code"in n&&/^SQLITE_(?:BUSY|LOCKED)(?:_|$)/u.test(String(n.code)))return!0;n=n instanceof Error?n.cause:void 0}return!1})}isSerializationConflict(e){for(let t=e;t!==void 0;){let r=typeof t==="object"&&t!==null&&"code"in t?String(t.code):"",o=Ve(t,"");if(/SQLITE_(?:BUSY|LOCKED)/u.test(r)||/SQLITE_(?:BUSY|LOCKED)|database is locked|transaction (?:busy|conflict)/iu.test(o))return!0;t=t instanceof Error?t.cause:void 0}return!1}async startWorkerSession(e,t,r=Date.now(),o=Hi,n,i){let s=r+o,a={brainVersion:n??null,brainVersionSortKey:n?rf(n):null,stableSlotId:i??null};await this.write("start worker session",async()=>{await this.db.insert(Me).values({slotId:e,sessionId:t,startedAt:r,heartbeatAt:r,expiresAt:s,...a}).onConflictDoUpdate({target:Me.slotId,set:{sessionId:t,startedAt:r,heartbeatAt:r,expiresAt:s,...a}}),await this.pruneDeadWorkerSessions(r,o)})}async heartbeatWorkerSession(e,t,r=Date.now(),o=Hi){return(await this.write("heartbeat worker session",async()=>{let i=await this.db.update(Me).set({heartbeatAt:r,expiresAt:r+o}).where(tt(je(Me.slotId,e),je(Me.sessionId,t))).returning({slotId:Me.slotId});return await this.pruneDeadWorkerSessions(r,o),i})).length===1}async pruneDeadWorkerSessions(e,t){let r=this.db.select({id:Y.id}).from(Y).where(tt(je(Y.workerSlotId,Me.slotId),je(Y.workerSessionId,Me.sessionId),je(Y.status,Oe.PROCESSING),An(Y.leaseExpiresAt,e)));await this.db.delete(Me).where(tt(ns(Me.expiresAt,e-t),is(r)))}async endWorkerSession(e,t){return(await this.write("end worker session",async()=>this.db.delete(Me).where(tt(je(Me.slotId,e),je(Me.sessionId,t))).returning({slotId:Me.slotId}))).length===1}async complete(e,t,r){let o=Date.now(),i=(await this.write("complete",async()=>this.db.update(Y).set({status:Oe.COMPLETED,result:t,lastError:null,lastErrorPublic:null,completedAt:o,runtimeUpdatedAt:this.nextRuntimeUpdatedAt(o)}).where(this.attemptWriteGuard(e,r)).returning({id:Y.id}))).length===1;if(i)this.logger.debug("Job completed",{jobId:e,hasResult:t!==void 0});return i}async update(e,t,r){let n=(await this.write("update",async()=>this.db.update(Y).set({data:JSON.stringify(t)}).where(this.attemptWriteGuard(e,r)).returning({id:Y.id}))).length===1;if(n)this.logger.debug("Job data updated",{jobId:e});return n}async recordAttemptProgress(e,t,r,o=Date.now()){return(await this.write("record progress",async()=>this.db.update(Y).set({attemptHeartbeatAt:o,runtimeUpdatedAt:this.nextRuntimeUpdatedAt(o),progress:r}).where(this.attemptWriteGuard(e,t)).returning({id:Y.id}))).length===1}async renewAttemptLease(e,t,r,o){return(await this.write("renew attempt lease",async()=>this.db.update(Y).set({attemptHeartbeatAt:r,leaseExpiresAt:r+o}).where(this.attemptWriteGuard(e,t)).returning({id:Y.id}))).length===1}async release(e,t,r=Date.now()){return(await this.write("release",async()=>this.db.update(Y).set({status:Oe.PENDING,scheduledFor:r,startedAt:null,attemptId:null,workerSlotId:null,workerSessionId:null,leaseExpiresAt:null,attemptHeartbeatAt:null}).where(this.attemptWriteGuard(e,t)).returning({id:Y.id}))).length===1}async fail(e,t,r,o=Date.now()){let i=(await this.db.select({retryCount:Y.retryCount,maxRetries:Y.maxRetries,type:Y.type,scheduledFor:Y.scheduledFor,startedAt:Y.startedAt,runtimeUpdatedAt:Y.runtimeUpdatedAt}).from(Y).where(this.attemptWriteGuard(e,r)).limit(1))[0];if(!i)return!1;let s=i.retryCount<i.maxRetries,a=s?i.retryCount+1:i.retryCount,l=Math.min(1000*2**i.retryCount,60000),u=s?o+l:i.scheduledFor;if((await this.write("fail",async()=>this.db.update(Y).set({status:s?Oe.PENDING:Oe.FAILED,retryCount:a,lastError:t.message,lastErrorPublic:ng(t).toJSON(),scheduledFor:u,completedAt:s?null:o,runtimeUpdatedAt:s?i.runtimeUpdatedAt:this.nextRuntimeUpdatedAt(o),startedAt:s?null:i.startedAt,attemptId:null,workerSlotId:null,workerSessionId:null,leaseExpiresAt:null,attemptHeartbeatAt:null}).where(tt(this.attemptWriteGuard(e,r),je(Y.retryCount,i.retryCount))).returning({id:Y.id}))).length!==1)return!1;if(s)this.logger.debug("Job scheduled for retry",{jobId:e,retryCount:a,backoffMs:l,scheduledFor:new Date(u).toISOString()});else this.logger.error("Job failed after max retries",{jobId:e,type:i.type,retryCount:i.retryCount,error:t.message});return!0}async retireUnownedActiveJob(e){let t=e.reason.trim();if(t.length===0)throw Error("Retired job reason must not be empty");let o=(await this.write("retire unowned job",async()=>this.db.update(Y).set({status:Oe.FAILED,lastError:t,lastErrorPublic:new Ci("no_handler").toJSON(),completedAt:e.now,runtimeUpdatedAt:this.nextRuntimeUpdatedAt(e.now)}).where(tt(je(Y.id,e.jobId),je(Y.type,e.expectedType),cn(je(Y.status,Oe.PENDING),je(Y.status,Oe.PROCESSING)),qr(Y.attemptId),qr(Y.workerSlotId),qr(Y.workerSessionId),qr(Y.leaseExpiresAt),qr(Y.attemptHeartbeatAt),qr(Y.progress),qr(Y.result))).returning()))[0]??null;if(o)this.logger.warn("Retired unowned legacy job",{jobId:o.id,type:o.type,reason:t});return o}async getStatus(e){return(await this.db.select().from(Y).where(je(Y.id,e)).limit(1))[0]??null}async getJobsByRootJobId(e){return this.db.select().from(Y).where(C`json_extract(${Y.metadata}, '$.rootJobId') = ${e}`).orderBy(Fo(Y.createdAt),Fo(Y.id))}async getStatusByEntityId(e){return(await this.db.select().from(Y).where(C`json_extract(${Y.data}, '$.id') = ${e}`).orderBy(ba(Y.createdAt)).limit(1))[0]??null}async getStats(){let e=await this.db.select({status:Y.status,count:C`count(*)`}).from(Y).groupBy(Y.status),t={pending:0,processing:0,failed:0,completed:0,total:0};for(let r of e){let o=Number(r.count);t[r.status]=o,t.total+=o}return t}async getDiagnostics(e=Date.now()){let[t,r,o]=await Promise.all([this.db.select({type:Y.type,status:Y.status,count:C`count(*)`}).from(Y).groupBy(Y.type,Y.status),this.db.select({oldestPendingAt:C`min(case when ${Y.status} = ${Oe.PENDING} then ${Y.createdAt} end)`,duePending:C`coalesce(sum(case when ${Y.status} = ${Oe.PENDING} and ${Y.scheduledFor} <= ${e} then 1 else 0 end), 0)`,oldestDuePendingAt:C`min(case when ${Y.status} = ${Oe.PENDING} and ${Y.scheduledFor} <= ${e} then ${Y.scheduledFor} end)`,latestClaimAt:C`max(${Y.startedAt})`,oldestProcessingAt:C`min(case when ${Y.status} = ${Oe.PROCESSING} then ${Y.startedAt} end)`,staleLeaseCount:C`coalesce(sum(case when ${Y.status} = ${Oe.PROCESSING} and ${Y.leaseExpiresAt} is not null and ${Y.leaseExpiresAt} <= ${e} then 1 else 0 end), 0)`}).from(Y),this.db.select({total:C`count(*)`,active:C`coalesce(sum(case when ${Me.expiresAt} > ${e} then 1 else 0 end), 0)`,stale:C`coalesce(sum(case when ${Me.expiresAt} <= ${e} then 1 else 0 end), 0)`,latestHeartbeatAt:C`max(${Me.heartbeatAt})`}).from(Me)]),n={pending:0,processing:0,completed:0,failed:0},i=t.map((u)=>{let d=Number(u.count);return n[u.status]+=d,{type:u.type,status:u.status,count:d}}),s=r[0],a=o[0],l=(u)=>u===null||u===void 0?null:Math.max(0,e-Number(u));return{totals:n,byType:i,oldestPendingAgeMs:l(s?.oldestPendingAt),duePending:Number(s?.duePending??0),oldestDuePendingAgeMs:l(s?.oldestDuePendingAt),latestClaimAgeMs:l(s?.latestClaimAt),oldestProcessingAgeMs:l(s?.oldestProcessingAt),staleLeaseCount:Number(s?.staleLeaseCount??0),workerSessions:{total:Number(a?.total??0),active:Number(a?.active??0),stale:Number(a?.stale??0),latestHeartbeatAgeMs:l(a?.latestHeartbeatAt)}}}async getRuntimeUpdates(e,t){let r=yge.parse(t);if(r===0)return[];return(await this.db.select().from(Y).where(C`(${Y.runtimeUpdatedAt}, ${Y.id}) > (${e.updatedAt}, ${e.jobId})`).orderBy(Fo(Y.runtimeUpdatedAt),Fo(Y.id)).limit(r)).map((n)=>({job:n,cursor:{updatedAt:n.runtimeUpdatedAt??0,jobId:n.id}}))}async cleanup(e){let t=Date.now()-e;return(await this.write("cleanup",async()=>this.db.delete(Y).where(tt(cn(je(Y.status,Oe.COMPLETED),je(Y.status,Oe.FAILED)),ns(Y.completedAt,t))))).rowsAffected}async getActiveJobs(e){let t=cn(je(Y.status,Oe.PENDING),je(Y.status,Oe.PROCESSING)),r=e&&e.length>0?tt(t,os(Y.type,e)):t;return this.db.select().from(Y).where(r).orderBy(ba(Y.createdAt))}async getRecentJobs(e,t=20){let r=e&&e.length>0?os(Y.type,e):void 0;return this.db.select().from(Y).where(r).orderBy(ba(Y.createdAt)).limit(t)}async getFailedJobs(e){let t=je(Y.status,Oe.FAILED),r=e&&e.length>0?tt(t,os(Y.type,e)):t;return this.db.select().from(Y).where(r).orderBy(ba(Y.createdAt))}async claimNextReady(e){let{now:t,attemptId:r,workerSlotId:o,workerSessionId:n,leaseDurationMs:i,executableTypes:s,exclusiveTypes:a=[],brainVersion:l}=e,u=l?this.brainVersionGate(l,t):{admissible:void 0,noNewerWorker:void 0},d=this.db.select({slotId:Me.slotId}).from(Me).where(tt(je(Me.slotId,o),je(Me.sessionId,n),An(Me.expiresAt,t))),p=this.noNewerLiveInstance(o,n,t),m=this.db.select({slotId:Me.slotId}).from(Me).where(tt(je(Me.slotId,Y.workerSlotId),je(Me.sessionId,Y.workerSessionId))),h=tt(je(Y.status,Oe.PROCESSING),cn(qr(Y.attemptId),is(m),ns(Y.leaseExpiresAt,t))),b=vb(Y,"running"),y=this.db.select({id:b.id}).from(b).where(tt(je(b.type,Y.type),je(b.status,Oe.PROCESSING),An(b.leaseExpiresAt,t),C`${b.id} <> ${Y.id}`)),v=a.length===0?void 0:cn(sb(Y.type,[...a]),is(y)),x=C`${Y.status} = ${Oe.PROCESSING} AND ${Y.retryCount} + 1 > ${Y.maxRetries}`,_=this.db.select({id:Y.id}).from(Y).where(tt(os(Y.type,s),v,u.admissible,cn(tt(je(Y.status,Oe.PENDING),ns(Y.scheduledFor,t)),h))).orderBy(Fo(Y.priority),Fo(Y.createdAt)).limit(1),O=(await this.write("claim",async()=>this.db.update(Y).set({status:C`CASE WHEN ${x} THEN ${Oe.FAILED} ELSE ${Oe.PROCESSING} END`,retryCount:C`CASE WHEN ${Y.status} = ${Oe.PROCESSING} THEN ${Y.retryCount} + 1 ELSE ${Y.retryCount} END`,lastError:C`CASE WHEN ${Y.status} = ${Oe.PROCESSING} THEN 'Attempt lease expired' ELSE ${Y.lastError} END`,lastErrorPublic:C`CASE WHEN ${Y.status} = ${Oe.PROCESSING} THEN ${E8("deadline_exceeded")} ELSE ${Y.lastErrorPublic} END`,startedAt:C`CASE WHEN ${x} THEN ${Y.startedAt} ELSE ${t} END`,completedAt:C`CASE WHEN ${x} THEN ${t} ELSE NULL END`,attemptId:C`CASE WHEN ${x} THEN ${Y.attemptId} ELSE ${r} END`,workerSlotId:C`CASE WHEN ${x} THEN ${Y.workerSlotId} ELSE ${o} END`,workerSessionId:C`CASE WHEN ${x} THEN ${Y.workerSessionId} ELSE ${n} END`,leaseExpiresAt:C`CASE WHEN ${x} THEN ${Y.leaseExpiresAt} ELSE ${t+i} END`,attemptHeartbeatAt:C`CASE WHEN ${x} THEN ${Y.attemptHeartbeatAt} ELSE ${t} END`,runtimeUpdatedAt:C`CASE WHEN ${x} THEN ${this.nextRuntimeUpdatedAt(t)} ELSE ${Y.runtimeUpdatedAt} END`}).where(tt(os(Y.id,_),ab(d),p,u.noNewerWorker)).returning()))[0];if(!O)return null;if(O.status===Oe.FAILED)return O;return this.logger.debug("Job claimed",{jobId:O.id,attemptId:O.attemptId,workerSlotId:o,workerSessionId:n}),O}noNewerLiveInstance(e,t,r){let o=vb(Me,"claimer"),n=vb(Me,"peer"),i=this.db.select({slotId:n.slotId}).from(n).innerJoin(o,tt(je(o.slotId,e),je(o.sessionId,t))).where(tt(je(n.stableSlotId,o.stableSlotId),An(n.expiresAt,r),cn(An(n.startedAt,o.startedAt),tt(je(n.startedAt,o.startedAt),An(n.slotId,o.slotId)))));return is(i)}brainVersionGate(e,t){let r=rf(e),o=this.db.select({slotId:Me.slotId}).from(Me).where(tt(An(Me.expiresAt,t),An(Me.brainVersionSortKey,r)));return{admissible:cn(qr(Y.brainVersionSortKey),ns(Y.brainVersionSortKey,r)),noNewerWorker:is(o)}}nextRuntimeUpdatedAt(e){return C`max(${e}, coalesce((select max(${Y.runtimeUpdatedAt}) from ${Y}), 0) + 1)`}attemptWriteGuard(e,t){return t?tt(je(Y.id,e),je(Y.status,Oe.PROCESSING),je(Y.attemptId,t)):tt(je(Y.id,e),qr(Y.attemptId),cn(je(Y.status,Oe.PENDING),je(Y.status,Oe.PROCESSING)))}}var mge=2000,hge=5,gge=40,yge,bge;var I8=S(()=>{$$();xb();O$();wt();de();Zo();gp();v8();N$();yge=c.number().int().min(0).max(1000),bge=new P$});import{AsyncLocalStorage as Sge}from"async_hooks";class Bl{storage=new Sge;static createFresh(){return new Bl}constructor(){}current(){return this.storage.getStore()}run(e,t,r){if(t.length===0)throw Error("Operation ID must not be empty");let o=To.parse(e),n=vge(o);return this.storage.run(Object.freeze({provenance:n,operationId:t}),r)}}function vge(e){if(Object.freeze(e.projectionLineage),e.sourceEntity)Object.freeze(e.sourceEntity);return Object.freeze(e)}var Tb=S(()=>{wt()});class nf{client;logger;handlerRegistry;repository;walInitialization=null;walInitializationSettled=!1;closeRequested=!1;clientClosed=!1;inFlightEnqueues=0;databaseUrl;operationContext;projectionAdmission;directWorkerSlotId=`direct:${Lo()}`;directWorkerSessionId=Lo();directLeaseDurationMs;directSessionStart=null;brainVersion;close(){this.closeRequested=!0,this.closeClientWhenReady()}static createFresh(e,t,r){return new nf(e,t??Rr.getInstance(),r)}constructor(e,t,r){this.brainVersion=e.brainVersion===void 0?void 0:x8.parse(e.brainVersion);let{db:o,client:n,url:i}=b8(e);this.client=n,this.databaseUrl=i,this.logger=t.child("JobQueueService"),this.operationContext=r?.operationContext??Bl.createFresh(),this.projectionAdmission=r?.projectionAdmission,this.handlerRegistry=new C$(this.logger,r?.handlerRegistrationMode??"combined"),this.repository=new D$(o,n,i,this.logger),this.directLeaseDurationMs=e.claimTimeoutMs??300000}initialize(){if(this.closeRequested)return Promise.resolve();return this.walInitialization??=this.initializeWALMode(),this.walInitialization}async initializeWALMode(){try{await Rb(this.client,this.databaseUrl)}catch(e){this.logger.warn("Failed to enable WAL mode (non-fatal)",e)}finally{this.walInitializationSettled=!0,this.closeClientWhenReady()}}closeClientWhenReady(){if(!this.closeRequested||this.inFlightEnqueues>0||this.walInitialization!==null&&!this.walInitializationSettled)return;this.closeClient()}closeClient(){if(this.clientClosed)return;this.clientClosed=!0,this.client.close()}registerHandler(e,t,r){this.handlerRegistry.registerHandler(e,t,r)}unregisterHandler(e){this.handlerRegistry.unregisterHandler(e)}unregisterPluginHandlers(e){this.handlerRegistry.unregisterPluginHandlers(e)}getRegisteredTypes(){return this.handlerRegistry.getRegisteredTypes()}getHandler(e){return this.handlerRegistry.getHandler(e)}getValidator(e){return this.handlerRegistry.getValidator(e)}finalizeHandlerRegistrations(){return this.handlerRegistry.finalizeRegistrations()}getExecutionRegistrations(){return this.handlerRegistry.getExecutionRegistrations()}async enqueue(e){if(this.closeRequested)throw Error("Cannot enqueue a job after the queue service is closed");this.inFlightEnqueues++;try{return await this.enqueueValidated(e)}finally{this.inFlightEnqueues--,this.closeClientWhenReady()}}async enqueueValidated(e){let{type:t,data:r,options:o}=e,n=this.handlerRegistry.getValidator(t);if(!n)throw Error(`No job type declared: ${t}`);let i=n.validateAndParse(r);if(i===null)throw Error(`Invalid job data for type: ${t}`);let s=Date.now(),a=Lo(),l=o?.rootJobId??(o?.detached?a:this.operationContext.current()?.provenance.rootJobId)??a,u=this.createJobProvenance(a,l,o),d=o?.metadata??{operationType:"data_processing"},{provenance:p,...m}=d,h={id:a,type:t,data:JSON.stringify(i),status:Oe.PENDING,priority:o?.priority??0,maxRetries:o?.maxRetries??3,retryCount:0,source:o?.source??null,metadata:{...m,...o?.deduplicationKey&&{deduplicationKey:o.deduplicationKey},rootJobId:l,provenance:u},createdAt:s,scheduledFor:o?.delayMs?s+o.delayMs:s,result:null,lastError:null,startedAt:null,completedAt:null,brainVersion:this.brainVersion},b,y=()=>{b?.rollback(),b=void 0};try{let v=await this.repository.enqueueAtomic({jobData:h,strategy:o?.deduplication,deduplicationKey:o?.deduplicationKey,beforeInsert:async()=>{b=await this.projectionAdmission?.reserveJobAdmission(u)},onInsertRollback:y});if(b?.commit(),b=void 0,v.kind==="skipped")this.logger.debug("Skipping duplicate job (already pending)",{type:t,existingJobId:v.jobId});else if(v.kind==="coalesced")this.logger.debug("Coalescing with existing job",{type:t,existingJobId:v.jobId});else{if(v.kind==="replaced")this.logger.debug("Replacing duplicate job",{type:t,oldJobId:v.replacedJobId});this.logger.debug("Job enqueued",{id:v.jobId,type:t,priority:h.priority,rootJobId:h.metadata.rootJobId})}return v.jobId}catch(v){throw y(),this.logger.error("Failed to enqueue job",{type:t,error:Ve(v)}),v}}createJobProvenance(e,t,r){let o=this.operationContext.current(),n=r?.metadata.provenance??o?.provenance,i=n?.rootJobId===t?n:void 0,s=o?.provenance.rootJobId===t?o.operationId:void 0,a=r?.projection,l=a?[...i?.projectionLineage??[],a.id]:[...i?.projectionLineage??[]],u=a?.id??i?.projectionId;return To.parse({rootJobId:t,causationId:s??i?.causationId??e,...u?{projectionId:u}:{},projectionLineage:l,...a?.sourceEntity?{sourceEntity:a.sourceEntity}:i?.sourceEntity?{sourceEntity:i.sourceEntity}:{},derivationDepth:l.length})}async dequeue(e){let t=this.handlerRegistry.getRegisteredTypes();if(t.length===0)return null;let{onTerminalReclaim:r,...o}=e??await this.getDirectClaimOptions(),n=Date.now(),i=await this.repository.claimNextReady({...o,workerSlotId:this.sessionSlotId(o.workerSlotId,o.workerSessionId),brainVersion:this.brainVersion,now:n,attemptId:Lo(),executableTypes:t,exclusiveTypes:this.handlerRegistry.getExclusiveTypes()});if(!i)return null;if(i.status===Oe.FAILED)return this.logger.warn("Expired attempt failed terminally on reclaim",{id:i.id,type:i.type,retryCount:i.retryCount}),await r?.(i),null;return this.logger.debug("Job dequeued",{id:i.id,type:i.type,priority:i.priority,retryCount:i.retryCount,attemptId:i.attemptId,workerSlotId:i.workerSlotId,workerSessionId:i.workerSessionId}),i}async startWorkerSession(e,t,r=Hi){await this.repository.startWorkerSession(this.sessionSlotId(e,t),t,Date.now(),r,this.brainVersion,this.versionedSlotId(e))}heartbeatWorkerSession(e,t,r=Hi){return this.repository.heartbeatWorkerSession(this.sessionSlotId(e,t),t,Date.now(),r)}endWorkerSession(e,t){return this.repository.endWorkerSession(this.sessionSlotId(e,t),t)}versionedSlotId(e){return this.brainVersion?`${e}@${this.brainVersion}`:e}sessionSlotId(e,t){return`${this.versionedSlotId(e)}#${t}`}renewAttemptLease(e,t,r){return this.repository.renewAttemptLease(e,t,Date.now(),r)}recordAttemptProgress(e,t,r){return this.repository.recordAttemptProgress(e,t,r)}complete(e,t,r){return this.repository.complete(e,t,r)}update(e,t,r){return this.repository.update(e,t,r)}fail(e,t,r){return this.repository.fail(e,t,r)}release(e,t){return this.repository.release(e,t)}retireUnownedActiveJob(e){return this.repository.retireUnownedActiveJob(e)}async getDirectClaimOptions(){return this.directSessionStart??=this.repository.startWorkerSession(this.sessionSlotId(this.directWorkerSlotId,this.directWorkerSessionId),this.directWorkerSessionId,Date.now(),this.directLeaseDurationMs,this.brainVersion),await this.directSessionStart,{workerSlotId:this.directWorkerSlotId,workerSessionId:this.directWorkerSessionId,leaseDurationMs:this.directLeaseDurationMs}}async getStatus(e){return this.repository.getStatus(e)}async getJobsByRootJobId(e){return this.repository.getJobsByRootJobId(e)}async getStatusByEntityId(e){return this.repository.getStatusByEntityId(e)}async getStats(){return this.repository.getStats()}getDiagnostics(e){return this.repository.getDiagnostics(e)}async waitForIdle(e={}){let t=e.quietMs??250,r=e.pollIntervalMs??25,o=Date.now()+(e.timeoutMs??30000),n=async(i)=>{e.signal?.throwIfAborted();let{totals:s}=await this.getDiagnostics(),l=s.pending===0&&s.processing===0?i??Date.now():null;if(l!==null&&Date.now()-l>=t)return;if(Date.now()>=o)throw Error(`Timed out waiting for the job queue to settle: ${s.pending} pending, ${s.processing} processing`);return await Bun.sleep(r),n(l)};return n(null)}getRuntimeUpdates(e,t=1000){return this.repository.getRuntimeUpdates(e,t)}async cleanup(e){let t=await this.repository.cleanup(e);if(t>0)this.logger.info("Cleaned up old jobs",{deletedCount:t,olderThanMs:e});return t}async getActiveJobs(e){return this.repository.getActiveJobs(e)}async getRecentJobs(e,t){return this.repository.getRecentJobs(e,t)}async getFailedJobs(e){return this.repository.getFailedJobs(e)}}var A8=S(()=>{mp();UR();gp();Zo();T$();S8();I8();wt();Tb();N$()});var L$=()=>{};var k8=S(()=>{mp();Zo();gp();Zo();L$();Tb()});var R8=S(()=>{Zo();L$()});var $b,T8;var Z$=S(()=>{de();$b=c.object({success:c.boolean(),data:c.unknown().optional(),error:c.string().optional(),code:c.string().optional()}),T8=c.object({id:c.string().min(1),timestamp:c.string(),type:c.string().min(1),source:c.string().min(1),target:c.string().optional(),metadata:c.record(c.string(),c.unknown()).optional()})});var o8e;var $8=S(()=>{de();Z$();o8e=c.union([c.object({noop:c.literal(!0)}),$b])});var Ob=S(()=>{$8()});var O8=S(()=>{Ob()});var C8=S(()=>{Ob()});var P8=S(()=>{C8()});var x8e;var j$=S(()=>{de();x8e=c.looseObject({issues:c.array(c.looseObject({message:c.string()})).optional()})});var z8=S(()=>{O8();Ob();P8();j$();wt();Tb()});var $ge;var N8=S(()=>{de();Z$();$ge=c.object({id:c.string().min(1),requestId:c.string().min(1),success:c.boolean(),data:c.unknown().optional(),error:c.object({message:c.string(),code:c.string().optional()}).optional(),timestamp:c.string().datetime()})});var B8e;var D8=S(()=>{wt();B8e=new Ci("invalid_response").toJSON()});var L8=S(()=>{z8();N8();j$();D8()});var iHe;var Z8=S(()=>{de();L8();hp();Zo();iHe=c.preprocess((e)=>{if(typeof e!=="string")return e;return JSON.parse(e)},c.record(c.string(),c.unknown()))});var cHe;var j8=S(()=>{de();cHe=c.record(c.string(),c.unknown())});var B8=S(()=>{wt();mp()});var U8=S(()=>{A8();k8();R8();Z8();j8();gp();Zo();hp();B8()});var B$={};Lt(B$,{LEGACY_PROJECTION_JOB_TYPES:()=>q8,LEGACY_PROJECTION_RETIREMENT_REASON:()=>H8,legacyProjectionJobTypeSchema:()=>F8,retireLegacyProjectionJob:()=>Nge});import{existsSync as Cge}from"fs";import{resolve as Pge}from"path";function M8(e){return{id:e.id,type:e.type,status:e.status,retryCount:e.retryCount,maxRetries:e.maxRetries,createdAt:e.createdAt,startedAt:e.startedAt,completedAt:e.completedAt}}function zge(e,t){if(e.type!==t)throw Error(`Job ${e.id} has type ${e.type}; expected ${t}`);if(e.status!=="pending"&&e.status!=="processing")throw Error(`Job ${e.id} is already terminal (${e.status})`);if(e.attemptId!==null||e.workerSlotId!==null||e.workerSessionId!==null||e.leaseExpiresAt!==null||e.attemptHeartbeatAt!==null)throw Error(`Job ${e.id} still has attempt ownership`);if(e.progress!==null||e.result!=null)throw Error(`Job ${e.id} contains partial progress or a result`)}async function Nge(e){let t=Pge(e.databasePath);if(!Cge(t))throw Error(`Job database does not exist: ${t}`);let r=F8.parse(e.jobType),o=nf.createFresh({url:`file:${t}`});try{let n=await o.getStatus(e.jobId);if(!n)throw Error(`Job not found: ${e.jobId}`);if(zge(n,r),e.dryRun){if(e.confirmation!==void 0)throw Error("Dry-run recovery must not include confirmation");return{databasePath:t,job:M8(n),retired:!1}}let i=`retire:${n.id}`;if(e.confirmation!==i)throw Error(`Refusing to retire ${n.id}; expected --confirm ${i}`);let s=await o.retireUnownedActiveJob({jobId:n.id,expectedType:r,reason:H8,now:e.now?.()??Date.now()});if(!s)throw Error(`Job ${n.id} changed or acquired ownership before retirement`);return{databasePath:t,job:M8(s),retired:!0}}finally{o.close()}}var q8,F8,H8="Retired legacy projection job superseded by scheduler-owned projections";var U$=S(()=>{U8();de();q8=["conversation-memory:project","skill:project","swot:derive","topic:project"],F8=c.enum(q8)});function Ut(e,t,r,o,n){return K8.parse({id:e,operation:t,count:r,targetProbeCount:o,settleMs:n})}function Q8(e){return zb.parse(structuredClone(Bge[e]))}function Nb(e){let t=`stress:${e.handle}`;if(e.confirmation!==t)throw Error(`Directory-sync stress requires --confirm ${t}`);let r=/(^|[-_.])smoke($|[-_.])/i;if(!r.test(e.handle)||!r.test(e.domain)||!r.test(e.contentRepo))throw Error("Directory-sync stress is smoke-only; handle, domain, and content repository must all identify smoke")}async function q$(e,t={}){let r=t.fetchImpl??fetch,o=t.now??(()=>new Date),n=t.timeoutMs??20000,i=o(),s=new AbortController,a=setTimeout(()=>s.abort(),n);try{let l=await r(e,{method:"GET",signal:s.signal});return await l.arrayBuffer(),M$.parse({timestamp:i.toISOString(),endpoint:new URL(e).pathname,status:l.status,durationMs:Math.max(0,o().getTime()-i.getTime()),ok:l.ok})}catch(l){return M$.parse({timestamp:i.toISOString(),endpoint:new URL(e).pathname,status:0,durationMs:Math.max(0,o().getTime()-i.getTime()),ok:!1,error:Mge(l)})}finally{clearTimeout(a)}}async function Y8(e,t){let r=zb.parse(e),o=[],n,i=await t.prepare(r),s,a;try{try{await t.startMonitoring()}catch(l){n=`monitor: ${Cb(l)}`}if(!n)for(let l of r.phases)try{let u=V8.parse(await t.executePhase(l,i));if(o.push(u),!u.success){n=`${l.id}: ${u.error??"phase failed"}`;break}}catch(u){let d=Cb(u);o.push({id:l.id,operation:l.operation,count:l.count,success:!1,error:d}),n=`${l.id}: ${d}`;break}}finally{try{if(s=W8.parse(await t.cleanup(i)),!s.success&&!n)n=s.error??"cleanup failed"}catch(l){let u=Cb(l);s={success:!1,probesRemaining:0,error:u},n??=`cleanup: ${u}`}try{a=G8.parse(await t.stopMonitoring())}catch(l){let u=Cb(l);a={health:[],runtime:[]},n??=`monitor: ${u}`}}return n??=Uge(a,r.maximumExternalAiCalls??0),jge.parse({profile:r.profile,success:n===void 0&&o.length===r.phases.length&&s.success,baseline:i,phases:o,cleanup:s,metrics:a,...n?{failure:n}:{}})}function Uge(e,t=0){let r=e.health.find((i)=>!i.ok);if(r)return`health: ${r.endpoint} unavailable`;let o=e.externalAiCalls??0;if(o>t)return t===0?`external AI: observed ${o} call(s)`:`external AI: observed ${o} call(s), cap ${t}`;if(e.container?.oomKilled)return"container: OOM killed";let n=e.container?.restartCount??0;if(n>0)return`container: restarted ${n} time(s)`;if(e.container&&e.container.status!=="running")return`container: ${e.container.status}`;return}function Mge(e){if(e instanceof Error)return`${e.name}: ${e.message}`;return String(e)}function Cb(e){return Ve(e)}var Pb,J8,K8,zb,Dge,M$,Lge,V8,W8,Zge,G8,jge,Bge;var F$=S(()=>{de();Pb=c.enum(["regression","load","stress"]),J8=c.enum(["add","update","rename","delete"]),K8=c.object({id:c.string().min(1),operation:J8,count:c.number().int().positive().max(700),targetProbeCount:c.number().int().min(0).max(700),settleMs:c.number().int().nonnegative().max(300000)}),zb=c.object({profile:Pb,maximumProbeCount:c.number().int().positive().max(700),maximumExternalAiCalls:c.number().int().nonnegative().max(1e4).optional(),phases:c.array(K8).min(1)}),Dge=c.object({entities:c.number().int().nonnegative(),notes:c.number().int().nonnegative(),version:c.string().min(1)}),M$=c.object({timestamp:c.iso.datetime(),endpoint:c.string().startsWith("/"),status:c.number().int().nonnegative(),durationMs:c.number().nonnegative(),ok:c.boolean(),error:c.string().optional()}),Lge=c.object({timestamp:c.iso.datetime(),cpuPercent:c.number().nonnegative(),memoryPercent:c.number().nonnegative(),pids:c.number().int().nonnegative()}),V8=c.object({id:c.string().min(1),operation:J8,count:c.number().int().positive(),success:c.boolean(),commitLatencyMs:c.number().nonnegative().optional(),persistenceLatencyMs:c.number().nonnegative().optional(),error:c.string().optional()}),W8=c.object({success:c.boolean(),probesRemaining:c.number().int().nonnegative(),finalEntities:c.number().int().nonnegative().optional(),finalNotes:c.number().int().nonnegative().optional(),contentTreeRestored:c.boolean().optional(),error:c.string().optional()}),Zge=c.object({status:c.string(),restartCount:c.number().int().nonnegative(),oomKilled:c.boolean()}),G8=c.object({health:c.array(M$),runtime:c.array(Lge),externalAiCalls:c.number().int().nonnegative().optional(),container:Zge.optional()}),jge=c.object({profile:Pb,success:c.boolean(),baseline:Dge,phases:c.array(V8),cleanup:W8,metrics:G8,failure:c.string().optional()}),Bge={regression:{profile:"regression",maximumProbeCount:20,phases:[Ut("add20","add",20,20,0),Ut("update20","update",20,20,30000),Ut("delete20","delete",20,0,150000)]},load:{profile:"load",maximumProbeCount:350,phases:[Ut("add50","add",50,50,0),Ut("add150","add",100,150,0),Ut("add350","add",200,350,0),Ut("update350a","update",350,350,45000),Ut("rename100","rename",100,350,45000),Ut("update350b","update",350,350,45000),Ut("delete350","delete",350,0,150000)]},stress:{profile:"stress",maximumProbeCount:700,phases:[Ut("add50","add",50,50,0),Ut("add150","add",100,150,0),Ut("add350","add",200,350,0),Ut("add700","add",350,700,0),Ut("update700a","update",700,700,45000),Ut("rename200","rename",200,700,45000),Ut("update700b","update",700,700,45000),Ut("delete700","delete",700,0,150000)]}}});import{spawn as qge}from"child_process";async function X8(e,t,r,o){let n=await e(t,r,o);if(n.exitCode!==0)throw co(t,r,n);return n}function co(e,t,r){let o=r.stderr.trim()||r.stdout.trim();return Error(`${e} ${t.join(" ")} exited with ${r.exitCode}${o?`: ${o}`:""}`)}var Go=async(e,t,r={})=>new Promise((o,n)=>{let i=qge(e,[...t],{cwd:r.cwd,env:r.env?{...process.env,...r.env}:process.env,stdio:["pipe","pipe","pipe"]}),s="",a="";i.stdout.setEncoding("utf8"),i.stderr.setEncoding("utf8"),i.stdout.on("data",(l)=>{s+=l}),i.stderr.on("data",(l)=>{a+=l}),i.on("error",n),i.on("close",(l)=>{o({exitCode:l??1,stdout:s,stderr:a})}),i.stdin.end(r.stdin)});var of=()=>{};class Ul{#e;#t;dir;constructor(e,t,r){this.#e=e,this.dir=t,this.#t=r}static async clone(e,t,r,o){let n=new Ul(e,r,o);return await X8(e,"git",["-c","credential.helper=","-c",`credential.helper=${eH}`,"clone","--branch","main","--single-branch",`https://github.com/${t}.git`,r],{env:n.environment()}),await n.run(["config","--local","credential.helper",eH]),await n.run(["reset","--hard","origin/main"]),n}async run(e,t=!0){let r=await this.#e("git",e,{cwd:this.dir,env:this.environment()});if(t&&r.exitCode!==0)throw co("git",e,r);return r}async output(e){return(await this.run(e)).stdout.trim()}async sync(e=!1){if(await this.run(["fetch","origin","main"]),e)await this.run(["reset","--hard","origin/main"]);else await this.run(["pull","--rebase","origin","main"])}async commitAll(e){await this.run(["add","-A"]),await this.run(["-c","user.name=brains-ops","-c","user.email=ops@rizom.ai","commit","-m",e])}async pushMainWithRebase(){for(let e=1;e<=5;e+=1){if((await this.run(["push","origin","main"],!1)).exitCode===0)return;await this.run(["pull","--rebase","origin","main"])}throw Error("Unable to push content main after five rebase attempts")}async pruneStressBackupBranches(){let t=(await this.run(["ls-remote","--heads","origin","refs/heads/ops/directory-sync-stress-backup-*"])).stdout.split(/\r?\n/).map((r)=>r.match(/\trefs\/heads\/(ops\/directory-sync-stress-backup-[^\s]+)$/)?.[1]).filter((r)=>r!==void 0).sort();for(let r of t)await this.run(["push","origin","--delete",r]);return t}environment(){return{GH_TOKEN:this.#t,GITHUB_TOKEN:this.#t}}}var eH='!f() { test "$1" = get && echo username=x-access-token && echo "password=$GH_TOKEN"; }; f';var tH=S(()=>{of()});function sf(e){return e.entityCounts.find((t)=>t.entityType==="note")?.count??0}class H${#e;#t=[];#r=[];#n=new Set(["/health/ready"]);#o=!0;#i;#a;#s="";#c=0;#l;constructor(e){this.#e=e}get startedAt(){return this.#s}get error(){return this.#a}get healthSamples(){return this.#t}get runtimeSamples(){return this.#r}gateHealthSamples(){return this.#t.slice(this.#c,this.#l??this.#t.length)}markGateEnd(){this.#l=this.#t.length}async discoverEndpoints(){for(let e of["/health/live","/health/operate"])if((await q$(`https://${this.#e.domain}${e}`,{fetchImpl:this.#e.fetchImpl,now:this.#e.now,timeoutMs:5000})).status!==404)this.#n.add(e)}start(){this.#o=!1,this.#a=void 0,this.#c=this.#t.length,this.#l=void 0,this.#s=this.#e.now().toISOString(),this.#i=Promise.all([this.#m(),this.#f()]).then(()=>{return}).catch((e)=>{this.#a=e,this.#o=!0})}async stop(){this.#o=!0,await this.#i}async waitForHealthSnapshot(e){return this.waitForEntityBaseline(void 0,void 0,e)}async waitForEntityBaseline(e,t,r){let o=this.#e.now().getTime();while(this.#e.now().getTime()-o<r){let n=await this.fetchHealthPayload();if(this.#p(n,e,t))return n;await this.#e.sleep(5000)}return}async waitForStableEntityBaseline(e,t,r){let o=this.#e.now().getTime(),n=0;while(this.#e.now().getTime()-o<r){let i=await this.fetchHealthPayload();if(this.#p(i,e,t)){if(n+=1,n===2)return i}else n=0;await this.#e.sleep(5000)}return}async fetchHealthPayload(){let e=await this.#d();if(e===void 0)return;let t=await this.#e.readEntityCounts();if(!t)return;return{version:e,entities:t.reduce((r,o)=>r+o.count,0),entityCounts:t}}async#d(){let e=this.#e.now(),t=new AbortController,r=setTimeout(()=>t.abort(),20000);try{let o=await this.#e.fetchImpl(`https://${this.#e.domain}/health/operate`,{signal:t.signal}),n=await o.text();if(this.#t.push({timestamp:e.toISOString(),endpoint:"/health/operate",status:o.status,durationMs:Math.max(0,this.#e.now().getTime()-e.getTime()),ok:o.ok}),!o.ok)return;return Fge.parse(JSON.parse(n)).app.version}catch(o){this.#t.push({timestamp:e.toISOString(),endpoint:"/health/operate",status:0,durationMs:Math.max(0,this.#e.now().getTime()-e.getTime()),ok:!1,error:o instanceof Error?`${o.name}: ${o.message}`:String(o)});return}finally{clearTimeout(r)}}#p(e,t,r){return e!==void 0&&(t===void 0||sf(e)===t)&&(r===void 0||e.entities===r)}async#m(){while(!this.#o){for(let e of this.#n)this.#t.push(await q$(`https://${this.#e.domain}${e}`,{fetchImpl:this.#e.fetchImpl,now:this.#e.now,timeoutMs:20000}));await this.#e.sleep(4000)}}async#f(){while(!this.#o){let e=await this.#e.sampleRuntime();if(e)this.#r.push(e);await this.#e.sleep(1000)}}}var rH,Fge;var nH=S(()=>{de();F$();rH=c.array(c.object({entityType:c.string(),count:c.number().int().nonnegative()})),Fge=c.object({status:c.literal("ready"),operationalStatus:c.literal("operational"),app:c.object({version:c.string()})})});var Db={};Lt(Db,{applyDirectorySyncStressPhase:()=>aH,cleanupDirectorySyncStress:()=>tye,listProbeFiles:()=>xa,parseStressRuntimeSample:()=>cH,removeProbeFiles:()=>Y$,runDeployedDirectorySyncStress:()=>Xge,runStressCommand:()=>Go,verifyDirectorySyncStressAccess:()=>eye});import{chmod as Hge,mkdir as K$,mkdtemp as V$,readFile as Jge,readdir as Kge,rename as Vge,rm as cf,writeFile as Tn}from"fs/promises";import{tmpdir as W$}from"os";import{join as ct,resolve as G$}from"path";async function Xge(e){let t=e.now??(()=>new Date),r=t().toISOString(),o=X$(r),n=G$(e.artifactsDir??ct(e.rootDir,".brains-ops","stress",o));await K$(n,{recursive:!0});let{pilot:i,user:s}=await Q$(e.rootDir,e.handle);Nb({handle:s.handle,domain:s.domain,contentRepo:s.contentRepo,confirmation:e.confirmation});let a=Pb.parse(e.profile),l=e.plan?zb.parse(e.plan):Q8(a);if(l.profile!==a)throw Error(`Directory-sync stress plan profile ${l.profile} does not match requested profile ${a}`);if((l.maximumExternalAiCalls??0)===0)sH(s);let u=Wge.parse(e.env??process.env),d=new iH({runId:o,artifactsDir:n,user:s,githubOrg:i.githubOrg,serverLabel:`${i.contentRepoPrefix}${s.handle}`,environment:u,fetchImpl:e.fetchImpl??fetch,commandRunner:e.commandRunner??Go,logger:e.logger??console.info,now:t,sleep:e.sleep??Bun.sleep}),p;try{p=await Y8(l,d)}finally{await d.dispose()}let m={runId:o,artifactsDir:n,target:{handle:s.handle,domain:s.domain,contentRepo:`${i.githubOrg}/${s.contentRepo}`},startedAt:r,completedAt:t().toISOString(),report:p};return await oye(m),m}async function eye(e){let r=(e.now??(()=>new Date))().toISOString(),o=X$(r),n=G$(e.artifactsDir??ct(e.rootDir,".brains-ops","stress",`access-check-${o}`));await K$(n,{recursive:!0});let{pilot:i,user:s}=await Q$(e.rootDir,e.handle);Nb({handle:s.handle,domain:s.domain,contentRepo:s.contentRepo,confirmation:e.confirmation}),sH(s);let a=(e.env??process.env).CONTENT_REPO_ADMIN_TOKEN;if(!a)throw Error("Missing CONTENT_REPO_ADMIN_TOKEN");let l=await V$(ct(W$(),"brains-ops-directory-sync-access-check-"));try{let u=await Ul.clone(e.commandRunner??Go,`${i.githubOrg}/${s.contentRepo}`,ct(l,"content"),a),d=await u.output(["rev-parse","HEAD"]);await u.run(["push","--dry-run","origin",`HEAD:refs/heads/ops/directory-sync-stress-access-check-${o}`]);let p={success:!0,artifactsDir:n,checkedAt:r,remoteHead:d,target:{handle:s.handle,domain:s.domain,contentRepo:`${i.githubOrg}/${s.contentRepo}`}};return await Tn(ct(n,"access-check.json"),`${JSON.stringify(p,null,2)}
|
|
459
459
|
`),p}finally{await cf(l,{recursive:!0,force:!0})}}async function tye(e){let t=e.now??(()=>new Date),r=G$(e.artifactsDir??ct(e.rootDir,".brains-ops","stress",`cleanup-${X$(t().toISOString())}`));await K$(r,{recursive:!0});let{pilot:o,user:n}=await Q$(e.rootDir,e.handle);Nb({handle:n.handle,domain:n.domain,contentRepo:n.contentRepo,confirmation:e.confirmation});let i=(e.env??process.env).CONTENT_REPO_ADMIN_TOKEN;if(!i)throw Error("Missing CONTENT_REPO_ADMIN_TOKEN");let s=e.commandRunner??Go,a=e.logger??console.info,l=await V$(ct(W$(),"brains-ops-directory-sync-cleanup-")),u=ct(l,"content");try{let d=await Ul.clone(s,`${o.githubOrg}/${n.contentRepo}`,u,i),p=await Y$(d.dir),m;if(p>0)await d.commitAll("test(directory-sync): clean residual stress probes"),await d.pushMainWithRebase(),m=await d.output(["rev-parse","HEAD"]),a(`Removed ${p} directory-sync stress probes`);let h=(await xa(d.dir)).length,b=h===0?await d.pruneStressBackupBranches():[],y={success:h===0,artifactsDir:r,probesRemoved:p,probesRemaining:h,backupBranchesDeleted:b,...m?{cleanupCommit:m}:{}};return await Tn(ct(r,"cleanup.json"),`${JSON.stringify(y,null,2)}
|
|
460
460
|
`),y}finally{await cf(l,{recursive:!0,force:!0})}}class iH{#e;#t;#r;#n;#o;#i;#a;#s;#c;#l;#d;constructor(e){this.#e=e,this.#t=new H$({domain:e.user.domain,fetchImpl:e.fetchImpl,now:e.now,sleep:e.sleep,sampleRuntime:()=>this.#b(),readEntityCounts:()=>this.#y()})}async prepare(e){this.#r=await V$(ct(W$(),"brains-ops-directory-sync-stress-"));let t=ct(this.#r,"content");this.#o=ct(this.#r,"id_ed25519"),this.#i=ct(this.#r,"known_hosts"),this.#a=await this.#m(),await Tn(this.#o,nye(this.#e.environment.KAMAL_SSH_PRIVATE_KEY),{mode:384}),await Hge(this.#o,384);let r=await this.#S("ssh-keyscan",["-T","10","-t","ed25519",this.#a]);if(r.exitCode!==0||!r.stdout.trim())throw Error("Unable to resolve smoke SSH host key");await Tn(this.#i,r.stdout,{mode:384});let o=await this.#h(["docker","ps","--filter","label=service=rover","--filter","label=role=web","--format","{{.Names}}"]);if(this.#s=o.stdout.trim().split(/\r?\n/)[0],!this.#s||!/^[A-Za-z0-9_.-]+$/.test(this.#s))throw Error("Unable to resolve a running smoke container");let n=await Ul.clone(this.#e.commandRunner,`${this.#e.githubOrg}/${this.#e.user.contentRepo}`,t,this.#e.environment.CONTENT_REPO_ADMIN_TOKEN);if(this.#n=n,(await xa(n.dir)).length>0)throw Error("Directory-sync stress probes already exist");let i=await n.output(["rev-parse","HEAD"]);this.#l=await n.output(["rev-parse","HEAD^{tree}"]),this.#d=await this.#p();let s=await this.#t.waitForHealthSnapshot(60000);if(!s)throw Error("Smoke health was unavailable before stress testing");return this.#c=`ops/directory-sync-stress-backup-${this.#e.runId}`,await n.run(["push","origin",`HEAD:refs/heads/${this.#c}`]),await this.#t.discoverEndpoints(),await Tn(ct(this.#e.artifactsDir,"state.json"),`${JSON.stringify({runId:this.#e.runId,profile:e.profile,originalHead:i,originalTree:this.#l,backupBranch:this.#c,baseline:{entities:s.entities,notes:sf(s),version:s.version}},null,2)}
|
|
461
461
|
`),this.#e.logger(`Prepared ${e.profile} directory-sync stress run for ${this.#e.user.handle}`),{entities:s.entities,notes:sf(s),version:s.version}}async startMonitoring(){this.#v(),this.#t.start()}async executePhase(e,t){this.#v();let r=this.#n;if(!r)throw Error("Directory-sync stress checkout is not prepared");await r.sync();let o=this.#t.healthSamples.length,n=this.#e.now().getTime(),i=await this.#g();if(i?.pending!==0||i.processing!==0)return Ml(e,"health did not provide a drained queue before the phase");await aH(r.dir,e),await r.commitAll(`test(directory-sync): stress ${e.id}`),await r.pushMainWithRebase();let s=this.#e.now().getTime(),a=await r.output(["rev-parse","HEAD"]),l=await this.#f(a,900000);if(l===void 0)return Ml(e,"runtime did not pull the phase commit");let u;if(e.operation==="rename"){let h=t.notes+e.targetProbeCount;if(e.settleMs>0)await this.#e.sleep(e.settleMs);let b=await this.#t.waitForStableEntityBaseline(h,void 0,1200000);if(u=this.#e.now().getTime()-s,!b)return Ml(e,`health did not stabilize at ${h} notes`,l,u)}else if(e.operation==="add"||e.operation==="delete"){let h=t.notes+e.targetProbeCount,b=this.#e.now().getTime(),y=await this.#t.waitForEntityBaseline(h,void 0,1200000);if(u=this.#e.now().getTime()-b,!y)return Ml(e,`health did not reach ${h} notes`,l,u)}if(e.operation!=="rename"&&e.settleMs>0)await this.#e.sleep(e.settleMs);let d=e.operation==="delete"?0:Math.ceil(e.count/50);if(!await this.#u(i.completedImports+d,1200000))return Ml(e,`health did not observe ${d} completed import job(s) with a drained queue`,l,u);let m=this.#t.healthSamples.slice(o).find((h)=>!h.ok);if(m)return Ml(e,`${m.endpoint} unavailable (${m.status===0?m.error??"unknown":m.status})`,l,u);return this.#e.logger(`Completed ${e.id} in ${this.#e.now().getTime()-n}ms`),{id:e.id,operation:e.operation,count:e.count,success:!0,commitLatencyMs:l,...u===void 0?{}:{persistenceLatencyMs:u}}}async cleanup(e){let t=this.#n;if(!t)return{success:!1,probesRemaining:0,error:"stress checkout was not prepared"};try{if(await t.sync(!0),await Y$(t.dir)>0)await t.commitAll("test(directory-sync): remove stress probes"),await t.pushMainWithRebase();let o=(await xa(t.dir)).length;this.#t.markGateEnd();let n=await this.#t.waitForEntityBaseline(e.notes,e.entities,1200000);await t.sync(!0);let s=await t.output(["rev-parse","HEAD^{tree}"])===this.#l,a=o===0&&n!==void 0&&s;if(a&&this.#c){if((await t.run(["push","origin","--delete",this.#c],!1)).exitCode!==0)this.#e.logger(`Warning: unable to delete backup branch ${this.#c}`)}return{success:a,probesRemaining:o,...n?{finalEntities:n.entities,finalNotes:sf(n)}:{},contentTreeRestored:s,...!a?{error:!n?"entity baseline was not restored before cleanup timeout":!s?"content tree differs from the pre-stress baseline":"stress probes remain after cleanup"}:{}}}catch(r){return{success:!1,probesRemaining:(await xa(t.dir)).length,error:Ve(r)}}}async stopMonitoring(){await this.#t.stop(),await Tn(ct(this.#e.artifactsDir,"health-samples.json"),`${JSON.stringify(this.#t.healthSamples,null,2)}
|
|
462
|
-
`);let e=0;if(this.#s&&this.#t.startedAt){let o=await this.#h(["docker","logs","--since",this.#t.startedAt,this.#s],!1),n=`${o.stdout}${o.stderr}`;e=n.match(/\] ai:usage \{/g)?.length??0,await Tn(ct(this.#e.artifactsDir,"runtime.log"),n)}let t=await this.#p(),r={health:this.#t.gateHealthSamples(),runtime:[...this.#t.runtimeSamples],externalAiCalls:e,...t?{container:t}:{}};if(this.#t.error)throw this.#t.error;return r}async dispose(){if(await this.#t.stop(),this.#r)await cf(this.#r,{recursive:!0,force:!0})}async#p(){if(!this.#s)return;let e=await this.#h(["docker","inspect",this.#s],!1);if(e.exitCode!==0)throw Error(`docker inspect ${this.#s} exited with code ${e.exitCode}`);let t;try{t=c.array(c.object({RestartCount:c.number().int().nonnegative(),State:c.object({Status:c.string(),OOMKilled:c.boolean(),StartedAt:c.string().min(1)})})).parse(JSON.parse(e.stdout))}catch(i){throw Error(`Could not read docker inspect output for ${this.#s}`,{cause:i})}let r=t[0];if(!r)throw Error("docker inspect reported no such container");let o=Math.max(0,r.RestartCount-(this.#d?.restartCount??0)),n=this.#d!==void 0&&r.State.StartedAt!==this.#d.startedAt;return{status:r.State.Status,restartCount:Math.max(o,n?1:0),oomKilled:r.State.OOMKilled&&!(this.#d?.oomKilled??!1),startedAt:r.State.StartedAt}}async#m(){let e=encodeURIComponent(`brain=${this.#e.serverLabel}`),t=await this.#e.fetchImpl(`https://api.hetzner.cloud/v1/servers?label_selector=${e}`,{headers:{Authorization:`Bearer ${this.#e.environment.HCLOUD_TOKEN}`}});if(!t.ok)throw Error(`Hetzner server lookup failed with ${t.status}`);let o=Gge.parse(await t.json()).servers[0];if(o?.status!=="running")throw Error("Smoke server is not running");return o.public_net.ipv4.ip}async#f(e,t){let r=this.#s;if(!r)throw Error("Directory-sync stress container is not prepared");let o=this.#e.now().getTime();while(this.#e.now().getTime()-o<t){if((await this.#h(["docker","exec",r,"git","-C","/app/brain-data","merge-base","--is-ancestor",e,"HEAD"],!1)).exitCode===0)return this.#e.now().getTime()-o;await this.#e.sleep(5000)}return}async#g(){let e=new AbortController,t=setTimeout(()=>e.abort(),20000),r;try{let i=await this.#e.fetchImpl(`https://${this.#e.user.domain}/health/operate`,{method:"GET",signal:e.signal});if(!i.ok)return;r=await i.json()}catch{return}finally{clearTimeout(t)}let o=Qge.safeParse(r);if(!o.success)throw Error(`Unexpected /health/operate payload from ${this.#e.user.domain}`,{cause:o.error});let n=o.data.resources.queue.byType.filter((i)=>i.type==="directory-sync:directory-import"&&i.status==="completed").reduce((i,s)=>i+s.count,0);return{pending:o.data.resources.queue.totals.pending,processing:o.data.resources.queue.totals.processing,completedImports:n}}async#u(e,t){let r=this.#e.now().getTime(),o=0;while(this.#e.now().getTime()-r<t){let n=await this.#g();if(n?.pending===0&&n.processing===0&&n.completedImports>=e){if(o+=1,o===2)return!0}else o=0;await this.#e.sleep(5000)}return!1}async#y(){let e=this.#s;if(!e)throw Error("Directory-sync stress container is not prepared");let t=await this.#h(["docker","exec",e,"bun","-e",`'${Yge}'`],!1);if(t.exitCode!==0)return;try{return rH.parse(JSON.parse(t.stdout))}catch(r){throw Error(`Could not read entity counts from ${e}`,{cause:r})}}async#b(){let e=this.#s;if(!e)throw Error("Directory-sync stress container is not prepared");let t=await this.#h(["timeout","15","docker","stats","--no-stream","--format","{{.CPUPerc}},{{.MemPerc}},{{.PIDs}}",e],!1);return cH(t.stdout.trim(),this.#e.now().toISOString())}async#h(e,t=!0){let r=this.#o,o=this.#i,n=this.#a;if(!r||!o||!n)throw Error("Directory-sync stress SSH access is not prepared");let i=await this.#S("ssh",["-i",r,"-o","BatchMode=yes","-o","IdentitiesOnly=yes","-o","ConnectTimeout=10","-o","StrictHostKeyChecking=yes","-o",`UserKnownHostsFile=${o}`,`root@${n}`,...e]);if(t&&i.exitCode!==0)throw
|
|
462
|
+
`);let e=0;if(this.#s&&this.#t.startedAt){let o=await this.#h(["docker","logs","--since",this.#t.startedAt,this.#s],!1),n=`${o.stdout}${o.stderr}`;e=n.match(/\] ai:usage \{/g)?.length??0,await Tn(ct(this.#e.artifactsDir,"runtime.log"),n)}let t=await this.#p(),r={health:this.#t.gateHealthSamples(),runtime:[...this.#t.runtimeSamples],externalAiCalls:e,...t?{container:t}:{}};if(this.#t.error)throw this.#t.error;return r}async dispose(){if(await this.#t.stop(),this.#r)await cf(this.#r,{recursive:!0,force:!0})}async#p(){if(!this.#s)return;let e=await this.#h(["docker","inspect",this.#s],!1);if(e.exitCode!==0)throw Error(`docker inspect ${this.#s} exited with code ${e.exitCode}`);let t;try{t=c.array(c.object({RestartCount:c.number().int().nonnegative(),State:c.object({Status:c.string(),OOMKilled:c.boolean(),StartedAt:c.string().min(1)})})).parse(JSON.parse(e.stdout))}catch(i){throw Error(`Could not read docker inspect output for ${this.#s}`,{cause:i})}let r=t[0];if(!r)throw Error("docker inspect reported no such container");let o=Math.max(0,r.RestartCount-(this.#d?.restartCount??0)),n=this.#d!==void 0&&r.State.StartedAt!==this.#d.startedAt;return{status:r.State.Status,restartCount:Math.max(o,n?1:0),oomKilled:r.State.OOMKilled&&!(this.#d?.oomKilled??!1),startedAt:r.State.StartedAt}}async#m(){let e=encodeURIComponent(`brain=${this.#e.serverLabel}`),t=await this.#e.fetchImpl(`https://api.hetzner.cloud/v1/servers?label_selector=${e}`,{headers:{Authorization:`Bearer ${this.#e.environment.HCLOUD_TOKEN}`}});if(!t.ok)throw Error(`Hetzner server lookup failed with ${t.status}`);let o=Gge.parse(await t.json()).servers[0];if(o?.status!=="running")throw Error("Smoke server is not running");return o.public_net.ipv4.ip}async#f(e,t){let r=this.#s;if(!r)throw Error("Directory-sync stress container is not prepared");let o=this.#e.now().getTime();while(this.#e.now().getTime()-o<t){if((await this.#h(["docker","exec",r,"git","-C","/app/brain-data","merge-base","--is-ancestor",e,"HEAD"],!1)).exitCode===0)return this.#e.now().getTime()-o;await this.#e.sleep(5000)}return}async#g(){let e=new AbortController,t=setTimeout(()=>e.abort(),20000),r;try{let i=await this.#e.fetchImpl(`https://${this.#e.user.domain}/health/operate`,{method:"GET",signal:e.signal});if(!i.ok)return;r=await i.json()}catch{return}finally{clearTimeout(t)}let o=Qge.safeParse(r);if(!o.success)throw Error(`Unexpected /health/operate payload from ${this.#e.user.domain}`,{cause:o.error});let n=o.data.resources.queue.byType.filter((i)=>i.type==="directory-sync:directory-import"&&i.status==="completed").reduce((i,s)=>i+s.count,0);return{pending:o.data.resources.queue.totals.pending,processing:o.data.resources.queue.totals.processing,completedImports:n}}async#u(e,t){let r=this.#e.now().getTime(),o=0;while(this.#e.now().getTime()-r<t){let n=await this.#g();if(n?.pending===0&&n.processing===0&&n.completedImports>=e){if(o+=1,o===2)return!0}else o=0;await this.#e.sleep(5000)}return!1}async#y(){let e=this.#s;if(!e)throw Error("Directory-sync stress container is not prepared");let t=await this.#h(["docker","exec",e,"bun","-e",`'${Yge}'`],!1);if(t.exitCode!==0)return;try{return rH.parse(JSON.parse(t.stdout))}catch(r){throw Error(`Could not read entity counts from ${e}`,{cause:r})}}async#b(){let e=this.#s;if(!e)throw Error("Directory-sync stress container is not prepared");let t=await this.#h(["timeout","15","docker","stats","--no-stream","--format","{{.CPUPerc}},{{.MemPerc}},{{.PIDs}}",e],!1);return cH(t.stdout.trim(),this.#e.now().toISOString())}async#h(e,t=!0){let r=this.#o,o=this.#i,n=this.#a;if(!r||!o||!n)throw Error("Directory-sync stress SSH access is not prepared");let i=await this.#S("ssh",["-i",r,"-o","BatchMode=yes","-o","IdentitiesOnly=yes","-o","ConnectTimeout=10","-o","StrictHostKeyChecking=yes","-o",`UserKnownHostsFile=${o}`,`root@${n}`,...e]);if(t&&i.exitCode!==0)throw co("ssh",e,i);return i}async#S(e,t,r){return this.#e.commandRunner(e,t,r)}#v(){if(!this.#n||!this.#o||!this.#i||!this.#a||!this.#s)throw Error("Directory-sync stress driver is not prepared")}}function sH(e){if(e.embeddingEnabled!==!1)throw Error("Directory-sync stress requires embeddingEnabled: false for a hermetic smoke workload");if(e.topicExtractionEnabled!==!1)throw Error("Directory-sync stress requires topicExtractionEnabled: false for a hermetic smoke workload");if(e.skillDerivationEnabled!==!1)throw Error("Directory-sync stress requires skillDerivationEnabled: false for a hermetic smoke workload");if(e.swotDerivationEnabled!==!1)throw Error("Directory-sync stress requires swotDerivationEnabled: false for a hermetic smoke workload")}async function Q$(e,t){let r=await xt(e),o=r.users.find((n)=>n.handle===t);if(!o)throw Error(`Unknown pilot user: ${t}`);return{pilot:r.pilot,user:o}}async function aH(e,t){let r=await xa(e);switch(t.operation){case"add":{let o=t.targetProbeCount-r.length;if(o!==t.count)throw Error(`${t.id} expected to add ${t.count} probes from ${r.length}`);let n=r.map(rye).filter((s)=>s!==void 0),i=n.length===0?1:Math.max(...n)+1;for(let s=i;s<i+o;s+=1){let a=String(s).padStart(3,"0");await Tn(ct(e,`directory-sync-stress-${a}.md`),["---",`title: "Directory Sync Stress ${a}"`,"---","",`Deterministic directory-sync stress probe ${a}.`,"Payload: abcdefghijklmnopqrstuvwxyz-0123456789-abcdefghijklmnopqrstuvwxyz.",""].join(`
|
|
463
463
|
`))}break}case"update":{if(r.length!==t.count)throw Error(`${t.id} expected ${t.count} probes, found ${r.length}`);for(let o of r){let n=ct(e,o),i=await Jge(n,"utf8");await Tn(n,`${i.trimEnd()}
|
|
464
464
|
|
|
465
465
|
Update marker: ${t.id}.
|
|
@@ -763,13 +763,13 @@ deployed_container_restarted=false
|
|
|
763
763
|
EOF
|
|
764
764
|
pass "fleet watchdog isolation smoke completed"
|
|
765
765
|
printf 'REMOTE_ARTIFACT_DIR=%s\\n' "$remote_dir"
|
|
766
|
-
`;var pH=()=>{};var oO={};Lt(oO,{assertHealthWatchdogSmokeTarget:()=>nO,cleanupHealthWatchdogSmoke:()=>hye,renderHealthWatchdogSmokeRemoteScript:()=>yH,runHealthWatchdogSmoke:()=>mye});import{chmod as uye,mkdir as mH,mkdtemp as dye,rm as rO,writeFile as ql}from"fs/promises";import{tmpdir as pye}from"os";import{join as
|
|
767
|
-
`),p}async function hye(e){let t=hH(e.artifactsDir??
|
|
768
|
-
`),i}async function bH(e,t){let r=await xt(e),o=r.users.find((n)=>n.handle===t);if(!o)throw Error(`Unknown pilot user: ${t}`);return{pilot:r.pilot,user:o}}async function SH(e){let t=await dye(
|
|
766
|
+
`;var pH=()=>{};var oO={};Lt(oO,{assertHealthWatchdogSmokeTarget:()=>nO,cleanupHealthWatchdogSmoke:()=>hye,renderHealthWatchdogSmokeRemoteScript:()=>yH,runHealthWatchdogSmoke:()=>mye});import{chmod as uye,mkdir as mH,mkdtemp as dye,rm as rO,writeFile as ql}from"fs/promises";import{tmpdir as pye}from"os";import{join as lo,resolve as hH}from"path";function nO(e){let t=`watchdog-smoke:${e.handle}`;if(e.confirmation!==t)throw Error(`Health watchdog smoke requires --confirm ${t}`);if(!/^[A-Za-z0-9][A-Za-z0-9_.-]{0,100}$/.test(e.runId))throw Error("Health watchdog smoke run ID is invalid");let r=/(^|[-_.])smoke($|[-_.])/i;if(!r.test(e.handle)||!r.test(e.domain))throw Error("Health watchdog smoke is smoke-only; handle and domain must both identify smoke")}function yH(){return fH.replace("__WATCHDOG_PAYLOAD_BASE64__",Buffer.from(uH,"utf8").toString("base64")).replace("__WATCHDOG_LABEL_FILTER__",eO)}async function mye(e){let t=hH(e.artifactsDir??lo(e.rootDir,".brains-ops","watchdog-smoke",e.runId)),r=await bH(e.rootDir,e.handle);nO({handle:r.user.handle,domain:r.user.domain,confirmation:e.confirmation,runId:e.runId}),await mH(t,{recursive:!0});let o=gH.parse(e.env??process.env),n=e.commandRunner??Go,i=e.logger??console.info,s=await SH({target:r,environment:o,commandRunner:n,fetchImpl:e.fetchImpl??fetch}),a=`/tmp/brains-health-watchdog-smoke-${e.runId}`,l,u=!1;try{let m=await tO(s,"run",e.runId);if(await Zb(t,"remote",m),m.stdout.trim())i(m.stdout.trim());if(m.exitCode!==0)l=co("ssh",["watchdog-smoke","run"],m);let h=await gye(s,a,t);if(await Zb(t,"scp",h),h.exitCode===0){if(u=await Ar(lo(t,"summary.txt")),!u)l??=Error("Health watchdog smoke evidence is missing summary.txt")}else l??=co("scp",[a,t],h)}catch(m){l=Error(Ve(m,"Health watchdog smoke execution failed"))}let d;try{let m=await tO(s,"cleanup",e.runId);if(await Zb(t,"cleanup",m),m.exitCode!==0)d=co("ssh",["watchdog-smoke","cleanup"],m)}catch(m){d=Error(Ve(m,"Health watchdog smoke cleanup failed"))}finally{await rO(s.temporaryRoot,{recursive:!0,force:!0})}if(l)throw l;if(d)throw d;if(!u)throw Error("Health watchdog smoke completed without copied evidence");let p={success:!0,runId:e.runId,artifactsDir:t,target:{handle:r.user.handle,domain:r.user.domain,serverIp:s.serverIp}};return await ql(lo(t,"result.json"),`${JSON.stringify(p,null,2)}
|
|
767
|
+
`),p}async function hye(e){let t=hH(e.artifactsDir??lo(e.rootDir,".brains-ops","watchdog-smoke",`cleanup-${e.runId}`)),r=await bH(e.rootDir,e.handle);nO({handle:r.user.handle,domain:r.user.domain,confirmation:e.confirmation,runId:e.runId}),await mH(t,{recursive:!0});let o=gH.parse(e.env??process.env),n=await SH({target:r,environment:o,commandRunner:e.commandRunner??Go,fetchImpl:e.fetchImpl??fetch});try{let s=await tO(n,"cleanup",e.runId);if(await Zb(t,"cleanup",s),s.stdout.trim())(e.logger??console.info)(s.stdout.trim());if(s.exitCode!==0)throw co("ssh",["watchdog-smoke","cleanup"],s)}finally{await rO(n.temporaryRoot,{recursive:!0,force:!0})}let i={success:!0,runId:e.runId,artifactsDir:t,target:{handle:r.user.handle,domain:r.user.domain,serverIp:n.serverIp}};return await ql(lo(t,"result.json"),`${JSON.stringify(i,null,2)}
|
|
768
|
+
`),i}async function bH(e,t){let r=await xt(e),o=r.users.find((n)=>n.handle===t);if(!o)throw Error(`Unknown pilot user: ${t}`);return{pilot:r.pilot,user:o}}async function SH(e){let t=await dye(lo(pye(),"brains-ops-watchdog-smoke-")),r=lo(t,"id_ed25519"),o=lo(t,"known_hosts");try{let n=encodeURIComponent(`brain=${e.target.pilot.contentRepoPrefix}${e.target.user.handle}`),i=await e.fetchImpl(`https://api.hetzner.cloud/v1/servers?label_selector=${n}`,{headers:{Authorization:`Bearer ${e.environment.HCLOUD_TOKEN}`}});if(!i.ok)throw Error(`Hetzner server lookup failed with ${i.status}`);let s=fye.parse(await i.json());if(s.servers.length!==1)throw Error(`Expected one smoke server, found ${s.servers.length}`);let a=s.servers[0];if(a?.status!=="running")throw Error("Smoke server is not running");await ql(r,yye(e.environment.KAMAL_SSH_PRIVATE_KEY),{mode:384}),await uye(r,384);let l=await e.commandRunner("ssh-keyscan",["-T","10","-t","ed25519",a.public_net.ipv4.ip]);if(l.exitCode!==0||!l.stdout.trim())throw Error("Unable to resolve watchdog smoke SSH host key");return await ql(o,l.stdout,{mode:384}),{temporaryRoot:t,sshKeyPath:r,knownHostsPath:o,serverIp:a.public_net.ipv4.ip,commandRunner:e.commandRunner}}catch(n){throw await rO(t,{recursive:!0,force:!0}),n}}async function tO(e,t,r){return e.commandRunner("ssh",[...vH(e),`root@${e.serverIp}`,"bash","-s","--",t,r],{stdin:yH()})}async function gye(e,t,r){return e.commandRunner("scp",[...vH(e),"-r",`root@${e.serverIp}:${t}/.`,r])}function vH(e){return["-i",e.sshKeyPath,"-o","BatchMode=yes","-o","IdentitiesOnly=yes","-o","ConnectTimeout=10","-o","StrictHostKeyChecking=yes","-o",`UserKnownHostsFile=${e.knownHostsPath}`]}async function Zb(e,t,r){await Promise.all([ql(lo(e,`${t}.stdout.log`),r.stdout),ql(lo(e,`${t}.stderr.log`),r.stderr)])}function yye(e){return`${e.replace(/\r\n/g,`
|
|
769
769
|
`).replace(/\\n/g,`
|
|
770
770
|
`).trimEnd()}
|
|
771
771
|
`}var gH,fye;var iO=S(async()=>{de();pH();gn();of();Ys();await dH();gH=c.object({HCLOUD_TOKEN:c.string().min(1),KAMAL_SSH_PRIVATE_KEY:c.string().min(1)}),fye=c.object({servers:c.array(c.object({status:c.string(),public_net:c.object({ipv4:c.object({ip:c.string().min(1)})})}))})});import{parseArgs as oJ}from"util";function nt(e){return e}class uf extends Error{constructor(e){super(e);this.name="CliUsageError"}}function iJ(e,t){let r={...t};for(let o of e)for(let[n,i]of Object.entries(o.flags??{})){let s=r[n];if(s===void 0){r[n]=i;continue}if(s.type!==i.type||s.short!==i.short||s.default!==i.default)throw Error(`Conflicting definitions for flag --${n}: commands must agree on type, short, and default`)}return r}function sJ(e){let t={};for(let[r,o]of Object.entries(e))t[r]={type:o.type,...o.short!==void 0?{short:o.short}:{},...o.default!==void 0?{default:o.default}:{}};return t}function aJ(e){if(!(e instanceof Error)||!("code"in e))return!1;return e.code==="ERR_PARSE_ARGS_UNKNOWN_OPTION"||e.code==="ERR_PARSE_ARGS_INVALID_OPTION_VALUE"}function cO(e,t){let r=iJ(t.commands,t.globalFlags??{}),o,n;try{({values:o,positionals:n}=oJ({args:e,options:sJ(r),allowPositionals:!0,strict:t.strict??!0}))}catch(s){if(aJ(s))throw new uf(s.message.split(". ")[0]??s.message);throw s}if("help"in r&&o.help===!0)return{command:"help",args:[],flags:{help:!0}};if("version"in r&&o.version===!0)return{command:"version",args:[],flags:{version:!0}};let i={};for(let[s,a]of Object.entries(r)){let l=o[s];if(typeof l==="string"&&a.type==="string")i[s]=l;else if(typeof l==="boolean"&&a.type==="boolean")i[s]=l}return{command:n[0]??"help",args:n.slice(1),flags:i}}function lO(e){let t=e.reduce((r,o)=>Math.max(r,o.label.length),0);return e.map((r)=>` ${r.label.padEnd(t)} ${r.description}`)}function cJ(e){return lO(e.map((t)=>({label:t.usage?`${t.name} ${t.usage}`:t.name,description:t.description})))}function lJ(e,t){let r=t.type==="string"?` ${t.placeholder??"<value>"}`:"",o=t.short!==void 0?`, -${t.short}`:"";return`--${e}${r}${o}`}function uO(e){return lO(Object.entries(e).map(([t,r])=>({label:lJ(t,r),description:r.description})))}function dO(e,t){return`Usage: ${e} ${t.name}${t.usage?` ${t.usage}`:""}`}function uJ(e){return JSON.stringify(Object.entries(e).map(([t,r])=>[t,r.type,r.short??"",r.description,r.placeholder??"",r.default??""]).sort((t,r)=>String(t[0]).localeCompare(String(r[0]))))}function dJ(e){let t=[],r=new Map;for(let n of e){let i=n.flags??{};if(Object.keys(i).length===0)continue;let s=uJ(i),a=r.get(s);if(a){a.names.push(n.name);continue}let l={names:[n.name],flags:i};r.set(s,l),t.push(l)}let o=[];for(let n of t)o.push("",`${n.names.join(" / ")} options:`),o.push(...uO(n.flags));return o}function pO(e){let t=[e.intro,"",`Usage: ${e.cliName} ${e.usage??"<command> [args]"}`,"","Commands:",...cJ(e.commands)];if(e.globalFlags&&Object.keys(e.globalFlags).length>0)t.push("","Options:",...uO(e.globalFlags));return t.push(...dJ(e.commands)),t.join(`
|
|
772
|
-
`)}function fO(e){let t=new Map;for(let r of e){if(t.has(r.name))throw Error(`Duplicate command name: ${r.name}`);t.set(r.name,r)}return t}function ot(e,t){let r=e[t];return typeof r==="string"?r:void 0}function ps(e,t){let r=e[t];return typeof r==="boolean"?r:void 0}var df={name:"@rizom/ops",version:"0.2.0-alpha.
|
|
772
|
+
`)}function fO(e){let t=new Map;for(let r of e){if(t.has(r.name))throw Error(`Duplicate command name: ${r.name}`);t.set(r.name,r)}return t}function ot(e,t){let r=e[t];return typeof r==="string"?r:void 0}function ps(e,t){let r=e[t];return typeof r==="boolean"?r:void 0}var df={name:"@rizom/ops",version:"0.2.0-alpha.808",description:"Operator CLI for managing private brain fleet registry repos",keywords:["brains","ops","cli","deploy","fleet","operator"],license:"AGPL-3.0-only",author:"Yeehaa <yeehaa@rizom.ai> (https://rizom.ai)",bin:{"brains-ops":"./dist/brains-ops.js"},bugs:"https://github.com/rizom-ai/brains/issues",dependencies:{"@libsql/client":"^0.17.4","age-encryption":"^0.3.0",yaml:"^2.9.0"},devDependencies:{"@brains/contracts":"workspace:*","@brains/deploy-support":"workspace:*","@brains/eslint-config":"workspace:*","@brains/job-queue":"workspace:*","@brains/profile":"workspace:*","@brains/site-composition":"workspace:*","@brains/test-utils":"workspace:*","@brains/typescript-config":"workspace:*","@brains/utils":"workspace:*","@types/bun":"^1.4.0",typescript:"^7.0.2"},engines:{bun:">=1.3.3"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./deploy":{types:"./dist/deploy.d.ts",import:"./dist/deploy.js",bun:"./dist/deploy.js"}},files:["dist","templates"],homepage:"https://github.com/rizom-ai/brains/tree/main/packages/brains-ops#readme",main:"./dist/index.js",publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/rizom-ai/brains.git",directory:"packages/brains-ops"},scripts:{build:"bun scripts/build.ts",lint:"eslint . --max-warnings 0","lint:fix":"eslint . --max-warnings 0 --fix",prepublishOnly:"bun scripts/build.ts",test:"bun test --timeout 20000","test:smoke":"bun run build && RUN_SMOKE_TESTS=1 bun test --timeout 60000",typecheck:"tsc --noEmit"},type:"module",types:"./dist/index.d.ts"};Nv();wi();import{writeFile as YX}from"fs/promises";import{join as Fj}from"path";import{createSign as XW,generateKeyPairSync as eG}from"crypto";import{mkdir as tG,writeFile as fD}from"fs/promises";import{join as mD}from"path";async function l9(e){let t=await e.text();if(!t.trim())return;try{return JSON.parse(t)}catch{return t}}async function Qa(e,t,r){let o=await l9(e),n=t.safeParse(o);if(!e.ok||!n.success){let i=r.formatError??u9;throw Error(`${r.label}${i(e,o)}`)}return n.data}function u9(e,t){let r=t===void 0?"":`: ${typeof t==="string"?t:JSON.stringify(t)}`;return` (${e.status} ${e.statusText}${r})`}de();var rG="2.5.4.3",nG="1.2.840.113549.1.1.11",yD="https://api.cloudflare.com/client/v4",oG="origin-rsa",iG=5475,bD=15000;function SD(e){return{Authorization:`Bearer ${e}`,"Content-Type":"application/json"}}var hD=c.looseObject({message:c.string().optional()}),sG=c.looseObject({errors:c.array(hD).optional(),messages:c.array(hD).optional()}),aG=c.looseObject({certificate:c.string().min(1),expires_on:c.string().optional()}),cG=c.looseObject({success:c.literal(!0),result:aG}),lG=c.looseObject({success:c.literal(!0)});function uG(){let{privateKey:e,publicKey:t}=eG("rsa",{modulusLength:2048,privateKeyEncoding:{type:"pkcs8",format:"pem"},publicKeyEncoding:{type:"spki",format:"der"}});return{privateKeyPem:e,publicKeyDer:Buffer.from(t)}}function dG(e,t){let r=xd(bG(xd(gD(rG),hG(e)))),o=xd(mG(0),r,Buffer.from(t.publicKeyDer),SG(0,Buffer.alloc(0))),n=XW("sha256").update(o).sign(t.privateKeyPem),i=xd(o,xd(gD(nG),yG()),gG(n));return{csrPem:fG("CERTIFICATE REQUEST",i),certificationRequestInfoDer:o,signature:n}}async function pG(e,t,r,o){let n=await e(`${yD}/certificates`,{method:"POST",headers:SD(t),body:JSON.stringify({hostnames:[o,`*.${o}`],requested_validity:iG,request_type:oG,csr:r}),signal:AbortSignal.timeout(bD)}),i=await Qa(n,cG,{label:"Cloudflare Origin CA request failed",formatError:wD}),a={certificatePem:`${i.result.certificate.trim()}
|
|
773
773
|
`};if(i.result.expires_on)a.expiresOn=i.result.expires_on;return a}async function vD(e,t,r){let o=await e(`${yD}/zones/${r}/settings/ssl`,{method:"PATCH",headers:SD(t),body:JSON.stringify({value:"strict"}),signal:AbortSignal.timeout(bD)});await Qa(o,lG,{label:"Cloudflare zone SSL update failed",formatError:wD})}function fG(e,t){let o=t.toString("base64").match(/.{1,64}/g)??[];return[`-----BEGIN ${e}-----`,...o,`-----END ${e}-----`,""].join(`
|
|
774
774
|
`)}function mG(e){if(e!==0)throw Error("Only zero-valued INTEGER encoding is currently supported");return Buffer.from([2,1,0])}function gD(e){let t=e.split(".").map((s)=>Number(s));if(t.length<2||t.some((s)=>Number.isNaN(s)))throw Error(`Invalid OID: ${e}`);let r=t[0],o=t[1];if(r===void 0||o===void 0)throw Error(`Invalid OID: ${e}`);let i=[r*40+o];for(let s of t.slice(2)){let a=wG(s);i.push(...a)}return Tc(6,Buffer.from(i))}function hG(e){return Tc(12,Buffer.from(e,"utf8"))}function gG(e){return Tc(3,Buffer.concat([Buffer.from([0]),e]))}function yG(){return Buffer.from([5,0])}function xd(...e){return Tc(48,Buffer.concat(e))}function bG(...e){return Tc(49,Buffer.concat(e))}function SG(e,t){return Tc(160+e,t)}function Tc(e,t){return Buffer.concat([Buffer.from([e]),vG(t.length),t])}function vG(e){if(e<128)return Buffer.from([e]);let t=[],r=e;while(r>0)t.unshift(r&255),r>>=8;return Buffer.from([128|t.length,...t])}function wG(e){if(!Number.isInteger(e)||e<0)throw Error(`Invalid OID component: ${e}`);if(e===0)return[0];let t=[],r=e;while(r>0)t.unshift(r&127),r>>=7;for(let o=0;o<t.length-1;o+=1)t[o]=(t[o]??0)|128;return t}function wD(e,t){let r=xG(t),o=r.length>0?`: ${r.join("; ")}`:"";return` (${e.status} ${e.statusText}${o})`}function xG(e){let t=sG.safeParse(e);if(!t.success)return[];return[...t.data.errors??[],...t.data.messages??[]].map((r)=>r.message).filter((r)=>typeof r==="string"&&r.length>0)}async function xD(e,t,r){let o=uG(),{csrPem:n}=dG(r,o),i=await pG(e,t,n,r);return{certificatePem:i.certificatePem,privateKeyPem:o.privateKeyPem,...i.expiresOn!==void 0&&{expiresOn:i.expiresOn}}}async function _D(e,t){let r=mD(e,"origin.pem"),o=mD(e,"origin.key");return await tG(e,{recursive:!0}),await Promise.all([fD(r,t.certificatePem,"utf-8"),fD(o,t.privateKeyPem,{encoding:"utf-8",mode:384})]),{certificatePath:r,privateKeyPath:o}}gn();Pu();Mn();async function Jj(e,t={}){try{return await XX(e,t),{success:!0}}catch(r){return{success:!1,message:Ve(r,"Certificate bootstrap failed")}}}async function XX(e,t={}){let r=await xt(e),o=tee(r,t.handle),n=o.domain,i=t.env??process.env,s=Lr(e),a=t.cfApiToken??jt("CF_API_TOKEN",i,s),l=t.cfZoneId??o.cloudflareZoneId??jt("CF_ZONE_ID",i,s);if(!a)throw Error("Missing CF_API_TOKEN");if(!l)throw Error("Missing CF_ZONE_ID");let u=t.fetchImpl??fetch,d=t.logger??console.log,p=await xD(u,a,n),m=Fj(e,".brains-ops","certs",o.id),{certificatePath:h,privateKeyPath:b}=await _D(m,p),y=Fj(m,"secrets.yaml");await YX(y,eee(p.certificatePem,p.privateKeyPem),"utf-8"),await vD(u,a,l);let v=Wa(t.pushTo);if(v)await Si([["CERTIFICATE_PEM",p.certificatePem],["PRIVATE_KEY_PEM",p.privateKeyPem]],{logger:d,runCommand:t.runCommand??tr});if(d(`Issued ${o.id} Origin CA cert for ${n} and *.${n}`),d(`Wrote ${h}`),d(`Wrote ${b}`),d(`Wrote ${y}`),p.expiresOn)d(`Expires on ${p.expiresOn}`);if(d("Cloudflare zone SSL mode set to Full (strict)"),v)d(`Pushed CERTIFICATE_PEM and PRIVATE_KEY_PEM to ${v}`);return{domain:n,certificatePath:h,privateKeyPath:b,certificatePem:p.certificatePem,secretsSnippetPath:y}}function eee(e,t){return[`certificatePem: ${Hj(e)}`,`privateKeyPem: ${Hj(t)}`,""].join(`
|
|
775
775
|
`)}function Hj(e){return`"${e.replace(/"/g,"\\\"").replace(/\n/g,"\\n")}"`}function tee(e,t){if(!t)return{id:"shared",domain:ree(e.pilot.domainSuffix)};let r=e.users.find((o)=>o.handle===t);if(!r)throw Error(`Unknown user handle: ${t}`);return{id:t,domain:r.domain,...r.cloudflareZoneId?{cloudflareZoneId:r.cloudflareZoneId}:{}}}function ree(e){let t=e.trim().replace(/^\./,"").replace(/\.$/,"");if(!t||t.includes("*"))throw Error(`Invalid pilot domainSuffix: ${e}`);return t}import{chmod as JA,mkdir as ug,readFile as Wj,writeFile as Vj}from"fs/promises";import{dirname as aee,join as Bc}from"path";import{fileURLToPath as cee}from"url";wi();Pd();Ys();var lee=["pilot.yaml","package.json",".env.schema",".gitignore","cohorts/cohort-1.yaml","users/alice.yaml",".github/actions/varlock-env/action.yml",".github/workflows/build.yml",".github/workflows/deploy.yml",".github/workflows/directory-sync-stress.yml",".github/workflows/health-watchdog-smoke.yml",".github/workflows/offboard.yml",".github/workflows/reconcile.yml",".github/workflows/upgrade.yml","deploy/Dockerfile","deploy/kamal/deploy.yml","deploy/scripts/helpers.ts","deploy/scripts/create-predeploy-backup.ts","deploy/scripts/install-health-watchdog.ts","deploy/scripts/provision-server.ts","deploy/scripts/pull-local-models.ts","deploy/scripts/reload-homeserver.ts","deploy/scripts/update-dns.ts","deploy/scripts/write-ssh-key.ts","deploy/scripts/decrypt-user-secrets.ts","deploy/scripts/validate-secrets.ts","deploy/scripts/write-kamal-secrets.ts","deploy/scripts/resolve-user-config.ts","deploy/scripts/resolve-missing-images.ts","deploy/scripts/verify-runtime-image.ts","deploy/scripts/resolve-deploy-handles.ts","deploy/scripts/sync-content-repo.ts",".kamal/hooks/pre-deploy","docs/onboarding-checklist.md","docs/canonical-crossover-record.md","docs/operator-playbook.md","docs/user-onboarding.md","README.md"],KA=new Set([".kamal/hooks/pre-deploy"]),uee=new Set(["cohorts/cohort-1.yaml","users/alice.yaml","docs/canonical-crossover-record.md"]),dee=cee(new URL("../templates/rover-pilot/",import.meta.url));function Qn(e){return(t)=>t.includes(e)}function pee(e){return tz.find((t)=>e===`deploy/scripts/${t}`)}function VA(e){return e.replace(/\n {2}secret:\n(?: {4}- .*\n)+\nvolumes:\n/,`
|
|
@@ -787,8 +787,8 @@ writeSecretGitHubEnv("DISCORD_APPLICATION_ID", secrets["discordApplicationId"]);
|
|
|
787
787
|
`];function vee(e,t){let r=(o)=>See.reduce((n,i)=>n.replace(i,""),bee.reduce((n,[i,s])=>n.replace(i,s),o));return r(e)===r(t)}function wee(e){return e.includes('if (eventName !== "push") {')&&e.includes('const currentSha = requireEnv("GITHUB_SHA");')||e.includes("path.match(/^users\\/([^/]+)\\/")&&!e.includes("existsSync(`users/${handle}.yaml`)")}var xee={".env.schema":yee,"deploy/Dockerfile":(e)=>oz(e),"deploy/kamal/deploy.yml":(e)=>fee(e)||mee(e),"deploy/scripts/decrypt-user-secrets.ts":vee,"deploy/scripts/resolve-deploy-handles.ts":(e)=>wee(e),"deploy/scripts/helpers.ts":Qn('"@rizom/ops/deploy"'),"deploy/scripts/resolve-user-config.ts":Qn("sitePackagesFor"),"deploy/scripts/resolve-missing-images.ts":Qn("runResolveMissingImages"),"deploy/scripts/sync-content-repo.ts":Qn("GIT_SYNC_TOKEN"),"deploy/scripts/reload-homeserver.ts":Qn("export async function reloadHomeserver"),".github/workflows/build.yml":Qn("resolve-missing-images.ts"),".github/workflows/deploy.yml":Qn("install-health-watchdog.ts"),".github/workflows/offboard.yml":Qn("user:offboard"),".github/workflows/reconcile.yml":Qn("brains-ops reconcile"),".github/workflows/upgrade.yml":Qn("brains-ops upgrade")};function _ee(e,t,r){let o=pee(e);if(o&&rz(o,t,r))return!0;return xee[e]?.(t,r)??!1}async function Gj(e){await ug(e,{recursive:!0});let t=Bc(e,"views","users.md"),r=await Ar(t),o=await Ar(Bc(e,"pilot.yaml"));await ug(Bc(e,"users"),{recursive:!0}),await ug(Bc(e,"cohorts"),{recursive:!0});let n=lee.filter((i)=>!(o&&uee.has(i))).map(async(i)=>{let s=Bc(e,i);await ug(aee(s),{recursive:!0}),await Eee(i,s)});if(await Promise.all(n),!r)await Pi(e)}async function Eee(e,t){let r=await Iee(e);try{if(await Vj(t,r,{flag:"wx"}),KA.has(e))await JA(t,493);return}catch(n){if(!kee(n,"EEXIST"))throw n}let o=await Wj(t,"utf8");if(o===r){if(KA.has(e))await JA(t,493);return}if(!_ee(e,o,r))return;if(await Vj(t,r),KA.has(e))await JA(t,493)}async function Iee(e){if(e===".gitignore")return`node_modules/
|
|
788
788
|
.brains-ops/
|
|
789
789
|
users/*.secrets.yaml
|
|
790
|
-
`;if(e==="deploy/Dockerfile")return nz();if(e==="deploy/kamal/deploy.yml")return hm({serviceName:"rover"});if(e===".kamal/hooks/pre-deploy")return Dv({deployConfigPath:"deploy/kamal/deploy.yml",brainYamlPath:"${BRAIN_YAML_PATH:-brain.yaml}"});let t=Bc(dee,e),r=await Wj(t,"utf8");return Aee(r)}function Aee(e){return e.replaceAll("__BRAINS_OPS_VERSION__",df.version).replaceAll("__BUN_VERSION__",Bun.version).replaceAll("__PREDEPLOY_BACKUP_SKIP_INPUT__",Lv).replaceAll("__PREDEPLOY_BACKUP_SKIP_CONDITION__",Zv)}function kee(e,t){return typeof e==="object"&&e!==null&&"code"in e&&e.code===t}gn();ek();YA()
|
|
791
|
-
`,"utf-8");if(h.length===0)throw Error(`Unable to derive a public key from ${d}`);let b=await Mte({fetchImpl:i,hcloudToken:a,publicKey:h,sshKeyName:l}),y=Wa(t.pushTo);if(y)await Si([["KAMAL_SSH_PRIVATE_KEY",UB(d,"utf-8")]],{logger:n,runCommand:t.runCommand??tr});if(n(m?`Created ${d}`:`Reusing ${d}`),n(b?`Registered Hetzner SSH key ${l}`:`Hetzner SSH key ${l} already exists`),y)n(`Pushed KAMAL_SSH_PRIVATE_KEY to ${y}`);return{createdHetznerKey:b,createdLocalKey:m,privateKeyPath:d,publicKeyPath:p,sshKeyName:l}}async function Mte(e){let t=new URL("https://api.hetzner.cloud/v1/ssh_keys");t.searchParams.set("name",e.sshKeyName);let r=await e.fetchImpl(t.toString(),{headers:{Authorization:`Bearer ${e.hcloudToken}`,"Content-Type":"application/json"}}),{ssh_keys:o}=await Qa(r,Bte,{label:"Hetzner SSH key lookup failed"}),[n]=o;if(n){if(n.public_key.trim()!==e.publicKey)throw Error(`Existing Hetzner SSH key ${e.sshKeyName} does not match the local public key`);return!1}let i=await e.fetchImpl("https://api.hetzner.cloud/v1/ssh_keys",{method:"POST",headers:{Authorization:`Bearer ${e.hcloudToken}`,"Content-Type":"application/json"},body:JSON.stringify({name:e.sshKeyName,public_key:e.publicKey})});return await Qa(i,c.object({ssh_key:MB}),{label:"Hetzner SSH key create failed"}),!0}function qte(e){return e.replace(/[^A-Za-z0-9._-]+/g,"_")}Nd();bg();Vn()
|
|
790
|
+
`;if(e==="deploy/Dockerfile")return nz();if(e==="deploy/kamal/deploy.yml")return hm({serviceName:"rover"});if(e===".kamal/hooks/pre-deploy")return Dv({deployConfigPath:"deploy/kamal/deploy.yml",brainYamlPath:"${BRAIN_YAML_PATH:-brain.yaml}"});let t=Bc(dee,e),r=await Wj(t,"utf8");return Aee(r)}function Aee(e){return e.replaceAll("__BRAINS_OPS_VERSION__",df.version).replaceAll("__BUN_VERSION__",Bun.version).replaceAll("__PREDEPLOY_BACKUP_SKIP_INPUT__",Lv).replaceAll("__PREDEPLOY_BACKUP_SKIP_CONDITION__",Zv)}function kee(e,t){return typeof e==="object"&&e!==null&&"code"in e&&e.code===t}gn();ek();YA();$o();import{lookup as Dee}from"dns/promises";async function Dd(e,t,r,o){let n=new AbortController,i=setTimeout(()=>n.abort(),o);try{return await e(t,{...r,signal:n.signal})}finally{clearTimeout(i)}}var fB=5000;function mB(e={}){let t=e.fetchImpl??fetch,r=e.lookupHost??Dee;return async function(n){let i=await Lee(n.domain,r),[s,a,l]=await Promise.all([pB(n.domain,"/health/ready",t),pB(n.domain,"/health/operate",t),Zee(n.domain,t)]);return{dnsStatus:i,serverStatus:s,deployStatus:a,mcpStatus:l}}}async function Lee(e,t){try{return(await t(e)).address?"ready":"failed"}catch{return"failed"}}async function pB(e,t,r){try{return(await Dd(r,`https://${e}${t}`,{method:"GET"},fB)).ok?"ready":"failed"}catch{return"failed"}}async function Zee(e,t){try{let r=await Dd(t,`https://${e}/mcp`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{}})},fB);return r.status===401||r.ok?"ready":"failed"}catch{return"failed"}}Ld();async function AB(e,t,r,o={}){let{registry:n,user:i}=await mg(e,t);await Uc(e,n,[i],r,o)}Ld();async function hg(e,t,r={}){let{registry:o,users:n}=await IB(e);await Uc(e,o,n,t,r)}import{createHash as ste}from"crypto";import{cp as ate,lstat as cte,mkdtemp as lte,readFile as ute,readdir as dte,readlink as pte,rm as fte}from"fs/promises";import{tmpdir as mte}from"os";import{basename as hte,join as Zd,relative as gte,resolve as yte,sep as bte}from"path";var Ste=new Set([".git",".operator",".brains-ops",".turbo","dist","node_modules"]);async function TB(e){let t=yte(e),r=await lte(Zd(mte(),"brains-ops-reconcile-")),o=Zd(r,"repo");try{await ate(t,o,{recursive:!0,errorOnExist:!0,force:!1,filter:(a)=>vte(t,a)});let n=await ik(o);await kB(o);let i=await ik(o);await kB(o);let s=await ik(o);return{firstPassChangedFiles:RB(n,i),secondPassChangedFiles:RB(i,s)}}finally{await fte(r,{recursive:!0,force:!0})}}function vte(e,t){let r=gte(e,t);if(r.length===0)return!0;if(r.split(bte).some((n)=>Ste.has(n)))return!1;if(r===".env"||r===".env.local")return!1;return!hte(r).endsWith(".secrets.yaml")}async function kB(e){await hg(e,void 0,{env:{},contentRepoRemoteResolver:()=>{return},fetchImpl:async()=>{throw Error("Dry-run reconcile attempted external HTTP access")},runCommand:async()=>{throw Error("Dry-run reconcile attempted a subprocess")}})}async function ik(e){let t=new Map;return await $B(e,"",t),t}async function $B(e,t,r){let o=Zd(e,t),n=await dte(o,{withFileTypes:!0});n.sort((i,s)=>i.name.localeCompare(s.name));for(let i of n){let s=Zd(t,i.name),a=Zd(e,s);if(i.isDirectory()){await $B(e,s,r);continue}let u=(await cte(a)).isSymbolicLink()?`symlink:${await pte(a)}`:await ute(a);r.set(s,ste("sha256").update(u).digest("hex"))}}function RB(e,t){return[...new Set([...e.keys(),...t.keys()])].filter((o)=>e.get(o)!==t.get(o)).sort()}Ld();async function OB(e,t,r,o={}){let{registry:n,users:i}=await EB(e,t);await Uc(e,n,i,r,o)}Pd();lk();wi();Pu();Mn();import{readFileSync as Tte}from"fs";async function jB(e,t={}){let r=t.env??process.env,o=t.logger??console.log,n=Lr(e),i=Bv(`${e}/.env.schema`),s=Ote(i),a=[],l=[],u=new Map;for(let p of s){u.set(p.key,p.required);let m=Cte(p.key,r,n,e);if(m===void 0||m.trim().length===0){l.push(p.key);continue}a.push([p.key,m])}if(a.length===0)throw Error("No pushable local secrets found for this pilot repo");let d=(p)=>u.get(p)??!1;if(t.dryRun)return o(`Dry run: would push ${a.length} secrets to GitHub Secrets.`),o(`Secrets: ${a.map(([p])=>p).join(", ")}`),Cv(o,l,d),{pushedKeys:a.map(([p])=>p),skippedKeys:l,dryRun:!0};return await Si(a,{logger:o,runCommand:t.runCommand??tr}),Cv(o,l,d),{pushedKeys:a.map(([p])=>p),skippedKeys:l}}var $te=new Set(["DISCORD_BOT_TOKEN","DISCORD_PUBLIC_KEY","DISCORD_APPLICATION_ID"]);function Ote(e){return e.filter((t)=>!$te.has(t.key)).map((t)=>({key:t.key,required:t.required}))}function Cte(e,t,r,o){let n=jt(`${e}_FILE`,t,r);if(n&&n.trim().length>0)return Tte(vi(n,o),"utf8");let i=jt(e,t,r);if(i===void 0||i.trim().length===0)return;return i}de();import{execFileSync as BB}from"child_process";import{chmodSync as Pte,existsSync as zte,mkdirSync as Nte,readFileSync as UB,writeFileSync as Dte}from"fs";import{dirname as Lte,join as Zte}from"path";import{homedir as jte}from"os";Mv();Pu();Mn();var MB=c.object({id:c.number(),name:c.string(),public_key:c.string()}),Bte=c.object({ssh_keys:c.array(MB)}),Ute={createEd25519KeyPair(e,t){BB("ssh-keygen",["-t","ed25519","-f",e,"-C",t,"-N",""],{stdio:"ignore"})},derivePublicKey(e){return BB("ssh-keygen",["-y","-f",e],{encoding:"utf-8",stdio:["ignore","pipe","inherit"]}).trim()}};async function uk(e,t={}){try{let r=await qB(e,t);return{success:!0,message:r.createdLocalKey?`SSH deploy key ready at ${r.privateKeyPath}`:`SSH deploy key already ready at ${r.privateKeyPath}`}}catch(r){return{success:!1,message:Ve(r,"SSH key bootstrap failed")}}}async function qB(e,t={}){let r=t.env??process.env,o=Lr(e),n=t.logger??console.log,i=t.fetchImpl??fetch,s=t.sshKeygen??Ute,a=jt("HCLOUD_TOKEN",r,o);if(!a)throw Error("Missing HCLOUD_TOKEN");let l=jt("HCLOUD_SSH_KEY_NAME",r,o);if(!l)throw Error("Missing HCLOUD_SSH_KEY_NAME");let u=jt("KAMAL_SSH_PRIVATE_KEY_FILE",r,o),d=u?vi(u,e):Zte(jte(),".ssh",`${qte(l)}_ed25519`),p=`${d}.pub`,m=!1;if(!zte(d))Nte(Lte(d),{recursive:!0,mode:448}),s.createEd25519KeyPair(d,l),m=!0;Pte(d,384);let h;if(m)h=UB(p,"utf-8").trim();else h=s.derivePublicKey(d),Dte(p,`${h}
|
|
791
|
+
`,"utf-8");if(h.length===0)throw Error(`Unable to derive a public key from ${d}`);let b=await Mte({fetchImpl:i,hcloudToken:a,publicKey:h,sshKeyName:l}),y=Wa(t.pushTo);if(y)await Si([["KAMAL_SSH_PRIVATE_KEY",UB(d,"utf-8")]],{logger:n,runCommand:t.runCommand??tr});if(n(m?`Created ${d}`:`Reusing ${d}`),n(b?`Registered Hetzner SSH key ${l}`:`Hetzner SSH key ${l} already exists`),y)n(`Pushed KAMAL_SSH_PRIVATE_KEY to ${y}`);return{createdHetznerKey:b,createdLocalKey:m,privateKeyPath:d,publicKeyPath:p,sshKeyName:l}}async function Mte(e){let t=new URL("https://api.hetzner.cloud/v1/ssh_keys");t.searchParams.set("name",e.sshKeyName);let r=await e.fetchImpl(t.toString(),{headers:{Authorization:`Bearer ${e.hcloudToken}`,"Content-Type":"application/json"}}),{ssh_keys:o}=await Qa(r,Bte,{label:"Hetzner SSH key lookup failed"}),[n]=o;if(n){if(n.public_key.trim()!==e.publicKey)throw Error(`Existing Hetzner SSH key ${e.sshKeyName} does not match the local public key`);return!1}let i=await e.fetchImpl("https://api.hetzner.cloud/v1/ssh_keys",{method:"POST",headers:{Authorization:`Bearer ${e.hcloudToken}`,"Content-Type":"application/json"},body:JSON.stringify({name:e.sshKeyName,public_key:e.publicKey})});return await Qa(i,c.object({ssh_key:MB}),{label:"Hetzner SSH key create failed"}),!0}function qte(e){return e.replace(/[^A-Za-z0-9._-]+/g,"_")}Nd();bg();Vn();$o();Ys();import{mkdir as HB,readFile as Fte,writeFile as KB}from"fs/promises";import{basename as Hte,join as Mc}from"path";async function VB(e,t,r){let o=br.parse(t),n=br.parse(r.cohort),i=Mc(e,"users"),s=Mc(e,"cohorts"),a=Mc(i,`${o}.yaml`),l=Mc(i,`${o}.secrets.yaml`),u=Mc(i,`${o}.secrets.yaml.age`),d=Mc(s,`${n}.yaml`);await Promise.all([HB(i,{recursive:!0}),HB(s,{recursive:!0})]);let p=r.discord===!0||Boolean(r.anchorId),m=await JB(a,Vte(o,p,r.anchorId)),b=await Ar(u)?!1:await JB(l,Wte(o,p)),{addedToCohort:y}=await Jte(d,o);return{handle:o,cohort:n,userPath:a,secretsTemplatePath:l,cohortPath:d,createdUser:m,createdSecretsTemplate:b,addedToCohort:y}}async function Jte(e,t){let r=await Kte(e);if(r.members.includes(t))return{addedToCohort:!1};let o={...r,members:[...r.members,t].sort()};return await KB(e,Gte(o)),{addedToCohort:!0}}async function Kte(e){try{let t=await Fte(e,"utf8"),r=yr(t,hn);if(!r.ok)throw Error(`${Hte(e)}: ${r.error}`);return r.data}catch(t){if(dg(t))return{members:[]};throw t}}function Vte(e,t,r){return[`handle: ${e}`,"anchorProfile:",` name: ${Xte(e)}`,"discord:",` enabled: ${String(t)}`,...t&&r?[` anchorUserId: ${JSON.stringify(r)}`]:[],""].join(`
|
|
792
792
|
`)}function Wte(e,t){return["# local per-user secret staging file",`# fill values, run \`bunx brains-ops secrets:encrypt . ${e}\`, then the plaintext file will be removed`,...t?["discordBotToken: "]:[],"atprotoAppPassword: ","# For custom-domain sites, paste PEMs with literal \\n escapes.","certificatePem: ","privateKeyPem: ",""].join(`
|
|
793
793
|
`)}function Gte(e){return["members:",...e.members.map((t)=>` - ${t}`),...e.brainVersionOverride?[`brainVersionOverride: ${e.brainVersionOverride}`]:[],...e.bundlesOverride?["bundlesOverride:",...e.bundlesOverride.map((t)=>` - ${t}`)]:[],...e.addOverride?["addOverride:",...e.addOverride.map((t)=>` - ${t}`)]:[],...e.removeOverride?["removeOverride:",...e.removeOverride.map((t)=>` - ${t}`)]:[],...e.openaiApiKeyOverride?[`openaiApiKeyOverride: ${e.openaiApiKeyOverride}`]:[],...e.gitSyncTokenOverride?[`gitSyncTokenOverride: ${e.gitSyncTokenOverride}`]:[],""].join(`
|
|
794
794
|
`)}async function JB(e,t){try{return await KB(e,t,{flag:"wx"}),!0}catch(r){if(Qte(r))return!1;throw r}}function Qte(e){return Yte(e,"EEXIST")}function Yte(e,t){return typeof e==="object"&&e!==null&&"code"in e&&e.code===t}function Xte(e){return e.split("-").filter((t)=>t.length>0).map(FB).join(" ")}de();gn();var ere=c.looseObject({status:c.string(),operationalStatus:c.string(),checks:c.array(c.looseObject({name:c.string(),status:c.string(),message:c.string().optional()})).default([]),app:c.looseObject({daemons:c.array(c.looseObject({name:c.string().optional(),status:c.string().optional(),health:c.looseObject({status:c.string().optional(),message:c.string().optional()}).optional()})).default([])}).default({daemons:[]})});async function GB(e,t,r={}){let o=r.fetchImpl??fetch,i=(await xt(e)).users.find((m)=>m.handle===t);if(!i)throw Error(`Unknown pilot user: ${t}`);let s=`https://${i.domain}`,a=[],l=[],u=c.number().int().positive().max(30).parse(r.operationalRetryAttempts??6),d=c.number().int().nonnegative().max(60000).parse(r.operationalRetryDelayMs??1e4),p=r.sleep??((m)=>new Promise((h)=>setTimeout(h,m)));if(await Sg("health",()=>tre(o,s,u,d,p),a,l),await Sg("mcp-auth-gate",()=>ore(o,s),a,l),i.bundles.includes("site"))await Sg("site",()=>WB(o,`${s}/`,"site"),a,l),await Sg("studio",()=>WB(o,`${s}/studio`,"studio"),a,l),r.logger?.("WARN Manual check still required: passkey setup/handoff completed from the setup email.");return{handle:i.handle,bundles:i.bundles,domain:i.domain,contentRepo:i.contentRepo,checks:a,failedChecks:l}}async function Sg(e,t,r,o){try{await t(),r.push(e)}catch(n){o.push({name:e,message:Ve(n)})}}async function tre(e,t,r,o,n){let i;for(let s=1;s<=r;s++)try{await rre(e,t);return}catch(a){if(i=a,s<r)await n(o)}throw i}async function rre(e,t){let o=await dk(e,`${t}/health/operate`,{method:"GET"}),n=await o.json().catch(()=>null),i=ere.safeParse(n);if(!o.ok){let a=i.success?i.data.checks.filter((l)=>l.status!=="healthy").slice(0,10).map((l)=>`${l.name}: ${nre(l.message??l.status)}`):[];throw Error(`/health/operate returned ${o.status}, expected 200${a.length>0?` (${a.join("; ")})`:""}`)}if(!i.success)throw Error(`/health/operate response did not match expected shape: ${i.error.message}`);let s=i.data;if(s.status!=="ready")throw Error(`/health/operate status is ${s.status}, expected ready`);if(s.operationalStatus!=="operational")throw Error(`/health/operate operationalStatus is ${s.operationalStatus}, expected operational`);for(let a of s.app.daemons){let l=a.status??"unknown",u=a.health?.status;if(l==="error"||u==="unhealthy")throw Error(`daemon ${a.name??"unknown"} is unhealthy (${l}/${u??"unknown"})`)}}function nre(e){let t=e.replaceAll(/\s+/g," ").trim();return t.length<=300?t:`${t.slice(0,297)}...`}async function ore(e,t){let r=await dk(e,`${t}/mcp`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize"})});if(r.status<400||r.status>=500)throw Error(`unauthenticated POST /mcp returned ${r.status}, expected a 4xx auth failure`)}async function WB(e,t,r){let o=await dk(e,t,{method:"GET"});if(o.status>=400)throw Error(`${r} ${t} returned ${o.status}, expected < 400`)}function dk(e,t,r){return Dd(e,t,{...r,redirect:"follow"},20000)}var xH="brains-ops",sO={type:"string",placeholder:"<target>",description:"Push target (`gh` or `github`)"},jb={type:"boolean",description:"Show what would happen without writing anything"};function mt(e){return{success:!1,message:dO(xH,e)}}var _H=nt({name:"init",usage:"<repo>",description:"Create a pilot repo skeleton",run:async({args:e})=>{let t=e[0];if(!t)return mt(_H);return await Gj(t),{success:!0,message:`Initialized ${t}`}}}),EH=nt({name:"upgrade",usage:"<repo>",description:"Bump @rizom/ops and refresh the generated scaffold",flags:{to:{type:"string",placeholder:"<version>",description:"Explicit @rizom/ops version (`latest` by default)"}},run:async({args:e,flags:t})=>{let r=e[0];if(!r)return mt(EH);let o=ot(t,"to"),{upgradePilotRepo:n}=await Promise.resolve().then(() => (XB(),YB)),{from:i,to:s}=await n(r,{...o&&o!=="latest"?{version:o}:{}});return{success:!0,message:i===s?`Already at @rizom/ops@${s}; scaffold refreshed`:`Upgraded @rizom/ops ${i} -> ${s}; scaffold refreshed`}}}),IH=nt({name:"images:lock",usage:"<repo> [--brain-version <version>] [--site-packages <pins>]",description:"Create immutable runtime dependency locks for operator review (no build or deploy)",flags:{"brain-version":{type:"string",placeholder:"<version>",description:"Lock one exact Brain version instead of the declared fleet"},"site-packages":{type:"string",placeholder:"<pins>",description:"Exact site/theme pins for an explicit Brain version"}},run:async({args:e,flags:t},r)=>{let o=e[0],n=ot(t,"brain-version"),i=ot(t,"site-packages");if(!o||i!==void 0&&!n)return mt(IH);if(n!==void 0)Ct.parse(n);let{users:s}=await xt(o),a=await dB({users:s,brainVersionInput:n,sitePackagesInput:i,imageExists:async()=>!1,verifyImage:async()=>{throw Error("Lock generation must not inspect images")}}),l=[];for(let u of a){let d=await lB(o,u,r.imageLockRunCommand);l.push(`${d}: ${u.tag}`)}return{success:!0,message:["Review and commit runtime dependency locks before building:",...l].join(`
|