zion-mcp 2.0.7 → 2.0.8

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/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __nodeCreateRequire } from 'node:module';
2
2
  const require = __nodeCreateRequire(import.meta.url);
3
- import{a as K,c as _,d as py,e as Pt,g as p,h as g}from"./chunk-2PDPEBWZ.js";var aa=_((hy,Cx)=>{p();var Jp=K("buffer"),zn=Jp.Buffer;function kx(e,t){for(var r in e)t[r]=e[r]}zn.from&&zn.alloc&&zn.allocUnsafe&&zn.allocUnsafeSlow?Cx.exports=Jp:(kx(Jp,hy),hy.Buffer=$o);function $o(e,t,r){return zn(e,t,r)}$o.prototype=Object.create(zn.prototype);kx(zn,$o);$o.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return zn(e,t,r)};$o.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=zn(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};$o.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return zn(e)};$o.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Jp.SlowBuffer(e)}});var my=_((kEe,Lx)=>{p();var Yp=aa().Buffer,OZ=K("stream"),wZ=K("util");function Xp(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=Yp.alloc(0),this;if(typeof e.pipe=="function")return this.buffer=Yp.alloc(0),e.pipe(this),this;if(e.length||typeof e=="object")return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}wZ.inherits(Xp,OZ);Xp.prototype.write=function(t){this.buffer=Yp.concat([this.buffer,Yp.from(t)]),this.emit("data",t)};Xp.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1};Lx.exports=Xp});var $x=_((LEe,jx)=>{"use strict";p();function gy(e){var t=(e/8|0)+(e%8===0?0:1);return t}var IZ={ES256:gy(256),ES384:gy(384),ES512:gy(521)};function xZ(e){var t=IZ[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}jx.exports=xZ});var Gx=_(($Ee,Vx)=>{"use strict";p();var ed=aa().Buffer,qx=$x(),td=128,Fx=0,NZ=32,AZ=16,RZ=2,zx=AZ|NZ|Fx<<6,rd=RZ|Fx<<6;function PZ(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ux(e){if(ed.isBuffer(e))return e;if(typeof e=="string")return ed.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function DZ(e,t){e=Ux(e);var r=qx(t),n=r+1,i=e.length,o=0;if(e[o++]!==zx)throw new Error('Could not find expected "seq"');var s=e[o++];if(s===(td|1)&&(s=e[o++]),i-o<s)throw new Error('"seq" specified length of "'+s+'", only "'+(i-o)+'" remaining');if(e[o++]!==rd)throw new Error('Could not find expected "int" for "r"');var a=e[o++];if(i-o-2<a)throw new Error('"r" specified length of "'+a+'", only "'+(i-o-2)+'" available');if(n<a)throw new Error('"r" specified length of "'+a+'", max of "'+n+'" is acceptable');var c=o;if(o+=a,e[o++]!==rd)throw new Error('Could not find expected "int" for "s"');var u=e[o++];if(i-o!==u)throw new Error('"s" specified length of "'+u+'", expected "'+(i-o)+'"');if(n<u)throw new Error('"s" specified length of "'+u+'", max of "'+n+'" is acceptable');var l=o;if(o+=u,o!==i)throw new Error('Expected to consume entire buffer, but "'+(i-o)+'" bytes remain');var d=r-a,f=r-u,h=ed.allocUnsafe(d+a+f+u);for(o=0;o<d;++o)h[o]=0;e.copy(h,o,c+Math.max(-d,0),c+a),o=r;for(var m=o;o<m+f;++o)h[o]=0;return e.copy(h,o,l+Math.max(-f,0),l+u),h=h.toString("base64"),h=PZ(h),h}function Mx(e,t,r){for(var n=0;t+n<r&&e[t+n]===0;)++n;var i=e[t+n]>=td;return i&&--n,n}function kZ(e,t){e=Ux(e);var r=qx(t),n=e.length;if(n!==r*2)throw new TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=Mx(e,0,r),o=Mx(e,r,e.length),s=r-i,a=r-o,c=2+s+1+1+a,u=c<td,l=ed.allocUnsafe((u?2:3)+c),d=0;return l[d++]=zx,u?l[d++]=c:(l[d++]=td|1,l[d++]=c&255),l[d++]=rd,l[d++]=s,i<0?(l[d++]=0,d+=e.copy(l,d,0,r)):d+=e.copy(l,d,i,r),l[d++]=rd,l[d++]=a,o<0?(l[d++]=0,e.copy(l,d,r)):e.copy(l,d,r+o),l}Vx.exports={derToJose:DZ,joseToDer:kZ}});var Zx=_((qEe,Bx)=>{"use strict";p();var iu=K("buffer").Buffer,yy=K("buffer").SlowBuffer;Bx.exports=nd;function nd(e,t){if(!iu.isBuffer(e)||!iu.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}nd.install=function(){iu.prototype.equal=yy.prototype.equal=function(t){return nd(this,t)}};var CZ=iu.prototype.equal,LZ=yy.prototype.equal;nd.restore=function(){iu.prototype.equal=CZ,yy.prototype.equal=LZ}});var by=_((zEe,tN)=>{p();var ua=aa().Buffer,Hr=K("crypto"),Qx=Gx(),Kx=K("util"),jZ=`"%s" is not a valid algorithm.
3
+ import{a as K,c as _,d as py,e as Pt,g as p,h as g}from"./chunk-3R2I4EJP.js";var aa=_((hy,Cx)=>{p();var Jp=K("buffer"),zn=Jp.Buffer;function kx(e,t){for(var r in e)t[r]=e[r]}zn.from&&zn.alloc&&zn.allocUnsafe&&zn.allocUnsafeSlow?Cx.exports=Jp:(kx(Jp,hy),hy.Buffer=$o);function $o(e,t,r){return zn(e,t,r)}$o.prototype=Object.create(zn.prototype);kx(zn,$o);$o.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return zn(e,t,r)};$o.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=zn(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};$o.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return zn(e)};$o.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Jp.SlowBuffer(e)}});var my=_((kEe,Lx)=>{p();var Yp=aa().Buffer,OZ=K("stream"),wZ=K("util");function Xp(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=Yp.alloc(0),this;if(typeof e.pipe=="function")return this.buffer=Yp.alloc(0),e.pipe(this),this;if(e.length||typeof e=="object")return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}wZ.inherits(Xp,OZ);Xp.prototype.write=function(t){this.buffer=Yp.concat([this.buffer,Yp.from(t)]),this.emit("data",t)};Xp.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1};Lx.exports=Xp});var $x=_((LEe,jx)=>{"use strict";p();function gy(e){var t=(e/8|0)+(e%8===0?0:1);return t}var IZ={ES256:gy(256),ES384:gy(384),ES512:gy(521)};function xZ(e){var t=IZ[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}jx.exports=xZ});var Gx=_(($Ee,Vx)=>{"use strict";p();var ed=aa().Buffer,qx=$x(),td=128,Fx=0,NZ=32,AZ=16,RZ=2,zx=AZ|NZ|Fx<<6,rd=RZ|Fx<<6;function PZ(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ux(e){if(ed.isBuffer(e))return e;if(typeof e=="string")return ed.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function DZ(e,t){e=Ux(e);var r=qx(t),n=r+1,i=e.length,o=0;if(e[o++]!==zx)throw new Error('Could not find expected "seq"');var s=e[o++];if(s===(td|1)&&(s=e[o++]),i-o<s)throw new Error('"seq" specified length of "'+s+'", only "'+(i-o)+'" remaining');if(e[o++]!==rd)throw new Error('Could not find expected "int" for "r"');var a=e[o++];if(i-o-2<a)throw new Error('"r" specified length of "'+a+'", only "'+(i-o-2)+'" available');if(n<a)throw new Error('"r" specified length of "'+a+'", max of "'+n+'" is acceptable');var c=o;if(o+=a,e[o++]!==rd)throw new Error('Could not find expected "int" for "s"');var u=e[o++];if(i-o!==u)throw new Error('"s" specified length of "'+u+'", expected "'+(i-o)+'"');if(n<u)throw new Error('"s" specified length of "'+u+'", max of "'+n+'" is acceptable');var l=o;if(o+=u,o!==i)throw new Error('Expected to consume entire buffer, but "'+(i-o)+'" bytes remain');var d=r-a,f=r-u,h=ed.allocUnsafe(d+a+f+u);for(o=0;o<d;++o)h[o]=0;e.copy(h,o,c+Math.max(-d,0),c+a),o=r;for(var m=o;o<m+f;++o)h[o]=0;return e.copy(h,o,l+Math.max(-f,0),l+u),h=h.toString("base64"),h=PZ(h),h}function Mx(e,t,r){for(var n=0;t+n<r&&e[t+n]===0;)++n;var i=e[t+n]>=td;return i&&--n,n}function kZ(e,t){e=Ux(e);var r=qx(t),n=e.length;if(n!==r*2)throw new TypeError('"'+t+'" signatures must be "'+r*2+'" bytes, saw "'+n+'"');var i=Mx(e,0,r),o=Mx(e,r,e.length),s=r-i,a=r-o,c=2+s+1+1+a,u=c<td,l=ed.allocUnsafe((u?2:3)+c),d=0;return l[d++]=zx,u?l[d++]=c:(l[d++]=td|1,l[d++]=c&255),l[d++]=rd,l[d++]=s,i<0?(l[d++]=0,d+=e.copy(l,d,0,r)):d+=e.copy(l,d,i,r),l[d++]=rd,l[d++]=a,o<0?(l[d++]=0,e.copy(l,d,r)):e.copy(l,d,r+o),l}Vx.exports={derToJose:DZ,joseToDer:kZ}});var Zx=_((qEe,Bx)=>{"use strict";p();var iu=K("buffer").Buffer,yy=K("buffer").SlowBuffer;Bx.exports=nd;function nd(e,t){if(!iu.isBuffer(e)||!iu.isBuffer(t)||e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}nd.install=function(){iu.prototype.equal=yy.prototype.equal=function(t){return nd(this,t)}};var CZ=iu.prototype.equal,LZ=yy.prototype.equal;nd.restore=function(){iu.prototype.equal=CZ,yy.prototype.equal=LZ}});var by=_((zEe,tN)=>{p();var ua=aa().Buffer,Hr=K("crypto"),Qx=Gx(),Kx=K("util"),jZ=`"%s" is not a valid algorithm.
4
4
  Supported algorithms are:
5
5
  "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".`,ou="secret must be a string or buffer",ca="key must be a string or a buffer",$Z="key must be a string, a buffer or an object",vy=typeof Hr.createPublicKey=="function";vy&&(ca+=" or a KeyObject",ou+="or a KeyObject");function Hx(e){if(!ua.isBuffer(e)&&typeof e!="string"&&(!vy||typeof e!="object"||typeof e.type!="string"||typeof e.asymmetricKeyType!="string"||typeof e.export!="function"))throw vn(ca)}function Wx(e){if(!ua.isBuffer(e)&&typeof e!="string"&&typeof e!="object")throw vn($Z)}function MZ(e){if(!ua.isBuffer(e)){if(typeof e=="string")return e;if(!vy||typeof e!="object"||e.type!=="secret"||typeof e.export!="function")throw vn(ou)}}function Ey(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Jx(e){e=e.toString();var t=4-e.length%4;if(t!==4)for(var r=0;r<t;++r)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function vn(e){var t=[].slice.call(arguments,1),r=Kx.format.bind(Kx,e).apply(null,t);return new TypeError(r)}function qZ(e){return ua.isBuffer(e)||typeof e=="string"}function su(e){return qZ(e)||(e=JSON.stringify(e)),e}function Yx(e){return function(r,n){MZ(n),r=su(r);var i=Hr.createHmac("sha"+e,n),o=(i.update(r),i.digest("base64"));return Ey(o)}}var _y,FZ="timingSafeEqual"in Hr?function(t,r){return t.byteLength!==r.byteLength?!1:Hr.timingSafeEqual(t,r)}:function(t,r){return _y||(_y=Zx()),_y(t,r)};function zZ(e){return function(r,n,i){var o=Yx(e)(r,i);return FZ(ua.from(n),ua.from(o))}}function Xx(e){return function(r,n){Wx(n),r=su(r);var i=Hr.createSign("RSA-SHA"+e),o=(i.update(r),i.sign(n,"base64"));return Ey(o)}}function eN(e){return function(r,n,i){Hx(i),r=su(r),n=Jx(n);var o=Hr.createVerify("RSA-SHA"+e);return o.update(r),o.verify(i,n,"base64")}}function UZ(e){return function(r,n){Wx(n),r=su(r);var i=Hr.createSign("RSA-SHA"+e),o=(i.update(r),i.sign({key:n,padding:Hr.constants.RSA_PKCS1_PSS_PADDING,saltLength:Hr.constants.RSA_PSS_SALTLEN_DIGEST},"base64"));return Ey(o)}}function VZ(e){return function(r,n,i){Hx(i),r=su(r),n=Jx(n);var o=Hr.createVerify("RSA-SHA"+e);return o.update(r),o.verify({key:i,padding:Hr.constants.RSA_PKCS1_PSS_PADDING,saltLength:Hr.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function GZ(e){var t=Xx(e);return function(){var n=t.apply(null,arguments);return n=Qx.derToJose(n,"ES"+e),n}}function BZ(e){var t=eN(e);return function(n,i,o){i=Qx.joseToDer(i,"ES"+e).toString("base64");var s=t(n,i,o);return s}}function ZZ(){return function(){return""}}function KZ(){return function(t,r){return r===""}}tN.exports=function(t){var r={hs:Yx,rs:Xx,ps:UZ,es:GZ,none:ZZ},n={hs:zZ,rs:eN,ps:VZ,es:BZ,none:KZ},i=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);if(!i)throw vn(jZ,t);var o=(i[1]||i[3]).toLowerCase(),s=i[2];return{sign:r[o](s),verify:n[o](s)}}});var Ty=_((VEe,rN)=>{p();var QZ=K("buffer").Buffer;rN.exports=function(t){return typeof t=="string"?t:typeof t=="number"||QZ.isBuffer(t)?t.toString():JSON.stringify(t)}});var cN=_((BEe,aN)=>{p();var HZ=aa().Buffer,nN=my(),WZ=by(),JZ=K("stream"),iN=Ty(),Sy=K("util");function oN(e,t){return HZ.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function YZ(e,t,r){r=r||"utf8";var n=oN(iN(e),"binary"),i=oN(iN(t),r);return Sy.format("%s.%s",n,i)}function sN(e){var t=e.header,r=e.payload,n=e.secret||e.privateKey,i=e.encoding,o=WZ(t.alg),s=YZ(t,r,i),a=o.sign(s,n);return Sy.format("%s.%s",s,a)}function id(e){var t=e.secret;if(t=t??e.privateKey,t=t??e.key,/^hs/i.test(e.header.alg)===!0&&t==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new nN(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=r,this.payload=new nN(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}Sy.inherits(id,JZ);id.prototype.sign=function(){try{var t=sN({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(r){this.readable=!1,this.emit("error",r),this.emit("close")}};id.sign=sN;aN.exports=id});var _N=_((KEe,yN)=>{p();var lN=aa().Buffer,uN=my(),XZ=by(),eK=K("stream"),pN=Ty(),tK=K("util"),rK=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function nK(e){return Object.prototype.toString.call(e)==="[object Object]"}function iK(e){if(nK(e))return e;try{return JSON.parse(e)}catch{return}}function dN(e){var t=e.split(".",1)[0];return iK(lN.from(t,"base64").toString("binary"))}function oK(e){return e.split(".",2).join(".")}function fN(e){return e.split(".")[2]}function sK(e,t){t=t||"utf8";var r=e.split(".")[1];return lN.from(r,"base64").toString(t)}function hN(e){return rK.test(e)&&!!dN(e)}function mN(e,t,r){if(!t){var n=new Error("Missing algorithm parameter for jws.verify");throw n.code="MISSING_ALGORITHM",n}e=pN(e);var i=fN(e),o=oK(e),s=XZ(t);return s.verify(o,i,r)}function gN(e,t){if(t=t||{},e=pN(e),!hN(e))return null;var r=dN(e);if(!r)return null;var n=sK(e);return(r.typ==="JWT"||t.json)&&(n=JSON.parse(n,t.encoding)),{header:r,payload:n,signature:fN(e)}}function la(e){e=e||{};var t=e.secret;if(t=t??e.publicKey,t=t??e.key,/^hs/i.test(e.algorithm)===!0&&t==null)throw new TypeError("secret must be a string or buffer or a KeyObject");var r=new uN(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=r,this.signature=new uN(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}tK.inherits(la,eK);la.prototype.verify=function(){try{var t=mN(this.signature.buffer,this.algorithm,this.key.buffer),r=gN(this.signature.buffer,this.encoding);return this.emit("done",t,r),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(n){this.readable=!1,this.emit("error",n),this.emit("close")}};la.decode=gN;la.isValid=hN;la.verify=mN;yN.exports=la});var sd=_(Gi=>{p();var vN=cN(),od=_N(),aK=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"];Gi.ALGORITHMS=aK;Gi.sign=vN.sign;Gi.verify=od.verify;Gi.decode=od.decode;Gi.isValid=od.isValid;Gi.createSign=function(t){return new vN(t)};Gi.createVerify=function(t){return new od(t)}});var Oy=_((JEe,EN)=>{p();var cK=sd();EN.exports=function(e,t){t=t||{};var r=cK.decode(e,t);if(!r)return null;var n=r.payload;if(typeof n=="string")try{var i=JSON.parse(n);i!==null&&typeof i=="object"&&(n=i)}catch{}return t.complete===!0?{header:r.header,payload:n,signature:r.signature}:n}});var au=_((XEe,bN)=>{p();var ad=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};ad.prototype=Object.create(Error.prototype);ad.prototype.constructor=ad;bN.exports=ad});var wy=_((tbe,SN)=>{p();var TN=au(),cd=function(e,t){TN.call(this,e),this.name="NotBeforeError",this.date=t};cd.prototype=Object.create(TN.prototype);cd.prototype.constructor=cd;SN.exports=cd});var Iy=_((nbe,wN)=>{p();var ON=au(),ud=function(e,t){ON.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};ud.prototype=Object.create(ON.prototype);ud.prototype.constructor=ud;wN.exports=ud});var xN=_((obe,IN)=>{p();var pa=1e3,da=pa*60,fa=da*60,Mo=fa*24,uK=Mo*7,lK=Mo*365.25;IN.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return pK(e);if(r==="number"&&isFinite(e))return t.long?fK(e):dK(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function pK(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*lK;case"weeks":case"week":case"w":return r*uK;case"days":case"day":case"d":return r*Mo;case"hours":case"hour":case"hrs":case"hr":case"h":return r*fa;case"minutes":case"minute":case"mins":case"min":case"m":return r*da;case"seconds":case"second":case"secs":case"sec":case"s":return r*pa;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function dK(e){var t=Math.abs(e);return t>=Mo?Math.round(e/Mo)+"d":t>=fa?Math.round(e/fa)+"h":t>=da?Math.round(e/da)+"m":t>=pa?Math.round(e/pa)+"s":e+"ms"}function fK(e){var t=Math.abs(e);return t>=Mo?ld(e,t,Mo,"day"):t>=fa?ld(e,t,fa,"hour"):t>=da?ld(e,t,da,"minute"):t>=pa?ld(e,t,pa,"second"):e+" ms"}function ld(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var xy=_((abe,NN)=>{p();var hK=xN();NN.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if(typeof e=="string"){var n=hK(e);return typeof n>"u"?void 0:Math.floor(r+n/1e3)}else return typeof e=="number"?r+e:void 0}});var ha=_((ube,AN)=>{"use strict";p();var mK="2.0.0",gK=Number.MAX_SAFE_INTEGER||9007199254740991,yK=16,_K=250,vK=["major","premajor","minor","preminor","patch","prepatch","prerelease"];AN.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:yK,MAX_SAFE_BUILD_LENGTH:_K,MAX_SAFE_INTEGER:gK,RELEASE_TYPES:vK,SEMVER_SPEC_VERSION:mK,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var cu=_((pbe,RN)=>{"use strict";p();var EK=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};RN.exports=EK});var ma=_((Un,PN)=>{"use strict";p();var{MAX_SAFE_COMPONENT_LENGTH:Ny,MAX_SAFE_BUILD_LENGTH:bK,MAX_LENGTH:TK}=ha(),SK=cu();Un=PN.exports={};var OK=Un.re=[],wK=Un.safeRe=[],z=Un.src=[],IK=Un.safeSrc=[],U=Un.t={},xK=0,Ay="[a-zA-Z0-9-]",NK=[["\\s",1],["\\d",TK],[Ay,bK]],AK=e=>{for(let[t,r]of NK)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},pe=(e,t,r)=>{let n=AK(t),i=xK++;SK(e,i,t),U[e]=i,z[i]=t,IK[i]=n,OK[i]=new RegExp(t,r?"g":void 0),wK[i]=new RegExp(n,r?"g":void 0)};pe("NUMERICIDENTIFIER","0|[1-9]\\d*");pe("NUMERICIDENTIFIERLOOSE","\\d+");pe("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ay}*`);pe("MAINVERSION",`(${z[U.NUMERICIDENTIFIER]})\\.(${z[U.NUMERICIDENTIFIER]})\\.(${z[U.NUMERICIDENTIFIER]})`);pe("MAINVERSIONLOOSE",`(${z[U.NUMERICIDENTIFIERLOOSE]})\\.(${z[U.NUMERICIDENTIFIERLOOSE]})\\.(${z[U.NUMERICIDENTIFIERLOOSE]})`);pe("PRERELEASEIDENTIFIER",`(?:${z[U.NONNUMERICIDENTIFIER]}|${z[U.NUMERICIDENTIFIER]})`);pe("PRERELEASEIDENTIFIERLOOSE",`(?:${z[U.NONNUMERICIDENTIFIER]}|${z[U.NUMERICIDENTIFIERLOOSE]})`);pe("PRERELEASE",`(?:-(${z[U.PRERELEASEIDENTIFIER]}(?:\\.${z[U.PRERELEASEIDENTIFIER]})*))`);pe("PRERELEASELOOSE",`(?:-?(${z[U.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${z[U.PRERELEASEIDENTIFIERLOOSE]})*))`);pe("BUILDIDENTIFIER",`${Ay}+`);pe("BUILD",`(?:\\+(${z[U.BUILDIDENTIFIER]}(?:\\.${z[U.BUILDIDENTIFIER]})*))`);pe("FULLPLAIN",`v?${z[U.MAINVERSION]}${z[U.PRERELEASE]}?${z[U.BUILD]}?`);pe("FULL",`^${z[U.FULLPLAIN]}$`);pe("LOOSEPLAIN",`[v=\\s]*${z[U.MAINVERSIONLOOSE]}${z[U.PRERELEASELOOSE]}?${z[U.BUILD]}?`);pe("LOOSE",`^${z[U.LOOSEPLAIN]}$`);pe("GTLT","((?:<|>)?=?)");pe("XRANGEIDENTIFIERLOOSE",`${z[U.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);pe("XRANGEIDENTIFIER",`${z[U.NUMERICIDENTIFIER]}|x|X|\\*`);pe("XRANGEPLAIN",`[v=\\s]*(${z[U.XRANGEIDENTIFIER]})(?:\\.(${z[U.XRANGEIDENTIFIER]})(?:\\.(${z[U.XRANGEIDENTIFIER]})(?:${z[U.PRERELEASE]})?${z[U.BUILD]}?)?)?`);pe("XRANGEPLAINLOOSE",`[v=\\s]*(${z[U.XRANGEIDENTIFIERLOOSE]})(?:\\.(${z[U.XRANGEIDENTIFIERLOOSE]})(?:\\.(${z[U.XRANGEIDENTIFIERLOOSE]})(?:${z[U.PRERELEASELOOSE]})?${z[U.BUILD]}?)?)?`);pe("XRANGE",`^${z[U.GTLT]}\\s*${z[U.XRANGEPLAIN]}$`);pe("XRANGELOOSE",`^${z[U.GTLT]}\\s*${z[U.XRANGEPLAINLOOSE]}$`);pe("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ny}})(?:\\.(\\d{1,${Ny}}))?(?:\\.(\\d{1,${Ny}}))?`);pe("COERCE",`${z[U.COERCEPLAIN]}(?:$|[^\\d])`);pe("COERCEFULL",z[U.COERCEPLAIN]+`(?:${z[U.PRERELEASE]})?(?:${z[U.BUILD]})?(?:$|[^\\d])`);pe("COERCERTL",z[U.COERCE],!0);pe("COERCERTLFULL",z[U.COERCEFULL],!0);pe("LONETILDE","(?:~>?)");pe("TILDETRIM",`(\\s*)${z[U.LONETILDE]}\\s+`,!0);Un.tildeTrimReplace="$1~";pe("TILDE",`^${z[U.LONETILDE]}${z[U.XRANGEPLAIN]}$`);pe("TILDELOOSE",`^${z[U.LONETILDE]}${z[U.XRANGEPLAINLOOSE]}$`);pe("LONECARET","(?:\\^)");pe("CARETTRIM",`(\\s*)${z[U.LONECARET]}\\s+`,!0);Un.caretTrimReplace="$1^";pe("CARET",`^${z[U.LONECARET]}${z[U.XRANGEPLAIN]}$`);pe("CARETLOOSE",`^${z[U.LONECARET]}${z[U.XRANGEPLAINLOOSE]}$`);pe("COMPARATORLOOSE",`^${z[U.GTLT]}\\s*(${z[U.LOOSEPLAIN]})$|^$`);pe("COMPARATOR",`^${z[U.GTLT]}\\s*(${z[U.FULLPLAIN]})$|^$`);pe("COMPARATORTRIM",`(\\s*)${z[U.GTLT]}\\s*(${z[U.LOOSEPLAIN]}|${z[U.XRANGEPLAIN]})`,!0);Un.comparatorTrimReplace="$1$2$3";pe("HYPHENRANGE",`^\\s*(${z[U.XRANGEPLAIN]})\\s+-\\s+(${z[U.XRANGEPLAIN]})\\s*$`);pe("HYPHENRANGELOOSE",`^\\s*(${z[U.XRANGEPLAINLOOSE]})\\s+-\\s+(${z[U.XRANGEPLAINLOOSE]})\\s*$`);pe("STAR","(<|>)?=?\\s*\\*");pe("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");pe("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var pd=_((hbe,DN)=>{"use strict";p();var RK=Object.freeze({loose:!0}),PK=Object.freeze({}),DK=e=>e?typeof e!="object"?RK:e:PK;DN.exports=DK});var Ry=_((gbe,LN)=>{"use strict";p();var kN=/^[0-9]+$/,CN=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;let r=kN.test(e),n=kN.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},kK=(e,t)=>CN(t,e);LN.exports={compareIdentifiers:CN,rcompareIdentifiers:kK}});var Ut=_((_be,$N)=>{"use strict";p();var dd=cu(),{MAX_LENGTH:jN,MAX_SAFE_INTEGER:fd}=ha(),{safeRe:hd,t:md}=ma(),CK=pd(),{compareIdentifiers:Py}=Ry(),Dy=class e{constructor(t,r){if(r=CK(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>jN)throw new TypeError(`version is longer than ${jN} characters`);dd("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?hd[md.LOOSE]:hd[md.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>fd||this.major<0)throw new TypeError("Invalid major version");if(this.minor>fd||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>fd||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let o=+i;if(o>=0&&o<fd)return o}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(dd("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=t.prerelease[r];if(dd("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Py(n,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],i=t.build[r];if(dd("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Py(n,i)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?hd[md.PRERELEASELOOSE]:hd[md.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let o=[r,i];n===!1&&(o=[r]),Py(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};$N.exports=Dy});var Bi=_((Ebe,qN)=>{"use strict";p();var MN=Ut(),LK=(e,t,r=!1)=>{if(e instanceof MN)return e;try{return new MN(e,t)}catch(n){if(!r)return null;throw n}};qN.exports=LK});var zN=_((Tbe,FN)=>{"use strict";p();var jK=Bi(),$K=(e,t)=>{let r=jK(e,t);return r?r.version:null};FN.exports=$K});var VN=_((Obe,UN)=>{"use strict";p();var MK=Bi(),qK=(e,t)=>{let r=MK(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};UN.exports=qK});var ZN=_((Ibe,BN)=>{"use strict";p();var GN=Ut(),FK=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new GN(e instanceof GN?e.version:e,r).inc(t,n,i).version}catch{return null}};BN.exports=FK});var HN=_((Nbe,QN)=>{"use strict";p();var KN=Bi(),zK=(e,t)=>{let r=KN(e,null,!0),n=KN(t,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};QN.exports=zK});var JN=_((Rbe,WN)=>{"use strict";p();var UK=Ut(),VK=(e,t)=>new UK(e,t).major;WN.exports=VK});var XN=_((Dbe,YN)=>{"use strict";p();var GK=Ut(),BK=(e,t)=>new GK(e,t).minor;YN.exports=BK});var tA=_((Cbe,eA)=>{"use strict";p();var ZK=Ut(),KK=(e,t)=>new ZK(e,t).patch;eA.exports=KK});var nA=_((jbe,rA)=>{"use strict";p();var QK=Bi(),HK=(e,t)=>{let r=QK(e,t);return r&&r.prerelease.length?r.prerelease:null};rA.exports=HK});var Wr=_((Mbe,oA)=>{"use strict";p();var iA=Ut(),WK=(e,t,r)=>new iA(e,r).compare(new iA(t,r));oA.exports=WK});var aA=_((Fbe,sA)=>{"use strict";p();var JK=Wr(),YK=(e,t,r)=>JK(t,e,r);sA.exports=YK});var uA=_((Ube,cA)=>{"use strict";p();var XK=Wr(),eQ=(e,t)=>XK(e,t,!0);cA.exports=eQ});var gd=_((Gbe,pA)=>{"use strict";p();var lA=Ut(),tQ=(e,t,r)=>{let n=new lA(e,r),i=new lA(t,r);return n.compare(i)||n.compareBuild(i)};pA.exports=tQ});var fA=_((Zbe,dA)=>{"use strict";p();var rQ=gd(),nQ=(e,t)=>e.sort((r,n)=>rQ(r,n,t));dA.exports=nQ});var mA=_((Qbe,hA)=>{"use strict";p();var iQ=gd(),oQ=(e,t)=>e.sort((r,n)=>iQ(n,r,t));hA.exports=oQ});var uu=_((Wbe,gA)=>{"use strict";p();var sQ=Wr(),aQ=(e,t,r)=>sQ(e,t,r)>0;gA.exports=aQ});var yd=_((Ybe,yA)=>{"use strict";p();var cQ=Wr(),uQ=(e,t,r)=>cQ(e,t,r)<0;yA.exports=uQ});var ky=_((eTe,_A)=>{"use strict";p();var lQ=Wr(),pQ=(e,t,r)=>lQ(e,t,r)===0;_A.exports=pQ});var Cy=_((rTe,vA)=>{"use strict";p();var dQ=Wr(),fQ=(e,t,r)=>dQ(e,t,r)!==0;vA.exports=fQ});var _d=_((iTe,EA)=>{"use strict";p();var hQ=Wr(),mQ=(e,t,r)=>hQ(e,t,r)>=0;EA.exports=mQ});var vd=_((sTe,bA)=>{"use strict";p();var gQ=Wr(),yQ=(e,t,r)=>gQ(e,t,r)<=0;bA.exports=yQ});var Ly=_((cTe,TA)=>{"use strict";p();var _Q=ky(),vQ=Cy(),EQ=uu(),bQ=_d(),TQ=yd(),SQ=vd(),OQ=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return _Q(e,r,n);case"!=":return vQ(e,r,n);case">":return EQ(e,r,n);case">=":return bQ(e,r,n);case"<":return TQ(e,r,n);case"<=":return SQ(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};TA.exports=OQ});var OA=_((lTe,SA)=>{"use strict";p();var wQ=Ut(),IQ=Bi(),{safeRe:Ed,t:bd}=ma(),xQ=(e,t)=>{if(e instanceof wQ)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Ed[bd.COERCEFULL]:Ed[bd.COERCE]);else{let c=t.includePrerelease?Ed[bd.COERCERTLFULL]:Ed[bd.COERCERTL],u;for(;(u=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return IQ(`${n}.${i}.${o}${s}${a}`,t)};SA.exports=xQ});var IA=_((dTe,wA)=>{"use strict";p();var NQ=Bi(),AQ=ha(),RQ=Ut(),PQ=(e,t,r)=>{if(!AQ.RELEASE_TYPES.includes(t))return null;let n=DQ(e,r);return n&&kQ(n,t)},DQ=(e,t)=>{let r=e instanceof RQ?e.version:e;return NQ(r,t)},kQ=(e,t)=>{if(CQ(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},CQ=e=>e.startsWith("pre");wA.exports=PQ});var NA=_((hTe,xA)=>{"use strict";p();var jy=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}};xA.exports=jy});var Jr=_((gTe,DA)=>{"use strict";p();var LQ=/\s+/g,$y=class e{constructor(t,r){if(r=$Q(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof My)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(LQ," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!RA(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&ZQ(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){t=t.replace(BQ,"");let n=((this.options.includePrerelease&&VQ)|(this.options.loose&&GQ))+":"+t,i=AA.get(n);if(i)return i;let o=this.options.loose,s=o?lr[Vt.HYPHENRANGELOOSE]:lr[Vt.HYPHENRANGE];t=t.replace(s,rH(this.options.includePrerelease)),it("hyphen replace",t),t=t.replace(lr[Vt.COMPARATORTRIM],FQ),it("comparator trim",t),t=t.replace(lr[Vt.TILDETRIM],zQ),it("tilde trim",t),t=t.replace(lr[Vt.CARETTRIM],UQ),it("caret trim",t);let a=t.split(" ").map(d=>KQ(d,this.options)).join(" ").split(/\s+/).map(d=>tH(d,this.options));o&&(a=a.filter(d=>(it("loose invalid filter",d,this.options),!!d.match(lr[Vt.COMPARATORLOOSE])))),it("range list",a);let c=new Map,u=a.map(d=>new My(d,this.options));for(let d of u){if(RA(d))return[d];c.set(d.value,d)}c.size>1&&c.has("")&&c.delete("");let l=[...c.values()];return AA.set(n,l),l}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(n=>PA(n,r)&&t.set.some(i=>PA(i,r)&&n.every(o=>i.every(s=>o.intersects(s,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new MQ(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(nH(this.set[r],t,this.options))return!0;return!1}};DA.exports=$y;var jQ=NA(),AA=new jQ,$Q=pd(),My=lu(),it=cu(),MQ=Ut(),{safeRe:lr,src:qQ,t:Vt,comparatorTrimReplace:FQ,tildeTrimReplace:zQ,caretTrimReplace:UQ}=ma(),{FLAG_INCLUDE_PRERELEASE:VQ,FLAG_LOOSE:GQ}=ha(),BQ=new RegExp(qQ[Vt.BUILD],"g"),RA=e=>e.value==="<0.0.0-0",ZQ=e=>e.value==="",PA=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every(o=>i.intersects(o,t)),i=n.pop();return r},KQ=(e,t)=>(e=e.replace(lr[Vt.BUILD],""),it("comp",e,t),e=WQ(e,t),it("caret",e),e=QQ(e,t),it("tildes",e),e=YQ(e,t),it("xrange",e),e=eH(e,t),it("stars",e),e),pr=e=>!e||e.toLowerCase()==="x"||e==="*",QQ=(e,t)=>e.trim().split(/\s+/).map(r=>HQ(r,t)).join(" "),HQ=(e,t)=>{let r=t.loose?lr[Vt.TILDELOOSE]:lr[Vt.TILDE];return e.replace(r,(n,i,o,s,a)=>{it("tilde",e,n,i,o,s,a);let c;return pr(i)?c="":pr(o)?c=`>=${i}.0.0 <${+i+1}.0.0-0`:pr(s)?c=`>=${i}.${o}.0 <${i}.${+o+1}.0-0`:a?(it("replaceTilde pr",a),c=`>=${i}.${o}.${s}-${a} <${i}.${+o+1}.0-0`):c=`>=${i}.${o}.${s} <${i}.${+o+1}.0-0`,it("tilde return",c),c})},WQ=(e,t)=>e.trim().split(/\s+/).map(r=>JQ(r,t)).join(" "),JQ=(e,t)=>{it("caret",e,t);let r=t.loose?lr[Vt.CARETLOOSE]:lr[Vt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(i,o,s,a,c)=>{it("caret",e,i,o,s,a,c);let u;return pr(o)?u="":pr(s)?u=`>=${o}.0.0${n} <${+o+1}.0.0-0`:pr(a)?o==="0"?u=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`:c?(it("replaceCaret pr",c),o==="0"?s==="0"?u=`>=${o}.${s}.${a}-${c} <${o}.${s}.${+a+1}-0`:u=`>=${o}.${s}.${a}-${c} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.${a}-${c} <${+o+1}.0.0-0`):(it("no pr"),o==="0"?s==="0"?u=`>=${o}.${s}.${a}${n} <${o}.${s}.${+a+1}-0`:u=`>=${o}.${s}.${a}${n} <${o}.${+s+1}.0-0`:u=`>=${o}.${s}.${a} <${+o+1}.0.0-0`),it("caret return",u),u})},YQ=(e,t)=>(it("replaceXRanges",e,t),e.split(/\s+/).map(r=>XQ(r,t)).join(" ")),XQ=(e,t)=>{e=e.trim();let r=t.loose?lr[Vt.XRANGELOOSE]:lr[Vt.XRANGE];return e.replace(r,(n,i,o,s,a,c)=>{it("xRange",e,n,i,o,s,a,c);let u=pr(o),l=u||pr(s),d=l||pr(a),f=d;return i==="="&&f&&(i=""),c=t.includePrerelease?"-0":"",u?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&f?(l&&(s=0),a=0,i===">"?(i=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):i==="<="&&(i="<",l?o=+o+1:s=+s+1),i==="<"&&(c="-0"),n=`${i+o}.${s}.${a}${c}`):l?n=`>=${o}.0.0${c} <${+o+1}.0.0-0`:d&&(n=`>=${o}.${s}.0${c} <${o}.${+s+1}.0-0`),it("xRange return",n),n})},eH=(e,t)=>(it("replaceStars",e,t),e.trim().replace(lr[Vt.STAR],"")),tH=(e,t)=>(it("replaceGTE0",e,t),e.trim().replace(lr[t.includePrerelease?Vt.GTE0PRE:Vt.GTE0],"")),rH=e=>(t,r,n,i,o,s,a,c,u,l,d,f)=>(pr(n)?r="":pr(i)?r=`>=${n}.0.0${e?"-0":""}`:pr(o)?r=`>=${n}.${i}.0${e?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,pr(u)?c="":pr(l)?c=`<${+u+1}.0.0-0`:pr(d)?c=`<${u}.${+l+1}.0-0`:f?c=`<=${u}.${l}.${d}-${f}`:e?c=`<${u}.${l}.${+d+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),nH=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++)if(it(e[n].semver),e[n].semver!==My.ANY&&e[n].semver.prerelease.length>0){let i=e[n].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}});var lu=_((_Te,MA)=>{"use strict";p();var pu=Symbol("SemVer ANY"),zy=class e{static get ANY(){return pu}constructor(t,r){if(r=kA(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),Fy("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===pu?this.value="":this.value=this.operator+this.semver.version,Fy("comp",this)}parse(t){let r=this.options.loose?CA[LA.COMPARATORLOOSE]:CA[LA.COMPARATOR],n=t.match(r);if(!n)throw new TypeError(`Invalid comparator: ${t}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new jA(n[2],this.options.loose):this.semver=pu}toString(){return this.value}test(t){if(Fy("Comparator.test",t,this.options.loose),this.semver===pu||t===pu)return!0;if(typeof t=="string")try{t=new jA(t,this.options)}catch{return!1}return qy(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new $A(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new $A(this.value,r).test(t.semver):(r=kA(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||qy(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||qy(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};MA.exports=zy;var kA=pd(),{safeRe:CA,t:LA}=ma(),qy=Ly(),Fy=cu(),jA=Ut(),$A=Jr()});var du=_((ETe,qA)=>{"use strict";p();var iH=Jr(),oH=(e,t,r)=>{try{t=new iH(t,r)}catch{return!1}return t.test(e)};qA.exports=oH});var zA=_((TTe,FA)=>{"use strict";p();var sH=Jr(),aH=(e,t)=>new sH(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));FA.exports=aH});var VA=_((OTe,UA)=>{"use strict";p();var cH=Ut(),uH=Jr(),lH=(e,t,r)=>{let n=null,i=null,o=null;try{o=new uH(t,r)}catch{return null}return e.forEach(s=>{o.test(s)&&(!n||i.compare(s)===-1)&&(n=s,i=new cH(n,r))}),n};UA.exports=lH});var BA=_((ITe,GA)=>{"use strict";p();var pH=Ut(),dH=Jr(),fH=(e,t,r)=>{let n=null,i=null,o=null;try{o=new dH(t,r)}catch{return null}return e.forEach(s=>{o.test(s)&&(!n||i.compare(s)===1)&&(n=s,i=new pH(n,r))}),n};GA.exports=fH});var QA=_((NTe,KA)=>{"use strict";p();var Uy=Ut(),hH=Jr(),ZA=uu(),mH=(e,t)=>{e=new hH(e,t);let r=new Uy("0.0.0");if(e.test(r)||(r=new Uy("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n<e.set.length;++n){let i=e.set[n],o=null;i.forEach(s=>{let a=new Uy(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||ZA(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||ZA(r,o))&&(r=o)}return r&&e.test(r)?r:null};KA.exports=mH});var WA=_((RTe,HA)=>{"use strict";p();var gH=Jr(),yH=(e,t)=>{try{return new gH(e,t).range||"*"}catch{return null}};HA.exports=yH});var Td=_((DTe,eR)=>{"use strict";p();var _H=Ut(),XA=lu(),{ANY:vH}=XA,EH=Jr(),bH=du(),JA=uu(),YA=yd(),TH=vd(),SH=_d(),OH=(e,t,r,n)=>{e=new _H(e,n),t=new EH(t,n);let i,o,s,a,c;switch(r){case">":i=JA,o=TH,s=YA,a=">",c=">=";break;case"<":i=YA,o=SH,s=JA,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(bH(e,t,n))return!1;for(let u=0;u<t.set.length;++u){let l=t.set[u],d=null,f=null;if(l.forEach(h=>{h.semver===vH&&(h=new XA(">=0.0.0")),d=d||h,f=f||h,i(h.semver,d.semver,n)?d=h:s(h.semver,f.semver,n)&&(f=h)}),d.operator===a||d.operator===c||(!f.operator||f.operator===a)&&o(e,f.semver))return!1;if(f.operator===c&&s(e,f.semver))return!1}return!0};eR.exports=OH});var rR=_((CTe,tR)=>{"use strict";p();var wH=Td(),IH=(e,t,r)=>wH(e,t,">",r);tR.exports=IH});var iR=_((jTe,nR)=>{"use strict";p();var xH=Td(),NH=(e,t,r)=>xH(e,t,"<",r);nR.exports=NH});var aR=_((MTe,sR)=>{"use strict";p();var oR=Jr(),AH=(e,t,r)=>(e=new oR(e,r),t=new oR(t,r),e.intersects(t,r));sR.exports=AH});var uR=_((FTe,cR)=>{"use strict";p();var RH=du(),PH=Wr();cR.exports=(e,t,r)=>{let n=[],i=null,o=null,s=e.sort((l,d)=>PH(l,d,r));for(let l of s)RH(l,t,r)?(o=l,i||(i=l)):(o&&n.push([i,o]),o=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,d]of n)l===d?a.push(l):!d&&l===s[0]?a.push("*"):d?l===s[0]?a.push(`<=${d}`):a.push(`${l} - ${d}`):a.push(`>=${l}`);let c=a.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length<u.length?c:t}});var mR=_((UTe,hR)=>{"use strict";p();var lR=Jr(),By=lu(),{ANY:Vy}=By,Gy=du(),Zy=Wr(),DH=(e,t,r={})=>{if(e===t)return!0;e=new lR(e,r),t=new lR(t,r);let n=!1;e:for(let i of e.set){for(let o of t.set){let s=CH(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},kH=[new By(">=0.0.0-0")],pR=[new By(">=0.0.0")],CH=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Vy){if(t.length===1&&t[0].semver===Vy)return!0;r.includePrerelease?e=kH:e=pR}if(t.length===1&&t[0].semver===Vy){if(r.includePrerelease)return!0;t=pR}let n=new Set,i,o;for(let h of e)h.operator===">"||h.operator===">="?i=dR(i,h,r):h.operator==="<"||h.operator==="<="?o=fR(o,h,r):n.add(h.semver);if(n.size>1)return null;let s;if(i&&o){if(s=Zy(i.semver,o.semver,r),s>0)return null;if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let h of n){if(i&&!Gy(h,String(i),r)||o&&!Gy(h,String(o),r))return null;for(let m of t)if(!Gy(h,String(m),r))return!1;return!0}let a,c,u,l,d=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,f=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;d&&d.prerelease.length===1&&o.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(let h of t){if(l=l||h.operator===">"||h.operator===">=",u=u||h.operator==="<"||h.operator==="<=",i){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(a=dR(i,h,r),a===h&&a!==i)return!1}else if(i.operator===">="&&!h.test(i.semver))return!1}if(o){if(d&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===d.major&&h.semver.minor===d.minor&&h.semver.patch===d.patch&&(d=!1),h.operator==="<"||h.operator==="<="){if(c=fR(o,h,r),c===h&&c!==o)return!1}else if(o.operator==="<="&&!h.test(o.semver))return!1}if(!h.operator&&(o||i)&&s!==0)return!1}return!(i&&u&&!o&&s!==0||o&&l&&!i&&s!==0||f||d)},dR=(e,t,r)=>{if(!e)return t;let n=Zy(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},fR=(e,t,r)=>{if(!e)return t;let n=Zy(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};hR.exports=DH});var Sd=_((GTe,_R)=>{"use strict";p();var Ky=ma(),gR=ha(),LH=Ut(),yR=Ry(),jH=Bi(),$H=zN(),MH=VN(),qH=ZN(),FH=HN(),zH=JN(),UH=XN(),VH=tA(),GH=nA(),BH=Wr(),ZH=aA(),KH=uA(),QH=gd(),HH=fA(),WH=mA(),JH=uu(),YH=yd(),XH=ky(),e2=Cy(),t2=_d(),r2=vd(),n2=Ly(),i2=OA(),o2=IA(),s2=lu(),a2=Jr(),c2=du(),u2=zA(),l2=VA(),p2=BA(),d2=QA(),f2=WA(),h2=Td(),m2=rR(),g2=iR(),y2=aR(),_2=uR(),v2=mR();_R.exports={parse:jH,valid:$H,clean:MH,inc:qH,diff:FH,major:zH,minor:UH,patch:VH,prerelease:GH,compare:BH,rcompare:ZH,compareLoose:KH,compareBuild:QH,sort:HH,rsort:WH,gt:JH,lt:YH,eq:XH,neq:e2,gte:t2,lte:r2,cmp:n2,coerce:i2,truncate:o2,Comparator:s2,Range:a2,satisfies:c2,toComparators:u2,maxSatisfying:l2,minSatisfying:p2,minVersion:d2,validRange:f2,outside:h2,gtr:m2,ltr:g2,intersects:y2,simplifyRange:_2,subset:v2,SemVer:LH,re:Ky.re,src:Ky.src,tokens:Ky.t,SEMVER_SPEC_VERSION:gR.SEMVER_SPEC_VERSION,RELEASE_TYPES:gR.RELEASE_TYPES,compareIdentifiers:yR.compareIdentifiers,rcompareIdentifiers:yR.rcompareIdentifiers}});var ER=_((ZTe,vR)=>{p();var E2=Sd();vR.exports=E2.satisfies(process.version,">=15.7.0")});var TR=_((QTe,bR)=>{p();var b2=Sd();bR.exports=b2.satisfies(process.version,">=16.9.0")});var Qy=_((WTe,SR)=>{p();var T2=ER(),S2=TR(),O2={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},w2={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};SR.exports=function(e,t){if(!e||!t)return;let r=t.asymmetricKeyType;if(!r)return;let n=O2[r];if(!n)throw new Error(`Unknown key type "${r}".`);if(!n.includes(e))throw new Error(`"alg" parameter for "${r}" key type must be one of: ${n.join(", ")}.`);if(T2)switch(r){case"ec":let i=t.asymmetricKeyDetails.namedCurve,o=w2[e];if(i!==o)throw new Error(`"alg" parameter "${e}" requires curve "${o}".`);break;case"rsa-pss":if(S2){let s=parseInt(e.slice(-3),10),{hashAlgorithm:a,mgf1HashAlgorithm:c,saltLength:u}=t.asymmetricKeyDetails;if(a!==`sha${s}`||c!==a)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(u!==void 0&&u>s>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}break}}});var Hy=_((YTe,OR)=>{p();var I2=Sd();OR.exports=I2.satisfies(process.version,"^6.12.0 || >=8.0.0")});var xR=_((eSe,IR)=>{p();var et=au(),x2=wy(),wR=Iy(),N2=Oy(),A2=xy(),R2=Qy(),P2=Hy(),D2=sd(),{KeyObject:k2,createSecretKey:C2,createPublicKey:L2}=K("crypto"),Wy=["RS256","RS384","RS512"],j2=["ES256","ES384","ES512"],Jy=["RS256","RS384","RS512"],$2=["HS256","HS384","HS512"];P2&&(Wy.splice(Wy.length,0,"PS256","PS384","PS512"),Jy.splice(Jy.length,0,"PS256","PS384","PS512"));IR.exports=function(e,t,r,n){typeof r=="function"&&!n&&(n=r,r={}),r||(r={}),r=Object.assign({},r);let i;if(n?i=n:i=function(l,d){if(l)throw l;return d},r.clockTimestamp&&typeof r.clockTimestamp!="number")return i(new et("clockTimestamp must be a number"));if(r.nonce!==void 0&&(typeof r.nonce!="string"||r.nonce.trim()===""))return i(new et("nonce must be a non-empty string"));if(r.allowInvalidAsymmetricKeyTypes!==void 0&&typeof r.allowInvalidAsymmetricKeyTypes!="boolean")return i(new et("allowInvalidAsymmetricKeyTypes must be a boolean"));let o=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return i(new et("jwt must be provided"));if(typeof e!="string")return i(new et("jwt must be a string"));let s=e.split(".");if(s.length!==3)return i(new et("jwt malformed"));let a;try{a=N2(e,{complete:!0})}catch(l){return i(l)}if(!a)return i(new et("invalid token"));let c=a.header,u;if(typeof t=="function"){if(!n)return i(new et("verify must be called asynchronous if secret or public key is provided as a callback"));u=t}else u=function(l,d){return d(null,t)};return u(c,function(l,d){if(l)return i(new et("error in secret or public key callback: "+l.message));let f=s[2].trim()!=="";if(!f&&d)return i(new et("jwt signature is required"));if(f&&!d)return i(new et("secret or public key must be provided"));if(!f&&!r.algorithms)return i(new et('please specify "none" in "algorithms" to verify unsigned tokens'));if(d!=null&&!(d instanceof k2))try{d=L2(d)}catch{try{d=C2(typeof d=="string"?Buffer.from(d):d)}catch{return i(new et("secretOrPublicKey is not valid key material"))}}if(r.algorithms||(d.type==="secret"?r.algorithms=$2:["rsa","rsa-pss"].includes(d.asymmetricKeyType)?r.algorithms=Jy:d.asymmetricKeyType==="ec"?r.algorithms=j2:r.algorithms=Wy),r.algorithms.indexOf(a.header.alg)===-1)return i(new et("invalid algorithm"));if(c.alg.startsWith("HS")&&d.type!=="secret")return i(new et(`secretOrPublicKey must be a symmetric key when using ${c.alg}`));if(/^(?:RS|PS|ES)/.test(c.alg)&&d.type!=="public")return i(new et(`secretOrPublicKey must be an asymmetric key when using ${c.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{R2(c.alg,d)}catch(y){return i(y)}let h;try{h=D2.verify(e,a.header.alg,d)}catch(y){return i(y)}if(!h)return i(new et("invalid signature"));let m=a.payload;if(typeof m.nbf<"u"&&!r.ignoreNotBefore){if(typeof m.nbf!="number")return i(new et("invalid nbf value"));if(m.nbf>o+(r.clockTolerance||0))return i(new x2("jwt not active",new Date(m.nbf*1e3)))}if(typeof m.exp<"u"&&!r.ignoreExpiration){if(typeof m.exp!="number")return i(new et("invalid exp value"));if(o>=m.exp+(r.clockTolerance||0))return i(new wR("jwt expired",new Date(m.exp*1e3)))}if(r.audience){let y=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(m.aud)?m.aud:[m.aud]).some(function(T){return y.some(function(O){return O instanceof RegExp?O.test(T):O===T})}))return i(new et("jwt audience invalid. expected: "+y.join(" or ")))}if(r.issuer&&(typeof r.issuer=="string"&&m.iss!==r.issuer||Array.isArray(r.issuer)&&r.issuer.indexOf(m.iss)===-1))return i(new et("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&m.sub!==r.subject)return i(new et("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&m.jti!==r.jwtid)return i(new et("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&m.nonce!==r.nonce)return i(new et("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if(typeof m.iat!="number")return i(new et("iat required when maxAge is specified"));let y=A2(r.maxAge,m.iat);if(typeof y>"u")return i(new et('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(o>=y+(r.clockTolerance||0))return i(new wR("maxAge exceeded",new Date(y*1e3)))}if(r.complete===!0){let y=a.signature;return i(null,{header:c,payload:m,signature:y})}return i(null,m)})}});var kR=_((rSe,DR)=>{p();var NR=1/0,RR=9007199254740991,M2=17976931348623157e292,AR=NaN,q2="[object Arguments]",F2="[object Function]",z2="[object GeneratorFunction]",U2="[object String]",V2="[object Symbol]",G2=/^\s+|\s+$/g,B2=/^[-+]0x[0-9a-f]+$/i,Z2=/^0b[01]+$/i,K2=/^0o[0-7]+$/i,Q2=/^(?:0|[1-9]\d*)$/,H2=parseInt;function W2(e,t){for(var r=-1,n=e?e.length:0,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function J2(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Y2(e,t,r){if(t!==t)return J2(e,X2,r);for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function X2(e){return e!==e}function e4(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function t4(e,t){return W2(t,function(r){return e[r]})}function r4(e,t){return function(r){return e(t(r))}}var Od=Object.prototype,Xy=Od.hasOwnProperty,wd=Od.toString,n4=Od.propertyIsEnumerable,i4=r4(Object.keys,Object),o4=Math.max;function s4(e,t){var r=PR(e)||p4(e)?e4(e.length,String):[],n=r.length,i=!!n;for(var o in e)(t||Xy.call(e,o))&&!(i&&(o=="length"||c4(o,n)))&&r.push(o);return r}function a4(e){if(!u4(e))return i4(e);var t=[];for(var r in Object(e))Xy.call(e,r)&&r!="constructor"&&t.push(r);return t}function c4(e,t){return t=t??RR,!!t&&(typeof e=="number"||Q2.test(e))&&e>-1&&e%1==0&&e<t}function u4(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Od;return e===r}function l4(e,t,r,n){e=e_(e)?e:b4(e),r=r&&!n?_4(r):0;var i=e.length;return r<0&&(r=o4(i+r,0)),m4(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&Y2(e,t,r)>-1}function p4(e){return d4(e)&&Xy.call(e,"callee")&&(!n4.call(e,"callee")||wd.call(e)==q2)}var PR=Array.isArray;function e_(e){return e!=null&&h4(e.length)&&!f4(e)}function d4(e){return t_(e)&&e_(e)}function f4(e){var t=Yy(e)?wd.call(e):"";return t==F2||t==z2}function h4(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=RR}function Yy(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function t_(e){return!!e&&typeof e=="object"}function m4(e){return typeof e=="string"||!PR(e)&&t_(e)&&wd.call(e)==U2}function g4(e){return typeof e=="symbol"||t_(e)&&wd.call(e)==V2}function y4(e){if(!e)return e===0?e:0;if(e=v4(e),e===NR||e===-NR){var t=e<0?-1:1;return t*M2}return e===e?e:0}function _4(e){var t=y4(e),r=t%1;return t===t?r?t-r:t:0}function v4(e){if(typeof e=="number")return e;if(g4(e))return AR;if(Yy(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Yy(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(G2,"");var r=Z2.test(e);return r||K2.test(e)?H2(e.slice(2),r?2:8):B2.test(e)?AR:+e}function E4(e){return e_(e)?s4(e):a4(e)}function b4(e){return e?t4(e,E4(e)):[]}DR.exports=l4});var LR=_((iSe,CR)=>{p();var T4="[object Boolean]",S4=Object.prototype,O4=S4.toString;function w4(e){return e===!0||e===!1||I4(e)&&O4.call(e)==T4}function I4(e){return!!e&&typeof e=="object"}CR.exports=w4});var FR=_((sSe,qR)=>{p();var jR=1/0,x4=17976931348623157e292,$R=NaN,N4="[object Symbol]",A4=/^\s+|\s+$/g,R4=/^[-+]0x[0-9a-f]+$/i,P4=/^0b[01]+$/i,D4=/^0o[0-7]+$/i,k4=parseInt,C4=Object.prototype,L4=C4.toString;function j4(e){return typeof e=="number"&&e==F4(e)}function MR(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function $4(e){return!!e&&typeof e=="object"}function M4(e){return typeof e=="symbol"||$4(e)&&L4.call(e)==N4}function q4(e){if(!e)return e===0?e:0;if(e=z4(e),e===jR||e===-jR){var t=e<0?-1:1;return t*x4}return e===e?e:0}function F4(e){var t=q4(e),r=t%1;return t===t?r?t-r:t:0}function z4(e){if(typeof e=="number")return e;if(M4(e))return $R;if(MR(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=MR(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(A4,"");var r=P4.test(e);return r||D4.test(e)?k4(e.slice(2),r?2:8):R4.test(e)?$R:+e}qR.exports=j4});var UR=_((cSe,zR)=>{p();var U4="[object Number]",V4=Object.prototype,G4=V4.toString;function B4(e){return!!e&&typeof e=="object"}function Z4(e){return typeof e=="number"||B4(e)&&G4.call(e)==U4}zR.exports=Z4});var ZR=_((lSe,BR)=>{p();var K4="[object Object]";function Q4(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function H4(e,t){return function(r){return e(t(r))}}var W4=Function.prototype,VR=Object.prototype,GR=W4.toString,J4=VR.hasOwnProperty,Y4=GR.call(Object),X4=VR.toString,eW=H4(Object.getPrototypeOf,Object);function tW(e){return!!e&&typeof e=="object"}function rW(e){if(!tW(e)||X4.call(e)!=K4||Q4(e))return!1;var t=eW(e);if(t===null)return!0;var r=J4.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&GR.call(r)==Y4}BR.exports=rW});var QR=_((dSe,KR)=>{p();var nW="[object String]",iW=Object.prototype,oW=iW.toString,sW=Array.isArray;function aW(e){return!!e&&typeof e=="object"}function cW(e){return typeof e=="string"||!sW(e)&&aW(e)&&oW.call(e)==nW}KR.exports=cW});var XR=_((hSe,YR)=>{p();var uW="Expected a function",HR=1/0,lW=17976931348623157e292,WR=NaN,pW="[object Symbol]",dW=/^\s+|\s+$/g,fW=/^[-+]0x[0-9a-f]+$/i,hW=/^0b[01]+$/i,mW=/^0o[0-7]+$/i,gW=parseInt,yW=Object.prototype,_W=yW.toString;function vW(e,t){var r;if(typeof t!="function")throw new TypeError(uW);return e=OW(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}function EW(e){return vW(2,e)}function JR(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function bW(e){return!!e&&typeof e=="object"}function TW(e){return typeof e=="symbol"||bW(e)&&_W.call(e)==pW}function SW(e){if(!e)return e===0?e:0;if(e=wW(e),e===HR||e===-HR){var t=e<0?-1:1;return t*lW}return e===e?e:0}function OW(e){var t=SW(e),r=t%1;return t===t?r?t-r:t:0}function wW(e){if(typeof e=="number")return e;if(TW(e))return WR;if(JR(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=JR(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(dW,"");var r=hW.test(e);return r||mW.test(e)?gW(e.slice(2),r?2:8):fW.test(e)?WR:+e}YR.exports=EW});var cP=_((gSe,aP)=>{p();var eP=xy(),IW=Hy(),xW=Qy(),tP=sd(),NW=kR(),Id=LR(),rP=FR(),r_=UR(),iP=ZR(),Zi=QR(),AW=XR(),{KeyObject:RW,createSecretKey:PW,createPrivateKey:DW}=K("crypto"),oP=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];IW&&oP.splice(3,0,"PS256","PS384","PS512");var kW={expiresIn:{isValid:function(e){return rP(e)||Zi(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return rP(e)||Zi(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return Zi(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:NW.bind(null,oP),message:'"algorithm" must be a valid string enum value'},header:{isValid:iP,message:'"header" must be an object'},encoding:{isValid:Zi,message:'"encoding" must be a string'},issuer:{isValid:Zi,message:'"issuer" must be a string'},subject:{isValid:Zi,message:'"subject" must be a string'},jwtid:{isValid:Zi,message:'"jwtid" must be a string'},noTimestamp:{isValid:Id,message:'"noTimestamp" must be a boolean'},keyid:{isValid:Zi,message:'"keyid" must be a string'},mutatePayload:{isValid:Id,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:Id,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:Id,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},CW={iat:{isValid:r_,message:'"iat" should be a number of seconds'},exp:{isValid:r_,message:'"exp" should be a number of seconds'},nbf:{isValid:r_,message:'"nbf" should be a number of seconds'}};function sP(e,t,r,n){if(!iP(r))throw new Error('Expected "'+n+'" to be a plain object.');Object.keys(r).forEach(function(i){let o=e[i];if(!o){if(!t)throw new Error('"'+i+'" is not allowed in "'+n+'"');return}if(!o.isValid(r[i]))throw new Error(o.message)})}function LW(e){return sP(kW,!1,e,"options")}function jW(e){return sP(CW,!0,e,"payload")}var nP={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},$W=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];aP.exports=function(e,t,r,n){typeof r=="function"?(n=r,r={}):r=r||{};let i=typeof e=="object"&&!Buffer.isBuffer(e),o=Object.assign({alg:r.algorithm||"HS256",typ:i?"JWT":void 0,kid:r.keyid},r.header);function s(u){if(n)return n(u);throw u}if(!t&&r.algorithm!=="none")return s(new Error("secretOrPrivateKey must have a value"));if(t!=null&&!(t instanceof RW))try{t=DW(t)}catch{try{t=PW(typeof t=="string"?Buffer.from(t):t)}catch{return s(new Error("secretOrPrivateKey is not valid key material"))}}if(o.alg.startsWith("HS")&&t.type!=="secret")return s(new Error(`secretOrPrivateKey must be a symmetric key when using ${o.alg}`));if(/^(?:RS|PS|ES)/.test(o.alg)){if(t.type!=="private")return s(new Error(`secretOrPrivateKey must be an asymmetric key when using ${o.alg}`));if(!r.allowInsecureKeySizes&&!o.alg.startsWith("ES")&&t.asymmetricKeyDetails!==void 0&&t.asymmetricKeyDetails.modulusLength<2048)return s(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`))}if(typeof e>"u")return s(new Error("payload is required"));if(i){try{jW(e)}catch(u){return s(u)}r.mutatePayload||(e=Object.assign({},e))}else{let u=$W.filter(function(l){return typeof r[l]<"u"});if(u.length>0)return s(new Error("invalid "+u.join(",")+" option for "+typeof e+" payload"))}if(typeof e.exp<"u"&&typeof r.expiresIn<"u")return s(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(typeof e.nbf<"u"&&typeof r.notBefore<"u")return s(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{LW(r)}catch(u){return s(u)}if(!r.allowInvalidAsymmetricKeyTypes)try{xW(o.alg,t)}catch(u){return s(u)}let a=e.iat||Math.floor(Date.now()/1e3);if(r.noTimestamp?delete e.iat:i&&(e.iat=a),typeof r.notBefore<"u"){try{e.nbf=eP(r.notBefore,a)}catch(u){return s(u)}if(typeof e.nbf>"u")return s(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(typeof r.expiresIn<"u"&&typeof e=="object"){try{e.exp=eP(r.expiresIn,a)}catch(u){return s(u)}if(typeof e.exp>"u")return s(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(nP).forEach(function(u){let l=nP[u];if(typeof r[u]<"u"){if(typeof e[l]<"u")return s(new Error('Bad "options.'+u+'" option. The payload already has an "'+l+'" property.'));e[l]=r[u]}});let c=r.encoding||"utf8";if(typeof n=="function")n=n&&AW(n),tP.createSign({header:o,privateKey:t,payload:e,encoding:c}).once("error",n).once("done",function(u){if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&u.length<256)return n(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`));n(null,u)});else{let u=tP.sign({header:o,payload:e,secret:t,encoding:c});if(!r.allowInsecureKeySizes&&/^(?:RS|PS)/.test(o.alg)&&u.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${o.alg}`);return u}}});var fu=_((_Se,uP)=>{p();uP.exports={decode:Oy(),verify:xR(),sign:cP(),JsonWebTokenError:au(),NotBeforeError:wy(),TokenExpiredError:Iy()}});var bP=_(ya=>{"use strict";p();Object.defineProperty(ya,"__esModule",{value:!0});ya.versionInfo=ya.version=void 0;var o9="15.10.2";ya.version=o9;var s9=Object.freeze({major:15,minor:10,patch:2,preReleaseTag:null});ya.versionInfo=s9});var kd=_(l_=>{"use strict";p();Object.defineProperty(l_,"__esModule",{value:!0});l_.default=a9;function a9(e){return typeof e?.then=="function"}});var Yr=_(p_=>{"use strict";p();Object.defineProperty(p_,"__esModule",{value:!0});p_.default=c9;function c9(e,t){var r=!!e;if(!r)throw new Error(t)}});var Gn=_(d_=>{"use strict";p();Object.defineProperty(d_,"__esModule",{value:!0});d_.default=u9;function Cd(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Cd=function(r){return typeof r}:Cd=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Cd(e)}function u9(e){return Cd(e)=="object"&&e!==null}});var Bn=_(Ki=>{"use strict";p();Object.defineProperty(Ki,"__esModule",{value:!0});Ki.SYMBOL_TO_STRING_TAG=Ki.SYMBOL_ASYNC_ITERATOR=Ki.SYMBOL_ITERATOR=void 0;var l9=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator";Ki.SYMBOL_ITERATOR=l9;var p9=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator";Ki.SYMBOL_ASYNC_ITERATOR=p9;var d9=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";Ki.SYMBOL_TO_STRING_TAG=d9});var Ld=_(f_=>{"use strict";p();Object.defineProperty(f_,"__esModule",{value:!0});f_.getLocation=f9;function f9(e,t){for(var r=/\r\n|[\n\r]/g,n=1,i=t+1,o;(o=r.exec(e.body))&&o.index<t;)n+=1,i=t+1-(o.index+o[0].length);return{line:n,column:i}}});var h_=_($d=>{"use strict";p();Object.defineProperty($d,"__esModule",{value:!0});$d.printLocation=m9;$d.printSourceLocation=SP;var h9=Ld();function m9(e){return SP(e.source,(0,h9.getLocation)(e.source,e.start))}function SP(e,t){var r=e.locationOffset.column-1,n=jd(r)+e.body,i=t.line-1,o=e.locationOffset.line-1,s=t.line+o,a=t.line===1?r:0,c=t.column+a,u="".concat(e.name,":").concat(s,":").concat(c,`
6
6
  `),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var f=Math.floor(c/80),h=c%80,m=[],y=0;y<d.length;y+=80)m.push(d.slice(y,y+80));return u+TP([["".concat(s),m[0]]].concat(m.slice(1,f+1).map(function(v){return["",v]}),[[" ",jd(h-1)+"^"],["",m[f+1]]]))}return u+TP([["".concat(s-1),l[i-1]],["".concat(s),d],["",jd(c-1)+"^"],["".concat(s+1),l[i+1]]])}function TP(e){var t=e.filter(function(n){var i=n[0],o=n[1];return o!==void 0}),r=Math.max.apply(Math,t.map(function(n){var i=n[0];return i.length}));return t.map(function(n){var i=n[0],o=n[1];return g9(r,i)+(o?" | "+o:" |")}).join(`
@@ -959,7 +959,7 @@ ${String(e)}`)}catch(t){return t}},gj=e=>{if(typeof e!="object"||e===null)throw
959
959
  }
960
960
  }
961
961
  }
962
- `;p();import{randomUUID as ise}from"crypto";var xq=Pt(bM(),1);p();var Joe=Pt(gq(),1),Yoe=Pt(Lh(),1),Xoe=Pt(cc(),1),ese=Pt(nS(),1),tse=Pt(sS(),1),rse=Pt(dS(),1),wq=Pt(qh(),1),nse=Pt(Oq(),1);var Iq=wq.default;var Nq=ise(),ose=e=>{if(!e)return e;if(Array.isArray(e))return e.map(([r,n])=>[r,String(r).toLowerCase()==="authorization"?"Bearer <redacted>":n]);if(typeof e=="object"&&"forEach"in e&&typeof e.forEach=="function"){let r={};return e.forEach((n,i)=>{r[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(n)}),r}let t={};for(let[r,n]of Object.entries(e))t[r]=r.toLowerCase()==="authorization"?"Bearer <redacted>":String(n);return t},sse=e=>{if(typeof e=="string")return e;if(e instanceof Uint8Array)return Buffer.from(e).toString("utf8");try{return String(e)}catch{return"<unserializable body>"}},Cl=async(e,t)=>{let r=Rd();B.debug(`[HTTP] Request URL: ${e.toString()}`),t?.headers&&B.debug(`[HTTP] Request Headers: ${JSON.stringify(ose(t.headers))}`),r&&t?.body!=null&&B.debug(`[GQL] Request Body: ${sse(t.body)}`);let n=await fetch(e,t);if(r)try{let i=await n.clone().text();B.debug(`[GQL] Response ${n.status}: ${i}`)}catch(i){B.debug(`[GQL] Response read failed: ${String(i)}`)}return n};async function hS(e,t){let r=await e.getValidToken(),n=await xn(t),i={Authorization:`Bearer ${r}`,"User-Locale":"en_US","X-SESSION-ID":Nq};return process.env.REACT_APP_VERSION&&(i["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new er(`${n.apiBaseUrl}/api/graphql`,{headers:i,fetch:Cl})}async function Aq(e,t){let r=await e.getValidToken(),i=`${(await xn(t)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(o,s,a)=>{let c=Rd(),u={authToken:r,"X-SESSION-ID":Nq};B.debug(`[SUB] connecting ${i} params=${JSON.stringify({...u,authToken:"Bearer <redacted>"})}`);let l=new xq.SubscriptionClient(i,{lazy:!0,reconnect:!0,minTimeout:3e3,connectionParams:u},Iq);l.onConnected(()=>B.debug("[SUB] connected")),l.onReconnected(()=>B.debug("[SUB] reconnected")),l.onDisconnected(()=>B.debug("[SUB] disconnected")),l.onError(h=>B.debug(`[SUB] error ${h?.message??String(h)}`));let f=[{name:"onNewCrdtPatchV2",query:Qj,variables:{projectExId:o.projectExId,appExId:o.appExId??null,versionExId:o.appVersionExId??null,latestPatchExIdInClient:s}},{name:"onSchemaUploadV3",query:Hj,variables:{projectExId:o.projectExId,appExId:o.appExId??null,appVersionExId:o.appVersionExId??null}}].map(h=>(B.debug(`[SUB] subscribe ${h.name} vars=${JSON.stringify(h.variables)}`),l.request({query:h.query,variables:h.variables}).subscribe({next:m=>{c&&B.debug(`[SUB] ${h.name} event: ${JSON.stringify(m)}`),a()},error:m=>{B.warn("Schema subscription event failed",String(m)),a()}})));return{unsubscribe(){for(let h of f)h.unsubscribe();l.close(!1,!1)}}}}async function zh(e,t){if(t.projectExId)return await e.saveProjectContext(t.projectExId),t.projectExId;let r=await e.loadProjectContext();if(!r?.projectExId)throw new Error("No projectExId provided and no current project is set");return r.projectExId}p();p();var Rq=100*1024*1024,Uh=class{current=Promise.resolve();async run(t){let r=this.current,n=()=>{};this.current=new Promise(i=>{n=i}),await r;try{return await t()}finally{n()}}},Cq=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`Failed to download CRDT model: ${t.status} ${t.statusText}`);let r=t.body?.getReader();if(!r)throw new Error("Failed to read CRDT model response body");let n=[],i=0;for(;;){let{done:a,value:c}=await r.read();if(a)break;if(i+=c.length,i>Rq)throw new Error(`CRDT model is larger than ${Rq} bytes`);n.push(c)}let o=new Uint8Array(i),s=0;for(let a of n)o.set(a,s),s+=a.length;return o},Vh=async(e,t)=>{try{return await t()}catch(r){return B.warn(`Optional runtime package unavailable: ${e}`,r.message),null}},Pq=null,Pi=async()=>(Pq??=Vh("@functorz/ztype",()=>import("./ztype-CWGNVQST.js")).then(e=>(e?.default??e)?.com?.functorz?.ztype??null),Pq),Dq=null,mS=async()=>(Dq??=Vh("@functorz/crdt-helper",()=>import("./index.cjs-OYKDXY6B.js")).then(e=>e?.Crdt??e?.default?.Crdt??null),Dq),kq=null,Lq=async()=>(kq??=Vh("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-7QYQSIK6.js")).then(e=>e??Vh("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-SM3HKB4B.js"))).then(e=>e?.Patch??e?.default?.Patch??null),kq),gS=e=>e?.lastUploadedSchema??null,yS=e=>[e?.project?.lastDeployedServerSchemaExId,e?.lastDeployedServerSchemaExId,e?.project?.latestDeployedServerSchema?.exId,e?.latestDeployedServerSchema?.exId].find(r=>typeof r=="string"&&r.length>0)??null,_S=e=>e==null?e:structuredClone(e),jq=(e,t)=>e?.appExId?e.appExId:t?.name??"",$q=(e,t)=>{let r=e?.typesystem?.schema?.ClientType;if(r)return t==="WECHAT_MINI_PROGRAM"?r.WECHAT_MINI_PROGRAM??r.WECHAT??r.WEB:t==="MOBILE"?r.MOBILE??r.WEB:r.WEB},Mq=e=>{let t=e?.typesystem?.schema?.Product?.[qo];if(!t)throw new Error(`ztype runtime has no Product enum member for ${qo}`);return t},ase=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return String(e)}},Gh=e=>({componentId:e?.componentId??null,message:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("EN"):e?.message??String(e),zhMessage:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("ZH"):void 0,platform:e?.platform??null,isBackendError:!!e?.isBackendError,fullPath:ase(e?.fullPath??[])}),Bh=e=>e.stableErrors.concat(e.betaErrors).filter(t=>!!t.isBackendError),qq=e=>Bh(e).length,Fq=(e,t)=>{if(t.__typename==="DiffItem"){let r=t.pathComponents?.at(-1)?.key??"";if(t.operation==="delete"){delete e[r];return}e[r]=structuredClone(t.newValue);return}if(t.__typename==="ArrayDiffItem"){let r=t.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(e)||r<0)throw new Error("Invalid array diff target");if(t.operation==="delete"){e.splice(r,1);return}if(t.operation==="insert"){e.splice(r,0,structuredClone(t.newValue));return}e[r]=structuredClone(t.newValue)}};p();p();import{createHash as cse}from"crypto";var use=e=>!!(e&&typeof e=="object"&&!Array.isArray(e)),vS=e=>{if(Array.isArray(e))return e.map(r=>r===void 0?null:vS(r));if(!use(e))return e;let t={};for(let r of Object.keys(e).sort()){let n=e[r];n!==void 0&&(t[r]=vS(n))}return t},lse=e=>JSON.stringify(vS(e)),pse=e=>cse("sha256").update(lse(e)).digest("hex"),zq=e=>({projectExId:e.projectExId,appExId:e.appExId??null,appVersionExId:e.appVersionExId??null,schemaExId:e.schemaExId??null,lastPatchExId:e.lastPatchExId??null,snapshotHash:pse(e.snapshot),deployedSchemaExId:e.deployedSchemaExId??null,checkedAt:e.checkedAt??new Date().toISOString()}),Uq=(e,t)=>!e||!t?e!==t:e.schemaExId!==t.schemaExId||e.lastPatchExId!==t.lastPatchExId||e.snapshotHash!==t.snapshotHash||e.deployedSchemaExId!==t.deployedSchemaExId,ES=e=>e.changes.length>0;var Vq=null,dse=()=>(Vq??=Pi().then(e=>{let t=e?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof t=="function"?t:null}),Vq),bS=async(e,t)=>{let r=await dse();return r?r(e,t):{changes:[]}};p();var _s=class extends Error{constructor(r,n){super(r);this.diagnostics=n;this.name="ZtypeValidationError"}};p();function Zh(e,t,r){let n=$q(e,r?.appType);return e.api.ZTypeCoreApi.genZTypeApiContext(t,Mq(e),n,jq(r,n),e?.utils?.Locale?.EN,null)}p();var fse=3e4,Kh=class{constructor(t){this.options=t}timer=null;subscriptionHandle=null;running=!1;isActive(){return this.timer!==null||this.subscriptionHandle!==null}start(){this.timer||this.subscriptionHandle||!this.options.subscriptionFactory||this.options.subscriptionFactory(this.options.sessionKey,this.options.getLastPatchExId(),()=>{this.run()}).then(t=>{this.subscriptionHandle=t}).catch(t=>{B.warn("Schema subscription failed; falling back to polling",t.message)}).finally(()=>{this.schedulePoll()})}dispose(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.subscriptionHandle?.unsubscribe(),this.subscriptionHandle=null}schedulePoll(){!this.options.subscriptionFactory||this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.run().finally(()=>this.schedulePoll())},fse),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};p();p();var b={};py(b,{BRAND:()=>qse,DIRTY:()=>vs,EMPTY_PATH:()=>yse,INVALID:()=>ie,NEVER:()=>Tae,OK:()=>sr,ParseStatus:()=>Kt,Schema:()=>ge,ZodAny:()=>_o,ZodArray:()=>Li,ZodBigInt:()=>bs,ZodBoolean:()=>Ts,ZodBranded:()=>jl,ZodCatch:()=>ks,ZodDate:()=>Ss,ZodDefault:()=>Ds,ZodDiscriminatedUnion:()=>Wh,ZodEffects:()=>ln,ZodEnum:()=>Rs,ZodError:()=>Nr,ZodFirstPartyTypeKind:()=>D,ZodFunction:()=>Yh,ZodIntersection:()=>xs,ZodIssueCode:()=>P,ZodLazy:()=>Ns,ZodLiteral:()=>As,ZodMap:()=>vc,ZodNaN:()=>bc,ZodNativeEnum:()=>Ps,ZodNever:()=>Rn,ZodNull:()=>ws,ZodNullable:()=>ii,ZodNumber:()=>Es,ZodObject:()=>Rr,ZodOptional:()=>Ar,ZodParsedType:()=>M,ZodPipeline:()=>$l,ZodPromise:()=>vo,ZodReadonly:()=>Cs,ZodRecord:()=>Jh,ZodSchema:()=>ge,ZodSet:()=>Ec,ZodString:()=>yo,ZodSymbol:()=>yc,ZodTransformer:()=>ln,ZodTuple:()=>ni,ZodType:()=>ge,ZodUndefined:()=>Os,ZodUnion:()=>Is,ZodUnknown:()=>Ci,ZodVoid:()=>_c,addIssueToContext:()=>$,any:()=>Qse,array:()=>Yse,bigint:()=>Vse,boolean:()=>e1,coerce:()=>bae,custom:()=>Jq,date:()=>Gse,datetimeRegex:()=>Hq,defaultErrorMap:()=>Di,discriminatedUnion:()=>tae,effect:()=>fae,enum:()=>lae,function:()=>aae,getErrorMap:()=>hc,getParsedType:()=>ri,instanceof:()=>zse,intersection:()=>rae,isAborted:()=>Qh,isAsync:()=>mc,isDirty:()=>Hh,isValid:()=>go,late:()=>Fse,lazy:()=>cae,literal:()=>uae,makeIssue:()=>Ll,map:()=>oae,nan:()=>Use,nativeEnum:()=>pae,never:()=>Wse,null:()=>Kse,nullable:()=>mae,number:()=>Xq,object:()=>wS,objectUtil:()=>TS,oboolean:()=>Eae,onumber:()=>vae,optional:()=>hae,ostring:()=>_ae,pipeline:()=>yae,preprocess:()=>gae,promise:()=>dae,quotelessJson:()=>hse,record:()=>iae,set:()=>sae,setErrorMap:()=>gse,strictObject:()=>Xse,string:()=>Yq,symbol:()=>Bse,transformer:()=>fae,tuple:()=>nae,undefined:()=>Zse,union:()=>eae,unknown:()=>Hse,util:()=>be,void:()=>Jse});p();p();p();p();p();var be;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(be||(be={}));var TS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(TS||(TS={}));var M=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ri=e=>{switch(typeof e){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(e)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(e)?M.array:e===null?M.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?M.promise:typeof Map<"u"&&e instanceof Map?M.map:typeof Set<"u"&&e instanceof Set?M.set:typeof Date<"u"&&e instanceof Date?M.date:M.object;default:return M.unknown}};var P=be.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),hse=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Nr=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Nr.create=e=>new Nr(e);var mse=(e,t)=>{let r;switch(e.code){case P.invalid_type:e.received===M.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case P.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,be.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:r=`Unrecognized key(s) in object: ${be.joinValues(e.keys,", ")}`;break;case P.invalid_union:r="Invalid input";break;case P.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${be.joinValues(e.options)}`;break;case P.invalid_enum_value:r=`Invalid enum value. Expected ${be.joinValues(e.options)}, received '${e.received}'`;break;case P.invalid_arguments:r="Invalid function arguments";break;case P.invalid_return_type:r="Invalid function return type";break;case P.invalid_date:r="Invalid date";break;case P.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:be.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case P.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case P.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case P.custom:r="Invalid input";break;case P.invalid_intersection_types:r="Intersection results could not be merged";break;case P.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case P.not_finite:r="Number must be finite";break;default:r=t.defaultError,be.assertNever(e)}return{message:r}},Di=mse;var Gq=Di;function gse(e){Gq=e}function hc(){return Gq}p();var Ll=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},yse=[];function $(e,t){let r=hc(),n=Ll({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Di?void 0:Di].filter(i=>!!i)});e.common.issues.push(n)}var Kt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ie;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ie;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},ie=Object.freeze({status:"aborted"}),vs=e=>({status:"dirty",value:e}),sr=e=>({status:"valid",value:e}),Qh=e=>e.status==="aborted",Hh=e=>e.status==="dirty",go=e=>e.status==="valid",mc=e=>typeof Promise<"u"&&e instanceof Promise;p();p();var Q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Q||(Q={}));var un=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Bq=(e,t)=>{if(go(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Nr(e.common.issues);return this._error=r,this._error}}};function fe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var ge=class{get description(){return this._def.description}_getType(t){return ri(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:ri(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Kt,ctx:{common:t.parent.common,data:t.data,parsedType:ri(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(mc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ri(t)},i=this._parseSync({data:t,path:n.path,parent:n});return Bq(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ri(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return go(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>go(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ri(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(mc(i)?i:Promise.resolve(i));return Bq(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:P.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new ln({schema:this,typeName:D.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ar.create(this,this._def)}nullable(){return ii.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Li.create(this)}promise(){return vo.create(this,this._def)}or(t){return Is.create([this,t],this._def)}and(t){return xs.create(this,t,this._def)}transform(t){return new ln({...fe(this._def),schema:this,typeName:D.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ds({...fe(this._def),innerType:this,defaultValue:r,typeName:D.ZodDefault})}brand(){return new jl({typeName:D.ZodBranded,type:this,...fe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ks({...fe(this._def),innerType:this,catchValue:r,typeName:D.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return $l.create(this,t)}readonly(){return Cs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},_se=/^c[^\s-]{8,}$/i,vse=/^[0-9a-z]+$/,Ese=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bse=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Tse=/^[a-z0-9_-]{21}$/i,Sse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ose=/^[-+]?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)?)??$/,wse=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ise="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",SS,xse=/^(?:(?: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])$/,Nse=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ase=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Rse=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dse=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kq="((\\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])))",kse=new RegExp(`^${Kq}$`);function Qq(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Cse(e){return new RegExp(`^${Qq(e)}$`)}function Hq(e){let t=`${Kq}T${Qq(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Lse(e,t){return!!((t==="v4"||!t)&&xse.test(e)||(t==="v6"||!t)&&Ase.test(e))}function jse(e,t){if(!Sse.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function $se(e,t){return!!((t==="v4"||!t)&&Nse.test(e)||(t==="v6"||!t)&&Rse.test(e))}var yo=class e extends ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==M.string){let o=this._getOrReturnCtx(t);return $(o,{code:P.invalid_type,expected:M.string,received:o.parsedType}),ie}let n=new Kt,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:P.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:P.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?$(i,{code:P.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&$(i,{code:P.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")wse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"email",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")SS||(SS=new RegExp(Ise,"u")),SS.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"emoji",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")bse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"uuid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Tse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"nanoid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")_se.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")vse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid2",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Ese.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ulid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),$(i,{validation:"url",code:P.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"regex",code:P.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Hq(o).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?kse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Cse(o).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Ose.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"duration",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Lse(t.data,o.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ip",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?jse(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"jwt",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?$se(t.data,o.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cidr",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Pse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Dse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64url",code:P.invalid_string,message:o.message}),n.dirty()):be.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:P.invalid_string,...Q.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Q.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Q.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Q.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Q.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Q.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Q.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Q.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Q.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Q.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Q.errToObj(r)})}nonempty(t){return this.min(1,Q.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};yo.create=e=>new yo({checks:[],typeName:D.ZodString,coerce:e?.coerce??!1,...fe(e)});function Mse(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var Es=class e extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==M.number){let o=this._getOrReturnCtx(t);return $(o,{code:P.invalid_type,expected:M.number,received:o.parsedType}),ie}let n,i=new Kt;for(let o of this._def.checks)o.kind==="int"?be.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),$(n,{code:P.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Mse(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),$(n,{code:P.not_finite,message:o.message}),i.dirty()):be.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Q.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&be.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Es.create=e=>new Es({checks:[],typeName:D.ZodNumber,coerce:e?.coerce||!1,...fe(e)});var bs=class e extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==M.bigint)return this._getInvalidInput(t);let n,i=new Kt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):be.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return $(r,{code:P.invalid_type,expected:M.bigint,received:r.parsedType}),ie}gte(t,r){return this.setLimit("min",t,!0,Q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Q.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};bs.create=e=>new bs({checks:[],typeName:D.ZodBigInt,coerce:e?.coerce??!1,...fe(e)});var Ts=class extends ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==M.boolean){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.boolean,received:n.parsedType}),ie}return sr(t.data)}};Ts.create=e=>new Ts({typeName:D.ZodBoolean,coerce:e?.coerce||!1,...fe(e)});var Ss=class e extends ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==M.date){let o=this._getOrReturnCtx(t);return $(o,{code:P.invalid_type,expected:M.date,received:o.parsedType}),ie}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return $(o,{code:P.invalid_date}),ie}let n=new Kt,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:P.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:P.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):be.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Q.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Q.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Ss.create=e=>new Ss({checks:[],coerce:e?.coerce||!1,typeName:D.ZodDate,...fe(e)});var yc=class extends ge{_parse(t){if(this._getType(t)!==M.symbol){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.symbol,received:n.parsedType}),ie}return sr(t.data)}};yc.create=e=>new yc({typeName:D.ZodSymbol,...fe(e)});var Os=class extends ge{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.undefined,received:n.parsedType}),ie}return sr(t.data)}};Os.create=e=>new Os({typeName:D.ZodUndefined,...fe(e)});var ws=class extends ge{_parse(t){if(this._getType(t)!==M.null){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.null,received:n.parsedType}),ie}return sr(t.data)}};ws.create=e=>new ws({typeName:D.ZodNull,...fe(e)});var _o=class extends ge{constructor(){super(...arguments),this._any=!0}_parse(t){return sr(t.data)}};_o.create=e=>new _o({typeName:D.ZodAny,...fe(e)});var Ci=class extends ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return sr(t.data)}};Ci.create=e=>new Ci({typeName:D.ZodUnknown,...fe(e)});var Rn=class extends ge{_parse(t){let r=this._getOrReturnCtx(t);return $(r,{code:P.invalid_type,expected:M.never,received:r.parsedType}),ie}};Rn.create=e=>new Rn({typeName:D.ZodNever,...fe(e)});var _c=class extends ge{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.void,received:n.parsedType}),ie}return sr(t.data)}};_c.create=e=>new _c({typeName:D.ZodVoid,...fe(e)});var Li=class e extends ge{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==M.array)return $(r,{code:P.invalid_type,expected:M.array,received:r.parsedType}),ie;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&($(r,{code:s?P.too_big:P.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&($(r,{code:P.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&($(r,{code:P.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new un(r,s,r.path,a)))).then(s=>Kt.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new un(r,s,r.path,a)));return Kt.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Q.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Q.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Q.toString(r)}})}nonempty(t){return this.min(1,t)}};Li.create=(e,t)=>new Li({type:e,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...fe(t)});function gc(e){if(e instanceof Rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ar.create(gc(n))}return new Rr({...e._def,shape:()=>t})}else return e instanceof Li?new Li({...e._def,type:gc(e.element)}):e instanceof Ar?Ar.create(gc(e.unwrap())):e instanceof ii?ii.create(gc(e.unwrap())):e instanceof ni?ni.create(e.items.map(t=>gc(t))):e}var Rr=class e extends ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=be.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==M.object){let u=this._getOrReturnCtx(t);return $(u,{code:P.invalid_type,expected:M.object,received:u.parsedType}),ie}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Rn&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new un(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Rn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&($(i,{code:P.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new un(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Kt.mergeObjectSync(n,u)):Kt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:D.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of be.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of be.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return gc(this)}partial(t){let r={};for(let n of be.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of be.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Ar;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return Wq(be.objectKeys(this.shape))}};Rr.create=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strip",catchall:Rn.create(),typeName:D.ZodObject,...fe(t)});Rr.strictCreate=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strict",catchall:Rn.create(),typeName:D.ZodObject,...fe(t)});Rr.lazycreate=(e,t)=>new Rr({shape:e,unknownKeys:"strip",catchall:Rn.create(),typeName:D.ZodObject,...fe(t)});var Is=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Nr(a.ctx.common.issues));return $(r,{code:P.invalid_union,unionErrors:s}),ie}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new Nr(c));return $(r,{code:P.invalid_union,unionErrors:a}),ie}}get options(){return this._def.options}};Is.create=(e,t)=>new Is({options:e,typeName:D.ZodUnion,...fe(t)});var ki=e=>e instanceof Ns?ki(e.schema):e instanceof ln?ki(e.innerType()):e instanceof As?[e.value]:e instanceof Rs?e.options:e instanceof Ps?be.objectValues(e.enum):e instanceof Ds?ki(e._def.innerType):e instanceof Os?[void 0]:e instanceof ws?[null]:e instanceof Ar?[void 0,...ki(e.unwrap())]:e instanceof ii?[null,...ki(e.unwrap())]:e instanceof jl||e instanceof Cs?ki(e.unwrap()):e instanceof ks?ki(e._def.innerType):[],Wh=class e extends ge{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.object)return $(r,{code:P.invalid_type,expected:M.object,received:r.parsedType}),ie;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):($(r,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=ki(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:D.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...fe(n)})}};function OS(e,t){let r=ri(e),n=ri(t);if(e===t)return{valid:!0,data:e};if(r===M.object&&n===M.object){let i=be.objectKeys(t),o=be.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=OS(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===M.array&&n===M.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=OS(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===M.date&&n===M.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var xs=class extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(Qh(o)||Qh(s))return ie;let a=OS(o.value,s.value);return a.valid?((Hh(o)||Hh(s))&&r.dirty(),{status:r.value,value:a.data}):($(n,{code:P.invalid_intersection_types}),ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};xs.create=(e,t,r)=>new xs({left:e,right:t,typeName:D.ZodIntersection,...fe(r)});var ni=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.array)return $(n,{code:P.invalid_type,expected:M.array,received:n.parsedType}),ie;if(n.data.length<this._def.items.length)return $(n,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&n.data.length>this._def.items.length&&($(n,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new un(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Kt.mergeArray(r,s)):Kt.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ni.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ni({items:e,typeName:D.ZodTuple,rest:null,...fe(t)})};var Jh=class e extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.object)return $(n,{code:P.invalid_type,expected:M.object,received:n.parsedType}),ie;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new un(n,a,n.path,a)),value:s._parse(new un(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Kt.mergeObjectAsync(r,i):Kt.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ge?new e({keyType:t,valueType:r,typeName:D.ZodRecord,...fe(n)}):new e({keyType:yo.create(),valueType:t,typeName:D.ZodRecord,...fe(r)})}},vc=class extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.map)return $(n,{code:P.invalid_type,expected:M.map,received:n.parsedType}),ie;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new un(n,a,n.path,[u,"key"])),value:o._parse(new un(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return ie;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return ie;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};vc.create=(e,t,r)=>new vc({valueType:t,keyType:e,typeName:D.ZodMap,...fe(r)});var Ec=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.set)return $(n,{code:P.invalid_type,expected:M.set,received:n.parsedType}),ie;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&($(n,{code:P.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&($(n,{code:P.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return ie;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new un(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:Q.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Q.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ec.create=(e,t)=>new Ec({valueType:e,minSize:null,maxSize:null,typeName:D.ZodSet,...fe(t)});var Yh=class e extends ge{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.function)return $(r,{code:P.invalid_type,expected:M.function,received:r.parsedType}),ie;function n(a,c){return Ll({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hc(),Di].filter(u=>!!u),issueData:{code:P.invalid_arguments,argumentsError:c}})}function i(a,c){return Ll({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hc(),Di].filter(u=>!!u),issueData:{code:P.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof vo){let a=this;return sr(async function(...c){let u=new Nr([]),l=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{let a=this;return sr(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Nr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new Nr([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ni.create(t).rest(Ci.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||ni.create([]).rest(Ci.create()),returns:r||Ci.create(),typeName:D.ZodFunction,...fe(n)})}},Ns=class extends ge{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ns.create=(e,t)=>new Ns({getter:e,typeName:D.ZodLazy,...fe(t)});var As=class extends ge{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return $(r,{received:r.data,code:P.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:t.data}}get value(){return this._def.value}};As.create=(e,t)=>new As({value:e,typeName:D.ZodLiteral,...fe(t)});function Wq(e,t){return new Rs({values:e,typeName:D.ZodEnum,...fe(t)})}var Rs=class e extends ge{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return $(r,{expected:be.joinValues(n),received:r.parsedType,code:P.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return $(r,{received:r.data,code:P.invalid_enum_value,options:n}),ie}return sr(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Rs.create=Wq;var Ps=class extends ge{_parse(t){let r=be.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==M.string&&n.parsedType!==M.number){let i=be.objectValues(r);return $(n,{expected:be.joinValues(i),received:n.parsedType,code:P.invalid_type}),ie}if(this._cache||(this._cache=new Set(be.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=be.objectValues(r);return $(n,{received:n.data,code:P.invalid_enum_value,options:i}),ie}return sr(t.data)}get enum(){return this._def.values}};Ps.create=(e,t)=>new Ps({values:e,typeName:D.ZodNativeEnum,...fe(t)});var vo=class extends ge{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.promise&&r.common.async===!1)return $(r,{code:P.invalid_type,expected:M.promise,received:r.parsedType}),ie;let n=r.parsedType===M.promise?r.data:Promise.resolve(r.data);return sr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};vo.create=(e,t)=>new vo({type:e,typeName:D.ZodPromise,...fe(t)});var ln=class extends ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{$(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ie;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ie:c.status==="dirty"?vs(c.value):r.value==="dirty"?vs(c.value):c});{if(r.value==="aborted")return ie;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ie:a.status==="dirty"?vs(a.value):r.value==="dirty"?vs(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ie:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ie:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!go(s))return ie;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>go(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ie);be.assertNever(i)}};ln.create=(e,t,r)=>new ln({schema:e,typeName:D.ZodEffects,effect:t,...fe(r)});ln.createWithPreprocess=(e,t,r)=>new ln({schema:t,effect:{type:"preprocess",transform:e},typeName:D.ZodEffects,...fe(r)});var Ar=class extends ge{_parse(t){return this._getType(t)===M.undefined?sr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:D.ZodOptional,...fe(t)});var ii=class extends ge{_parse(t){return this._getType(t)===M.null?sr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ii.create=(e,t)=>new ii({innerType:e,typeName:D.ZodNullable,...fe(t)});var Ds=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ds.create=(e,t)=>new Ds({innerType:e,typeName:D.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});var ks=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return mc(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Nr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Nr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ks.create=(e,t)=>new ks({innerType:e,typeName:D.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});var bc=class extends ge{_parse(t){if(this._getType(t)!==M.nan){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.nan,received:n.parsedType}),ie}return{status:"valid",value:t.data}}};bc.create=e=>new bc({typeName:D.ZodNaN,...fe(e)});var qse=Symbol("zod_brand"),jl=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},$l=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ie:o.status==="dirty"?(r.dirty(),vs(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ie:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:D.ZodPipeline})}},Cs=class extends ge{_parse(t){let r=this._def.innerType._parse(t),n=i=>(go(i)&&(i.value=Object.freeze(i.value)),i);return mc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Cs.create=(e,t)=>new Cs({innerType:e,typeName:D.ZodReadonly,...fe(t)});function Zq(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Jq(e,t={},r){return e?_o.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=Zq(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=Zq(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):_o.create()}var Fse={object:Rr.lazycreate},D;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(D||(D={}));var zse=(e,t={message:`Input not instance of ${e.name}`})=>Jq(r=>r instanceof e,t),Yq=yo.create,Xq=Es.create,Use=bc.create,Vse=bs.create,e1=Ts.create,Gse=Ss.create,Bse=yc.create,Zse=Os.create,Kse=ws.create,Qse=_o.create,Hse=Ci.create,Wse=Rn.create,Jse=_c.create,Yse=Li.create,wS=Rr.create,Xse=Rr.strictCreate,eae=Is.create,tae=Wh.create,rae=xs.create,nae=ni.create,iae=Jh.create,oae=vc.create,sae=Ec.create,aae=Yh.create,cae=Ns.create,uae=As.create,lae=Rs.create,pae=Ps.create,dae=vo.create,fae=ln.create,hae=Ar.create,mae=ii.create,gae=ln.createWithPreprocess,yae=$l.create,_ae=()=>Yq().optional(),vae=()=>Xq().optional(),Eae=()=>e1().optional(),bae={string:(e=>yo.create({...e,coerce:!0})),number:(e=>Es.create({...e,coerce:!0})),boolean:(e=>Ts.create({...e,coerce:!0})),bigint:(e=>bs.create({...e,coerce:!0})),date:(e=>Ss.create({...e,coerce:!0}))};var Tae=ie;var IS=[{name:"schema_actionflow",description:`Action flows \u2014 flow-level (addressed by actionFlowId). Discover types via op=SELECTABLE_TYPES and ids via op=GET_DETAIL. AI nodes require isAsync=true.
962
+ `;p();import{randomUUID as ise}from"crypto";var xq=Pt(bM(),1);p();var Joe=Pt(gq(),1),Yoe=Pt(Lh(),1),Xoe=Pt(cc(),1),ese=Pt(nS(),1),tse=Pt(sS(),1),rse=Pt(dS(),1),wq=Pt(qh(),1),nse=Pt(Oq(),1);var Iq=wq.default;var Nq=ise(),ose=e=>{if(!e)return e;if(Array.isArray(e))return e.map(([r,n])=>[r,String(r).toLowerCase()==="authorization"?"Bearer <redacted>":n]);if(typeof e=="object"&&"forEach"in e&&typeof e.forEach=="function"){let r={};return e.forEach((n,i)=>{r[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(n)}),r}let t={};for(let[r,n]of Object.entries(e))t[r]=r.toLowerCase()==="authorization"?"Bearer <redacted>":String(n);return t},sse=e=>{if(typeof e=="string")return e;if(e instanceof Uint8Array)return Buffer.from(e).toString("utf8");try{return String(e)}catch{return"<unserializable body>"}},Cl=async(e,t)=>{let r=Rd();B.debug(`[HTTP] Request URL: ${e.toString()}`),t?.headers&&B.debug(`[HTTP] Request Headers: ${JSON.stringify(ose(t.headers))}`),r&&t?.body!=null&&B.debug(`[GQL] Request Body: ${sse(t.body)}`);let n=await fetch(e,t);if(r)try{let i=await n.clone().text();B.debug(`[GQL] Response ${n.status}: ${i}`)}catch(i){B.debug(`[GQL] Response read failed: ${String(i)}`)}return n};async function hS(e,t){let r=await e.getValidToken(),n=await xn(t),i={Authorization:`Bearer ${r}`,"User-Locale":"en_US","X-SESSION-ID":Nq};return process.env.REACT_APP_VERSION&&(i["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new er(`${n.apiBaseUrl}/api/graphql`,{headers:i,fetch:Cl})}async function Aq(e,t){let r=await e.getValidToken(),i=`${(await xn(t)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(o,s,a)=>{let c=Rd(),u={authToken:r,"X-SESSION-ID":Nq};B.debug(`[SUB] connecting ${i} params=${JSON.stringify({...u,authToken:"Bearer <redacted>"})}`);let l=new xq.SubscriptionClient(i,{lazy:!0,reconnect:!0,minTimeout:3e3,connectionParams:u},Iq);l.onConnected(()=>B.debug("[SUB] connected")),l.onReconnected(()=>B.debug("[SUB] reconnected")),l.onDisconnected(()=>B.debug("[SUB] disconnected")),l.onError(h=>B.debug(`[SUB] error ${h?.message??String(h)}`));let f=[{name:"onNewCrdtPatchV2",query:Qj,variables:{projectExId:o.projectExId,appExId:o.appExId??null,versionExId:o.appVersionExId??null,latestPatchExIdInClient:s}},{name:"onSchemaUploadV3",query:Hj,variables:{projectExId:o.projectExId,appExId:o.appExId??null,appVersionExId:o.appVersionExId??null}}].map(h=>(B.debug(`[SUB] subscribe ${h.name} vars=${JSON.stringify(h.variables)}`),l.request({query:h.query,variables:h.variables}).subscribe({next:m=>{c&&B.debug(`[SUB] ${h.name} event: ${JSON.stringify(m)}`),a()},error:m=>{B.warn("Schema subscription event failed",String(m)),a()}})));return{unsubscribe(){for(let h of f)h.unsubscribe();l.close(!1,!1)}}}}async function zh(e,t){if(t.projectExId)return await e.saveProjectContext(t.projectExId),t.projectExId;let r=await e.loadProjectContext();if(!r?.projectExId)throw new Error("No projectExId provided and no current project is set");return r.projectExId}p();p();var Rq=100*1024*1024,Uh=class{current=Promise.resolve();async run(t){let r=this.current,n=()=>{};this.current=new Promise(i=>{n=i}),await r;try{return await t()}finally{n()}}},Cq=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`Failed to download CRDT model: ${t.status} ${t.statusText}`);let r=t.body?.getReader();if(!r)throw new Error("Failed to read CRDT model response body");let n=[],i=0;for(;;){let{done:a,value:c}=await r.read();if(a)break;if(i+=c.length,i>Rq)throw new Error(`CRDT model is larger than ${Rq} bytes`);n.push(c)}let o=new Uint8Array(i),s=0;for(let a of n)o.set(a,s),s+=a.length;return o},Vh=async(e,t)=>{try{return await t()}catch(r){return B.warn(`Optional runtime package unavailable: ${e}`,r.message),null}},Pq=null,Pi=async()=>(Pq??=Vh("@functorz/ztype",()=>import("./ztype-DGJLZP7C.js")).then(e=>(e?.default??e)?.com?.functorz?.ztype??null),Pq),Dq=null,mS=async()=>(Dq??=Vh("@functorz/crdt-helper",()=>import("./index.cjs-AXWBHEMF.js")).then(e=>e?.Crdt??e?.default?.Crdt??null),Dq),kq=null,Lq=async()=>(kq??=Vh("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-TVUPWIPX.js")).then(e=>e??Vh("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-WCWG3GEG.js"))).then(e=>e?.Patch??e?.default?.Patch??null),kq),gS=e=>e?.lastUploadedSchema??null,yS=e=>[e?.project?.lastDeployedServerSchemaExId,e?.lastDeployedServerSchemaExId,e?.project?.latestDeployedServerSchema?.exId,e?.latestDeployedServerSchema?.exId].find(r=>typeof r=="string"&&r.length>0)??null,_S=e=>e==null?e:structuredClone(e),jq=(e,t)=>e?.appExId?e.appExId:t?.name??"",$q=(e,t)=>{let r=e?.typesystem?.schema?.ClientType;if(r)return t==="WECHAT_MINI_PROGRAM"?r.WECHAT_MINI_PROGRAM??r.WECHAT??r.WEB:t==="MOBILE"?r.MOBILE??r.WEB:r.WEB},Mq=e=>{let t=e?.typesystem?.schema?.Product?.[qo];if(!t)throw new Error(`ztype runtime has no Product enum member for ${qo}`);return t},ase=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return String(e)}},Gh=e=>({componentId:e?.componentId??null,message:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("EN"):e?.message??String(e),zhMessage:typeof e?.getLocalizedErrorMessage=="function"?e.getLocalizedErrorMessage("ZH"):void 0,platform:e?.platform??null,isBackendError:!!e?.isBackendError,fullPath:ase(e?.fullPath??[])}),Bh=e=>e.stableErrors.concat(e.betaErrors).filter(t=>!!t.isBackendError),qq=e=>Bh(e).length,Fq=(e,t)=>{if(t.__typename==="DiffItem"){let r=t.pathComponents?.at(-1)?.key??"";if(t.operation==="delete"){delete e[r];return}e[r]=structuredClone(t.newValue);return}if(t.__typename==="ArrayDiffItem"){let r=t.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(e)||r<0)throw new Error("Invalid array diff target");if(t.operation==="delete"){e.splice(r,1);return}if(t.operation==="insert"){e.splice(r,0,structuredClone(t.newValue));return}e[r]=structuredClone(t.newValue)}};p();p();import{createHash as cse}from"crypto";var use=e=>!!(e&&typeof e=="object"&&!Array.isArray(e)),vS=e=>{if(Array.isArray(e))return e.map(r=>r===void 0?null:vS(r));if(!use(e))return e;let t={};for(let r of Object.keys(e).sort()){let n=e[r];n!==void 0&&(t[r]=vS(n))}return t},lse=e=>JSON.stringify(vS(e)),pse=e=>cse("sha256").update(lse(e)).digest("hex"),zq=e=>({projectExId:e.projectExId,appExId:e.appExId??null,appVersionExId:e.appVersionExId??null,schemaExId:e.schemaExId??null,lastPatchExId:e.lastPatchExId??null,snapshotHash:pse(e.snapshot),deployedSchemaExId:e.deployedSchemaExId??null,checkedAt:e.checkedAt??new Date().toISOString()}),Uq=(e,t)=>!e||!t?e!==t:e.schemaExId!==t.schemaExId||e.lastPatchExId!==t.lastPatchExId||e.snapshotHash!==t.snapshotHash||e.deployedSchemaExId!==t.deployedSchemaExId,ES=e=>e.changes.length>0;var Vq=null,dse=()=>(Vq??=Pi().then(e=>{let t=e?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof t=="function"?t:null}),Vq),bS=async(e,t)=>{let r=await dse();return r?r(e,t):{changes:[]}};p();var _s=class extends Error{constructor(r,n){super(r);this.diagnostics=n;this.name="ZtypeValidationError"}};p();function Zh(e,t,r){let n=$q(e,r?.appType);return e.api.ZTypeCoreApi.genZTypeApiContext(t,Mq(e),n,jq(r,n),e?.utils?.Locale?.EN,null)}p();var fse=3e4,Kh=class{constructor(t){this.options=t}timer=null;subscriptionHandle=null;running=!1;isActive(){return this.timer!==null||this.subscriptionHandle!==null}start(){this.timer||this.subscriptionHandle||!this.options.subscriptionFactory||this.options.subscriptionFactory(this.options.sessionKey,this.options.getLastPatchExId(),()=>{this.run()}).then(t=>{this.subscriptionHandle=t}).catch(t=>{B.warn("Schema subscription failed; falling back to polling",t.message)}).finally(()=>{this.schedulePoll()})}dispose(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.subscriptionHandle?.unsubscribe(),this.subscriptionHandle=null}schedulePoll(){!this.options.subscriptionFactory||this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.run().finally(()=>this.schedulePoll())},fse),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};p();p();var b={};py(b,{BRAND:()=>qse,DIRTY:()=>vs,EMPTY_PATH:()=>yse,INVALID:()=>ie,NEVER:()=>Tae,OK:()=>sr,ParseStatus:()=>Kt,Schema:()=>ge,ZodAny:()=>_o,ZodArray:()=>Li,ZodBigInt:()=>bs,ZodBoolean:()=>Ts,ZodBranded:()=>jl,ZodCatch:()=>ks,ZodDate:()=>Ss,ZodDefault:()=>Ds,ZodDiscriminatedUnion:()=>Wh,ZodEffects:()=>ln,ZodEnum:()=>Rs,ZodError:()=>Nr,ZodFirstPartyTypeKind:()=>D,ZodFunction:()=>Yh,ZodIntersection:()=>xs,ZodIssueCode:()=>P,ZodLazy:()=>Ns,ZodLiteral:()=>As,ZodMap:()=>vc,ZodNaN:()=>bc,ZodNativeEnum:()=>Ps,ZodNever:()=>Rn,ZodNull:()=>ws,ZodNullable:()=>ii,ZodNumber:()=>Es,ZodObject:()=>Rr,ZodOptional:()=>Ar,ZodParsedType:()=>M,ZodPipeline:()=>$l,ZodPromise:()=>vo,ZodReadonly:()=>Cs,ZodRecord:()=>Jh,ZodSchema:()=>ge,ZodSet:()=>Ec,ZodString:()=>yo,ZodSymbol:()=>yc,ZodTransformer:()=>ln,ZodTuple:()=>ni,ZodType:()=>ge,ZodUndefined:()=>Os,ZodUnion:()=>Is,ZodUnknown:()=>Ci,ZodVoid:()=>_c,addIssueToContext:()=>$,any:()=>Qse,array:()=>Yse,bigint:()=>Vse,boolean:()=>e1,coerce:()=>bae,custom:()=>Jq,date:()=>Gse,datetimeRegex:()=>Hq,defaultErrorMap:()=>Di,discriminatedUnion:()=>tae,effect:()=>fae,enum:()=>lae,function:()=>aae,getErrorMap:()=>hc,getParsedType:()=>ri,instanceof:()=>zse,intersection:()=>rae,isAborted:()=>Qh,isAsync:()=>mc,isDirty:()=>Hh,isValid:()=>go,late:()=>Fse,lazy:()=>cae,literal:()=>uae,makeIssue:()=>Ll,map:()=>oae,nan:()=>Use,nativeEnum:()=>pae,never:()=>Wse,null:()=>Kse,nullable:()=>mae,number:()=>Xq,object:()=>wS,objectUtil:()=>TS,oboolean:()=>Eae,onumber:()=>vae,optional:()=>hae,ostring:()=>_ae,pipeline:()=>yae,preprocess:()=>gae,promise:()=>dae,quotelessJson:()=>hse,record:()=>iae,set:()=>sae,setErrorMap:()=>gse,strictObject:()=>Xse,string:()=>Yq,symbol:()=>Bse,transformer:()=>fae,tuple:()=>nae,undefined:()=>Zse,union:()=>eae,unknown:()=>Hse,util:()=>be,void:()=>Jse});p();p();p();p();p();var be;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(be||(be={}));var TS;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(TS||(TS={}));var M=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ri=e=>{switch(typeof e){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(e)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(e)?M.array:e===null?M.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?M.promise:typeof Map<"u"&&e instanceof Map?M.map:typeof Set<"u"&&e instanceof Set?M.set:typeof Date<"u"&&e instanceof Date?M.date:M.object;default:return M.unknown}};var P=be.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),hse=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Nr=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Nr.create=e=>new Nr(e);var mse=(e,t)=>{let r;switch(e.code){case P.invalid_type:e.received===M.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case P.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,be.jsonStringifyReplacer)}`;break;case P.unrecognized_keys:r=`Unrecognized key(s) in object: ${be.joinValues(e.keys,", ")}`;break;case P.invalid_union:r="Invalid input";break;case P.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${be.joinValues(e.options)}`;break;case P.invalid_enum_value:r=`Invalid enum value. Expected ${be.joinValues(e.options)}, received '${e.received}'`;break;case P.invalid_arguments:r="Invalid function arguments";break;case P.invalid_return_type:r="Invalid function return type";break;case P.invalid_date:r="Invalid date";break;case P.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:be.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case P.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case P.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case P.custom:r="Invalid input";break;case P.invalid_intersection_types:r="Intersection results could not be merged";break;case P.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case P.not_finite:r="Number must be finite";break;default:r=t.defaultError,be.assertNever(e)}return{message:r}},Di=mse;var Gq=Di;function gse(e){Gq=e}function hc(){return Gq}p();var Ll=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},yse=[];function $(e,t){let r=hc(),n=Ll({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Di?void 0:Di].filter(i=>!!i)});e.common.issues.push(n)}var Kt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return ie;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ie;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},ie=Object.freeze({status:"aborted"}),vs=e=>({status:"dirty",value:e}),sr=e=>({status:"valid",value:e}),Qh=e=>e.status==="aborted",Hh=e=>e.status==="dirty",go=e=>e.status==="valid",mc=e=>typeof Promise<"u"&&e instanceof Promise;p();p();var Q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Q||(Q={}));var un=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Bq=(e,t)=>{if(go(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Nr(e.common.issues);return this._error=r,this._error}}};function fe(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}var ge=class{get description(){return this._def.description}_getType(t){return ri(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:ri(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Kt,ctx:{common:t.parent.common,data:t.data,parsedType:ri(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(mc(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ri(t)},i=this._parseSync({data:t,path:n.path,parent:n});return Bq(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ri(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return go(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>go(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ri(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(mc(i)?i:Promise.resolve(i));return Bq(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:P.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new ln({schema:this,typeName:D.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ar.create(this,this._def)}nullable(){return ii.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Li.create(this)}promise(){return vo.create(this,this._def)}or(t){return Is.create([this,t],this._def)}and(t){return xs.create(this,t,this._def)}transform(t){return new ln({...fe(this._def),schema:this,typeName:D.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Ds({...fe(this._def),innerType:this,defaultValue:r,typeName:D.ZodDefault})}brand(){return new jl({typeName:D.ZodBranded,type:this,...fe(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ks({...fe(this._def),innerType:this,catchValue:r,typeName:D.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return $l.create(this,t)}readonly(){return Cs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},_se=/^c[^\s-]{8,}$/i,vse=/^[0-9a-z]+$/,Ese=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bse=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Tse=/^[a-z0-9_-]{21}$/i,Sse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ose=/^[-+]?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)?)??$/,wse=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ise="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",SS,xse=/^(?:(?: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])$/,Nse=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ase=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Rse=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dse=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kq="((\\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])))",kse=new RegExp(`^${Kq}$`);function Qq(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Cse(e){return new RegExp(`^${Qq(e)}$`)}function Hq(e){let t=`${Kq}T${Qq(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Lse(e,t){return!!((t==="v4"||!t)&&xse.test(e)||(t==="v6"||!t)&&Ase.test(e))}function jse(e,t){if(!Sse.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function $se(e,t){return!!((t==="v4"||!t)&&Nse.test(e)||(t==="v6"||!t)&&Rse.test(e))}var yo=class e extends ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==M.string){let o=this._getOrReturnCtx(t);return $(o,{code:P.invalid_type,expected:M.string,received:o.parsedType}),ie}let n=new Kt,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:P.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:P.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?$(i,{code:P.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&$(i,{code:P.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")wse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"email",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")SS||(SS=new RegExp(Ise,"u")),SS.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"emoji",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")bse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"uuid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Tse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"nanoid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")_se.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")vse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cuid2",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")Ese.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ulid",code:P.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),$(i,{validation:"url",code:P.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"regex",code:P.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Hq(o).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?kse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Cse(o).test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{code:P.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Ose.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"duration",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Lse(t.data,o.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"ip",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?jse(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"jwt",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?$se(t.data,o.version)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"cidr",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Pse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64",code:P.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Dse.test(t.data)||(i=this._getOrReturnCtx(t,i),$(i,{validation:"base64url",code:P.invalid_string,message:o.message}),n.dirty()):be.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:P.invalid_string,...Q.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Q.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Q.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Q.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Q.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Q.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Q.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Q.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Q.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Q.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Q.errToObj(r)})}nonempty(t){return this.min(1,Q.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};yo.create=e=>new yo({checks:[],typeName:D.ZodString,coerce:e?.coerce??!1,...fe(e)});function Mse(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}var Es=class e extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==M.number){let o=this._getOrReturnCtx(t);return $(o,{code:P.invalid_type,expected:M.number,received:o.parsedType}),ie}let n,i=new Kt;for(let o of this._def.checks)o.kind==="int"?be.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),$(n,{code:P.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Mse(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),$(n,{code:P.not_finite,message:o.message}),i.dirty()):be.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Q.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&be.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Es.create=e=>new Es({checks:[],typeName:D.ZodNumber,coerce:e?.coerce||!1,...fe(e)});var bs=class e extends ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==M.bigint)return this._getInvalidInput(t);let n,i=new Kt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),$(n,{code:P.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):be.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return $(r,{code:P.invalid_type,expected:M.bigint,received:r.parsedType}),ie}gte(t,r){return this.setLimit("min",t,!0,Q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Q.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};bs.create=e=>new bs({checks:[],typeName:D.ZodBigInt,coerce:e?.coerce??!1,...fe(e)});var Ts=class extends ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==M.boolean){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.boolean,received:n.parsedType}),ie}return sr(t.data)}};Ts.create=e=>new Ts({typeName:D.ZodBoolean,coerce:e?.coerce||!1,...fe(e)});var Ss=class e extends ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==M.date){let o=this._getOrReturnCtx(t);return $(o,{code:P.invalid_type,expected:M.date,received:o.parsedType}),ie}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return $(o,{code:P.invalid_date}),ie}let n=new Kt,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:P.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),$(i,{code:P.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):be.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Q.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Q.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Ss.create=e=>new Ss({checks:[],coerce:e?.coerce||!1,typeName:D.ZodDate,...fe(e)});var yc=class extends ge{_parse(t){if(this._getType(t)!==M.symbol){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.symbol,received:n.parsedType}),ie}return sr(t.data)}};yc.create=e=>new yc({typeName:D.ZodSymbol,...fe(e)});var Os=class extends ge{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.undefined,received:n.parsedType}),ie}return sr(t.data)}};Os.create=e=>new Os({typeName:D.ZodUndefined,...fe(e)});var ws=class extends ge{_parse(t){if(this._getType(t)!==M.null){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.null,received:n.parsedType}),ie}return sr(t.data)}};ws.create=e=>new ws({typeName:D.ZodNull,...fe(e)});var _o=class extends ge{constructor(){super(...arguments),this._any=!0}_parse(t){return sr(t.data)}};_o.create=e=>new _o({typeName:D.ZodAny,...fe(e)});var Ci=class extends ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return sr(t.data)}};Ci.create=e=>new Ci({typeName:D.ZodUnknown,...fe(e)});var Rn=class extends ge{_parse(t){let r=this._getOrReturnCtx(t);return $(r,{code:P.invalid_type,expected:M.never,received:r.parsedType}),ie}};Rn.create=e=>new Rn({typeName:D.ZodNever,...fe(e)});var _c=class extends ge{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.void,received:n.parsedType}),ie}return sr(t.data)}};_c.create=e=>new _c({typeName:D.ZodVoid,...fe(e)});var Li=class e extends ge{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==M.array)return $(r,{code:P.invalid_type,expected:M.array,received:r.parsedType}),ie;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&($(r,{code:s?P.too_big:P.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&($(r,{code:P.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&($(r,{code:P.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new un(r,s,r.path,a)))).then(s=>Kt.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new un(r,s,r.path,a)));return Kt.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:Q.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:Q.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:Q.toString(r)}})}nonempty(t){return this.min(1,t)}};Li.create=(e,t)=>new Li({type:e,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...fe(t)});function gc(e){if(e instanceof Rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Ar.create(gc(n))}return new Rr({...e._def,shape:()=>t})}else return e instanceof Li?new Li({...e._def,type:gc(e.element)}):e instanceof Ar?Ar.create(gc(e.unwrap())):e instanceof ii?ii.create(gc(e.unwrap())):e instanceof ni?ni.create(e.items.map(t=>gc(t))):e}var Rr=class e extends ge{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=be.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==M.object){let u=this._getOrReturnCtx(t);return $(u,{code:P.invalid_type,expected:M.object,received:u.parsedType}),ie}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Rn&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new un(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Rn){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&($(i,{code:P.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new un(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Kt.mergeObjectSync(n,u)):Kt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:D.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of be.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of be.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return gc(this)}partial(t){let r={};for(let n of be.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of be.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Ar;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return Wq(be.objectKeys(this.shape))}};Rr.create=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strip",catchall:Rn.create(),typeName:D.ZodObject,...fe(t)});Rr.strictCreate=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strict",catchall:Rn.create(),typeName:D.ZodObject,...fe(t)});Rr.lazycreate=(e,t)=>new Rr({shape:e,unknownKeys:"strip",catchall:Rn.create(),typeName:D.ZodObject,...fe(t)});var Is=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Nr(a.ctx.common.issues));return $(r,{code:P.invalid_union,unionErrors:s}),ie}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new Nr(c));return $(r,{code:P.invalid_union,unionErrors:a}),ie}}get options(){return this._def.options}};Is.create=(e,t)=>new Is({options:e,typeName:D.ZodUnion,...fe(t)});var ki=e=>e instanceof Ns?ki(e.schema):e instanceof ln?ki(e.innerType()):e instanceof As?[e.value]:e instanceof Rs?e.options:e instanceof Ps?be.objectValues(e.enum):e instanceof Ds?ki(e._def.innerType):e instanceof Os?[void 0]:e instanceof ws?[null]:e instanceof Ar?[void 0,...ki(e.unwrap())]:e instanceof ii?[null,...ki(e.unwrap())]:e instanceof jl||e instanceof Cs?ki(e.unwrap()):e instanceof ks?ki(e._def.innerType):[],Wh=class e extends ge{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.object)return $(r,{code:P.invalid_type,expected:M.object,received:r.parsedType}),ie;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):($(r,{code:P.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=ki(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:D.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...fe(n)})}};function OS(e,t){let r=ri(e),n=ri(t);if(e===t)return{valid:!0,data:e};if(r===M.object&&n===M.object){let i=be.objectKeys(t),o=be.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=OS(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===M.array&&n===M.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=OS(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===M.date&&n===M.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var xs=class extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(Qh(o)||Qh(s))return ie;let a=OS(o.value,s.value);return a.valid?((Hh(o)||Hh(s))&&r.dirty(),{status:r.value,value:a.data}):($(n,{code:P.invalid_intersection_types}),ie)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};xs.create=(e,t,r)=>new xs({left:e,right:t,typeName:D.ZodIntersection,...fe(r)});var ni=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.array)return $(n,{code:P.invalid_type,expected:M.array,received:n.parsedType}),ie;if(n.data.length<this._def.items.length)return $(n,{code:P.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&n.data.length>this._def.items.length&&($(n,{code:P.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new un(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Kt.mergeArray(r,s)):Kt.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ni.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ni({items:e,typeName:D.ZodTuple,rest:null,...fe(t)})};var Jh=class e extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.object)return $(n,{code:P.invalid_type,expected:M.object,received:n.parsedType}),ie;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new un(n,a,n.path,a)),value:s._parse(new un(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Kt.mergeObjectAsync(r,i):Kt.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ge?new e({keyType:t,valueType:r,typeName:D.ZodRecord,...fe(n)}):new e({keyType:yo.create(),valueType:t,typeName:D.ZodRecord,...fe(r)})}},vc=class extends ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.map)return $(n,{code:P.invalid_type,expected:M.map,received:n.parsedType}),ie;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new un(n,a,n.path,[u,"key"])),value:o._parse(new un(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return ie;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return ie;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};vc.create=(e,t,r)=>new vc({valueType:t,keyType:e,typeName:D.ZodMap,...fe(r)});var Ec=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.set)return $(n,{code:P.invalid_type,expected:M.set,received:n.parsedType}),ie;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&($(n,{code:P.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&($(n,{code:P.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return ie;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new un(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:Q.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:Q.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ec.create=(e,t)=>new Ec({valueType:e,minSize:null,maxSize:null,typeName:D.ZodSet,...fe(t)});var Yh=class e extends ge{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.function)return $(r,{code:P.invalid_type,expected:M.function,received:r.parsedType}),ie;function n(a,c){return Ll({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hc(),Di].filter(u=>!!u),issueData:{code:P.invalid_arguments,argumentsError:c}})}function i(a,c){return Ll({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,hc(),Di].filter(u=>!!u),issueData:{code:P.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof vo){let a=this;return sr(async function(...c){let u=new Nr([]),l=await a._def.args.parseAsync(c,o).catch(h=>{throw u.addIssue(n(c,h)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{let a=this;return sr(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Nr([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new Nr([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ni.create(t).rest(Ci.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||ni.create([]).rest(Ci.create()),returns:r||Ci.create(),typeName:D.ZodFunction,...fe(n)})}},Ns=class extends ge{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ns.create=(e,t)=>new Ns({getter:e,typeName:D.ZodLazy,...fe(t)});var As=class extends ge{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return $(r,{received:r.data,code:P.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:t.data}}get value(){return this._def.value}};As.create=(e,t)=>new As({value:e,typeName:D.ZodLiteral,...fe(t)});function Wq(e,t){return new Rs({values:e,typeName:D.ZodEnum,...fe(t)})}var Rs=class e extends ge{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return $(r,{expected:be.joinValues(n),received:r.parsedType,code:P.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return $(r,{received:r.data,code:P.invalid_enum_value,options:n}),ie}return sr(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Rs.create=Wq;var Ps=class extends ge{_parse(t){let r=be.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==M.string&&n.parsedType!==M.number){let i=be.objectValues(r);return $(n,{expected:be.joinValues(i),received:n.parsedType,code:P.invalid_type}),ie}if(this._cache||(this._cache=new Set(be.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=be.objectValues(r);return $(n,{received:n.data,code:P.invalid_enum_value,options:i}),ie}return sr(t.data)}get enum(){return this._def.values}};Ps.create=(e,t)=>new Ps({values:e,typeName:D.ZodNativeEnum,...fe(t)});var vo=class extends ge{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.promise&&r.common.async===!1)return $(r,{code:P.invalid_type,expected:M.promise,received:r.parsedType}),ie;let n=r.parsedType===M.promise?r.data:Promise.resolve(r.data);return sr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};vo.create=(e,t)=>new vo({type:e,typeName:D.ZodPromise,...fe(t)});var ln=class extends ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{$(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ie;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?ie:c.status==="dirty"?vs(c.value):r.value==="dirty"?vs(c.value):c});{if(r.value==="aborted")return ie;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ie:a.status==="dirty"?vs(a.value):r.value==="dirty"?vs(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ie:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ie:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!go(s))return ie;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>go(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ie);be.assertNever(i)}};ln.create=(e,t,r)=>new ln({schema:e,typeName:D.ZodEffects,effect:t,...fe(r)});ln.createWithPreprocess=(e,t,r)=>new ln({schema:t,effect:{type:"preprocess",transform:e},typeName:D.ZodEffects,...fe(r)});var Ar=class extends ge{_parse(t){return this._getType(t)===M.undefined?sr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:D.ZodOptional,...fe(t)});var ii=class extends ge{_parse(t){return this._getType(t)===M.null?sr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ii.create=(e,t)=>new ii({innerType:e,typeName:D.ZodNullable,...fe(t)});var Ds=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ds.create=(e,t)=>new Ds({innerType:e,typeName:D.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});var ks=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return mc(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Nr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Nr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ks.create=(e,t)=>new ks({innerType:e,typeName:D.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});var bc=class extends ge{_parse(t){if(this._getType(t)!==M.nan){let n=this._getOrReturnCtx(t);return $(n,{code:P.invalid_type,expected:M.nan,received:n.parsedType}),ie}return{status:"valid",value:t.data}}};bc.create=e=>new bc({typeName:D.ZodNaN,...fe(e)});var qse=Symbol("zod_brand"),jl=class extends ge{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},$l=class e extends ge{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ie:o.status==="dirty"?(r.dirty(),vs(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ie:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:D.ZodPipeline})}},Cs=class extends ge{_parse(t){let r=this._def.innerType._parse(t),n=i=>(go(i)&&(i.value=Object.freeze(i.value)),i);return mc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Cs.create=(e,t)=>new Cs({innerType:e,typeName:D.ZodReadonly,...fe(t)});function Zq(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Jq(e,t={},r){return e?_o.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=Zq(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=Zq(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):_o.create()}var Fse={object:Rr.lazycreate},D;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(D||(D={}));var zse=(e,t={message:`Input not instance of ${e.name}`})=>Jq(r=>r instanceof e,t),Yq=yo.create,Xq=Es.create,Use=bc.create,Vse=bs.create,e1=Ts.create,Gse=Ss.create,Bse=yc.create,Zse=Os.create,Kse=ws.create,Qse=_o.create,Hse=Ci.create,Wse=Rn.create,Jse=_c.create,Yse=Li.create,wS=Rr.create,Xse=Rr.strictCreate,eae=Is.create,tae=Wh.create,rae=xs.create,nae=ni.create,iae=Jh.create,oae=vc.create,sae=Ec.create,aae=Yh.create,cae=Ns.create,uae=As.create,lae=Rs.create,pae=Ps.create,dae=vo.create,fae=ln.create,hae=Ar.create,mae=ii.create,gae=ln.createWithPreprocess,yae=$l.create,_ae=()=>Yq().optional(),vae=()=>Xq().optional(),Eae=()=>e1().optional(),bae={string:(e=>yo.create({...e,coerce:!0})),number:(e=>Es.create({...e,coerce:!0})),boolean:(e=>Ts.create({...e,coerce:!0})),bigint:(e=>bs.create({...e,coerce:!0})),date:(e=>Ss.create({...e,coerce:!0}))};var Tae=ie;var IS=[{name:"schema_actionflow",description:`Action flows \u2014 flow-level (addressed by actionFlowId). Discover types via op=SELECTABLE_TYPES and ids via op=GET_DETAIL. AI nodes require isAsync=true.
963
963
  Set apply=true to upload the CRDT patch. Ops:
964
964
  - op=ADD \u2192 ADD_ACTION_FLOWS (req: items)
965
965
  - op=ADD_GLOBAL_VARS \u2192 ADD_ACTION_FLOW_GLOBAL_VARIABLES (req: actionFlowId, items)
@@ -1123,7 +1123,7 @@ ${ql(o)}
1123
1123
  }
1124
1124
  }
1125
1125
  `;return t.ok(Gr(await n.dataClient.request(s,{where:e.where??{}}),r))},v1={"support.graphql":bce,"support.query":Tce,"support.insert":Sce,"support.update":Oce,"support.delete":wce};p();var Ice=["GATEWAY","ACTION_FLOW","ACTION_FLOW_NODE","ACTION_FLOW_CONTEXT_LOG","DEPLOYMENT","TPA","TRIGGER","SQL_GENERATION","GQL","ZAI"],xce=["INFO","WARNING","ERROR"],Nce=50,Ace=100,E1=5,b1=e=>`${e.toISOString().slice(0,19)}Z`,Rce=e=>{if(!e)return new Date;let t=new Date(e);return Number.isNaN(t.getTime())?new Date:t},T1=(e,t)=>{if(!e)return;let r=e.map(n=>n.toUpperCase()).filter(n=>t.includes(n));return r.length>0?r:void 0},Pce=async(e,t)=>{let r=await t.getProjectArgs(e),i=(await Fl(t.client,r)).dataVisualizer.token;if(!i)throw new Error(`Log admin token is missing for project ${r.projectExId}`);let o=Rce(Re(e.requestCreatedAt)),s={start:b1(new Date(o.getTime()-E1*6e4)),end:b1(new Date(o.getTime()+E1*6e4)),desc:!0},a=T1(Ls(e.types),Ice);a&&(s.type=a);let c=T1(Ls(e.levels),xce);c&&(s.level=c);let u=Re(e.customQueryCondition);u&&(s.customQueryCondition=u);let l=Math.min(Ace,pn(e.limit,Nce)),d=Ir().logApiUrlTemplate.replace("{projectExId}",r.projectExId),m=((await new er(d,{headers:{authorization:`Bearer ${i}`},fetch:Cl}).request(n$,{queryCreation:s,paginator:{first:l}}))?.fetchLogsByPaginator?.edges??[]).map(y=>y?.node).filter(y=>!!y);return t.ok({entries:m})},S1={"logs.search":Pce};p();p();p();p();import{readFileSync as Fce}from"node:fs";import{dirname as zce,join as Uce}from"node:path";import{fileURLToPath as Vce}from"node:url";p();var jt,zl=null;function im(){return(zl===null||zl.byteLength===0)&&(zl=new Uint8Array(jt.memory.buffer)),zl}var om=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&om.decode();var Dce=2146435072,LS=0;function kce(e,t){return LS+=t,LS>=Dce&&(om=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},om.decode(),LS=t),om.decode(im().subarray(e,e+t))}function jS(e,t){return e=e>>>0,kce(e,t)}function $S(e){let t=typeof e;if(t=="number"||t=="boolean"||e==null)return`${e}`;if(t=="string")return`"${e}"`;if(t=="symbol"){let i=e.description;return i==null?"Symbol":`Symbol(${i})`}if(t=="function"){let i=e.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(e)){let i=e.length,o="[";i>0&&(o+=$S(e[0]));for(let s=1;s<i;s++)o+=", "+$S(e[s]);return o+="]",o}let r=/\[object ([^\]]+)\]/.exec(toString.call(e)),n;if(r&&r.length>1)n=r[1];else return toString.call(e);if(n=="Object")try{return"Object("+JSON.stringify(e)+")"}catch{return"Object"}return e instanceof Error?`${e.name}: ${e.message}
1126
- ${e.stack}`:n}var am=0,sm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Cce=typeof sm.encodeInto=="function"?function(e,t){return sm.encodeInto(e,t)}:function(e,t){let r=sm.encode(e);return t.set(r),{read:e.length,written:r.length}};function O1(e,t,r){if(r===void 0){let a=sm.encode(e),c=t(a.length,1)>>>0;return im().subarray(c,c+a.length).set(a),am=a.length,c}let n=e.length,i=t(n,1)>>>0,o=im(),s=0;for(;s<n;s++){let a=e.charCodeAt(s);if(a>127)break;o[i+s]=a}if(s!==n){s!==0&&(e=e.slice(s)),i=r(i,n,n=s+e.length*3,1)>>>0;let a=im().subarray(i+s,i+n),c=Cce(e,a);s+=c.written,i=r(i,n,s,1)>>>0}return am=s,i}var $s=null;function MS(){return($s===null||$s.buffer.detached===!0||$s.buffer.detached===void 0&&$s.buffer!==jt.memory.buffer)&&($s=new DataView(jt.memory.buffer)),$s}function Lce(e){return e==null}function jce(e,t){e=e>>>0;let r=MS(),n=[];for(let i=e;i<e+4*t;i+=4)n.push(jt.__wbindgen_export_2.get(r.getUint32(i,!0)));return jt.__externref_drop_slice(e,t),n}function w1(e,t){let r=O1(e,jt.__wbindgen_malloc,jt.__wbindgen_realloc),n=am,i=jt.cut(r,n,Lce(t)?16777215:t?1:0);var o=jce(i[0],i[1]).slice();return jt.__wbindgen_free(i[0],i[1]*4,4),o}var $ce=new Set(["basic","cors","default"]);async function Mce(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.ok&&$ce.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function I1(){let e={};return e.wbg={},e.wbg.__wbg_Error_0497d5bdba9362e5=function(t,r){return Error(jS(t,r))},e.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,r,n){t[r]=n},e.wbg.__wbindgen_bigint_from_u64=function(t){return BigInt.asUintN(64,t)},e.wbg.__wbindgen_debug_string=function(t,r){let n=$S(r),i=O1(n,jt.__wbindgen_malloc,jt.__wbindgen_realloc),o=am;MS().setInt32(t+4,o,!0),MS().setInt32(t+0,i,!0)},e.wbg.__wbindgen_init_externref_table=function(){let t=jt.__wbindgen_export_2,r=t.grow(4);t.set(0,void 0),t.set(r+0,void 0),t.set(r+1,null),t.set(r+2,!0),t.set(r+3,!1)},e.wbg.__wbindgen_number_new=function(t){return t},e.wbg.__wbindgen_string_new=function(t,r){return jS(t,r)},e.wbg.__wbindgen_throw=function(t,r){throw new Error(jS(t,r))},e}function x1(e,t){return jt=e.exports,qce.__wbindgen_wasm_module=t,$s=null,zl=null,jt.__wbindgen_start(),jt}function N1(e){if(jt!==void 0)return jt;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=I1();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let r=new WebAssembly.Instance(e,t);return x1(r,e)}async function qce(e){if(jt!==void 0)return jt;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("jieba_rs_wasm_bg.wasm",import.meta.url));let t=I1();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:n}=await Mce(await e,t);return x1(r,n)}var A1=!1,R1=(e,t)=>{if(!A1){let r=Uce(zce(Vce(import.meta.url)),"jieba-engine.wasm");N1({module:Fce(r)}),A1=!0}return w1(e,t)};var Gce=new Set(["a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]),Bce=/[a-z0-9]+/g,Zce=e=>{let t=e.toLowerCase().replace(/'s\b/g,""),r=[];for(let n of t.matchAll(Bce)){let i=n[0];Gce.has(i)||r.push(Hce(i))}return r},Kce=/[㐀-鿿豈-﫿぀-ヿ가-힯]|[a-z0-9]/i,Qce=e=>R1(e.toLowerCase(),!0).filter(t=>Kce.test(t)),um=e=>qo==="ZION"?Qce(e):Zce(e),Ms=(e,t)=>{let r=e[t];return r==="a"||r==="e"||r==="i"||r==="o"||r==="u"?!1:r==="y"?t===0?!0:!Ms(e,t-1):!0},Eo=e=>{let t=0,r=!1;for(let n=0;n<e.length;n+=1){let i=!Ms(e,n);r&&!i&&(t+=1),r=i}return t},qS=e=>{for(let t=0;t<e.length;t+=1)if(!Ms(e,t))return!0;return!1},P1=e=>{let t=e.length;return t>=2&&e[t-1]===e[t-2]&&Ms(e,t-1)},D1=e=>{let t=e.length;if(t<3||!Ms(e,t-1)||Ms(e,t-2)||!Ms(e,t-3))return!1;let r=e[t-1];return r!=="w"&&r!=="x"&&r!=="y"},cm=(e,t,r)=>e.slice(0,e.length-t.length)+r;function Hce(e){let t=e;if(t.length<=2)return t;t.endsWith("sses")?t=cm(t,"sses","ss"):t.endsWith("ies")?t=cm(t,"ies","i"):t.endsWith("ss")||t.endsWith("s")&&(t=t.slice(0,-1));let r=!1;t.endsWith("eed")?Eo(t.slice(0,-3))>0&&(t=t.slice(0,-1)):t.endsWith("ed")&&qS(t.slice(0,-2))?(t=t.slice(0,-2),r=!0):t.endsWith("ing")&&qS(t.slice(0,-3))&&(t=t.slice(0,-3),r=!0),r&&(t.endsWith("at")||t.endsWith("bl")||t.endsWith("iz")?t+="e":P1(t)&&!/[lsz]$/.test(t)?t=t.slice(0,-1):Eo(t)===1&&D1(t)&&(t+="e")),t.endsWith("y")&&qS(t.slice(0,-1))&&(t=`${t.slice(0,-1)}i`);let n=[["ational","ate"],["tional","tion"],["enci","ence"],["anci","ance"],["izer","ize"],["bli","ble"],["alli","al"],["entli","ent"],["eli","e"],["ousli","ous"],["ization","ize"],["ation","ate"],["ator","ate"],["alism","al"],["iveness","ive"],["fulness","ful"],["ousness","ous"],["aliti","al"],["iviti","ive"],["biliti","ble"],["logi","log"]];for(let[a,c]of n)if(t.endsWith(a)){Eo(t.slice(0,t.length-a.length))>0&&(t=cm(t,a,c));break}let i=[["icate","ic"],["ative",""],["alize","al"],["iciti","ic"],["ical","ic"],["ful",""],["ness",""]];for(let[a,c]of i)if(t.endsWith(a)){Eo(t.slice(0,t.length-a.length))>0&&(t=cm(t,a,c));break}let o=["al","ance","ence","er","ic","able","ible","ant","ement","ment","ent","ou","ism","ate","iti","ous","ive","ize"],s=!1;for(let a of o)if(t.endsWith(a)){let c=t.slice(0,t.length-a.length);Eo(c)>1&&(t=c),s=!0;break}if(!s&&t.endsWith("ion")){let a=t.slice(0,-3);Eo(a)>1&&/[st]$/.test(a)&&(t=a)}if(t.endsWith("e")){let a=t.slice(0,-1),c=Eo(a);(c>1||c===1&&!D1(a))&&(t=a)}return Eo(t)>1&&P1(t)&&t.endsWith("l")&&(t=t.slice(0,-1)),t}var Wce=async()=>(await import("./corpus-3S6VQ7EG.js")).DOCS_CORPUS,k1=1.5,C1=.75,Jce=3,L1=null,Yce=e=>{let t=[],r=new Map,n=new Map,i=0;for(let o of e){n.set(o.path,o);let s=um(o.content),a=um(o.title);for(let u=0;u<Jce;u+=1)s.push(...a);let c=new Map;for(let u of s)c.set(u,(c.get(u)??0)+1);for(let u of c.keys())r.set(u,(r.get(u)??0)+1);t.push({page:o,tf:c,length:s.length}),i+=s.length}return{docs:t,df:r,avgdl:t.length>0?i/t.length:0,byPath:n}},j1=async()=>(L1??=Yce(await Wce()),L1),$1=async(e,t=10)=>{let r=await j1(),n=[...new Set(um(e))];if(n.length===0||r.docs.length===0)return[];let i=r.docs.length;return r.docs.map(s=>{let a=0;for(let c of n){let u=s.tf.get(c);if(!u)continue;let l=r.df.get(c)??0,d=Math.log(1+(i-l+.5)/(l+.5)),f=u+k1*(1-C1+C1*s.length/(r.avgdl||1));a+=d*(u*(k1+1)/f)}return{page:s.page,score:a}}).filter(s=>s.score>0).sort((s,a)=>a.score-s.score).slice(0,Math.max(1,t)).map(s=>({path:s.page.path,title:s.page.title,url:s.page.url}))},M1=async e=>{let t=e.replace(/\.mdx$/,""),r=t.startsWith("/")?t:`/${t}`;return(await j1()).byPath.get(r)??null};var Xce=async(e,t)=>{let r=Re(e.query);if(!r)throw new Error("query is required");let n=pn(e.limit,10);return t.ok({results:await $1(r,n)})},eue=async(e,t)=>{let r=Re(e.path);if(!r)throw new Error("path is required");let n=await M1(r);if(!n)throw new Error(`No doc page found for path: ${r}`);return t.ok(n)},q1={"docs.search":Xce,"docs.get_page":eue};p();var tue=async(e,t)=>{let r=Re(e.query);if(!r)throw new Error("query is required");let n=e.variables&&typeof e.variables=="object"?e.variables:{};return t.ok(await t.client.request(r,n))},F1={"zb.graphql":tue};p();var z1={...l1,...d1,...g1,..._1,...v1,...S1,...q1,...F1};var rue=new Set(["docs.search","docs.get_page"]),nue=e=>new Proxy({},{get(){throw new Error(`${e} is a local-only command and has no authenticated client`)}});function iue(e){if(!(e instanceof Error))return String(e);let t=e.response?.errors;if(Array.isArray(t)){let r=t.map(n=>n?.message).filter(n=>typeof n=="string");if(r.length>0)return r.join("; ")}return e.message||String(e)}function lm(e,t={}){let r=new fi(e),n=new Ja(r),i=new Xh(()=>hS(n,r),t.watchSchemaChanges?async(...c)=>(await Aq(n,r))(...c):void 0),o=(c,u)=>({ok:!0,data:c,message:u}),s=c=>({ok:!1,error:iue(c),data:c instanceof _s?{ztypeDiagnostics:c.diagnostics}:void 0});return{execute:async(c,u)=>{let l=n1(c.args);try{let d=z1[c.name];if(!d)throw new Error(`Unknown command: ${c.name}`);let f=rue.has(c.name)?nue(c.name):await hS(n,r),h=null,m=async E=>(h??=await s1(r,E),h);return await d(l,{credentialStore:r,tokenManager:n,schemaManager:i,client:f,signal:u,getProjectArgs:m,checkSchema:async E=>{let T=await m(E);return i.checkRemoteAndSync(em(T.projectExId,T))},ok:o,fail:s})}catch(d){return s(d)}},schemaManager:i,setWorkspaceRoot(c){r.setWorkspaceRoot(c),i.clear()},stop(){i.clear()}}}p();var V1=Pt(fu(),1);import{createRequire as oue}from"module";import{fileURLToPath as sue}from"url";import U1 from"path";var G1=oue(import.meta.url),$i=typeof g>"u"?void 0:g,aue=()=>{if($i)return{version:$i.agent};try{let e=U1.resolve(U1.dirname(sue(import.meta.url)),"../../package.json");return G1(e)}catch{return{}}},pm=e=>{if($i){if(e==="@functorz/ztype")return $i.ztype;if(e==="@functorz/crdt-helper")return $i.crdtHelper;if(e==="json-joy")return $i.jsonJoy}try{return G1(`${e}/package.json`).version??"unknown"}catch{return"unavailable"}},cue=async()=>{if($i)return{ztypeVersion:$i.ztype,ztypeSchemaVersion:$i.ztypeSchemaVersion};try{let e=await Pi();return{ztypeVersion:e?.ZTypeSystem?.getZTypeVersion?.()??pm("@functorz/ztype"),ztypeSchemaVersion:e?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:pm("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function FS(){let e=aue(),t=await cue();return{agentVersion:e.version??"0.0.0",nodeMajor:process.versions.node.split(".")[0],platform:process.platform,arch:process.arch,ztypeVersion:t.ztypeVersion,ztypeSchemaVersion:t.ztypeSchemaVersion,crdtHelperVersion:pm("@functorz/crdt-helper"),jsonJoyVersion:pm("json-joy")}}async function Sc(e,t){let[r,n,i]=await Promise.all([FS(),xn(e),e.loadCredentials()]),o=i?V1.default.decode(i.access_token):null,s=typeof o=="object"&&o!==null?String(o.sub??o.exId??o.id??"authenticated"):"anonymous";return{...r,product:Xt,apiBaseUrl:n.apiBaseUrl,authUserId:s,workspaceRoot:e.getWorkspaceRoot(),startupFlags:[...t].sort()}}function B1(e,t){return JSON.stringify(e)===JSON.stringify(t)}p();import dm from"net";var uue=600*1e3;async function Pr(e,t,r){let{socketPath:n,token:i}=e,o=`${Date.now()}-${Math.random().toString(16).slice(2)}`,s={id:o,token:i,command:t};return new Promise((a,c)=>{let u=n.startsWith("tcp://")?dm.createConnection(K1(n)):dm.createConnection(n),l="",d=setTimeout(()=>{u.destroy(),c(new Error(`Timed out waiting for daemon response to ${t.name}`))},uue),f=()=>{r&&r.removeEventListener("abort",h)},h=()=>{clearTimeout(d),u.destroy(),c(new Error(`Request aborted: ${t.name}`))};if(r){if(r.aborted){h();return}r.addEventListener("abort",h)}u.on("connect",()=>{u.write(`${JSON.stringify(s)}
1126
+ ${e.stack}`:n}var am=0,sm=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Cce=typeof sm.encodeInto=="function"?function(e,t){return sm.encodeInto(e,t)}:function(e,t){let r=sm.encode(e);return t.set(r),{read:e.length,written:r.length}};function O1(e,t,r){if(r===void 0){let a=sm.encode(e),c=t(a.length,1)>>>0;return im().subarray(c,c+a.length).set(a),am=a.length,c}let n=e.length,i=t(n,1)>>>0,o=im(),s=0;for(;s<n;s++){let a=e.charCodeAt(s);if(a>127)break;o[i+s]=a}if(s!==n){s!==0&&(e=e.slice(s)),i=r(i,n,n=s+e.length*3,1)>>>0;let a=im().subarray(i+s,i+n),c=Cce(e,a);s+=c.written,i=r(i,n,s,1)>>>0}return am=s,i}var $s=null;function MS(){return($s===null||$s.buffer.detached===!0||$s.buffer.detached===void 0&&$s.buffer!==jt.memory.buffer)&&($s=new DataView(jt.memory.buffer)),$s}function Lce(e){return e==null}function jce(e,t){e=e>>>0;let r=MS(),n=[];for(let i=e;i<e+4*t;i+=4)n.push(jt.__wbindgen_export_2.get(r.getUint32(i,!0)));return jt.__externref_drop_slice(e,t),n}function w1(e,t){let r=O1(e,jt.__wbindgen_malloc,jt.__wbindgen_realloc),n=am,i=jt.cut(r,n,Lce(t)?16777215:t?1:0);var o=jce(i[0],i[1]).slice();return jt.__wbindgen_free(i[0],i[1]*4,4),o}var $ce=new Set(["basic","cors","default"]);async function Mce(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(n){if(e.ok&&$ce.has(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}function I1(){let e={};return e.wbg={},e.wbg.__wbg_Error_0497d5bdba9362e5=function(t,r){return Error(jS(t,r))},e.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},e.wbg.__wbg_set_3f1d0b984ed272ed=function(t,r,n){t[r]=n},e.wbg.__wbindgen_bigint_from_u64=function(t){return BigInt.asUintN(64,t)},e.wbg.__wbindgen_debug_string=function(t,r){let n=$S(r),i=O1(n,jt.__wbindgen_malloc,jt.__wbindgen_realloc),o=am;MS().setInt32(t+4,o,!0),MS().setInt32(t+0,i,!0)},e.wbg.__wbindgen_init_externref_table=function(){let t=jt.__wbindgen_export_2,r=t.grow(4);t.set(0,void 0),t.set(r+0,void 0),t.set(r+1,null),t.set(r+2,!0),t.set(r+3,!1)},e.wbg.__wbindgen_number_new=function(t){return t},e.wbg.__wbindgen_string_new=function(t,r){return jS(t,r)},e.wbg.__wbindgen_throw=function(t,r){throw new Error(jS(t,r))},e}function x1(e,t){return jt=e.exports,qce.__wbindgen_wasm_module=t,$s=null,zl=null,jt.__wbindgen_start(),jt}function N1(e){if(jt!==void 0)return jt;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=I1();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let r=new WebAssembly.Instance(e,t);return x1(r,e)}async function qce(e){if(jt!==void 0)return jt;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("jieba_rs_wasm_bg.wasm",import.meta.url));let t=I1();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:n}=await Mce(await e,t);return x1(r,n)}var A1=!1,R1=(e,t)=>{if(!A1){let r=Uce(zce(Vce(import.meta.url)),"jieba-engine.wasm");N1({module:Fce(r)}),A1=!0}return w1(e,t)};var Gce=new Set(["a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]),Bce=/[a-z0-9]+/g,Zce=e=>{let t=e.toLowerCase().replace(/'s\b/g,""),r=[];for(let n of t.matchAll(Bce)){let i=n[0];Gce.has(i)||r.push(Hce(i))}return r},Kce=/[㐀-鿿豈-﫿぀-ヿ가-힯]|[a-z0-9]/i,Qce=e=>R1(e.toLowerCase(),!0).filter(t=>Kce.test(t)),um=e=>qo==="ZION"?Qce(e):Zce(e),Ms=(e,t)=>{let r=e[t];return r==="a"||r==="e"||r==="i"||r==="o"||r==="u"?!1:r==="y"?t===0?!0:!Ms(e,t-1):!0},Eo=e=>{let t=0,r=!1;for(let n=0;n<e.length;n+=1){let i=!Ms(e,n);r&&!i&&(t+=1),r=i}return t},qS=e=>{for(let t=0;t<e.length;t+=1)if(!Ms(e,t))return!0;return!1},P1=e=>{let t=e.length;return t>=2&&e[t-1]===e[t-2]&&Ms(e,t-1)},D1=e=>{let t=e.length;if(t<3||!Ms(e,t-1)||Ms(e,t-2)||!Ms(e,t-3))return!1;let r=e[t-1];return r!=="w"&&r!=="x"&&r!=="y"},cm=(e,t,r)=>e.slice(0,e.length-t.length)+r;function Hce(e){let t=e;if(t.length<=2)return t;t.endsWith("sses")?t=cm(t,"sses","ss"):t.endsWith("ies")?t=cm(t,"ies","i"):t.endsWith("ss")||t.endsWith("s")&&(t=t.slice(0,-1));let r=!1;t.endsWith("eed")?Eo(t.slice(0,-3))>0&&(t=t.slice(0,-1)):t.endsWith("ed")&&qS(t.slice(0,-2))?(t=t.slice(0,-2),r=!0):t.endsWith("ing")&&qS(t.slice(0,-3))&&(t=t.slice(0,-3),r=!0),r&&(t.endsWith("at")||t.endsWith("bl")||t.endsWith("iz")?t+="e":P1(t)&&!/[lsz]$/.test(t)?t=t.slice(0,-1):Eo(t)===1&&D1(t)&&(t+="e")),t.endsWith("y")&&qS(t.slice(0,-1))&&(t=`${t.slice(0,-1)}i`);let n=[["ational","ate"],["tional","tion"],["enci","ence"],["anci","ance"],["izer","ize"],["bli","ble"],["alli","al"],["entli","ent"],["eli","e"],["ousli","ous"],["ization","ize"],["ation","ate"],["ator","ate"],["alism","al"],["iveness","ive"],["fulness","ful"],["ousness","ous"],["aliti","al"],["iviti","ive"],["biliti","ble"],["logi","log"]];for(let[a,c]of n)if(t.endsWith(a)){Eo(t.slice(0,t.length-a.length))>0&&(t=cm(t,a,c));break}let i=[["icate","ic"],["ative",""],["alize","al"],["iciti","ic"],["ical","ic"],["ful",""],["ness",""]];for(let[a,c]of i)if(t.endsWith(a)){Eo(t.slice(0,t.length-a.length))>0&&(t=cm(t,a,c));break}let o=["al","ance","ence","er","ic","able","ible","ant","ement","ment","ent","ou","ism","ate","iti","ous","ive","ize"],s=!1;for(let a of o)if(t.endsWith(a)){let c=t.slice(0,t.length-a.length);Eo(c)>1&&(t=c),s=!0;break}if(!s&&t.endsWith("ion")){let a=t.slice(0,-3);Eo(a)>1&&/[st]$/.test(a)&&(t=a)}if(t.endsWith("e")){let a=t.slice(0,-1),c=Eo(a);(c>1||c===1&&!D1(a))&&(t=a)}return Eo(t)>1&&P1(t)&&t.endsWith("l")&&(t=t.slice(0,-1)),t}var Wce=async()=>(await import("./corpus-WZGTIFWH.js")).DOCS_CORPUS,k1=1.5,C1=.75,Jce=3,L1=null,Yce=e=>{let t=[],r=new Map,n=new Map,i=0;for(let o of e){n.set(o.path,o);let s=um(o.content),a=um(o.title);for(let u=0;u<Jce;u+=1)s.push(...a);let c=new Map;for(let u of s)c.set(u,(c.get(u)??0)+1);for(let u of c.keys())r.set(u,(r.get(u)??0)+1);t.push({page:o,tf:c,length:s.length}),i+=s.length}return{docs:t,df:r,avgdl:t.length>0?i/t.length:0,byPath:n}},j1=async()=>(L1??=Yce(await Wce()),L1),$1=async(e,t=10)=>{let r=await j1(),n=[...new Set(um(e))];if(n.length===0||r.docs.length===0)return[];let i=r.docs.length;return r.docs.map(s=>{let a=0;for(let c of n){let u=s.tf.get(c);if(!u)continue;let l=r.df.get(c)??0,d=Math.log(1+(i-l+.5)/(l+.5)),f=u+k1*(1-C1+C1*s.length/(r.avgdl||1));a+=d*(u*(k1+1)/f)}return{page:s.page,score:a}}).filter(s=>s.score>0).sort((s,a)=>a.score-s.score).slice(0,Math.max(1,t)).map(s=>({path:s.page.path,title:s.page.title,url:s.page.url}))},M1=async e=>{let t=e.replace(/\.mdx$/,""),r=t.startsWith("/")?t:`/${t}`;return(await j1()).byPath.get(r)??null};var Xce=async(e,t)=>{let r=Re(e.query);if(!r)throw new Error("query is required");let n=pn(e.limit,10);return t.ok({results:await $1(r,n)})},eue=async(e,t)=>{let r=Re(e.path);if(!r)throw new Error("path is required");let n=await M1(r);if(!n)throw new Error(`No doc page found for path: ${r}`);return t.ok(n)},q1={"docs.search":Xce,"docs.get_page":eue};p();var tue=async(e,t)=>{let r=Re(e.query);if(!r)throw new Error("query is required");let n=e.variables&&typeof e.variables=="object"?e.variables:{};return t.ok(await t.client.request(r,n))},F1={"zb.graphql":tue};p();var z1={...l1,...d1,...g1,..._1,...v1,...S1,...q1,...F1};var rue=new Set(["docs.search","docs.get_page"]),nue=e=>new Proxy({},{get(){throw new Error(`${e} is a local-only command and has no authenticated client`)}});function iue(e){if(!(e instanceof Error))return String(e);let t=e.response?.errors;if(Array.isArray(t)){let r=t.map(n=>n?.message).filter(n=>typeof n=="string");if(r.length>0)return r.join("; ")}return e.message||String(e)}function lm(e,t={}){let r=new fi(e),n=new Ja(r),i=new Xh(()=>hS(n,r),t.watchSchemaChanges?async(...c)=>(await Aq(n,r))(...c):void 0),o=(c,u)=>({ok:!0,data:c,message:u}),s=c=>({ok:!1,error:iue(c),data:c instanceof _s?{ztypeDiagnostics:c.diagnostics}:void 0});return{execute:async(c,u)=>{let l=n1(c.args);try{let d=z1[c.name];if(!d)throw new Error(`Unknown command: ${c.name}`);let f=rue.has(c.name)?nue(c.name):await hS(n,r),h=null,m=async E=>(h??=await s1(r,E),h);return await d(l,{credentialStore:r,tokenManager:n,schemaManager:i,client:f,signal:u,getProjectArgs:m,checkSchema:async E=>{let T=await m(E);return i.checkRemoteAndSync(em(T.projectExId,T))},ok:o,fail:s})}catch(d){return s(d)}},schemaManager:i,setWorkspaceRoot(c){r.setWorkspaceRoot(c),i.clear()},stop(){i.clear()}}}p();var V1=Pt(fu(),1);import{createRequire as oue}from"module";import{fileURLToPath as sue}from"url";import U1 from"path";var G1=oue(import.meta.url),$i=typeof g>"u"?void 0:g,aue=()=>{if($i)return{version:$i.agent};try{let e=U1.resolve(U1.dirname(sue(import.meta.url)),"../../package.json");return G1(e)}catch{return{}}},pm=e=>{if($i){if(e==="@functorz/ztype")return $i.ztype;if(e==="@functorz/crdt-helper")return $i.crdtHelper;if(e==="json-joy")return $i.jsonJoy}try{return G1(`${e}/package.json`).version??"unknown"}catch{return"unavailable"}},cue=async()=>{if($i)return{ztypeVersion:$i.ztype,ztypeSchemaVersion:$i.ztypeSchemaVersion};try{let e=await Pi();return{ztypeVersion:e?.ZTypeSystem?.getZTypeVersion?.()??pm("@functorz/ztype"),ztypeSchemaVersion:e?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:pm("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function FS(){let e=aue(),t=await cue();return{agentVersion:e.version??"0.0.0",nodeMajor:process.versions.node.split(".")[0],platform:process.platform,arch:process.arch,ztypeVersion:t.ztypeVersion,ztypeSchemaVersion:t.ztypeSchemaVersion,crdtHelperVersion:pm("@functorz/crdt-helper"),jsonJoyVersion:pm("json-joy")}}async function Sc(e,t){let[r,n,i]=await Promise.all([FS(),xn(e),e.loadCredentials()]),o=i?V1.default.decode(i.access_token):null,s=typeof o=="object"&&o!==null?String(o.sub??o.exId??o.id??"authenticated"):"anonymous";return{...r,product:Xt,apiBaseUrl:n.apiBaseUrl,authUserId:s,workspaceRoot:e.getWorkspaceRoot(),startupFlags:[...t].sort()}}function B1(e,t){return JSON.stringify(e)===JSON.stringify(t)}p();import dm from"net";var uue=600*1e3;async function Pr(e,t,r){let{socketPath:n,token:i}=e,o=`${Date.now()}-${Math.random().toString(16).slice(2)}`,s={id:o,token:i,command:t};return new Promise((a,c)=>{let u=n.startsWith("tcp://")?dm.createConnection(K1(n)):dm.createConnection(n),l="",d=setTimeout(()=>{u.destroy(),c(new Error(`Timed out waiting for daemon response to ${t.name}`))},uue),f=()=>{r&&r.removeEventListener("abort",h)},h=()=>{clearTimeout(d),u.destroy(),c(new Error(`Request aborted: ${t.name}`))};if(r){if(r.aborted){h();return}r.addEventListener("abort",h)}u.on("connect",()=>{u.write(`${JSON.stringify(s)}
1127
1127
  `)}),u.on("data",m=>{l+=m.toString("utf8");let y=l.indexOf(`
1128
1128
  `);if(y<0)return;let v=l.slice(0,y);clearTimeout(d),f(),u.end();try{let E=JSON.parse(v);if(E.id!==o){c(new Error("Daemon response id mismatch"));return}a(E.result)}catch(E){c(E)}}),u.on("error",m=>{clearTimeout(d),f(),c(m)})})}function Z1(e,t,r){let{socketPath:n,token:i}=e,o=null,s=!1,a=null,c=()=>{if(s)return;o=n.startsWith("tcp://")?dm.createConnection(K1(n)):dm.createConnection(n);let u=`sub-${Date.now()}-${Math.random().toString(16).slice(2)}`,l={id:u,token:i,command:{name:"schema.subscribe"}},d="";o.on("connect",()=>{o?.write(`${JSON.stringify(l)}
1129
1129
  `)}),o.on("data",f=>{for(d+=f.toString("utf8");;){let h=d.indexOf(`