@botpress/sdk 4.20.2 → 4.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -5
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +3 -3
- package/dist/message.d.ts +245 -29
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
var ta=Object.defineProperty;var Fv=Object.getOwnPropertyDescriptor;var Wv=Object.getOwnPropertyNames;var zv=Object.prototype.hasOwnProperty;var at=(t,e)=>()=>(t&&(e=t(t=0)),e);var hn=(t,e)=>{for(var n in e)ta(t,n,{get:e[n],enumerable:!0})},qv=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Wv(e))!zv.call(t,o)&&o!==n&&ta(t,o,{get:()=>e[o],enumerable:!(r=Fv(e,o))||r.enumerable});return t};var Gv=t=>qv(ta({},"__esModule",{value:!0}),t);var A=at(()=>{});var J={};hn(J,{_debugEnd:()=>Uu,_debugProcess:()=>Hu,_events:()=>ec,_eventsCount:()=>tc,_exiting:()=>vu,_fatalExceptions:()=>Ru,_getActiveHandles:()=>wu,_getActiveRequests:()=>bu,_kill:()=>Pu,_linkedBinding:()=>mu,_maxListeners:()=>Qu,_preload_modules:()=>Ju,_rawDebug:()=>gu,_startProfilerIdleNotifier:()=>$u,_stopProfilerIdleNotifier:()=>Zu,_tickCallback:()=>Du,abort:()=>Fu,addListener:()=>nc,allowedNodeEnvironmentFlags:()=>Au,arch:()=>eu,argv:()=>ru,argv0:()=>Vu,assert:()=>Cu,binding:()=>lu,browser:()=>pu,chdir:()=>fu,config:()=>Tu,cpuUsage:()=>pi,cwd:()=>cu,debugPort:()=>Gu,default:()=>fc,dlopen:()=>_u,domain:()=>hu,emit:()=>sc,emitWarning:()=>su,env:()=>nu,execArgv:()=>iu,execPath:()=>qu,exit:()=>ku,features:()=>Ou,hasUncaughtExceptionCaptureCallback:()=>Nu,hrtime:()=>di,kill:()=>Su,listeners:()=>cc,memoryUsage:()=>Eu,moduleLoadList:()=>yu,nextTick:()=>Yl,off:()=>ic,on:()=>Kt,once:()=>rc,openStdin:()=>Iu,pid:()=>Wu,platform:()=>tu,ppid:()=>zu,prependListener:()=>lc,prependOnceListener:()=>uc,reallyExit:()=>xu,release:()=>du,removeAllListeners:()=>ac,removeListener:()=>oc,resourceUsage:()=>Bu,setSourceMapsEnabled:()=>Yu,setUncaughtExceptionCaptureCallback:()=>Mu,stderr:()=>Ku,stdin:()=>Lu,stdout:()=>ju,title:()=>Ql,umask:()=>uu,uptime:()=>Xu,version:()=>ou,versions:()=>au});function ia(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function Vv(){!Wn||!vn||(Wn=!1,vn.length?jt=vn.concat(jt):fi=-1,jt.length&&Jl())}function Jl(){if(!Wn){var t=setTimeout(Vv,0);Wn=!0;for(var e=jt.length;e;){for(vn=jt,jt=[];++fi<e;)vn&&vn[fi].run();fi=-1,e=jt.length}vn=null,Wn=!1,clearTimeout(t)}}function Yl(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];jt.push(new Xl(t,e)),jt.length===1&&!Wn&&setTimeout(Jl,0)}function Xl(t,e){this.fun=t,this.array=e}function lt(){}function mu(t){ia("_linkedBinding")}function _u(t){ia("dlopen")}function bu(){return[]}function wu(){return[]}function Cu(t,e){if(!t)throw new Error(e||"assertion error")}function Nu(){return!1}function Xu(){return on.now()/1e3}function di(t){var e=Math.floor((Date.now()-on.now())*.001),n=on.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=ra)),[r,o]}function Kt(){return fc}function cc(t){return[]}var jt,Wn,vn,fi,Ql,eu,tu,nu,ru,iu,ou,au,su,lu,uu,cu,fu,du,pu,gu,yu,hu,vu,Tu,xu,Pu,pi,Bu,Eu,Su,ku,Iu,Au,Ou,Ru,Mu,Du,Hu,Uu,$u,Zu,ju,Ku,Lu,Fu,Wu,zu,qu,Gu,Vu,Ju,Yu,on,na,ra,Qu,ec,tc,nc,rc,ic,oc,ac,sc,lc,uc,fc,dc=at(()=>{A();O();C();jt=[],Wn=!1,fi=-1;Xl.prototype.run=function(){this.fun.apply(null,this.array)};Ql="browser",eu="x64",tu="browser",nu={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},ru=["/usr/bin/node"],iu=[],ou="v16.8.0",au={},su=function(t,e){console.warn((e?e+": ":"")+t)},lu=function(t){ia("binding")},uu=function(t){return 0},cu=function(){return"/"},fu=function(t){},du={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};pu=!0,gu=lt,yu=[];hu={},vu=!1,Tu={};xu=lt,Pu=lt,pi=function(){return{}},Bu=pi,Eu=pi,Su=lt,ku=lt,Iu=lt,Au={};Ou={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Ru=lt,Mu=lt;Du=lt,Hu=lt,Uu=lt,$u=lt,Zu=lt,ju=void 0,Ku=void 0,Lu=void 0,Fu=lt,Wu=2,zu=1,qu="/bin/usr/node",Gu=9229,Vu="node",Ju=[],Yu=lt,on={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};on.now===void 0&&(na=Date.now(),on.timing&&on.timing.navigationStart&&(na=on.timing.navigationStart),on.now=()=>Date.now()-na);ra=1e9;di.bigint=function(t){var e=di(t);return typeof BigInt>"u"?e[0]*ra+e[1]:BigInt(e[0]*ra)+BigInt(e[1])};Qu=10,ec={},tc=0;nc=Kt,rc=Kt,ic=Kt,oc=Kt,ac=Kt,sc=lt,lc=Kt,uc=Kt;fc={version:ou,versions:au,arch:eu,platform:tu,browser:pu,release:du,_rawDebug:gu,moduleLoadList:yu,binding:lu,_linkedBinding:mu,_events:ec,_eventsCount:tc,_maxListeners:Qu,on:Kt,addListener:nc,once:rc,off:ic,removeListener:oc,removeAllListeners:ac,emit:sc,prependListener:lc,prependOnceListener:uc,listeners:cc,domain:hu,_exiting:vu,config:Tu,dlopen:_u,uptime:Xu,_getActiveRequests:bu,_getActiveHandles:wu,reallyExit:xu,_kill:Pu,cpuUsage:pi,resourceUsage:Bu,memoryUsage:Eu,kill:Su,exit:ku,openStdin:Iu,allowedNodeEnvironmentFlags:Au,assert:Cu,features:Ou,_fatalExceptions:Ru,setUncaughtExceptionCaptureCallback:Mu,hasUncaughtExceptionCaptureCallback:Nu,emitWarning:su,nextTick:Yl,_tickCallback:Du,_debugProcess:Hu,_debugEnd:Uu,_startProfilerIdleNotifier:$u,_stopProfilerIdleNotifier:Zu,stdout:ju,stdin:Lu,stderr:Ku,abort:Fu,umask:uu,chdir:fu,cwd:cu,env:nu,title:Ql,argv:ru,execArgv:iu,pid:Wu,ppid:zu,execPath:qu,debugPort:Gu,hrtime:di,argv0:Vu,_preload_modules:Ju,setSourceMapsEnabled:Yu}});var C=at(()=>{dc()});function Jv(){if(pc)return Tr;pc=!0,Tr.byteLength=s,Tr.toByteArray=f,Tr.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=r.length;o<a;++o)t[o]=r[o],e[r.charCodeAt(o)]=o;e[45]=62,e[95]=63;function i(h){var v=h.length;if(v%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=v);var B=P===v?0:4-P%4;return[P,B]}function s(h){var v=i(h),P=v[0],B=v[1];return(P+B)*3/4-B}function l(h,v,P){return(v+P)*3/4-P}function f(h){var v,P=i(h),B=P[0],T=P[1],S=new n(l(h,B,T)),E=0,H=T>0?B-4:B,j;for(j=0;j<H;j+=4)v=e[h.charCodeAt(j)]<<18|e[h.charCodeAt(j+1)]<<12|e[h.charCodeAt(j+2)]<<6|e[h.charCodeAt(j+3)],S[E++]=v>>16&255,S[E++]=v>>8&255,S[E++]=v&255;return T===2&&(v=e[h.charCodeAt(j)]<<2|e[h.charCodeAt(j+1)]>>4,S[E++]=v&255),T===1&&(v=e[h.charCodeAt(j)]<<10|e[h.charCodeAt(j+1)]<<4|e[h.charCodeAt(j+2)]>>2,S[E++]=v>>8&255,S[E++]=v&255),S}function p(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,v,P){for(var B,T=[],S=v;S<P;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),T.push(p(B));return T.join("")}function g(h){for(var v,P=h.length,B=P%3,T=[],S=16383,E=0,H=P-B;E<H;E+=S)T.push(y(h,E,E+S>H?H:E+S));return B===1?(v=h[P-1],T.push(t[v>>2]+t[v<<4&63]+"==")):B===2&&(v=(h[P-2]<<8)+h[P-1],T.push(t[v>>10]+t[v>>4&63]+t[v<<2&63]+"=")),T.join("")}return Tr}function Yv(){if(gc)return gi;gc=!0;return gi.read=function(t,e,n,r,o){var a,i,s=o*8-r-1,l=(1<<s)-1,f=l>>1,p=-7,y=n?o-1:0,g=n?-1:1,h=t[e+y];for(y+=g,a=h&(1<<-p)-1,h>>=-p,p+=s;p>0;a=a*256+t[e+y],y+=g,p-=8);for(i=a&(1<<-p)-1,a>>=-p,p+=r;p>0;i=i*256+t[e+y],y+=g,p-=8);if(a===0)a=1-f;else{if(a===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),a=a-f}return(h?-1:1)*i*Math.pow(2,a-r)},gi.write=function(t,e,n,r,o,a){var i,s,l,f=a*8-o-1,p=(1<<f)-1,y=p>>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,v=r?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,i=p):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+y>=1?e+=g/l:e+=g*Math.pow(2,1-y),e*l>=2&&(i++,l/=2),i+y>=p?(s=0,i=p):i+y>=1?(s=(e*l-1)*Math.pow(2,o),i=i+y):(s=e*Math.pow(2,y-1)*Math.pow(2,o),i=0));o>=8;t[n+h]=s&255,h+=v,s/=256,o-=8);for(i=i<<o|s,f+=o;f>0;t[n+h]=i&255,h+=v,i/=256,f-=8);t[n+h-v]|=P*128},gi}function Dt(){if(yc)return Tn;yc=!0;let t=Jv(),e=Yv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Tn.Buffer=i,Tn.SlowBuffer=T,Tn.INSPECT_MAX_BYTES=50;let r=2147483647;Tn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=o(),!i.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{let m=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(m,u),m.foo()===42}catch{return!1}}Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}});function a(m){if(m>r)throw new RangeError('The value "'+m+'" is invalid for option "size"');let u=new Uint8Array(m);return Object.setPrototypeOf(u,i.prototype),u}function i(m,u,c){if(typeof m=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(m)}return s(m,u,c)}i.poolSize=8192;function s(m,u,c){if(typeof m=="string")return y(m,u);if(ArrayBuffer.isView(m))return h(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(xt(m,ArrayBuffer)||m&&xt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xt(m,SharedArrayBuffer)||m&&xt(m.buffer,SharedArrayBuffer)))return v(m,u,c);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let _=m.valueOf&&m.valueOf();if(_!=null&&_!==m)return i.from(_,u,c);let I=P(m);if(I)return I;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return i.from(m[Symbol.toPrimitive]("string"),u,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}i.from=function(m,u,c){return s(m,u,c)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function l(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function f(m,u,c){return l(m),m<=0?a(m):u!==void 0?typeof c=="string"?a(m).fill(u,c):a(m).fill(u):a(m)}i.alloc=function(m,u,c){return f(m,u,c)};function p(m){return l(m),a(m<0?0:B(m)|0)}i.allocUnsafe=function(m){return p(m)},i.allocUnsafeSlow=function(m){return p(m)};function y(m,u){if((typeof u!="string"||u==="")&&(u="utf8"),!i.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let c=S(m,u)|0,_=a(c),I=_.write(m,u);return I!==c&&(_=_.slice(0,I)),_}function g(m){let u=m.length<0?0:B(m.length)|0,c=a(u);for(let _=0;_<u;_+=1)c[_]=m[_]&255;return c}function h(m){if(xt(m,Uint8Array)){let u=new Uint8Array(m);return v(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function v(m,u,c){if(u<0||m.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');let _;return u===void 0&&c===void 0?_=new Uint8Array(m):c===void 0?_=new Uint8Array(m,u):_=new Uint8Array(m,u,c),Object.setPrototypeOf(_,i.prototype),_}function P(m){if(i.isBuffer(m)){let u=B(m.length)|0,c=a(u);return c.length===0||m.copy(c,0,0,u),c}if(m.length!==void 0)return typeof m.length!="number"||hr(m.length)?a(0):g(m);if(m.type==="Buffer"&&Array.isArray(m.data))return g(m.data)}function B(m){if(m>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return m|0}function T(m){return+m!=m&&(m=0),i.alloc(+m)}i.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==i.prototype},i.compare=function(u,c){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),xt(c,Uint8Array)&&(c=i.from(c,c.offset,c.byteLength)),!i.isBuffer(u)||!i.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===c)return 0;let _=u.length,I=c.length;for(let U=0,W=Math.min(_,I);U<W;++U)if(u[U]!==c[U]){_=u[U],I=c[U];break}return _<I?-1:I<_?1:0},i.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(u,c){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return i.alloc(0);let _;if(c===void 0)for(c=0,_=0;_<u.length;++_)c+=u[_].length;let I=i.allocUnsafe(c),U=0;for(_=0;_<u.length;++_){let W=u[_];if(xt(W,Uint8Array))U+W.length>I.length?(i.isBuffer(W)||(W=i.from(W)),W.copy(I,U)):Uint8Array.prototype.set.call(I,W,U);else if(i.isBuffer(W))W.copy(I,U);else throw new TypeError('"list" argument must be an Array of Buffers');U+=W.length}return I};function S(m,u){if(i.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||xt(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let c=m.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&c===0)return 0;let I=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return Me(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return Ct(m).length;default:if(I)return _?-1:Me(m).length;u=(""+u).toLowerCase(),I=!0}}i.byteLength=S;function E(m,u,c){let _=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,u>>>=0,c<=u))return"";for(m||(m="utf8");;)switch(m){case"hex":return Pe(this,u,c);case"utf8":case"utf-8":return tt(this,u,c);case"ascii":return ht(this,u,c);case"latin1":case"binary":return Ue(this,u,c);case"base64":return ze(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,u,c);default:if(_)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),_=!0}}i.prototype._isBuffer=!0;function H(m,u,c){let _=m[u];m[u]=m[c],m[c]=_}i.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let c=0;c<u;c+=2)H(this,c,c+1);return this},i.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let c=0;c<u;c+=4)H(this,c,c+3),H(this,c+1,c+2);return this},i.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let c=0;c<u;c+=8)H(this,c,c+7),H(this,c+1,c+6),H(this,c+2,c+5),H(this,c+3,c+4);return this},i.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?tt(this,0,u):E.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(u){if(!i.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:i.compare(this,u)===0},i.prototype.inspect=function(){let u="",c=Tn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(u+=" ... "),"<Buffer "+u+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(u,c,_,I,U){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),!i.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(c===void 0&&(c=0),_===void 0&&(_=u?u.length:0),I===void 0&&(I=0),U===void 0&&(U=this.length),c<0||_>u.length||I<0||U>this.length)throw new RangeError("out of range index");if(I>=U&&c>=_)return 0;if(I>=U)return-1;if(c>=_)return 1;if(c>>>=0,_>>>=0,I>>>=0,U>>>=0,this===u)return 0;let W=U-I,Be=_-c,qe=Math.min(W,Be),Ze=this.slice(I,U),Ge=u.slice(c,_);for(let He=0;He<qe;++He)if(Ze[He]!==Ge[He]){W=Ze[He],Be=Ge[He];break}return W<Be?-1:Be<W?1:0};function j(m,u,c,_,I){if(m.length===0)return-1;if(typeof c=="string"?(_=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,hr(c)&&(c=I?0:m.length-1),c<0&&(c=m.length+c),c>=m.length){if(I)return-1;c=m.length-1}else if(c<0)if(I)c=0;else return-1;if(typeof u=="string"&&(u=i.from(u,_)),i.isBuffer(u))return u.length===0?-1:re(m,u,c,_,I);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?I?Uint8Array.prototype.indexOf.call(m,u,c):Uint8Array.prototype.lastIndexOf.call(m,u,c):re(m,[u],c,_,I);throw new TypeError("val must be string, number or Buffer")}function re(m,u,c,_,I){let U=1,W=m.length,Be=u.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(m.length<2||u.length<2)return-1;U=2,W/=2,Be/=2,c/=2}function qe(Ge,He){return U===1?Ge[He]:Ge.readUInt16BE(He*U)}let Ze;if(I){let Ge=-1;for(Ze=c;Ze<W;Ze++)if(qe(m,Ze)===qe(u,Ge===-1?0:Ze-Ge)){if(Ge===-1&&(Ge=Ze),Ze-Ge+1===Be)return Ge*U}else Ge!==-1&&(Ze-=Ze-Ge),Ge=-1}else for(c+Be>W&&(c=W-Be),Ze=c;Ze>=0;Ze--){let Ge=!0;for(let He=0;He<Be;He++)if(qe(m,Ze+He)!==qe(u,He)){Ge=!1;break}if(Ge)return Ze}return-1}i.prototype.includes=function(u,c,_){return this.indexOf(u,c,_)!==-1},i.prototype.indexOf=function(u,c,_){return j(this,u,c,_,!0)},i.prototype.lastIndexOf=function(u,c,_){return j(this,u,c,_,!1)};function ee(m,u,c,_){c=Number(c)||0;let I=m.length-c;_?(_=Number(_),_>I&&(_=I)):_=I;let U=u.length;_>U/2&&(_=U/2);let W;for(W=0;W<_;++W){let Be=parseInt(u.substr(W*2,2),16);if(hr(Be))return W;m[c+W]=Be}return W}function ge(m,u,c,_){return Nt(Me(u,m.length-c),m,c,_)}function ae(m,u,c,_){return Nt(_e(u),m,c,_)}function ie(m,u,c,_){return Nt(Ct(u),m,c,_)}function Oe(m,u,c,_){return Nt($(u,m.length-c),m,c,_)}i.prototype.write=function(u,c,_,I){if(c===void 0)I="utf8",_=this.length,c=0;else if(_===void 0&&typeof c=="string")I=c,_=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(_)?(_=_>>>0,I===void 0&&(I="utf8")):(I=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-c;if((_===void 0||_>U)&&(_=U),u.length>0&&(_<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");let W=!1;for(;;)switch(I){case"hex":return ee(this,u,c,_);case"utf8":case"utf-8":return ge(this,u,c,_);case"ascii":case"latin1":case"binary":return ae(this,u,c,_);case"base64":return ie(this,u,c,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,c,_);default:if(W)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),W=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ze(m,u,c){return u===0&&c===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(u,c))}function tt(m,u,c){c=Math.min(m.length,c);let _=[],I=u;for(;I<c;){let U=m[I],W=null,Be=U>239?4:U>223?3:U>191?2:1;if(I+Be<=c){let qe,Ze,Ge,He;switch(Be){case 1:U<128&&(W=U);break;case 2:qe=m[I+1],(qe&192)===128&&(He=(U&31)<<6|qe&63,He>127&&(W=He));break;case 3:qe=m[I+1],Ze=m[I+2],(qe&192)===128&&(Ze&192)===128&&(He=(U&15)<<12|(qe&63)<<6|Ze&63,He>2047&&(He<55296||He>57343)&&(W=He));break;case 4:qe=m[I+1],Ze=m[I+2],Ge=m[I+3],(qe&192)===128&&(Ze&192)===128&&(Ge&192)===128&&(He=(U&15)<<18|(qe&63)<<12|(Ze&63)<<6|Ge&63,He>65535&&He<1114112&&(W=He))}}W===null?(W=65533,Be=1):W>65535&&(W-=65536,_.push(W>>>10&1023|55296),W=56320|W&1023),_.push(W),I+=Be}return Je(_)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let c="",_=0;for(;_<u;)c+=String.fromCharCode.apply(String,m.slice(_,_+=Ve));return c}function ht(m,u,c){let _="";c=Math.min(m.length,c);for(let I=u;I<c;++I)_+=String.fromCharCode(m[I]&127);return _}function Ue(m,u,c){let _="";c=Math.min(m.length,c);for(let I=u;I<c;++I)_+=String.fromCharCode(m[I]);return _}function Pe(m,u,c){let _=m.length;(!u||u<0)&&(u=0),(!c||c<0||c>_)&&(c=_);let I="";for(let U=u;U<c;++U)I+=ci[m[U]];return I}function Se(m,u,c){let _=m.slice(u,c),I="";for(let U=0;U<_.length-1;U+=2)I+=String.fromCharCode(_[U]+_[U+1]*256);return I}i.prototype.slice=function(u,c){let _=this.length;u=~~u,c=c===void 0?_:~~c,u<0?(u+=_,u<0&&(u=0)):u>_&&(u=_),c<0?(c+=_,c<0&&(c=0)):c>_&&(c=_),c<u&&(c=u);let I=this.subarray(u,c);return Object.setPrototypeOf(I,i.prototype),I};function fe(m,u,c){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+u>c)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(u,c,_){u=u>>>0,c=c>>>0,_||fe(u,c,this.length);let I=this[u],U=1,W=0;for(;++W<c&&(U*=256);)I+=this[u+W]*U;return I},i.prototype.readUintBE=i.prototype.readUIntBE=function(u,c,_){u=u>>>0,c=c>>>0,_||fe(u,c,this.length);let I=this[u+--c],U=1;for(;c>0&&(U*=256);)I+=this[u+--c]*U;return I},i.prototype.readUint8=i.prototype.readUInt8=function(u,c){return u=u>>>0,c||fe(u,1,this.length),this[u]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(u,c){return u=u>>>0,c||fe(u,2,this.length),this[u]|this[u+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(u,c){return u=u>>>0,c||fe(u,2,this.length),this[u]<<8|this[u+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},i.prototype.readBigUInt64LE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,U=this[++u]+this[++u]*2**8+this[++u]*2**16+_*2**24;return BigInt(I)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=c*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],U=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+_;return(BigInt(I)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,c,_){u=u>>>0,c=c>>>0,_||fe(u,c,this.length);let I=this[u],U=1,W=0;for(;++W<c&&(U*=256);)I+=this[u+W]*U;return U*=128,I>=U&&(I-=Math.pow(2,8*c)),I},i.prototype.readIntBE=function(u,c,_){u=u>>>0,c=c>>>0,_||fe(u,c,this.length);let I=c,U=1,W=this[u+--I];for(;I>0&&(U*=256);)W+=this[u+--I]*U;return U*=128,W>=U&&(W-=Math.pow(2,8*c)),W},i.prototype.readInt8=function(u,c){return u=u>>>0,c||fe(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},i.prototype.readInt16LE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let _=this[u]|this[u+1]<<8;return _&32768?_|4294901760:_},i.prototype.readInt16BE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let _=this[u+1]|this[u]<<8;return _&32768?_|4294901760:_},i.prototype.readInt32LE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},i.prototype.readInt32BE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},i.prototype.readBigInt64LE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(_<<24);return(BigInt(I)<<BigInt(32))+BigInt(c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=(c<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(I)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+_)}),i.prototype.readFloatLE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),e.read(this,u,!0,23,4)},i.prototype.readFloatBE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),e.read(this,u,!1,23,4)},i.prototype.readDoubleLE=function(u,c){return u=u>>>0,c||fe(u,8,this.length),e.read(this,u,!0,52,8)},i.prototype.readDoubleBE=function(u,c){return u=u>>>0,c||fe(u,8,this.length),e.read(this,u,!1,52,8)};function ve(m,u,c,_,I,U){if(!i.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>I||u<U)throw new RangeError('"value" argument is out of bounds');if(c+_>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,c,_,I){if(u=+u,c=c>>>0,_=_>>>0,!I){let Be=Math.pow(2,8*_)-1;ve(this,u,c,_,Be,0)}let U=1,W=0;for(this[c]=u&255;++W<_&&(U*=256);)this[c+W]=u/U&255;return c+_},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,c,_,I){if(u=+u,c=c>>>0,_=_>>>0,!I){let Be=Math.pow(2,8*_)-1;ve(this,u,c,_,Be,0)}let U=_-1,W=1;for(this[c+U]=u&255;--U>=0&&(W*=256);)this[c+U]=u/W&255;return c+_},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,1,255,0),this[c]=u&255,c+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,65535,0),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,65535,0),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,4,4294967295,0),this[c+3]=u>>>24,this[c+2]=u>>>16,this[c+1]=u>>>8,this[c]=u&255,c+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,4,4294967295,0),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4};function D(m,u,c,_,I){oe(u,_,I,m,c,7);let U=Number(u&BigInt(4294967295));m[c++]=U,U=U>>8,m[c++]=U,U=U>>8,m[c++]=U,U=U>>8,m[c++]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[c++]=W,W=W>>8,m[c++]=W,W=W>>8,m[c++]=W,W=W>>8,m[c++]=W,c}function K(m,u,c,_,I){oe(u,_,I,m,c,7);let U=Number(u&BigInt(4294967295));m[c+7]=U,U=U>>8,m[c+6]=U,U=U>>8,m[c+5]=U,U=U>>8,m[c+4]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[c+3]=W,W=W>>8,m[c+2]=W,W=W>>8,m[c+1]=W,W=W>>8,m[c]=W,c+8}i.prototype.writeBigUInt64LE=Et(function(u,c=0){return D(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Et(function(u,c=0){return K(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,c,_,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*_-1);ve(this,u,c,_,qe-1,-qe)}let U=0,W=1,Be=0;for(this[c]=u&255;++U<_&&(W*=256);)u<0&&Be===0&&this[c+U-1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+_},i.prototype.writeIntBE=function(u,c,_,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*_-1);ve(this,u,c,_,qe-1,-qe)}let U=_-1,W=1,Be=0;for(this[c+U]=u&255;--U>=0&&(W*=256);)u<0&&Be===0&&this[c+U+1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+_},i.prototype.writeInt8=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,1,127,-128),u<0&&(u=255+u+1),this[c]=u&255,c+1},i.prototype.writeInt16LE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeInt16BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeInt32LE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,4,2147483647,-2147483648),this[c]=u&255,this[c+1]=u>>>8,this[c+2]=u>>>16,this[c+3]=u>>>24,c+4},i.prototype.writeInt32BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4},i.prototype.writeBigInt64LE=Et(function(u,c=0){return D(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Et(function(u,c=0){return K(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,c,_,I,U){if(c+_>m.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function de(m,u,c,_,I){return u=+u,c=c>>>0,I||F(m,u,c,4),e.write(m,u,c,_,23,4),c+4}i.prototype.writeFloatLE=function(u,c,_){return de(this,u,c,!0,_)},i.prototype.writeFloatBE=function(u,c,_){return de(this,u,c,!1,_)};function Te(m,u,c,_,I){return u=+u,c=c>>>0,I||F(m,u,c,8),e.write(m,u,c,_,52,8),c+8}i.prototype.writeDoubleLE=function(u,c,_){return Te(this,u,c,!0,_)},i.prototype.writeDoubleBE=function(u,c,_){return Te(this,u,c,!1,_)},i.prototype.copy=function(u,c,_,I){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(_||(_=0),!I&&I!==0&&(I=this.length),c>=u.length&&(c=u.length),c||(c=0),I>0&&I<_&&(I=_),I===_||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),u.length-c<I-_&&(I=u.length-c+_);let U=I-_;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,_,I):Uint8Array.prototype.set.call(u,this.subarray(_,I),c),U},i.prototype.fill=function(u,c,_,I){if(typeof u=="string"){if(typeof c=="string"?(I=c,c=0,_=this.length):typeof _=="string"&&(I=_,_=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!i.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(u.length===1){let W=u.charCodeAt(0);(I==="utf8"&&W<128||I==="latin1")&&(u=W)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(c<0||this.length<c||this.length<_)throw new RangeError("Out of range index");if(_<=c)return this;c=c>>>0,_=_===void 0?this.length:_>>>0,u||(u=0);let U;if(typeof u=="number")for(U=c;U<_;++U)this[U]=u;else{let W=i.isBuffer(u)?u:i.from(u,I),Be=W.length;if(Be===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(U=0;U<_-c;++U)this[U+c]=W[U%Be]}return this};let M={};function k(m,u,c){M[m]=class extends c{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${m}]`,this.stack,delete this.name}get code(){return m}set code(I){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:I,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}k("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),k("ERR_INVALID_ARG_TYPE",function(m,u){return`The "${m}" argument must be of type number. Received type ${typeof u}`},TypeError),k("ERR_OUT_OF_RANGE",function(m,u,c){let _=`The value of "${m}" is out of range.`,I=c;return Number.isInteger(c)&&Math.abs(c)>2**32?I=Z(String(c)):typeof c=="bigint"&&(I=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(I=Z(I)),I+="n"),_+=` It must be ${u}. Received ${I}`,_},RangeError);function Z(m){let u="",c=m.length,_=m[0]==="-"?1:0;for(;c>=_+4;c-=3)u=`_${m.slice(c-3,c)}${u}`;return`${m.slice(0,c)}${u}`}function Y(m,u,c){w(u,"offset"),(m[u]===void 0||m[u+c]===void 0)&&x(u,m.length-(c+1))}function oe(m,u,c,_,I,U){if(m>c||m<u){let W=typeof u=="bigint"?"n":"",Be;throw u===0||u===BigInt(0)?Be=`>= 0${W} and < 2${W} ** ${(U+1)*8}${W}`:Be=`>= -(2${W} ** ${(U+1)*8-1}${W}) and < 2 ** ${(U+1)*8-1}${W}`,new M.ERR_OUT_OF_RANGE("value",Be,m)}Y(_,I,U)}function w(m,u){if(typeof m!="number")throw new M.ERR_INVALID_ARG_TYPE(u,"number",m)}function x(m,u,c){throw Math.floor(m)!==m?(w(m,c),new M.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new M.ERR_BUFFER_OUT_OF_BOUNDS:new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,m)}let z=/[^+/0-9A-Za-z-_]/g;function Q(m){if(m=m.split("=")[0],m=m.trim().replace(z,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Me(m,u){u=u||1/0;let c,_=m.length,I=null,U=[];for(let W=0;W<_;++W){if(c=m.charCodeAt(W),c>55295&&c<57344){if(!I){if(c>56319){(u-=3)>-1&&U.push(239,191,189);continue}else if(W+1===_){(u-=3)>-1&&U.push(239,191,189);continue}I=c;continue}if(c<56320){(u-=3)>-1&&U.push(239,191,189),I=c;continue}c=(I-55296<<10|c-56320)+65536}else I&&(u-=3)>-1&&U.push(239,191,189);if(I=null,c<128){if((u-=1)<0)break;U.push(c)}else if(c<2048){if((u-=2)<0)break;U.push(c>>6|192,c&63|128)}else if(c<65536){if((u-=3)<0)break;U.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((u-=4)<0)break;U.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return U}function _e(m){let u=[];for(let c=0;c<m.length;++c)u.push(m.charCodeAt(c)&255);return u}function $(m,u){let c,_,I,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)c=m.charCodeAt(W),_=c>>8,I=c%256,U.push(I),U.push(_);return U}function Ct(m){return t.toByteArray(Q(m))}function Nt(m,u,c,_){let I;for(I=0;I<_&&!(I+c>=u.length||I>=m.length);++I)u[I+c]=m[I];return I}function xt(m,u){return m instanceof u||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===u.name}function hr(m){return m!==m}let ci=(function(){let m="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){let _=c*16;for(let I=0;I<16;++I)u[_+I]=m[c]+m[I]}return u})();function Et(m){return typeof BigInt>"u"?vr:m}function vr(){throw new Error("BigInt not supported")}return Tn}var Tr,pc,gi,gc,Tn,yc,yi=at(()=>{A();O();C();Tr={},pc=!1;gi={},gc=!1;Tn={},yc=!1});var _n,q,bA,wA,mc=at(()=>{A();O();C();yi();_n=Dt();_n.Buffer;_n.SlowBuffer;_n.INSPECT_MAX_BYTES;_n.kMaxLength;q=_n.Buffer,bA=_n.INSPECT_MAX_BYTES,wA=_n.kMaxLength});var O=at(()=>{mc()});function Ht(){return Hy||(Hy=!0,typeof Object.create=="function"?Po=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Po=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Po}var Po,Hy,as=at(()=>{A();O();C();Po={},Hy=!1});function Ne(){Ne.init.call(this)}function Bo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function qy(t){return t._maxListeners===void 0?Ne.defaultMaxListeners:t._maxListeners}function jy(t,e,n,r){var o,a,i,s;if(Bo(n),(a=t._events)===void 0?(a=t._events=Object.create(null),t._eventsCount=0):(a.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),a=t._events),i=a[e]),i===void 0)i=a[e]=n,++t._eventsCount;else if(typeof i=="function"?i=a[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(o=qy(t))>0&&i.length>o&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=i.length,s=l,console&&console.warn&&console.warn(s)}return t}function FB(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ky(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=FB.bind(r);return o.listener=n,r.wrapFn=o,o}function Ly(t,e,n){var r=t._events;if(r===void 0)return[];var o=r[e];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?(function(a){for(var i=new Array(a.length),s=0;s<i.length;++s)i[s]=a[s].listener||a[s];return i})(o):Gy(o,o.length)}function Fy(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}function Gy(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var Wy,zy,ar,Uy,$y,Zy,_t,ss=at(()=>{A();O();C();ar=typeof Reflect=="object"?Reflect:null,Uy=ar&&typeof ar.apply=="function"?ar.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};zy=ar&&typeof ar.ownKeys=="function"?ar.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};$y=Number.isNaN||function(t){return t!=t};Wy=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;Zy=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return Zy},set:function(t){if(typeof t!="number"||t<0||$y(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Zy=t}}),Ne.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ne.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||$y(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},Ne.prototype.getMaxListeners=function(){return qy(this)},Ne.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var i=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw i.context=a,i}var s=o[t];if(s===void 0)return!1;if(typeof s=="function")Uy(s,this,e);else{var l=s.length,f=Gy(s,l);for(n=0;n<l;++n)Uy(f[n],this,e)}return!0},Ne.prototype.addListener=function(t,e){return jy(this,t,e,!1)},Ne.prototype.on=Ne.prototype.addListener,Ne.prototype.prependListener=function(t,e){return jy(this,t,e,!0)},Ne.prototype.once=function(t,e){return Bo(e),this.on(t,Ky(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return Bo(e),this.prependListener(t,Ky(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,o,a,i;if(Bo(e),(r=this._events)===void 0)return this;if((n=r[t])===void 0)return this;if(n===e||n.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(o=-1,a=n.length-1;a>=0;a--)if(n[a]===e||n[a].listener===e){i=n[a].listener,o=a;break}if(o<0)return this;o===0?n.shift():(function(s,l){for(;l+1<s.length;l++)s[l]=s[l+1];s.pop()})(n,o),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,i||e)}return this},Ne.prototype.off=Ne.prototype.removeListener,Ne.prototype.removeAllListeners=function(t){var e,n,r;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var o,a=Object.keys(n);for(r=0;r<a.length;++r)(o=a[r])!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=n[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},Ne.prototype.listeners=function(t){return Ly(this,t,!0)},Ne.prototype.rawListeners=function(t){return Ly(this,t,!1)},Ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Fy.call(t,e)},Ne.prototype.listenerCount=Fy,Ne.prototype.eventNames=function(){return this._eventsCount>0?zy(this._events):[]};_t=Wy;_t.EventEmitter;_t.defaultMaxListeners;_t.init;_t.listenerCount;_t.EventEmitter;_t.defaultMaxListeners;_t.init;_t.listenerCount});var Vy=at(()=>{A();O();C();ss();_t.once=function(t,e){return new Promise((n,r)=>{function o(...i){a!==void 0&&t.removeListener("error",a),n(i)}let a;e!=="error"&&(a=i=>{t.removeListener(name,o),r(i)},t.once("error",a)),t.once(e,o)})};_t.on=function(t,e){let n=[],r=[],o=null,a=!1,i={async next(){let f=n.shift();if(f)return createIterResult(f,!1);if(o){let p=Promise.reject(o);return o=null,p}return a?createIterResult(void 0,!0):new Promise((p,y)=>r.push({resolve:p,reject:y}))},async return(){t.removeListener(e,s),t.removeListener("error",l),a=!0;for(let f of r)f.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(f){o=f,t.removeListener(e,s),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,s),t.on("error",l),i;function s(...f){let p=r.shift();p?p.resolve(createIterResult(f,!1)):n.push(f)}function l(f){a=!0;let p=r.shift();p?p.reject(f):o=f,i.return()}}});function ds(){throw new Error("setTimeout has not been defined")}function ps(){throw new Error("clearTimeout has not been defined")}function um(t){if(Jt===setTimeout)return setTimeout(t,0);if((Jt===ds||!Jt)&&setTimeout)return Jt=setTimeout,setTimeout(t,0);try{return Jt(t,0)}catch{try{return Jt.call(null,t,0)}catch{return Jt.call(this||lr,t,0)}}}function WB(){sr&&Un&&(sr=!1,Un.length?Xt=Un.concat(Xt):Co=-1,Xt.length&&cm())}function cm(){if(!sr){var t=um(WB);sr=!0;for(var e=Xt.length;e;){for(Un=Xt,Xt=[];++Co<e;)Un&&Un[Co].run();Co=-1,e=Xt.length}Un=null,sr=!1,(function(n){if(Yt===clearTimeout)return clearTimeout(n);if((Yt===ps||!Yt)&&clearTimeout)return Yt=clearTimeout,clearTimeout(n);try{Yt(n)}catch{try{return Yt.call(null,n)}catch{return Yt.call(this||lr,n)}}})(t)}}function Jy(t,e){(this||lr).fun=t,(this||lr).array=e}function Vt(){}function Zn(t){return t.call.bind(t)}function Xr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function Xy(t){return bt&&Pt?St(t)!==void 0:mm(t)||hm(t)||vm(t)||Tm(t)||_m(t)||bm(t)||wm(t)||xm(t)||Pm(t)||Bm(t)||Em(t)}function mm(t){return bt&&Pt?St(t)==="Uint8Array":We(t)==="[object Uint8Array]"||tE(t)&&t.buffer!==void 0}function hm(t){return bt&&Pt?St(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function vm(t){return bt&&Pt?St(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function Tm(t){return bt&&Pt?St(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function _m(t){return bt&&Pt?St(t)==="Int8Array":We(t)==="[object Int8Array]"}function bm(t){return bt&&Pt?St(t)==="Int16Array":We(t)==="[object Int16Array]"}function wm(t){return bt&&Pt?St(t)==="Int32Array":We(t)==="[object Int32Array]"}function xm(t){return bt&&Pt?St(t)==="Float32Array":We(t)==="[object Float32Array]"}function Pm(t){return bt&&Pt?St(t)==="Float64Array":We(t)==="[object Float64Array]"}function Bm(t){return bt&&Pt?St(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Em(t){return bt&&Pt?St(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function Eo(t){return We(t)==="[object Map]"}function So(t){return We(t)==="[object Set]"}function ko(t){return We(t)==="[object WeakMap]"}function ls(t){return We(t)==="[object WeakSet]"}function Ro(t){return We(t)==="[object ArrayBuffer]"}function Qy(t){return typeof ArrayBuffer<"u"&&(Ro.working?Ro(t):t instanceof ArrayBuffer)}function Mo(t){return We(t)==="[object DataView]"}function em(t){return typeof DataView<"u"&&(Mo.working?Mo(t):t instanceof DataView)}function No(t){return We(t)==="[object SharedArrayBuffer]"}function tm(t){return typeof SharedArrayBuffer<"u"&&(No.working?No(t):t instanceof SharedArrayBuffer)}function nm(t){return Xr(t,aE)}function rm(t){return Xr(t,sE)}function im(t){return Xr(t,lE)}function om(t){return ym&&Xr(t,uE)}function am(t){return ys&&Xr(t,cE)}function fn(t,e){var n={seen:[],stylize:pE};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ms(e)?n.showHidden=e:e&&L._extend(n,e),$n(n.showHidden)&&(n.showHidden=!1),$n(n.depth)&&(n.depth=2),$n(n.colors)&&(n.colors=!1),$n(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=dE),Do(n,t,n.depth)}function dE(t,e){var n=fn.styles[e];return n?"\x1B["+fn.colors[n][0]+"m"+t+"\x1B["+fn.colors[n][1]+"m":t}function pE(t,e){return t}function Do(t,e,n){if(t.customInspect&&e&&Oo(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ho(r)||(r=Do(t,r,n)),r}var o=(function(g,h){if($n(h))return g.stylize("undefined","undefined");if(Ho(h)){var v="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(v,"string")}if(Im(h))return g.stylize(""+h,"number");if(ms(h))return g.stylize(""+h,"boolean");if(Zo(h))return g.stylize("null","null")})(t,e);if(o)return o;var a=Object.keys(e),i=(function(g){var h={};return g.forEach((function(v,P){h[v]=!0})),h})(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),Yr(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return us(e);if(a.length===0){if(Oo(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Jr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Uo(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Yr(e))return us(e)}var l,f="",p=!1,y=["{","}"];return km(e)&&(p=!0,y=["[","]"]),Oo(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),Jr(e)&&(f=" "+RegExp.prototype.toString.call(e)),Uo(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Yr(e)&&(f=" "+us(e)),a.length!==0||p&&e.length!=0?n<0?Jr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=p?(function(g,h,v,P,B){for(var T=[],S=0,E=h.length;S<E;++S)Am(h,String(S))?T.push(cs(g,h,v,P,String(S),!0)):T.push("");return B.forEach((function(H){H.match(/^\d+$/)||T.push(cs(g,h,v,P,H,!0))})),T})(t,e,n,i,a):a.map((function(g){return cs(t,e,n,i,g,p)})),t.seen.pop(),(function(g,h,v){var P=0;return g.reduce((function(B,T){return P++,T.indexOf(`
|
|
1
|
+
var ta=Object.defineProperty;var Wv=Object.getOwnPropertyDescriptor;var zv=Object.getOwnPropertyNames;var qv=Object.prototype.hasOwnProperty;var at=(t,e)=>()=>(t&&(e=t(t=0)),e);var hn=(t,e)=>{for(var n in e)ta(t,n,{get:e[n],enumerable:!0})},Gv=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zv(e))!qv.call(t,o)&&o!==n&&ta(t,o,{get:()=>e[o],enumerable:!(r=Wv(e,o))||r.enumerable});return t};var Vv=t=>Gv(ta({},"__esModule",{value:!0}),t);var A=at(()=>{});var J={};hn(J,{_debugEnd:()=>Uu,_debugProcess:()=>Hu,_events:()=>ec,_eventsCount:()=>tc,_exiting:()=>vu,_fatalExceptions:()=>Ru,_getActiveHandles:()=>wu,_getActiveRequests:()=>bu,_kill:()=>Pu,_linkedBinding:()=>mu,_maxListeners:()=>Qu,_preload_modules:()=>Ju,_rawDebug:()=>gu,_startProfilerIdleNotifier:()=>$u,_stopProfilerIdleNotifier:()=>Zu,_tickCallback:()=>Du,abort:()=>Fu,addListener:()=>nc,allowedNodeEnvironmentFlags:()=>Au,arch:()=>eu,argv:()=>ru,argv0:()=>Vu,assert:()=>Cu,binding:()=>lu,browser:()=>pu,chdir:()=>fu,config:()=>Tu,cpuUsage:()=>pi,cwd:()=>cu,debugPort:()=>Gu,default:()=>fc,dlopen:()=>_u,domain:()=>hu,emit:()=>sc,emitWarning:()=>su,env:()=>nu,execArgv:()=>iu,execPath:()=>qu,exit:()=>ku,features:()=>Ou,hasUncaughtExceptionCaptureCallback:()=>Nu,hrtime:()=>di,kill:()=>Su,listeners:()=>cc,memoryUsage:()=>Eu,moduleLoadList:()=>yu,nextTick:()=>Yl,off:()=>ic,on:()=>Kt,once:()=>rc,openStdin:()=>Iu,pid:()=>Wu,platform:()=>tu,ppid:()=>zu,prependListener:()=>lc,prependOnceListener:()=>uc,reallyExit:()=>xu,release:()=>du,removeAllListeners:()=>ac,removeListener:()=>oc,resourceUsage:()=>Bu,setSourceMapsEnabled:()=>Yu,setUncaughtExceptionCaptureCallback:()=>Mu,stderr:()=>Ku,stdin:()=>Lu,stdout:()=>ju,title:()=>Ql,umask:()=>uu,uptime:()=>Xu,version:()=>ou,versions:()=>au});function ia(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function Jv(){!Wn||!vn||(Wn=!1,vn.length?jt=vn.concat(jt):fi=-1,jt.length&&Jl())}function Jl(){if(!Wn){var t=setTimeout(Jv,0);Wn=!0;for(var e=jt.length;e;){for(vn=jt,jt=[];++fi<e;)vn&&vn[fi].run();fi=-1,e=jt.length}vn=null,Wn=!1,clearTimeout(t)}}function Yl(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];jt.push(new Xl(t,e)),jt.length===1&&!Wn&&setTimeout(Jl,0)}function Xl(t,e){this.fun=t,this.array=e}function lt(){}function mu(t){ia("_linkedBinding")}function _u(t){ia("dlopen")}function bu(){return[]}function wu(){return[]}function Cu(t,e){if(!t)throw new Error(e||"assertion error")}function Nu(){return!1}function Xu(){return on.now()/1e3}function di(t){var e=Math.floor((Date.now()-on.now())*.001),n=on.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=ra)),[r,o]}function Kt(){return fc}function cc(t){return[]}var jt,Wn,vn,fi,Ql,eu,tu,nu,ru,iu,ou,au,su,lu,uu,cu,fu,du,pu,gu,yu,hu,vu,Tu,xu,Pu,pi,Bu,Eu,Su,ku,Iu,Au,Ou,Ru,Mu,Du,Hu,Uu,$u,Zu,ju,Ku,Lu,Fu,Wu,zu,qu,Gu,Vu,Ju,Yu,on,na,ra,Qu,ec,tc,nc,rc,ic,oc,ac,sc,lc,uc,fc,dc=at(()=>{A();O();C();jt=[],Wn=!1,fi=-1;Xl.prototype.run=function(){this.fun.apply(null,this.array)};Ql="browser",eu="x64",tu="browser",nu={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},ru=["/usr/bin/node"],iu=[],ou="v16.8.0",au={},su=function(t,e){console.warn((e?e+": ":"")+t)},lu=function(t){ia("binding")},uu=function(t){return 0},cu=function(){return"/"},fu=function(t){},du={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};pu=!0,gu=lt,yu=[];hu={},vu=!1,Tu={};xu=lt,Pu=lt,pi=function(){return{}},Bu=pi,Eu=pi,Su=lt,ku=lt,Iu=lt,Au={};Ou={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Ru=lt,Mu=lt;Du=lt,Hu=lt,Uu=lt,$u=lt,Zu=lt,ju=void 0,Ku=void 0,Lu=void 0,Fu=lt,Wu=2,zu=1,qu="/bin/usr/node",Gu=9229,Vu="node",Ju=[],Yu=lt,on={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};on.now===void 0&&(na=Date.now(),on.timing&&on.timing.navigationStart&&(na=on.timing.navigationStart),on.now=()=>Date.now()-na);ra=1e9;di.bigint=function(t){var e=di(t);return typeof BigInt>"u"?e[0]*ra+e[1]:BigInt(e[0]*ra)+BigInt(e[1])};Qu=10,ec={},tc=0;nc=Kt,rc=Kt,ic=Kt,oc=Kt,ac=Kt,sc=lt,lc=Kt,uc=Kt;fc={version:ou,versions:au,arch:eu,platform:tu,browser:pu,release:du,_rawDebug:gu,moduleLoadList:yu,binding:lu,_linkedBinding:mu,_events:ec,_eventsCount:tc,_maxListeners:Qu,on:Kt,addListener:nc,once:rc,off:ic,removeListener:oc,removeAllListeners:ac,emit:sc,prependListener:lc,prependOnceListener:uc,listeners:cc,domain:hu,_exiting:vu,config:Tu,dlopen:_u,uptime:Xu,_getActiveRequests:bu,_getActiveHandles:wu,reallyExit:xu,_kill:Pu,cpuUsage:pi,resourceUsage:Bu,memoryUsage:Eu,kill:Su,exit:ku,openStdin:Iu,allowedNodeEnvironmentFlags:Au,assert:Cu,features:Ou,_fatalExceptions:Ru,setUncaughtExceptionCaptureCallback:Mu,hasUncaughtExceptionCaptureCallback:Nu,emitWarning:su,nextTick:Yl,_tickCallback:Du,_debugProcess:Hu,_debugEnd:Uu,_startProfilerIdleNotifier:$u,_stopProfilerIdleNotifier:Zu,stdout:ju,stdin:Lu,stderr:Ku,abort:Fu,umask:uu,chdir:fu,cwd:cu,env:nu,title:Ql,argv:ru,execArgv:iu,pid:Wu,ppid:zu,execPath:qu,debugPort:Gu,hrtime:di,argv0:Vu,_preload_modules:Ju,setSourceMapsEnabled:Yu}});var C=at(()=>{dc()});function Yv(){if(pc)return Tr;pc=!0,Tr.byteLength=s,Tr.toByteArray=f,Tr.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=r.length;o<a;++o)t[o]=r[o],e[r.charCodeAt(o)]=o;e[45]=62,e[95]=63;function i(h){var v=h.length;if(v%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=v);var B=P===v?0:4-P%4;return[P,B]}function s(h){var v=i(h),P=v[0],B=v[1];return(P+B)*3/4-B}function l(h,v,P){return(v+P)*3/4-P}function f(h){var v,P=i(h),B=P[0],T=P[1],S=new n(l(h,B,T)),E=0,H=T>0?B-4:B,j;for(j=0;j<H;j+=4)v=e[h.charCodeAt(j)]<<18|e[h.charCodeAt(j+1)]<<12|e[h.charCodeAt(j+2)]<<6|e[h.charCodeAt(j+3)],S[E++]=v>>16&255,S[E++]=v>>8&255,S[E++]=v&255;return T===2&&(v=e[h.charCodeAt(j)]<<2|e[h.charCodeAt(j+1)]>>4,S[E++]=v&255),T===1&&(v=e[h.charCodeAt(j)]<<10|e[h.charCodeAt(j+1)]<<4|e[h.charCodeAt(j+2)]>>2,S[E++]=v>>8&255,S[E++]=v&255),S}function p(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,v,P){for(var B,T=[],S=v;S<P;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),T.push(p(B));return T.join("")}function g(h){for(var v,P=h.length,B=P%3,T=[],S=16383,E=0,H=P-B;E<H;E+=S)T.push(y(h,E,E+S>H?H:E+S));return B===1?(v=h[P-1],T.push(t[v>>2]+t[v<<4&63]+"==")):B===2&&(v=(h[P-2]<<8)+h[P-1],T.push(t[v>>10]+t[v>>4&63]+t[v<<2&63]+"=")),T.join("")}return Tr}function Xv(){if(gc)return gi;gc=!0;return gi.read=function(t,e,n,r,o){var a,i,s=o*8-r-1,l=(1<<s)-1,f=l>>1,p=-7,y=n?o-1:0,g=n?-1:1,h=t[e+y];for(y+=g,a=h&(1<<-p)-1,h>>=-p,p+=s;p>0;a=a*256+t[e+y],y+=g,p-=8);for(i=a&(1<<-p)-1,a>>=-p,p+=r;p>0;i=i*256+t[e+y],y+=g,p-=8);if(a===0)a=1-f;else{if(a===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),a=a-f}return(h?-1:1)*i*Math.pow(2,a-r)},gi.write=function(t,e,n,r,o,a){var i,s,l,f=a*8-o-1,p=(1<<f)-1,y=p>>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,v=r?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,i=p):(i=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+y>=1?e+=g/l:e+=g*Math.pow(2,1-y),e*l>=2&&(i++,l/=2),i+y>=p?(s=0,i=p):i+y>=1?(s=(e*l-1)*Math.pow(2,o),i=i+y):(s=e*Math.pow(2,y-1)*Math.pow(2,o),i=0));o>=8;t[n+h]=s&255,h+=v,s/=256,o-=8);for(i=i<<o|s,f+=o;f>0;t[n+h]=i&255,h+=v,i/=256,f-=8);t[n+h-v]|=P*128},gi}function Dt(){if(yc)return Tn;yc=!0;let t=Yv(),e=Xv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Tn.Buffer=i,Tn.SlowBuffer=T,Tn.INSPECT_MAX_BYTES=50;let r=2147483647;Tn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=o(),!i.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{let m=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(m,u),m.foo()===42}catch{return!1}}Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}});function a(m){if(m>r)throw new RangeError('The value "'+m+'" is invalid for option "size"');let u=new Uint8Array(m);return Object.setPrototypeOf(u,i.prototype),u}function i(m,u,c){if(typeof m=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(m)}return s(m,u,c)}i.poolSize=8192;function s(m,u,c){if(typeof m=="string")return y(m,u);if(ArrayBuffer.isView(m))return h(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(xt(m,ArrayBuffer)||m&&xt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xt(m,SharedArrayBuffer)||m&&xt(m.buffer,SharedArrayBuffer)))return v(m,u,c);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let _=m.valueOf&&m.valueOf();if(_!=null&&_!==m)return i.from(_,u,c);let I=P(m);if(I)return I;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return i.from(m[Symbol.toPrimitive]("string"),u,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}i.from=function(m,u,c){return s(m,u,c)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function l(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function f(m,u,c){return l(m),m<=0?a(m):u!==void 0?typeof c=="string"?a(m).fill(u,c):a(m).fill(u):a(m)}i.alloc=function(m,u,c){return f(m,u,c)};function p(m){return l(m),a(m<0?0:B(m)|0)}i.allocUnsafe=function(m){return p(m)},i.allocUnsafeSlow=function(m){return p(m)};function y(m,u){if((typeof u!="string"||u==="")&&(u="utf8"),!i.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let c=S(m,u)|0,_=a(c),I=_.write(m,u);return I!==c&&(_=_.slice(0,I)),_}function g(m){let u=m.length<0?0:B(m.length)|0,c=a(u);for(let _=0;_<u;_+=1)c[_]=m[_]&255;return c}function h(m){if(xt(m,Uint8Array)){let u=new Uint8Array(m);return v(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function v(m,u,c){if(u<0||m.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');let _;return u===void 0&&c===void 0?_=new Uint8Array(m):c===void 0?_=new Uint8Array(m,u):_=new Uint8Array(m,u,c),Object.setPrototypeOf(_,i.prototype),_}function P(m){if(i.isBuffer(m)){let u=B(m.length)|0,c=a(u);return c.length===0||m.copy(c,0,0,u),c}if(m.length!==void 0)return typeof m.length!="number"||hr(m.length)?a(0):g(m);if(m.type==="Buffer"&&Array.isArray(m.data))return g(m.data)}function B(m){if(m>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return m|0}function T(m){return+m!=m&&(m=0),i.alloc(+m)}i.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==i.prototype},i.compare=function(u,c){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),xt(c,Uint8Array)&&(c=i.from(c,c.offset,c.byteLength)),!i.isBuffer(u)||!i.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===c)return 0;let _=u.length,I=c.length;for(let U=0,W=Math.min(_,I);U<W;++U)if(u[U]!==c[U]){_=u[U],I=c[U];break}return _<I?-1:I<_?1:0},i.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(u,c){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return i.alloc(0);let _;if(c===void 0)for(c=0,_=0;_<u.length;++_)c+=u[_].length;let I=i.allocUnsafe(c),U=0;for(_=0;_<u.length;++_){let W=u[_];if(xt(W,Uint8Array))U+W.length>I.length?(i.isBuffer(W)||(W=i.from(W)),W.copy(I,U)):Uint8Array.prototype.set.call(I,W,U);else if(i.isBuffer(W))W.copy(I,U);else throw new TypeError('"list" argument must be an Array of Buffers');U+=W.length}return I};function S(m,u){if(i.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||xt(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);let c=m.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&c===0)return 0;let I=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return Me(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return Ct(m).length;default:if(I)return _?-1:Me(m).length;u=(""+u).toLowerCase(),I=!0}}i.byteLength=S;function E(m,u,c){let _=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,u>>>=0,c<=u))return"";for(m||(m="utf8");;)switch(m){case"hex":return Pe(this,u,c);case"utf8":case"utf-8":return tt(this,u,c);case"ascii":return ht(this,u,c);case"latin1":case"binary":return Ue(this,u,c);case"base64":return ze(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Se(this,u,c);default:if(_)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),_=!0}}i.prototype._isBuffer=!0;function H(m,u,c){let _=m[u];m[u]=m[c],m[c]=_}i.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let c=0;c<u;c+=2)H(this,c,c+1);return this},i.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let c=0;c<u;c+=4)H(this,c,c+3),H(this,c+1,c+2);return this},i.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let c=0;c<u;c+=8)H(this,c,c+7),H(this,c+1,c+6),H(this,c+2,c+5),H(this,c+3,c+4);return this},i.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?tt(this,0,u):E.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(u){if(!i.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:i.compare(this,u)===0},i.prototype.inspect=function(){let u="",c=Tn.INSPECT_MAX_BYTES;return u=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(u+=" ... "),"<Buffer "+u+">"},n&&(i.prototype[n]=i.prototype.inspect),i.prototype.compare=function(u,c,_,I,U){if(xt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),!i.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(c===void 0&&(c=0),_===void 0&&(_=u?u.length:0),I===void 0&&(I=0),U===void 0&&(U=this.length),c<0||_>u.length||I<0||U>this.length)throw new RangeError("out of range index");if(I>=U&&c>=_)return 0;if(I>=U)return-1;if(c>=_)return 1;if(c>>>=0,_>>>=0,I>>>=0,U>>>=0,this===u)return 0;let W=U-I,Be=_-c,qe=Math.min(W,Be),Ze=this.slice(I,U),Ge=u.slice(c,_);for(let He=0;He<qe;++He)if(Ze[He]!==Ge[He]){W=Ze[He],Be=Ge[He];break}return W<Be?-1:Be<W?1:0};function j(m,u,c,_,I){if(m.length===0)return-1;if(typeof c=="string"?(_=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,hr(c)&&(c=I?0:m.length-1),c<0&&(c=m.length+c),c>=m.length){if(I)return-1;c=m.length-1}else if(c<0)if(I)c=0;else return-1;if(typeof u=="string"&&(u=i.from(u,_)),i.isBuffer(u))return u.length===0?-1:re(m,u,c,_,I);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?I?Uint8Array.prototype.indexOf.call(m,u,c):Uint8Array.prototype.lastIndexOf.call(m,u,c):re(m,[u],c,_,I);throw new TypeError("val must be string, number or Buffer")}function re(m,u,c,_,I){let U=1,W=m.length,Be=u.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(m.length<2||u.length<2)return-1;U=2,W/=2,Be/=2,c/=2}function qe(Ge,He){return U===1?Ge[He]:Ge.readUInt16BE(He*U)}let Ze;if(I){let Ge=-1;for(Ze=c;Ze<W;Ze++)if(qe(m,Ze)===qe(u,Ge===-1?0:Ze-Ge)){if(Ge===-1&&(Ge=Ze),Ze-Ge+1===Be)return Ge*U}else Ge!==-1&&(Ze-=Ze-Ge),Ge=-1}else for(c+Be>W&&(c=W-Be),Ze=c;Ze>=0;Ze--){let Ge=!0;for(let He=0;He<Be;He++)if(qe(m,Ze+He)!==qe(u,He)){Ge=!1;break}if(Ge)return Ze}return-1}i.prototype.includes=function(u,c,_){return this.indexOf(u,c,_)!==-1},i.prototype.indexOf=function(u,c,_){return j(this,u,c,_,!0)},i.prototype.lastIndexOf=function(u,c,_){return j(this,u,c,_,!1)};function ee(m,u,c,_){c=Number(c)||0;let I=m.length-c;_?(_=Number(_),_>I&&(_=I)):_=I;let U=u.length;_>U/2&&(_=U/2);let W;for(W=0;W<_;++W){let Be=parseInt(u.substr(W*2,2),16);if(hr(Be))return W;m[c+W]=Be}return W}function ge(m,u,c,_){return Nt(Me(u,m.length-c),m,c,_)}function ae(m,u,c,_){return Nt(_e(u),m,c,_)}function ie(m,u,c,_){return Nt(Ct(u),m,c,_)}function Oe(m,u,c,_){return Nt($(u,m.length-c),m,c,_)}i.prototype.write=function(u,c,_,I){if(c===void 0)I="utf8",_=this.length,c=0;else if(_===void 0&&typeof c=="string")I=c,_=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(_)?(_=_>>>0,I===void 0&&(I="utf8")):(I=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-c;if((_===void 0||_>U)&&(_=U),u.length>0&&(_<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");let W=!1;for(;;)switch(I){case"hex":return ee(this,u,c,_);case"utf8":case"utf-8":return ge(this,u,c,_);case"ascii":case"latin1":case"binary":return ae(this,u,c,_);case"base64":return ie(this,u,c,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,c,_);default:if(W)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),W=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ze(m,u,c){return u===0&&c===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(u,c))}function tt(m,u,c){c=Math.min(m.length,c);let _=[],I=u;for(;I<c;){let U=m[I],W=null,Be=U>239?4:U>223?3:U>191?2:1;if(I+Be<=c){let qe,Ze,Ge,He;switch(Be){case 1:U<128&&(W=U);break;case 2:qe=m[I+1],(qe&192)===128&&(He=(U&31)<<6|qe&63,He>127&&(W=He));break;case 3:qe=m[I+1],Ze=m[I+2],(qe&192)===128&&(Ze&192)===128&&(He=(U&15)<<12|(qe&63)<<6|Ze&63,He>2047&&(He<55296||He>57343)&&(W=He));break;case 4:qe=m[I+1],Ze=m[I+2],Ge=m[I+3],(qe&192)===128&&(Ze&192)===128&&(Ge&192)===128&&(He=(U&15)<<18|(qe&63)<<12|(Ze&63)<<6|Ge&63,He>65535&&He<1114112&&(W=He))}}W===null?(W=65533,Be=1):W>65535&&(W-=65536,_.push(W>>>10&1023|55296),W=56320|W&1023),_.push(W),I+=Be}return Je(_)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let c="",_=0;for(;_<u;)c+=String.fromCharCode.apply(String,m.slice(_,_+=Ve));return c}function ht(m,u,c){let _="";c=Math.min(m.length,c);for(let I=u;I<c;++I)_+=String.fromCharCode(m[I]&127);return _}function Ue(m,u,c){let _="";c=Math.min(m.length,c);for(let I=u;I<c;++I)_+=String.fromCharCode(m[I]);return _}function Pe(m,u,c){let _=m.length;(!u||u<0)&&(u=0),(!c||c<0||c>_)&&(c=_);let I="";for(let U=u;U<c;++U)I+=ci[m[U]];return I}function Se(m,u,c){let _=m.slice(u,c),I="";for(let U=0;U<_.length-1;U+=2)I+=String.fromCharCode(_[U]+_[U+1]*256);return I}i.prototype.slice=function(u,c){let _=this.length;u=~~u,c=c===void 0?_:~~c,u<0?(u+=_,u<0&&(u=0)):u>_&&(u=_),c<0?(c+=_,c<0&&(c=0)):c>_&&(c=_),c<u&&(c=u);let I=this.subarray(u,c);return Object.setPrototypeOf(I,i.prototype),I};function fe(m,u,c){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+u>c)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(u,c,_){u=u>>>0,c=c>>>0,_||fe(u,c,this.length);let I=this[u],U=1,W=0;for(;++W<c&&(U*=256);)I+=this[u+W]*U;return I},i.prototype.readUintBE=i.prototype.readUIntBE=function(u,c,_){u=u>>>0,c=c>>>0,_||fe(u,c,this.length);let I=this[u+--c],U=1;for(;c>0&&(U*=256);)I+=this[u+--c]*U;return I},i.prototype.readUint8=i.prototype.readUInt8=function(u,c){return u=u>>>0,c||fe(u,1,this.length),this[u]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(u,c){return u=u>>>0,c||fe(u,2,this.length),this[u]|this[u+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(u,c){return u=u>>>0,c||fe(u,2,this.length),this[u]<<8|this[u+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},i.prototype.readBigUInt64LE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,U=this[++u]+this[++u]*2**8+this[++u]*2**16+_*2**24;return BigInt(I)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=c*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],U=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+_;return(BigInt(I)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,c,_){u=u>>>0,c=c>>>0,_||fe(u,c,this.length);let I=this[u],U=1,W=0;for(;++W<c&&(U*=256);)I+=this[u+W]*U;return U*=128,I>=U&&(I-=Math.pow(2,8*c)),I},i.prototype.readIntBE=function(u,c,_){u=u>>>0,c=c>>>0,_||fe(u,c,this.length);let I=c,U=1,W=this[u+--I];for(;I>0&&(U*=256);)W+=this[u+--I]*U;return U*=128,W>=U&&(W-=Math.pow(2,8*c)),W},i.prototype.readInt8=function(u,c){return u=u>>>0,c||fe(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},i.prototype.readInt16LE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let _=this[u]|this[u+1]<<8;return _&32768?_|4294901760:_},i.prototype.readInt16BE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let _=this[u+1]|this[u]<<8;return _&32768?_|4294901760:_},i.prototype.readInt32LE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},i.prototype.readInt32BE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},i.prototype.readBigInt64LE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(_<<24);return(BigInt(I)<<BigInt(32))+BigInt(c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=Et(function(u){u=u>>>0,w(u,"offset");let c=this[u],_=this[u+7];(c===void 0||_===void 0)&&x(u,this.length-8);let I=(c<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(I)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+_)}),i.prototype.readFloatLE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),e.read(this,u,!0,23,4)},i.prototype.readFloatBE=function(u,c){return u=u>>>0,c||fe(u,4,this.length),e.read(this,u,!1,23,4)},i.prototype.readDoubleLE=function(u,c){return u=u>>>0,c||fe(u,8,this.length),e.read(this,u,!0,52,8)},i.prototype.readDoubleBE=function(u,c){return u=u>>>0,c||fe(u,8,this.length),e.read(this,u,!1,52,8)};function ve(m,u,c,_,I,U){if(!i.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>I||u<U)throw new RangeError('"value" argument is out of bounds');if(c+_>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,c,_,I){if(u=+u,c=c>>>0,_=_>>>0,!I){let Be=Math.pow(2,8*_)-1;ve(this,u,c,_,Be,0)}let U=1,W=0;for(this[c]=u&255;++W<_&&(U*=256);)this[c+W]=u/U&255;return c+_},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,c,_,I){if(u=+u,c=c>>>0,_=_>>>0,!I){let Be=Math.pow(2,8*_)-1;ve(this,u,c,_,Be,0)}let U=_-1,W=1;for(this[c+U]=u&255;--U>=0&&(W*=256);)this[c+U]=u/W&255;return c+_},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,1,255,0),this[c]=u&255,c+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,65535,0),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,65535,0),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,4,4294967295,0),this[c+3]=u>>>24,this[c+2]=u>>>16,this[c+1]=u>>>8,this[c]=u&255,c+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,4,4294967295,0),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4};function D(m,u,c,_,I){oe(u,_,I,m,c,7);let U=Number(u&BigInt(4294967295));m[c++]=U,U=U>>8,m[c++]=U,U=U>>8,m[c++]=U,U=U>>8,m[c++]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[c++]=W,W=W>>8,m[c++]=W,W=W>>8,m[c++]=W,W=W>>8,m[c++]=W,c}function K(m,u,c,_,I){oe(u,_,I,m,c,7);let U=Number(u&BigInt(4294967295));m[c+7]=U,U=U>>8,m[c+6]=U,U=U>>8,m[c+5]=U,U=U>>8,m[c+4]=U;let W=Number(u>>BigInt(32)&BigInt(4294967295));return m[c+3]=W,W=W>>8,m[c+2]=W,W=W>>8,m[c+1]=W,W=W>>8,m[c]=W,c+8}i.prototype.writeBigUInt64LE=Et(function(u,c=0){return D(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Et(function(u,c=0){return K(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,c,_,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*_-1);ve(this,u,c,_,qe-1,-qe)}let U=0,W=1,Be=0;for(this[c]=u&255;++U<_&&(W*=256);)u<0&&Be===0&&this[c+U-1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+_},i.prototype.writeIntBE=function(u,c,_,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*_-1);ve(this,u,c,_,qe-1,-qe)}let U=_-1,W=1,Be=0;for(this[c+U]=u&255;--U>=0&&(W*=256);)u<0&&Be===0&&this[c+U+1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+_},i.prototype.writeInt8=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,1,127,-128),u<0&&(u=255+u+1),this[c]=u&255,c+1},i.prototype.writeInt16LE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeInt16BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeInt32LE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,4,2147483647,-2147483648),this[c]=u&255,this[c+1]=u>>>8,this[c+2]=u>>>16,this[c+3]=u>>>24,c+4},i.prototype.writeInt32BE=function(u,c,_){return u=+u,c=c>>>0,_||ve(this,u,c,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4},i.prototype.writeBigInt64LE=Et(function(u,c=0){return D(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Et(function(u,c=0){return K(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,c,_,I,U){if(c+_>m.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function de(m,u,c,_,I){return u=+u,c=c>>>0,I||F(m,u,c,4),e.write(m,u,c,_,23,4),c+4}i.prototype.writeFloatLE=function(u,c,_){return de(this,u,c,!0,_)},i.prototype.writeFloatBE=function(u,c,_){return de(this,u,c,!1,_)};function Te(m,u,c,_,I){return u=+u,c=c>>>0,I||F(m,u,c,8),e.write(m,u,c,_,52,8),c+8}i.prototype.writeDoubleLE=function(u,c,_){return Te(this,u,c,!0,_)},i.prototype.writeDoubleBE=function(u,c,_){return Te(this,u,c,!1,_)},i.prototype.copy=function(u,c,_,I){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(_||(_=0),!I&&I!==0&&(I=this.length),c>=u.length&&(c=u.length),c||(c=0),I>0&&I<_&&(I=_),I===_||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),u.length-c<I-_&&(I=u.length-c+_);let U=I-_;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,_,I):Uint8Array.prototype.set.call(u,this.subarray(_,I),c),U},i.prototype.fill=function(u,c,_,I){if(typeof u=="string"){if(typeof c=="string"?(I=c,c=0,_=this.length):typeof _=="string"&&(I=_,_=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!i.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(u.length===1){let W=u.charCodeAt(0);(I==="utf8"&&W<128||I==="latin1")&&(u=W)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(c<0||this.length<c||this.length<_)throw new RangeError("Out of range index");if(_<=c)return this;c=c>>>0,_=_===void 0?this.length:_>>>0,u||(u=0);let U;if(typeof u=="number")for(U=c;U<_;++U)this[U]=u;else{let W=i.isBuffer(u)?u:i.from(u,I),Be=W.length;if(Be===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(U=0;U<_-c;++U)this[U+c]=W[U%Be]}return this};let M={};function k(m,u,c){M[m]=class extends c{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${m}]`,this.stack,delete this.name}get code(){return m}set code(I){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:I,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}k("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),k("ERR_INVALID_ARG_TYPE",function(m,u){return`The "${m}" argument must be of type number. Received type ${typeof u}`},TypeError),k("ERR_OUT_OF_RANGE",function(m,u,c){let _=`The value of "${m}" is out of range.`,I=c;return Number.isInteger(c)&&Math.abs(c)>2**32?I=Z(String(c)):typeof c=="bigint"&&(I=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(I=Z(I)),I+="n"),_+=` It must be ${u}. Received ${I}`,_},RangeError);function Z(m){let u="",c=m.length,_=m[0]==="-"?1:0;for(;c>=_+4;c-=3)u=`_${m.slice(c-3,c)}${u}`;return`${m.slice(0,c)}${u}`}function Y(m,u,c){w(u,"offset"),(m[u]===void 0||m[u+c]===void 0)&&x(u,m.length-(c+1))}function oe(m,u,c,_,I,U){if(m>c||m<u){let W=typeof u=="bigint"?"n":"",Be;throw u===0||u===BigInt(0)?Be=`>= 0${W} and < 2${W} ** ${(U+1)*8}${W}`:Be=`>= -(2${W} ** ${(U+1)*8-1}${W}) and < 2 ** ${(U+1)*8-1}${W}`,new M.ERR_OUT_OF_RANGE("value",Be,m)}Y(_,I,U)}function w(m,u){if(typeof m!="number")throw new M.ERR_INVALID_ARG_TYPE(u,"number",m)}function x(m,u,c){throw Math.floor(m)!==m?(w(m,c),new M.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new M.ERR_BUFFER_OUT_OF_BOUNDS:new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,m)}let z=/[^+/0-9A-Za-z-_]/g;function Q(m){if(m=m.split("=")[0],m=m.trim().replace(z,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Me(m,u){u=u||1/0;let c,_=m.length,I=null,U=[];for(let W=0;W<_;++W){if(c=m.charCodeAt(W),c>55295&&c<57344){if(!I){if(c>56319){(u-=3)>-1&&U.push(239,191,189);continue}else if(W+1===_){(u-=3)>-1&&U.push(239,191,189);continue}I=c;continue}if(c<56320){(u-=3)>-1&&U.push(239,191,189),I=c;continue}c=(I-55296<<10|c-56320)+65536}else I&&(u-=3)>-1&&U.push(239,191,189);if(I=null,c<128){if((u-=1)<0)break;U.push(c)}else if(c<2048){if((u-=2)<0)break;U.push(c>>6|192,c&63|128)}else if(c<65536){if((u-=3)<0)break;U.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((u-=4)<0)break;U.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return U}function _e(m){let u=[];for(let c=0;c<m.length;++c)u.push(m.charCodeAt(c)&255);return u}function $(m,u){let c,_,I,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)c=m.charCodeAt(W),_=c>>8,I=c%256,U.push(I),U.push(_);return U}function Ct(m){return t.toByteArray(Q(m))}function Nt(m,u,c,_){let I;for(I=0;I<_&&!(I+c>=u.length||I>=m.length);++I)u[I+c]=m[I];return I}function xt(m,u){return m instanceof u||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===u.name}function hr(m){return m!==m}let ci=(function(){let m="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){let _=c*16;for(let I=0;I<16;++I)u[_+I]=m[c]+m[I]}return u})();function Et(m){return typeof BigInt>"u"?vr:m}function vr(){throw new Error("BigInt not supported")}return Tn}var Tr,pc,gi,gc,Tn,yc,yi=at(()=>{A();O();C();Tr={},pc=!1;gi={},gc=!1;Tn={},yc=!1});var _n,q,wA,xA,mc=at(()=>{A();O();C();yi();_n=Dt();_n.Buffer;_n.SlowBuffer;_n.INSPECT_MAX_BYTES;_n.kMaxLength;q=_n.Buffer,wA=_n.INSPECT_MAX_BYTES,xA=_n.kMaxLength});var O=at(()=>{mc()});function Ht(){return Uy||(Uy=!0,typeof Object.create=="function"?Po=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Po=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Po}var Po,Uy,as=at(()=>{A();O();C();Po={},Uy=!1});function Ne(){Ne.init.call(this)}function Bo(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function Gy(t){return t._maxListeners===void 0?Ne.defaultMaxListeners:t._maxListeners}function Ky(t,e,n,r){var o,a,i,s;if(Bo(n),(a=t._events)===void 0?(a=t._events=Object.create(null),t._eventsCount=0):(a.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),a=t._events),i=a[e]),i===void 0)i=a[e]=n,++t._eventsCount;else if(typeof i=="function"?i=a[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(o=Gy(t))>0&&i.length>o&&!i.warned){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=i.length,s=l,console&&console.warn&&console.warn(s)}return t}function WB(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ly(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=WB.bind(r);return o.listener=n,r.wrapFn=o,o}function Fy(t,e,n){var r=t._events;if(r===void 0)return[];var o=r[e];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?(function(a){for(var i=new Array(a.length),s=0;s<i.length;++s)i[s]=a[s].listener||a[s];return i})(o):Vy(o,o.length)}function Wy(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}function Vy(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}var zy,qy,ar,$y,Zy,jy,_t,ss=at(()=>{A();O();C();ar=typeof Reflect=="object"?Reflect:null,$y=ar&&typeof ar.apply=="function"?ar.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};qy=ar&&typeof ar.ownKeys=="function"?ar.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Zy=Number.isNaN||function(t){return t!=t};zy=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;jy=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return jy},set:function(t){if(typeof t!="number"||t<0||Zy(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");jy=t}}),Ne.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ne.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Zy(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},Ne.prototype.getMaxListeners=function(){return Gy(this)},Ne.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",o=this._events;if(o!==void 0)r=r&&o.error===void 0;else if(!r)return!1;if(r){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var i=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw i.context=a,i}var s=o[t];if(s===void 0)return!1;if(typeof s=="function")$y(s,this,e);else{var l=s.length,f=Vy(s,l);for(n=0;n<l;++n)$y(f[n],this,e)}return!0},Ne.prototype.addListener=function(t,e){return Ky(this,t,e,!1)},Ne.prototype.on=Ne.prototype.addListener,Ne.prototype.prependListener=function(t,e){return Ky(this,t,e,!0)},Ne.prototype.once=function(t,e){return Bo(e),this.on(t,Ly(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return Bo(e),this.prependListener(t,Ly(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,o,a,i;if(Bo(e),(r=this._events)===void 0)return this;if((n=r[t])===void 0)return this;if(n===e||n.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(o=-1,a=n.length-1;a>=0;a--)if(n[a]===e||n[a].listener===e){i=n[a].listener,o=a;break}if(o<0)return this;o===0?n.shift():(function(s,l){for(;l+1<s.length;l++)s[l]=s[l+1];s.pop()})(n,o),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,i||e)}return this},Ne.prototype.off=Ne.prototype.removeListener,Ne.prototype.removeAllListeners=function(t){var e,n,r;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var o,a=Object.keys(n);for(r=0;r<a.length;++r)(o=a[r])!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=n[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},Ne.prototype.listeners=function(t){return Fy(this,t,!0)},Ne.prototype.rawListeners=function(t){return Fy(this,t,!1)},Ne.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Wy.call(t,e)},Ne.prototype.listenerCount=Wy,Ne.prototype.eventNames=function(){return this._eventsCount>0?qy(this._events):[]};_t=zy;_t.EventEmitter;_t.defaultMaxListeners;_t.init;_t.listenerCount;_t.EventEmitter;_t.defaultMaxListeners;_t.init;_t.listenerCount});var Jy=at(()=>{A();O();C();ss();_t.once=function(t,e){return new Promise((n,r)=>{function o(...i){a!==void 0&&t.removeListener("error",a),n(i)}let a;e!=="error"&&(a=i=>{t.removeListener(name,o),r(i)},t.once("error",a)),t.once(e,o)})};_t.on=function(t,e){let n=[],r=[],o=null,a=!1,i={async next(){let f=n.shift();if(f)return createIterResult(f,!1);if(o){let p=Promise.reject(o);return o=null,p}return a?createIterResult(void 0,!0):new Promise((p,y)=>r.push({resolve:p,reject:y}))},async return(){t.removeListener(e,s),t.removeListener("error",l),a=!0;for(let f of r)f.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(f){o=f,t.removeListener(e,s),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,s),t.on("error",l),i;function s(...f){let p=r.shift();p?p.resolve(createIterResult(f,!1)):n.push(f)}function l(f){a=!0;let p=r.shift();p?p.reject(f):o=f,i.return()}}});function ds(){throw new Error("setTimeout has not been defined")}function ps(){throw new Error("clearTimeout has not been defined")}function cm(t){if(Jt===setTimeout)return setTimeout(t,0);if((Jt===ds||!Jt)&&setTimeout)return Jt=setTimeout,setTimeout(t,0);try{return Jt(t,0)}catch{try{return Jt.call(null,t,0)}catch{return Jt.call(this||lr,t,0)}}}function zB(){sr&&Un&&(sr=!1,Un.length?Xt=Un.concat(Xt):Co=-1,Xt.length&&fm())}function fm(){if(!sr){var t=cm(zB);sr=!0;for(var e=Xt.length;e;){for(Un=Xt,Xt=[];++Co<e;)Un&&Un[Co].run();Co=-1,e=Xt.length}Un=null,sr=!1,(function(n){if(Yt===clearTimeout)return clearTimeout(n);if((Yt===ps||!Yt)&&clearTimeout)return Yt=clearTimeout,clearTimeout(n);try{Yt(n)}catch{try{return Yt.call(null,n)}catch{return Yt.call(this||lr,n)}}})(t)}}function Yy(t,e){(this||lr).fun=t,(this||lr).array=e}function Vt(){}function Zn(t){return t.call.bind(t)}function Xr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function Qy(t){return bt&&Pt?St(t)!==void 0:hm(t)||vm(t)||Tm(t)||_m(t)||bm(t)||wm(t)||xm(t)||Pm(t)||Bm(t)||Em(t)||Sm(t)}function hm(t){return bt&&Pt?St(t)==="Uint8Array":We(t)==="[object Uint8Array]"||nE(t)&&t.buffer!==void 0}function vm(t){return bt&&Pt?St(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function Tm(t){return bt&&Pt?St(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function _m(t){return bt&&Pt?St(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function bm(t){return bt&&Pt?St(t)==="Int8Array":We(t)==="[object Int8Array]"}function wm(t){return bt&&Pt?St(t)==="Int16Array":We(t)==="[object Int16Array]"}function xm(t){return bt&&Pt?St(t)==="Int32Array":We(t)==="[object Int32Array]"}function Pm(t){return bt&&Pt?St(t)==="Float32Array":We(t)==="[object Float32Array]"}function Bm(t){return bt&&Pt?St(t)==="Float64Array":We(t)==="[object Float64Array]"}function Em(t){return bt&&Pt?St(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Sm(t){return bt&&Pt?St(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function Eo(t){return We(t)==="[object Map]"}function So(t){return We(t)==="[object Set]"}function ko(t){return We(t)==="[object WeakMap]"}function ls(t){return We(t)==="[object WeakSet]"}function Ro(t){return We(t)==="[object ArrayBuffer]"}function em(t){return typeof ArrayBuffer<"u"&&(Ro.working?Ro(t):t instanceof ArrayBuffer)}function Mo(t){return We(t)==="[object DataView]"}function tm(t){return typeof DataView<"u"&&(Mo.working?Mo(t):t instanceof DataView)}function No(t){return We(t)==="[object SharedArrayBuffer]"}function nm(t){return typeof SharedArrayBuffer<"u"&&(No.working?No(t):t instanceof SharedArrayBuffer)}function rm(t){return Xr(t,sE)}function im(t){return Xr(t,lE)}function om(t){return Xr(t,uE)}function am(t){return mm&&Xr(t,cE)}function sm(t){return ys&&Xr(t,fE)}function fn(t,e){var n={seen:[],stylize:gE};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),ms(e)?n.showHidden=e:e&&L._extend(n,e),$n(n.showHidden)&&(n.showHidden=!1),$n(n.depth)&&(n.depth=2),$n(n.colors)&&(n.colors=!1),$n(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=pE),Do(n,t,n.depth)}function pE(t,e){var n=fn.styles[e];return n?"\x1B["+fn.colors[n][0]+"m"+t+"\x1B["+fn.colors[n][1]+"m":t}function gE(t,e){return t}function Do(t,e,n){if(t.customInspect&&e&&Oo(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ho(r)||(r=Do(t,r,n)),r}var o=(function(g,h){if($n(h))return g.stylize("undefined","undefined");if(Ho(h)){var v="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(v,"string")}if(Am(h))return g.stylize(""+h,"number");if(ms(h))return g.stylize(""+h,"boolean");if(Zo(h))return g.stylize("null","null")})(t,e);if(o)return o;var a=Object.keys(e),i=(function(g){var h={};return g.forEach((function(v,P){h[v]=!0})),h})(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),Yr(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return us(e);if(a.length===0){if(Oo(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Jr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Uo(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Yr(e))return us(e)}var l,f="",p=!1,y=["{","}"];return Im(e)&&(p=!0,y=["[","]"]),Oo(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),Jr(e)&&(f=" "+RegExp.prototype.toString.call(e)),Uo(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Yr(e)&&(f=" "+us(e)),a.length!==0||p&&e.length!=0?n<0?Jr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=p?(function(g,h,v,P,B){for(var T=[],S=0,E=h.length;S<E;++S)Cm(h,String(S))?T.push(cs(g,h,v,P,String(S),!0)):T.push("");return B.forEach((function(H){H.match(/^\d+$/)||T.push(cs(g,h,v,P,H,!0))})),T})(t,e,n,i,a):a.map((function(g){return cs(t,e,n,i,g,p)})),t.seen.pop(),(function(g,h,v){var P=0;return g.reduce((function(B,T){return P++,T.indexOf(`
|
|
2
2
|
`)>=0&&P++,B+T.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?v[0]+(h===""?"":h+`
|
|
3
3
|
`)+" "+g.join(`,
|
|
4
|
-
`)+" "+v[1]:v[0]+h+" "+g.join(", ")+" "+v[1]})(l,f,y)):y[0]+f+y[1]}function us(t){return"["+Error.prototype.toString.call(t)+"]"}function cs(t,e,n,r,o,a){var i,s,l;if((l=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),
|
|
4
|
+
`)+" "+v[1]:v[0]+h+" "+g.join(", ")+" "+v[1]})(l,f,y)):y[0]+f+y[1]}function us(t){return"["+Error.prototype.toString.call(t)+"]"}function cs(t,e,n,r,o,a){var i,s,l;if((l=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),Cm(r,o)||(i="["+o+"]"),s||(t.seen.indexOf(l.value)<0?(s=Zo(n)?Do(t,l.value,null):Do(t,l.value,n-1)).indexOf(`
|
|
5
5
|
`)>-1&&(s=a?s.split(`
|
|
6
6
|
`).map((function(f){return" "+f})).join(`
|
|
7
7
|
`).substr(2):`
|
|
8
8
|
`+s.split(`
|
|
9
9
|
`).map((function(f){return" "+f})).join(`
|
|
10
|
-
`)):s=t.stylize("[Circular]","special")),$n(i)){if(a&&o.match(/^\d+$/))return s;(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+s}function km(t){return Array.isArray(t)}function ms(t){return typeof t=="boolean"}function Zo(t){return t===null}function Im(t){return typeof t=="number"}function Ho(t){return typeof t=="string"}function $n(t){return t===void 0}function Jr(t){return ur(t)&&hs(t)==="[object RegExp]"}function ur(t){return typeof t=="object"&&t!==null}function Uo(t){return ur(t)&&hs(t)==="[object Date]"}function Yr(t){return ur(t)&&(hs(t)==="[object Error]"||t instanceof Error)}function Oo(t){return typeof t=="function"}function hs(t){return Object.prototype.toString.call(t)}function fs(t){return t<10?"0"+t.toString(10):t.toString(10)}function yE(){var t=new Date,e=[fs(t.getHours()),fs(t.getMinutes()),fs(t.getSeconds())].join(":");return[t.getDate(),gE[t.getMonth()],e].join(" ")}function Am(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function mE(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var lm,Jt,Yt,lr,Qe,Un,Xt,sr,Co,je,zB,gs,$o,fm,qB,GB,VB,JB,YB,dm,pm,Yy,XB,QB,eE,gm,Ee,tE,nE,rE,ym,ys,Pt,bt,iE,We,aE,sE,lE,Vr,L,Ut,sm,fE,Io,Sm,Ao,gE,Hn,OC,jo=at(()=>{A();O();C();lr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=lm={};(function(){try{Jt=typeof setTimeout=="function"?setTimeout:ds}catch{Jt=ds}try{Yt=typeof clearTimeout=="function"?clearTimeout:ps}catch{Yt=ps}})();Xt=[],sr=!1,Co=-1;Qe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Xt.push(new Jy(t,e)),Xt.length!==1||sr||um(cm)},Jy.prototype.run=function(){(this||lr).fun.apply(null,(this||lr).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=Vt,Qe.addListener=Vt,Qe.once=Vt,Qe.off=Vt,Qe.removeListener=Vt,Qe.removeAllListeners=Vt,Qe.emit=Vt,Qe.prependListener=Vt,Qe.prependOnceListener=Vt,Qe.listeners=function(t){return[]},Qe.binding=function(t){throw new Error("process.binding is not supported")},Qe.cwd=function(){return"/"},Qe.chdir=function(t){throw new Error("process.chdir is not supported")},Qe.umask=function(){return 0};je=lm;je.addListener;je.argv;je.binding;je.browser;je.chdir;je.cwd;je.emit;je.env;je.listeners;je.nextTick;je.off;je.on;je.once;je.prependListener;je.prependOnceListener;je.removeAllListeners;je.removeListener;je.title;je.umask;je.version;je.versions;zB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",gs=Object.prototype.toString,$o=function(t){return!(zB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&gs.call(t)==="[object Arguments]"},fm=function(t){return!!$o(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&gs.call(t)!=="[object Array]"&&gs.call(t.callee)==="[object Function]"},qB=(function(){return $o(arguments)})();$o.isLegacyArguments=fm;GB=qB?$o:fm,VB=Object.prototype.toString,JB=Function.prototype.toString,YB=/^\s*(?:function)?\*/,dm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",pm=Object.getPrototypeOf,Yy=(function(){if(!dm)return!1;try{return Function("return function*() {}")()}catch{}})(),XB=Yy?pm(Yy):{},QB=function(t){return typeof t=="function"&&(!!YB.test(JB.call(t))||(dm?pm(t)===XB:VB.call(t)==="[object GeneratorFunction]"))},eE=typeof Object.create=="function"?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},gm=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},tE=gm,nE=GB,rE=QB;ym=typeof BigInt<"u",ys=typeof Symbol<"u",Pt=ys&&Symbol.toStringTag!==void 0,bt=typeof Uint8Array<"u",iE=typeof ArrayBuffer<"u";if(bt&&Pt)var oE=Object.getPrototypeOf(Uint8Array.prototype),St=Zn(Object.getOwnPropertyDescriptor(oE,Symbol.toStringTag).get);We=Zn(Object.prototype.toString),aE=Zn(Number.prototype.valueOf),sE=Zn(String.prototype.valueOf),lE=Zn(Boolean.prototype.valueOf);if(ym)var uE=Zn(BigInt.prototype.valueOf);if(ys)var cE=Zn(Symbol.prototype.valueOf);Ee.isArgumentsObject=nE,Ee.isGeneratorFunction=rE,Ee.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},Ee.isArrayBufferView=function(t){return iE&&ArrayBuffer.isView?ArrayBuffer.isView(t):Xy(t)||em(t)},Ee.isTypedArray=Xy,Ee.isUint8Array=mm,Ee.isUint8ClampedArray=hm,Ee.isUint16Array=vm,Ee.isUint32Array=Tm,Ee.isInt8Array=_m,Ee.isInt16Array=bm,Ee.isInt32Array=wm,Ee.isFloat32Array=xm,Ee.isFloat64Array=Pm,Ee.isBigInt64Array=Bm,Ee.isBigUint64Array=Em,Eo.working=typeof Map<"u"&&Eo(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(Eo.working?Eo(t):t instanceof Map)},So.working=typeof Set<"u"&&So(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(So.working?So(t):t instanceof Set)},ko.working=typeof WeakMap<"u"&&ko(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(ko.working?ko(t):t instanceof WeakMap)},ls.working=typeof WeakSet<"u"&&ls(new WeakSet),Ee.isWeakSet=function(t){return ls(t)},Ro.working=typeof ArrayBuffer<"u"&&Ro(new ArrayBuffer),Ee.isArrayBuffer=Qy,Mo.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Mo(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=em,No.working=typeof SharedArrayBuffer<"u"&&No(new SharedArrayBuffer),Ee.isSharedArrayBuffer=tm,Ee.isAsyncFunction=function(t){return We(t)==="[object AsyncFunction]"},Ee.isMapIterator=function(t){return We(t)==="[object Map Iterator]"},Ee.isSetIterator=function(t){return We(t)==="[object Set Iterator]"},Ee.isGeneratorObject=function(t){return We(t)==="[object Generator]"},Ee.isWebAssemblyCompiledModule=function(t){return We(t)==="[object WebAssembly.Module]"},Ee.isNumberObject=nm,Ee.isStringObject=rm,Ee.isBooleanObject=im,Ee.isBigIntObject=om,Ee.isSymbolObject=am,Ee.isBoxedPrimitive=function(t){return nm(t)||rm(t)||im(t)||om(t)||am(t)},Ee.isAnyArrayBuffer=function(t){return bt&&(Qy(t)||tm(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Ut=je,sm=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},fE=/%[sdj%]/g;L.format=function(t){if(!Ho(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(fn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,a=String(t).replace(fE,(function(s){if(s==="%%")return"%";if(n>=o)return s;switch(s){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return s}})),i=r[n];n<o;i=r[++n])Zo(i)||!ur(i)?a+=" "+i:a+=" "+fn(i);return a},L.deprecate=function(t,e){if(Ut!==void 0&&Ut.noDeprecation===!0)return t;if(Ut===void 0)return function(){return L.deprecate(t,e).apply(this||Vr,arguments)};var n=!1;return function(){if(!n){if(Ut.throwDeprecation)throw new Error(e);Ut.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Vr,arguments)}};Io={},Sm=/^$/;Ut.env.NODE_DEBUG&&(Ao=Ut.env.NODE_DEBUG,Ao=Ao.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Sm=new RegExp("^"+Ao+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Io[t])if(Sm.test(t)){var e=Ut.pid;Io[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Io[t]=function(){};return Io[t]},L.inspect=fn,fn.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},fn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=km,L.isBoolean=ms,L.isNull=Zo,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Im,L.isString=Ho,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=$n,L.isRegExp=Jr,L.types.isRegExp=Jr,L.isObject=ur,L.isDate=Uo,L.types.isDate=Uo,L.isError=Yr,L.types.isNativeError=Yr,L.isFunction=Oo,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=gm;gE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",yE(),L.format.apply(L,arguments))},L.inherits=eE,L._extend=function(t,e){if(!e||!ur(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Hn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;L.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Hn&&t[Hn]){var e;if(typeof(e=t[Hn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Hn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,o=new Promise((function(s,l){n=s,r=l})),a=[],i=0;i<arguments.length;i++)a.push(arguments[i]);a.push((function(s,l){s?r(s):n(l)}));try{t.apply(this||Vr,a)}catch(s){r(s)}return o}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Hn&&Object.defineProperty(e,Hn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,sm(t))},L.promisify.custom=Hn,L.callbackify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=n.pop();if(typeof o!="function")throw new TypeError("The last argument must be of type Function");var a=this||Vr,i=function(){return o.apply(a,arguments)};t.apply(this||Vr,n).then((function(s){Ut.nextTick(i.bind(null,null,s))}),(function(s){Ut.nextTick(mE.bind(null,s,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,sm(t)),e};L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;L.promisify;L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;OC=L.promisify;L.types});var UC,Cm=at(()=>{A();O();C();jo();L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;UC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function bs(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function hE(){!cr||!jn||(cr=!1,jn.length?Qt=jn.concat(Qt):Ko=-1,Qt.length&&Om())}function Om(){if(!cr){var t=setTimeout(hE,0);cr=!0;for(var e=Qt.length;e;){for(jn=Qt,Qt=[];++Ko<e;)jn&&jn[Ko].run();Ko=-1,e=Qt.length}jn=null,cr=!1,clearTimeout(t)}}function vE(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Qt.push(new Rm(t,e)),Qt.length===1&&!cr&&setTimeout(Om,0)}function Rm(t,e){this.fun=t,this.array=e}function ct(){}function NE(t){bs("_linkedBinding")}function $E(t){bs("dlopen")}function ZE(){return[]}function jE(){return[]}function JE(t,e){if(!t)throw new Error(e||"assertion error")}function eS(){return!1}function hS(){return dn.now()/1e3}function _s(t){var e=Math.floor((Date.now()-dn.now())*.001),n=dn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=Ts)),[r,o]}function pn(){return Rt}function IS(t){return[]}var Qt,cr,jn,Ko,TE,_E,bE,wE,xE,PE,BE,EE,SE,kE,IE,AE,CE,OE,RE,ME,DE,HE,UE,KE,LE,ws,FE,WE,zE,qE,GE,VE,YE,XE,QE,tS,nS,rS,iS,oS,aS,sS,lS,uS,cS,fS,dS,pS,gS,yS,mS,dn,vs,Ts,vS,TS,_S,bS,wS,xS,PS,BS,ES,SS,kS,Rt,xs=at(()=>{A();O();C();Qt=[],cr=!1,Ko=-1;Rm.prototype.run=function(){this.fun.apply(null,this.array)};TE="browser",_E="x64",bE="browser",wE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},xE=["/usr/bin/node"],PE=[],BE="v16.8.0",EE={},SE=function(t,e){console.warn((e?e+": ":"")+t)},kE=function(t){bs("binding")},IE=function(t){return 0},AE=function(){return"/"},CE=function(t){},OE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};RE=ct,ME=[];DE={},HE=!1,UE={};KE=ct,LE=ct,ws=function(){return{}},FE=ws,WE=ws,zE=ct,qE=ct,GE=ct,VE={};YE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},XE=ct,QE=ct;tS=ct,nS=ct,rS=ct,iS=ct,oS=ct,aS=void 0,sS=void 0,lS=void 0,uS=ct,cS=2,fS=1,dS="/bin/usr/node",pS=9229,gS="node",yS=[],mS=ct,dn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};dn.now===void 0&&(vs=Date.now(),dn.timing&&dn.timing.navigationStart&&(vs=dn.timing.navigationStart),dn.now=()=>Date.now()-vs);Ts=1e9;_s.bigint=function(t){var e=_s(t);return typeof BigInt>"u"?e[0]*Ts+e[1]:BigInt(e[0]*Ts)+BigInt(e[1])};vS=10,TS={},_S=0;bS=pn,wS=pn,xS=pn,PS=pn,BS=pn,ES=ct,SS=pn,kS=pn;Rt={version:BE,versions:EE,arch:_E,platform:bE,release:OE,_rawDebug:RE,moduleLoadList:ME,binding:kE,_linkedBinding:NE,_events:TS,_eventsCount:_S,_maxListeners:vS,on:pn,addListener:bS,once:wS,off:xS,removeListener:PS,removeAllListeners:BS,emit:ES,prependListener:SS,prependOnceListener:kS,listeners:IS,domain:DE,_exiting:HE,config:UE,dlopen:$E,uptime:hS,_getActiveRequests:ZE,_getActiveHandles:jE,reallyExit:KE,_kill:LE,cpuUsage:ws,resourceUsage:FE,memoryUsage:WE,kill:zE,exit:qE,openStdin:GE,allowedNodeEnvironmentFlags:VE,assert:JE,features:YE,_fatalExceptions:XE,setUncaughtExceptionCaptureCallback:QE,hasUncaughtExceptionCaptureCallback:eS,emitWarning:SE,nextTick:vE,_tickCallback:tS,_debugProcess:nS,_debugEnd:rS,_startProfilerIdleNotifier:iS,_stopProfilerIdleNotifier:oS,stdout:aS,stdin:lS,stderr:sS,abort:uS,umask:IE,chdir:CE,cwd:AE,env:wE,title:TE,argv:xE,execArgv:PE,pid:cS,ppid:fS,execPath:dS,debugPort:pS,hrtime:_s,argv0:gS,_preload_modules:yS,setSourceMapsEnabled:mS}});function Nm(){if(Mm)return Ps;Mm=!0,Ps=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function a(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this||Bs,arguments)}return a}function e(n){try{if(!Bs.localStorage)return!1}catch{return!1}var r=Bs.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return Ps}var Ps,Mm,Bs,Dm=at(()=>{A();O();C();Ps={},Mm=!1,Bs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function AS(){if(Hm)return Qr;Hm=!0;var t=Dt(),e=t.Buffer;function n(o,a){for(var i in o)a[i]=o[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Qr=t:(n(t,Qr),Qr.Buffer=r);function r(o,a,i){return e(o,a,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(o,a,i){if(typeof o=="number")throw new TypeError("Argument must not be a number");return e(o,a,i)},r.alloc=function(o,a,i){if(typeof o!="number")throw new TypeError("Argument must be a number");var s=e(o);return a!==void 0?typeof i=="string"?s.fill(a,i):s.fill(a):s.fill(0),s},r.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e(o)},r.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)},Qr}function CS(){if(Um)return Es;Um=!0;var t=AS().Buffer,e=t.isEncoding||function(T){switch(T=""+T,T&&T.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(T){if(!T)return"utf8";for(var S;;)switch(T){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return T;default:if(S)return;T=(""+T).toLowerCase(),S=!0}}function r(T){var S=n(T);if(typeof S!="string"&&(t.isEncoding===e||!e(T)))throw new Error("Unknown encoding: "+T);return S||T}Es.StringDecoder=o;function o(T){this.encoding=r(T);var S;switch(this.encoding){case"utf16le":this.text=y,this.end=g,S=4;break;case"utf8":this.fillLast=l,S=4;break;case"base64":this.text=h,this.end=v,S=3;break;default:this.write=P,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}o.prototype.write=function(T){if(T.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(T),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<T.length?S?S+this.text(T,E):this.text(T,E):S||""},o.prototype.end=p,o.prototype.text=f,o.prototype.fillLast=function(T){if(this.lastNeed<=T.length)return T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,T.length),this.lastNeed-=T.length};function a(T){return T<=127?0:T>>5===6?2:T>>4===14?3:T>>3===30?4:T>>6===2?-1:-2}function i(T,S,E){var H=S.length-1;if(H<E)return 0;var j=a(S[H]);return j>=0?(j>0&&(T.lastNeed=j-1),j):--H<E||j===-2?0:(j=a(S[H]),j>=0?(j>0&&(T.lastNeed=j-2),j):--H<E||j===-2?0:(j=a(S[H]),j>=0?(j>0&&(j===2?j=0:T.lastNeed=j-3),j):0))}function s(T,S,E){if((S[0]&192)!==128)return T.lastNeed=0,"\uFFFD";if(T.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return T.lastNeed=1,"\uFFFD";if(T.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return T.lastNeed=2,"\uFFFD"}}function l(T){var S=this.lastTotal-this.lastNeed,E=s(this,T);if(E!==void 0)return E;if(this.lastNeed<=T.length)return T.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,S,0,T.length),this.lastNeed-=T.length}function f(T,S){var E=i(this,T,S);if(!this.lastNeed)return T.toString("utf8",S);this.lastTotal=E;var H=T.length-(E-this.lastNeed);return T.copy(this.lastChar,0,H),T.toString("utf8",S,H)}function p(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+"\uFFFD":S}function y(T,S){if((T.length-S)%2===0){var E=T.toString("utf16le",S);if(E){var H=E.charCodeAt(E.length-1);if(H>=55296&&H<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=T[T.length-1],T.toString("utf16le",S,T.length-1)}function g(T){var S=T&&T.length?this.write(T):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(T,S){var E=(T.length-S)%3;return E===0?T.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=T[T.length-1]:(this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1]),T.toString("base64",S,T.length-E))}function v(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function P(T){return T.toString(this.encoding)}function B(T){return T&&T.length?this.write(T):""}return Es}var Qr,Hm,Es,Um,ei,XC,$m=at(()=>{A();O();C();yi();Qr={},Hm=!1;Es={},Um=!1;ei=CS();ei.StringDecoder;XC=ei.StringDecoder});function OS(){if(Zm)return Ss;Zm=!0;var t=Ss={},e,n;function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?n=clearTimeout:n=o}catch{n=o}})();function a(P){if(e===setTimeout)return setTimeout(P,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(P,0);try{return e(P,0)}catch{try{return e.call(null,P,0)}catch{return e.call(this||fr,P,0)}}}function i(P){if(n===clearTimeout)return clearTimeout(P);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||fr,P)}}}var s=[],l=!1,f,p=-1;function y(){!l||!f||(l=!1,f.length?s=f.concat(s):p=-1,s.length&&g())}function g(){if(!l){var P=a(y);l=!0;for(var B=s.length;B;){for(f=s,s=[];++p<B;)f&&f[p].run();p=-1,B=s.length}f=null,l=!1,i(P)}}t.nextTick=function(P){var B=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)B[T-1]=arguments[T];s.push(new h(P,B)),s.length===1&&!l&&a(g)};function h(P,B){(this||fr).fun=P,(this||fr).array=B}h.prototype.run=function(){(this||fr).fun.apply(null,(this||fr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function v(){}return t.on=v,t.addListener=v,t.once=v,t.off=v,t.removeListener=v,t.removeAllListeners=v,t.emit=v,t.prependListener=v,t.prependOnceListener=v,t.listeners=function(P){return[]},t.binding=function(P){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(P){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},Ss}var Ss,Zm,fr,Ke,ks=at(()=>{A();O();C();Ss={},Zm=!1,fr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=OS();Ke.platform="browser";Ke.addListener;Ke.argv;Ke.binding;Ke.browser;Ke.chdir;Ke.cwd;Ke.emit;Ke.env;Ke.listeners;Ke.nextTick;Ke.off;Ke.on;Ke.once;Ke.prependListener;Ke.prependOnceListener;Ke.removeAllListeners;Ke.removeListener;Ke.title;Ke.umask;Ke.version;Ke.versions});function RS(){if(jm)return Is;jm=!0;var t=Ke;function e(a){if(typeof a!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function n(a,i){for(var s="",l=0,f=-1,p=0,y,g=0;g<=a.length;++g){if(g<a.length)y=a.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||p===1))if(f!==g-1&&p===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",l=0):(s=s.slice(0,h),l=s.length-1-s.lastIndexOf("/")),f=g,p=0;continue}}else if(s.length===2||s.length===1){s="",l=0,f=g,p=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+a.slice(f+1,g):s=a.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return s}function r(a,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+a+l:l}var o={resolve:function(){for(var i="",s=!1,l,f=arguments.length-1;f>=-1&&!s;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,s=p.charCodeAt(0)===47)}return i=n(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=o.resolve(i),s=o.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<s.length&&s.charCodeAt(y)===47;++y);for(var g=s.length,h=g-y,v=p<h?p:h,P=-1,B=0;B<=v;++B){if(B===v){if(h>v){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>v&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(T!==S)break;T===47&&(P=B)}var E="";for(B=l+P+1;B<=f;++B)(B===f||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+s.slice(y+P):(y+=P,s.charCodeAt(y)===47&&++y,s.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(s=i.charCodeAt(y),s===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var g=s.length-1,h=-1;for(y=i.length-1;y>=0;--y){var v=i.charCodeAt(y);if(v===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(v===s.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=h))}return l===f?f=h:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else f===-1&&(p=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var s=-1,l=0,f=-1,p=!0,y=0,g=i.length-1;g>=0;--g){var h=i.charCodeAt(g);if(h===47){if(!p){l=g+1;break}continue}f===-1&&(p=!1,f=g+1),h===46?s===-1?s=g:y!==1&&(y=1):s!==-1&&(y=-1)}return s===-1||f===-1||y===0||y===1&&s===f-1&&s===l+1?"":i.slice(s,f)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),f=l===47,p;f?(s.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,v=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!v){g=P+1;break}continue}h===-1&&(v=!1,h=P+1),l===46?y===-1?y=P:B!==1&&(B=1):y!==-1&&(B=-1)}return y===-1||h===-1||B===0||B===1&&y===h-1&&y===g+1?h!==-1&&(g===0&&f?s.base=s.name=i.slice(1,h):s.base=s.name=i.slice(g,h)):(g===0&&f?(s.name=i.slice(1,y),s.base=i.slice(1,h)):(s.name=i.slice(g,y),s.base=i.slice(g,h)),s.ext=i.slice(y,h)),g>0?s.dir=i.slice(0,g-1):f&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Is=o,Is}function Kn(t){throw new RangeError(HS[t])}function Lm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let o=(function(a,i){let s=[],l=a.length;for(;l--;)s[l]=i(a[l]);return s})((t=t.replace(DS,".")).split("."),e).join(".");return r+o}function Xm(t){let e=[],n=0,r=t.length;for(;n<r;){let o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let a=t.charCodeAt(n++);(64512&a)==56320?e.push(((1023&o)<<10)+(1023&a)+65536):(e.push(o),n--)}else e.push(o)}return e}function $S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function ni(t,e,n){if(t&&$t.isObject(t)&&t instanceof kt)return t;var r=new kt;return r.parse(t,e,n),r}function VS(){if(Jm)return Rs;Jm=!0;var t=je;function e(a){if(typeof a!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function n(a,i){for(var s="",l=0,f=-1,p=0,y,g=0;g<=a.length;++g){if(g<a.length)y=a.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||p===1))if(f!==g-1&&p===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",l=0):(s=s.slice(0,h),l=s.length-1-s.lastIndexOf("/")),f=g,p=0;continue}}else if(s.length===2||s.length===1){s="",l=0,f=g,p=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+a.slice(f+1,g):s=a.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return s}function r(a,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+a+l:l}var o={resolve:function(){for(var i="",s=!1,l,f=arguments.length-1;f>=-1&&!s;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,s=p.charCodeAt(0)===47)}return i=n(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=o.resolve(i),s=o.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<s.length&&s.charCodeAt(y)===47;++y);for(var g=s.length,h=g-y,v=p<h?p:h,P=-1,B=0;B<=v;++B){if(B===v){if(h>v){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>v&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(T!==S)break;T===47&&(P=B)}var E="";for(B=l+P+1;B<=f;++B)(B===f||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+s.slice(y+P):(y+=P,s.charCodeAt(y)===47&&++y,s.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(s=i.charCodeAt(y),s===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var g=s.length-1,h=-1;for(y=i.length-1;y>=0;--y){var v=i.charCodeAt(y);if(v===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(v===s.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=h))}return l===f?f=h:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else f===-1&&(p=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var s=-1,l=0,f=-1,p=!0,y=0,g=i.length-1;g>=0;--g){var h=i.charCodeAt(g);if(h===47){if(!p){l=g+1;break}continue}f===-1&&(p=!1,f=g+1),h===46?s===-1?s=g:y!==1&&(y=1):s!==-1&&(y=-1)}return s===-1||f===-1||y===0||y===1&&s===f-1&&s===l+1?"":i.slice(s,f)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),f=l===47,p;f?(s.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,v=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!v){g=P+1;break}continue}h===-1&&(v=!1,h=P+1),l===46?y===-1?y=P:B!==1&&(B=1):y!==-1&&(B=-1)}return y===-1||h===-1||B===0||B===1&&y===h-1&&y===g+1?h!==-1&&(g===0&&f?s.base=s.name=i.slice(1,h):s.base=s.name=i.slice(g,h)):(g===0&&f?(s.name=i.slice(1,y),s.base=i.slice(1,h)):(s.name=i.slice(g,y),s.base=i.slice(g,h)),s.ext=i.slice(y,h)),g>0?s.dir=i.slice(0,g-1):f&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Rs=o,Rs}function sk(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Ns?lk(t):uk(t)}function lk(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(tk,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<QS||r>ek||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function uk(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function ck(t){let e=Ym.resolve(t),n=t.charCodeAt(t.length-1);(n===XS||Ns&&n===YS)&&e[e.length-1]!==Ym.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(nk,"%25")),!Ns&&e.includes("\\")&&(e=e.replace(rk,"%5C")),e.includes(`
|
|
11
|
-
`)&&(e=e.replace(
|
|
12
|
-
`)&&(e=e.replace(
|
|
13
|
-
`," "]),Ms=["'"].concat(zS),qm=["%","/","?",";","#"].concat(Ms),Gm=["/","?","#"],Vm=/^[+a-z0-9A-Z_-]{0,63}$/,qS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,GS={javascript:!0,"javascript:":!0},Cs={javascript:!0,"javascript:":!0},dr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Os=en;kt.prototype.parse=function(t,e,n){if(!$t.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=r!==-1&&r<t.indexOf("#")?"?":"#",a=t.split(o);a[0]=a[0].replace(/\\/g,"/");var i=t=a.join(o);if(i=i.trim(),!n&&t.split("#").length===1){var s=WS.exec(i);if(s)return this.path=i,this.href=i,this.pathname=s[1],s[2]?(this.search=s[2],this.query=e?Os.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=LS.exec(i);if(l){var f=(l=l[0]).toLowerCase();this.protocol=f,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var p=i.substr(0,2)==="//";!p||l&&Cs[l]||(i=i.substr(2),this.slashes=!0)}if(!Cs[l]&&(p||l&&!dr[l])){for(var y,g,h=-1,v=0;v<Gm.length;v++)(P=i.indexOf(Gm[v]))!==-1&&(h===-1||P<h)&&(h=P);for((g=h===-1?i.lastIndexOf("@"):i.lastIndexOf("@",h))!==-1&&(y=i.slice(0,g),i=i.slice(g+1),this.auth=decodeURIComponent(y)),h=-1,v=0;v<qm.length;v++){var P;(P=i.indexOf(qm[v]))!==-1&&(h===-1||P<h)&&(h=P)}h===-1&&(h=i.length),this.host=i.slice(0,h),i=i.slice(h),this.parseHost(),this.hostname=this.hostname||"";var B=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!B)for(var T=this.hostname.split(/\./),S=(v=0,T.length);v<S;v++){var E=T[v];if(E&&!E.match(Vm)){for(var H="",j=0,re=E.length;j<re;j++)E.charCodeAt(j)>127?H+="x":H+=E[j];if(!H.match(Vm)){var ee=T.slice(0,v),ge=T.slice(v+1),ae=E.match(qS);ae&&(ee.push(ae[1]),ge.unshift(ae[2])),ge.length&&(i="/"+ge.join(".")+i),this.hostname=ee.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=KS.toASCII(this.hostname));var ie=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+ie,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!GS[f])for(v=0,S=Ms.length;v<S;v++){var ze=Ms[v];if(i.indexOf(ze)!==-1){var tt=encodeURIComponent(ze);tt===ze&&(tt=escape(ze)),i=i.split(ze).join(tt)}}var Ve=i.indexOf("#");Ve!==-1&&(this.hash=i.substr(Ve),i=i.slice(0,Ve));var Je=i.indexOf("?");if(Je!==-1?(this.search=i.substr(Je),this.query=i.substr(Je+1),e&&(this.query=Os.parse(this.query)),i=i.slice(0,Je)):e&&(this.search="",this.query={}),i&&(this.pathname=i),dr[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){ie=this.pathname||"";var ht=this.search||"";this.path=ie+ht}return this.href=this.format(),this},kt.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,a="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&$t.isObject(this.query)&&Object.keys(this.query).length&&(a=Os.stringify(this.query));var i=this.search||a&&"?"+a||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||dr[e])&&o!==!1?(o="//"+(o||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):o||(o=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+o+(n=n.replace(/[?#]/g,(function(s){return encodeURIComponent(s)})))+(i=i.replace("#","%23"))+r},kt.prototype.resolve=function(t){return this.resolveObject(ni(t,!1,!0)).format()},kt.prototype.resolveObject=function(t){if($t.isString(t)){var e=new kt;e.parse(t,!1,!0),t=e}for(var n=new kt,r=Object.keys(this),o=0;o<r.length;o++){var a=r[o];n[a]=this[a]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),s=0;s<i.length;s++){var l=i[s];l!=="protocol"&&(n[l]=t[l])}return dr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!dr[t.protocol]){for(var f=Object.keys(t),p=0;p<f.length;p++){var y=f[p];n[y]=t[y]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||Cs[t.protocol])n.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),n.pathname=g.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var h=n.pathname||"",v=n.search||"";n.path=h+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var P=n.pathname&&n.pathname.charAt(0)==="/",B=t.host||t.pathname&&t.pathname.charAt(0)==="/",T=B||P||n.host&&t.pathname,S=T,E=n.pathname&&n.pathname.split("/")||[],H=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!dr[n.protocol]);if(H&&(n.hostname="",n.port=null,n.host&&(E[0]===""?E[0]=n.host:E.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),T=T&&(g[0]===""||E[0]==="")),B)n.host=t.host||t.host===""?t.host:n.host,n.hostname=t.hostname||t.hostname===""?t.hostname:n.hostname,n.search=t.search,n.query=t.query,E=g;else if(g.length)E||(E=[]),E.pop(),E=E.concat(g),n.search=t.search,n.query=t.query;else if(!$t.isNullOrUndefined(t.search))return H&&(n.hostname=n.host=E.shift(),(ae=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=ae.shift(),n.host=n.hostname=ae.shift())),n.search=t.search,n.query=t.query,$t.isNull(n.pathname)&&$t.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var j=E.slice(-1)[0],re=(n.host||t.host||E.length>1)&&(j==="."||j==="..")||j==="",ee=0,ge=E.length;ge>=0;ge--)(j=E[ge])==="."?E.splice(ge,1):j===".."?(E.splice(ge,1),ee++):ee&&(E.splice(ge,1),ee--);if(!T&&!S)for(;ee--;ee)E.unshift("..");!T||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),re&&E.join("/").substr(-1)!=="/"&&E.push("");var ae,ie=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=ie?"":E.length?E.shift():"",(ae=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=ae.shift(),n.host=n.hostname=ae.shift())),(T=T||n.host&&E.length)&&!ie&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),$t.isNull(n.pathname)&&$t.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},kt.prototype.parseHost=function(){var t=this.host,e=FS.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};De.Url;De.format;De.resolve;De.resolveObject;Rs={},Jm=!1;Ym=VS(),JS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=ck;De.fileURLToPath=sk;De.Url;De.format;De.resolve;De.resolveObject;De.URL;YS=92,XS=47,QS=97,ek=122,Ns=JS==="win32",tk=/\//g,nk=/%/g,rk=/\\/g,ik=/\n/g,ok=/\r/g,ak=/\t/g;fk=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=Bk;De.fileURLToPath=wk;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;dk=92,pk=47,gk=97,yk=122,Ds=fk==="win32",mk=/\//g,hk=/%/g,vk=/\\/g,Tk=/\n/g,_k=/\r/g,bk=/\t/g});var Rh={};hn(Rh,{Agent:()=>Dk,ClientRequest:()=>Hk,IncomingMessage:()=>Uk,METHODS:()=>$k,STATUS_CODES:()=>Zk,default:()=>tn,get:()=>jk,globalAgent:()=>Kk,request:()=>Lk});function Ph(){if(th)return Bt;th=!0,Bt.fetch=r(Ln.fetch)&&r(Ln.ReadableStream),Bt.writableStream=r(Ln.WritableStream),Bt.abortController=r(Ln.AbortController);var t;function e(){if(t!==void 0)return t;if(Ln.XMLHttpRequest){t=new Ln.XMLHttpRequest;try{t.open("GET",Ln.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(o){var a=e();if(!a)return!1;try{return a.responseType=o,a.responseType===o}catch{}return!1}Bt.arraybuffer=Bt.fetch||n("arraybuffer"),Bt.msstream=!Bt.fetch&&n("ms-stream"),Bt.mozchunkedarraybuffer=!Bt.fetch&&n("moz-chunked-arraybuffer"),Bt.overrideMimeType=Bt.fetch||(e()?r(e().overrideMimeType):!1);function r(o){return typeof o=="function"}return t=null,Bt}function Bh(){return nh||(nh=!0,Hs=_t.EventEmitter),Hs}function Ek(){if(rh)return Us;rh=!0;function t(v,P){var B=Object.keys(v);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(v);P&&(T=T.filter(function(S){return Object.getOwnPropertyDescriptor(v,S).enumerable})),B.push.apply(B,T)}return B}function e(v){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(T){n(v,T,B[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(T){Object.defineProperty(v,T,Object.getOwnPropertyDescriptor(B,T))})}return v}function n(v,P,B){return P=i(P),P in v?Object.defineProperty(v,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):v[P]=B,v}function r(v,P){if(!(v instanceof P))throw new TypeError("Cannot call a class as a function")}function o(v,P){for(var B=0;B<P.length;B++){var T=P[B];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,i(T.key),T)}}function a(v,P,B){return P&&o(v.prototype,P),Object.defineProperty(v,"prototype",{writable:!1}),v}function i(v){var P=s(v,"string");return typeof P=="symbol"?P:String(P)}function s(v,P){if(typeof v!="object"||v===null)return v;var B=v[Symbol.toPrimitive];if(B!==void 0){var T=B.call(v,P||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(v)}var l=Dt(),f=l.Buffer,p=L,y=p.inspect,g=y&&y.custom||"inspect";function h(v,P,B){f.prototype.copy.call(v,P,B)}return Us=(function(){function v(){r(this,v),this.head=null,this.tail=null,this.length=0}return a(v,[{key:"push",value:function(B){var T={data:B,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(B){var T={data:B,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var B=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,B}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(B){if(this.length===0)return"";for(var T=this.head,S=""+T.data;T=T.next;)S+=B+T.data;return S}},{key:"concat",value:function(B){if(this.length===0)return f.alloc(0);for(var T=f.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,T,E),E+=S.data.length,S=S.next;return T}},{key:"consume",value:function(B,T){var S;return B<this.head.data.length?(S=this.head.data.slice(0,B),this.head.data=this.head.data.slice(B)):B===this.head.data.length?S=this.shift():S=T?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var T=this.head,S=1,E=T.data;for(B-=E.length;T=T.next;){var H=T.data,j=B>H.length?H.length:B;if(j===H.length?E+=H:E+=H.slice(0,B),B-=j,B===0){j===H.length?(++S,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=H.slice(j));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var T=f.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(T),B-=S.data.length;S=S.next;){var H=S.data,j=B>H.length?H.length:B;if(H.copy(T,T.length-B,0,j),B-=j,B===0){j===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(j));break}++E}return this.length-=E,T}},{key:g,value:function(B,T){return y(this,e(e({},T),{},{depth:0,customInspect:!1}))}}]),v})(),Us}function Eh(){if(ih)return $s;ih=!0;var t=Rt;function e(s,l){var f=this,p=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return p||y?(l?l(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(a,this,s)):t.nextTick(a,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(g){!l&&g?f._writableState?f._writableState.errorEmitted?t.nextTick(r,f):(f._writableState.errorEmitted=!0,t.nextTick(n,f,g)):t.nextTick(n,f,g):l?(t.nextTick(r,f),l(g)):t.nextTick(r,f)}),this)}function n(s,l){a(s,l),r(s)}function r(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function a(s,l){s.emit("error",l)}function i(s,l){var f=s._readableState,p=s._writableState;f&&f.autoDestroy||p&&p.autoDestroy?s.destroy(l):s.emit("error",l)}return $s={destroy:e,undestroy:o,errorOrDestroy:i},$s}function yr(){if(oh)return Zs;oh=!0;let t={};function e(i,s,l){l||(l=Error);function f(y,g,h){return typeof s=="string"?s:s(y,g,h)}class p extends l{constructor(g,h,v){super(f(g,h,v))}}p.prototype.name=l.name,p.prototype.code=i,t[i]=p}function n(i,s){if(Array.isArray(i)){let l=i.length;return i=i.map(f=>String(f)),l>2?`one of ${s} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${s} ${i[0]} or ${i[1]}`:`of ${s} ${i[0]}`}else return`of ${s} ${String(i)}`}function r(i,s,l){return i.substr(0,s.length)===s}function o(i,s,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-s.length,l)===s}function a(i,s,l){return typeof l!="number"&&(l=0),l+s.length>i.length?!1:i.indexOf(s,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,s){return'The value "'+s+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,s,l){let f;typeof s=="string"&&r(s,"not ")?(f="must not be",s=s.replace(/^not /,"")):f="must be";let p;if(o(i," argument"))p=`The ${i} ${f} ${n(s,"type")}`;else{let y=a(i,".")?"property":"argument";p=`The "${i}" ${y} ${f} ${n(s,"type")}`}return p+=`. Received type ${typeof l}`,p},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Zs.codes=t,Zs}function Sh(){if(ah)return js;ah=!0;var t=yr().codes.ERR_INVALID_OPT_VALUE;function e(r,o,a){return r.highWaterMark!=null?r.highWaterMark:o?r[a]:null}function n(r,o,a,i){var s=e(o,i,a);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var l=i?a:"highWaterMark";throw new t(l,s)}return Math.floor(s)}return r.objectMode?16:16*1024}return js={getHighWaterMark:n},js}function kh(){if(sh)return Ks;sh=!0;var t=Rt;Ks=ae;function e(M){var k=this;this.next=null,this.entry=null,this.finish=function(){Te(k,M)}}var n;ae.WritableState=ee;var r={deprecate:Nm()},o=Bh(),a=Dt().Buffer,i=(typeof lh<"u"?lh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(M){return a.from(M)}function l(M){return a.isBuffer(M)||M instanceof i}var f=Eh(),p=Sh(),y=p.getHighWaterMark,g=yr().codes,h=g.ERR_INVALID_ARG_TYPE,v=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,T=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,j=f.errorOrDestroy;Ht()(ae,o);function re(){}function ee(M,k,Z){n=n||gr(),M=M||{},typeof Z!="boolean"&&(Z=k instanceof n),this.objectMode=!!M.objectMode,Z&&(this.objectMode=this.objectMode||!!M.writableObjectMode),this.highWaterMark=y(this,M,"writableHighWaterMark",Z),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Y=M.decodeStrings===!1;this.decodeStrings=!Y,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(oe){Ue(k,oe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=M.emitClose!==!1,this.autoDestroy=!!M.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ee.prototype.getBuffer=function(){for(var k=this.bufferedRequest,Z=[];k;)Z.push(k),k=k.next;return Z},(function(){try{Object.defineProperty(ee.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ge;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ge=Function.prototype[Symbol.hasInstance],Object.defineProperty(ae,Symbol.hasInstance,{value:function(k){return ge.call(this,k)?!0:this!==ae?!1:k&&k._writableState instanceof ee}})):ge=function(k){return k instanceof this};function ae(M){n=n||gr();var k=this instanceof n;if(!k&&!ge.call(ae,this))return new ae(M);this._writableState=new ee(M,this,k),this.writable=!0,M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final)),o.call(this)}ae.prototype.pipe=function(){j(this,new B)};function ie(M,k){var Z=new E;j(M,Z),t.nextTick(k,Z)}function Oe(M,k,Z,Y){var oe;return Z===null?oe=new S:typeof Z!="string"&&!k.objectMode&&(oe=new h("chunk",["string","Buffer"],Z)),oe?(j(M,oe),t.nextTick(Y,oe),!1):!0}ae.prototype.write=function(M,k,Z){var Y=this._writableState,oe=!1,w=!Y.objectMode&&l(M);return w&&!a.isBuffer(M)&&(M=s(M)),typeof k=="function"&&(Z=k,k=null),w?k="buffer":k||(k=Y.defaultEncoding),typeof Z!="function"&&(Z=re),Y.ending?ie(this,Z):(w||Oe(this,Y,M,Z))&&(Y.pendingcb++,oe=tt(this,Y,w,M,k,Z)),oe},ae.prototype.cork=function(){this._writableState.corked++},ae.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,!M.writing&&!M.corked&&!M.bufferProcessing&&M.bufferedRequest&&fe(this,M))},ae.prototype.setDefaultEncoding=function(k){if(typeof k=="string"&&(k=k.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((k+"").toLowerCase())>-1))throw new H(k);return this._writableState.defaultEncoding=k,this},Object.defineProperty(ae.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ze(M,k,Z){return!M.objectMode&&M.decodeStrings!==!1&&typeof k=="string"&&(k=a.from(k,Z)),k}Object.defineProperty(ae.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function tt(M,k,Z,Y,oe,w){if(!Z){var x=ze(k,Y,oe);Y!==x&&(Z=!0,oe="buffer",Y=x)}var z=k.objectMode?1:Y.length;k.length+=z;var Q=k.length<k.highWaterMark;if(Q||(k.needDrain=!0),k.writing||k.corked){var Me=k.lastBufferedRequest;k.lastBufferedRequest={chunk:Y,encoding:oe,isBuf:Z,callback:w,next:null},Me?Me.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else Ve(M,k,!1,z,Y,oe,w);return Q}function Ve(M,k,Z,Y,oe,w,x){k.writelen=Y,k.writecb=x,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new T("write")):Z?M._writev(oe,k.onwrite):M._write(oe,w,k.onwrite),k.sync=!1}function Je(M,k,Z,Y,oe){--k.pendingcb,Z?(t.nextTick(oe,Y),t.nextTick(F,M,k),M._writableState.errorEmitted=!0,j(M,Y)):(oe(Y),M._writableState.errorEmitted=!0,j(M,Y),F(M,k))}function ht(M){M.writing=!1,M.writecb=null,M.length-=M.writelen,M.writelen=0}function Ue(M,k){var Z=M._writableState,Y=Z.sync,oe=Z.writecb;if(typeof oe!="function")throw new P;if(ht(Z),k)Je(M,Z,Y,k,oe);else{var w=ve(Z)||M.destroyed;!w&&!Z.corked&&!Z.bufferProcessing&&Z.bufferedRequest&&fe(M,Z),Y?t.nextTick(Pe,M,Z,w,oe):Pe(M,Z,w,oe)}}function Pe(M,k,Z,Y){Z||Se(M,k),k.pendingcb--,Y(),F(M,k)}function Se(M,k){k.length===0&&k.needDrain&&(k.needDrain=!1,M.emit("drain"))}function fe(M,k){k.bufferProcessing=!0;var Z=k.bufferedRequest;if(M._writev&&Z&&Z.next){var Y=k.bufferedRequestCount,oe=new Array(Y),w=k.corkedRequestsFree;w.entry=Z;for(var x=0,z=!0;Z;)oe[x]=Z,Z.isBuf||(z=!1),Z=Z.next,x+=1;oe.allBuffers=z,Ve(M,k,!0,k.length,oe,"",w.finish),k.pendingcb++,k.lastBufferedRequest=null,w.next?(k.corkedRequestsFree=w.next,w.next=null):k.corkedRequestsFree=new e(k),k.bufferedRequestCount=0}else{for(;Z;){var Q=Z.chunk,Me=Z.encoding,_e=Z.callback,$=k.objectMode?1:Q.length;if(Ve(M,k,!1,$,Q,Me,_e),Z=Z.next,k.bufferedRequestCount--,k.writing)break}Z===null&&(k.lastBufferedRequest=null)}k.bufferedRequest=Z,k.bufferProcessing=!1}ae.prototype._write=function(M,k,Z){Z(new v("_write()"))},ae.prototype._writev=null,ae.prototype.end=function(M,k,Z){var Y=this._writableState;return typeof M=="function"?(Z=M,M=null,k=null):typeof k=="function"&&(Z=k,k=null),M!=null&&this.write(M,k),Y.corked&&(Y.corked=1,this.uncork()),Y.ending||de(this,Y,Z),this},Object.defineProperty(ae.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ve(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}function D(M,k){M._final(function(Z){k.pendingcb--,Z&&j(M,Z),k.prefinished=!0,M.emit("prefinish"),F(M,k)})}function K(M,k){!k.prefinished&&!k.finalCalled&&(typeof M._final=="function"&&!k.destroyed?(k.pendingcb++,k.finalCalled=!0,t.nextTick(D,M,k)):(k.prefinished=!0,M.emit("prefinish")))}function F(M,k){var Z=ve(k);if(Z&&(K(M,k),k.pendingcb===0&&(k.finished=!0,M.emit("finish"),k.autoDestroy))){var Y=M._readableState;(!Y||Y.autoDestroy&&Y.endEmitted)&&M.destroy()}return Z}function de(M,k,Z){k.ending=!0,F(M,k),Z&&(k.finished?t.nextTick(Z):M.once("finish",Z)),k.ended=!0,M.writable=!1}function Te(M,k,Z){var Y=M.entry;for(M.entry=null;Y;){var oe=Y.callback;k.pendingcb--,oe(Z),Y=Y.next}k.corkedRequestsFree.next=M}return Object.defineProperty(ae.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(k){this._writableState&&(this._writableState.destroyed=k)}}),ae.prototype.destroy=f.destroy,ae.prototype._undestroy=f.undestroy,ae.prototype._destroy=function(M,k){k(M)},Ks}function gr(){if(uh)return Ls;uh=!0;var t=Rt,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};Ls=s;var n=Ih(),r=kh();Ht()(s,n);for(var o=e(r.prototype),a=0;a<o.length;a++){var i=o[a];s.prototype[i]||(s.prototype[i]=r.prototype[i])}function s(p){if(!(this instanceof s))return new s(p);n.call(this,p),r.call(this,p),this.allowHalfOpen=!0,p&&(p.readable===!1&&(this.readable=!1),p.writable===!1&&(this.writable=!1),p.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(f,this)}function f(p){p.end()}return Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=y,this._writableState.destroyed=y)}}),Ls}function tl(){if(ch)return Fs;ch=!0;var t=yr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(a){var i=!1;return function(){if(!i){i=!0;for(var s=arguments.length,l=new Array(s),f=0;f<s;f++)l[f]=arguments[f];a.apply(this,l)}}}function n(){}function r(a){return a.setHeader&&typeof a.abort=="function"}function o(a,i,s){if(typeof i=="function")return o(a,null,i);i||(i={}),s=e(s||n);var l=i.readable||i.readable!==!1&&a.readable,f=i.writable||i.writable!==!1&&a.writable,p=function(){a.writable||g()},y=a._writableState&&a._writableState.finished,g=function(){f=!1,y=!0,l||s.call(a)},h=a._readableState&&a._readableState.endEmitted,v=function(){l=!1,h=!0,f||s.call(a)},P=function(E){s.call(a,E)},B=function(){var E;if(l&&!h)return(!a._readableState||!a._readableState.ended)&&(E=new t),s.call(a,E);if(f&&!y)return(!a._writableState||!a._writableState.ended)&&(E=new t),s.call(a,E)},T=function(){a.req.on("finish",g)};return r(a)?(a.on("complete",g),a.on("abort",B),a.req?T():a.on("request",T)):f&&!a._writableState&&(a.on("end",p),a.on("close",p)),a.on("end",v),a.on("finish",g),i.error!==!1&&a.on("error",P),a.on("close",B),function(){a.removeListener("complete",g),a.removeListener("abort",B),a.removeListener("request",T),a.req&&a.req.removeListener("finish",g),a.removeListener("end",p),a.removeListener("close",p),a.removeListener("finish",g),a.removeListener("end",v),a.removeListener("error",P),a.removeListener("close",B)}}return Fs=o,Fs}function Sk(){if(fh)return Ws;fh=!0;var t=Rt,e;function n(H,j,re){return j=r(j),j in H?Object.defineProperty(H,j,{value:re,enumerable:!0,configurable:!0,writable:!0}):H[j]=re,H}function r(H){var j=o(H,"string");return typeof j=="symbol"?j:String(j)}function o(H,j){if(typeof H!="object"||H===null)return H;var re=H[Symbol.toPrimitive];if(re!==void 0){var ee=re.call(H,j||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(H)}var a=tl(),i=Symbol("lastResolve"),s=Symbol("lastReject"),l=Symbol("error"),f=Symbol("ended"),p=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function h(H,j){return{value:H,done:j}}function v(H){var j=H[i];if(j!==null){var re=H[g].read();re!==null&&(H[p]=null,H[i]=null,H[s]=null,j(h(re,!1)))}}function P(H){t.nextTick(v,H)}function B(H,j){return function(re,ee){H.then(function(){if(j[f]){re(h(void 0,!0));return}j[y](re,ee)},ee)}}var T=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var j=this,re=this[l];if(re!==null)return Promise.reject(re);if(this[f])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(ie,Oe){t.nextTick(function(){j[l]?Oe(j[l]):ie(h(void 0,!0))})});var ee=this[p],ge;if(ee)ge=new Promise(B(ee,this));else{var ae=this[g].read();if(ae!==null)return Promise.resolve(h(ae,!1));ge=new Promise(this[y])}return this[p]=ge,ge}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var j=this;return new Promise(function(re,ee){j[g].destroy(null,function(ge){if(ge){ee(ge);return}re(h(void 0,!0))})})}),e),T),E=function(j){var re,ee=Object.create(S,(re={},n(re,g,{value:j,writable:!0}),n(re,i,{value:null,writable:!0}),n(re,s,{value:null,writable:!0}),n(re,l,{value:null,writable:!0}),n(re,f,{value:j._readableState.endEmitted,writable:!0}),n(re,y,{value:function(ae,ie){var Oe=ee[g].read();Oe?(ee[p]=null,ee[i]=null,ee[s]=null,ae(h(Oe,!1))):(ee[i]=ae,ee[s]=ie)},writable:!0}),re));return ee[p]=null,a(j,function(ge){if(ge&&ge.code!=="ERR_STREAM_PREMATURE_CLOSE"){var ae=ee[s];ae!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,ae(ge)),ee[l]=ge;return}var ie=ee[i];ie!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,ie(h(void 0,!0))),ee[f]=!0}),j.on("readable",P.bind(null,ee)),ee};return Ws=E,Ws}function kk(){return dh||(dh=!0,zs=function(){throw new Error("Readable.from is not available in the browser")}),zs}function Ih(){if(ph)return qs;ph=!0;var t=Rt;qs=ie;var e;ie.ReadableState=ae,_t.EventEmitter;var n=function(x,z){return x.listeners(z).length},r=Bh(),o=Dt().Buffer,a=(typeof gh<"u"?gh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(w){return o.from(w)}function s(w){return o.isBuffer(w)||w instanceof a}var l=L,f;l&&l.debuglog?f=l.debuglog("stream"):f=function(){};var p=Ek(),y=Eh(),g=Sh(),h=g.getHighWaterMark,v=yr().codes,P=v.ERR_INVALID_ARG_TYPE,B=v.ERR_STREAM_PUSH_AFTER_EOF,T=v.ERR_METHOD_NOT_IMPLEMENTED,S=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,j;Ht()(ie,r);var re=y.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function ge(w,x,z){if(typeof w.prependListener=="function")return w.prependListener(x,z);!w._events||!w._events[x]?w.on(x,z):Array.isArray(w._events[x])?w._events[x].unshift(z):w._events[x]=[z,w._events[x]]}function ae(w,x,z){e=e||gr(),w=w||{},typeof z!="boolean"&&(z=x instanceof e),this.objectMode=!!w.objectMode,z&&(this.objectMode=this.objectMode||!!w.readableObjectMode),this.highWaterMark=h(this,w,"readableHighWaterMark",z),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.destroyed=!1,this.defaultEncoding=w.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,w.encoding&&(E||(E=ei.StringDecoder),this.decoder=new E(w.encoding),this.encoding=w.encoding)}function ie(w){if(e=e||gr(),!(this instanceof ie))return new ie(w);var x=this instanceof e;this._readableState=new ae(w,this,x),this.readable=!0,w&&(typeof w.read=="function"&&(this._read=w.read),typeof w.destroy=="function"&&(this._destroy=w.destroy)),r.call(this)}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),ie.prototype.destroy=y.destroy,ie.prototype._undestroy=y.undestroy,ie.prototype._destroy=function(w,x){x(w)},ie.prototype.push=function(w,x){var z=this._readableState,Q;return z.objectMode?Q=!0:typeof w=="string"&&(x=x||z.defaultEncoding,x!==z.encoding&&(w=o.from(w,x),x=""),Q=!0),Oe(this,w,x,!1,Q)},ie.prototype.unshift=function(w){return Oe(this,w,null,!0,!1)};function Oe(w,x,z,Q,Me){f("readableAddChunk",x);var _e=w._readableState;if(x===null)_e.reading=!1,Ue(w,_e);else{var $;if(Me||($=tt(_e,x)),$)re(w,$);else if(_e.objectMode||x&&x.length>0)if(typeof x!="string"&&!_e.objectMode&&Object.getPrototypeOf(x)!==o.prototype&&(x=i(x)),Q)_e.endEmitted?re(w,new S):ze(w,_e,x,!0);else if(_e.ended)re(w,new B);else{if(_e.destroyed)return!1;_e.reading=!1,_e.decoder&&!z?(x=_e.decoder.write(x),_e.objectMode||x.length!==0?ze(w,_e,x,!1):fe(w,_e)):ze(w,_e,x,!1)}else Q||(_e.reading=!1,fe(w,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(w,x,z,Q){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,w.emit("data",z)):(x.length+=x.objectMode?1:z.length,Q?x.buffer.unshift(z):x.buffer.push(z),x.needReadable&&Pe(w)),fe(w,x)}function tt(w,x){var z;return!s(x)&&typeof x!="string"&&x!==void 0&&!w.objectMode&&(z=new P("chunk",["string","Buffer","Uint8Array"],x)),z}ie.prototype.isPaused=function(){return this._readableState.flowing===!1},ie.prototype.setEncoding=function(w){E||(E=ei.StringDecoder);var x=new E(w);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,Q="";z!==null;)Q+=x.write(z.data),z=z.next;return this._readableState.buffer.clear(),Q!==""&&this._readableState.buffer.push(Q),this._readableState.length=Q.length,this};var Ve=1073741824;function Je(w){return w>=Ve?w=Ve:(w--,w|=w>>>1,w|=w>>>2,w|=w>>>4,w|=w>>>8,w|=w>>>16,w++),w}function ht(w,x){return w<=0||x.length===0&&x.ended?0:x.objectMode?1:w!==w?x.flowing&&x.length?x.buffer.head.data.length:x.length:(w>x.highWaterMark&&(x.highWaterMark=Je(w)),w<=x.length?w:x.ended?x.length:(x.needReadable=!0,0))}ie.prototype.read=function(w){f("read",w),w=parseInt(w,10);var x=this._readableState,z=w;if(w!==0&&(x.emittedReadable=!1),w===0&&x.needReadable&&((x.highWaterMark!==0?x.length>=x.highWaterMark:x.length>0)||x.ended))return f("read: emitReadable",x.length,x.ended),x.length===0&&x.ended?Z(this):Pe(this),null;if(w=ht(w,x),w===0&&x.ended)return x.length===0&&Z(this),null;var Q=x.needReadable;f("need readable",Q),(x.length===0||x.length-w<x.highWaterMark)&&(Q=!0,f("length less than watermark",Q)),x.ended||x.reading?(Q=!1,f("reading or ended",Q)):Q&&(f("do read"),x.reading=!0,x.sync=!0,x.length===0&&(x.needReadable=!0),this._read(x.highWaterMark),x.sync=!1,x.reading||(w=ht(z,x)));var Me;return w>0?Me=k(w,x):Me=null,Me===null?(x.needReadable=x.length<=x.highWaterMark,w=0):(x.length-=w,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),z!==w&&x.ended&&Z(this)),Me!==null&&this.emit("data",Me),Me};function Ue(w,x){if(f("onEofChunk"),!x.ended){if(x.decoder){var z=x.decoder.end();z&&z.length&&(x.buffer.push(z),x.length+=x.objectMode?1:z.length)}x.ended=!0,x.sync?Pe(w):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,Se(w)))}}function Pe(w){var x=w._readableState;f("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(f("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(Se,w))}function Se(w){var x=w._readableState;f("emitReadable_",x.destroyed,x.length,x.ended),!x.destroyed&&(x.length||x.ended)&&(w.emit("readable"),x.emittedReadable=!1),x.needReadable=!x.flowing&&!x.ended&&x.length<=x.highWaterMark,M(w)}function fe(w,x){x.readingMore||(x.readingMore=!0,t.nextTick(ve,w,x))}function ve(w,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var z=x.length;if(f("maybeReadMore read 0"),w.read(0),z===x.length)break}x.readingMore=!1}ie.prototype._read=function(w){re(this,new T("_read()"))},ie.prototype.pipe=function(w,x){var z=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=w;break;case 1:Q.pipes=[Q.pipes,w];break;default:Q.pipes.push(w);break}Q.pipesCount+=1,f("pipe count=%d opts=%j",Q.pipesCount,x);var Me=(!x||x.end!==!1)&&w!==t.stdout&&w!==t.stderr,_e=Me?Ct:u;Q.endEmitted?t.nextTick(_e):z.once("end",_e),w.on("unpipe",$);function $(c,_){f("onunpipe"),c===z&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,hr())}function Ct(){f("onend"),w.end()}var Nt=D(z);w.on("drain",Nt);var xt=!1;function hr(){f("cleanup"),w.removeListener("close",vr),w.removeListener("finish",m),w.removeListener("drain",Nt),w.removeListener("error",Et),w.removeListener("unpipe",$),z.removeListener("end",Ct),z.removeListener("end",u),z.removeListener("data",ci),xt=!0,Q.awaitDrain&&(!w._writableState||w._writableState.needDrain)&&Nt()}z.on("data",ci);function ci(c){f("ondata");var _=w.write(c);f("dest.write",_),_===!1&&((Q.pipesCount===1&&Q.pipes===w||Q.pipesCount>1&&oe(Q.pipes,w)!==-1)&&!xt&&(f("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function Et(c){f("onerror",c),u(),w.removeListener("error",Et),n(w,"error")===0&&re(w,c)}ge(w,"error",Et);function vr(){w.removeListener("finish",m),u()}w.once("close",vr);function m(){f("onfinish"),w.removeListener("close",vr),u()}w.once("finish",m);function u(){f("unpipe"),z.unpipe(w)}return w.emit("pipe",z),Q.flowing||(f("pipe resume"),z.resume()),w};function D(w){return function(){var z=w._readableState;f("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(w,"data")&&(z.flowing=!0,M(w))}}ie.prototype.unpipe=function(w){var x=this._readableState,z={hasUnpiped:!1};if(x.pipesCount===0)return this;if(x.pipesCount===1)return w&&w!==x.pipes?this:(w||(w=x.pipes),x.pipes=null,x.pipesCount=0,x.flowing=!1,w&&w.emit("unpipe",this,z),this);if(!w){var Q=x.pipes,Me=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var _e=0;_e<Me;_e++)Q[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var $=oe(x.pipes,w);return $===-1?this:(x.pipes.splice($,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),w.emit("unpipe",this,z),this)},ie.prototype.on=function(w,x){var z=r.prototype.on.call(this,w,x),Q=this._readableState;return w==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):w==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,f("on readable",Q.length,Q.reading),Q.length?Pe(this):Q.reading||t.nextTick(F,this)),z},ie.prototype.addListener=ie.prototype.on,ie.prototype.removeListener=function(w,x){var z=r.prototype.removeListener.call(this,w,x);return w==="readable"&&t.nextTick(K,this),z},ie.prototype.removeAllListeners=function(w){var x=r.prototype.removeAllListeners.apply(this,arguments);return(w==="readable"||w===void 0)&&t.nextTick(K,this),x};function K(w){var x=w._readableState;x.readableListening=w.listenerCount("readable")>0,x.resumeScheduled&&!x.paused?x.flowing=!0:w.listenerCount("data")>0&&w.resume()}function F(w){f("readable nexttick read 0"),w.read(0)}ie.prototype.resume=function(){var w=this._readableState;return w.flowing||(f("resume"),w.flowing=!w.readableListening,de(this,w)),w.paused=!1,this};function de(w,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(Te,w,x))}function Te(w,x){f("resume",x.reading),x.reading||w.read(0),x.resumeScheduled=!1,w.emit("resume"),M(w),x.flowing&&!x.reading&&w.read(0)}ie.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function M(w){var x=w._readableState;for(f("flow",x.flowing);x.flowing&&w.read()!==null;);}ie.prototype.wrap=function(w){var x=this,z=this._readableState,Q=!1;w.on("end",function(){if(f("wrapped end"),z.decoder&&!z.ended){var $=z.decoder.end();$&&$.length&&x.push($)}x.push(null)}),w.on("data",function($){if(f("wrapped data"),z.decoder&&($=z.decoder.write($)),!(z.objectMode&&$==null)&&!(!z.objectMode&&(!$||!$.length))){var Ct=x.push($);Ct||(Q=!0,w.pause())}});for(var Me in w)this[Me]===void 0&&typeof w[Me]=="function"&&(this[Me]=(function(Ct){return function(){return w[Ct].apply(w,arguments)}})(Me));for(var _e=0;_e<ee.length;_e++)w.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function($){f("wrapped _read",$),Q&&(Q=!1,w.resume())},this},typeof Symbol=="function"&&(ie.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=Sk()),H(this)}),Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(ie.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(ie.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),ie._fromList=k,Object.defineProperty(ie.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function k(w,x){if(x.length===0)return null;var z;return x.objectMode?z=x.buffer.shift():!w||w>=x.length?(x.decoder?z=x.buffer.join(""):x.buffer.length===1?z=x.buffer.first():z=x.buffer.concat(x.length),x.buffer.clear()):z=x.buffer.consume(w,x.decoder),z}function Z(w){var x=w._readableState;f("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(Y,x,w))}function Y(w,x){if(f("endReadableNT",w.endEmitted,w.length),!w.endEmitted&&w.length===0&&(w.endEmitted=!0,x.readable=!1,x.emit("end"),w.autoDestroy)){var z=x._writableState;(!z||z.autoDestroy&&z.finished)&&x.destroy()}}typeof Symbol=="function"&&(ie.from=function(w,x){return j===void 0&&(j=kk()),j(ie,w,x)});function oe(w,x){for(var z=0,Q=w.length;z<Q;z++)if(w[z]===x)return z;return-1}return qs}function Ah(){if(yh)return Gs;yh=!0,Gs=s;var t=yr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=t.ERR_TRANSFORM_WITH_LENGTH_0,a=gr();Ht()(s,a);function i(p,y){var g=this._transformState;g.transforming=!1;var h=g.writecb;if(h===null)return this.emit("error",new n);g.writechunk=null,g.writecb=null,y!=null&&this.push(y),h(p);var v=this._readableState;v.reading=!1,(v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}function s(p){if(!(this instanceof s))return new s(p);a.call(this,p),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,p&&(typeof p.transform=="function"&&(this._transform=p.transform),typeof p.flush=="function"&&(this._flush=p.flush)),this.on("prefinish",l)}function l(){var p=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(y,g){f(p,y,g)}):f(this,null,null)}s.prototype.push=function(p,y){return this._transformState.needTransform=!1,a.prototype.push.call(this,p,y)},s.prototype._transform=function(p,y,g){g(new e("_transform()"))},s.prototype._write=function(p,y,g){var h=this._transformState;if(h.writecb=g,h.writechunk=p,h.writeencoding=y,!h.transforming){var v=this._readableState;(h.needTransform||v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}},s.prototype._read=function(p){var y=this._transformState;y.writechunk!==null&&!y.transforming?(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform)):y.needTransform=!0},s.prototype._destroy=function(p,y){a.prototype._destroy.call(this,p,function(g){y(g)})};function f(p,y,g){if(y)return p.emit("error",y);if(g!=null&&p.push(g),p._writableState.length)throw new o;if(p._transformState.transforming)throw new r;return p.push(null)}return Gs}function Ik(){if(mh)return Vs;mh=!0,Vs=e;var t=Ah();Ht()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,o){o(null,n)},Vs}function Ak(){if(hh)return Js;hh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=yr().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function a(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function s(g,h,v,P){P=e(P);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=tl()),t(g,{readable:h,writable:v},function(S){if(S)return P(S);B=!0,P()});var T=!1;return function(S){if(!B&&!T){if(T=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();P(S||new o("pipe"))}}}function l(g){g()}function f(g,h){return g.pipe(h)}function p(g){return!g.length||typeof g[g.length-1]!="function"?a:g.pop()}function y(){for(var g=arguments.length,h=new Array(g),v=0;v<g;v++)h[v]=arguments[v];var P=p(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,T=h.map(function(S,E){var H=E<h.length-1,j=E>0;return s(S,H,j,function(re){B||(B=re),re&&T.forEach(l),!H&&(T.forEach(l),P(B))})});return h.reduce(f)}return Js=y,Js}function Ch(){return vh||(vh=!0,wt=wt=Ih(),wt.Stream=wt,wt.Readable=wt,wt.Writable=kh(),wt.Duplex=gr(),wt.Transform=Ah(),wt.PassThrough=Ik(),wt.finished=tl(),wt.pipeline=Ak()),wt}function Oh(){if(Th)return Lo;Th=!0;var t=Dt().Buffer,e=Rt,n=Ph(),r=Ht(),o=Ch(),a=Lo.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Lo.IncomingMessage=function(s,l,f,p){var y=this||Fo;if(o.Readable.call(y),y._mode=f,y.headers={},y.rawHeaders=[],y.trailers={},y.rawTrailers=[],y.on("end",function(){e.nextTick(function(){y.emit("close")})}),f==="fetch"){let T=function(){h.read().then(function(S){if(!y._destroyed){if(p(S.done),S.done){y.push(null);return}y.push(t.from(S.value)),T()}}).catch(function(S){p(!0),y._destroyed||y.emit("error",S)})};if(y._fetchResponse=l,y.url=l.url,y.statusCode=l.status,y.statusMessage=l.statusText,l.headers.forEach(function(S,E){y.headers[E.toLowerCase()]=S,y.rawHeaders.push(E,S)}),n.writableStream){var g=new WritableStream({write:function(S){return p(!1),new Promise(function(E,H){y._destroyed?H():y.push(t.from(S))?E():y._resumeFetch=E})},close:function(){p(!0),y._destroyed||y.push(null)},abort:function(S){p(!0),y._destroyed||y.emit("error",S)}});try{l.body.pipeTo(g).catch(function(S){p(!0),y._destroyed||y.emit("error",S)});return}catch{}}var h=l.body.getReader();T()}else{y._xhr=s,y._pos=0,y.url=s.responseURL,y.statusCode=s.status,y.statusMessage=s.statusText;var v=s.getAllResponseHeaders().split(/\r?\n/);if(v.forEach(function(T){var S=T.match(/^([^:]+):\s*(.*)/);if(S){var E=S[1].toLowerCase();E==="set-cookie"?(y.headers[E]===void 0&&(y.headers[E]=[]),y.headers[E].push(S[2])):y.headers[E]!==void 0?y.headers[E]+=", "+S[2]:y.headers[E]=S[2],y.rawHeaders.push(S[1],S[2])}}),y._charset="x-user-defined",!n.overrideMimeType){var P=y.rawHeaders["mime-type"];if(P){var B=P.match(/;\s*charset=([^;])(;|$)/);B&&(y._charset=B[1].toLowerCase())}y._charset||(y._charset="utf-8")}}};return r(i,o.Readable),i.prototype._read=function(){var s=this||Fo,l=s._resumeFetch;l&&(s._resumeFetch=null,l())},i.prototype._onXHRProgress=function(s){var l=this||Fo,f=l._xhr,p=null;switch(l._mode){case"text":if(p=f.responseText,p.length>l._pos){var y=p.substr(l._pos);if(l._charset==="x-user-defined"){for(var g=t.alloc(y.length),h=0;h<y.length;h++)g[h]=y.charCodeAt(h)&255;l.push(g)}else l.push(y,l._charset);l._pos=p.length}break;case"arraybuffer":if(f.readyState!==a.DONE||!f.response)break;p=f.response,l.push(t.from(new Uint8Array(p)));break;case"moz-chunked-arraybuffer":if(p=f.response,f.readyState!==a.LOADING||!p)break;l.push(t.from(new Uint8Array(p)));break;case"ms-stream":if(p=f.response,f.readyState!==a.LOADING)break;var v=new Fo.MSStreamReader;v.onprogress=function(){v.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(v.result.slice(l._pos)))),l._pos=v.result.byteLength)},v.onload=function(){s(!0),l.push(null)},v.readAsArrayBuffer(p);break}l._xhr.readyState===a.DONE&&l._mode!=="ms-stream"&&(s(!0),l.push(null))},Lo}function Ck(){if(_h)return Ys;_h=!0;var t=Dt().Buffer,e=Rt,n=Ph(),r=Ht(),o=Oh(),a=Ch(),i=o.IncomingMessage,s=o.readyStates;function l(g,h){return n.fetch&&h?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&g?"arraybuffer":"text"}var f=Ys=function(g){var h=this||ot;a.Writable.call(h),h._opts=g,h._body=[],h._headers={},g.auth&&h.setHeader("Authorization","Basic "+t.from(g.auth).toString("base64")),Object.keys(g.headers).forEach(function(B){h.setHeader(B,g.headers[B])});var v,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,v=!0;else if(g.mode==="prefer-streaming")v=!1;else if(g.mode==="allow-wrong-content-type")v=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")v=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(v,P),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(f,a.Writable),f.prototype.setHeader=function(g,h){var v=this||ot,P=g.toLowerCase();y.indexOf(P)===-1&&(v._headers[P]={name:g,value:h})},f.prototype.getHeader=function(g){var h=(this||ot)._headers[g.toLowerCase()];return h?h.value:null},f.prototype.removeHeader=function(g){var h=this||ot;delete h._headers[g.toLowerCase()]},f.prototype._onFinish=function(){var g=this||ot;if(!g._destroyed){var h=g._opts;"timeout"in h&&h.timeout!==0&&g.setTimeout(h.timeout);var v=g._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(g._body,{type:(v["content-type"]||{}).value||""}));var B=[];if(Object.keys(v).forEach(function(H){var j=v[H].name,re=v[H].value;Array.isArray(re)?re.forEach(function(ee){B.push([j,ee])}):B.push([j,re])}),g._mode==="fetch"){var T=null;if(n.abortController){var S=new AbortController;T=S.signal,g._fetchAbortController=S,"requestTimeout"in h&&h.requestTimeout!==0&&(g._fetchTimer=ot.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},h.requestTimeout))}ot.fetch(g._opts.url,{method:g._opts.method,headers:B,body:P||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:T}).then(function(H){g._fetchResponse=H,g._resetTimers(!1),g._connect()},function(H){g._resetTimers(!0),g._destroyed||g.emit("error",H)})}else{var E=g._xhr=new ot.XMLHttpRequest;try{E.open(g._opts.method,g._opts.url,!0)}catch(H){e.nextTick(function(){g.emit("error",H)});return}"responseType"in E&&(E.responseType=g._mode),"withCredentials"in E&&(E.withCredentials=!!h.withCredentials),g._mode==="text"&&"overrideMimeType"in E&&E.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in h&&(E.timeout=h.requestTimeout,E.ontimeout=function(){g.emit("requestTimeout")}),B.forEach(function(H){E.setRequestHeader(H[0],H[1])}),g._response=null,E.onreadystatechange=function(){switch(E.readyState){case s.LOADING:case s.DONE:g._onXHRProgress();break}},g._mode==="moz-chunked-arraybuffer"&&(E.onprogress=function(){g._onXHRProgress()}),E.onerror=function(){g._destroyed||(g._resetTimers(!0),g.emit("error",new Error("XHR error")))};try{E.send(P)}catch(H){e.nextTick(function(){g.emit("error",H)});return}}}};function p(g){try{var h=g.status;return h!==null&&h!==0}catch{return!1}}f.prototype._onXHRProgress=function(){var g=this||ot;g._resetTimers(!1),!(!p(g._xhr)||g._destroyed)&&(g._response||g._connect(),g._response._onXHRProgress(g._resetTimers.bind(g)))},f.prototype._connect=function(){var g=this||ot;g._destroyed||(g._response=new i(g._xhr,g._fetchResponse,g._mode,g._resetTimers.bind(g)),g._response.on("error",function(h){g.emit("error",h)}),g.emit("response",g._response))},f.prototype._write=function(g,h,v){var P=this||ot;P._body.push(g),v()},f.prototype._resetTimers=function(g){var h=this||ot;ot.clearTimeout(h._socketTimer),h._socketTimer=null,g?(ot.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=ot.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},f.prototype.abort=f.prototype.destroy=function(g){var h=this||ot;h._destroyed=!0,h._resetTimers(!0),h._response&&(h._response._destroyed=!0),h._xhr?h._xhr.abort():h._fetchAbortController&&h._fetchAbortController.abort(),g&&h.emit("error",g)},f.prototype.end=function(g,h,v){var P=this||ot;typeof g=="function"&&(v=g,g=void 0),a.Writable.prototype.end.call(P,g,h,v)},f.prototype.setTimeout=function(g,h){var v=this||ot;h&&v.once("timeout",h),v._socketTimeout=g,v._resetTimers(!1)},f.prototype.flushHeaders=function(){},f.prototype.setNoDelay=function(){},f.prototype.setSocketKeepAlive=function(){};var y=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return Ys}function Ok(){if(bh)return Xs;bh=!0,Xs=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var o=arguments[r];for(var a in o)t.call(o,a)&&(n[a]=o[a])}return n}return Xs}function Rk(){return wh||(wh=!0,Qs={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}),Qs}function Nk(){if(xh)return el;xh=!0;var t=Ck(),e=Oh(),n=Ok(),r=Rk(),o=De,a=el;return a.request=function(i,s){typeof i=="string"?i=o.parse(i):i=n(i);var l=Mk.location.protocol.search(/^https?:$/)===-1?"http:":"",f=i.protocol||l,p=i.hostname||i.host,y=i.port,g=i.path||"/";p&&p.indexOf(":")!==-1&&(p="["+p+"]"),i.url=(p?f+"//"+p:"")+(y?":"+y:"")+g,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var h=new t(i);return s&&h.on("response",s),h},a.get=function(s,l){var f=a.request(s,l);return f.end(),f},a.ClientRequest=t,a.IncomingMessage=e.IncomingMessage,a.Agent=function(){},a.Agent.defaultMaxSockets=4,a.globalAgent=new a.Agent,a.STATUS_CODES=r,a.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],el}var Bt,th,Ln,Hs,nh,Us,rh,$s,ih,Zs,oh,js,ah,Ks,sh,lh,Ls,uh,Fs,ch,Ws,fh,zs,dh,qs,ph,gh,Gs,yh,Vs,mh,Js,hh,wt,vh,Lo,Th,Fo,Ys,_h,ot,Xs,bh,Qs,wh,el,xh,Mk,tn,Dk,Hk,Uk,$k,Zk,jk,Kk,Lk,Mh=at(()=>{A();O();C();as();Vy();ss();yi();Cm();jo();xs();Dm();$m();eh();ks();Bt={},th=!1,Ln=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Hs={},nh=!1;Us={},rh=!1;$s={},ih=!1;Zs={},oh=!1;js={},ah=!1;Ks={},sh=!1,lh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ls={},uh=!1;Fs={},ch=!1;Ws={},fh=!1;zs={},dh=!1;qs={},ph=!1,gh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Gs={},yh=!1;Vs={},mh=!1;Js={},hh=!1;wt={},vh=!1;Lo={},Th=!1,Fo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ys={},_h=!1,ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Xs={},bh=!1;Qs={},wh=!1;el={},xh=!1,Mk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;tn=Nk(),Dk=tn.Agent,Hk=tn.ClientRequest,Uk=tn.IncomingMessage,$k=tn.METHODS,Zk=tn.STATUS_CODES,jk=tn.get,Kk=tn.globalAgent,Lk=tn.request});A();O();C();var Dy={};hn(Dy,{defaults:()=>LB,markdown:()=>KB});A();O();C();A();O();C();A();O();C();var Sa=Object.defineProperty,Xv=Object.defineProperties,Qv=Object.getOwnPropertyDescriptors,Ei=Object.getOwnPropertySymbols,tf=Object.prototype.hasOwnProperty,nf=Object.prototype.propertyIsEnumerable,hc=(t,e,n)=>e in t?Sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))tf.call(e,n)&&hc(t,n,e[n]);if(Ei)for(var n of Ei(e))nf.call(e,n)&&hc(t,n,e[n]);return t},N=(t,e)=>Xv(t,Qv(e)),d=(t,e)=>Sa(t,"name",{value:e,configurable:!0}),rf=(t,e)=>{var n={};for(var r in t)tf.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ei)for(var r of Ei(t))e.indexOf(r)<0&&nf.call(t,r)&&(n[r]=t[r]);return n},so=(t,e)=>{for(var n in e)Sa(t,n,{get:e[n],enumerable:!0})},IA={},eT={};so(eT,{errors:()=>uf,fromJSONSchema:()=>ey,fromJSONSchemaLegacy:()=>dB,fromObject:()=>Ba,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>UB,toTypescriptSchema:()=>$a,toTypescriptType:()=>ka});var X={};so(X,{BRAND:()=>Kx,DIRTY:()=>Jn,EMPTY_PATH:()=>Ux,INVALID:()=>pe,NEVER:()=>KP,OK:()=>gt,ParseInputLazyPath:()=>Ot,ParseStatus:()=>Tt,Schema:()=>he,ZodAny:()=>Lr,ZodArray:()=>Fr,ZodBigInt:()=>La,ZodBoolean:()=>Fa,ZodBranded:()=>Wa,ZodCatch:()=>za,ZodDate:()=>qa,ZodDefault:()=>To,ZodDiscriminatedUnion:()=>mg,ZodEffects:()=>In,ZodEnum:()=>or,ZodError:()=>Wt,ZodFirstPartyTypeKind:()=>rg,ZodFunction:()=>vg,ZodIntersection:()=>Va,ZodIssueCode:()=>V,ZodLazy:()=>Ja,ZodLiteral:()=>Ya,ZodMap:()=>_g,ZodNaN:()=>wg,ZodNativeEnum:()=>Xa,ZodNever:()=>qr,ZodNull:()=>Qa,ZodNullable:()=>er,ZodNumber:()=>es,ZodObject:()=>tr,ZodOptional:()=>ln,ZodParsedType:()=>ne,ZodPipeline:()=>ts,ZodPromise:()=>bo,ZodReadonly:()=>wo,ZodRecord:()=>Ig,ZodRef:()=>Cg,ZodSchema:()=>he,ZodSet:()=>Og,ZodString:()=>yt,ZodSymbol:()=>Lg,ZodTransformer:()=>In,ZodTuple:()=>rr,ZodType:()=>he,ZodUndefined:()=>xo,ZodUnion:()=>ns,ZodUnknown:()=>Hr,ZodVoid:()=>qg,addIssueToContext:()=>te,agent:()=>Vx,aimodel:()=>eP,any:()=>fP,array:()=>yP,bigint:()=>aP,boolean:()=>Jg,coerce:()=>jP,conversation:()=>zx,createZodEnum:()=>_o,cuid2Regex:()=>Mg,cuidRegex:()=>Rg,custom:()=>gg,datasource:()=>tP,date:()=>sP,default:()=>NP,discriminatedUnion:()=>TP,effect:()=>Xc,emailRegex:()=>Hg,enum:()=>AP,errorUtil:()=>ue,event:()=>Jx,function:()=>SP,getErrorMap:()=>jr,getParsedType:()=>sn,instanceof:()=>iP,intent:()=>Qx,intersection:()=>_P,ipv4Regex:()=>$g,ipv6Regex:()=>Zg,isAborted:()=>wa,isAsync:()=>Ii,isDirty:()=>xa,isEmojiRegex:()=>Lx,isValid:()=>Kr,knowledgebase:()=>nP,late:()=>rP,lazy:()=>kP,literal:()=>IP,makeIssue:()=>ki,map:()=>BP,message:()=>Gx,nan:()=>oP,nativeEnum:()=>CP,never:()=>pP,null:()=>cP,nullable:()=>MP,number:()=>Vg,object:()=>mP,objectUtil:()=>ba,oboolean:()=>ZP,onumber:()=>$P,optional:()=>RP,ostring:()=>UP,pipeline:()=>HP,preprocess:()=>DP,processCreateParams:()=>me,promise:()=>OP,quotelessJson:()=>Hx,readonly:()=>PP,record:()=>wP,ref:()=>xP,set:()=>EP,setErrorMap:()=>ag,strictObject:()=>hP,string:()=>Gg,symbol:()=>lP,table:()=>Yx,tablerow:()=>Xx,transformer:()=>Xc,tuple:()=>bP,ulidRegex:()=>Ng,undefined:()=>uP,union:()=>vP,unknown:()=>dP,user:()=>qx,util:()=>be,uuidRegex:()=>Dg,variable:()=>Wx,void:()=>gP});var le="x-zui";function of(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:se(t)}d(of,"primitiveToTypscriptLiteralType");function se(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${se(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:typeof t=="string"?lf(t):JSON.stringify(t)}d(se,"primitiveToTypescriptValue");function Yn(t){return typeof t>"u"?"undefined":JSON.stringify(t)}d(Yn,"unknownToTypescriptValue");var af=d((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([o,a])=>`${da(o)}: ${Yn(a)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),da=d(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:se(t),"toPropertyKey"),tT=d(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),sf=d(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(tT).filter(r=>!!r).join("")},"toTypeArgumentName"),vc=d(t=>{for(var e;t.length&&!((e=t[0])!=null&&e.trim());)t.shift();for(;t.length&&!t[t.length-1].trim();)t.pop()},"trimEmptyLinesInPlace"),nt=d(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
|
|
10
|
+
`)):s=t.stylize("[Circular]","special")),$n(i)){if(a&&o.match(/^\d+$/))return s;(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+s}function Im(t){return Array.isArray(t)}function ms(t){return typeof t=="boolean"}function Zo(t){return t===null}function Am(t){return typeof t=="number"}function Ho(t){return typeof t=="string"}function $n(t){return t===void 0}function Jr(t){return ur(t)&&hs(t)==="[object RegExp]"}function ur(t){return typeof t=="object"&&t!==null}function Uo(t){return ur(t)&&hs(t)==="[object Date]"}function Yr(t){return ur(t)&&(hs(t)==="[object Error]"||t instanceof Error)}function Oo(t){return typeof t=="function"}function hs(t){return Object.prototype.toString.call(t)}function fs(t){return t<10?"0"+t.toString(10):t.toString(10)}function mE(){var t=new Date,e=[fs(t.getHours()),fs(t.getMinutes()),fs(t.getSeconds())].join(":");return[t.getDate(),yE[t.getMonth()],e].join(" ")}function Cm(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function hE(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var um,Jt,Yt,lr,Qe,Un,Xt,sr,Co,je,qB,gs,$o,dm,GB,VB,JB,YB,XB,pm,gm,Xy,QB,eE,tE,ym,Ee,nE,rE,iE,mm,ys,Pt,bt,oE,We,sE,lE,uE,Vr,L,Ut,lm,dE,Io,km,Ao,yE,Hn,RC,jo=at(()=>{A();O();C();lr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=um={};(function(){try{Jt=typeof setTimeout=="function"?setTimeout:ds}catch{Jt=ds}try{Yt=typeof clearTimeout=="function"?clearTimeout:ps}catch{Yt=ps}})();Xt=[],sr=!1,Co=-1;Qe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Xt.push(new Yy(t,e)),Xt.length!==1||sr||cm(fm)},Yy.prototype.run=function(){(this||lr).fun.apply(null,(this||lr).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=Vt,Qe.addListener=Vt,Qe.once=Vt,Qe.off=Vt,Qe.removeListener=Vt,Qe.removeAllListeners=Vt,Qe.emit=Vt,Qe.prependListener=Vt,Qe.prependOnceListener=Vt,Qe.listeners=function(t){return[]},Qe.binding=function(t){throw new Error("process.binding is not supported")},Qe.cwd=function(){return"/"},Qe.chdir=function(t){throw new Error("process.chdir is not supported")},Qe.umask=function(){return 0};je=um;je.addListener;je.argv;je.binding;je.browser;je.chdir;je.cwd;je.emit;je.env;je.listeners;je.nextTick;je.off;je.on;je.once;je.prependListener;je.prependOnceListener;je.removeAllListeners;je.removeListener;je.title;je.umask;je.version;je.versions;qB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",gs=Object.prototype.toString,$o=function(t){return!(qB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&gs.call(t)==="[object Arguments]"},dm=function(t){return!!$o(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&gs.call(t)!=="[object Array]"&&gs.call(t.callee)==="[object Function]"},GB=(function(){return $o(arguments)})();$o.isLegacyArguments=dm;VB=GB?$o:dm,JB=Object.prototype.toString,YB=Function.prototype.toString,XB=/^\s*(?:function)?\*/,pm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",gm=Object.getPrototypeOf,Xy=(function(){if(!pm)return!1;try{return Function("return function*() {}")()}catch{}})(),QB=Xy?gm(Xy):{},eE=function(t){return typeof t=="function"&&(!!XB.test(YB.call(t))||(pm?gm(t)===QB:JB.call(t)==="[object GeneratorFunction]"))},tE=typeof Object.create=="function"?function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},ym=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},nE=ym,rE=VB,iE=eE;mm=typeof BigInt<"u",ys=typeof Symbol<"u",Pt=ys&&Symbol.toStringTag!==void 0,bt=typeof Uint8Array<"u",oE=typeof ArrayBuffer<"u";if(bt&&Pt)var aE=Object.getPrototypeOf(Uint8Array.prototype),St=Zn(Object.getOwnPropertyDescriptor(aE,Symbol.toStringTag).get);We=Zn(Object.prototype.toString),sE=Zn(Number.prototype.valueOf),lE=Zn(String.prototype.valueOf),uE=Zn(Boolean.prototype.valueOf);if(mm)var cE=Zn(BigInt.prototype.valueOf);if(ys)var fE=Zn(Symbol.prototype.valueOf);Ee.isArgumentsObject=rE,Ee.isGeneratorFunction=iE,Ee.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},Ee.isArrayBufferView=function(t){return oE&&ArrayBuffer.isView?ArrayBuffer.isView(t):Qy(t)||tm(t)},Ee.isTypedArray=Qy,Ee.isUint8Array=hm,Ee.isUint8ClampedArray=vm,Ee.isUint16Array=Tm,Ee.isUint32Array=_m,Ee.isInt8Array=bm,Ee.isInt16Array=wm,Ee.isInt32Array=xm,Ee.isFloat32Array=Pm,Ee.isFloat64Array=Bm,Ee.isBigInt64Array=Em,Ee.isBigUint64Array=Sm,Eo.working=typeof Map<"u"&&Eo(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(Eo.working?Eo(t):t instanceof Map)},So.working=typeof Set<"u"&&So(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(So.working?So(t):t instanceof Set)},ko.working=typeof WeakMap<"u"&&ko(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(ko.working?ko(t):t instanceof WeakMap)},ls.working=typeof WeakSet<"u"&&ls(new WeakSet),Ee.isWeakSet=function(t){return ls(t)},Ro.working=typeof ArrayBuffer<"u"&&Ro(new ArrayBuffer),Ee.isArrayBuffer=em,Mo.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Mo(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=tm,No.working=typeof SharedArrayBuffer<"u"&&No(new SharedArrayBuffer),Ee.isSharedArrayBuffer=nm,Ee.isAsyncFunction=function(t){return We(t)==="[object AsyncFunction]"},Ee.isMapIterator=function(t){return We(t)==="[object Map Iterator]"},Ee.isSetIterator=function(t){return We(t)==="[object Set Iterator]"},Ee.isGeneratorObject=function(t){return We(t)==="[object Generator]"},Ee.isWebAssemblyCompiledModule=function(t){return We(t)==="[object WebAssembly.Module]"},Ee.isNumberObject=rm,Ee.isStringObject=im,Ee.isBooleanObject=om,Ee.isBigIntObject=am,Ee.isSymbolObject=sm,Ee.isBoxedPrimitive=function(t){return rm(t)||im(t)||om(t)||am(t)||sm(t)},Ee.isAnyArrayBuffer=function(t){return bt&&(em(t)||nm(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));Vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Ut=je,lm=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},dE=/%[sdj%]/g;L.format=function(t){if(!Ho(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(fn(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,a=String(t).replace(dE,(function(s){if(s==="%%")return"%";if(n>=o)return s;switch(s){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return s}})),i=r[n];n<o;i=r[++n])Zo(i)||!ur(i)?a+=" "+i:a+=" "+fn(i);return a},L.deprecate=function(t,e){if(Ut!==void 0&&Ut.noDeprecation===!0)return t;if(Ut===void 0)return function(){return L.deprecate(t,e).apply(this||Vr,arguments)};var n=!1;return function(){if(!n){if(Ut.throwDeprecation)throw new Error(e);Ut.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Vr,arguments)}};Io={},km=/^$/;Ut.env.NODE_DEBUG&&(Ao=Ut.env.NODE_DEBUG,Ao=Ao.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),km=new RegExp("^"+Ao+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Io[t])if(km.test(t)){var e=Ut.pid;Io[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Io[t]=function(){};return Io[t]},L.inspect=fn,fn.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},fn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=Im,L.isBoolean=ms,L.isNull=Zo,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Am,L.isString=Ho,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=$n,L.isRegExp=Jr,L.types.isRegExp=Jr,L.isObject=ur,L.isDate=Uo,L.types.isDate=Uo,L.isError=Yr,L.types.isNativeError=Yr,L.isFunction=Oo,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=ym;yE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",mE(),L.format.apply(L,arguments))},L.inherits=tE,L._extend=function(t,e){if(!e||!ur(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Hn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;L.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Hn&&t[Hn]){var e;if(typeof(e=t[Hn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Hn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,o=new Promise((function(s,l){n=s,r=l})),a=[],i=0;i<arguments.length;i++)a.push(arguments[i]);a.push((function(s,l){s?r(s):n(l)}));try{t.apply(this||Vr,a)}catch(s){r(s)}return o}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Hn&&Object.defineProperty(e,Hn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,lm(t))},L.promisify.custom=Hn,L.callbackify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=n.pop();if(typeof o!="function")throw new TypeError("The last argument must be of type Function");var a=this||Vr,i=function(){return o.apply(a,arguments)};t.apply(this||Vr,n).then((function(s){Ut.nextTick(i.bind(null,null,s))}),(function(s){Ut.nextTick(hE.bind(null,s,i))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,lm(t)),e};L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;L.promisify;L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;RC=L.promisify;L.types});var $C,Om=at(()=>{A();O();C();jo();L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;$C=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function bs(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function vE(){!cr||!jn||(cr=!1,jn.length?Qt=jn.concat(Qt):Ko=-1,Qt.length&&Rm())}function Rm(){if(!cr){var t=setTimeout(vE,0);cr=!0;for(var e=Qt.length;e;){for(jn=Qt,Qt=[];++Ko<e;)jn&&jn[Ko].run();Ko=-1,e=Qt.length}jn=null,cr=!1,clearTimeout(t)}}function TE(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Qt.push(new Mm(t,e)),Qt.length===1&&!cr&&setTimeout(Rm,0)}function Mm(t,e){this.fun=t,this.array=e}function ct(){}function DE(t){bs("_linkedBinding")}function ZE(t){bs("dlopen")}function jE(){return[]}function KE(){return[]}function YE(t,e){if(!t)throw new Error(e||"assertion error")}function tS(){return!1}function vS(){return dn.now()/1e3}function _s(t){var e=Math.floor((Date.now()-dn.now())*.001),n=dn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=Ts)),[r,o]}function pn(){return Rt}function AS(t){return[]}var Qt,cr,jn,Ko,_E,bE,wE,xE,PE,BE,EE,SE,kE,IE,AE,CE,OE,RE,ME,NE,HE,UE,$E,LE,FE,ws,WE,zE,qE,GE,VE,JE,XE,QE,eS,nS,rS,iS,oS,aS,sS,lS,uS,cS,fS,dS,pS,gS,yS,mS,hS,dn,vs,Ts,TS,_S,bS,wS,xS,PS,BS,ES,SS,kS,IS,Rt,xs=at(()=>{A();O();C();Qt=[],cr=!1,Ko=-1;Mm.prototype.run=function(){this.fun.apply(null,this.array)};_E="browser",bE="x64",wE="browser",xE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},PE=["/usr/bin/node"],BE=[],EE="v16.8.0",SE={},kE=function(t,e){console.warn((e?e+": ":"")+t)},IE=function(t){bs("binding")},AE=function(t){return 0},CE=function(){return"/"},OE=function(t){},RE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};ME=ct,NE=[];HE={},UE=!1,$E={};LE=ct,FE=ct,ws=function(){return{}},WE=ws,zE=ws,qE=ct,GE=ct,VE=ct,JE={};XE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},QE=ct,eS=ct;nS=ct,rS=ct,iS=ct,oS=ct,aS=ct,sS=void 0,lS=void 0,uS=void 0,cS=ct,fS=2,dS=1,pS="/bin/usr/node",gS=9229,yS="node",mS=[],hS=ct,dn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};dn.now===void 0&&(vs=Date.now(),dn.timing&&dn.timing.navigationStart&&(vs=dn.timing.navigationStart),dn.now=()=>Date.now()-vs);Ts=1e9;_s.bigint=function(t){var e=_s(t);return typeof BigInt>"u"?e[0]*Ts+e[1]:BigInt(e[0]*Ts)+BigInt(e[1])};TS=10,_S={},bS=0;wS=pn,xS=pn,PS=pn,BS=pn,ES=pn,SS=ct,kS=pn,IS=pn;Rt={version:EE,versions:SE,arch:bE,platform:wE,release:RE,_rawDebug:ME,moduleLoadList:NE,binding:IE,_linkedBinding:DE,_events:_S,_eventsCount:bS,_maxListeners:TS,on:pn,addListener:wS,once:xS,off:PS,removeListener:BS,removeAllListeners:ES,emit:SS,prependListener:kS,prependOnceListener:IS,listeners:AS,domain:HE,_exiting:UE,config:$E,dlopen:ZE,uptime:vS,_getActiveRequests:jE,_getActiveHandles:KE,reallyExit:LE,_kill:FE,cpuUsage:ws,resourceUsage:WE,memoryUsage:zE,kill:qE,exit:GE,openStdin:VE,allowedNodeEnvironmentFlags:JE,assert:YE,features:XE,_fatalExceptions:QE,setUncaughtExceptionCaptureCallback:eS,hasUncaughtExceptionCaptureCallback:tS,emitWarning:kE,nextTick:TE,_tickCallback:nS,_debugProcess:rS,_debugEnd:iS,_startProfilerIdleNotifier:oS,_stopProfilerIdleNotifier:aS,stdout:sS,stdin:uS,stderr:lS,abort:cS,umask:AE,chdir:OE,cwd:CE,env:xE,title:_E,argv:PE,execArgv:BE,pid:fS,ppid:dS,execPath:pS,debugPort:gS,hrtime:_s,argv0:yS,_preload_modules:mS,setSourceMapsEnabled:hS}});function Dm(){if(Nm)return Ps;Nm=!0,Ps=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function a(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this||Bs,arguments)}return a}function e(n){try{if(!Bs.localStorage)return!1}catch{return!1}var r=Bs.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return Ps}var Ps,Nm,Bs,Hm=at(()=>{A();O();C();Ps={},Nm=!1,Bs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function CS(){if(Um)return Qr;Um=!0;var t=Dt(),e=t.Buffer;function n(o,a){for(var i in o)a[i]=o[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Qr=t:(n(t,Qr),Qr.Buffer=r);function r(o,a,i){return e(o,a,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(o,a,i){if(typeof o=="number")throw new TypeError("Argument must not be a number");return e(o,a,i)},r.alloc=function(o,a,i){if(typeof o!="number")throw new TypeError("Argument must be a number");var s=e(o);return a!==void 0?typeof i=="string"?s.fill(a,i):s.fill(a):s.fill(0),s},r.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e(o)},r.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)},Qr}function OS(){if($m)return Es;$m=!0;var t=CS().Buffer,e=t.isEncoding||function(T){switch(T=""+T,T&&T.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(T){if(!T)return"utf8";for(var S;;)switch(T){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return T;default:if(S)return;T=(""+T).toLowerCase(),S=!0}}function r(T){var S=n(T);if(typeof S!="string"&&(t.isEncoding===e||!e(T)))throw new Error("Unknown encoding: "+T);return S||T}Es.StringDecoder=o;function o(T){this.encoding=r(T);var S;switch(this.encoding){case"utf16le":this.text=y,this.end=g,S=4;break;case"utf8":this.fillLast=l,S=4;break;case"base64":this.text=h,this.end=v,S=3;break;default:this.write=P,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}o.prototype.write=function(T){if(T.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(T),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<T.length?S?S+this.text(T,E):this.text(T,E):S||""},o.prototype.end=p,o.prototype.text=f,o.prototype.fillLast=function(T){if(this.lastNeed<=T.length)return T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,T.length),this.lastNeed-=T.length};function a(T){return T<=127?0:T>>5===6?2:T>>4===14?3:T>>3===30?4:T>>6===2?-1:-2}function i(T,S,E){var H=S.length-1;if(H<E)return 0;var j=a(S[H]);return j>=0?(j>0&&(T.lastNeed=j-1),j):--H<E||j===-2?0:(j=a(S[H]),j>=0?(j>0&&(T.lastNeed=j-2),j):--H<E||j===-2?0:(j=a(S[H]),j>=0?(j>0&&(j===2?j=0:T.lastNeed=j-3),j):0))}function s(T,S,E){if((S[0]&192)!==128)return T.lastNeed=0,"\uFFFD";if(T.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return T.lastNeed=1,"\uFFFD";if(T.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return T.lastNeed=2,"\uFFFD"}}function l(T){var S=this.lastTotal-this.lastNeed,E=s(this,T);if(E!==void 0)return E;if(this.lastNeed<=T.length)return T.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,S,0,T.length),this.lastNeed-=T.length}function f(T,S){var E=i(this,T,S);if(!this.lastNeed)return T.toString("utf8",S);this.lastTotal=E;var H=T.length-(E-this.lastNeed);return T.copy(this.lastChar,0,H),T.toString("utf8",S,H)}function p(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+"\uFFFD":S}function y(T,S){if((T.length-S)%2===0){var E=T.toString("utf16le",S);if(E){var H=E.charCodeAt(E.length-1);if(H>=55296&&H<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=T[T.length-1],T.toString("utf16le",S,T.length-1)}function g(T){var S=T&&T.length?this.write(T):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(T,S){var E=(T.length-S)%3;return E===0?T.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=T[T.length-1]:(this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1]),T.toString("base64",S,T.length-E))}function v(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function P(T){return T.toString(this.encoding)}function B(T){return T&&T.length?this.write(T):""}return Es}var Qr,Um,Es,$m,ei,QC,Zm=at(()=>{A();O();C();yi();Qr={},Um=!1;Es={},$m=!1;ei=OS();ei.StringDecoder;QC=ei.StringDecoder});function RS(){if(jm)return Ss;jm=!0;var t=Ss={},e,n;function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?n=clearTimeout:n=o}catch{n=o}})();function a(P){if(e===setTimeout)return setTimeout(P,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(P,0);try{return e(P,0)}catch{try{return e.call(null,P,0)}catch{return e.call(this||fr,P,0)}}}function i(P){if(n===clearTimeout)return clearTimeout(P);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||fr,P)}}}var s=[],l=!1,f,p=-1;function y(){!l||!f||(l=!1,f.length?s=f.concat(s):p=-1,s.length&&g())}function g(){if(!l){var P=a(y);l=!0;for(var B=s.length;B;){for(f=s,s=[];++p<B;)f&&f[p].run();p=-1,B=s.length}f=null,l=!1,i(P)}}t.nextTick=function(P){var B=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)B[T-1]=arguments[T];s.push(new h(P,B)),s.length===1&&!l&&a(g)};function h(P,B){(this||fr).fun=P,(this||fr).array=B}h.prototype.run=function(){(this||fr).fun.apply(null,(this||fr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function v(){}return t.on=v,t.addListener=v,t.once=v,t.off=v,t.removeListener=v,t.removeAllListeners=v,t.emit=v,t.prependListener=v,t.prependOnceListener=v,t.listeners=function(P){return[]},t.binding=function(P){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(P){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},Ss}var Ss,jm,fr,Ke,ks=at(()=>{A();O();C();Ss={},jm=!1,fr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=RS();Ke.platform="browser";Ke.addListener;Ke.argv;Ke.binding;Ke.browser;Ke.chdir;Ke.cwd;Ke.emit;Ke.env;Ke.listeners;Ke.nextTick;Ke.off;Ke.on;Ke.once;Ke.prependListener;Ke.prependOnceListener;Ke.removeAllListeners;Ke.removeListener;Ke.title;Ke.umask;Ke.version;Ke.versions});function MS(){if(Km)return Is;Km=!0;var t=Ke;function e(a){if(typeof a!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function n(a,i){for(var s="",l=0,f=-1,p=0,y,g=0;g<=a.length;++g){if(g<a.length)y=a.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||p===1))if(f!==g-1&&p===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",l=0):(s=s.slice(0,h),l=s.length-1-s.lastIndexOf("/")),f=g,p=0;continue}}else if(s.length===2||s.length===1){s="",l=0,f=g,p=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+a.slice(f+1,g):s=a.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return s}function r(a,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+a+l:l}var o={resolve:function(){for(var i="",s=!1,l,f=arguments.length-1;f>=-1&&!s;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,s=p.charCodeAt(0)===47)}return i=n(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=o.resolve(i),s=o.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<s.length&&s.charCodeAt(y)===47;++y);for(var g=s.length,h=g-y,v=p<h?p:h,P=-1,B=0;B<=v;++B){if(B===v){if(h>v){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>v&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(T!==S)break;T===47&&(P=B)}var E="";for(B=l+P+1;B<=f;++B)(B===f||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+s.slice(y+P):(y+=P,s.charCodeAt(y)===47&&++y,s.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(s=i.charCodeAt(y),s===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var g=s.length-1,h=-1;for(y=i.length-1;y>=0;--y){var v=i.charCodeAt(y);if(v===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(v===s.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=h))}return l===f?f=h:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else f===-1&&(p=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var s=-1,l=0,f=-1,p=!0,y=0,g=i.length-1;g>=0;--g){var h=i.charCodeAt(g);if(h===47){if(!p){l=g+1;break}continue}f===-1&&(p=!1,f=g+1),h===46?s===-1?s=g:y!==1&&(y=1):s!==-1&&(y=-1)}return s===-1||f===-1||y===0||y===1&&s===f-1&&s===l+1?"":i.slice(s,f)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),f=l===47,p;f?(s.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,v=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!v){g=P+1;break}continue}h===-1&&(v=!1,h=P+1),l===46?y===-1?y=P:B!==1&&(B=1):y!==-1&&(B=-1)}return y===-1||h===-1||B===0||B===1&&y===h-1&&y===g+1?h!==-1&&(g===0&&f?s.base=s.name=i.slice(1,h):s.base=s.name=i.slice(g,h)):(g===0&&f?(s.name=i.slice(1,y),s.base=i.slice(1,h)):(s.name=i.slice(g,y),s.base=i.slice(g,h)),s.ext=i.slice(y,h)),g>0?s.dir=i.slice(0,g-1):f&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Is=o,Is}function Kn(t){throw new RangeError(US[t])}function Fm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let o=(function(a,i){let s=[],l=a.length;for(;l--;)s[l]=i(a[l]);return s})((t=t.replace(HS,".")).split("."),e).join(".");return r+o}function Qm(t){let e=[],n=0,r=t.length;for(;n<r;){let o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let a=t.charCodeAt(n++);(64512&a)==56320?e.push(((1023&o)<<10)+(1023&a)+65536):(e.push(o),n--)}else e.push(o)}return e}function ZS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function ni(t,e,n){if(t&&$t.isObject(t)&&t instanceof kt)return t;var r=new kt;return r.parse(t,e,n),r}function JS(){if(Ym)return Rs;Ym=!0;var t=je;function e(a){if(typeof a!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function n(a,i){for(var s="",l=0,f=-1,p=0,y,g=0;g<=a.length;++g){if(g<a.length)y=a.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||p===1))if(f!==g-1&&p===2){if(s.length<2||l!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var h=s.lastIndexOf("/");if(h!==s.length-1){h===-1?(s="",l=0):(s=s.slice(0,h),l=s.length-1-s.lastIndexOf("/")),f=g,p=0;continue}}else if(s.length===2||s.length===1){s="",l=0,f=g,p=0;continue}}i&&(s.length>0?s+="/..":s="..",l=2)}else s.length>0?s+="/"+a.slice(f+1,g):s=a.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return s}function r(a,i){var s=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return s?s===i.root?s+l:s+a+l:l}var o={resolve:function(){for(var i="",s=!1,l,f=arguments.length-1;f>=-1&&!s;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,s=p.charCodeAt(0)===47)}return i=n(i,!s),s?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var s=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!s),i.length===0&&!s&&(i="."),i.length>0&&l&&(i+="/"),s?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,s=0;s<arguments.length;++s){var l=arguments[s];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,s){if(e(i),e(s),i===s||(i=o.resolve(i),s=o.resolve(s),i===s))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<s.length&&s.charCodeAt(y)===47;++y);for(var g=s.length,h=g-y,v=p<h?p:h,P=-1,B=0;B<=v;++B){if(B===v){if(h>v){if(s.charCodeAt(y+B)===47)return s.slice(y+B+1);if(B===0)return s.slice(y+B)}else p>v&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var T=i.charCodeAt(l+B),S=s.charCodeAt(y+B);if(T!==S)break;T===47&&(P=B)}var E="";for(B=l+P+1;B<=f;++B)(B===f||i.charCodeAt(B)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+s.slice(y+P):(y+=P,s.charCodeAt(y)===47&&++y,s.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var s=i.charCodeAt(0),l=s===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(s=i.charCodeAt(y),s===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(s!==void 0&&s.length>0&&s.length<=i.length){if(s.length===i.length&&s===i)return"";var g=s.length-1,h=-1;for(y=i.length-1;y>=0;--y){var v=i.charCodeAt(y);if(v===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(v===s.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=h))}return l===f?f=h:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!p){l=y+1;break}}else f===-1&&(p=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var s=-1,l=0,f=-1,p=!0,y=0,g=i.length-1;g>=0;--g){var h=i.charCodeAt(g);if(h===47){if(!p){l=g+1;break}continue}f===-1&&(p=!1,f=g+1),h===46?s===-1?s=g:y!==1&&(y=1):s!==-1&&(y=-1)}return s===-1||f===-1||y===0||y===1&&s===f-1&&s===l+1?"":i.slice(s,f)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var s={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return s;var l=i.charCodeAt(0),f=l===47,p;f?(s.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,v=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!v){g=P+1;break}continue}h===-1&&(v=!1,h=P+1),l===46?y===-1?y=P:B!==1&&(B=1):y!==-1&&(B=-1)}return y===-1||h===-1||B===0||B===1&&y===h-1&&y===g+1?h!==-1&&(g===0&&f?s.base=s.name=i.slice(1,h):s.base=s.name=i.slice(g,h)):(g===0&&f?(s.name=i.slice(1,y),s.base=i.slice(1,h)):(s.name=i.slice(g,y),s.base=i.slice(g,h)),s.ext=i.slice(y,h)),g>0?s.dir=i.slice(0,g-1):f&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Rs=o,Rs}function lk(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Ns?uk(t):ck(t)}function uk(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(nk,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<ek||r>tk||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function ck(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function fk(t){let e=Xm.resolve(t),n=t.charCodeAt(t.length-1);(n===QS||Ns&&n===XS)&&e[e.length-1]!==Xm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(rk,"%25")),!Ns&&e.includes("\\")&&(e=e.replace(ik,"%5C")),e.includes(`
|
|
11
|
+
`)&&(e=e.replace(ok,"%0A")),e.includes("\r")&&(e=e.replace(ak,"%0D")),e.includes(" ")&&(e=e.replace(sk,"%09")),r.pathname=e,r}function xk(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Ds?Pk(t):Bk(t)}function Pk(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(hk,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<yk||r>mk||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function Bk(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function Ek(t){let e=Lm.resolve(t),n=t.charCodeAt(t.length-1);(n===gk||Ds&&n===pk)&&e[e.length-1]!==Lm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(vk,"%25")),!Ds&&e.includes("\\")&&(e=e.replace(Tk,"%5C")),e.includes(`
|
|
12
|
+
`)&&(e=e.replace(_k,"%0A")),e.includes("\r")&&(e=e.replace(bk,"%0D")),e.includes(" ")&&(e=e.replace(wk,"%09")),r.pathname=e,r}var Is,Km,Lm,pr,NS,DS,HS,US,Zt,As,Wm,eh,zm,qm,$S,jS,ti,KS,en,De,LS,$t,FS,WS,zS,qS,Ms,Gm,Vm,Jm,GS,VS,Cs,dr,Os,Rs,Ym,Xm,YS,XS,QS,ek,tk,Ns,nk,rk,ik,ok,ak,sk,dk,pk,gk,yk,mk,Ds,hk,vk,Tk,_k,bk,wk,th=at(()=>{A();O();C();jo();ks();Is={},Km=!1;Lm=MS(),pr=2147483647,NS=/^xn--/,DS=/[^\0-\x7E]/,HS=/[\x2E\u3002\uFF0E\uFF61]/g,US={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Zt=Math.floor,As=String.fromCharCode;Wm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},eh=function(t,e,n){let r=0;for(t=n?Zt(t/700):t>>1,t+=Zt(t/e);t>455;r+=36)t=Zt(t/35);return Zt(r+36*t/(t+38))},zm=function(t){let e=[],n=t.length,r=0,o=128,a=72,i=t.lastIndexOf("-");i<0&&(i=0);for(let l=0;l<i;++l)t.charCodeAt(l)>=128&&Kn("not-basic"),e.push(t.charCodeAt(l));for(let l=i>0?i+1:0;l<n;){let f=r;for(let y=1,g=36;;g+=36){l>=n&&Kn("invalid-input");let h=(s=t.charCodeAt(l++))-48<10?s-22:s-65<26?s-65:s-97<26?s-97:36;(h>=36||h>Zt((pr-r)/y))&&Kn("overflow"),r+=h*y;let v=g<=a?1:g>=a+26?26:g-a;if(h<v)break;let P=36-v;y>Zt(pr/P)&&Kn("overflow"),y*=P}let p=e.length+1;a=eh(r-f,p,f==0),Zt(r/p)>pr-o&&Kn("overflow"),o+=Zt(r/p),r%=p,e.splice(r++,0,o)}var s;return String.fromCodePoint(...e)},qm=function(t){let e=[],n=(t=Qm(t)).length,r=128,o=0,a=72;for(let l of t)l<128&&e.push(As(l));let i=e.length,s=i;for(i&&e.push("-");s<n;){let l=pr;for(let p of t)p>=r&&p<l&&(l=p);let f=s+1;l-r>Zt((pr-o)/f)&&Kn("overflow"),o+=(l-r)*f,r=l;for(let p of t)if(p<r&&++o>pr&&Kn("overflow"),p==r){let y=o;for(let g=36;;g+=36){let h=g<=a?1:g>=a+26?26:g-a;if(y<h)break;let v=y-h,P=36-h;e.push(As(Wm(h+v%P,0))),y=Zt(v/P)}e.push(As(Wm(y,0))),a=eh(o,f,s==i),o=0,++s}++o,++r}return e.join("")},$S={version:"2.1.0",ucs2:{decode:Qm,encode:t=>String.fromCodePoint(...t)},decode:zm,encode:qm,toASCII:function(t){return Fm(t,(function(e){return DS.test(e)?"xn--"+qm(e):e}))},toUnicode:function(t){return Fm(t,(function(e){return NS.test(e)?zm(e.slice(4).toLowerCase()):e}))}};jS=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if(typeof t!="string"||t.length===0)return o;var a=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var s=t.length;i>0&&s>i&&(s=i);for(var l=0;l<s;++l){var f,p,y,g,h=t[l].replace(a,"%20"),v=h.indexOf(n);v>=0?(f=h.substr(0,v),p=h.substr(v+1)):(f=h,p=""),y=decodeURIComponent(f),g=decodeURIComponent(p),ZS(o,y)?Array.isArray(o[y])?o[y].push(g):o[y]=[o[y],g]:o[y]=g}return o},ti=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},KS=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map((function(o){var a=encodeURIComponent(ti(o))+n;return Array.isArray(t[o])?t[o].map((function(i){return a+encodeURIComponent(ti(i))})).join(e):a+encodeURIComponent(ti(t[o]))})).join(e):r?encodeURIComponent(ti(r))+n+encodeURIComponent(ti(t)):""},en={};en.decode=en.parse=jS,en.encode=en.stringify=KS;en.decode;en.encode;en.parse;en.stringify;De={},LS=$S,$t={isString:function(t){return typeof t=="string"},isObject:function(t){return typeof t=="object"&&t!==null},isNull:function(t){return t===null},isNullOrUndefined:function(t){return t==null}};De.parse=ni,De.resolve=function(t,e){return ni(t,!1,!0).resolve(e)},De.resolveObject=function(t,e){return t?ni(t,!1,!0).resolveObject(e):e},De.format=function(t){return $t.isString(t)&&(t=ni(t)),t instanceof kt?t.format():kt.prototype.format.call(t)},De.Url=kt;FS=/^([a-z0-9.+-]+:)/i,WS=/:[0-9]*$/,zS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,qS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
|
|
13
|
+
`," "]),Ms=["'"].concat(qS),Gm=["%","/","?",";","#"].concat(Ms),Vm=["/","?","#"],Jm=/^[+a-z0-9A-Z_-]{0,63}$/,GS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,VS={javascript:!0,"javascript:":!0},Cs={javascript:!0,"javascript:":!0},dr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Os=en;kt.prototype.parse=function(t,e,n){if(!$t.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=r!==-1&&r<t.indexOf("#")?"?":"#",a=t.split(o);a[0]=a[0].replace(/\\/g,"/");var i=t=a.join(o);if(i=i.trim(),!n&&t.split("#").length===1){var s=zS.exec(i);if(s)return this.path=i,this.href=i,this.pathname=s[1],s[2]?(this.search=s[2],this.query=e?Os.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=FS.exec(i);if(l){var f=(l=l[0]).toLowerCase();this.protocol=f,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var p=i.substr(0,2)==="//";!p||l&&Cs[l]||(i=i.substr(2),this.slashes=!0)}if(!Cs[l]&&(p||l&&!dr[l])){for(var y,g,h=-1,v=0;v<Vm.length;v++)(P=i.indexOf(Vm[v]))!==-1&&(h===-1||P<h)&&(h=P);for((g=h===-1?i.lastIndexOf("@"):i.lastIndexOf("@",h))!==-1&&(y=i.slice(0,g),i=i.slice(g+1),this.auth=decodeURIComponent(y)),h=-1,v=0;v<Gm.length;v++){var P;(P=i.indexOf(Gm[v]))!==-1&&(h===-1||P<h)&&(h=P)}h===-1&&(h=i.length),this.host=i.slice(0,h),i=i.slice(h),this.parseHost(),this.hostname=this.hostname||"";var B=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!B)for(var T=this.hostname.split(/\./),S=(v=0,T.length);v<S;v++){var E=T[v];if(E&&!E.match(Jm)){for(var H="",j=0,re=E.length;j<re;j++)E.charCodeAt(j)>127?H+="x":H+=E[j];if(!H.match(Jm)){var ee=T.slice(0,v),ge=T.slice(v+1),ae=E.match(GS);ae&&(ee.push(ae[1]),ge.unshift(ae[2])),ge.length&&(i="/"+ge.join(".")+i),this.hostname=ee.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=LS.toASCII(this.hostname));var ie=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+ie,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!VS[f])for(v=0,S=Ms.length;v<S;v++){var ze=Ms[v];if(i.indexOf(ze)!==-1){var tt=encodeURIComponent(ze);tt===ze&&(tt=escape(ze)),i=i.split(ze).join(tt)}}var Ve=i.indexOf("#");Ve!==-1&&(this.hash=i.substr(Ve),i=i.slice(0,Ve));var Je=i.indexOf("?");if(Je!==-1?(this.search=i.substr(Je),this.query=i.substr(Je+1),e&&(this.query=Os.parse(this.query)),i=i.slice(0,Je)):e&&(this.search="",this.query={}),i&&(this.pathname=i),dr[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){ie=this.pathname||"";var ht=this.search||"";this.path=ie+ht}return this.href=this.format(),this},kt.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,a="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&$t.isObject(this.query)&&Object.keys(this.query).length&&(a=Os.stringify(this.query));var i=this.search||a&&"?"+a||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||dr[e])&&o!==!1?(o="//"+(o||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):o||(o=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+o+(n=n.replace(/[?#]/g,(function(s){return encodeURIComponent(s)})))+(i=i.replace("#","%23"))+r},kt.prototype.resolve=function(t){return this.resolveObject(ni(t,!1,!0)).format()},kt.prototype.resolveObject=function(t){if($t.isString(t)){var e=new kt;e.parse(t,!1,!0),t=e}for(var n=new kt,r=Object.keys(this),o=0;o<r.length;o++){var a=r[o];n[a]=this[a]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),s=0;s<i.length;s++){var l=i[s];l!=="protocol"&&(n[l]=t[l])}return dr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!dr[t.protocol]){for(var f=Object.keys(t),p=0;p<f.length;p++){var y=f[p];n[y]=t[y]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||Cs[t.protocol])n.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),n.pathname=g.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var h=n.pathname||"",v=n.search||"";n.path=h+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var P=n.pathname&&n.pathname.charAt(0)==="/",B=t.host||t.pathname&&t.pathname.charAt(0)==="/",T=B||P||n.host&&t.pathname,S=T,E=n.pathname&&n.pathname.split("/")||[],H=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!dr[n.protocol]);if(H&&(n.hostname="",n.port=null,n.host&&(E[0]===""?E[0]=n.host:E.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),T=T&&(g[0]===""||E[0]==="")),B)n.host=t.host||t.host===""?t.host:n.host,n.hostname=t.hostname||t.hostname===""?t.hostname:n.hostname,n.search=t.search,n.query=t.query,E=g;else if(g.length)E||(E=[]),E.pop(),E=E.concat(g),n.search=t.search,n.query=t.query;else if(!$t.isNullOrUndefined(t.search))return H&&(n.hostname=n.host=E.shift(),(ae=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=ae.shift(),n.host=n.hostname=ae.shift())),n.search=t.search,n.query=t.query,$t.isNull(n.pathname)&&$t.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var j=E.slice(-1)[0],re=(n.host||t.host||E.length>1)&&(j==="."||j==="..")||j==="",ee=0,ge=E.length;ge>=0;ge--)(j=E[ge])==="."?E.splice(ge,1):j===".."?(E.splice(ge,1),ee++):ee&&(E.splice(ge,1),ee--);if(!T&&!S)for(;ee--;ee)E.unshift("..");!T||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),re&&E.join("/").substr(-1)!=="/"&&E.push("");var ae,ie=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=ie?"":E.length?E.shift():"",(ae=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=ae.shift(),n.host=n.hostname=ae.shift())),(T=T||n.host&&E.length)&&!ie&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),$t.isNull(n.pathname)&&$t.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},kt.prototype.parseHost=function(){var t=this.host,e=WS.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};De.Url;De.format;De.resolve;De.resolveObject;Rs={},Ym=!1;Xm=JS(),YS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=fk;De.fileURLToPath=lk;De.Url;De.format;De.resolve;De.resolveObject;De.URL;XS=92,QS=47,ek=97,tk=122,Ns=YS==="win32",nk=/\//g,rk=/%/g,ik=/\\/g,ok=/\n/g,ak=/\r/g,sk=/\t/g;dk=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=Ek;De.fileURLToPath=xk;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;pk=92,gk=47,yk=97,mk=122,Ds=dk==="win32",hk=/\//g,vk=/%/g,Tk=/\\/g,_k=/\n/g,bk=/\r/g,wk=/\t/g});var Mh={};hn(Mh,{Agent:()=>Hk,ClientRequest:()=>Uk,IncomingMessage:()=>$k,METHODS:()=>Zk,STATUS_CODES:()=>jk,default:()=>tn,get:()=>Kk,globalAgent:()=>Lk,request:()=>Fk});function Bh(){if(nh)return Bt;nh=!0,Bt.fetch=r(Ln.fetch)&&r(Ln.ReadableStream),Bt.writableStream=r(Ln.WritableStream),Bt.abortController=r(Ln.AbortController);var t;function e(){if(t!==void 0)return t;if(Ln.XMLHttpRequest){t=new Ln.XMLHttpRequest;try{t.open("GET",Ln.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(o){var a=e();if(!a)return!1;try{return a.responseType=o,a.responseType===o}catch{}return!1}Bt.arraybuffer=Bt.fetch||n("arraybuffer"),Bt.msstream=!Bt.fetch&&n("ms-stream"),Bt.mozchunkedarraybuffer=!Bt.fetch&&n("moz-chunked-arraybuffer"),Bt.overrideMimeType=Bt.fetch||(e()?r(e().overrideMimeType):!1);function r(o){return typeof o=="function"}return t=null,Bt}function Eh(){return rh||(rh=!0,Hs=_t.EventEmitter),Hs}function Sk(){if(ih)return Us;ih=!0;function t(v,P){var B=Object.keys(v);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(v);P&&(T=T.filter(function(S){return Object.getOwnPropertyDescriptor(v,S).enumerable})),B.push.apply(B,T)}return B}function e(v){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(T){n(v,T,B[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(T){Object.defineProperty(v,T,Object.getOwnPropertyDescriptor(B,T))})}return v}function n(v,P,B){return P=i(P),P in v?Object.defineProperty(v,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):v[P]=B,v}function r(v,P){if(!(v instanceof P))throw new TypeError("Cannot call a class as a function")}function o(v,P){for(var B=0;B<P.length;B++){var T=P[B];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,i(T.key),T)}}function a(v,P,B){return P&&o(v.prototype,P),Object.defineProperty(v,"prototype",{writable:!1}),v}function i(v){var P=s(v,"string");return typeof P=="symbol"?P:String(P)}function s(v,P){if(typeof v!="object"||v===null)return v;var B=v[Symbol.toPrimitive];if(B!==void 0){var T=B.call(v,P||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(v)}var l=Dt(),f=l.Buffer,p=L,y=p.inspect,g=y&&y.custom||"inspect";function h(v,P,B){f.prototype.copy.call(v,P,B)}return Us=(function(){function v(){r(this,v),this.head=null,this.tail=null,this.length=0}return a(v,[{key:"push",value:function(B){var T={data:B,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(B){var T={data:B,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var B=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,B}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(B){if(this.length===0)return"";for(var T=this.head,S=""+T.data;T=T.next;)S+=B+T.data;return S}},{key:"concat",value:function(B){if(this.length===0)return f.alloc(0);for(var T=f.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,T,E),E+=S.data.length,S=S.next;return T}},{key:"consume",value:function(B,T){var S;return B<this.head.data.length?(S=this.head.data.slice(0,B),this.head.data=this.head.data.slice(B)):B===this.head.data.length?S=this.shift():S=T?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var T=this.head,S=1,E=T.data;for(B-=E.length;T=T.next;){var H=T.data,j=B>H.length?H.length:B;if(j===H.length?E+=H:E+=H.slice(0,B),B-=j,B===0){j===H.length?(++S,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=H.slice(j));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var T=f.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(T),B-=S.data.length;S=S.next;){var H=S.data,j=B>H.length?H.length:B;if(H.copy(T,T.length-B,0,j),B-=j,B===0){j===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(j));break}++E}return this.length-=E,T}},{key:g,value:function(B,T){return y(this,e(e({},T),{},{depth:0,customInspect:!1}))}}]),v})(),Us}function Sh(){if(oh)return $s;oh=!0;var t=Rt;function e(s,l){var f=this,p=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return p||y?(l?l(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(a,this,s)):t.nextTick(a,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(g){!l&&g?f._writableState?f._writableState.errorEmitted?t.nextTick(r,f):(f._writableState.errorEmitted=!0,t.nextTick(n,f,g)):t.nextTick(n,f,g):l?(t.nextTick(r,f),l(g)):t.nextTick(r,f)}),this)}function n(s,l){a(s,l),r(s)}function r(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function a(s,l){s.emit("error",l)}function i(s,l){var f=s._readableState,p=s._writableState;f&&f.autoDestroy||p&&p.autoDestroy?s.destroy(l):s.emit("error",l)}return $s={destroy:e,undestroy:o,errorOrDestroy:i},$s}function yr(){if(ah)return Zs;ah=!0;let t={};function e(i,s,l){l||(l=Error);function f(y,g,h){return typeof s=="string"?s:s(y,g,h)}class p extends l{constructor(g,h,v){super(f(g,h,v))}}p.prototype.name=l.name,p.prototype.code=i,t[i]=p}function n(i,s){if(Array.isArray(i)){let l=i.length;return i=i.map(f=>String(f)),l>2?`one of ${s} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${s} ${i[0]} or ${i[1]}`:`of ${s} ${i[0]}`}else return`of ${s} ${String(i)}`}function r(i,s,l){return i.substr(0,s.length)===s}function o(i,s,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-s.length,l)===s}function a(i,s,l){return typeof l!="number"&&(l=0),l+s.length>i.length?!1:i.indexOf(s,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,s){return'The value "'+s+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,s,l){let f;typeof s=="string"&&r(s,"not ")?(f="must not be",s=s.replace(/^not /,"")):f="must be";let p;if(o(i," argument"))p=`The ${i} ${f} ${n(s,"type")}`;else{let y=a(i,".")?"property":"argument";p=`The "${i}" ${y} ${f} ${n(s,"type")}`}return p+=`. Received type ${typeof l}`,p},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Zs.codes=t,Zs}function kh(){if(sh)return js;sh=!0;var t=yr().codes.ERR_INVALID_OPT_VALUE;function e(r,o,a){return r.highWaterMark!=null?r.highWaterMark:o?r[a]:null}function n(r,o,a,i){var s=e(o,i,a);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var l=i?a:"highWaterMark";throw new t(l,s)}return Math.floor(s)}return r.objectMode?16:16*1024}return js={getHighWaterMark:n},js}function Ih(){if(lh)return Ks;lh=!0;var t=Rt;Ks=ae;function e(M){var k=this;this.next=null,this.entry=null,this.finish=function(){Te(k,M)}}var n;ae.WritableState=ee;var r={deprecate:Dm()},o=Eh(),a=Dt().Buffer,i=(typeof uh<"u"?uh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(M){return a.from(M)}function l(M){return a.isBuffer(M)||M instanceof i}var f=Sh(),p=kh(),y=p.getHighWaterMark,g=yr().codes,h=g.ERR_INVALID_ARG_TYPE,v=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,T=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,j=f.errorOrDestroy;Ht()(ae,o);function re(){}function ee(M,k,Z){n=n||gr(),M=M||{},typeof Z!="boolean"&&(Z=k instanceof n),this.objectMode=!!M.objectMode,Z&&(this.objectMode=this.objectMode||!!M.writableObjectMode),this.highWaterMark=y(this,M,"writableHighWaterMark",Z),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Y=M.decodeStrings===!1;this.decodeStrings=!Y,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(oe){Ue(k,oe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=M.emitClose!==!1,this.autoDestroy=!!M.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ee.prototype.getBuffer=function(){for(var k=this.bufferedRequest,Z=[];k;)Z.push(k),k=k.next;return Z},(function(){try{Object.defineProperty(ee.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ge;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ge=Function.prototype[Symbol.hasInstance],Object.defineProperty(ae,Symbol.hasInstance,{value:function(k){return ge.call(this,k)?!0:this!==ae?!1:k&&k._writableState instanceof ee}})):ge=function(k){return k instanceof this};function ae(M){n=n||gr();var k=this instanceof n;if(!k&&!ge.call(ae,this))return new ae(M);this._writableState=new ee(M,this,k),this.writable=!0,M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final)),o.call(this)}ae.prototype.pipe=function(){j(this,new B)};function ie(M,k){var Z=new E;j(M,Z),t.nextTick(k,Z)}function Oe(M,k,Z,Y){var oe;return Z===null?oe=new S:typeof Z!="string"&&!k.objectMode&&(oe=new h("chunk",["string","Buffer"],Z)),oe?(j(M,oe),t.nextTick(Y,oe),!1):!0}ae.prototype.write=function(M,k,Z){var Y=this._writableState,oe=!1,w=!Y.objectMode&&l(M);return w&&!a.isBuffer(M)&&(M=s(M)),typeof k=="function"&&(Z=k,k=null),w?k="buffer":k||(k=Y.defaultEncoding),typeof Z!="function"&&(Z=re),Y.ending?ie(this,Z):(w||Oe(this,Y,M,Z))&&(Y.pendingcb++,oe=tt(this,Y,w,M,k,Z)),oe},ae.prototype.cork=function(){this._writableState.corked++},ae.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,!M.writing&&!M.corked&&!M.bufferProcessing&&M.bufferedRequest&&fe(this,M))},ae.prototype.setDefaultEncoding=function(k){if(typeof k=="string"&&(k=k.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((k+"").toLowerCase())>-1))throw new H(k);return this._writableState.defaultEncoding=k,this},Object.defineProperty(ae.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ze(M,k,Z){return!M.objectMode&&M.decodeStrings!==!1&&typeof k=="string"&&(k=a.from(k,Z)),k}Object.defineProperty(ae.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function tt(M,k,Z,Y,oe,w){if(!Z){var x=ze(k,Y,oe);Y!==x&&(Z=!0,oe="buffer",Y=x)}var z=k.objectMode?1:Y.length;k.length+=z;var Q=k.length<k.highWaterMark;if(Q||(k.needDrain=!0),k.writing||k.corked){var Me=k.lastBufferedRequest;k.lastBufferedRequest={chunk:Y,encoding:oe,isBuf:Z,callback:w,next:null},Me?Me.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else Ve(M,k,!1,z,Y,oe,w);return Q}function Ve(M,k,Z,Y,oe,w,x){k.writelen=Y,k.writecb=x,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new T("write")):Z?M._writev(oe,k.onwrite):M._write(oe,w,k.onwrite),k.sync=!1}function Je(M,k,Z,Y,oe){--k.pendingcb,Z?(t.nextTick(oe,Y),t.nextTick(F,M,k),M._writableState.errorEmitted=!0,j(M,Y)):(oe(Y),M._writableState.errorEmitted=!0,j(M,Y),F(M,k))}function ht(M){M.writing=!1,M.writecb=null,M.length-=M.writelen,M.writelen=0}function Ue(M,k){var Z=M._writableState,Y=Z.sync,oe=Z.writecb;if(typeof oe!="function")throw new P;if(ht(Z),k)Je(M,Z,Y,k,oe);else{var w=ve(Z)||M.destroyed;!w&&!Z.corked&&!Z.bufferProcessing&&Z.bufferedRequest&&fe(M,Z),Y?t.nextTick(Pe,M,Z,w,oe):Pe(M,Z,w,oe)}}function Pe(M,k,Z,Y){Z||Se(M,k),k.pendingcb--,Y(),F(M,k)}function Se(M,k){k.length===0&&k.needDrain&&(k.needDrain=!1,M.emit("drain"))}function fe(M,k){k.bufferProcessing=!0;var Z=k.bufferedRequest;if(M._writev&&Z&&Z.next){var Y=k.bufferedRequestCount,oe=new Array(Y),w=k.corkedRequestsFree;w.entry=Z;for(var x=0,z=!0;Z;)oe[x]=Z,Z.isBuf||(z=!1),Z=Z.next,x+=1;oe.allBuffers=z,Ve(M,k,!0,k.length,oe,"",w.finish),k.pendingcb++,k.lastBufferedRequest=null,w.next?(k.corkedRequestsFree=w.next,w.next=null):k.corkedRequestsFree=new e(k),k.bufferedRequestCount=0}else{for(;Z;){var Q=Z.chunk,Me=Z.encoding,_e=Z.callback,$=k.objectMode?1:Q.length;if(Ve(M,k,!1,$,Q,Me,_e),Z=Z.next,k.bufferedRequestCount--,k.writing)break}Z===null&&(k.lastBufferedRequest=null)}k.bufferedRequest=Z,k.bufferProcessing=!1}ae.prototype._write=function(M,k,Z){Z(new v("_write()"))},ae.prototype._writev=null,ae.prototype.end=function(M,k,Z){var Y=this._writableState;return typeof M=="function"?(Z=M,M=null,k=null):typeof k=="function"&&(Z=k,k=null),M!=null&&this.write(M,k),Y.corked&&(Y.corked=1,this.uncork()),Y.ending||de(this,Y,Z),this},Object.defineProperty(ae.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ve(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}function D(M,k){M._final(function(Z){k.pendingcb--,Z&&j(M,Z),k.prefinished=!0,M.emit("prefinish"),F(M,k)})}function K(M,k){!k.prefinished&&!k.finalCalled&&(typeof M._final=="function"&&!k.destroyed?(k.pendingcb++,k.finalCalled=!0,t.nextTick(D,M,k)):(k.prefinished=!0,M.emit("prefinish")))}function F(M,k){var Z=ve(k);if(Z&&(K(M,k),k.pendingcb===0&&(k.finished=!0,M.emit("finish"),k.autoDestroy))){var Y=M._readableState;(!Y||Y.autoDestroy&&Y.endEmitted)&&M.destroy()}return Z}function de(M,k,Z){k.ending=!0,F(M,k),Z&&(k.finished?t.nextTick(Z):M.once("finish",Z)),k.ended=!0,M.writable=!1}function Te(M,k,Z){var Y=M.entry;for(M.entry=null;Y;){var oe=Y.callback;k.pendingcb--,oe(Z),Y=Y.next}k.corkedRequestsFree.next=M}return Object.defineProperty(ae.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(k){this._writableState&&(this._writableState.destroyed=k)}}),ae.prototype.destroy=f.destroy,ae.prototype._undestroy=f.undestroy,ae.prototype._destroy=function(M,k){k(M)},Ks}function gr(){if(ch)return Ls;ch=!0;var t=Rt,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};Ls=s;var n=Ah(),r=Ih();Ht()(s,n);for(var o=e(r.prototype),a=0;a<o.length;a++){var i=o[a];s.prototype[i]||(s.prototype[i]=r.prototype[i])}function s(p){if(!(this instanceof s))return new s(p);n.call(this,p),r.call(this,p),this.allowHalfOpen=!0,p&&(p.readable===!1&&(this.readable=!1),p.writable===!1&&(this.writable=!1),p.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",l)))}Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(f,this)}function f(p){p.end()}return Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=y,this._writableState.destroyed=y)}}),Ls}function tl(){if(fh)return Fs;fh=!0;var t=yr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(a){var i=!1;return function(){if(!i){i=!0;for(var s=arguments.length,l=new Array(s),f=0;f<s;f++)l[f]=arguments[f];a.apply(this,l)}}}function n(){}function r(a){return a.setHeader&&typeof a.abort=="function"}function o(a,i,s){if(typeof i=="function")return o(a,null,i);i||(i={}),s=e(s||n);var l=i.readable||i.readable!==!1&&a.readable,f=i.writable||i.writable!==!1&&a.writable,p=function(){a.writable||g()},y=a._writableState&&a._writableState.finished,g=function(){f=!1,y=!0,l||s.call(a)},h=a._readableState&&a._readableState.endEmitted,v=function(){l=!1,h=!0,f||s.call(a)},P=function(E){s.call(a,E)},B=function(){var E;if(l&&!h)return(!a._readableState||!a._readableState.ended)&&(E=new t),s.call(a,E);if(f&&!y)return(!a._writableState||!a._writableState.ended)&&(E=new t),s.call(a,E)},T=function(){a.req.on("finish",g)};return r(a)?(a.on("complete",g),a.on("abort",B),a.req?T():a.on("request",T)):f&&!a._writableState&&(a.on("end",p),a.on("close",p)),a.on("end",v),a.on("finish",g),i.error!==!1&&a.on("error",P),a.on("close",B),function(){a.removeListener("complete",g),a.removeListener("abort",B),a.removeListener("request",T),a.req&&a.req.removeListener("finish",g),a.removeListener("end",p),a.removeListener("close",p),a.removeListener("finish",g),a.removeListener("end",v),a.removeListener("error",P),a.removeListener("close",B)}}return Fs=o,Fs}function kk(){if(dh)return Ws;dh=!0;var t=Rt,e;function n(H,j,re){return j=r(j),j in H?Object.defineProperty(H,j,{value:re,enumerable:!0,configurable:!0,writable:!0}):H[j]=re,H}function r(H){var j=o(H,"string");return typeof j=="symbol"?j:String(j)}function o(H,j){if(typeof H!="object"||H===null)return H;var re=H[Symbol.toPrimitive];if(re!==void 0){var ee=re.call(H,j||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(H)}var a=tl(),i=Symbol("lastResolve"),s=Symbol("lastReject"),l=Symbol("error"),f=Symbol("ended"),p=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function h(H,j){return{value:H,done:j}}function v(H){var j=H[i];if(j!==null){var re=H[g].read();re!==null&&(H[p]=null,H[i]=null,H[s]=null,j(h(re,!1)))}}function P(H){t.nextTick(v,H)}function B(H,j){return function(re,ee){H.then(function(){if(j[f]){re(h(void 0,!0));return}j[y](re,ee)},ee)}}var T=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var j=this,re=this[l];if(re!==null)return Promise.reject(re);if(this[f])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(ie,Oe){t.nextTick(function(){j[l]?Oe(j[l]):ie(h(void 0,!0))})});var ee=this[p],ge;if(ee)ge=new Promise(B(ee,this));else{var ae=this[g].read();if(ae!==null)return Promise.resolve(h(ae,!1));ge=new Promise(this[y])}return this[p]=ge,ge}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var j=this;return new Promise(function(re,ee){j[g].destroy(null,function(ge){if(ge){ee(ge);return}re(h(void 0,!0))})})}),e),T),E=function(j){var re,ee=Object.create(S,(re={},n(re,g,{value:j,writable:!0}),n(re,i,{value:null,writable:!0}),n(re,s,{value:null,writable:!0}),n(re,l,{value:null,writable:!0}),n(re,f,{value:j._readableState.endEmitted,writable:!0}),n(re,y,{value:function(ae,ie){var Oe=ee[g].read();Oe?(ee[p]=null,ee[i]=null,ee[s]=null,ae(h(Oe,!1))):(ee[i]=ae,ee[s]=ie)},writable:!0}),re));return ee[p]=null,a(j,function(ge){if(ge&&ge.code!=="ERR_STREAM_PREMATURE_CLOSE"){var ae=ee[s];ae!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,ae(ge)),ee[l]=ge;return}var ie=ee[i];ie!==null&&(ee[p]=null,ee[i]=null,ee[s]=null,ie(h(void 0,!0))),ee[f]=!0}),j.on("readable",P.bind(null,ee)),ee};return Ws=E,Ws}function Ik(){return ph||(ph=!0,zs=function(){throw new Error("Readable.from is not available in the browser")}),zs}function Ah(){if(gh)return qs;gh=!0;var t=Rt;qs=ie;var e;ie.ReadableState=ae,_t.EventEmitter;var n=function(x,z){return x.listeners(z).length},r=Eh(),o=Dt().Buffer,a=(typeof yh<"u"?yh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(w){return o.from(w)}function s(w){return o.isBuffer(w)||w instanceof a}var l=L,f;l&&l.debuglog?f=l.debuglog("stream"):f=function(){};var p=Sk(),y=Sh(),g=kh(),h=g.getHighWaterMark,v=yr().codes,P=v.ERR_INVALID_ARG_TYPE,B=v.ERR_STREAM_PUSH_AFTER_EOF,T=v.ERR_METHOD_NOT_IMPLEMENTED,S=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,j;Ht()(ie,r);var re=y.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function ge(w,x,z){if(typeof w.prependListener=="function")return w.prependListener(x,z);!w._events||!w._events[x]?w.on(x,z):Array.isArray(w._events[x])?w._events[x].unshift(z):w._events[x]=[z,w._events[x]]}function ae(w,x,z){e=e||gr(),w=w||{},typeof z!="boolean"&&(z=x instanceof e),this.objectMode=!!w.objectMode,z&&(this.objectMode=this.objectMode||!!w.readableObjectMode),this.highWaterMark=h(this,w,"readableHighWaterMark",z),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=w.emitClose!==!1,this.autoDestroy=!!w.autoDestroy,this.destroyed=!1,this.defaultEncoding=w.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,w.encoding&&(E||(E=ei.StringDecoder),this.decoder=new E(w.encoding),this.encoding=w.encoding)}function ie(w){if(e=e||gr(),!(this instanceof ie))return new ie(w);var x=this instanceof e;this._readableState=new ae(w,this,x),this.readable=!0,w&&(typeof w.read=="function"&&(this._read=w.read),typeof w.destroy=="function"&&(this._destroy=w.destroy)),r.call(this)}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),ie.prototype.destroy=y.destroy,ie.prototype._undestroy=y.undestroy,ie.prototype._destroy=function(w,x){x(w)},ie.prototype.push=function(w,x){var z=this._readableState,Q;return z.objectMode?Q=!0:typeof w=="string"&&(x=x||z.defaultEncoding,x!==z.encoding&&(w=o.from(w,x),x=""),Q=!0),Oe(this,w,x,!1,Q)},ie.prototype.unshift=function(w){return Oe(this,w,null,!0,!1)};function Oe(w,x,z,Q,Me){f("readableAddChunk",x);var _e=w._readableState;if(x===null)_e.reading=!1,Ue(w,_e);else{var $;if(Me||($=tt(_e,x)),$)re(w,$);else if(_e.objectMode||x&&x.length>0)if(typeof x!="string"&&!_e.objectMode&&Object.getPrototypeOf(x)!==o.prototype&&(x=i(x)),Q)_e.endEmitted?re(w,new S):ze(w,_e,x,!0);else if(_e.ended)re(w,new B);else{if(_e.destroyed)return!1;_e.reading=!1,_e.decoder&&!z?(x=_e.decoder.write(x),_e.objectMode||x.length!==0?ze(w,_e,x,!1):fe(w,_e)):ze(w,_e,x,!1)}else Q||(_e.reading=!1,fe(w,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(w,x,z,Q){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,w.emit("data",z)):(x.length+=x.objectMode?1:z.length,Q?x.buffer.unshift(z):x.buffer.push(z),x.needReadable&&Pe(w)),fe(w,x)}function tt(w,x){var z;return!s(x)&&typeof x!="string"&&x!==void 0&&!w.objectMode&&(z=new P("chunk",["string","Buffer","Uint8Array"],x)),z}ie.prototype.isPaused=function(){return this._readableState.flowing===!1},ie.prototype.setEncoding=function(w){E||(E=ei.StringDecoder);var x=new E(w);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,Q="";z!==null;)Q+=x.write(z.data),z=z.next;return this._readableState.buffer.clear(),Q!==""&&this._readableState.buffer.push(Q),this._readableState.length=Q.length,this};var Ve=1073741824;function Je(w){return w>=Ve?w=Ve:(w--,w|=w>>>1,w|=w>>>2,w|=w>>>4,w|=w>>>8,w|=w>>>16,w++),w}function ht(w,x){return w<=0||x.length===0&&x.ended?0:x.objectMode?1:w!==w?x.flowing&&x.length?x.buffer.head.data.length:x.length:(w>x.highWaterMark&&(x.highWaterMark=Je(w)),w<=x.length?w:x.ended?x.length:(x.needReadable=!0,0))}ie.prototype.read=function(w){f("read",w),w=parseInt(w,10);var x=this._readableState,z=w;if(w!==0&&(x.emittedReadable=!1),w===0&&x.needReadable&&((x.highWaterMark!==0?x.length>=x.highWaterMark:x.length>0)||x.ended))return f("read: emitReadable",x.length,x.ended),x.length===0&&x.ended?Z(this):Pe(this),null;if(w=ht(w,x),w===0&&x.ended)return x.length===0&&Z(this),null;var Q=x.needReadable;f("need readable",Q),(x.length===0||x.length-w<x.highWaterMark)&&(Q=!0,f("length less than watermark",Q)),x.ended||x.reading?(Q=!1,f("reading or ended",Q)):Q&&(f("do read"),x.reading=!0,x.sync=!0,x.length===0&&(x.needReadable=!0),this._read(x.highWaterMark),x.sync=!1,x.reading||(w=ht(z,x)));var Me;return w>0?Me=k(w,x):Me=null,Me===null?(x.needReadable=x.length<=x.highWaterMark,w=0):(x.length-=w,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),z!==w&&x.ended&&Z(this)),Me!==null&&this.emit("data",Me),Me};function Ue(w,x){if(f("onEofChunk"),!x.ended){if(x.decoder){var z=x.decoder.end();z&&z.length&&(x.buffer.push(z),x.length+=x.objectMode?1:z.length)}x.ended=!0,x.sync?Pe(w):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,Se(w)))}}function Pe(w){var x=w._readableState;f("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(f("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(Se,w))}function Se(w){var x=w._readableState;f("emitReadable_",x.destroyed,x.length,x.ended),!x.destroyed&&(x.length||x.ended)&&(w.emit("readable"),x.emittedReadable=!1),x.needReadable=!x.flowing&&!x.ended&&x.length<=x.highWaterMark,M(w)}function fe(w,x){x.readingMore||(x.readingMore=!0,t.nextTick(ve,w,x))}function ve(w,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var z=x.length;if(f("maybeReadMore read 0"),w.read(0),z===x.length)break}x.readingMore=!1}ie.prototype._read=function(w){re(this,new T("_read()"))},ie.prototype.pipe=function(w,x){var z=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=w;break;case 1:Q.pipes=[Q.pipes,w];break;default:Q.pipes.push(w);break}Q.pipesCount+=1,f("pipe count=%d opts=%j",Q.pipesCount,x);var Me=(!x||x.end!==!1)&&w!==t.stdout&&w!==t.stderr,_e=Me?Ct:u;Q.endEmitted?t.nextTick(_e):z.once("end",_e),w.on("unpipe",$);function $(c,_){f("onunpipe"),c===z&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,hr())}function Ct(){f("onend"),w.end()}var Nt=D(z);w.on("drain",Nt);var xt=!1;function hr(){f("cleanup"),w.removeListener("close",vr),w.removeListener("finish",m),w.removeListener("drain",Nt),w.removeListener("error",Et),w.removeListener("unpipe",$),z.removeListener("end",Ct),z.removeListener("end",u),z.removeListener("data",ci),xt=!0,Q.awaitDrain&&(!w._writableState||w._writableState.needDrain)&&Nt()}z.on("data",ci);function ci(c){f("ondata");var _=w.write(c);f("dest.write",_),_===!1&&((Q.pipesCount===1&&Q.pipes===w||Q.pipesCount>1&&oe(Q.pipes,w)!==-1)&&!xt&&(f("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function Et(c){f("onerror",c),u(),w.removeListener("error",Et),n(w,"error")===0&&re(w,c)}ge(w,"error",Et);function vr(){w.removeListener("finish",m),u()}w.once("close",vr);function m(){f("onfinish"),w.removeListener("close",vr),u()}w.once("finish",m);function u(){f("unpipe"),z.unpipe(w)}return w.emit("pipe",z),Q.flowing||(f("pipe resume"),z.resume()),w};function D(w){return function(){var z=w._readableState;f("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(w,"data")&&(z.flowing=!0,M(w))}}ie.prototype.unpipe=function(w){var x=this._readableState,z={hasUnpiped:!1};if(x.pipesCount===0)return this;if(x.pipesCount===1)return w&&w!==x.pipes?this:(w||(w=x.pipes),x.pipes=null,x.pipesCount=0,x.flowing=!1,w&&w.emit("unpipe",this,z),this);if(!w){var Q=x.pipes,Me=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var _e=0;_e<Me;_e++)Q[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var $=oe(x.pipes,w);return $===-1?this:(x.pipes.splice($,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),w.emit("unpipe",this,z),this)},ie.prototype.on=function(w,x){var z=r.prototype.on.call(this,w,x),Q=this._readableState;return w==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):w==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,f("on readable",Q.length,Q.reading),Q.length?Pe(this):Q.reading||t.nextTick(F,this)),z},ie.prototype.addListener=ie.prototype.on,ie.prototype.removeListener=function(w,x){var z=r.prototype.removeListener.call(this,w,x);return w==="readable"&&t.nextTick(K,this),z},ie.prototype.removeAllListeners=function(w){var x=r.prototype.removeAllListeners.apply(this,arguments);return(w==="readable"||w===void 0)&&t.nextTick(K,this),x};function K(w){var x=w._readableState;x.readableListening=w.listenerCount("readable")>0,x.resumeScheduled&&!x.paused?x.flowing=!0:w.listenerCount("data")>0&&w.resume()}function F(w){f("readable nexttick read 0"),w.read(0)}ie.prototype.resume=function(){var w=this._readableState;return w.flowing||(f("resume"),w.flowing=!w.readableListening,de(this,w)),w.paused=!1,this};function de(w,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(Te,w,x))}function Te(w,x){f("resume",x.reading),x.reading||w.read(0),x.resumeScheduled=!1,w.emit("resume"),M(w),x.flowing&&!x.reading&&w.read(0)}ie.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function M(w){var x=w._readableState;for(f("flow",x.flowing);x.flowing&&w.read()!==null;);}ie.prototype.wrap=function(w){var x=this,z=this._readableState,Q=!1;w.on("end",function(){if(f("wrapped end"),z.decoder&&!z.ended){var $=z.decoder.end();$&&$.length&&x.push($)}x.push(null)}),w.on("data",function($){if(f("wrapped data"),z.decoder&&($=z.decoder.write($)),!(z.objectMode&&$==null)&&!(!z.objectMode&&(!$||!$.length))){var Ct=x.push($);Ct||(Q=!0,w.pause())}});for(var Me in w)this[Me]===void 0&&typeof w[Me]=="function"&&(this[Me]=(function(Ct){return function(){return w[Ct].apply(w,arguments)}})(Me));for(var _e=0;_e<ee.length;_e++)w.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function($){f("wrapped _read",$),Q&&(Q=!1,w.resume())},this},typeof Symbol=="function"&&(ie.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=kk()),H(this)}),Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(ie.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(ie.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),ie._fromList=k,Object.defineProperty(ie.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function k(w,x){if(x.length===0)return null;var z;return x.objectMode?z=x.buffer.shift():!w||w>=x.length?(x.decoder?z=x.buffer.join(""):x.buffer.length===1?z=x.buffer.first():z=x.buffer.concat(x.length),x.buffer.clear()):z=x.buffer.consume(w,x.decoder),z}function Z(w){var x=w._readableState;f("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(Y,x,w))}function Y(w,x){if(f("endReadableNT",w.endEmitted,w.length),!w.endEmitted&&w.length===0&&(w.endEmitted=!0,x.readable=!1,x.emit("end"),w.autoDestroy)){var z=x._writableState;(!z||z.autoDestroy&&z.finished)&&x.destroy()}}typeof Symbol=="function"&&(ie.from=function(w,x){return j===void 0&&(j=Ik()),j(ie,w,x)});function oe(w,x){for(var z=0,Q=w.length;z<Q;z++)if(w[z]===x)return z;return-1}return qs}function Ch(){if(mh)return Gs;mh=!0,Gs=s;var t=yr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=t.ERR_TRANSFORM_WITH_LENGTH_0,a=gr();Ht()(s,a);function i(p,y){var g=this._transformState;g.transforming=!1;var h=g.writecb;if(h===null)return this.emit("error",new n);g.writechunk=null,g.writecb=null,y!=null&&this.push(y),h(p);var v=this._readableState;v.reading=!1,(v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}function s(p){if(!(this instanceof s))return new s(p);a.call(this,p),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,p&&(typeof p.transform=="function"&&(this._transform=p.transform),typeof p.flush=="function"&&(this._flush=p.flush)),this.on("prefinish",l)}function l(){var p=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(y,g){f(p,y,g)}):f(this,null,null)}s.prototype.push=function(p,y){return this._transformState.needTransform=!1,a.prototype.push.call(this,p,y)},s.prototype._transform=function(p,y,g){g(new e("_transform()"))},s.prototype._write=function(p,y,g){var h=this._transformState;if(h.writecb=g,h.writechunk=p,h.writeencoding=y,!h.transforming){var v=this._readableState;(h.needTransform||v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}},s.prototype._read=function(p){var y=this._transformState;y.writechunk!==null&&!y.transforming?(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform)):y.needTransform=!0},s.prototype._destroy=function(p,y){a.prototype._destroy.call(this,p,function(g){y(g)})};function f(p,y,g){if(y)return p.emit("error",y);if(g!=null&&p.push(g),p._writableState.length)throw new o;if(p._transformState.transforming)throw new r;return p.push(null)}return Gs}function Ak(){if(hh)return Vs;hh=!0,Vs=e;var t=Ch();Ht()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,o){o(null,n)},Vs}function Ck(){if(vh)return Js;vh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=yr().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function a(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function s(g,h,v,P){P=e(P);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=tl()),t(g,{readable:h,writable:v},function(S){if(S)return P(S);B=!0,P()});var T=!1;return function(S){if(!B&&!T){if(T=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();P(S||new o("pipe"))}}}function l(g){g()}function f(g,h){return g.pipe(h)}function p(g){return!g.length||typeof g[g.length-1]!="function"?a:g.pop()}function y(){for(var g=arguments.length,h=new Array(g),v=0;v<g;v++)h[v]=arguments[v];var P=p(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,T=h.map(function(S,E){var H=E<h.length-1,j=E>0;return s(S,H,j,function(re){B||(B=re),re&&T.forEach(l),!H&&(T.forEach(l),P(B))})});return h.reduce(f)}return Js=y,Js}function Oh(){return Th||(Th=!0,wt=wt=Ah(),wt.Stream=wt,wt.Readable=wt,wt.Writable=Ih(),wt.Duplex=gr(),wt.Transform=Ch(),wt.PassThrough=Ak(),wt.finished=tl(),wt.pipeline=Ck()),wt}function Rh(){if(_h)return Lo;_h=!0;var t=Dt().Buffer,e=Rt,n=Bh(),r=Ht(),o=Oh(),a=Lo.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Lo.IncomingMessage=function(s,l,f,p){var y=this||Fo;if(o.Readable.call(y),y._mode=f,y.headers={},y.rawHeaders=[],y.trailers={},y.rawTrailers=[],y.on("end",function(){e.nextTick(function(){y.emit("close")})}),f==="fetch"){let T=function(){h.read().then(function(S){if(!y._destroyed){if(p(S.done),S.done){y.push(null);return}y.push(t.from(S.value)),T()}}).catch(function(S){p(!0),y._destroyed||y.emit("error",S)})};if(y._fetchResponse=l,y.url=l.url,y.statusCode=l.status,y.statusMessage=l.statusText,l.headers.forEach(function(S,E){y.headers[E.toLowerCase()]=S,y.rawHeaders.push(E,S)}),n.writableStream){var g=new WritableStream({write:function(S){return p(!1),new Promise(function(E,H){y._destroyed?H():y.push(t.from(S))?E():y._resumeFetch=E})},close:function(){p(!0),y._destroyed||y.push(null)},abort:function(S){p(!0),y._destroyed||y.emit("error",S)}});try{l.body.pipeTo(g).catch(function(S){p(!0),y._destroyed||y.emit("error",S)});return}catch{}}var h=l.body.getReader();T()}else{y._xhr=s,y._pos=0,y.url=s.responseURL,y.statusCode=s.status,y.statusMessage=s.statusText;var v=s.getAllResponseHeaders().split(/\r?\n/);if(v.forEach(function(T){var S=T.match(/^([^:]+):\s*(.*)/);if(S){var E=S[1].toLowerCase();E==="set-cookie"?(y.headers[E]===void 0&&(y.headers[E]=[]),y.headers[E].push(S[2])):y.headers[E]!==void 0?y.headers[E]+=", "+S[2]:y.headers[E]=S[2],y.rawHeaders.push(S[1],S[2])}}),y._charset="x-user-defined",!n.overrideMimeType){var P=y.rawHeaders["mime-type"];if(P){var B=P.match(/;\s*charset=([^;])(;|$)/);B&&(y._charset=B[1].toLowerCase())}y._charset||(y._charset="utf-8")}}};return r(i,o.Readable),i.prototype._read=function(){var s=this||Fo,l=s._resumeFetch;l&&(s._resumeFetch=null,l())},i.prototype._onXHRProgress=function(s){var l=this||Fo,f=l._xhr,p=null;switch(l._mode){case"text":if(p=f.responseText,p.length>l._pos){var y=p.substr(l._pos);if(l._charset==="x-user-defined"){for(var g=t.alloc(y.length),h=0;h<y.length;h++)g[h]=y.charCodeAt(h)&255;l.push(g)}else l.push(y,l._charset);l._pos=p.length}break;case"arraybuffer":if(f.readyState!==a.DONE||!f.response)break;p=f.response,l.push(t.from(new Uint8Array(p)));break;case"moz-chunked-arraybuffer":if(p=f.response,f.readyState!==a.LOADING||!p)break;l.push(t.from(new Uint8Array(p)));break;case"ms-stream":if(p=f.response,f.readyState!==a.LOADING)break;var v=new Fo.MSStreamReader;v.onprogress=function(){v.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(v.result.slice(l._pos)))),l._pos=v.result.byteLength)},v.onload=function(){s(!0),l.push(null)},v.readAsArrayBuffer(p);break}l._xhr.readyState===a.DONE&&l._mode!=="ms-stream"&&(s(!0),l.push(null))},Lo}function Ok(){if(bh)return Ys;bh=!0;var t=Dt().Buffer,e=Rt,n=Bh(),r=Ht(),o=Rh(),a=Oh(),i=o.IncomingMessage,s=o.readyStates;function l(g,h){return n.fetch&&h?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&g?"arraybuffer":"text"}var f=Ys=function(g){var h=this||ot;a.Writable.call(h),h._opts=g,h._body=[],h._headers={},g.auth&&h.setHeader("Authorization","Basic "+t.from(g.auth).toString("base64")),Object.keys(g.headers).forEach(function(B){h.setHeader(B,g.headers[B])});var v,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,v=!0;else if(g.mode==="prefer-streaming")v=!1;else if(g.mode==="allow-wrong-content-type")v=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")v=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(v,P),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(f,a.Writable),f.prototype.setHeader=function(g,h){var v=this||ot,P=g.toLowerCase();y.indexOf(P)===-1&&(v._headers[P]={name:g,value:h})},f.prototype.getHeader=function(g){var h=(this||ot)._headers[g.toLowerCase()];return h?h.value:null},f.prototype.removeHeader=function(g){var h=this||ot;delete h._headers[g.toLowerCase()]},f.prototype._onFinish=function(){var g=this||ot;if(!g._destroyed){var h=g._opts;"timeout"in h&&h.timeout!==0&&g.setTimeout(h.timeout);var v=g._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(g._body,{type:(v["content-type"]||{}).value||""}));var B=[];if(Object.keys(v).forEach(function(H){var j=v[H].name,re=v[H].value;Array.isArray(re)?re.forEach(function(ee){B.push([j,ee])}):B.push([j,re])}),g._mode==="fetch"){var T=null;if(n.abortController){var S=new AbortController;T=S.signal,g._fetchAbortController=S,"requestTimeout"in h&&h.requestTimeout!==0&&(g._fetchTimer=ot.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},h.requestTimeout))}ot.fetch(g._opts.url,{method:g._opts.method,headers:B,body:P||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:T}).then(function(H){g._fetchResponse=H,g._resetTimers(!1),g._connect()},function(H){g._resetTimers(!0),g._destroyed||g.emit("error",H)})}else{var E=g._xhr=new ot.XMLHttpRequest;try{E.open(g._opts.method,g._opts.url,!0)}catch(H){e.nextTick(function(){g.emit("error",H)});return}"responseType"in E&&(E.responseType=g._mode),"withCredentials"in E&&(E.withCredentials=!!h.withCredentials),g._mode==="text"&&"overrideMimeType"in E&&E.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in h&&(E.timeout=h.requestTimeout,E.ontimeout=function(){g.emit("requestTimeout")}),B.forEach(function(H){E.setRequestHeader(H[0],H[1])}),g._response=null,E.onreadystatechange=function(){switch(E.readyState){case s.LOADING:case s.DONE:g._onXHRProgress();break}},g._mode==="moz-chunked-arraybuffer"&&(E.onprogress=function(){g._onXHRProgress()}),E.onerror=function(){g._destroyed||(g._resetTimers(!0),g.emit("error",new Error("XHR error")))};try{E.send(P)}catch(H){e.nextTick(function(){g.emit("error",H)});return}}}};function p(g){try{var h=g.status;return h!==null&&h!==0}catch{return!1}}f.prototype._onXHRProgress=function(){var g=this||ot;g._resetTimers(!1),!(!p(g._xhr)||g._destroyed)&&(g._response||g._connect(),g._response._onXHRProgress(g._resetTimers.bind(g)))},f.prototype._connect=function(){var g=this||ot;g._destroyed||(g._response=new i(g._xhr,g._fetchResponse,g._mode,g._resetTimers.bind(g)),g._response.on("error",function(h){g.emit("error",h)}),g.emit("response",g._response))},f.prototype._write=function(g,h,v){var P=this||ot;P._body.push(g),v()},f.prototype._resetTimers=function(g){var h=this||ot;ot.clearTimeout(h._socketTimer),h._socketTimer=null,g?(ot.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=ot.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},f.prototype.abort=f.prototype.destroy=function(g){var h=this||ot;h._destroyed=!0,h._resetTimers(!0),h._response&&(h._response._destroyed=!0),h._xhr?h._xhr.abort():h._fetchAbortController&&h._fetchAbortController.abort(),g&&h.emit("error",g)},f.prototype.end=function(g,h,v){var P=this||ot;typeof g=="function"&&(v=g,g=void 0),a.Writable.prototype.end.call(P,g,h,v)},f.prototype.setTimeout=function(g,h){var v=this||ot;h&&v.once("timeout",h),v._socketTimeout=g,v._resetTimers(!1)},f.prototype.flushHeaders=function(){},f.prototype.setNoDelay=function(){},f.prototype.setSocketKeepAlive=function(){};var y=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return Ys}function Rk(){if(wh)return Xs;wh=!0,Xs=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var o=arguments[r];for(var a in o)t.call(o,a)&&(n[a]=o[a])}return n}return Xs}function Mk(){return xh||(xh=!0,Qs={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}),Qs}function Dk(){if(Ph)return el;Ph=!0;var t=Ok(),e=Rh(),n=Rk(),r=Mk(),o=De,a=el;return a.request=function(i,s){typeof i=="string"?i=o.parse(i):i=n(i);var l=Nk.location.protocol.search(/^https?:$/)===-1?"http:":"",f=i.protocol||l,p=i.hostname||i.host,y=i.port,g=i.path||"/";p&&p.indexOf(":")!==-1&&(p="["+p+"]"),i.url=(p?f+"//"+p:"")+(y?":"+y:"")+g,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var h=new t(i);return s&&h.on("response",s),h},a.get=function(s,l){var f=a.request(s,l);return f.end(),f},a.ClientRequest=t,a.IncomingMessage=e.IncomingMessage,a.Agent=function(){},a.Agent.defaultMaxSockets=4,a.globalAgent=new a.Agent,a.STATUS_CODES=r,a.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],el}var Bt,nh,Ln,Hs,rh,Us,ih,$s,oh,Zs,ah,js,sh,Ks,lh,uh,Ls,ch,Fs,fh,Ws,dh,zs,ph,qs,gh,yh,Gs,mh,Vs,hh,Js,vh,wt,Th,Lo,_h,Fo,Ys,bh,ot,Xs,wh,Qs,xh,el,Ph,Nk,tn,Hk,Uk,$k,Zk,jk,Kk,Lk,Fk,Nh=at(()=>{A();O();C();as();Jy();ss();yi();Om();jo();xs();Hm();Zm();th();ks();Bt={},nh=!1,Ln=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Hs={},rh=!1;Us={},ih=!1;$s={},oh=!1;Zs={},ah=!1;js={},sh=!1;Ks={},lh=!1,uh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ls={},ch=!1;Fs={},fh=!1;Ws={},dh=!1;zs={},ph=!1;qs={},gh=!1,yh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Gs={},mh=!1;Vs={},hh=!1;Js={},vh=!1;wt={},Th=!1;Lo={},_h=!1,Fo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ys={},bh=!1,ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Xs={},wh=!1;Qs={},xh=!1;el={},Ph=!1,Nk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;tn=Dk(),Hk=tn.Agent,Uk=tn.ClientRequest,$k=tn.IncomingMessage,Zk=tn.METHODS,jk=tn.STATUS_CODES,Kk=tn.get,Lk=tn.globalAgent,Fk=tn.request});A();O();C();var Hy={};hn(Hy,{defaults:()=>FB,markdown:()=>KB,markdownBloc:()=>LB});A();O();C();A();O();C();A();O();C();var Sa=Object.defineProperty,Qv=Object.defineProperties,eT=Object.getOwnPropertyDescriptors,Ei=Object.getOwnPropertySymbols,tf=Object.prototype.hasOwnProperty,nf=Object.prototype.propertyIsEnumerable,hc=(t,e,n)=>e in t?Sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))tf.call(e,n)&&hc(t,n,e[n]);if(Ei)for(var n of Ei(e))nf.call(e,n)&&hc(t,n,e[n]);return t},N=(t,e)=>Qv(t,eT(e)),d=(t,e)=>Sa(t,"name",{value:e,configurable:!0}),rf=(t,e)=>{var n={};for(var r in t)tf.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ei)for(var r of Ei(t))e.indexOf(r)<0&&nf.call(t,r)&&(n[r]=t[r]);return n},so=(t,e)=>{for(var n in e)Sa(t,n,{get:e[n],enumerable:!0})},AA={},tT={};so(tT,{errors:()=>uf,fromJSONSchema:()=>ey,fromJSONSchemaLegacy:()=>pB,fromObject:()=>Ba,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>$B,toTypescriptSchema:()=>$a,toTypescriptType:()=>ka});var X={};so(X,{BRAND:()=>Lx,DIRTY:()=>Jn,EMPTY_PATH:()=>$x,INVALID:()=>pe,NEVER:()=>LP,OK:()=>gt,ParseInputLazyPath:()=>Ot,ParseStatus:()=>Tt,Schema:()=>he,ZodAny:()=>Lr,ZodArray:()=>Fr,ZodBigInt:()=>La,ZodBoolean:()=>Fa,ZodBranded:()=>Wa,ZodCatch:()=>za,ZodDate:()=>qa,ZodDefault:()=>To,ZodDiscriminatedUnion:()=>mg,ZodEffects:()=>In,ZodEnum:()=>or,ZodError:()=>Wt,ZodFirstPartyTypeKind:()=>rg,ZodFunction:()=>vg,ZodIntersection:()=>Va,ZodIssueCode:()=>V,ZodLazy:()=>Ja,ZodLiteral:()=>Ya,ZodMap:()=>_g,ZodNaN:()=>wg,ZodNativeEnum:()=>Xa,ZodNever:()=>qr,ZodNull:()=>Qa,ZodNullable:()=>er,ZodNumber:()=>es,ZodObject:()=>tr,ZodOptional:()=>ln,ZodParsedType:()=>ne,ZodPipeline:()=>ts,ZodPromise:()=>bo,ZodReadonly:()=>wo,ZodRecord:()=>Ig,ZodRef:()=>Cg,ZodSchema:()=>he,ZodSet:()=>Og,ZodString:()=>yt,ZodSymbol:()=>Lg,ZodTransformer:()=>In,ZodTuple:()=>rr,ZodType:()=>he,ZodUndefined:()=>xo,ZodUnion:()=>ns,ZodUnknown:()=>Hr,ZodVoid:()=>qg,addIssueToContext:()=>te,agent:()=>Jx,aimodel:()=>tP,any:()=>dP,array:()=>mP,bigint:()=>sP,boolean:()=>Jg,coerce:()=>KP,conversation:()=>qx,createZodEnum:()=>_o,cuid2Regex:()=>Mg,cuidRegex:()=>Rg,custom:()=>gg,datasource:()=>nP,date:()=>lP,default:()=>DP,discriminatedUnion:()=>_P,effect:()=>Xc,emailRegex:()=>Hg,enum:()=>CP,errorUtil:()=>ue,event:()=>Yx,function:()=>kP,getErrorMap:()=>jr,getParsedType:()=>sn,instanceof:()=>oP,intent:()=>eP,intersection:()=>bP,ipv4Regex:()=>$g,ipv6Regex:()=>Zg,isAborted:()=>wa,isAsync:()=>Ii,isDirty:()=>xa,isEmojiRegex:()=>Fx,isValid:()=>Kr,knowledgebase:()=>rP,late:()=>iP,lazy:()=>IP,literal:()=>AP,makeIssue:()=>ki,map:()=>EP,message:()=>Vx,nan:()=>aP,nativeEnum:()=>OP,never:()=>gP,null:()=>fP,nullable:()=>NP,number:()=>Vg,object:()=>hP,objectUtil:()=>ba,oboolean:()=>jP,onumber:()=>ZP,optional:()=>MP,ostring:()=>$P,pipeline:()=>UP,preprocess:()=>HP,processCreateParams:()=>me,promise:()=>RP,quotelessJson:()=>Ux,readonly:()=>BP,record:()=>xP,ref:()=>PP,set:()=>SP,setErrorMap:()=>ag,strictObject:()=>vP,string:()=>Gg,symbol:()=>uP,table:()=>Xx,tablerow:()=>Qx,transformer:()=>Xc,tuple:()=>wP,ulidRegex:()=>Ng,undefined:()=>cP,union:()=>TP,unknown:()=>pP,user:()=>Gx,util:()=>be,uuidRegex:()=>Dg,variable:()=>zx,void:()=>yP});var le="x-zui";function of(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:se(t)}d(of,"primitiveToTypscriptLiteralType");function se(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${se(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:typeof t=="string"?lf(t):JSON.stringify(t)}d(se,"primitiveToTypescriptValue");function Yn(t){return typeof t>"u"?"undefined":JSON.stringify(t)}d(Yn,"unknownToTypescriptValue");var af=d((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([o,a])=>`${da(o)}: ${Yn(a)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),da=d(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:se(t),"toPropertyKey"),nT=d(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),sf=d(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(nT).filter(r=>!!r).join("")},"toTypeArgumentName"),vc=d(t=>{for(var e;t.length&&!((e=t[0])!=null&&e.trim());)t.shift();for(;t.length&&!t[t.length-1].trim();)t.pop()},"trimEmptyLinesInPlace"),nt=d(t=>{t=t?.replace(/(\n(\s*)?){3,}/g,`
|
|
14
14
|
|
|
15
15
|
`);let e=d(o=>o.startsWith("* ")?` ${o}`:` * ${o}`,"ensureLineStartsWithAsterisk"),n=d(o=>o.replace(/\*\//g,"*\\/"),"escapeCommentEnd"),r=(t??"").split(`
|
|
16
16
|
`).map(o=>o.trim());return vc(r),r.length&&(r[0]=r[0].replace(/^\/\*\*?/,""),r[r.length-1]=r[r.length-1].replace(/\*\/$/,"")),vc(r),r.length===0?"":r.length===1?`/** ${n(r[0])} */`:`/**
|
|
17
17
|
${r.map(e).map(n).join(`
|
|
18
18
|
`)}
|
|
19
|
-
*/`},"getMultilineComment");function lf(t){if(typeof t!="string")return"";let n=String.raw`${t}`.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"').replace(/'/g,"\\'");return n.includes("`")?`"${n}"`:n.includes("'")?`"${n}"`:`'${n}'`}d(lf,"escapeString");var uf={};so(uf,{JSONSchemaToZuiError:()=>lo,ObjectToZuiError:()=>pa,UnrepresentableGenericError:()=>ga,UnsupportedJSONSchemaToZuiError:()=>an,UnsupportedZuiCheckToJSONSchemaError:()=>mf,UnsupportedZuiToJSONSchemaError:()=>pt,UnsupportedZuiToTypescriptSchemaError:()=>wn,UnsupportedZuiToTypescriptTypeError:()=>xf,UntitledDeclarationError:()=>Bf,ZuiToJSONSchemaError:()=>uo,ZuiToTypescriptSchemaError:()=>Tf,ZuiToTypescriptTypeError:()=>co,ZuiTransformError:()=>ir});var cf=class extends Error{constructor(e,n){super(n),this.transform=e}};d(cf,"ZuiTransformError");var ir=cf,ff=class extends ir{constructor(e){super("json-schema-to-zui",e)}};d(ff,"JSONSchemaToZuiError");var lo=ff,df=class extends ir{constructor(e){super("object-to-zui",e)}};d(df,"ObjectToZuiError");var pa=df,pf=class extends ir{constructor(e){super("zui-to-json-schema",e)}};d(pf,"ZuiToJSONSchemaError");var uo=pf,gf=class extends uo{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};d(gf,"UnsupportedZuiToJSONSchemaError");var pt=gf,yf=class extends uo{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};d(yf,"UnsupportedZuiCheckToJSONSchemaError");var mf=yf,hf=class extends lo{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};d(hf,"UnsupportedJSONSchemaToZuiError");var an=hf,vf=class extends ir{constructor(e){super("zui-to-typescript-schema",e)}};d(vf,"ZuiToTypescriptSchemaError");var Tf=vf,_f=class extends Tf{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};d(_f,"UnsupportedZuiToTypescriptSchemaError");var wn=_f,bf=class extends ir{constructor(e){super("zui-to-typescript-type",e)}};d(bf,"ZuiToTypescriptTypeError");var co=bf,wf=class extends co{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};d(wf,"UnsupportedZuiToTypescriptTypeError");var xf=wf,Pf=class extends co{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};d(Pf,"UntitledDeclarationError");var Bf=Pf,Ef=class extends co{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};d(Ef,"UnrepresentableGenericError");var ga=Ef,Sf=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],
|
|
20
|
-
`:"",y=t.value.describe(""),h=t.value instanceof R.ZodAny?bc(t.key):t.key;return`${p}${f}${p}${h}: ${ke(y,a)}${p}`}if(t instanceof Tc){if(t.schema instanceof R.ZodTuple){let y="";for(let g=0;g<t.schema.items.length;g++){let h=(o=(r=(n=t.schema.items[g])==null?void 0:n.ui)==null?void 0:r.title)!=null?o:`arg${g}`,v=t.schema.items[g];y+=`${ke(new mi(da(h),v),a)}${g<t.schema.items.length-1?", ":""} `}return y}let l=t.schema.naked()instanceof R.ZodLiteral,f=ke(t.schema,a).trim();return f.startsWith("{")&&f.endsWith("}")||f.startsWith("[")&&f.endsWith("]")||f.startsWith("(")&&f.endsWith(")")||f.startsWith("Array<")&&f.endsWith(">")||f.startsWith("Record<")&&f.endsWith(">")||
|
|
19
|
+
*/`},"getMultilineComment");function lf(t){if(typeof t!="string")return"";let n=String.raw`${t}`.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"').replace(/'/g,"\\'");return n.includes("`")?`"${n}"`:n.includes("'")?`"${n}"`:`'${n}'`}d(lf,"escapeString");var uf={};so(uf,{JSONSchemaToZuiError:()=>lo,ObjectToZuiError:()=>pa,UnrepresentableGenericError:()=>ga,UnsupportedJSONSchemaToZuiError:()=>an,UnsupportedZuiCheckToJSONSchemaError:()=>mf,UnsupportedZuiToJSONSchemaError:()=>pt,UnsupportedZuiToTypescriptSchemaError:()=>wn,UnsupportedZuiToTypescriptTypeError:()=>xf,UntitledDeclarationError:()=>Bf,ZuiToJSONSchemaError:()=>uo,ZuiToTypescriptSchemaError:()=>Tf,ZuiToTypescriptTypeError:()=>co,ZuiTransformError:()=>ir});var cf=class extends Error{constructor(e,n){super(n),this.transform=e}};d(cf,"ZuiTransformError");var ir=cf,ff=class extends ir{constructor(e){super("json-schema-to-zui",e)}};d(ff,"JSONSchemaToZuiError");var lo=ff,df=class extends ir{constructor(e){super("object-to-zui",e)}};d(df,"ObjectToZuiError");var pa=df,pf=class extends ir{constructor(e){super("zui-to-json-schema",e)}};d(pf,"ZuiToJSONSchemaError");var uo=pf,gf=class extends uo{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};d(gf,"UnsupportedZuiToJSONSchemaError");var pt=gf,yf=class extends uo{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};d(yf,"UnsupportedZuiCheckToJSONSchemaError");var mf=yf,hf=class extends lo{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};d(hf,"UnsupportedJSONSchemaToZuiError");var an=hf,vf=class extends ir{constructor(e){super("zui-to-typescript-schema",e)}};d(vf,"ZuiToTypescriptSchemaError");var Tf=vf,_f=class extends Tf{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};d(_f,"UnsupportedZuiToTypescriptSchemaError");var wn=_f,bf=class extends ir{constructor(e){super("zui-to-typescript-type",e)}};d(bf,"ZuiToTypescriptTypeError");var co=bf,wf=class extends co{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};d(wf,"UnsupportedZuiToTypescriptTypeError");var xf=wf,Pf=class extends co{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};d(Pf,"UntitledDeclarationError");var Bf=Pf,Ef=class extends co{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};d(Ef,"UnrepresentableGenericError");var ga=Ef,Sf=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],rT=5,iT=d(t=>Sf.includes(t),"isPrimitive"),oT=d(t=>Sf.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),oa=d(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),kf=class{constructor(e,n){this.key=e,this.value=n}};d(kf,"KeyValue");var mi=kf,If=class{constructor(e){this.schema=e}};d(If,"FnParameters");var Tc=If,Af=class{constructor(e){this.schema=e}};d(Af,"FnReturn");var _c=Af,Cf=class{constructor(e){this.props=e}};d(Cf,"Declaration");var Mr=Cf;function ka(t,e={}){let n=lT(t,e),r=ke(n,e);return e.formatter&&(r=e.formatter(r)),r}d(ka,"toTypescriptType");var bc=d(t=>t.endsWith("?")?t:`${t}?`,"_optionalKey");function ke(t,e){var n,r,o;let a=N(b({},e),{declaration:!1,parent:t});if(t===null)return"";if(t instanceof Mr)return aT(t,a);if(t instanceof mi){let l;if(t.value instanceof R.ZodOptional?l=t.value:t.value instanceof R.ZodDefault&&e.treatDefaultAsOptional&&(l=t.value._def.innerType.optional()),l){let v=l._def.innerType;return v instanceof R.Schema&&!v.description&&l.description&&(v=v?.describe(l.description)),ke(new mi(bc(t.key),v),a)}let f=nt(t.value._def.description||t.value.description),p=f?.trim().length>0?`
|
|
20
|
+
`:"",y=t.value.describe(""),h=t.value instanceof R.ZodAny?bc(t.key):t.key;return`${p}${f}${p}${h}: ${ke(y,a)}${p}`}if(t instanceof Tc){if(t.schema instanceof R.ZodTuple){let y="";for(let g=0;g<t.schema.items.length;g++){let h=(o=(r=(n=t.schema.items[g])==null?void 0:n.ui)==null?void 0:r.title)!=null?o:`arg${g}`,v=t.schema.items[g];y+=`${ke(new mi(da(h),v),a)}${g<t.schema.items.length-1?", ":""} `}return y}let l=t.schema.naked()instanceof R.ZodLiteral,f=ke(t.schema,a).trim();return f.startsWith("{")&&f.endsWith("}")||f.startsWith("[")&&f.endsWith("]")||f.startsWith("(")&&f.endsWith(")")||f.startsWith("Array<")&&f.endsWith(">")||f.startsWith("Record<")&&f.endsWith(">")||oT(f)||l?`args: ${f}`:f}if(t instanceof _c)return t.schema instanceof R.ZodOptional?`${ke(t.schema.unwrap(),a)} | undefined`:ke(t.schema,a);let i=t,s=i._def;switch(s.typeName){case R.ZodFirstPartyTypeKind.ZodString:return`${nt(i.description)} string`.trim();case R.ZodFirstPartyTypeKind.ZodNumber:case R.ZodFirstPartyTypeKind.ZodNaN:case R.ZodFirstPartyTypeKind.ZodBigInt:return`${nt(i.description)} number`.trim();case R.ZodFirstPartyTypeKind.ZodBoolean:return`${nt(i.description)} boolean`.trim();case R.ZodFirstPartyTypeKind.ZodDate:return`${nt(i.description)} Date`.trim();case R.ZodFirstPartyTypeKind.ZodUndefined:return`${nt(i.description)} undefined`.trim();case R.ZodFirstPartyTypeKind.ZodNull:return`${nt(i.description)} null`.trim();case R.ZodFirstPartyTypeKind.ZodAny:return`${nt(i.description)} any`.trim();case R.ZodFirstPartyTypeKind.ZodUnknown:return`${nt(i.description)} unknown`.trim();case R.ZodFirstPartyTypeKind.ZodNever:return`${nt(i.description)} never`.trim();case R.ZodFirstPartyTypeKind.ZodVoid:return`${nt(i.description)} void`.trim();case R.ZodFirstPartyTypeKind.ZodArray:let l=ke(s.type,a);return iT(l)?`${l}[]`:`Array<${l}>`;case R.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(s.shape()).map(([j,re])=>re instanceof R.Schema?ke(new mi(da(j),re),a):`${j}: unknown`).join("; ")} }`;case R.ZodFirstPartyTypeKind.ZodUnion:let p=s.options.map(j=>ke(j,a));return`${nt(i.description)}
|
|
21
21
|
${p.join(" | ")}`;case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let y=s.options.map(j=>ke(j,a));return`${nt(i.description)}
|
|
22
22
|
${y.join(" | ")}`;case R.ZodFirstPartyTypeKind.ZodIntersection:return`${ke(s.left,a)} & ${ke(s.right,a)}`;case R.ZodFirstPartyTypeKind.ZodTuple:return s.items.length===0?"[]":`[${s.items.map(j=>ke(j,a)).join(", ")}]`;case R.ZodFirstPartyTypeKind.ZodRecord:let h=ke(s.keyType,a),v=ke(s.valueType,a);return`${nt(i.description)} { [key: ${h}]: ${v} }`;case R.ZodFirstPartyTypeKind.ZodMap:return`Map<${ke(s.keyType,a)}, ${ke(s.valueType,a)}>`;case R.ZodFirstPartyTypeKind.ZodSet:return`Set<${ke(s.valueType,a)}>`;case R.ZodFirstPartyTypeKind.ZodFunction:let P=ke(new Tc(s.args),a),B=ke(new _c(s.returns),a),T=e?.parent instanceof Mr&&e?.parent.props.type==="type";return e?.declaration&&!T?`${nt(i.description)}
|
|
23
23
|
(${P}): ${B}`:`${nt(i.description)}
|
|
24
24
|
(${P}) => ${B}`;case R.ZodFirstPartyTypeKind.ZodLazy:return ke(s.getter(),a);case R.ZodFirstPartyTypeKind.ZodLiteral:let S=of(s.value);return`${nt(i.description)}
|
|
25
|
-
${S}`.trim();case R.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join(" | ");case R.ZodFirstPartyTypeKind.ZodEffects:return ke(s.schema,a);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new xf(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return`${ke(s.innerType,a)} | undefined`;case R.ZodFirstPartyTypeKind.ZodNullable:return`${ke(s.innerType,a)} | null`;case R.ZodFirstPartyTypeKind.ZodDefault:let H=e.treatDefaultAsOptional?s.innerType.optional():s.innerType;return ke(H,a);case R.ZodFirstPartyTypeKind.ZodCatch:return ke(s.innerType,a);case R.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${ke(s.type,a)}>`;case R.ZodFirstPartyTypeKind.ZodBranded:return ke(s.type,a);case R.ZodFirstPartyTypeKind.ZodPipeline:return ke(s.in,a);case R.ZodFirstPartyTypeKind.ZodSymbol:return`${nt(i.description)} symbol`.trim();case R.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${ke(s.innerType,a)}>`;case R.ZodFirstPartyTypeKind.ZodRef:return sf(s.uri);default:be.assertNever(s)}}d(ke,"sUnwrapZod");var
|
|
26
|
-
`).length>=
|
|
27
|
-
declare function ${r}${i};${l}`);if(t.props.type==="variable")return oa(`${o}declare const ${r}: ${i};${l}`);let f=t.props.args.length>0?`<${t.props.args.map(sf).join(", ")}>`:"";return oa(`${o}type ${t.props.identifier}${f} = ${i};${l}`)},"unwrapDeclaration"),aT=d(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),sT=d((t,e)=>{let n=aT(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new ga;return new Mr({type:"none",schema:t})}let o="title"in t.ui?t.ui.title:null;if(!o)throw new Bf;if(n==="variable"){if(r.length>0)throw new ga;return new Mr({type:"variable",identifier:o,schema:t})}return new Mr({type:"type",identifier:o,schema:t,args:r})},"getDeclarationProps"),lT=typeof global=="object"&&global&&global.Object===Object&&global,Of=lT,uT=typeof self=="object"&&self&&self.Object===Object&&self,cT=Of||uT||Function("return this")(),qt=cT,fT=qt.Symbol,un=fT,Rf=Object.prototype,dT=Rf.hasOwnProperty,pT=Rf.toString,_r=un?un.toStringTag:void 0;function Mf(t){var e=dT.call(t,_r),n=t[_r];try{t[_r]=void 0;var r=!0}catch{}var o=pT.call(t);return r&&(e?t[_r]=n:delete t[_r]),o}d(Mf,"getRawTag");var gT=Mf,yT=Object.prototype,mT=yT.toString;function Nf(t){return mT.call(t)}d(Nf,"objectToString");var hT=Nf,vT="[object Null]",TT="[object Undefined]",wc=un?un.toStringTag:void 0;function Df(t){return t==null?t===void 0?TT:vT:wc&&wc in Object(t)?gT(t):hT(t)}d(Df,"baseGetTag");var An=Df;function Hf(t){return t!=null&&typeof t=="object"}d(Hf,"isObjectLike");var kn=Hf,_T="[object Symbol]";function Uf(t){return typeof t=="symbol"||kn(t)&&An(t)==_T}d(Uf,"isSymbol");var Ia=Uf;function $f(t,e){for(var n=-1,r=t==null?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}d($f,"arrayMap");var Zf=$f,bT=Array.isArray,zt=bT,wT=1/0,xc=un?un.prototype:void 0,Pc=xc?xc.toString:void 0;function Aa(t){if(typeof t=="string")return t;if(zt(t))return Zf(t,Aa)+"";if(Ia(t))return Pc?Pc.call(t):"";var e=t+"";return e=="0"&&1/t==-wT?"-0":e}d(Aa,"baseToString");var xT=Aa;function jf(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}d(jf,"isObject");var Qn=jf;function Kf(t){return t}d(Kf,"identity");var PT=Kf,BT="[object AsyncFunction]",ET="[object Function]",ST="[object GeneratorFunction]",kT="[object Proxy]";function Lf(t){if(!Qn(t))return!1;var e=An(t);return e==ET||e==ST||e==BT||e==kT}d(Lf,"isFunction");var Ff=Lf,IT=qt["__core-js_shared__"],aa=IT,Bc=(function(){var t=/[^.]+$/.exec(aa&&aa.keys&&aa.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Wf(t){return!!Bc&&Bc in t}d(Wf,"isMasked");var AT=Wf,CT=Function.prototype,OT=CT.toString;function zf(t){if(t!=null){try{return OT.call(t)}catch{}try{return t+""}catch{}}return""}d(zf,"toSource");var Cn=zf,RT=/[\\^$.*+?()[\]{}|]/g,MT=/^\[object .+?Constructor\]$/,NT=Function.prototype,DT=Object.prototype,HT=NT.toString,UT=DT.hasOwnProperty,$T=RegExp("^"+HT.call(UT).replace(RT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qf(t){if(!Qn(t)||AT(t))return!1;var e=Ff(t)?$T:MT;return e.test(Cn(t))}d(qf,"baseIsNative");var ZT=qf;function Gf(t,e){return t?.[e]}d(Gf,"getValue");var jT=Gf;function Vf(t,e){var n=jT(t,e);return ZT(n)?n:void 0}d(Vf,"getNative");var On=Vf,KT=On(qt,"WeakMap"),ya=KT,LT=(function(){try{var t=On(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Ec=LT,FT=9007199254740991,WT=/^(?:0|[1-9]\d*)$/;function Jf(t,e){var n=typeof t;return e=e??FT,!!e&&(n=="number"||n!="symbol"&&WT.test(t))&&t>-1&&t%1==0&&t<e}d(Jf,"isIndex");var Ca=Jf;function Yf(t,e,n){e=="__proto__"&&Ec?Ec(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}d(Yf,"baseAssignValue");var Xf=Yf;function Qf(t,e){return t===e||t!==t&&e!==e}d(Qf,"eq");var Oa=Qf,zT=Object.prototype,qT=zT.hasOwnProperty;function ed(t,e,n){var r=t[e];(!(qT.call(t,e)&&Oa(r,n))||n===void 0&&!(e in t))&&Xf(t,e,n)}d(ed,"assignValue");var GT=ed,VT=9007199254740991;function td(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=VT}d(td,"isLength");var Ra=td;function nd(t){return t!=null&&Ra(t.length)&&!Ff(t)}d(nd,"isArrayLike");var rd=nd,JT=Object.prototype;function id(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||JT;return t===n}d(id,"isPrototype");var od=id;function ad(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}d(ad,"baseTimes");var YT=ad,XT="[object Arguments]";function sd(t){return kn(t)&&An(t)==XT}d(sd,"baseIsArguments");var Sc=sd,ld=Object.prototype,QT=ld.hasOwnProperty,e_=ld.propertyIsEnumerable,t_=Sc((function(){return arguments})())?Sc:function(t){return kn(t)&&QT.call(t,"callee")&&!e_.call(t,"callee")},ud=t_;function cd(){return!1}d(cd,"stubFalse");var n_=cd,fd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,kc=fd&&typeof module=="object"&&module&&!module.nodeType&&module,r_=kc&&kc.exports===fd,Ic=r_?qt.Buffer:void 0,i_=Ic?Ic.isBuffer:void 0,o_=i_||n_,ma=o_,a_="[object Arguments]",s_="[object Array]",l_="[object Boolean]",u_="[object Date]",c_="[object Error]",f_="[object Function]",d_="[object Map]",p_="[object Number]",g_="[object Object]",y_="[object RegExp]",m_="[object Set]",h_="[object String]",v_="[object WeakMap]",T_="[object ArrayBuffer]",__="[object DataView]",b_="[object Float32Array]",w_="[object Float64Array]",x_="[object Int8Array]",P_="[object Int16Array]",B_="[object Int32Array]",E_="[object Uint8Array]",S_="[object Uint8ClampedArray]",k_="[object Uint16Array]",I_="[object Uint32Array]",$e={};$e[b_]=$e[w_]=$e[x_]=$e[P_]=$e[B_]=$e[E_]=$e[S_]=$e[k_]=$e[I_]=!0;$e[a_]=$e[s_]=$e[T_]=$e[l_]=$e[__]=$e[u_]=$e[c_]=$e[f_]=$e[d_]=$e[p_]=$e[g_]=$e[y_]=$e[m_]=$e[h_]=$e[v_]=!1;function dd(t){return kn(t)&&Ra(t.length)&&!!$e[An(t)]}d(dd,"baseIsTypedArray");var A_=dd;function pd(t){return function(e){return t(e)}}d(pd,"baseUnary");var C_=pd,gd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nr=gd&&typeof module=="object"&&module&&!module.nodeType&&module,O_=Nr&&Nr.exports===gd,sa=O_&&Of.process,R_=(function(){try{var t=Nr&&Nr.require&&Nr.require("util").types;return t||sa&&sa.binding&&sa.binding("util")}catch{}})(),Ac=R_,Cc=Ac&&Ac.isTypedArray,M_=Cc?C_(Cc):A_,yd=M_,N_=Object.prototype,D_=N_.hasOwnProperty;function md(t,e){var n=zt(t),r=!n&&ud(t),o=!n&&!r&&ma(t),a=!n&&!r&&!o&&yd(t),i=n||r||o||a,s=i?YT(t.length,String):[],l=s.length;for(var f in t)(e||D_.call(t,f))&&!(i&&(f=="length"||o&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Ca(f,l)))&&s.push(f);return s}d(md,"arrayLikeKeys");var hd=md;function vd(t,e){return function(n){return t(e(n))}}d(vd,"overArg");var Td=vd,H_=Td(Object.keys,Object),U_=H_,$_=Object.prototype,Z_=$_.hasOwnProperty;function _d(t){if(!od(t))return U_(t);var e=[];for(var n in Object(t))Z_.call(t,n)&&n!="constructor"&&e.push(n);return e}d(_d,"baseKeys");var j_=_d;function bd(t){return rd(t)?hd(t):j_(t)}d(bd,"keys");var Ma=bd;function wd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}d(wd,"nativeKeysIn");var K_=wd,L_=Object.prototype,F_=L_.hasOwnProperty;function xd(t){if(!Qn(t))return K_(t);var e=od(t),n=[];for(var r in t)r=="constructor"&&(e||!F_.call(t,r))||n.push(r);return n}d(xd,"baseKeysIn");var W_=xd;function Pd(t){return rd(t)?hd(t,!0):W_(t)}d(Pd,"keysIn");var z_=Pd,q_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,G_=/^\w*$/;function Bd(t,e){if(zt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Ia(t)?!0:G_.test(t)||!q_.test(t)||e!=null&&t in Object(e)}d(Bd,"isKey");var Na=Bd,V_=On(Object,"create"),Ur=V_;function Ed(){this.__data__=Ur?Ur(null):{},this.size=0}d(Ed,"hashClear");var J_=Ed;function Sd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}d(Sd,"hashDelete");var Y_=Sd,X_="__lodash_hash_undefined__",Q_=Object.prototype,eb=Q_.hasOwnProperty;function kd(t){var e=this.__data__;if(Ur){var n=e[t];return n===X_?void 0:n}return eb.call(e,t)?e[t]:void 0}d(kd,"hashGet");var tb=kd,nb=Object.prototype,rb=nb.hasOwnProperty;function Id(t){var e=this.__data__;return Ur?e[t]!==void 0:rb.call(e,t)}d(Id,"hashHas");var ib=Id,ob="__lodash_hash_undefined__";function Ad(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ur&&e===void 0?ob:e,this}d(Ad,"hashSet");var ab=Ad;function Rn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}d(Rn,"Hash");Rn.prototype.clear=J_;Rn.prototype.delete=Y_;Rn.prototype.get=tb;Rn.prototype.has=ib;Rn.prototype.set=ab;var Oc=Rn;function Cd(){this.__data__=[],this.size=0}d(Cd,"listCacheClear");var sb=Cd;function Od(t,e){for(var n=t.length;n--;)if(Oa(t[n][0],e))return n;return-1}d(Od,"assocIndexOf");var fo=Od,lb=Array.prototype,ub=lb.splice;function Rd(t){var e=this.__data__,n=fo(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ub.call(e,n,1),--this.size,!0}d(Rd,"listCacheDelete");var cb=Rd;function Md(t){var e=this.__data__,n=fo(e,t);return n<0?void 0:e[n][1]}d(Md,"listCacheGet");var fb=Md;function Nd(t){return fo(this.__data__,t)>-1}d(Nd,"listCacheHas");var db=Nd;function Dd(t,e){var n=this.__data__,r=fo(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}d(Dd,"listCacheSet");var pb=Dd;function Mn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}d(Mn,"ListCache");Mn.prototype.clear=sb;Mn.prototype.delete=cb;Mn.prototype.get=fb;Mn.prototype.has=db;Mn.prototype.set=pb;var po=Mn,gb=On(qt,"Map"),$r=gb;function Hd(){this.size=0,this.__data__={hash:new Oc,map:new($r||po),string:new Oc}}d(Hd,"mapCacheClear");var yb=Hd;function Ud(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}d(Ud,"isKeyable");var mb=Ud;function $d(t,e){var n=t.__data__;return mb(e)?n[typeof e=="string"?"string":"hash"]:n.map}d($d,"getMapData");var go=$d;function Zd(t){var e=go(this,t).delete(t);return this.size-=e?1:0,e}d(Zd,"mapCacheDelete");var hb=Zd;function jd(t){return go(this,t).get(t)}d(jd,"mapCacheGet");var vb=jd;function Kd(t){return go(this,t).has(t)}d(Kd,"mapCacheHas");var Tb=Kd;function Ld(t,e){var n=go(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}d(Ld,"mapCacheSet");var _b=Ld;function Nn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}d(Nn,"MapCache");Nn.prototype.clear=yb;Nn.prototype.delete=hb;Nn.prototype.get=vb;Nn.prototype.has=Tb;Nn.prototype.set=_b;var yo=Nn,bb="Expected a function";function mo(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(bb);var n=d(function(){var r=arguments,o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=t.apply(this,r);return n.cache=a.set(o,i)||a,i},"memoized");return n.cache=new(mo.Cache||yo),n}d(mo,"memoize");mo.Cache=yo;var wb=mo,xb=500;function Fd(t){var e=wb(t,function(r){return n.size===xb&&n.clear(),r}),n=e.cache;return e}d(Fd,"memoizeCapped");var Pb=Fd,Bb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Eb=/\\(\\)?/g,Sb=Pb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Bb,function(n,r,o,a){e.push(o?a.replace(Eb,"$1"):r||n)}),e}),kb=Sb;function Wd(t){return t==null?"":xT(t)}d(Wd,"toString");var Ib=Wd;function zd(t,e){return zt(t)?t:Na(t,e)?[t]:kb(Ib(t))}d(zd,"castPath");var ho=zd,Ab=1/0;function qd(t){if(typeof t=="string"||Ia(t))return t;var e=t+"";return e=="0"&&1/t==-Ab?"-0":e}d(qd,"toKey");var zr=qd;function Gd(t,e){e=ho(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[zr(e[n++])];return n&&n==r?t:void 0}d(Gd,"baseGet");var Da=Gd;function Vd(t,e,n){var r=t==null?void 0:Da(t,e);return r===void 0?n:r}d(Vd,"get");var Cb=Vd;function Jd(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}d(Jd,"arrayPush");var Yd=Jd,Ob=Td(Object.getPrototypeOf,Object),Xd=Ob,Rb="[object Object]",Mb=Function.prototype,Nb=Object.prototype,Qd=Mb.toString,Db=Nb.hasOwnProperty,Hb=Qd.call(Object);function ep(t){if(!kn(t)||An(t)!=Rb)return!1;var e=Xd(t);if(e===null)return!0;var n=Db.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Qd.call(n)==Hb}d(ep,"isPlainObject");var Rc=ep;function tp(){this.__data__=new po,this.size=0}d(tp,"stackClear");var Ub=tp;function np(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}d(np,"stackDelete");var $b=np;function rp(t){return this.__data__.get(t)}d(rp,"stackGet");var Zb=rp;function ip(t){return this.__data__.has(t)}d(ip,"stackHas");var jb=ip,Kb=200;function op(t,e){var n=this.__data__;if(n instanceof po){var r=n.__data__;if(!$r||r.length<Kb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new yo(r)}return n.set(t,e),this.size=n.size,this}d(op,"stackSet");var Lb=op;function Dn(t){var e=this.__data__=new po(t);this.size=e.size}d(Dn,"Stack");Dn.prototype.clear=Ub;Dn.prototype.delete=$b;Dn.prototype.get=Zb;Dn.prototype.has=jb;Dn.prototype.set=Lb;var vi=Dn;function ap(t,e){for(var n=-1,r=t==null?0:t.length,o=0,a=[];++n<r;){var i=t[n];e(i,n,t)&&(a[o++]=i)}return a}d(ap,"arrayFilter");var Fb=ap;function sp(){return[]}d(sp,"stubArray");var lp=sp,Wb=Object.prototype,zb=Wb.propertyIsEnumerable,Mc=Object.getOwnPropertySymbols,qb=Mc?function(t){return t==null?[]:(t=Object(t),Fb(Mc(t),function(e){return zb.call(t,e)}))}:lp,up=qb,Gb=Object.getOwnPropertySymbols,Vb=Gb?function(t){for(var e=[];t;)Yd(e,up(t)),t=Xd(t);return e}:lp,Jb=Vb;function cp(t,e,n){var r=e(t);return zt(t)?r:Yd(r,n(t))}d(cp,"baseGetAllKeys");var fp=cp;function dp(t){return fp(t,Ma,up)}d(dp,"getAllKeys");var Nc=dp;function pp(t){return fp(t,z_,Jb)}d(pp,"getAllKeysIn");var Yb=pp,Xb=On(qt,"DataView"),ha=Xb,Qb=On(qt,"Promise"),va=Qb,ew=On(qt,"Set"),Ta=ew,Dc="[object Map]",tw="[object Object]",Hc="[object Promise]",Uc="[object Set]",$c="[object WeakMap]",Zc="[object DataView]",nw=Cn(ha),rw=Cn($r),iw=Cn(va),ow=Cn(Ta),aw=Cn(ya),xn=An;(ha&&xn(new ha(new ArrayBuffer(1)))!=Zc||$r&&xn(new $r)!=Dc||va&&xn(va.resolve())!=Hc||Ta&&xn(new Ta)!=Uc||ya&&xn(new ya)!=$c)&&(xn=d(function(t){var e=An(t),n=e==tw?t.constructor:void 0,r=n?Cn(n):"";if(r)switch(r){case nw:return Zc;case rw:return Dc;case iw:return Hc;case ow:return Uc;case aw:return $c}return e},"getTag"));var jc=xn,sw=qt.Uint8Array,Kc=sw,lw="__lodash_hash_undefined__";function gp(t){return this.__data__.set(t,lw),this}d(gp,"setCacheAdd");var uw=gp;function yp(t){return this.__data__.has(t)}d(yp,"setCacheHas");var cw=yp;function Zr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new yo;++e<n;)this.add(t[e])}d(Zr,"SetCache");Zr.prototype.add=Zr.prototype.push=uw;Zr.prototype.has=cw;var fw=Zr;function mp(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}d(mp,"arraySome");var dw=mp;function hp(t,e){return t.has(e)}d(hp,"cacheHas");var pw=hp,gw=1,yw=2;function vp(t,e,n,r,o,a){var i=n&gw,s=t.length,l=e.length;if(s!=l&&!(i&&l>s))return!1;var f=a.get(t),p=a.get(e);if(f&&p)return f==e&&p==t;var y=-1,g=!0,h=n&yw?new fw:void 0;for(a.set(t,e),a.set(e,t);++y<s;){var v=t[y],P=e[y];if(r)var B=i?r(P,v,y,e,t,a):r(v,P,y,t,e,a);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!dw(e,function(T,S){if(!pw(h,S)&&(v===T||o(v,T,n,r,a)))return h.push(S)})){g=!1;break}}else if(!(v===P||o(v,P,n,r,a))){g=!1;break}}return a.delete(t),a.delete(e),g}d(vp,"equalArrays");var Tp=vp;function _p(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}d(_p,"mapToArray");var mw=_p;function bp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}d(bp,"setToArray");var hw=bp,vw=1,Tw=2,_w="[object Boolean]",bw="[object Date]",ww="[object Error]",xw="[object Map]",Pw="[object Number]",Bw="[object RegExp]",Ew="[object Set]",Sw="[object String]",kw="[object Symbol]",Iw="[object ArrayBuffer]",Aw="[object DataView]",Lc=un?un.prototype:void 0,la=Lc?Lc.valueOf:void 0;function wp(t,e,n,r,o,a,i){switch(n){case Aw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Iw:return!(t.byteLength!=e.byteLength||!a(new Kc(t),new Kc(e)));case _w:case bw:case Pw:return Oa(+t,+e);case ww:return t.name==e.name&&t.message==e.message;case Bw:case Sw:return t==e+"";case xw:var s=mw;case Ew:var l=r&vw;if(s||(s=hw),t.size!=e.size&&!l)return!1;var f=i.get(t);if(f)return f==e;r|=Tw,i.set(t,e);var p=Tp(s(t),s(e),r,o,a,i);return i.delete(t),p;case kw:if(la)return la.call(t)==la.call(e)}return!1}d(wp,"equalByTag");var Cw=wp,Ow=1,Rw=Object.prototype,Mw=Rw.hasOwnProperty;function xp(t,e,n,r,o,a){var i=n&Ow,s=Nc(t),l=s.length,f=Nc(e),p=f.length;if(l!=p&&!i)return!1;for(var y=l;y--;){var g=s[y];if(!(i?g in e:Mw.call(e,g)))return!1}var h=a.get(t),v=a.get(e);if(h&&v)return h==e&&v==t;var P=!0;a.set(t,e),a.set(e,t);for(var B=i;++y<l;){g=s[y];var T=t[g],S=e[g];if(r)var E=i?r(S,T,g,e,t,a):r(T,S,g,t,e,a);if(!(E===void 0?T===S||o(T,S,n,r,a):E)){P=!1;break}B||(B=g=="constructor")}if(P&&!B){var H=t.constructor,j=e.constructor;H!=j&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof j=="function"&&j instanceof j)&&(P=!1)}return a.delete(t),a.delete(e),P}d(xp,"equalObjects");var Nw=xp,Dw=1,Fc="[object Arguments]",Wc="[object Array]",hi="[object Object]",Hw=Object.prototype,zc=Hw.hasOwnProperty;function Pp(t,e,n,r,o,a){var i=zt(t),s=zt(e),l=i?Wc:jc(t),f=s?Wc:jc(e);l=l==Fc?hi:l,f=f==Fc?hi:f;var p=l==hi,y=f==hi,g=l==f;if(g&&ma(t)){if(!ma(e))return!1;i=!0,p=!1}if(g&&!p)return a||(a=new vi),i||yd(t)?Tp(t,e,n,r,o,a):Cw(t,e,l,n,r,o,a);if(!(n&Dw)){var h=p&&zc.call(t,"__wrapped__"),v=y&&zc.call(e,"__wrapped__");if(h||v){var P=h?t.value():t,B=v?e.value():e;return a||(a=new vi),o(P,B,n,r,a)}}return g?(a||(a=new vi),Nw(t,e,n,r,o,a)):!1}d(Pp,"baseIsEqualDeep");var Uw=Pp;function Ha(t,e,n,r,o){return t===e?!0:t==null||e==null||!kn(t)&&!kn(e)?t!==t&&e!==e:Uw(t,e,n,r,Ha,o)}d(Ha,"baseIsEqual");var vo=Ha,$w=1,Zw=2;function Bp(t,e,n,r){var o=n.length,a=o,i=!r;if(t==null)return!a;for(t=Object(t);o--;){var s=n[o];if(i&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<a;){s=n[o];var l=s[0],f=t[l],p=s[1];if(i&&s[2]){if(f===void 0&&!(l in t))return!1}else{var y=new vi;if(r)var g=r(f,p,l,t,e,y);if(!(g===void 0?vo(p,f,$w|Zw,r,y):g))return!1}}return!0}d(Bp,"baseIsMatch");var jw=Bp;function Ep(t){return t===t&&!Qn(t)}d(Ep,"isStrictComparable");var Sp=Ep;function kp(t){for(var e=Ma(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Sp(o)]}return e}d(kp,"getMatchData");var Kw=kp;function Ip(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}d(Ip,"matchesStrictComparable");var Ap=Ip;function Cp(t){var e=Kw(t);return e.length==1&&e[0][2]?Ap(e[0][0],e[0][1]):function(n){return n===t||jw(n,t,e)}}d(Cp,"baseMatches");var Lw=Cp;function Op(t,e){return t!=null&&e in Object(t)}d(Op,"baseHasIn");var Fw=Op;function Rp(t,e,n){e=ho(e,t);for(var r=-1,o=e.length,a=!1;++r<o;){var i=zr(e[r]);if(!(a=t!=null&&n(t,i)))break;t=t[i]}return a||++r!=o?a:(o=t==null?0:t.length,!!o&&Ra(o)&&Ca(i,o)&&(zt(t)||ud(t)))}d(Rp,"hasPath");var Ww=Rp;function Mp(t,e){return t!=null&&Ww(t,e,Fw)}d(Mp,"hasIn");var zw=Mp,qw=1,Gw=2;function Np(t,e){return Na(t)&&Sp(e)?Ap(zr(t),e):function(n){var r=Cb(n,t);return r===void 0&&r===e?zw(n,t):vo(e,r,qw|Gw)}}d(Np,"baseMatchesProperty");var Vw=Np;function Dp(t){return function(e){return e?.[t]}}d(Dp,"baseProperty");var Jw=Dp;function Hp(t){return function(e){return Da(e,t)}}d(Hp,"basePropertyDeep");var Yw=Hp;function Up(t){return Na(t)?Jw(zr(t)):Yw(t)}d(Up,"property");var Xw=Up;function $p(t){return typeof t=="function"?t:t==null?PT:typeof t=="object"?zt(t)?Vw(t[0],t[1]):Lw(t):Xw(t)}d($p,"baseIteratee");var Ua=$p;function Zp(t){return function(e,n,r){for(var o=-1,a=Object(e),i=r(e),s=i.length;s--;){var l=i[t?s:++o];if(n(a[l],l,a)===!1)break}return e}}d(Zp,"createBaseFor");var Qw=Zp,ex=Qw(),tx=ex;function jp(t,e){return t&&tx(t,e,Ma)}d(jp,"baseForOwn");var nx=jp;function Kp(t,e){return vo(t,e)}d(Kp,"isEqual");var Xn=Kp;function Lp(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?vo(t,e,void 0,n):!!r}d(Lp,"isEqualWith");var rx=Lp;function Fp(t){return t===void 0}d(Fp,"isUndefined");var qc=Fp;function Wp(t,e){var n={};return e=Ua(e,3),nx(t,function(r,o,a){Xf(n,o,e(r,o,a))}),n}d(Wp,"mapValues");var ix=Wp,ox="Expected a function";function zp(t){if(typeof t!="function")throw new TypeError(ox);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}d(zp,"negate");var ax=zp;function qp(t,e,n,r){if(!Qn(t))return t;e=ho(e,t);for(var o=-1,a=e.length,i=a-1,s=t;s!=null&&++o<a;){var l=zr(e[o]),f=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(o!=i){var p=s[l];f=r?r(p,l,s):void 0,f===void 0&&(f=Qn(p)?p:Ca(e[o+1])?[]:{})}GT(s,l,f),s=s[l]}return t}d(qp,"baseSet");var sx=qp;function Gp(t,e,n){for(var r=-1,o=e.length,a={};++r<o;){var i=e[r],s=Da(t,i);n(s,i)&&sx(a,ho(i,t),s)}return a}d(Gp,"basePickBy");var lx=Gp;function Vp(t,e){if(t==null)return{};var n=Zf(Yb(t),function(r){return[r]});return e=Ua(e),lx(t,n,function(r,o){return e(r,o[0])})}d(Vp,"pickBy");var ux=Vp;function Jp(t,e){return ux(t,ax(Ua(e)))}d(Jp,"omitBy");var Gc=Jp,cx=d(t=>{let e=t.checks;return e.length===0?"":e.map(fx).join("")},"generateStringChecks"),fx=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"length":return`.length(${se(t.value)}, ${se(t.message)})`;case"email":return`.email(${se(t.message)})`;case"url":return`.url(${se(t.message)})`;case"emoji":return`.emoji(${se(t.message)})`;case"uuid":return`.uuid(${se(t.message)})`;case"cuid":return`.cuid(${se(t.message)})`;case"cuid2":return`.cuid2(${se(t.message)})`;case"ulid":return`.ulid(${se(t.message)})`;case"includes":let e=Yn({message:t.message,position:t.position});return`.includes(${se(t.value)}, ${e})`;case"startsWith":return`.startsWith(${se(t.value)}, ${se(t.message)})`;case"endsWith":return`.endsWith(${se(t.value)}, ${se(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${se(t.message)})`;case"trim":return".trim()";case"toLowerCase":return".toLowerCase()";case"toUpperCase":return".toUpperCase()";case"datetime":let r=t.precision===null?void 0:t.precision;return`.datetime(${Yn({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${Yn({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),dx=d(t=>{let e=t.checks;return e.length===0?"":e.map(px).join("")},"generateNumberChecks"),px=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"int":return`.int(${se(t.message)})`;case"multipleOf":return`.multipleOf(${se(t.value)}, ${se(t.message)})`;case"finite":return`.finite(${se(t.message)})`;default:return""}},"_generateNumberCheck"),gx=d(t=>{let e=t.checks;return e.length===0?"":e.map(yx).join("")},"generateBigIntChecks"),yx=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"multipleOf":return`.multipleOf(${se(t.value)}, ${se(t.message)})`;default:return""}},"_generateBigIntCheck"),mx=d(t=>{let e=t.checks;return e.length===0?"":e.map(hx).join("")},"generateDateChecks"),hx=d(t=>{switch(t.kind){case"min":return`.min(${Vc(t.value)}, ${se(t.message)})`;case"max":return`.max(${Vc(t.value)}, ${se(t.message)})`;default:return""}},"_generateDateCheck"),Vc=d(t=>`new Date(${t})`,"dateTs"),vx=d(t=>{let e=[];if(t.exactLength){let{value:n,message:r}=t.exactLength;e.push(`.length(${se(n)}, ${se(r)})`)}if(t.minLength){let{value:n,message:r}=t.minLength;e.push(`.min(${se(n)}, ${se(r)})`)}if(t.maxLength){let{value:n,message:r}=t.maxLength;e.push(`.max(${se(n)}, ${se(r)})`)}return e.join("")},"generateArrayChecks"),Tx=d(t=>{let e=[];if(t.minSize){let{value:n,message:r}=t.minSize;e.push(`.min(${se(n)}, ${se(r)})`)}if(t.maxSize){let{value:n,message:r}=t.maxSize;e.push(`.max(${se(n)}, ${se(r)})`)}return e.join("")},"generateSetChecks");function $a(t){return Fe(t)}d($a,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case R.ZodFirstPartyTypeKind.ZodString:return`z.string()${cx(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${dx(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${gx(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case R.ZodFirstPartyTypeKind.ZodDate:return`z.date()${mx(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${vx(n)}${Ce(n)}${Ae(n)}`;case R.ZodFirstPartyTypeKind.ZodObject:let r=ix(n.shape(),Fe),o=t.additionalProperties(),a=o?`.catchall(${Fe(o)})`:"";return["z.object({",...Object.entries(r).map(([ee,ge])=>` ${ee}: ${ge},`),`})${a}${Ce(n)}${Ae(n)}`].join(`
|
|
28
|
-
`).trim();case R.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=n.options.map(Fe);return`z.discriminatedUnion(${se(n.discriminator)}, [${s.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodIntersection:let f=Fe(n.left),p=Fe(n.right);return`z.intersection(${f}, ${p})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodMap:let v=Fe(n.keyType),P=Fe(n.valueType);return`z.map(${v}, ${P})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${Tx(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),T=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${T}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${se(n.value)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(se).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodEffects:throw new wn(R.ZodFirstPartyTypeKind.ZodEffects);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new wn(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodDefault:let j=Yn(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${j})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodCatch:throw new wn(R.ZodFirstPartyTypeKind.ZodCatch);case R.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBranded:throw new wn(R.ZodFirstPartyTypeKind.ZodBranded);case R.ZodFirstPartyTypeKind.ZodPipeline:throw new wn(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodSymbol:throw new wn(R.ZodFirstPartyTypeKind.ZodSymbol);case R.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodRef:return`z.ref(${se(n.uri)})${Ce(n)}${Ae(n)}`.trim();default:be.assertNever(n)}}d(Fe,"sUnwrapZod");var Ae=d(t=>t.description?`.describe(${se(t.description)})`:"","_maybeDescribe"),Ce=d(t=>`${_x(t)}${bx(t)}${wx(t)}${xx(t)}${Px(t)}${Bx(t)}${Ex(t)}`,"_addZuiExtensions"),_x=d(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${se(t[le].title)})`:""},"_maybeTitle"),bx=d(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${af({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),wx=d(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),xx=d(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),Px=d(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${se(t[le].placeholder)})`:""},"_maybePlaceholder"),Bx=d(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),Ex=d(t=>{var e;let n=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],r=Object.entries((e=t[le])!=null?e:{}).filter(([o])=>!n.includes(o));return r.length>0?`.metadata(${af(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),Sx=d(t=>{let e={type:"number",description:t.description,"x-zui":t._def["x-zui"]};t._def[le]&&(e[le]=t._def[le]);for(let n of t._def.checks)switch(n.kind){case"min":{let r=n.inclusive?"minimum":"exclusiveMinimum",o=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[o];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",o=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[o];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),Yp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",Xp="(([+-]\\d{2}(:?\\d{2})?)|Z)",kx="Z",Qp="(\\.\\d+)?",_a="\\.\\d{",Ix="}",eg=d(t=>{let e=t.precision?_a+t.precision+Ix:t.precision===0?"":Qp,n=t.offset?Xp:kx;return new RegExp(`^${Yp}${e}${n}$`)},"generateDatetimeRegex"),Ax=d(t=>({precision:Cx(t),offset:t.endsWith(`${Xp}$`)}),"extractPrecisionAndOffset"),Cx=d(t=>{let e=t.slice(1+Yp.length);return e.startsWith(Qp)?null:e.startsWith(_a)?parseInt(e.slice(_a.length)):0},"_extractPrecision"),Dr={};so(Dr,{escapeSpecialChars:()=>Ox});var Ox=d(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Za(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(b({},t.errorMessage),{[e]:n}))}d(Za,"addErrorMessage");function Re(t,e,n,r,o){t[e]=n,Za(t,e,r,o)}d(Re,"setResponseValueAndErrors");var Xe={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function ja(t,e){let n=b({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(o){return e.patternStrategy==="escape"?Dr.escapeSpecialChars(o):o}if(d(r,"processPattern"),t.checks)for(let o of t.checks)switch(o.kind){case"min":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e);break;case"max":Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":bn(n,"email",o.message,e);break;case"format:idn-email":bn(n,"idn-email",o.message,e);break;case"pattern:zod":Lt(n,Xe.email,o.message,e);break}break;case"url":bn(n,"uri",o.message,e);break;case"uuid":bn(n,"uuid",o.message,e);break;case"regex":Lt(n,o.regex.source,o.message,e);break;case"cuid":Lt(n,Xe.cuid,o.message,e);break;case"cuid2":Lt(n,Xe.cuid2,o.message,e);break;case"startsWith":Lt(n,"^"+r(o.value),o.message,e);break;case"endsWith":Lt(n,r(o.value)+"$",o.message,e);break;case"datetime":bn(n,"date-time",o.message,e);break;case"length":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e),Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"includes":{Lt(n,r(o.value),o.message,e);break}case"ip":{o.version!=="v6"&&bn(n,"ipv4",o.message,e),o.version!=="v4"&&bn(n,"ipv6",o.message,e);break}case"emoji":Lt(n,Xe.emoji,o.message,e);break;case"ulid":{Lt(n,Xe.ulid,o.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}d(ja,"parseStringDef");var bn=d((t,e,n,r)=>{var o;t.format||(o=t.anyOf)!=null&&o.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(b({format:t.format},t.errorMessage&&r.errorMessages&&{errorMessage:{format:t.errorMessage.format}})),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push(b({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Re(t,"format",e,n,r)},"addFormat"),Lt=d((t,e,n,r)=>{var o;t.pattern||(o=t.allOf)!=null&&o.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(b({pattern:t.pattern},t.errorMessage&&r.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}})),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push(b({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Re(t,"pattern",e,n,r)},"addPattern"),Rx=d(t=>{let e={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[le]&&(e[le]=t._def[le]);for(let n of t._def.checks)switch(n.kind){case"cuid":e.format="cuid",e.pattern=Xe.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Xe.cuid2;break;case"ulid":e.format="ulid",e.pattern=Xe.ulid;break;case"uuid":e.format="uuid",e.pattern=Xe.uuid;break;case"emoji":e.format="emoji",e.pattern=Xe.emoji;break;case"email":e.format="email",e.pattern=Xe.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Xe.ipv6:Xe.ipv4;break;case"datetime":e.format="date-time",e.pattern=eg(n).source,e[le]=N(b({},e[le]),{precision:n.precision,offset:n.offset});break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Dr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Dr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Dr.escapeSpecialChars(n.value)}`;break;case"regex":e.pattern=n.regex.source;break;case"length":e.minLength=e.maxLength=Math.max(0,n.value);break;case"min":e.minLength=Math.max(0,n.value);break;case"max":e.maxLength=Math.max(0,n.value);break;default:throw new mf({zodType:R.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),Mx=d((t,e)=>{let n={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[le]&&(n[le]=t._def[le]),t._def.minLength&&(n.minItems=t._def.minLength.value),t._def.maxLength&&(n.maxItems=t._def.maxLength.value),t._def.exactLength&&(n.minItems=t._def.exactLength.value,n.maxItems=t._def.exactLength.value),n},"zodArrayToJsonArray"),Nx=d((t,e)=>{let n={type:"array",description:t.description,uniqueItems:!0,items:e(t._def.valueType),"x-zui":t._def["x-zui"]};return t._def[le]&&(n[le]=t._def[le]),t._def.minSize&&(n.minItems=t._def.minSize.value),t._def.maxSize&&(n.maxItems=t._def.maxSize.value),n},"zodSetToJsonSet"),Dx=d((t,e)=>{let n={type:"array",description:t.description,items:t._def.items.map(r=>e(r))};return t._def[le]&&(n[le]=t._def[le]),t._def.rest&&(n.additionalItems=e(t._def.rest)),n},"zodTupleToJsonTuple");function st(t){let e=t,n=e._def;switch(n.typeName){case R.ZodFirstPartyTypeKind.ZodString:return Rx(e);case R.ZodFirstPartyTypeKind.ZodNumber:return Sx(e);case R.ZodFirstPartyTypeKind.ZodNaN:throw new pt(R.ZodFirstPartyTypeKind.ZodNaN);case R.ZodFirstPartyTypeKind.ZodBigInt:throw new pt(R.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case R.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodDate:throw new pt(R.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case R.ZodFirstPartyTypeKind.ZodUndefined:return ua(n);case R.ZodFirstPartyTypeKind.ZodNull:return ca(n);case R.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(b({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodUnknown}})};case R.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodVoid:throw new pt(R.ZodFirstPartyTypeKind.ZodVoid);case R.ZodFirstPartyTypeKind.ZodArray:return Mx(e,st);case R.ZodFirstPartyTypeKind.ZodObject:let r=Object.entries(n.shape()),o=r.filter(([p,y])=>!y.isOptional()),a=o.length?o.map(([p])=>p):void 0,i=r.map(([p,y])=>[p,y.mandatory()]).map(([p,y])=>[p,st(y)]),s=!1;return n.unknownKeys instanceof R.ZodType?s=st(n.unknownKeys):n.unknownKeys==="passthrough"&&(s=!0),{type:"object",description:n.description,properties:Object.fromEntries(i),required:a,additionalProperties:s,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodIntersection:let l=st(n.left),f=st(n.right);return"additionalProperties"in l&&delete l.additionalProperties,"additionalProperties"in f&&delete f.additionalProperties,{description:n.description,allOf:[l,f],"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodTuple:return Dx(e,st);case R.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:st(n.valueType),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodMap:throw new pt(R.ZodFirstPartyTypeKind.ZodMap);case R.ZodFirstPartyTypeKind.ZodSet:return Nx(e,st);case R.ZodFirstPartyTypeKind.ZodFunction:throw new pt(R.ZodFirstPartyTypeKind.ZodFunction);case R.ZodFirstPartyTypeKind.ZodLazy:throw new pt(R.ZodFirstPartyTypeKind.ZodLazy);case R.ZodFirstPartyTypeKind.ZodLiteral:if(typeof n.value=="string")return{type:"string",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(typeof n.value=="number")return{type:"number",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(typeof n.value=="boolean")return{type:"boolean",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(n.value===null)return ca(n);if(n.value===void 0)return ua(n);{R.util.assertEqual(!0);let p=typeof n.value;throw new uo(`Unsupported literal type: "${p}"`)}case R.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodEffects:throw new pt(R.ZodFirstPartyTypeKind.ZodEffects);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new pt(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[st(n.innerType),ua()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodOptional}})};case R.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[st(n.innerType),ca()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodNullable}})};case R.ZodFirstPartyTypeKind.ZodDefault:return N(b({},st(n.innerType)),{default:n.defaultValue()});case R.ZodFirstPartyTypeKind.ZodCatch:throw new pt(R.ZodFirstPartyTypeKind.ZodCatch);case R.ZodFirstPartyTypeKind.ZodPromise:throw new pt(R.ZodFirstPartyTypeKind.ZodPromise);case R.ZodFirstPartyTypeKind.ZodBranded:throw new pt(R.ZodFirstPartyTypeKind.ZodBranded);case R.ZodFirstPartyTypeKind.ZodPipeline:throw new pt(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodSymbol:throw new pt(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodReadonly:return N(b({},st(n.innerType)),{readOnly:!0});case R.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:R.util.assertNever(n)}}d(st,"toJSONSchema");var ua=d(t=>({not:!0,description:t?.description,"x-zui":N(b({},t?.["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),ca=d(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),tg=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};d(tg,"ParseInputLazyPath");var Ot=tg,Jc=d((t,e)=>{if(Kr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Wt(t.common.issues);return this._error=n,this._error}}},"handleResult"),ng=class{constructor(e){this.__type__="ZuiType",this.spa=this.safeParseAsync,this._def=e,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)}get description(){return this._metadataRoot._def.description}dereference(e){return this}getReferences(){return[]}clone(){let e=this.constructor;return new e(b({},this._def))}_getType(e){return sn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:sn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Tt,ctx:{common:e.parent.common,data:e.data,parsedType:sn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ii(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;let o={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sn(e)},a=this._parseSync({data:e,path:o.path,parent:o});return Jc(o,a)}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sn(e)},o=this._parse({data:e,path:r.path,parent:r}),a=await(Ii(o)?o:Promise.resolve(o));return Jc(r,a)}refine(e,n){let r=d(o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n,"getIssueProperties");return this._refinement((o,a)=>{let i=e(o),s=d(()=>a.addIssue(b({code:V.custom},r(o))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new In({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ln.create(this,this._def)}nullable(){return er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fr.create(this,this._def)}promise(){return bo.create(this,this._def)}mandatory(){return this}or(e){return ns.create([this,e],this._def)}and(e){return Va.create(this,e,this._def)}transform(e){return new In(N(b({},me(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let n=typeof e=="function"?e:()=>e;return new To(N(b({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Wa(b({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new za(N(b({},me(this._def)),{innerType:this,catchValue:n,typeName:"ZodCatch"}))}describe(e){let n=this.clone();return n._metadataRoot._def.description=e,n}pipe(e){return ts.create(this,e)}readonly(){return wo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,o;let a=this.clone(),i=a._metadataRoot;(o=(n=i._def)[r=le])!=null||(n[r]={});for(let[s,l]of Object.entries(e))i._def[le]=N(b({},i._def[le]),{[s]:l});return a}getMetadata(){return b({},this._metadataRoot._def[le])}setMetadata(e){this._metadataRoot._def[le]=b({},e)}get ui(){return b({},this._metadataRoot._def[le])}get _metadataRoot(){return this.naked()}displayAs(e){return this.metadata({displayAs:[e.id,e.params]})}title(e){return this.metadata({title:e})}hidden(e){let n;return e===void 0?n=!0:typeof e=="function"?n=e.toString():n=e,this.metadata({hidden:n})}disabled(e){let n;return e===void 0?n=!0:typeof e=="function"?n=e.toString():n=e,this.metadata({disabled:n})}placeholder(e){return this.metadata({placeholder:e})}toJSONSchema(){return st(this)}toTypescriptType(e){return ka(this,e)}toTypescriptSchema(){return $a(this)}naked(){return this}};d(ng,"ZodType");var he=ng,rg=(t=>(t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodRef="ZodRef",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly",t))(rg||{}),be;(t=>{t.assertEqual=d(o=>o,"assertEqual");function e(o){}t.assertIs=e,d(e,"assertIs");function n(o){throw new Error("assertNever called")}t.assertNever=n,d(n,"assertNever"),t.arrayToEnum=d(o=>{let a={};for(let i of o)a[i]=i;return a},"arrayToEnum"),t.getValidEnumValues=d(o=>{let a=(0,t.objectKeys)(o).filter(s=>typeof o[o[s]]!="number"),i={};for(let s of a)i[s]=o[s];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=d(o=>(0,t.objectKeys)(o).map(function(a){return o[a]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&a.push(i);return a},t.find=d((o,a)=>{for(let i of o)if(a(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,a=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,d(r,"joinValues"),t.jsonStringifyReplacer=d((o,a)=>typeof a=="bigint"?a.toString():a,"jsonStringifyReplacer"),t.compareFunctions=d((o,a)=>o.toString()===a.toString(),"compareFunctions"),t.mock=d(()=>({}),"mock")})(be||(be={}));var ba;(t=>{t.mergeShapes=d((e,n)=>b(b({},e),n),"mergeShapes")})(ba||(ba={}));var ne=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sn=d(t=>{switch(typeof t){case"undefined":return ne.undefined;case"string":return ne.string;case"number":return isNaN(t)?ne.nan:ne.number;case"boolean":return ne.boolean;case"function":return ne.function;case"bigint":return ne.bigint;case"symbol":return ne.symbol;case"object":return Array.isArray(t)?ne.array:t===null?ne.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ne.promise:typeof Map<"u"&&t instanceof Map?ne.map:typeof Set<"u"&&t instanceof Set?ne.set:typeof Date<"u"&&t instanceof Date?ne.date:ne.object;default:return ne.unknown}},"getParsedType");function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o,supportsExtensions:a,[le]:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);let s=i?Object.fromEntries(Object.entries(i).filter(([f])=>f!=="secret"||a?.includes("secret"))):void 0;return e?{errorMap:e,description:o,[le]:s}:{errorMap:d((f,p)=>f.code!=="invalid_type"?{message:p.defaultError}:typeof p.data>"u"?{message:r??p.defaultError}:{message:n??p.defaultError},"customMap"),description:o,[le]:s}}d(me,"processCreateParams");var Ka=d((t,e)=>{let n;switch(t.code){case V.invalid_type:t.received===ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:be.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case V.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case V.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;case V.unresolved_reference:n="Unresolved reference";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},"errorMap"),Yc=Ka,V=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","unresolved_reference"]),Hx=d(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Si=class ig extends Error{constructor(e){super(),this.issues=[],this.addIssue=d(r=>{this.issues=[...this.issues,r]},"addIssue"),this.addIssues=d((r=[])=>{this.issues=[...this.issues,...r]},"addIssues");let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let n=e||function(a){return a.message},r={_errors:[]},o=d(a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let s=r,l=0;for(;l<i.path.length;){let f=i.path[l];l===i.path.length-1?(s[f]=s[f]||{_errors:[]},s[f]._errors.push(n(i))):s[f]=s[f]||{_errors:[]},s=s[f],l++}}},"processError");return o(this),r}static assert(e){if(!(e instanceof ig))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};d(Si,"ZodError");Si.create=d(t=>new Si(t),"create");var Wt=Si,og=Ka;function ag(t){og=t}d(ag,"setErrorMap");function jr(){return og}d(jr,"getErrorMap");var ki=d(t=>{var e;let{data:n,path:r,errorMaps:o,issueData:a}=t,i=[...r,...a.path||[]],s=N(b({},a),{path:i}),l="",f=o.filter(p=>!!p).slice().reverse();for(let p of f)l=p(s,{data:n,defaultError:l}).message;return N(b({},a),{path:i,message:(e=a.message)!=null?e:l})},"makeIssue"),Ux=[];function te(t,e){let n=ki({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jr(),Ka].filter(r=>!!r)});t.common.issues.push(n)}d(te,"addIssueToContext");var sg=class lg{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n)r.push({key:await o.key,value:await o.value});return lg.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:a,value:i}=o;if(a.status==="aborted"||i.status==="aborted")return pe;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}};d(sg,"ParseStatus");var Tt=sg,pe=Object.freeze({status:"aborted"}),Jn=d(t=>({status:"dirty",value:t}),"DIRTY"),gt=d(t=>({status:"valid",value:t}),"OK"),wa=d(t=>t.status==="aborted","isAborted"),xa=d(t=>t.status==="dirty","isDirty"),Kr=d(t=>t.status==="valid","isValid"),Ii=d(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),ue;(t=>{t.errToObj=d(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=d(e=>typeof e=="string"?e:e?.message,"toString")})(ue||(ue={}));var Ai=class ug extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof ug}};d(Ai,"ZodAny");Ai.create=d(t=>new Ai(b({typeName:"ZodAny"},me(t))),"create");var Lr=Ai,Ci=class Pn extends he{dereference(e){return new Pn(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pn(N(b({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,o,a,i,s;return e instanceof Pn?Xn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&Xn((o=this._def.maxLength)==null?void 0:o.value,(a=e._def.maxLength)==null?void 0:a.value)&&Xn((i=this._def.minLength)==null?void 0:i.value,(s=e._def.minLength)==null?void 0:s.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==ne.array)return te(n,{code:V.invalid_type,expected:ne.array,received:n.parsedType}),pe;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,s=n.data.length<o.exactLength.value;(i||s)&&(te(n,{code:i?V.too_big:V.too_small,minimum:s?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(te(n,{code:V.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(te(n,{code:V.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,s)=>o.type._parseAsync(new Ot(n,i,n.path,s)))).then(i=>Tt.mergeArray(r,i));let a=[...n.data].map((i,s)=>o.type._parseSync(new Ot(n,i,n.path,s)));return Tt.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new Pn(N(b({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new Pn(N(b({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new Pn(N(b({},this._def),{exactLength:{value:e,message:ue.toString(n)}}))}nonempty(e){return this.min(1,e)}};d(Ci,"ZodArray");Ci.create=d((t,e)=>new Ci(b({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Fr=Ci,$x=d((t,e)=>cg(t,e,new WeakSet),"isEqual"),cg=d((t,e,n)=>rx(t,e,Zx(n)),"_isEqualWithVisitedTracking"),Zx=d(t=>(e,n)=>{if(Rc(e)&&!t.has(e)&&Rc(n)&&!t.has(n)){let r=Gc(e,qc),o=Gc(n,qc);return t.add(r).add(o).add(e).add(n),cg(r,o,t)}},"_customizerWithVisitedTracking"),jx={compare:$x},fg=class{constructor(e=[],n={}){this._options=b(b({},jx),n),this._items=[];for(let r of e)this.add(r)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(n=>this._options.compare(n,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(n=>e.has(n))}};d(fg,"CustomSet");var et=fg,Oi=class Ti extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ne.bigint){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_type,expected:ne.bigint,received:a.parsedType}),pe}let r,o=new Tt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):be.assertNever(a);return{status:o.value,value:e.data}}isEqual(e){if(!(e instanceof Ti)||this._def.coerce!==e._def.coerce)return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}gte(e,n){return this.setLimit("min",e,!0,ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ue.toString(n))}setLimit(e,n,r,o){return new Ti(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new Ti(N(b({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ue.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};d(Oi,"ZodBigInt");Oi.create=d(t=>{var e;return new Oi(b({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var La=Oi,Ri=class dg extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ne.boolean){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.boolean,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof dg?this._def.coerce===e._def.coerce:!1}};d(Ri,"ZodBoolean");Ri.create=d(t=>new Ri(b({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var Fa=Ri,Kx=Symbol("zod_brand"),pg=class wr extends he{dereference(e){return new wr(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new wr(N(b({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}isEqual(e){return e instanceof wr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new wr(N(b({},this._def),{type:this._def.type.mandatory()}))}};d(pg,"ZodBranded");var Wa=pg,Mi=class xr extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(b({},n),{common:N(b({},n.common),{issues:[]})}),o=this._def.innerType._parse({data:r.data,path:r.path,parent:b({},r)});return Ii(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Wt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof xr?this._def.innerType.isEqual(e._def.innerType)&&be.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new xr(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new xr(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Mi,"ZodCatch");Mi.create=d((t,e)=>new Mi(b({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var za=Mi,gg=d((t,e={},n)=>t?Lr.create().superRefine((r,o)=>{var a,i;if(!t(r)){let s=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(i=(a=s.fatal)!=null?a:n)!=null?i:!0,f=typeof s=="string"?{message:s}:s;o.addIssue(N(b({code:"custom"},f),{fatal:l}))}}):Lr.create(),"custom"),Ni=class Pa extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_type,expected:ne.date,received:a.parsedType}),pe}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_date}),pe}let r=new Tt,o;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:V.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:V.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):be.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pa(N(b({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ue.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ue.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}isEqual(e){if(!(e instanceof Pa))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};d(Ni,"ZodDate");Ni.create=d(t=>new Ni(b({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var qa=Ni,Di=class Pr extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}dereference(e){return new Pr(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Pr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof Pr?this._def.innerType.isEqual(e._def.innerType)&&Xn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Pr(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Di,"ZodDefault");Di.create=d((t,e,n)=>new Di(b({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var To=Di,Gt=d(t=>Array.from(new Set(t)),"unique"),Ft=d(t=>t instanceof Ja?Ft(t.schema):t instanceof In?Ft(t.innerType()):t instanceof Ya?[t.value]:t instanceof or?t.options:t instanceof Xa?be.objectValues(t.enum):t instanceof To?Ft(t._def.innerType):t instanceof xo?[void 0]:t instanceof Qa?[null]:t instanceof ln?[void 0,...Ft(t.unwrap())]:t instanceof er?[null,...Ft(t.unwrap())]:t instanceof Wa||t instanceof wo?Ft(t.unwrap()):t instanceof za?Ft(t._def.innerType):[],"getDiscriminator"),yg=class Bn extends he{dereference(e){let n=this.options.map(o=>o.dereference(e)),r=Bn._getOptionsMap(this.discriminator,n);return new Bn(N(b({},this._def),{options:n,optionsMap:r}))}getReferences(){return Gt(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new Bn(N(b({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.object)return te(n,{code:V.invalid_type,expected:ne.object,received:n.parsedType}),pe;let r=this.discriminator,o=n.data[r],a=this.optionsMap.get(o);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=Bn._getOptionsMap(e,n);return new Bn(b({typeName:"ZodDiscriminatedUnion",discriminator:e,options:n,optionsMap:o},me(r)))}static _getOptionsMap(e,n){let r=new Map;for(let o of n){let a=Ft(o.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of a){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,o)}}return r}isEqual(e){if(!(e instanceof Bn)||this._def.discriminator!==e._def.discriminator)return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et(this._def.options,{compare:n}),o=new et(e._def.options,{compare:n});return r.isEqual(o)}};d(yg,"ZodDiscriminatedUnion");var mg=yg;function _o(t,e){return new or(b({values:t,typeName:"ZodEnum"},me(e)))}d(_o,"createZodEnum");var Ga=class _i extends he{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{expected:be.joinValues(r),received:n.parsedType,code:V.invalid_type}),pe}if(this._def.values.indexOf(e.data)===-1){let n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{received:n.data,code:V.invalid_enum_value,options:r}),pe}return gt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return _i.create(e,b(b({},this._def),n))}exclude(e,n=this._def){return _i.create(this.options.filter(r=>!e.includes(r)),b(b({},this._def),n))}isEqual(e){if(!(e instanceof _i))return!1;let n=new et(this._def.values),r=new et(e._def.values);return n.isEqual(r)}};d(Ga,"ZodEnum");Ga.create=_o;var or=Ga,hg=class En extends he{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let n=this._def.args.dereference(e),r=this._def.returns.dereference(e);return new En(N(b({},this._def),{args:n,returns:r}))}getReferences(){return Gt([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new En(N(b({},this._def),{args:this._def.args.clone(),returns:this._def.returns.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.function)return te(n,{code:V.invalid_type,expected:ne.function,received:n.parsedType}),pe;function r(s,l){return ki({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,jr(),Yc].filter(f=>!!f),issueData:{code:V.invalid_arguments,argumentsError:l}})}d(r,"makeArgsIssue");function o(s,l){return ki({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,jr(),Yc].filter(f=>!!f),issueData:{code:V.invalid_return_type,returnTypeError:l}})}d(o,"makeReturnsIssue");let a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof bo){let s=this;return gt(async function(...l){let f=new Wt([]),p=await s._def.args.parseAsync(l,a).catch(h=>{throw f.addIssue(r(l,h)),f}),y=await Reflect.apply(i,this,p);return await s._def.returns._def.type.parseAsync(y,a).catch(h=>{throw f.addIssue(o(y,h)),f})})}else{let s=this;return gt(function(...l){let f=s._def.args.safeParse(l,a);if(!f.success)throw new Wt([r(l,f.error)]);let p=Reflect.apply(i,this,f.data),y=s._def.returns.safeParse(p,a);if(!y.success)throw new Wt([o(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new En(N(b({},this._def),{args:rr.create(e).rest(Hr.create())}))}returns(e){return new En(N(b({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new En(b({args:e||rr.create([]).rest(Hr.create()),returns:n||Hr.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof En&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};d(hg,"ZodFunction");var vg=hg;function Hi(t,e){let n=sn(t),r=sn(e);if(t===e)return{valid:!0,data:t};if(n===ne.object&&r===ne.object){let o=be.objectKeys(e),a=be.objectKeys(t).filter(s=>o.indexOf(s)!==-1),i=b(b({},t),e);for(let s of a){let l=Hi(t[s],e[s]);if(!l.valid)return{valid:!1};i[s]=l.data}return{valid:!0,data:i}}else if(n===ne.array&&r===ne.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let a=0;a<t.length;a++){let i=t[a],s=e[a],l=Hi(i,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===ne.date&&r===ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}d(Hi,"mergeValues");var Ui=class bi extends he{dereference(e){return new bi(N(b({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Gt([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new bi(N(b({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=d((a,i)=>{if(wa(a)||wa(i))return pe;let s=Hi(a.value,i.value);return s.valid?((xa(a)||xa(i))&&n.dirty(),{status:n.value,value:s.data}):(te(r,{code:V.invalid_intersection_types}),pe)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>o(a,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}isEqual(e){if(!(e instanceof bi))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et([this._def.left,this._def.right],{compare:n}),o=new et([e._def.left,e._def.right],{compare:n});return r.isEqual(o)}};d(Ui,"ZodIntersection");Ui.create=d((t,e,n)=>new Ui(b({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var Va=Ui,$i=class Br extends he{get schema(){return this._def.getter()}dereference(e){return new Br(N(b({},this._def),{getter:d(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Br(N(b({},this._def),{getter:d(()=>this._def.getter().clone(),"getter")}))}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}isEqual(e){return e instanceof Br?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Br(N(b({},this._def),{getter:d(()=>this._def.getter().mandatory(),"getter")}))}};d($i,"ZodLazy");$i.create=d((t,e)=>new $i(b({getter:t,typeName:"ZodLazy"},me(e))),"create");var Ja=$i,Zi=class Tg extends he{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Tg?Xn(this._def.value,e._def.value):!1}};d(Zi,"ZodLiteral");Zi.create=d((t,e)=>new Zi(b({value:t,typeName:"ZodLiteral"},me(e))),"create");var Ya=Zi,ji=class wi extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let n=this._def.keyType.dereference(e),r=this._def.valueType.dereference(e);return new wi(N(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Gt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new wi(N(b({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.map)return te(r,{code:V.invalid_type,expected:ne.map,received:r.parsedType}),pe;let o=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([s,l],f)=>({key:o._parse(new Ot(r,s,r.path,[f,"key"])),value:a._parse(new Ot(r,l,r.path,[f,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of i){let f=await l.key,p=await l.value;if(f.status==="aborted"||p.status==="aborted")return pe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),s.set(f.value,p.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let l of i){let f=l.key,p=l.value;if(f.status==="aborted"||p.status==="aborted")return pe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),s.set(f.value,p.value)}return{status:n.value,value:s}}}isEqual(e){return!(!(e instanceof wi)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(ji,"ZodMap");ji.create=d((t,e,n)=>new ji(b({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var _g=ji,Ki=class bg extends he{_parse(e){if(this._getType(e)!==ne.nan){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.nan,received:r.parsedType}),pe}return{status:"valid",value:e.data}}isEqual(e){return e instanceof bg}};d(Ki,"ZodNaN");Ki.create=d(t=>new Ki(b({typeName:"ZodNaN"},me(t))),"create");var wg=Ki,Li=class xg extends he{_parse(e){let n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ne.string&&r.parsedType!==ne.number){let o=be.objectValues(n);return te(r,{expected:be.joinValues(o),received:r.parsedType,code:V.invalid_type}),pe}if(n.indexOf(e.data)===-1){let o=be.objectValues(n);return te(r,{received:r.data,code:V.invalid_enum_value,options:o}),pe}return gt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof xg?Xn(this._def.values,e._def.values):!1}};d(Li,"ZodNativeEnum");Li.create=d((t,e)=>new Li(b({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var Xa=Li,Fi=class Pg extends he{_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:V.invalid_type,expected:ne.never,received:n.parsedType}),pe}isEqual(e){return e instanceof Pg}};d(Fi,"ZodNever");Fi.create=d(t=>new Fi(b({typeName:"ZodNever"},me(t))),"create");var qr=Fi,Wi=class Bg extends he{_parse(e){if(this._getType(e)!==ne.null){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.null,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Bg}};d(Wi,"ZodNull");Wi.create=d(t=>new Wi(b({typeName:"ZodNull"},me(t))),"create");var Qa=Wi,zi=class Er extends he{dereference(e){return new Er(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Er(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.null?gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Er?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Er(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(zi,"ZodNullable");zi.create=d((t,e)=>new zi(b({innerType:t,typeName:"ZodNullable"},me(e))),"create");var er=zi;function Eg(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,a=parseInt(t.toFixed(o).replace(".","")),i=parseInt(e.toFixed(o).replace(".",""));return a%i/Math.pow(10,o)}d(Eg,"floatSafeRemainder");var qi=class xi extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ne.number){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_type,expected:ne.number,received:a.parsedType}),pe}let r,o=new Tt;for(let a of this._def.checks)a.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:V.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?Eg(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_finite,message:a.message}),o.dirty()):be.assertNever(a);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ue.toString(n))}setLimit(e,n,r,o){return new xi(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new xi(N(b({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:ue.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ue.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ue.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ue.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ue.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&be.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}isEqual(e){if(!(e instanceof xi))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(qi,"ZodNumber");qi.create=d(t=>new qi(b({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var es=qi;function Sn(t){if(t instanceof tr){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=ln.create(Sn(r))}return new tr(N(b({},t._def),{shape:d(()=>e,"shape")}))}else return t instanceof Fr?new Fr(N(b({},t._def),{type:Sn(t.element)})):t instanceof ln?ln.create(Sn(t.unwrap())):t instanceof er?er.create(Sn(t.unwrap())):t instanceof rr?rr.create(t.items.map(e=>Sn(e))):t}d(Sn,"deepPartialify");var cn=class vt extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=be.objectKeys(e);return this._cached={shape:e,keys:n}}dereference(e){let n=this._def.shape(),r={};for(let o in n)r[o]=n[o].dereference(e);return new vt(N(b({},this._def),{shape:d(()=>r,"shape")}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return Gt(n)}clone(){let e={},n=this._def.shape();for(let[r,o]of Object.entries(n))e[r]=o.clone();return new vt(N(b({},this._def),{shape:d(()=>e,"shape")}))}_parse(e){if(this._getType(e)!==ne.object){let p=this._getOrReturnCtx(e);return te(p,{code:V.invalid_type,expected:ne.object,received:p.parsedType}),pe}let{status:r,ctx:o}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),s=[];if(this._def.unknownKeys!=="strip")for(let p in o.data)i.includes(p)||s.push(p);let l=[];for(let p of i){let y=a[p],g=o.data[p];l.push({key:{status:"valid",value:p},value:y._parse(new Ot(o,g,o.path,p)),alwaysSet:p in o.data})}let f=this._def.unknownKeys;if(f==="passthrough")for(let p of s)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(f==="strict")s.length>0&&(te(o,{code:V.unrecognized_keys,keys:s}),r.dirty());else if(f!=="strip")for(let p of s){let y=o.data[p];l.push({key:{status:"valid",value:p},value:f._parse(new Ot(o,y,o.path,p)),alwaysSet:p in o.data})}return o.common.async?Promise.resolve().then(async()=>{let p=[];for(let y of l){let g=await y.key;p.push({key:g,value:await y.value,alwaysSet:y.alwaysSet})}return p}).then(p=>Tt.mergeObjectSync(r,p)):Tt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new vt(b(N(b({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:d((n,r)=>{var o,a,i,s;let l=(i=(a=(o=this._def).errorMap)==null?void 0:a.call(o,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ue.errToObj(e).message)!=null?s:l}:{message:l}},"errorMap")}:{}))}strip(){return new vt(N(b({},this._def),{unknownKeys:"strip"}))}passthrough(){return new vt(N(b({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return Lr.create();if(this._def.unknownKeys==="strict")return qr.create()}extend(e){return new vt(N(b({},this._def),{shape:d(()=>b(b({},this._def.shape()),e),"shape")}))}merge(e){return new vt({unknownKeys:e._def.unknownKeys,shape:d(()=>b(b({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new vt(N(b({},this._def),{unknownKeys:e}))}pick(e){let n={};return be.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}omit(e){let n={};return be.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}deepPartial(){return Sn(this)}partial(e){let n={};return be.objectKeys(this.shape).forEach(r=>{let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o?.optional()}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}required(e){let n={};return be.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof ln;)a=a._def.innerType;n[r]=a}}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}keyof(){return _o(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof vt)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),o=d((s,l)=>s[0]===l[0]&&s[1].isEqual(l[1]),"compare"),a=new et(Object.entries(n),{compare:o}),i=new et(Object.entries(r),{compare:o});return a.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};d(cn,"ZodObject");cn.create=d((t,e)=>new cn(b({shape:d(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");cn.strictCreate=d((t,e)=>new cn(b({shape:d(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");cn.lazycreate=d((t,e)=>new cn(b({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var tr=cn,Gi=class Pi extends he{dereference(e){return new Pi(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Pi(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.undefined?gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Pi?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};d(Gi,"ZodOptional");Gi.create=d((t,e)=>new Gi(b({innerType:t,typeName:"ZodOptional"},me(e))),"create");var ln=Gi,Sg=class Sr extends he{dereference(e){return new Sr(N(b({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Gt([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Sr(N(b({},this._def),{in:this._def.in.clone(),out:this._def.out.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return d(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pe:a.status==="dirty"?(n.dirty(),Jn(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})},"handleAsync")();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pe:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new Sr({in:e,out:n,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Sr)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};d(Sg,"ZodPipeline");var ts=Sg,Vi=class Bi extends he{unwrap(){return this._def.type}dereference(e){return new Bi(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Bi(N(b({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.promise&&n.common.async===!1)return te(n,{code:V.invalid_type,expected:ne.promise,received:n.parsedType}),pe;let r=n.parsedType===ne.promise?n.data:Promise.resolve(n.data);return gt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}isEqual(e){return e instanceof Bi?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};d(Vi,"ZodPromise");Vi.create=d((t,e)=>new Vi(b({type:t,typeName:"ZodPromise"},me(e))),"create");var bo=Vi,Ji=class kr extends he{dereference(e){return new kr(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new kr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return Kr(n)&&(n.value=Object.freeze(n.value)),n}unwrap(){return this._def.innerType}isEqual(e){return e instanceof kr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new kr(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Ji,"ZodReadonly");Ji.create=d((t,e)=>new Ji(b({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var wo=Ji,kg=class qn extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let n=this._def.keyType.dereference(e),r=this._def.valueType.dereference(e);return new qn(N(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Gt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new qn(N(b({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.object)return te(r,{code:V.invalid_type,expected:ne.object,received:r.parsedType}),pe;let o=[],a=this._def.keyType,i=this._def.valueType;for(let s in r.data)o.push({key:a._parse(new Ot(r,s,r.path,s)),value:i._parse(new Ot(r,r.data[s],r.path,s))});return r.common.async?Tt.mergeObjectAsync(n,o):Tt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new qn(b({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new qn(b({keyType:yt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof qn)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(kg,"ZodRecord");var Ig=kg,Yi=class Ag extends he{dereference(e){let n=e[this._def.uri];return n||this}getReferences(){return[this._def.uri]}_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:V.unresolved_reference}),pe}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Ag?this._def.uri===e._def.uri:!1}};d(Yi,"ZodRef");Yi.create=d(t=>new Yi({typeName:"ZodRef",uri:t}),"create");var Cg=Yi,Xi=class Gn extends he{dereference(e){return new Gn(N(b({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Gn(N(b({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.set)return te(r,{code:V.invalid_type,expected:ne.set,received:r.parsedType}),pe;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(te(r,{code:V.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(te(r,{code:V.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let a=this._def.valueType;function i(l){let f=new Set;for(let p of l){if(p.status==="aborted")return pe;p.status==="dirty"&&n.dirty(),f.add(p.value)}return{status:n.value,value:f}}d(i,"finalizeSet");let s=[...r.data.values()].map((l,f)=>a._parse(new Ot(r,l,r.path,f)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(e,n){return new Gn(N(b({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new Gn(N(b({},this._def),{maxSize:{value:e,message:ue.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}isEqual(e){var n,r,o,a;if(!(e instanceof Gn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,s=(r=e._def.minSize)==null?void 0:r.value;if(i!==s)return!1;let l=(o=this._def.maxSize)==null?void 0:o.value,f=(a=e._def.maxSize)==null?void 0:a.value;return l!==f?!1:this._def.valueType.isEqual(e._def.valueType)}};d(Xi,"ZodSet");Xi.create=d((t,e)=>new Xi(b({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},me(e))),"create");var Og=Xi,Rg=/^c[^\s-]{8,}$/i,Mg=/^[a-z][a-z0-9]*$/,Ng=/^[0-9A-HJKMNP-TV-Z]{26}$/,Dg=/^[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,Hg=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ug="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Lx=d(t=>t===Ug,"isEmojiRegex"),fa,$g=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Zg=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;function jg(t,e){return!!((e==="v4"||!e)&&$g.test(t)||(e==="v6"||!e)&&Zg.test(t))}d(jg,"isValidIP");var Qi=class Vn extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ne.string){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_type,expected:ne.string,received:a.parsedType}),pe}let r=new Tt,o;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:V.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:V.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,s=e.data.length<a.value;(i||s)&&(o=this._getOrReturnCtx(e,o),i?te(o,{code:V.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&te(o,{code:V.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Hg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"email",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")fa||(fa=new RegExp(Ug,"u")),fa.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"emoji",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Dg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"uuid",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Rg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Mg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid2",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Ng.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ulid",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),te(o,{validation:"url",code:V.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"regex",code:V.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(e,o),te(o,{code:V.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:V.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:V.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?eg(a).test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{code:V.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="ip"?jg(e.data,a.version)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ip",code:V.invalid_string,message:a.message}),r.dirty()):be.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),b({validation:n,code:V.invalid_string},ue.errToObj(r)))}_addCheck(e){return new Vn(N(b({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(b({kind:"email"},ue.errToObj(e)))}url(e){return this._addCheck(b({kind:"url"},ue.errToObj(e)))}emoji(e){return this._addCheck(b({kind:"emoji"},ue.errToObj(e)))}uuid(e){return this._addCheck(b({kind:"uuid"},ue.errToObj(e)))}cuid(e){return this._addCheck(b({kind:"cuid"},ue.errToObj(e)))}cuid2(e){return this._addCheck(b({kind:"cuid2"},ue.errToObj(e)))}ulid(e){return this._addCheck(b({kind:"ulid"},ue.errToObj(e)))}ip(e){return this._addCheck(b({kind:"ip"},ue.errToObj(e)))}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(b({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(n=e?.offset)!=null?n:!1},ue.errToObj(e?.message)))}regex(e,n){return this._addCheck(b({kind:"regex",regex:e},ue.errToObj(n)))}includes(e,n){return this._addCheck(b({kind:"includes",value:e,position:n?.position},ue.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(b({kind:"startsWith",value:e},ue.errToObj(n)))}endsWith(e,n){return this._addCheck(b({kind:"endsWith",value:e},ue.errToObj(n)))}min(e,n){return this._addCheck(b({kind:"min",value:e},ue.errToObj(n)))}max(e,n){return this._addCheck(b({kind:"max",value:e},ue.errToObj(n)))}length(e,n){return this._addCheck(b({kind:"length",value:e},ue.errToObj(n)))}nonempty(e){return this.min(1,ue.errToObj(e))}trim(){return new Vn(N(b({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[le]=N(b({},this._def[le]),{secret:!0}),this}toLowerCase(){return new Vn(N(b({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Vn(N(b({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}isEqual(e){if(!(e instanceof Vn))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(Qi,"ZodString");Qi.create=d(t=>{var e;return new Qi(b({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(N(b({},t),{supportsExtensions:["secret"]}))))},"create");var yt=Qi,eo=class Kg extends he{_parse(e){if(this._getType(e)!==ne.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.symbol,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Kg}};d(eo,"ZodSymbol");eo.create=d(t=>new eo(b({typeName:"ZodSymbol"},me(t))),"create");var Lg=eo,nr=class Ir extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new Ir(N(b({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Ir(N(b({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,a={addIssue:d(i=>{te(r,i),i.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let i=o.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async s=>{if(n.value==="aborted")return pe;let l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?pe:l.status==="dirty"||n.value==="dirty"?Jn(l.value):l});{if(n.value==="aborted")return pe;let s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?pe:s.status==="dirty"||n.value==="dirty"?Jn(s.value):s}}if(o.type==="refinement"){let i=d(s=>{let l=o.refinement(s,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s},"executeRefinement");if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?pe:(s.status==="dirty"&&n.dirty(),i(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?pe:(s.status==="dirty"&&n.dirty(),i(s.value).then(()=>({status:n.value,value:s.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Kr(i))return i;let s=o.transform(i.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Kr(i)?Promise.resolve(o.transform(i.value,a)).then(s=>({status:n.value,value:s})):i);be.assertNever(o)}isEqual(e){return!(e instanceof Ir)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="refinement"?e._def.effect.type!=="refinement"?!1:be.compareFunctions(this._def.effect.refinement,e._def.effect.refinement):this._def.effect.type==="transform"?e._def.effect.type!=="transform"?!1:be.compareFunctions(this._def.effect.transform,e._def.effect.transform):this._def.effect.type==="preprocess"?e._def.effect.type!=="preprocess"?!1:be.compareFunctions(this._def.effect.transform,e._def.effect.transform):!1}naked(){return this._def.schema.naked()}mandatory(){return new Ir(N(b({},this._def),{schema:this._def.schema.mandatory()}))}};d(nr,"ZodEffects");nr.create=d((t,e,n)=>new nr(b({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");nr.createWithPreprocess=d((t,e,n)=>new nr(b({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var In=nr,to=class Ar extends he{dereference(e){let n=this._def.items.map(o=>o.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Ar(N(b({},this._def),{items:n,rest:r}))}getReferences(){return Gt([...this._def.items.flatMap(e=>e.getReferences()),...this._def.rest?this._def.rest.getReferences():[]])}clone(){let e=this._def.items.map(r=>r.clone()),n=this._def.rest?this._def.rest.clone():null;return new Ar(N(b({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.array)return te(r,{code:V.invalid_type,expected:ne.array,received:r.parsedType}),pe;if(r.data.length<this._def.items.length)return te(r,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pe;!this._def.rest&&r.data.length>this._def.items.length&&(te(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((i,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Ot(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>Tt.mergeArray(n,i)):Tt.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new Ar(N(b({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Ar)||!this._restEquals(e))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et(this._def.items,{compare:n}),o=new et(e._def.items,{compare:n});return r.isEqual(o)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};d(to,"ZodTuple");to.create=d((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new to(b({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var rr=to,no=class Fg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.undefined,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Fg}mandatory(){return qr.create(b({},this._def))}};d(no,"ZodUndefined");no.create=d(t=>new no(b({typeName:"ZodUndefined"},me(t))),"create");var xo=no,ro=class Cr extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Cr(N(b({},this._def),{options:n}))}getReferences(){return Gt(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Cr(N(b({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let i=a.map(s=>new Wt(s.ctx.common.issues));return te(n,{code:V.invalid_union,unionErrors:i}),pe}if(d(o,"handleResults"),n.common.async)return Promise.all(r.map(async a=>{let i=N(b({},n),{common:N(b({},n.common),{issues:[]}),parent:null});return{result:await a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let a,i=[];for(let l of r){let f=N(b({},n),{common:N(b({},n.common),{issues:[]}),parent:null}),p=l._parseSync({data:n.data,path:n.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(l=>new Wt(l));return te(n,{code:V.invalid_union,unionErrors:s}),pe}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Cr))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et([...this._def.options],{compare:n}),o=new et([...e._def.options],{compare:n});return r.isEqual(o)}mandatory(){let e=this._def.options.filter(a=>!(a instanceof xo)).map(a=>a.mandatory()),[n,r,...o]=e;return n?r?new Cr(N(b({},this._def),{options:[n,r,...o]})):n:qr.create(b({},this._def))}};d(ro,"ZodUnion");ro.create=d((t,e)=>new ro(b({options:t,typeName:"ZodUnion"},me(e))),"create");var ns=ro,io=class Wg extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof Wg}};d(io,"ZodUnknown");io.create=d(t=>new io(b({typeName:"ZodUnknown"},me(t))),"create");var Hr=io,oo=class zg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.void,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof zg}};d(oo,"ZodVoid");oo.create=d(t=>new oo(b({typeName:"ZodVoid"},me(t))),"create");var qg=oo,Fx=["gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-turbo","gpt-4o","gpt-3.5-turbo-0125","gpt-3.5-turbo-1106"],JA=or.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Wx=d(t=>yt.create().displayAs({id:"variable",params:b({type:t?.type||"any"},t?.params)}),"variable"),zx=d(t=>yt.create().displayAs({id:"conversation",params:b({},t?.params)}),"conversation"),qx=d(t=>yt.create().displayAs({id:"user",params:b({},t?.params)}),"user"),Gx=d(t=>yt.create().displayAs({id:"message",params:b({},t?.params)}),"message"),Vx=d(t=>yt.create().displayAs({id:"agent",params:b({},t?.params)}),"agent"),Jx=d(t=>yt.create().displayAs({id:"event",params:b({},t?.params)}),"event"),Yx=d(t=>yt.create().displayAs({id:"table",params:b({},t?.params)}),"table"),Xx=d(t=>yt.create().displayAs({id:"tablerow",params:b({},t?.params)}),"tablerow"),Qx=d(t=>yt.create().displayAs({id:"intent",params:b({},t?.params)}),"intent"),eP=d(()=>or.create(Fx).displayAs({id:"dropdown",params:{}}),"aimodel"),tP=d(t=>yt.create().displayAs({id:"datasource",params:b({},t)}),"datasource"),nP=d(t=>yt.create().displayAs({id:"knowledgebase",params:b({},t)}),"knowledgebase"),rP={object:tr.lazycreate},iP=d((t,e={message:`Input not instance of ${t.name}`})=>gg(n=>n instanceof t,e),"instanceOfType"),Gg=yt.create,Vg=es.create,oP=wg.create,aP=La.create,Jg=Fa.create,sP=qa.create,lP=Lg.create,uP=xo.create,cP=Qa.create,fP=Lr.create,dP=Hr.create,pP=qr.create,gP=qg.create,yP=Fr.create,mP=tr.create,hP=tr.strictCreate,vP=ns.create,TP=mg.create,_P=Va.create,bP=rr.create,wP=Ig.create,xP=Cg.create,PP=wo.create,BP=_g.create,EP=Og.create,SP=vg.create,kP=Ja.create,IP=Ya.create,AP=or.create,CP=Xa.create,OP=bo.create,Xc=In.create,RP=ln.create,MP=er.create,NP=To.create,DP=In.createWithPreprocess,HP=ts.create,UP=d(()=>Gg().optional(),"ostring"),$P=d(()=>Vg().optional(),"onumber"),ZP=d(()=>Jg().optional(),"oboolean"),jP={string:d(t=>yt.create(N(b({},t),{coerce:!0})),"string"),number:d(t=>es.create(N(b({},t),{coerce:!0})),"number"),boolean:d(t=>Fa.create(N(b({},t),{coerce:!0})),"boolean"),bigint:d(t=>La.create(N(b({},t),{coerce:!0})),"bigint"),date:d(t=>qa.create(N(b({},t),{coerce:!0})),"date")},KP=pe,R=X,Yg=d((t,e)=>t.anyOf.length?t.anyOf.length===1?it(t.anyOf[0],N(b({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>it(n,N(b({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),LP=d(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),FP=d(t=>"z.any()","parseDefault"),WP=d((t,e)=>`z.union([${t.type.map(n=>it(N(b({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),zP=d((t,e)=>`z.any().refine((value) => !${it(t.not,N(b({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),qP=d(t=>"z.null()","parseNull"),GP=d(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),VP=d((t,...e)=>Object.keys(t).reduce((n,r)=>(e.includes(r)||(n[r]=t[r]),n),{}),"omit");function ut(t,e,n){var r;let o=t[e],a="";if(o!==void 0){let i=n({value:o,json:JSON.stringify(o)});if(i){let s=i[0],l=i.length===3?i[1]:"",f=i.length===3?i[2]:i[1];a+=s,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(a+=l+JSON.stringify(t.errorMessage[e])),a+=f}}return a}d(ut,"withMessage");var Or=Symbol("Original index"),JP=d(t=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="boolean")e.push(r?{[Or]:n}:{[Or]:n,not:{}});else{if(Or in r)return t;e.push(N(b({},r),{[Or]:n}))}}return e},"ensureOriginalIndex");function Wr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return it(n,N(b({},e),{path:[...e.path,"allOf",n[Or]]}))}else{let[n,r]=GP(JP(t.allOf));return`z.intersection(${Wr({allOf:n},e)}, ${Wr({allOf:r},e)})`}}d(Wr,"parseAllOf");var YP=d((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,o)=>it(r,N(b({},e),{path:[...e.path,"items",o]})))}])`;let n=t.items?`z.array(${it(t.items,N(b({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return n+=ut(t,"minItems",({json:r})=>[`.min(${r}`,", ",")"]),n+=ut(t,"maxItems",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseArray"),XP=d(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),QP=d(t=>t.enum.length===0?"z.never()":t.enum.length===1?`z.literal(${JSON.stringify(t.enum[0])})`:t.enum.every(e=>typeof e=="string")?`z.enum([${t.enum.map(e=>JSON.stringify(e))}])`:`z.union([${t.enum.map(e=>`z.literal(${JSON.stringify(e)})`).join(", ")}])`,"parseEnum"),eB=d((t,e)=>{let n=it(t.if,N(b({},e),{path:[...e.path,"if"]})),r=it(t.then,N(b({},e),{path:[...e.path,"then"]})),o=it(t.else,N(b({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${o}]).superRefine((value,ctx) => {
|
|
25
|
+
${S}`.trim();case R.ZodFirstPartyTypeKind.ZodEnum:return s.values.map(se).join(" | ");case R.ZodFirstPartyTypeKind.ZodEffects:return ke(s.schema,a);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new xf(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return`${ke(s.innerType,a)} | undefined`;case R.ZodFirstPartyTypeKind.ZodNullable:return`${ke(s.innerType,a)} | null`;case R.ZodFirstPartyTypeKind.ZodDefault:let H=e.treatDefaultAsOptional?s.innerType.optional():s.innerType;return ke(H,a);case R.ZodFirstPartyTypeKind.ZodCatch:return ke(s.innerType,a);case R.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${ke(s.type,a)}>`;case R.ZodFirstPartyTypeKind.ZodBranded:return ke(s.type,a);case R.ZodFirstPartyTypeKind.ZodPipeline:return ke(s.in,a);case R.ZodFirstPartyTypeKind.ZodSymbol:return`${nt(i.description)} symbol`.trim();case R.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${ke(s.innerType,a)}>`;case R.ZodFirstPartyTypeKind.ZodRef:return sf(s.uri);default:be.assertNever(s)}}d(ke,"sUnwrapZod");var aT=d((t,e)=>{if(t.props.type==="none")return ke(t.props.schema,e);let{schema:n,identifier:r}=t.props,o=nt(n.description),a=n.describe(""),i=ke(a,N(b({},e),{declaration:!0})),l=i.split(`
|
|
26
|
+
`).length>=rT&&e.includeClosingTags?`// end of ${r}`:"";if(t.props.type!=="type"&&n instanceof R.ZodFunction)return oa(`${o}
|
|
27
|
+
declare function ${r}${i};${l}`);if(t.props.type==="variable")return oa(`${o}declare const ${r}: ${i};${l}`);let f=t.props.args.length>0?`<${t.props.args.map(sf).join(", ")}>`:"";return oa(`${o}type ${t.props.identifier}${f} = ${i};${l}`)},"unwrapDeclaration"),sT=d(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),lT=d((t,e)=>{let n=sT(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new ga;return new Mr({type:"none",schema:t})}let o="title"in t.ui?t.ui.title:null;if(!o)throw new Bf;if(n==="variable"){if(r.length>0)throw new ga;return new Mr({type:"variable",identifier:o,schema:t})}return new Mr({type:"type",identifier:o,schema:t,args:r})},"getDeclarationProps"),uT=typeof global=="object"&&global&&global.Object===Object&&global,Of=uT,cT=typeof self=="object"&&self&&self.Object===Object&&self,fT=Of||cT||Function("return this")(),qt=fT,dT=qt.Symbol,un=dT,Rf=Object.prototype,pT=Rf.hasOwnProperty,gT=Rf.toString,_r=un?un.toStringTag:void 0;function Mf(t){var e=pT.call(t,_r),n=t[_r];try{t[_r]=void 0;var r=!0}catch{}var o=gT.call(t);return r&&(e?t[_r]=n:delete t[_r]),o}d(Mf,"getRawTag");var yT=Mf,mT=Object.prototype,hT=mT.toString;function Nf(t){return hT.call(t)}d(Nf,"objectToString");var vT=Nf,TT="[object Null]",_T="[object Undefined]",wc=un?un.toStringTag:void 0;function Df(t){return t==null?t===void 0?_T:TT:wc&&wc in Object(t)?yT(t):vT(t)}d(Df,"baseGetTag");var An=Df;function Hf(t){return t!=null&&typeof t=="object"}d(Hf,"isObjectLike");var kn=Hf,bT="[object Symbol]";function Uf(t){return typeof t=="symbol"||kn(t)&&An(t)==bT}d(Uf,"isSymbol");var Ia=Uf;function $f(t,e){for(var n=-1,r=t==null?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}d($f,"arrayMap");var Zf=$f,wT=Array.isArray,zt=wT,xT=1/0,xc=un?un.prototype:void 0,Pc=xc?xc.toString:void 0;function Aa(t){if(typeof t=="string")return t;if(zt(t))return Zf(t,Aa)+"";if(Ia(t))return Pc?Pc.call(t):"";var e=t+"";return e=="0"&&1/t==-xT?"-0":e}d(Aa,"baseToString");var PT=Aa;function jf(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}d(jf,"isObject");var Qn=jf;function Kf(t){return t}d(Kf,"identity");var BT=Kf,ET="[object AsyncFunction]",ST="[object Function]",kT="[object GeneratorFunction]",IT="[object Proxy]";function Lf(t){if(!Qn(t))return!1;var e=An(t);return e==ST||e==kT||e==ET||e==IT}d(Lf,"isFunction");var Ff=Lf,AT=qt["__core-js_shared__"],aa=AT,Bc=(function(){var t=/[^.]+$/.exec(aa&&aa.keys&&aa.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Wf(t){return!!Bc&&Bc in t}d(Wf,"isMasked");var CT=Wf,OT=Function.prototype,RT=OT.toString;function zf(t){if(t!=null){try{return RT.call(t)}catch{}try{return t+""}catch{}}return""}d(zf,"toSource");var Cn=zf,MT=/[\\^$.*+?()[\]{}|]/g,NT=/^\[object .+?Constructor\]$/,DT=Function.prototype,HT=Object.prototype,UT=DT.toString,$T=HT.hasOwnProperty,ZT=RegExp("^"+UT.call($T).replace(MT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qf(t){if(!Qn(t)||CT(t))return!1;var e=Ff(t)?ZT:NT;return e.test(Cn(t))}d(qf,"baseIsNative");var jT=qf;function Gf(t,e){return t?.[e]}d(Gf,"getValue");var KT=Gf;function Vf(t,e){var n=KT(t,e);return jT(n)?n:void 0}d(Vf,"getNative");var On=Vf,LT=On(qt,"WeakMap"),ya=LT,FT=(function(){try{var t=On(Object,"defineProperty");return t({},"",{}),t}catch{}})(),Ec=FT,WT=9007199254740991,zT=/^(?:0|[1-9]\d*)$/;function Jf(t,e){var n=typeof t;return e=e??WT,!!e&&(n=="number"||n!="symbol"&&zT.test(t))&&t>-1&&t%1==0&&t<e}d(Jf,"isIndex");var Ca=Jf;function Yf(t,e,n){e=="__proto__"&&Ec?Ec(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}d(Yf,"baseAssignValue");var Xf=Yf;function Qf(t,e){return t===e||t!==t&&e!==e}d(Qf,"eq");var Oa=Qf,qT=Object.prototype,GT=qT.hasOwnProperty;function ed(t,e,n){var r=t[e];(!(GT.call(t,e)&&Oa(r,n))||n===void 0&&!(e in t))&&Xf(t,e,n)}d(ed,"assignValue");var VT=ed,JT=9007199254740991;function td(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=JT}d(td,"isLength");var Ra=td;function nd(t){return t!=null&&Ra(t.length)&&!Ff(t)}d(nd,"isArrayLike");var rd=nd,YT=Object.prototype;function id(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||YT;return t===n}d(id,"isPrototype");var od=id;function ad(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}d(ad,"baseTimes");var XT=ad,QT="[object Arguments]";function sd(t){return kn(t)&&An(t)==QT}d(sd,"baseIsArguments");var Sc=sd,ld=Object.prototype,e_=ld.hasOwnProperty,t_=ld.propertyIsEnumerable,n_=Sc((function(){return arguments})())?Sc:function(t){return kn(t)&&e_.call(t,"callee")&&!t_.call(t,"callee")},ud=n_;function cd(){return!1}d(cd,"stubFalse");var r_=cd,fd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,kc=fd&&typeof module=="object"&&module&&!module.nodeType&&module,i_=kc&&kc.exports===fd,Ic=i_?qt.Buffer:void 0,o_=Ic?Ic.isBuffer:void 0,a_=o_||r_,ma=a_,s_="[object Arguments]",l_="[object Array]",u_="[object Boolean]",c_="[object Date]",f_="[object Error]",d_="[object Function]",p_="[object Map]",g_="[object Number]",y_="[object Object]",m_="[object RegExp]",h_="[object Set]",v_="[object String]",T_="[object WeakMap]",__="[object ArrayBuffer]",b_="[object DataView]",w_="[object Float32Array]",x_="[object Float64Array]",P_="[object Int8Array]",B_="[object Int16Array]",E_="[object Int32Array]",S_="[object Uint8Array]",k_="[object Uint8ClampedArray]",I_="[object Uint16Array]",A_="[object Uint32Array]",$e={};$e[w_]=$e[x_]=$e[P_]=$e[B_]=$e[E_]=$e[S_]=$e[k_]=$e[I_]=$e[A_]=!0;$e[s_]=$e[l_]=$e[__]=$e[u_]=$e[b_]=$e[c_]=$e[f_]=$e[d_]=$e[p_]=$e[g_]=$e[y_]=$e[m_]=$e[h_]=$e[v_]=$e[T_]=!1;function dd(t){return kn(t)&&Ra(t.length)&&!!$e[An(t)]}d(dd,"baseIsTypedArray");var C_=dd;function pd(t){return function(e){return t(e)}}d(pd,"baseUnary");var O_=pd,gd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nr=gd&&typeof module=="object"&&module&&!module.nodeType&&module,R_=Nr&&Nr.exports===gd,sa=R_&&Of.process,M_=(function(){try{var t=Nr&&Nr.require&&Nr.require("util").types;return t||sa&&sa.binding&&sa.binding("util")}catch{}})(),Ac=M_,Cc=Ac&&Ac.isTypedArray,N_=Cc?O_(Cc):C_,yd=N_,D_=Object.prototype,H_=D_.hasOwnProperty;function md(t,e){var n=zt(t),r=!n&&ud(t),o=!n&&!r&&ma(t),a=!n&&!r&&!o&&yd(t),i=n||r||o||a,s=i?XT(t.length,String):[],l=s.length;for(var f in t)(e||H_.call(t,f))&&!(i&&(f=="length"||o&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Ca(f,l)))&&s.push(f);return s}d(md,"arrayLikeKeys");var hd=md;function vd(t,e){return function(n){return t(e(n))}}d(vd,"overArg");var Td=vd,U_=Td(Object.keys,Object),$_=U_,Z_=Object.prototype,j_=Z_.hasOwnProperty;function _d(t){if(!od(t))return $_(t);var e=[];for(var n in Object(t))j_.call(t,n)&&n!="constructor"&&e.push(n);return e}d(_d,"baseKeys");var K_=_d;function bd(t){return rd(t)?hd(t):K_(t)}d(bd,"keys");var Ma=bd;function wd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}d(wd,"nativeKeysIn");var L_=wd,F_=Object.prototype,W_=F_.hasOwnProperty;function xd(t){if(!Qn(t))return L_(t);var e=od(t),n=[];for(var r in t)r=="constructor"&&(e||!W_.call(t,r))||n.push(r);return n}d(xd,"baseKeysIn");var z_=xd;function Pd(t){return rd(t)?hd(t,!0):z_(t)}d(Pd,"keysIn");var q_=Pd,G_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V_=/^\w*$/;function Bd(t,e){if(zt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Ia(t)?!0:V_.test(t)||!G_.test(t)||e!=null&&t in Object(e)}d(Bd,"isKey");var Na=Bd,J_=On(Object,"create"),Ur=J_;function Ed(){this.__data__=Ur?Ur(null):{},this.size=0}d(Ed,"hashClear");var Y_=Ed;function Sd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}d(Sd,"hashDelete");var X_=Sd,Q_="__lodash_hash_undefined__",eb=Object.prototype,tb=eb.hasOwnProperty;function kd(t){var e=this.__data__;if(Ur){var n=e[t];return n===Q_?void 0:n}return tb.call(e,t)?e[t]:void 0}d(kd,"hashGet");var nb=kd,rb=Object.prototype,ib=rb.hasOwnProperty;function Id(t){var e=this.__data__;return Ur?e[t]!==void 0:ib.call(e,t)}d(Id,"hashHas");var ob=Id,ab="__lodash_hash_undefined__";function Ad(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ur&&e===void 0?ab:e,this}d(Ad,"hashSet");var sb=Ad;function Rn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}d(Rn,"Hash");Rn.prototype.clear=Y_;Rn.prototype.delete=X_;Rn.prototype.get=nb;Rn.prototype.has=ob;Rn.prototype.set=sb;var Oc=Rn;function Cd(){this.__data__=[],this.size=0}d(Cd,"listCacheClear");var lb=Cd;function Od(t,e){for(var n=t.length;n--;)if(Oa(t[n][0],e))return n;return-1}d(Od,"assocIndexOf");var fo=Od,ub=Array.prototype,cb=ub.splice;function Rd(t){var e=this.__data__,n=fo(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():cb.call(e,n,1),--this.size,!0}d(Rd,"listCacheDelete");var fb=Rd;function Md(t){var e=this.__data__,n=fo(e,t);return n<0?void 0:e[n][1]}d(Md,"listCacheGet");var db=Md;function Nd(t){return fo(this.__data__,t)>-1}d(Nd,"listCacheHas");var pb=Nd;function Dd(t,e){var n=this.__data__,r=fo(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}d(Dd,"listCacheSet");var gb=Dd;function Mn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}d(Mn,"ListCache");Mn.prototype.clear=lb;Mn.prototype.delete=fb;Mn.prototype.get=db;Mn.prototype.has=pb;Mn.prototype.set=gb;var po=Mn,yb=On(qt,"Map"),$r=yb;function Hd(){this.size=0,this.__data__={hash:new Oc,map:new($r||po),string:new Oc}}d(Hd,"mapCacheClear");var mb=Hd;function Ud(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}d(Ud,"isKeyable");var hb=Ud;function $d(t,e){var n=t.__data__;return hb(e)?n[typeof e=="string"?"string":"hash"]:n.map}d($d,"getMapData");var go=$d;function Zd(t){var e=go(this,t).delete(t);return this.size-=e?1:0,e}d(Zd,"mapCacheDelete");var vb=Zd;function jd(t){return go(this,t).get(t)}d(jd,"mapCacheGet");var Tb=jd;function Kd(t){return go(this,t).has(t)}d(Kd,"mapCacheHas");var _b=Kd;function Ld(t,e){var n=go(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}d(Ld,"mapCacheSet");var bb=Ld;function Nn(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}d(Nn,"MapCache");Nn.prototype.clear=mb;Nn.prototype.delete=vb;Nn.prototype.get=Tb;Nn.prototype.has=_b;Nn.prototype.set=bb;var yo=Nn,wb="Expected a function";function mo(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(wb);var n=d(function(){var r=arguments,o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=t.apply(this,r);return n.cache=a.set(o,i)||a,i},"memoized");return n.cache=new(mo.Cache||yo),n}d(mo,"memoize");mo.Cache=yo;var xb=mo,Pb=500;function Fd(t){var e=xb(t,function(r){return n.size===Pb&&n.clear(),r}),n=e.cache;return e}d(Fd,"memoizeCapped");var Bb=Fd,Eb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sb=/\\(\\)?/g,kb=Bb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Eb,function(n,r,o,a){e.push(o?a.replace(Sb,"$1"):r||n)}),e}),Ib=kb;function Wd(t){return t==null?"":PT(t)}d(Wd,"toString");var Ab=Wd;function zd(t,e){return zt(t)?t:Na(t,e)?[t]:Ib(Ab(t))}d(zd,"castPath");var ho=zd,Cb=1/0;function qd(t){if(typeof t=="string"||Ia(t))return t;var e=t+"";return e=="0"&&1/t==-Cb?"-0":e}d(qd,"toKey");var zr=qd;function Gd(t,e){e=ho(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[zr(e[n++])];return n&&n==r?t:void 0}d(Gd,"baseGet");var Da=Gd;function Vd(t,e,n){var r=t==null?void 0:Da(t,e);return r===void 0?n:r}d(Vd,"get");var Ob=Vd;function Jd(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}d(Jd,"arrayPush");var Yd=Jd,Rb=Td(Object.getPrototypeOf,Object),Xd=Rb,Mb="[object Object]",Nb=Function.prototype,Db=Object.prototype,Qd=Nb.toString,Hb=Db.hasOwnProperty,Ub=Qd.call(Object);function ep(t){if(!kn(t)||An(t)!=Mb)return!1;var e=Xd(t);if(e===null)return!0;var n=Hb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Qd.call(n)==Ub}d(ep,"isPlainObject");var Rc=ep;function tp(){this.__data__=new po,this.size=0}d(tp,"stackClear");var $b=tp;function np(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}d(np,"stackDelete");var Zb=np;function rp(t){return this.__data__.get(t)}d(rp,"stackGet");var jb=rp;function ip(t){return this.__data__.has(t)}d(ip,"stackHas");var Kb=ip,Lb=200;function op(t,e){var n=this.__data__;if(n instanceof po){var r=n.__data__;if(!$r||r.length<Lb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new yo(r)}return n.set(t,e),this.size=n.size,this}d(op,"stackSet");var Fb=op;function Dn(t){var e=this.__data__=new po(t);this.size=e.size}d(Dn,"Stack");Dn.prototype.clear=$b;Dn.prototype.delete=Zb;Dn.prototype.get=jb;Dn.prototype.has=Kb;Dn.prototype.set=Fb;var vi=Dn;function ap(t,e){for(var n=-1,r=t==null?0:t.length,o=0,a=[];++n<r;){var i=t[n];e(i,n,t)&&(a[o++]=i)}return a}d(ap,"arrayFilter");var Wb=ap;function sp(){return[]}d(sp,"stubArray");var lp=sp,zb=Object.prototype,qb=zb.propertyIsEnumerable,Mc=Object.getOwnPropertySymbols,Gb=Mc?function(t){return t==null?[]:(t=Object(t),Wb(Mc(t),function(e){return qb.call(t,e)}))}:lp,up=Gb,Vb=Object.getOwnPropertySymbols,Jb=Vb?function(t){for(var e=[];t;)Yd(e,up(t)),t=Xd(t);return e}:lp,Yb=Jb;function cp(t,e,n){var r=e(t);return zt(t)?r:Yd(r,n(t))}d(cp,"baseGetAllKeys");var fp=cp;function dp(t){return fp(t,Ma,up)}d(dp,"getAllKeys");var Nc=dp;function pp(t){return fp(t,q_,Yb)}d(pp,"getAllKeysIn");var Xb=pp,Qb=On(qt,"DataView"),ha=Qb,ew=On(qt,"Promise"),va=ew,tw=On(qt,"Set"),Ta=tw,Dc="[object Map]",nw="[object Object]",Hc="[object Promise]",Uc="[object Set]",$c="[object WeakMap]",Zc="[object DataView]",rw=Cn(ha),iw=Cn($r),ow=Cn(va),aw=Cn(Ta),sw=Cn(ya),xn=An;(ha&&xn(new ha(new ArrayBuffer(1)))!=Zc||$r&&xn(new $r)!=Dc||va&&xn(va.resolve())!=Hc||Ta&&xn(new Ta)!=Uc||ya&&xn(new ya)!=$c)&&(xn=d(function(t){var e=An(t),n=e==nw?t.constructor:void 0,r=n?Cn(n):"";if(r)switch(r){case rw:return Zc;case iw:return Dc;case ow:return Hc;case aw:return Uc;case sw:return $c}return e},"getTag"));var jc=xn,lw=qt.Uint8Array,Kc=lw,uw="__lodash_hash_undefined__";function gp(t){return this.__data__.set(t,uw),this}d(gp,"setCacheAdd");var cw=gp;function yp(t){return this.__data__.has(t)}d(yp,"setCacheHas");var fw=yp;function Zr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new yo;++e<n;)this.add(t[e])}d(Zr,"SetCache");Zr.prototype.add=Zr.prototype.push=cw;Zr.prototype.has=fw;var dw=Zr;function mp(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}d(mp,"arraySome");var pw=mp;function hp(t,e){return t.has(e)}d(hp,"cacheHas");var gw=hp,yw=1,mw=2;function vp(t,e,n,r,o,a){var i=n&yw,s=t.length,l=e.length;if(s!=l&&!(i&&l>s))return!1;var f=a.get(t),p=a.get(e);if(f&&p)return f==e&&p==t;var y=-1,g=!0,h=n&mw?new dw:void 0;for(a.set(t,e),a.set(e,t);++y<s;){var v=t[y],P=e[y];if(r)var B=i?r(P,v,y,e,t,a):r(v,P,y,t,e,a);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!pw(e,function(T,S){if(!gw(h,S)&&(v===T||o(v,T,n,r,a)))return h.push(S)})){g=!1;break}}else if(!(v===P||o(v,P,n,r,a))){g=!1;break}}return a.delete(t),a.delete(e),g}d(vp,"equalArrays");var Tp=vp;function _p(t){var e=-1,n=Array(t.size);return t.forEach(function(r,o){n[++e]=[o,r]}),n}d(_p,"mapToArray");var hw=_p;function bp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}d(bp,"setToArray");var vw=bp,Tw=1,_w=2,bw="[object Boolean]",ww="[object Date]",xw="[object Error]",Pw="[object Map]",Bw="[object Number]",Ew="[object RegExp]",Sw="[object Set]",kw="[object String]",Iw="[object Symbol]",Aw="[object ArrayBuffer]",Cw="[object DataView]",Lc=un?un.prototype:void 0,la=Lc?Lc.valueOf:void 0;function wp(t,e,n,r,o,a,i){switch(n){case Cw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Aw:return!(t.byteLength!=e.byteLength||!a(new Kc(t),new Kc(e)));case bw:case ww:case Bw:return Oa(+t,+e);case xw:return t.name==e.name&&t.message==e.message;case Ew:case kw:return t==e+"";case Pw:var s=hw;case Sw:var l=r&Tw;if(s||(s=vw),t.size!=e.size&&!l)return!1;var f=i.get(t);if(f)return f==e;r|=_w,i.set(t,e);var p=Tp(s(t),s(e),r,o,a,i);return i.delete(t),p;case Iw:if(la)return la.call(t)==la.call(e)}return!1}d(wp,"equalByTag");var Ow=wp,Rw=1,Mw=Object.prototype,Nw=Mw.hasOwnProperty;function xp(t,e,n,r,o,a){var i=n&Rw,s=Nc(t),l=s.length,f=Nc(e),p=f.length;if(l!=p&&!i)return!1;for(var y=l;y--;){var g=s[y];if(!(i?g in e:Nw.call(e,g)))return!1}var h=a.get(t),v=a.get(e);if(h&&v)return h==e&&v==t;var P=!0;a.set(t,e),a.set(e,t);for(var B=i;++y<l;){g=s[y];var T=t[g],S=e[g];if(r)var E=i?r(S,T,g,e,t,a):r(T,S,g,t,e,a);if(!(E===void 0?T===S||o(T,S,n,r,a):E)){P=!1;break}B||(B=g=="constructor")}if(P&&!B){var H=t.constructor,j=e.constructor;H!=j&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof j=="function"&&j instanceof j)&&(P=!1)}return a.delete(t),a.delete(e),P}d(xp,"equalObjects");var Dw=xp,Hw=1,Fc="[object Arguments]",Wc="[object Array]",hi="[object Object]",Uw=Object.prototype,zc=Uw.hasOwnProperty;function Pp(t,e,n,r,o,a){var i=zt(t),s=zt(e),l=i?Wc:jc(t),f=s?Wc:jc(e);l=l==Fc?hi:l,f=f==Fc?hi:f;var p=l==hi,y=f==hi,g=l==f;if(g&&ma(t)){if(!ma(e))return!1;i=!0,p=!1}if(g&&!p)return a||(a=new vi),i||yd(t)?Tp(t,e,n,r,o,a):Ow(t,e,l,n,r,o,a);if(!(n&Hw)){var h=p&&zc.call(t,"__wrapped__"),v=y&&zc.call(e,"__wrapped__");if(h||v){var P=h?t.value():t,B=v?e.value():e;return a||(a=new vi),o(P,B,n,r,a)}}return g?(a||(a=new vi),Dw(t,e,n,r,o,a)):!1}d(Pp,"baseIsEqualDeep");var $w=Pp;function Ha(t,e,n,r,o){return t===e?!0:t==null||e==null||!kn(t)&&!kn(e)?t!==t&&e!==e:$w(t,e,n,r,Ha,o)}d(Ha,"baseIsEqual");var vo=Ha,Zw=1,jw=2;function Bp(t,e,n,r){var o=n.length,a=o,i=!r;if(t==null)return!a;for(t=Object(t);o--;){var s=n[o];if(i&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<a;){s=n[o];var l=s[0],f=t[l],p=s[1];if(i&&s[2]){if(f===void 0&&!(l in t))return!1}else{var y=new vi;if(r)var g=r(f,p,l,t,e,y);if(!(g===void 0?vo(p,f,Zw|jw,r,y):g))return!1}}return!0}d(Bp,"baseIsMatch");var Kw=Bp;function Ep(t){return t===t&&!Qn(t)}d(Ep,"isStrictComparable");var Sp=Ep;function kp(t){for(var e=Ma(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Sp(o)]}return e}d(kp,"getMatchData");var Lw=kp;function Ip(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}d(Ip,"matchesStrictComparable");var Ap=Ip;function Cp(t){var e=Lw(t);return e.length==1&&e[0][2]?Ap(e[0][0],e[0][1]):function(n){return n===t||Kw(n,t,e)}}d(Cp,"baseMatches");var Fw=Cp;function Op(t,e){return t!=null&&e in Object(t)}d(Op,"baseHasIn");var Ww=Op;function Rp(t,e,n){e=ho(e,t);for(var r=-1,o=e.length,a=!1;++r<o;){var i=zr(e[r]);if(!(a=t!=null&&n(t,i)))break;t=t[i]}return a||++r!=o?a:(o=t==null?0:t.length,!!o&&Ra(o)&&Ca(i,o)&&(zt(t)||ud(t)))}d(Rp,"hasPath");var zw=Rp;function Mp(t,e){return t!=null&&zw(t,e,Ww)}d(Mp,"hasIn");var qw=Mp,Gw=1,Vw=2;function Np(t,e){return Na(t)&&Sp(e)?Ap(zr(t),e):function(n){var r=Ob(n,t);return r===void 0&&r===e?qw(n,t):vo(e,r,Gw|Vw)}}d(Np,"baseMatchesProperty");var Jw=Np;function Dp(t){return function(e){return e?.[t]}}d(Dp,"baseProperty");var Yw=Dp;function Hp(t){return function(e){return Da(e,t)}}d(Hp,"basePropertyDeep");var Xw=Hp;function Up(t){return Na(t)?Yw(zr(t)):Xw(t)}d(Up,"property");var Qw=Up;function $p(t){return typeof t=="function"?t:t==null?BT:typeof t=="object"?zt(t)?Jw(t[0],t[1]):Fw(t):Qw(t)}d($p,"baseIteratee");var Ua=$p;function Zp(t){return function(e,n,r){for(var o=-1,a=Object(e),i=r(e),s=i.length;s--;){var l=i[t?s:++o];if(n(a[l],l,a)===!1)break}return e}}d(Zp,"createBaseFor");var ex=Zp,tx=ex(),nx=tx;function jp(t,e){return t&&nx(t,e,Ma)}d(jp,"baseForOwn");var rx=jp;function Kp(t,e){return vo(t,e)}d(Kp,"isEqual");var Xn=Kp;function Lp(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?vo(t,e,void 0,n):!!r}d(Lp,"isEqualWith");var ix=Lp;function Fp(t){return t===void 0}d(Fp,"isUndefined");var qc=Fp;function Wp(t,e){var n={};return e=Ua(e,3),rx(t,function(r,o,a){Xf(n,o,e(r,o,a))}),n}d(Wp,"mapValues");var ox=Wp,ax="Expected a function";function zp(t){if(typeof t!="function")throw new TypeError(ax);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}d(zp,"negate");var sx=zp;function qp(t,e,n,r){if(!Qn(t))return t;e=ho(e,t);for(var o=-1,a=e.length,i=a-1,s=t;s!=null&&++o<a;){var l=zr(e[o]),f=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(o!=i){var p=s[l];f=r?r(p,l,s):void 0,f===void 0&&(f=Qn(p)?p:Ca(e[o+1])?[]:{})}VT(s,l,f),s=s[l]}return t}d(qp,"baseSet");var lx=qp;function Gp(t,e,n){for(var r=-1,o=e.length,a={};++r<o;){var i=e[r],s=Da(t,i);n(s,i)&&lx(a,ho(i,t),s)}return a}d(Gp,"basePickBy");var ux=Gp;function Vp(t,e){if(t==null)return{};var n=Zf(Xb(t),function(r){return[r]});return e=Ua(e),ux(t,n,function(r,o){return e(r,o[0])})}d(Vp,"pickBy");var cx=Vp;function Jp(t,e){return cx(t,sx(Ua(e)))}d(Jp,"omitBy");var Gc=Jp,fx=d(t=>{let e=t.checks;return e.length===0?"":e.map(dx).join("")},"generateStringChecks"),dx=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"length":return`.length(${se(t.value)}, ${se(t.message)})`;case"email":return`.email(${se(t.message)})`;case"url":return`.url(${se(t.message)})`;case"emoji":return`.emoji(${se(t.message)})`;case"uuid":return`.uuid(${se(t.message)})`;case"cuid":return`.cuid(${se(t.message)})`;case"cuid2":return`.cuid2(${se(t.message)})`;case"ulid":return`.ulid(${se(t.message)})`;case"includes":let e=Yn({message:t.message,position:t.position});return`.includes(${se(t.value)}, ${e})`;case"startsWith":return`.startsWith(${se(t.value)}, ${se(t.message)})`;case"endsWith":return`.endsWith(${se(t.value)}, ${se(t.message)})`;case"regex":return`.regex(${String(t.regex)}, ${se(t.message)})`;case"trim":return".trim()";case"toLowerCase":return".toLowerCase()";case"toUpperCase":return".toUpperCase()";case"datetime":let r=t.precision===null?void 0:t.precision;return`.datetime(${Yn({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${Yn({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),px=d(t=>{let e=t.checks;return e.length===0?"":e.map(gx).join("")},"generateNumberChecks"),gx=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"int":return`.int(${se(t.message)})`;case"multipleOf":return`.multipleOf(${se(t.value)}, ${se(t.message)})`;case"finite":return`.finite(${se(t.message)})`;default:return""}},"_generateNumberCheck"),yx=d(t=>{let e=t.checks;return e.length===0?"":e.map(mx).join("")},"generateBigIntChecks"),mx=d(t=>{switch(t.kind){case"min":return`.min(${se(t.value)}, ${se(t.message)})`;case"max":return`.max(${se(t.value)}, ${se(t.message)})`;case"multipleOf":return`.multipleOf(${se(t.value)}, ${se(t.message)})`;default:return""}},"_generateBigIntCheck"),hx=d(t=>{let e=t.checks;return e.length===0?"":e.map(vx).join("")},"generateDateChecks"),vx=d(t=>{switch(t.kind){case"min":return`.min(${Vc(t.value)}, ${se(t.message)})`;case"max":return`.max(${Vc(t.value)}, ${se(t.message)})`;default:return""}},"_generateDateCheck"),Vc=d(t=>`new Date(${t})`,"dateTs"),Tx=d(t=>{let e=[];if(t.exactLength){let{value:n,message:r}=t.exactLength;e.push(`.length(${se(n)}, ${se(r)})`)}if(t.minLength){let{value:n,message:r}=t.minLength;e.push(`.min(${se(n)}, ${se(r)})`)}if(t.maxLength){let{value:n,message:r}=t.maxLength;e.push(`.max(${se(n)}, ${se(r)})`)}return e.join("")},"generateArrayChecks"),_x=d(t=>{let e=[];if(t.minSize){let{value:n,message:r}=t.minSize;e.push(`.min(${se(n)}, ${se(r)})`)}if(t.maxSize){let{value:n,message:r}=t.maxSize;e.push(`.max(${se(n)}, ${se(r)})`)}return e.join("")},"generateSetChecks");function $a(t){return Fe(t)}d($a,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case R.ZodFirstPartyTypeKind.ZodString:return`z.string()${fx(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${px(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${yx(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case R.ZodFirstPartyTypeKind.ZodDate:return`z.date()${hx(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${Tx(n)}${Ce(n)}${Ae(n)}`;case R.ZodFirstPartyTypeKind.ZodObject:let r=ox(n.shape(),Fe),o=t.additionalProperties(),a=o?`.catchall(${Fe(o)})`:"";return["z.object({",...Object.entries(r).map(([ee,ge])=>` ${ee}: ${ge},`),`})${a}${Ce(n)}${Ae(n)}`].join(`
|
|
28
|
+
`).trim();case R.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let s=n.options.map(Fe);return`z.discriminatedUnion(${se(n.discriminator)}, [${s.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodIntersection:let f=Fe(n.left),p=Fe(n.right);return`z.intersection(${f}, ${p})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodMap:let v=Fe(n.keyType),P=Fe(n.valueType);return`z.map(${v}, ${P})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${_x(n)}${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),T=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${T}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${se(n.value)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(se).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodEffects:throw new wn(R.ZodFirstPartyTypeKind.ZodEffects);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new wn(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodDefault:let j=Yn(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${j})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodCatch:throw new wn(R.ZodFirstPartyTypeKind.ZodCatch);case R.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodBranded:throw new wn(R.ZodFirstPartyTypeKind.ZodBranded);case R.ZodFirstPartyTypeKind.ZodPipeline:throw new wn(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodSymbol:throw new wn(R.ZodFirstPartyTypeKind.ZodSymbol);case R.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case R.ZodFirstPartyTypeKind.ZodRef:return`z.ref(${se(n.uri)})${Ce(n)}${Ae(n)}`.trim();default:be.assertNever(n)}}d(Fe,"sUnwrapZod");var Ae=d(t=>t.description?`.describe(${se(t.description)})`:"","_maybeDescribe"),Ce=d(t=>`${bx(t)}${wx(t)}${xx(t)}${Px(t)}${Bx(t)}${Ex(t)}${Sx(t)}`,"_addZuiExtensions"),bx=d(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${se(t[le].title)})`:""},"_maybeTitle"),wx=d(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${af({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),xx=d(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),Px=d(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),Bx=d(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${se(t[le].placeholder)})`:""},"_maybePlaceholder"),Ex=d(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),Sx=d(t=>{var e;let n=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],r=Object.entries((e=t[le])!=null?e:{}).filter(([o])=>!n.includes(o));return r.length>0?`.metadata(${af(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),kx=d(t=>{let e={type:"number",description:t.description,"x-zui":t._def["x-zui"]};t._def[le]&&(e[le]=t._def[le]);for(let n of t._def.checks)switch(n.kind){case"min":{let r=n.inclusive?"minimum":"exclusiveMinimum",o=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[o];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",o=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[o];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),Yp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",Xp="(([+-]\\d{2}(:?\\d{2})?)|Z)",Ix="Z",Qp="(\\.\\d+)?",_a="\\.\\d{",Ax="}",eg=d(t=>{let e=t.precision?_a+t.precision+Ax:t.precision===0?"":Qp,n=t.offset?Xp:Ix;return new RegExp(`^${Yp}${e}${n}$`)},"generateDatetimeRegex"),Cx=d(t=>({precision:Ox(t),offset:t.endsWith(`${Xp}$`)}),"extractPrecisionAndOffset"),Ox=d(t=>{let e=t.slice(1+Yp.length);return e.startsWith(Qp)?null:e.startsWith(_a)?parseInt(e.slice(_a.length)):0},"_extractPrecision"),Dr={};so(Dr,{escapeSpecialChars:()=>Rx});var Rx=d(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Za(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(b({},t.errorMessage),{[e]:n}))}d(Za,"addErrorMessage");function Re(t,e,n,r,o){t[e]=n,Za(t,e,r,o)}d(Re,"setResponseValueAndErrors");var Xe={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"};function ja(t,e){let n=b({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(o){return e.patternStrategy==="escape"?Dr.escapeSpecialChars(o):o}if(d(r,"processPattern"),t.checks)for(let o of t.checks)switch(o.kind){case"min":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e);break;case"max":Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":bn(n,"email",o.message,e);break;case"format:idn-email":bn(n,"idn-email",o.message,e);break;case"pattern:zod":Lt(n,Xe.email,o.message,e);break}break;case"url":bn(n,"uri",o.message,e);break;case"uuid":bn(n,"uuid",o.message,e);break;case"regex":Lt(n,o.regex.source,o.message,e);break;case"cuid":Lt(n,Xe.cuid,o.message,e);break;case"cuid2":Lt(n,Xe.cuid2,o.message,e);break;case"startsWith":Lt(n,"^"+r(o.value),o.message,e);break;case"endsWith":Lt(n,r(o.value)+"$",o.message,e);break;case"datetime":bn(n,"date-time",o.message,e);break;case"length":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,o.value):o.value,o.message,e),Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,o.value):o.value,o.message,e);break;case"includes":{Lt(n,r(o.value),o.message,e);break}case"ip":{o.version!=="v6"&&bn(n,"ipv4",o.message,e),o.version!=="v4"&&bn(n,"ipv6",o.message,e);break}case"emoji":Lt(n,Xe.emoji,o.message,e);break;case"ulid":{Lt(n,Xe.ulid,o.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}d(ja,"parseStringDef");var bn=d((t,e,n,r)=>{var o;t.format||(o=t.anyOf)!=null&&o.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push(b({format:t.format},t.errorMessage&&r.errorMessages&&{errorMessage:{format:t.errorMessage.format}})),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push(b({format:e},n&&r.errorMessages&&{errorMessage:{format:n}}))):Re(t,"format",e,n,r)},"addFormat"),Lt=d((t,e,n,r)=>{var o;t.pattern||(o=t.allOf)!=null&&o.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push(b({pattern:t.pattern},t.errorMessage&&r.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}})),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push(b({pattern:e},n&&r.errorMessages&&{errorMessage:{pattern:n}}))):Re(t,"pattern",e,n,r)},"addPattern"),Mx=d(t=>{let e={type:"string",description:t.description,"x-zui":t._def["x-zui"]};t._def[le]&&(e[le]=t._def[le]);for(let n of t._def.checks)switch(n.kind){case"cuid":e.format="cuid",e.pattern=Xe.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Xe.cuid2;break;case"ulid":e.format="ulid",e.pattern=Xe.ulid;break;case"uuid":e.format="uuid",e.pattern=Xe.uuid;break;case"emoji":e.format="emoji",e.pattern=Xe.emoji;break;case"email":e.format="email",e.pattern=Xe.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Xe.ipv6:Xe.ipv4;break;case"datetime":e.format="date-time",e.pattern=eg(n).source,e[le]=N(b({},e[le]),{precision:n.precision,offset:n.offset});break;case"url":e.format="uri";break;case"endsWith":e.pattern=`${Dr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Dr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Dr.escapeSpecialChars(n.value)}`;break;case"regex":e.pattern=n.regex.source;break;case"length":e.minLength=e.maxLength=Math.max(0,n.value);break;case"min":e.minLength=Math.max(0,n.value);break;case"max":e.maxLength=Math.max(0,n.value);break;default:throw new mf({zodType:R.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),Nx=d((t,e)=>{let n={type:"array",description:t.description,items:e(t._def.type),"x-zui":t._def["x-zui"]};return t._def[le]&&(n[le]=t._def[le]),t._def.minLength&&(n.minItems=t._def.minLength.value),t._def.maxLength&&(n.maxItems=t._def.maxLength.value),t._def.exactLength&&(n.minItems=t._def.exactLength.value,n.maxItems=t._def.exactLength.value),n},"zodArrayToJsonArray"),Dx=d((t,e)=>{let n={type:"array",description:t.description,uniqueItems:!0,items:e(t._def.valueType),"x-zui":t._def["x-zui"]};return t._def[le]&&(n[le]=t._def[le]),t._def.minSize&&(n.minItems=t._def.minSize.value),t._def.maxSize&&(n.maxItems=t._def.maxSize.value),n},"zodSetToJsonSet"),Hx=d((t,e)=>{let n={type:"array",description:t.description,items:t._def.items.map(r=>e(r))};return t._def[le]&&(n[le]=t._def[le]),t._def.rest&&(n.additionalItems=e(t._def.rest)),n},"zodTupleToJsonTuple");function st(t){let e=t,n=e._def;switch(n.typeName){case R.ZodFirstPartyTypeKind.ZodString:return Mx(e);case R.ZodFirstPartyTypeKind.ZodNumber:return kx(e);case R.ZodFirstPartyTypeKind.ZodNaN:throw new pt(R.ZodFirstPartyTypeKind.ZodNaN);case R.ZodFirstPartyTypeKind.ZodBigInt:throw new pt(R.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case R.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodDate:throw new pt(R.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case R.ZodFirstPartyTypeKind.ZodUndefined:return ua(n);case R.ZodFirstPartyTypeKind.ZodNull:return ca(n);case R.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(b({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodUnknown}})};case R.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodVoid:throw new pt(R.ZodFirstPartyTypeKind.ZodVoid);case R.ZodFirstPartyTypeKind.ZodArray:return Nx(e,st);case R.ZodFirstPartyTypeKind.ZodObject:let r=Object.entries(n.shape()),o=r.filter(([p,y])=>!y.isOptional()),a=o.length?o.map(([p])=>p):void 0,i=r.map(([p,y])=>[p,y.mandatory()]).map(([p,y])=>[p,st(y)]),s=!1;return n.unknownKeys instanceof R.ZodType?s=st(n.unknownKeys):n.unknownKeys==="passthrough"&&(s=!0),{type:"object",description:n.description,properties:Object.fromEntries(i),required:a,additionalProperties:s,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodIntersection:let l=st(n.left),f=st(n.right);return"additionalProperties"in l&&delete l.additionalProperties,"additionalProperties"in f&&delete f.additionalProperties,{description:n.description,allOf:[l,f],"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodTuple:return Hx(e,st);case R.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:st(n.valueType),"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodMap:throw new pt(R.ZodFirstPartyTypeKind.ZodMap);case R.ZodFirstPartyTypeKind.ZodSet:return Dx(e,st);case R.ZodFirstPartyTypeKind.ZodFunction:throw new pt(R.ZodFirstPartyTypeKind.ZodFunction);case R.ZodFirstPartyTypeKind.ZodLazy:throw new pt(R.ZodFirstPartyTypeKind.ZodLazy);case R.ZodFirstPartyTypeKind.ZodLiteral:if(typeof n.value=="string")return{type:"string",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(typeof n.value=="number")return{type:"number",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(typeof n.value=="boolean")return{type:"boolean",description:n.description,const:n.value,"x-zui":n["x-zui"]};if(n.value===null)return ca(n);if(n.value===void 0)return ua(n);{R.util.assertEqual(!0);let p=typeof n.value;throw new uo(`Unsupported literal type: "${p}"`)}case R.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case R.ZodFirstPartyTypeKind.ZodEffects:throw new pt(R.ZodFirstPartyTypeKind.ZodEffects);case R.ZodFirstPartyTypeKind.ZodNativeEnum:throw new pt(R.ZodFirstPartyTypeKind.ZodNativeEnum);case R.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[st(n.innerType),ua()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodOptional}})};case R.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[st(n.innerType),ca()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodNullable}})};case R.ZodFirstPartyTypeKind.ZodDefault:return N(b({},st(n.innerType)),{default:n.defaultValue()});case R.ZodFirstPartyTypeKind.ZodCatch:throw new pt(R.ZodFirstPartyTypeKind.ZodCatch);case R.ZodFirstPartyTypeKind.ZodPromise:throw new pt(R.ZodFirstPartyTypeKind.ZodPromise);case R.ZodFirstPartyTypeKind.ZodBranded:throw new pt(R.ZodFirstPartyTypeKind.ZodBranded);case R.ZodFirstPartyTypeKind.ZodPipeline:throw new pt(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodSymbol:throw new pt(R.ZodFirstPartyTypeKind.ZodPipeline);case R.ZodFirstPartyTypeKind.ZodReadonly:return N(b({},st(n.innerType)),{readOnly:!0});case R.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:R.util.assertNever(n)}}d(st,"toJSONSchema");var ua=d(t=>({not:!0,description:t?.description,"x-zui":N(b({},t?.["x-zui"]),{def:{typeName:R.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),ca=d(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),tg=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};d(tg,"ParseInputLazyPath");var Ot=tg,Jc=d((t,e)=>{if(Kr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Wt(t.common.issues);return this._error=n,this._error}}},"handleResult"),ng=class{constructor(e){this.__type__="ZuiType",this.spa=this.safeParseAsync,this._def=e,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)}get description(){return this._metadataRoot._def.description}dereference(e){return this}getReferences(){return[]}clone(){let e=this.constructor;return new e(b({},this._def))}_getType(e){return sn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:sn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Tt,ctx:{common:e.parent.common,data:e.data,parsedType:sn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Ii(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;let o={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sn(e)},a=this._parseSync({data:e,path:o.path,parent:o});return Jc(o,a)}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sn(e)},o=this._parse({data:e,path:r.path,parent:r}),a=await(Ii(o)?o:Promise.resolve(o));return Jc(r,a)}refine(e,n){let r=d(o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n,"getIssueProperties");return this._refinement((o,a)=>{let i=e(o),s=d(()=>a.addIssue(b({code:V.custom},r(o))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new In({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ln.create(this,this._def)}nullable(){return er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fr.create(this,this._def)}promise(){return bo.create(this,this._def)}mandatory(){return this}or(e){return ns.create([this,e],this._def)}and(e){return Va.create(this,e,this._def)}transform(e){return new In(N(b({},me(this._def)),{schema:this,typeName:"ZodEffects",effect:{type:"transform",transform:e}}))}default(e){let n=typeof e=="function"?e:()=>e;return new To(N(b({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Wa(b({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new za(N(b({},me(this._def)),{innerType:this,catchValue:n,typeName:"ZodCatch"}))}describe(e){let n=this.clone();return n._metadataRoot._def.description=e,n}pipe(e){return ts.create(this,e)}readonly(){return wo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,o;let a=this.clone(),i=a._metadataRoot;(o=(n=i._def)[r=le])!=null||(n[r]={});for(let[s,l]of Object.entries(e))i._def[le]=N(b({},i._def[le]),{[s]:l});return a}getMetadata(){return b({},this._metadataRoot._def[le])}setMetadata(e){this._metadataRoot._def[le]=b({},e)}get ui(){return b({},this._metadataRoot._def[le])}get _metadataRoot(){return this.naked()}displayAs(e){return this.metadata({displayAs:[e.id,e.params]})}title(e){return this.metadata({title:e})}hidden(e){let n;return e===void 0?n=!0:typeof e=="function"?n=e.toString():n=e,this.metadata({hidden:n})}disabled(e){let n;return e===void 0?n=!0:typeof e=="function"?n=e.toString():n=e,this.metadata({disabled:n})}placeholder(e){return this.metadata({placeholder:e})}toJSONSchema(){return st(this)}toTypescriptType(e){return ka(this,e)}toTypescriptSchema(){return $a(this)}naked(){return this}};d(ng,"ZodType");var he=ng,rg=(t=>(t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodRef="ZodRef",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly",t))(rg||{}),be;(t=>{t.assertEqual=d(o=>o,"assertEqual");function e(o){}t.assertIs=e,d(e,"assertIs");function n(o){throw new Error("assertNever called")}t.assertNever=n,d(n,"assertNever"),t.arrayToEnum=d(o=>{let a={};for(let i of o)a[i]=i;return a},"arrayToEnum"),t.getValidEnumValues=d(o=>{let a=(0,t.objectKeys)(o).filter(s=>typeof o[o[s]]!="number"),i={};for(let s of a)i[s]=o[s];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=d(o=>(0,t.objectKeys)(o).map(function(a){return o[a]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&a.push(i);return a},t.find=d((o,a)=>{for(let i of o)if(a(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,a=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,d(r,"joinValues"),t.jsonStringifyReplacer=d((o,a)=>typeof a=="bigint"?a.toString():a,"jsonStringifyReplacer"),t.compareFunctions=d((o,a)=>o.toString()===a.toString(),"compareFunctions"),t.mock=d(()=>({}),"mock")})(be||(be={}));var ba;(t=>{t.mergeShapes=d((e,n)=>b(b({},e),n),"mergeShapes")})(ba||(ba={}));var ne=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sn=d(t=>{switch(typeof t){case"undefined":return ne.undefined;case"string":return ne.string;case"number":return isNaN(t)?ne.nan:ne.number;case"boolean":return ne.boolean;case"function":return ne.function;case"bigint":return ne.bigint;case"symbol":return ne.symbol;case"object":return Array.isArray(t)?ne.array:t===null?ne.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ne.promise:typeof Map<"u"&&t instanceof Map?ne.map:typeof Set<"u"&&t instanceof Set?ne.set:typeof Date<"u"&&t instanceof Date?ne.date:ne.object;default:return ne.unknown}},"getParsedType");function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o,supportsExtensions:a,[le]:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);let s=i?Object.fromEntries(Object.entries(i).filter(([f])=>f!=="secret"||a?.includes("secret"))):void 0;return e?{errorMap:e,description:o,[le]:s}:{errorMap:d((f,p)=>f.code!=="invalid_type"?{message:p.defaultError}:typeof p.data>"u"?{message:r??p.defaultError}:{message:n??p.defaultError},"customMap"),description:o,[le]:s}}d(me,"processCreateParams");var Ka=d((t,e)=>{let n;switch(t.code){case V.invalid_type:t.received===ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:be.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case V.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case V.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;case V.unresolved_reference:n="Unresolved reference";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},"errorMap"),Yc=Ka,V=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","unresolved_reference"]),Ux=d(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Si=class ig extends Error{constructor(e){super(),this.issues=[],this.addIssue=d(r=>{this.issues=[...this.issues,r]},"addIssue"),this.addIssues=d((r=[])=>{this.issues=[...this.issues,...r]},"addIssues");let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let n=e||function(a){return a.message},r={_errors:[]},o=d(a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let s=r,l=0;for(;l<i.path.length;){let f=i.path[l];l===i.path.length-1?(s[f]=s[f]||{_errors:[]},s[f]._errors.push(n(i))):s[f]=s[f]||{_errors:[]},s=s[f],l++}}},"processError");return o(this),r}static assert(e){if(!(e instanceof ig))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};d(Si,"ZodError");Si.create=d(t=>new Si(t),"create");var Wt=Si,og=Ka;function ag(t){og=t}d(ag,"setErrorMap");function jr(){return og}d(jr,"getErrorMap");var ki=d(t=>{var e;let{data:n,path:r,errorMaps:o,issueData:a}=t,i=[...r,...a.path||[]],s=N(b({},a),{path:i}),l="",f=o.filter(p=>!!p).slice().reverse();for(let p of f)l=p(s,{data:n,defaultError:l}).message;return N(b({},a),{path:i,message:(e=a.message)!=null?e:l})},"makeIssue"),$x=[];function te(t,e){let n=ki({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jr(),Ka].filter(r=>!!r)});t.common.issues.push(n)}d(te,"addIssueToContext");var sg=class lg{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return pe;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n)r.push({key:await o.key,value:await o.value});return lg.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:a,value:i}=o;if(a.status==="aborted"||i.status==="aborted")return pe;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}};d(sg,"ParseStatus");var Tt=sg,pe=Object.freeze({status:"aborted"}),Jn=d(t=>({status:"dirty",value:t}),"DIRTY"),gt=d(t=>({status:"valid",value:t}),"OK"),wa=d(t=>t.status==="aborted","isAborted"),xa=d(t=>t.status==="dirty","isDirty"),Kr=d(t=>t.status==="valid","isValid"),Ii=d(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),ue;(t=>{t.errToObj=d(e=>typeof e=="string"?{message:e}:e||{},"errToObj"),t.toString=d(e=>typeof e=="string"?e:e?.message,"toString")})(ue||(ue={}));var Ai=class ug extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof ug}};d(Ai,"ZodAny");Ai.create=d(t=>new Ai(b({typeName:"ZodAny"},me(t))),"create");var Lr=Ai,Ci=class Pn extends he{dereference(e){return new Pn(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pn(N(b({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,o,a,i,s;return e instanceof Pn?Xn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&Xn((o=this._def.maxLength)==null?void 0:o.value,(a=e._def.maxLength)==null?void 0:a.value)&&Xn((i=this._def.minLength)==null?void 0:i.value,(s=e._def.minLength)==null?void 0:s.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==ne.array)return te(n,{code:V.invalid_type,expected:ne.array,received:n.parsedType}),pe;if(o.exactLength!==null){let i=n.data.length>o.exactLength.value,s=n.data.length<o.exactLength.value;(i||s)&&(te(n,{code:i?V.too_big:V.too_small,minimum:s?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(te(n,{code:V.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(te(n,{code:V.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,s)=>o.type._parseAsync(new Ot(n,i,n.path,s)))).then(i=>Tt.mergeArray(r,i));let a=[...n.data].map((i,s)=>o.type._parseSync(new Ot(n,i,n.path,s)));return Tt.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new Pn(N(b({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new Pn(N(b({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new Pn(N(b({},this._def),{exactLength:{value:e,message:ue.toString(n)}}))}nonempty(e){return this.min(1,e)}};d(Ci,"ZodArray");Ci.create=d((t,e)=>new Ci(b({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Fr=Ci,Zx=d((t,e)=>cg(t,e,new WeakSet),"isEqual"),cg=d((t,e,n)=>ix(t,e,jx(n)),"_isEqualWithVisitedTracking"),jx=d(t=>(e,n)=>{if(Rc(e)&&!t.has(e)&&Rc(n)&&!t.has(n)){let r=Gc(e,qc),o=Gc(n,qc);return t.add(r).add(o).add(e).add(n),cg(r,o,t)}},"_customizerWithVisitedTracking"),Kx={compare:Zx},fg=class{constructor(e=[],n={}){this._options=b(b({},Kx),n),this._items=[];for(let r of e)this.add(r)}get items(){return[...this._items]}get size(){return this._items.length}has(e){return this._items.some(n=>this._options.compare(n,e))}add(e){this.has(e)||this._items.push(e)}isEqual(e){return this.size!==e.size?!1:this.isSubsetOf(e)&&e.isSubsetOf(this)}isSubsetOf(e){return this.size>e.size?!1:this._items.every(n=>e.has(n))}};d(fg,"CustomSet");var et=fg,Oi=class Ti extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ne.bigint){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_type,expected:ne.bigint,received:a.parsedType}),pe}let r,o=new Tt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):be.assertNever(a);return{status:o.value,value:e.data}}isEqual(e){if(!(e instanceof Ti)||this._def.coerce!==e._def.coerce)return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}gte(e,n){return this.setLimit("min",e,!0,ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ue.toString(n))}setLimit(e,n,r,o){return new Ti(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new Ti(N(b({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ue.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};d(Oi,"ZodBigInt");Oi.create=d(t=>{var e;return new Oi(b({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var La=Oi,Ri=class dg extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ne.boolean){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.boolean,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof dg?this._def.coerce===e._def.coerce:!1}};d(Ri,"ZodBoolean");Ri.create=d(t=>new Ri(b({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var Fa=Ri,Lx=Symbol("zod_brand"),pg=class wr extends he{dereference(e){return new wr(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new wr(N(b({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}isEqual(e){return e instanceof wr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new wr(N(b({},this._def),{type:this._def.type.mandatory()}))}};d(pg,"ZodBranded");var Wa=pg,Mi=class xr extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(b({},n),{common:N(b({},n.common),{issues:[]})}),o=this._def.innerType._parse({data:r.data,path:r.path,parent:b({},r)});return Ii(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Wt(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof xr?this._def.innerType.isEqual(e._def.innerType)&&be.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new xr(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new xr(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Mi,"ZodCatch");Mi.create=d((t,e)=>new Mi(b({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var za=Mi,gg=d((t,e={},n)=>t?Lr.create().superRefine((r,o)=>{var a,i;if(!t(r)){let s=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(i=(a=s.fatal)!=null?a:n)!=null?i:!0,f=typeof s=="string"?{message:s}:s;o.addIssue(N(b({code:"custom"},f),{fatal:l}))}}):Lr.create(),"custom"),Ni=class Pa extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_type,expected:ne.date,received:a.parsedType}),pe}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_date}),pe}let r=new Tt,o;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:V.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:V.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):be.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pa(N(b({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ue.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ue.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}isEqual(e){if(!(e instanceof Pa))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)&&this._def.coerce===e._def.coerce}};d(Ni,"ZodDate");Ni.create=d(t=>new Ni(b({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var qa=Ni,Di=class Pr extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===ne.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}dereference(e){return new Pr(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Pr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}isEqual(e){return e instanceof Pr?this._def.innerType.isEqual(e._def.innerType)&&Xn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Pr(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Di,"ZodDefault");Di.create=d((t,e,n)=>new Di(b({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var To=Di,Gt=d(t=>Array.from(new Set(t)),"unique"),Ft=d(t=>t instanceof Ja?Ft(t.schema):t instanceof In?Ft(t.innerType()):t instanceof Ya?[t.value]:t instanceof or?t.options:t instanceof Xa?be.objectValues(t.enum):t instanceof To?Ft(t._def.innerType):t instanceof xo?[void 0]:t instanceof Qa?[null]:t instanceof ln?[void 0,...Ft(t.unwrap())]:t instanceof er?[null,...Ft(t.unwrap())]:t instanceof Wa||t instanceof wo?Ft(t.unwrap()):t instanceof za?Ft(t._def.innerType):[],"getDiscriminator"),yg=class Bn extends he{dereference(e){let n=this.options.map(o=>o.dereference(e)),r=Bn._getOptionsMap(this.discriminator,n);return new Bn(N(b({},this._def),{options:n,optionsMap:r}))}getReferences(){return Gt(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new Bn(N(b({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.object)return te(n,{code:V.invalid_type,expected:ne.object,received:n.parsedType}),pe;let r=this.discriminator,o=n.data[r],a=this.optionsMap.get(o);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=Bn._getOptionsMap(e,n);return new Bn(b({typeName:"ZodDiscriminatedUnion",discriminator:e,options:n,optionsMap:o},me(r)))}static _getOptionsMap(e,n){let r=new Map;for(let o of n){let a=Ft(o.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of a){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,o)}}return r}isEqual(e){if(!(e instanceof Bn)||this._def.discriminator!==e._def.discriminator)return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et(this._def.options,{compare:n}),o=new et(e._def.options,{compare:n});return r.isEqual(o)}};d(yg,"ZodDiscriminatedUnion");var mg=yg;function _o(t,e){return new or(b({values:t,typeName:"ZodEnum"},me(e)))}d(_o,"createZodEnum");var Ga=class _i extends he{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{expected:be.joinValues(r),received:n.parsedType,code:V.invalid_type}),pe}if(this._def.values.indexOf(e.data)===-1){let n=this._getOrReturnCtx(e),r=this._def.values;return te(n,{received:n.data,code:V.invalid_enum_value,options:r}),pe}return gt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return _i.create(e,b(b({},this._def),n))}exclude(e,n=this._def){return _i.create(this.options.filter(r=>!e.includes(r)),b(b({},this._def),n))}isEqual(e){if(!(e instanceof _i))return!1;let n=new et(this._def.values),r=new et(e._def.values);return n.isEqual(r)}};d(Ga,"ZodEnum");Ga.create=_o;var or=Ga,hg=class En extends he{constructor(){super(...arguments),this.validate=this.implement}dereference(e){let n=this._def.args.dereference(e),r=this._def.returns.dereference(e);return new En(N(b({},this._def),{args:n,returns:r}))}getReferences(){return Gt([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new En(N(b({},this._def),{args:this._def.args.clone(),returns:this._def.returns.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.function)return te(n,{code:V.invalid_type,expected:ne.function,received:n.parsedType}),pe;function r(s,l){return ki({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,jr(),Yc].filter(f=>!!f),issueData:{code:V.invalid_arguments,argumentsError:l}})}d(r,"makeArgsIssue");function o(s,l){return ki({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,jr(),Yc].filter(f=>!!f),issueData:{code:V.invalid_return_type,returnTypeError:l}})}d(o,"makeReturnsIssue");let a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof bo){let s=this;return gt(async function(...l){let f=new Wt([]),p=await s._def.args.parseAsync(l,a).catch(h=>{throw f.addIssue(r(l,h)),f}),y=await Reflect.apply(i,this,p);return await s._def.returns._def.type.parseAsync(y,a).catch(h=>{throw f.addIssue(o(y,h)),f})})}else{let s=this;return gt(function(...l){let f=s._def.args.safeParse(l,a);if(!f.success)throw new Wt([r(l,f.error)]);let p=Reflect.apply(i,this,f.data),y=s._def.returns.safeParse(p,a);if(!y.success)throw new Wt([o(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new En(N(b({},this._def),{args:rr.create(e).rest(Hr.create())}))}returns(e){return new En(N(b({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new En(b({args:e||rr.create([]).rest(Hr.create()),returns:n||Hr.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof En&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};d(hg,"ZodFunction");var vg=hg;function Hi(t,e){let n=sn(t),r=sn(e);if(t===e)return{valid:!0,data:t};if(n===ne.object&&r===ne.object){let o=be.objectKeys(e),a=be.objectKeys(t).filter(s=>o.indexOf(s)!==-1),i=b(b({},t),e);for(let s of a){let l=Hi(t[s],e[s]);if(!l.valid)return{valid:!1};i[s]=l.data}return{valid:!0,data:i}}else if(n===ne.array&&r===ne.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let a=0;a<t.length;a++){let i=t[a],s=e[a],l=Hi(i,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===ne.date&&r===ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}d(Hi,"mergeValues");var Ui=class bi extends he{dereference(e){return new bi(N(b({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Gt([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new bi(N(b({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=d((a,i)=>{if(wa(a)||wa(i))return pe;let s=Hi(a.value,i.value);return s.valid?((xa(a)||xa(i))&&n.dirty(),{status:n.value,value:s.data}):(te(r,{code:V.invalid_intersection_types}),pe)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>o(a,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}isEqual(e){if(!(e instanceof bi))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et([this._def.left,this._def.right],{compare:n}),o=new et([e._def.left,e._def.right],{compare:n});return r.isEqual(o)}};d(Ui,"ZodIntersection");Ui.create=d((t,e,n)=>new Ui(b({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var Va=Ui,$i=class Br extends he{get schema(){return this._def.getter()}dereference(e){return new Br(N(b({},this._def),{getter:d(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Br(N(b({},this._def),{getter:d(()=>this._def.getter().clone(),"getter")}))}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}isEqual(e){return e instanceof Br?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Br(N(b({},this._def),{getter:d(()=>this._def.getter().mandatory(),"getter")}))}};d($i,"ZodLazy");$i.create=d((t,e)=>new $i(b({getter:t,typeName:"ZodLazy"},me(e))),"create");var Ja=$i,Zi=class Tg extends he{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof Tg?Xn(this._def.value,e._def.value):!1}};d(Zi,"ZodLiteral");Zi.create=d((t,e)=>new Zi(b({value:t,typeName:"ZodLiteral"},me(e))),"create");var Ya=Zi,ji=class wi extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let n=this._def.keyType.dereference(e),r=this._def.valueType.dereference(e);return new wi(N(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Gt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new wi(N(b({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.map)return te(r,{code:V.invalid_type,expected:ne.map,received:r.parsedType}),pe;let o=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([s,l],f)=>({key:o._parse(new Ot(r,s,r.path,[f,"key"])),value:a._parse(new Ot(r,l,r.path,[f,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of i){let f=await l.key,p=await l.value;if(f.status==="aborted"||p.status==="aborted")return pe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),s.set(f.value,p.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let l of i){let f=l.key,p=l.value;if(f.status==="aborted"||p.status==="aborted")return pe;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),s.set(f.value,p.value)}return{status:n.value,value:s}}}isEqual(e){return!(!(e instanceof wi)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(ji,"ZodMap");ji.create=d((t,e,n)=>new ji(b({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var _g=ji,Ki=class bg extends he{_parse(e){if(this._getType(e)!==ne.nan){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.nan,received:r.parsedType}),pe}return{status:"valid",value:e.data}}isEqual(e){return e instanceof bg}};d(Ki,"ZodNaN");Ki.create=d(t=>new Ki(b({typeName:"ZodNaN"},me(t))),"create");var wg=Ki,Li=class xg extends he{_parse(e){let n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ne.string&&r.parsedType!==ne.number){let o=be.objectValues(n);return te(r,{expected:be.joinValues(o),received:r.parsedType,code:V.invalid_type}),pe}if(n.indexOf(e.data)===-1){let o=be.objectValues(n);return te(r,{received:r.data,code:V.invalid_enum_value,options:o}),pe}return gt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof xg?Xn(this._def.values,e._def.values):!1}};d(Li,"ZodNativeEnum");Li.create=d((t,e)=>new Li(b({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var Xa=Li,Fi=class Pg extends he{_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:V.invalid_type,expected:ne.never,received:n.parsedType}),pe}isEqual(e){return e instanceof Pg}};d(Fi,"ZodNever");Fi.create=d(t=>new Fi(b({typeName:"ZodNever"},me(t))),"create");var qr=Fi,Wi=class Bg extends he{_parse(e){if(this._getType(e)!==ne.null){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.null,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Bg}};d(Wi,"ZodNull");Wi.create=d(t=>new Wi(b({typeName:"ZodNull"},me(t))),"create");var Qa=Wi,zi=class Er extends he{dereference(e){return new Er(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Er(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.null?gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Er?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Er(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(zi,"ZodNullable");zi.create=d((t,e)=>new zi(b({innerType:t,typeName:"ZodNullable"},me(e))),"create");var er=zi;function Eg(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,a=parseInt(t.toFixed(o).replace(".","")),i=parseInt(e.toFixed(o).replace(".",""));return a%i/Math.pow(10,o)}d(Eg,"floatSafeRemainder");var qi=class xi extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ne.number){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_type,expected:ne.number,received:a.parsedType}),pe}let r,o=new Tt;for(let a of this._def.checks)a.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:V.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?Eg(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:V.not_finite,message:a.message}),o.dirty()):be.assertNever(a);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ue.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ue.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ue.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ue.toString(n))}setLimit(e,n,r,o){return new xi(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(o)}]}))}_addCheck(e){return new xi(N(b({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:ue.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ue.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ue.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ue.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ue.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ue.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ue.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ue.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ue.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&be.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}isEqual(e){if(!(e instanceof xi))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(qi,"ZodNumber");qi.create=d(t=>new qi(b({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var es=qi;function Sn(t){if(t instanceof tr){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=ln.create(Sn(r))}return new tr(N(b({},t._def),{shape:d(()=>e,"shape")}))}else return t instanceof Fr?new Fr(N(b({},t._def),{type:Sn(t.element)})):t instanceof ln?ln.create(Sn(t.unwrap())):t instanceof er?er.create(Sn(t.unwrap())):t instanceof rr?rr.create(t.items.map(e=>Sn(e))):t}d(Sn,"deepPartialify");var cn=class vt extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=be.objectKeys(e);return this._cached={shape:e,keys:n}}dereference(e){let n=this._def.shape(),r={};for(let o in n)r[o]=n[o].dereference(e);return new vt(N(b({},this._def),{shape:d(()=>r,"shape")}))}getReferences(){let e=this._def.shape(),n=[];for(let r in e)n.push(...e[r].getReferences());return Gt(n)}clone(){let e={},n=this._def.shape();for(let[r,o]of Object.entries(n))e[r]=o.clone();return new vt(N(b({},this._def),{shape:d(()=>e,"shape")}))}_parse(e){if(this._getType(e)!==ne.object){let p=this._getOrReturnCtx(e);return te(p,{code:V.invalid_type,expected:ne.object,received:p.parsedType}),pe}let{status:r,ctx:o}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),s=[];if(this._def.unknownKeys!=="strip")for(let p in o.data)i.includes(p)||s.push(p);let l=[];for(let p of i){let y=a[p],g=o.data[p];l.push({key:{status:"valid",value:p},value:y._parse(new Ot(o,g,o.path,p)),alwaysSet:p in o.data})}let f=this._def.unknownKeys;if(f==="passthrough")for(let p of s)l.push({key:{status:"valid",value:p},value:{status:"valid",value:o.data[p]}});else if(f==="strict")s.length>0&&(te(o,{code:V.unrecognized_keys,keys:s}),r.dirty());else if(f!=="strip")for(let p of s){let y=o.data[p];l.push({key:{status:"valid",value:p},value:f._parse(new Ot(o,y,o.path,p)),alwaysSet:p in o.data})}return o.common.async?Promise.resolve().then(async()=>{let p=[];for(let y of l){let g=await y.key;p.push({key:g,value:await y.value,alwaysSet:y.alwaysSet})}return p}).then(p=>Tt.mergeObjectSync(r,p)):Tt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new vt(b(N(b({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:d((n,r)=>{var o,a,i,s;let l=(i=(a=(o=this._def).errorMap)==null?void 0:a.call(o,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ue.errToObj(e).message)!=null?s:l}:{message:l}},"errorMap")}:{}))}strip(){return new vt(N(b({},this._def),{unknownKeys:"strip"}))}passthrough(){return new vt(N(b({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return Lr.create();if(this._def.unknownKeys==="strict")return qr.create()}extend(e){return new vt(N(b({},this._def),{shape:d(()=>b(b({},this._def.shape()),e),"shape")}))}merge(e){return new vt({unknownKeys:e._def.unknownKeys,shape:d(()=>b(b({},this._def.shape()),e._def.shape()),"shape"),typeName:"ZodObject"})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new vt(N(b({},this._def),{unknownKeys:e}))}pick(e){let n={};return be.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}omit(e){let n={};return be.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}deepPartial(){return Sn(this)}partial(e){let n={};return be.objectKeys(this.shape).forEach(r=>{let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o?.optional()}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}required(e){let n={};return be.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof ln;)a=a._def.innerType;n[r]=a}}),new vt(N(b({},this._def),{shape:d(()=>n,"shape")}))}keyof(){return _o(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof vt)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),o=d((s,l)=>s[0]===l[0]&&s[1].isEqual(l[1]),"compare"),a=new et(Object.entries(n),{compare:o}),i=new et(Object.entries(r),{compare:o});return a.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};d(cn,"ZodObject");cn.create=d((t,e)=>new cn(b({shape:d(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");cn.strictCreate=d((t,e)=>new cn(b({shape:d(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");cn.lazycreate=d((t,e)=>new cn(b({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var tr=cn,Gi=class Pi extends he{dereference(e){return new Pi(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Pi(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.undefined?gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Pi?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};d(Gi,"ZodOptional");Gi.create=d((t,e)=>new Gi(b({innerType:t,typeName:"ZodOptional"},me(e))),"create");var ln=Gi,Sg=class Sr extends he{dereference(e){return new Sr(N(b({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Gt([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Sr(N(b({},this._def),{in:this._def.in.clone(),out:this._def.out.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return d(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pe:a.status==="dirty"?(n.dirty(),Jn(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})},"handleAsync")();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pe:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new Sr({in:e,out:n,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Sr)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};d(Sg,"ZodPipeline");var ts=Sg,Vi=class Bi extends he{unwrap(){return this._def.type}dereference(e){return new Bi(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Bi(N(b({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.promise&&n.common.async===!1)return te(n,{code:V.invalid_type,expected:ne.promise,received:n.parsedType}),pe;let r=n.parsedType===ne.promise?n.data:Promise.resolve(n.data);return gt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}isEqual(e){return e instanceof Bi?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};d(Vi,"ZodPromise");Vi.create=d((t,e)=>new Vi(b({type:t,typeName:"ZodPromise"},me(e))),"create");var bo=Vi,Ji=class kr extends he{dereference(e){return new kr(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new kr(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return Kr(n)&&(n.value=Object.freeze(n.value)),n}unwrap(){return this._def.innerType}isEqual(e){return e instanceof kr?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new kr(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Ji,"ZodReadonly");Ji.create=d((t,e)=>new Ji(b({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var wo=Ji,kg=class qn extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}dereference(e){let n=this._def.keyType.dereference(e),r=this._def.valueType.dereference(e);return new qn(N(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Gt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new qn(N(b({},this._def),{keyType:this._def.keyType.clone(),valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.object)return te(r,{code:V.invalid_type,expected:ne.object,received:r.parsedType}),pe;let o=[],a=this._def.keyType,i=this._def.valueType;for(let s in r.data)o.push({key:a._parse(new Ot(r,s,r.path,s)),value:i._parse(new Ot(r,r.data[s],r.path,s))});return r.common.async?Tt.mergeObjectAsync(n,o):Tt.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new qn(b({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new qn(b({keyType:yt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof qn)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(kg,"ZodRecord");var Ig=kg,Yi=class Ag extends he{dereference(e){let n=e[this._def.uri];return n||this}getReferences(){return[this._def.uri]}_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:V.unresolved_reference}),pe}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Ag?this._def.uri===e._def.uri:!1}};d(Yi,"ZodRef");Yi.create=d(t=>new Yi({typeName:"ZodRef",uri:t}),"create");var Cg=Yi,Xi=class Gn extends he{dereference(e){return new Gn(N(b({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Gn(N(b({},this._def),{valueType:this._def.valueType.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.set)return te(r,{code:V.invalid_type,expected:ne.set,received:r.parsedType}),pe;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(te(r,{code:V.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(te(r,{code:V.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let a=this._def.valueType;function i(l){let f=new Set;for(let p of l){if(p.status==="aborted")return pe;p.status==="dirty"&&n.dirty(),f.add(p.value)}return{status:n.value,value:f}}d(i,"finalizeSet");let s=[...r.data.values()].map((l,f)=>a._parse(new Ot(r,l,r.path,f)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(e,n){return new Gn(N(b({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new Gn(N(b({},this._def),{maxSize:{value:e,message:ue.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}isEqual(e){var n,r,o,a;if(!(e instanceof Gn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,s=(r=e._def.minSize)==null?void 0:r.value;if(i!==s)return!1;let l=(o=this._def.maxSize)==null?void 0:o.value,f=(a=e._def.maxSize)==null?void 0:a.value;return l!==f?!1:this._def.valueType.isEqual(e._def.valueType)}};d(Xi,"ZodSet");Xi.create=d((t,e)=>new Xi(b({valueType:t,minSize:null,maxSize:null,typeName:"ZodSet"},me(e))),"create");var Og=Xi,Rg=/^c[^\s-]{8,}$/i,Mg=/^[a-z][a-z0-9]*$/,Ng=/^[0-9A-HJKMNP-TV-Z]{26}$/,Dg=/^[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,Hg=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ug="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Fx=d(t=>t===Ug,"isEmojiRegex"),fa,$g=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Zg=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;function jg(t,e){return!!((e==="v4"||!e)&&$g.test(t)||(e==="v6"||!e)&&Zg.test(t))}d(jg,"isValidIP");var Qi=class Vn extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ne.string){let a=this._getOrReturnCtx(e);return te(a,{code:V.invalid_type,expected:ne.string,received:a.parsedType}),pe}let r=new Tt,o;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:V.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(o=this._getOrReturnCtx(e,o),te(o,{code:V.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,s=e.data.length<a.value;(i||s)&&(o=this._getOrReturnCtx(e,o),i?te(o,{code:V.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&te(o,{code:V.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Hg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"email",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")fa||(fa=new RegExp(Ug,"u")),fa.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"emoji",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Dg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"uuid",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Rg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Mg.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"cuid2",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Ng.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ulid",code:V.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),te(o,{validation:"url",code:V.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"regex",code:V.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(e,o),te(o,{code:V.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:V.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(o=this._getOrReturnCtx(e,o),te(o,{code:V.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?eg(a).test(e.data)||(o=this._getOrReturnCtx(e,o),te(o,{code:V.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="ip"?jg(e.data,a.version)||(o=this._getOrReturnCtx(e,o),te(o,{validation:"ip",code:V.invalid_string,message:a.message}),r.dirty()):be.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),b({validation:n,code:V.invalid_string},ue.errToObj(r)))}_addCheck(e){return new Vn(N(b({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(b({kind:"email"},ue.errToObj(e)))}url(e){return this._addCheck(b({kind:"url"},ue.errToObj(e)))}emoji(e){return this._addCheck(b({kind:"emoji"},ue.errToObj(e)))}uuid(e){return this._addCheck(b({kind:"uuid"},ue.errToObj(e)))}cuid(e){return this._addCheck(b({kind:"cuid"},ue.errToObj(e)))}cuid2(e){return this._addCheck(b({kind:"cuid2"},ue.errToObj(e)))}ulid(e){return this._addCheck(b({kind:"ulid"},ue.errToObj(e)))}ip(e){return this._addCheck(b({kind:"ip"},ue.errToObj(e)))}datetime(e){var n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck(b({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(n=e?.offset)!=null?n:!1},ue.errToObj(e?.message)))}regex(e,n){return this._addCheck(b({kind:"regex",regex:e},ue.errToObj(n)))}includes(e,n){return this._addCheck(b({kind:"includes",value:e,position:n?.position},ue.errToObj(n?.message)))}startsWith(e,n){return this._addCheck(b({kind:"startsWith",value:e},ue.errToObj(n)))}endsWith(e,n){return this._addCheck(b({kind:"endsWith",value:e},ue.errToObj(n)))}min(e,n){return this._addCheck(b({kind:"min",value:e},ue.errToObj(n)))}max(e,n){return this._addCheck(b({kind:"max",value:e},ue.errToObj(n)))}length(e,n){return this._addCheck(b({kind:"length",value:e},ue.errToObj(n)))}nonempty(e){return this.min(1,ue.errToObj(e))}trim(){return new Vn(N(b({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}secret(){return this._def[le]=N(b({},this._def[le]),{secret:!0}),this}toLowerCase(){return new Vn(N(b({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Vn(N(b({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}isEqual(e){if(!(e instanceof Vn))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(Qi,"ZodString");Qi.create=d(t=>{var e;return new Qi(b({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(N(b({},t),{supportsExtensions:["secret"]}))))},"create");var yt=Qi,eo=class Kg extends he{_parse(e){if(this._getType(e)!==ne.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.symbol,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Kg}};d(eo,"ZodSymbol");eo.create=d(t=>new eo(b({typeName:"ZodSymbol"},me(t))),"create");var Lg=eo,nr=class Ir extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName==="ZodEffects"?this._def.schema.sourceType():this._def.schema}dereference(e){return new Ir(N(b({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Ir(N(b({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,a={addIssue:d(i=>{te(r,i),i.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let i=o.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async s=>{if(n.value==="aborted")return pe;let l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?pe:l.status==="dirty"||n.value==="dirty"?Jn(l.value):l});{if(n.value==="aborted")return pe;let s=this._def.schema._parseSync({data:i,path:r.path,parent:r});return s.status==="aborted"?pe:s.status==="dirty"||n.value==="dirty"?Jn(s.value):s}}if(o.type==="refinement"){let i=d(s=>{let l=o.refinement(s,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s},"executeRefinement");if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?pe:(s.status==="dirty"&&n.dirty(),i(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?pe:(s.status==="dirty"&&n.dirty(),i(s.value).then(()=>({status:n.value,value:s.value}))))}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Kr(i))return i;let s=o.transform(i.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Kr(i)?Promise.resolve(o.transform(i.value,a)).then(s=>({status:n.value,value:s})):i);be.assertNever(o)}isEqual(e){return!(e instanceof Ir)||!this._def.schema.isEqual(e._def.schema)?!1:this._def.effect.type==="refinement"?e._def.effect.type!=="refinement"?!1:be.compareFunctions(this._def.effect.refinement,e._def.effect.refinement):this._def.effect.type==="transform"?e._def.effect.type!=="transform"?!1:be.compareFunctions(this._def.effect.transform,e._def.effect.transform):this._def.effect.type==="preprocess"?e._def.effect.type!=="preprocess"?!1:be.compareFunctions(this._def.effect.transform,e._def.effect.transform):!1}naked(){return this._def.schema.naked()}mandatory(){return new Ir(N(b({},this._def),{schema:this._def.schema.mandatory()}))}};d(nr,"ZodEffects");nr.create=d((t,e,n)=>new nr(b({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");nr.createWithPreprocess=d((t,e,n)=>new nr(b({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var In=nr,to=class Ar extends he{dereference(e){let n=this._def.items.map(o=>o.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Ar(N(b({},this._def),{items:n,rest:r}))}getReferences(){return Gt([...this._def.items.flatMap(e=>e.getReferences()),...this._def.rest?this._def.rest.getReferences():[]])}clone(){let e=this._def.items.map(r=>r.clone()),n=this._def.rest?this._def.rest.clone():null;return new Ar(N(b({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ne.array)return te(r,{code:V.invalid_type,expected:ne.array,received:r.parsedType}),pe;if(r.data.length<this._def.items.length)return te(r,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pe;!this._def.rest&&r.data.length>this._def.items.length&&(te(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((i,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Ot(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>Tt.mergeArray(n,i)):Tt.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new Ar(N(b({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Ar)||!this._restEquals(e))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et(this._def.items,{compare:n}),o=new et(e._def.items,{compare:n});return r.isEqual(o)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};d(to,"ZodTuple");to.create=d((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new to(b({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var rr=to,no=class Fg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.undefined,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof Fg}mandatory(){return qr.create(b({},this._def))}};d(no,"ZodUndefined");no.create=d(t=>new no(b({typeName:"ZodUndefined"},me(t))),"create");var xo=no,ro=class Cr extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Cr(N(b({},this._def),{options:n}))}getReferences(){return Gt(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Cr(N(b({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let i=a.map(s=>new Wt(s.ctx.common.issues));return te(n,{code:V.invalid_union,unionErrors:i}),pe}if(d(o,"handleResults"),n.common.async)return Promise.all(r.map(async a=>{let i=N(b({},n),{common:N(b({},n.common),{issues:[]}),parent:null});return{result:await a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let a,i=[];for(let l of r){let f=N(b({},n),{common:N(b({},n.common),{issues:[]}),parent:null}),p=l._parseSync({data:n.data,path:n.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(l=>new Wt(l));return te(n,{code:V.invalid_union,unionErrors:s}),pe}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Cr))return!1;let n=d((a,i)=>a.isEqual(i),"compare"),r=new et([...this._def.options],{compare:n}),o=new et([...e._def.options],{compare:n});return r.isEqual(o)}mandatory(){let e=this._def.options.filter(a=>!(a instanceof xo)).map(a=>a.mandatory()),[n,r,...o]=e;return n?r?new Cr(N(b({},this._def),{options:[n,r,...o]})):n:qr.create(b({},this._def))}};d(ro,"ZodUnion");ro.create=d((t,e)=>new ro(b({options:t,typeName:"ZodUnion"},me(e))),"create");var ns=ro,io=class Wg extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gt(e.data)}isEqual(e){return e instanceof Wg}};d(io,"ZodUnknown");io.create=d(t=>new io(b({typeName:"ZodUnknown"},me(t))),"create");var Hr=io,oo=class zg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:V.invalid_type,expected:ne.void,received:r.parsedType}),pe}return gt(e.data)}isEqual(e){return e instanceof zg}};d(oo,"ZodVoid");oo.create=d(t=>new oo(b({typeName:"ZodVoid"},me(t))),"create");var qg=oo,Wx=["gpt-3.5-turbo","gpt-3.5-turbo-16k","gpt-4","gpt-4-1106-preview","gpt-4-vision-preview","gpt-4-0125-preview","gpt-4-turbo-preview","gpt-4-turbo","gpt-4o","gpt-3.5-turbo-0125","gpt-3.5-turbo-1106"],YA=or.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),zx=d(t=>yt.create().displayAs({id:"variable",params:b({type:t?.type||"any"},t?.params)}),"variable"),qx=d(t=>yt.create().displayAs({id:"conversation",params:b({},t?.params)}),"conversation"),Gx=d(t=>yt.create().displayAs({id:"user",params:b({},t?.params)}),"user"),Vx=d(t=>yt.create().displayAs({id:"message",params:b({},t?.params)}),"message"),Jx=d(t=>yt.create().displayAs({id:"agent",params:b({},t?.params)}),"agent"),Yx=d(t=>yt.create().displayAs({id:"event",params:b({},t?.params)}),"event"),Xx=d(t=>yt.create().displayAs({id:"table",params:b({},t?.params)}),"table"),Qx=d(t=>yt.create().displayAs({id:"tablerow",params:b({},t?.params)}),"tablerow"),eP=d(t=>yt.create().displayAs({id:"intent",params:b({},t?.params)}),"intent"),tP=d(()=>or.create(Wx).displayAs({id:"dropdown",params:{}}),"aimodel"),nP=d(t=>yt.create().displayAs({id:"datasource",params:b({},t)}),"datasource"),rP=d(t=>yt.create().displayAs({id:"knowledgebase",params:b({},t)}),"knowledgebase"),iP={object:tr.lazycreate},oP=d((t,e={message:`Input not instance of ${t.name}`})=>gg(n=>n instanceof t,e),"instanceOfType"),Gg=yt.create,Vg=es.create,aP=wg.create,sP=La.create,Jg=Fa.create,lP=qa.create,uP=Lg.create,cP=xo.create,fP=Qa.create,dP=Lr.create,pP=Hr.create,gP=qr.create,yP=qg.create,mP=Fr.create,hP=tr.create,vP=tr.strictCreate,TP=ns.create,_P=mg.create,bP=Va.create,wP=rr.create,xP=Ig.create,PP=Cg.create,BP=wo.create,EP=_g.create,SP=Og.create,kP=vg.create,IP=Ja.create,AP=Ya.create,CP=or.create,OP=Xa.create,RP=bo.create,Xc=In.create,MP=ln.create,NP=er.create,DP=To.create,HP=In.createWithPreprocess,UP=ts.create,$P=d(()=>Gg().optional(),"ostring"),ZP=d(()=>Vg().optional(),"onumber"),jP=d(()=>Jg().optional(),"oboolean"),KP={string:d(t=>yt.create(N(b({},t),{coerce:!0})),"string"),number:d(t=>es.create(N(b({},t),{coerce:!0})),"number"),boolean:d(t=>Fa.create(N(b({},t),{coerce:!0})),"boolean"),bigint:d(t=>La.create(N(b({},t),{coerce:!0})),"bigint"),date:d(t=>qa.create(N(b({},t),{coerce:!0})),"date")},LP=pe,R=X,Yg=d((t,e)=>t.anyOf.length?t.anyOf.length===1?it(t.anyOf[0],N(b({},e),{path:[...e.path,"anyOf",0]})):`z.union([${t.anyOf.map((n,r)=>it(n,N(b({},e),{path:[...e.path,"anyOf",r]}))).join(", ")}])`:"z.any()","parseAnyOf"),FP=d(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),WP=d(t=>"z.any()","parseDefault"),zP=d((t,e)=>`z.union([${t.type.map(n=>it(N(b({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),qP=d((t,e)=>`z.any().refine((value) => !${it(t.not,N(b({},e),{path:[...e.path,"not"]}))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`,"parseNot"),GP=d(t=>"z.null()","parseNull"),VP=d(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),JP=d((t,...e)=>Object.keys(t).reduce((n,r)=>(e.includes(r)||(n[r]=t[r]),n),{}),"omit");function ut(t,e,n){var r;let o=t[e],a="";if(o!==void 0){let i=n({value:o,json:JSON.stringify(o)});if(i){let s=i[0],l=i.length===3?i[1]:"",f=i.length===3?i[2]:i[1];a+=s,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(a+=l+JSON.stringify(t.errorMessage[e])),a+=f}}return a}d(ut,"withMessage");var Or=Symbol("Original index"),YP=d(t=>{let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="boolean")e.push(r?{[Or]:n}:{[Or]:n,not:{}});else{if(Or in r)return t;e.push(N(b({},r),{[Or]:n}))}}return e},"ensureOriginalIndex");function Wr(t,e){if(t.allOf.length===0)return"z.never()";if(t.allOf.length===1){let n=t.allOf[0];return it(n,N(b({},e),{path:[...e.path,"allOf",n[Or]]}))}else{let[n,r]=VP(YP(t.allOf));return`z.intersection(${Wr({allOf:n},e)}, ${Wr({allOf:r},e)})`}}d(Wr,"parseAllOf");var XP=d((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,o)=>it(r,N(b({},e),{path:[...e.path,"items",o]})))}])`;let n=t.items?`z.array(${it(t.items,N(b({},e),{path:[...e.path,"items"]}))})`:"z.array(z.any())";return n+=ut(t,"minItems",({json:r})=>[`.min(${r}`,", ",")"]),n+=ut(t,"maxItems",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseArray"),QP=d(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),eB=d(t=>t.enum.length===0?"z.never()":t.enum.length===1?`z.literal(${JSON.stringify(t.enum[0])})`:t.enum.every(e=>typeof e=="string")?`z.enum([${t.enum.map(e=>JSON.stringify(e))}])`:`z.union([${t.enum.map(e=>`z.literal(${JSON.stringify(e)})`).join(", ")}])`,"parseEnum"),tB=d((t,e)=>{let n=it(t.if,N(b({},e),{path:[...e.path,"if"]})),r=it(t.then,N(b({},e),{path:[...e.path,"then"]})),o=it(t.else,N(b({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${o}]).superRefine((value,ctx) => {
|
|
29
29
|
const result = ${n}.safeParse(value).success
|
|
30
30
|
? ${r}.safeParse(value)
|
|
31
31
|
: ${o}.safeParse(value);
|
|
32
32
|
if (!result.success) {
|
|
33
33
|
result.error.errors.forEach((error) => ctx.addIssue(error))
|
|
34
34
|
}
|
|
35
|
-
})`},"parseIfThenElse"),
|
|
35
|
+
})`},"parseIfThenElse"),nB=d(t=>{var e;let n="z.number()";return(e=t[le])!=null&&e.coerce&&(n="z.coerce.number()"),t.type==="integer"?n+=ut(t,"type",()=>[".int(",")"]):n+=ut(t,"format",({value:r})=>{if(r==="int64")return[".int(",")"]}),n+=ut(t,"multipleOf",({value:r,json:o})=>r===1?n.startsWith("z.number().int(")?void 0:[".int(",")"]:[`.multipleOf(${o}`,", ",")"]),typeof t.minimum=="number"?t.exclusiveMinimum===!0?n+=ut(t,"minimum",({json:r})=>[`.gt(${r}`,", ",")"]):n+=ut(t,"minimum",({json:r})=>[`.gte(${r}`,", ",")"]):typeof t.exclusiveMinimum=="number"&&(n+=ut(t,"exclusiveMinimum",({json:r})=>[`.gt(${r}`,", ",")"])),typeof t.maximum=="number"?t.exclusiveMaximum===!0?n+=ut(t,"maximum",({json:r})=>[`.lt(${r}`,", ",")"]):n+=ut(t,"maximum",({json:r})=>[`.lte(${r}`,", ",")"]):typeof t.exclusiveMaximum=="number"&&(n+=ut(t,"exclusiveMaximum",({json:r})=>[`.lt(${r}`,", ",")"])),n},"parseNumber"),rs=d((t,e)=>t.oneOf.length?t.oneOf.length===1?it(t.oneOf[0],N(b({},e),{path:[...e.path,"oneOf",0]})):`z.any().superRefine((x, ctx) => {
|
|
36
36
|
const schemas = [${t.oneOf.map((n,r)=>it(n,N(b({},e),{path:[...e.path,"oneOf",r]}))).join(", ")}];
|
|
37
37
|
const errors = schemas.reduce(
|
|
38
38
|
(errors: z.ZodError[], schema) =>
|
|
@@ -81,7 +81,7 @@ declare function ${r}${i};${l}`);if(t.props.type==="variable")return oa(`${o}dec
|
|
|
81
81
|
`,o+=`}
|
|
82
82
|
`,o+=`}
|
|
83
83
|
`),o+=`}
|
|
84
|
-
`,o+="})"}let a=n?o?n+o:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:o||(r?`z.record(${r})`:"z.record(z.any())");return Ye.an.anyOf(t)&&(a+=`.and(${Yg(N(b({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),Ye.a.oneOf(t)&&(a+=`.and(${rs(N(b({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),Ye.an.allOf(t)&&(a+=`.and(${Wr(N(b({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),a}d(Xg,"parseObject");var nB=d(t=>{var e;let n="z.string()";if((e=t[le])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";n="z.coerce.string()"}return n+=ut(t,"format",({value:r})=>{switch(r){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),n+=ut(t,"pattern",({json:r})=>[`.regex(new RegExp(${r})`,", ",")"]),n+=ut(t,"minLength",({json:r})=>[`.min(${r}`,", ",")"]),n+=ut(t,"maxLength",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseString"),rB=d((t,e)=>`${it(VP(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),iB=d(t=>`z.ref('${t.$ref}')`,"parseRef"),oB=d((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return rs(t,e);let o=t.oneOf.map((a,i)=>it(a,N(b({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${o.join(", ")}])`},"parseDiscriminator"),it=d((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let a=e.parserOverride(t,e);if(typeof a=="string")return a}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let o=lB(t,e);return n||(o=aB(t,o),e.withoutDefaults||(o=sB(t,o))),r.r=o,o},"parseSchema"),aB=d((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),sB=d((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),lB=d((t,e)=>Ye.a.nullable(t)?rB(t,e):Ye.an.object(t)?Xg(t,e):Ye.an.array(t)?YP(t,e):Ye.an.anyOf(t)?Yg(t,e):Ye.an.allOf(t)?Wr(t,e):Ye.a.discriminator(t)?oB(t,e):Ye.a.oneOf(t)?rs(t,e):Ye.a.not(t)?zP(t,e):Ye.an.enum(t)?QP(t):Ye.a.const(t)?XP(t):Ye.a.multipleType(t)?WP(t,e):Ye.a.primitive(t,"string")?nB(t):Ye.a.primitive(t,"number")||Ye.a.primitive(t,"integer")?tB(t):Ye.a.primitive(t,"boolean")?LP(t):Ye.a.primitive(t,"null")?qP(t):Ye.a.conditional(t)?eB(t,e):Ye.a.ref(t)?iB(t):FP(t),"selectParser"),Ye={an:{object:d(t=>t.type==="object","object"),array:d(t=>t.type==="array","array"),anyOf:d(t=>t.anyOf!==void 0,"anyOf"),allOf:d(t=>t.allOf!==void 0,"allOf"),enum:d(t=>t.enum!==void 0,"enum")},a:{nullable:d(t=>t.nullable===!0,"nullable"),multipleType:d(t=>Array.isArray(t.type),"multipleType"),not:d(t=>t.not!==void 0,"not"),const:d(t=>t.const!==void 0,"const"),primitive:d((t,e)=>t.type===e,"primitive"),conditional:d(t=>!!("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:d(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:d(t=>t.oneOf!==void 0,"oneOf"),ref:d(t=>t.$ref!==void 0,"ref")}},uB=d(t=>{let e;try{e=new Function("z",`return ${t}`)(R)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof R.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),cB=d(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),fB=d(t=>{let e=cB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=uB(e);if(!n.sucess)throw new lo(n.error);return n.value},"jsonSchemaToZod"),Rr=d((t,e)=>{var n,r;if(e[le]&&t._def&&(t.naked()._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([o,a])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[o]&&Rr(i[o],a)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Rr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let o=e.items;if(typeof o=="object"&&!Array.isArray(o)){let a=t._def.type;a&&Rr(a,o)}else Array.isArray(o)&&o.forEach((a,i)=>{let s=t._def;s.typeName===X.ZodFirstPartyTypeKind.ZodTuple&&Rr(s.items[i],a)})}},"applyZuiPropsRecursively"),dB=d(t=>{let e=fB(t);return Rr(e,t),e},"fromJSONSchemaLegacy"),pB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Qg(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),gB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&r.type==="null")&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),Qg=d(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),yB=d(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),mB=d(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:o,multipleOf:a,format:i})=>{let s=R.number();return t==="integer"&&(s=s.int()),i==="finite"&&(s=s.finite()),n!==void 0?s=s.gt(n):e!==void 0&&(s=s.gte(e)),o!==void 0?s=s.lt(o):r!==void 0&&(s=s.lte(r)),a!==void 0&&(s=s.multipleOf(a)),s},"numberJSONSchemaToZuiNumber"),hB=d(({format:t,pattern:e,minLength:n,maxLength:r})=>{let o=R.string();if(n&&r&&n===r?o=o.length(n):(n&&(o=o.min(n)),r&&(o=o.max(r))),t==="cuid"||e===Xe.cuid)o=o.cuid();else if(t==="cuid2"||e===Xe.cuid2)o=o.cuid2();else if(t==="emoji"||e===Xe.emoji)o=o.emoji();else if(t==="ulid"||e===Xe.ulid)o=o.ulid();else if(t==="date-time"){let{precision:a,offset:i}=e?Ax(e):{};o=o.datetime({precision:a,offset:i})}else t==="email"||e===Xe.email?o=o.email():t==="ipv4"||e===Xe.ipv4?o=o.ip():t==="ipv6"||e===Xe.ipv6?o=o.ip("v6"):t==="uri"?o=o.url():t==="uuid"||e===Xe.uuid?o=o.uuid():e&&(o=o.regex(new RegExp(e)));return o},"stringJSONSchemaToZuiString"),br=d((t,e)=>{let n=[];e.enum!==void 0&&n.push(...e.enum),e.const!==void 0&&n.push(e.const);let r=n.filter(i=>typeof i===t),[o]=r;if(!o){if(t==="string"&&e.type==="string")return hB(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return mB(e);if(t==="boolean")return R.boolean();if(t==="null")return R.null();throw new lo(`Unknown primitive type: "${t}"`)}if(r.length===1)return R.literal(o);let a=r.map(i=>R.literal(i));return R.union(a)},"toZuiPrimitive"),vB=d((t,e)=>TB(t)?bB(t,e):_B(t)?wB(t,e):xB(t,e),"arrayJSONSchemaToZuiArray"),TB=d(t=>Array.isArray(t.items),"_isTuple"),_B=d(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),bB=d(({items:t,additionalItems:e},n)=>{let r=t.map(n),o=R.tuple(r);return e!==void 0&&(o=o.rest(n(e))),o},"_handleTuple"),wB=d(({items:t,minItems:e,maxItems:n},r)=>{let o=R.set(r(t));return e&&(o=o.min(e)),n&&(o=o.max(n)),o},"_handleSet"),xB=d(({minItems:t,maxItems:e,items:n},r)=>{let o=R.array(r(n));return t&&t===e?o.length(t):(t&&(o=o.min(t)),e&&(o=o.max(e)),o)},"_handleArray"),zn=R.any();function ey(t){return rt(t)}d(ey,"fromJSONSchema");function rt(t){var e;if(t===void 0)return zn;if(t===!0)return R.any();if(t===!1)return R.never();if(t.default!==void 0)return rt(N(b({},t),{default:void 0})).default(t.default);if(t.readOnly)return rt(N(b({},t),{readOnly:void 0})).readonly();if(t.oneOf!==void 0)throw new an({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new an({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new an({propertyNames:t.propertyNames});if(t.if!==void 0)throw new an({if:t.if});if(t.then!==void 0)throw new an({then:t.then});if(t.else!==void 0)throw new an({else:t.else});if(t.$ref!==void 0)return R.ref(t.$ref);if(t.not!==void 0){if(Qg(t))return R.undefined();if(t.not===!0)return R.never();throw new an({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return zn;if(t.type.length===1)return rt(N(b({},t),{type:t.type[0]}));let n=t,{type:r}=n,o=rf(n,["type"]),a=t.type.map(i=>rt(N(b({},o),{type:i})));return R.union(a)}if(t.type==="string")return t.enum&&t.enum.length>0?R.enum(t.enum):br("string",t);if(t.type==="integer"){let n=br("number",t);return n instanceof R.ZodNumber?n.int():n}if(t.type==="number")return br("number",t);if(t.type==="boolean")return br("boolean",t);if(t.type==="null")return br("null",t);if(t.type==="array")return vB(t,rt);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let n=rt(t.additionalProperties);return rt(N(b({},t),{additionalProperties:void 0})).catchall(n)}if(t.properties!==void 0){let n={};for(let[r,o]of Object.entries(t.properties)){let a=rt(o),i=(e=t.required)!=null?e:[];n[r]=i.includes(r)?a:a.optional()}return R.object(n)}if(t.additionalProperties!==void 0){let n=rt(t.additionalProperties);return R.record(n)}return R.record(zn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return zn;if(t.anyOf.length===1)return rt(t.anyOf[0]);if(pB(t))return rt(t.anyOf[0]).optional();if(gB(t))return rt(t.anyOf[0]).nullable();let n=t.anyOf.map(rt);return R.union(n)}if(t.allOf!==void 0){if(t.allOf.length===0)return zn;if(t.allOf.length===1)return rt(t.allOf[0]);let[n,...r]=t.allOf,o=rt(n),a=rt({allOf:r});return R.intersection(o,a)}return yB(t)?R.unknown():zn}d(rt,"_fromJSONSchema");var PB=/^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/,Ba=d((t,e,n=!0)=>{if(typeof t!="object")throw new pa("Input must be an object");let r=d(i=>{let s=i;return e?.nullable&&(s=s.nullable()),e?.optional&&(s=s.optional()),e?.passtrough&&typeof s.passthrough=="function"&&(s=s.passthrough()),s},"applyOptions"),o=Object.entries(t).reduce((i,[s,l])=>{if(l===null)i[s]=r(X.null());else switch(typeof l){case"string":i[s]=PB.test(l)?r(X.string().datetime()):r(X.string());break;case"number":i[s]=r(X.number());break;case"boolean":i[s]=r(X.boolean());break;case"object":Array.isArray(l)?l.length===0?i[s]=r(X.array(X.unknown())):typeof l[0]=="object"?i[s]=r(X.array(Ba(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[s]=r(X.array(X[typeof l[0]]()))):i[s]=r(Ba(l,e,!1));break;default:throw new pa(`Unsupported type for key ${s}`)}return i},{}),a=Object.keys(o).length>0;return e?.passtrough||!n&&!a?X.object(o).passthrough():X.object(o)},"fromObject");function ty(){return{}}d(ty,"parseAnyDef");function ny(t,e){var n,r;let o={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!=="ZodAny"&&(o.items=Ie(t.type._def,N(b({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Re(o,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(o,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(o,"minItems",t.exactLength.value,t.exactLength.message,e),Re(o,"maxItems",t.exactLength.value,t.exactLength.message,e)),o}d(ny,"parseArrayDef");function ry(t,e){let n=b({type:"integer",format:"int64"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"?r.inclusive?Re(n,"minimum",r.value,r.message,e):Re(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Re(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Re(n,"maximum",r.value,r.message,e):Re(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Re(n,"maximum",r.value,r.message,e));break;case"multipleOf":Re(n,"multipleOf",r.value,r.message,e);break}return n}d(ry,"parseBigintDef");function iy(t){return b({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(iy,"parseBooleanDef");function oy(t,e){return Ie(t.type._def,e)}d(oy,"parseBrandedDef");var BB=d((t,e)=>Ie(t.innerType._def,e),"parseCatchDef");function ay(t,e){return e.dateStrategy=="integer"?EB(t,e):b({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(ay,"parseDateDef");var EB=d((t,e)=>{let n=b({type:"integer",format:"unix-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"&&Re(n,"minimum",r.value,r.message,e);break;case"max":e.target==="jsonSchema7"&&Re(n,"maximum",r.value,r.message,e);break}return n},"integerDateParser");function sy(t,e){return N(b({},Ie(t.innerType._def,e)),{default:t.defaultValue()})}d(sy,"parseDefaultDef");function ly(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):{}}d(ly,"parseEffectsDef");function uy(t){return{type:"string",enum:t.values}}d(uy,"parseEnumDef");var SB=d(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function cy(t,e){let n=[Ie(t.left._def,N(b({},e),{currentPath:[...e.currentPath,"allOf","0"]})),Ie(t.right._def,N(b({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(a=>!!a),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(a=>{if(SB(a))o.push(...a.allOf),a.unevaluatedProperties===void 0&&(r=void 0);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let s=a,{additionalProperties:l}=s;i=rf(s,["additionalProperties"])}else r=void 0;o.push(i)}}),o.length?b({allOf:o},r):void 0}d(cy,"parseIntersectionDef");function fy(t,e){let n=typeof t.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[t.value]}:{type:n==="bigint"?"integer":n,const:t.value}}d(fy,"parseLiteralDef");function is(t,e){var n,r,o,a,i;if(e.target==="openApi3"&&((n=t.keyType)==null?void 0:n._def.typeName)==="ZodEnum")return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,f)=>{var p;return N(b({},l),{[f]:(p=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"properties",f]})))!=null?p:{}})},{}),additionalProperties:!1};let s={type:"object",additionalProperties:(r=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return s;if(((o=t.keyType)==null?void 0:o._def.typeName)==="ZodString"&&((a=t.keyType._def.checks)!=null&&a.length)){let l=Object.entries(ja(t.keyType._def,e)).reduce((f,[p,y])=>p==="type"?f:N(b({},f),{[p]:y}),{});return N(b({},s),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(b({},s),{propertyNames:{enum:t.keyType._def.values}});return s}d(is,"parseRecordDef");function dy(t,e){if(e.mapStrategy==="record")return is(t,e);let n=Ie(t.keyType._def,N(b({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}d(dy,"parseMapDef");function py(t){let e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),o=Array.from(new Set(r.map(a=>typeof a)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r.filter(a=>typeof a=="string"||typeof a=="number")}}d(py,"parseNativeEnumDef");function gy(){return{not:{}}}d(gy,"parseNeverDef");function yy(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}d(yy,"parseNullDef");var ao={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function my(t,e){if(e.target==="openApi3")return Qc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in ao&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,a)=>{let i=ao[a._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,a)=>{let i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(a._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((a,i,s)=>s.indexOf(a)===i);return{type:o.length>1?o:o[0],enum:n.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(a=>!r.includes(a))],[])};return Qc(t,e)}d(my,"parseUnionDef");var Qc=d((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((o,a)=>Ie(o._def,N(b({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${a}`]}))).filter(o=>!!o&&(!e.strictUnions||typeof o=="object"&&Object.keys(o).length>0)),r=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(n.length)return e.unionStrategy==="anyOf"?b({anyOf:n},r):b({oneOf:n},r)},"asUnionOf");function hy(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length)){let r=t.innerType;if(e.target==="openApi3"){let a={type:ao[r._def.typeName],nullable:!0};return Ea(r._def,e,a)}let o={type:[ao[r._def.typeName],"null"]};return Ea(r._def,e,o)}if(e.target==="openApi3"){let r=Ie(t.innerType._def,N(b({},e),{currentPath:[...e.currentPath]}));return r&&N(b({},r),{nullable:!0})}let n=Ie(t.innerType._def,N(b({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return n&&{anyOf:[n,{type:"null"}]}}d(hy,"parseNullableDef");function vy(t,e){let n=b({type:"number"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Za(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?Re(n,"minimum",r.value,r.message,e):Re(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Re(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Re(n,"maximum",r.value,r.message,e):Re(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Re(n,"maximum",r.value,r.message,e));break;case"multipleOf":Re(n,"multipleOf",r.value,r.message,e);break}return n}d(vy,"parseNumberDef");var kB=d((t,e)=>{var n;return t.unknownKeys instanceof he?(n=Ie(t.unknownKeys._def,N(b({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function Ty(t,e){let n=N(b({type:"object"},Object.entries(t.shape()).reduce((r,[o,a])=>{if(a===void 0||a._def===void 0)return r;let i=Ie(a._def,N(b({},e),{currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]}));return i===void 0?r:{properties:N(b({},r.properties),{[o]:i}),required:a.isOptional()?r.required:[...r.required,o]}},{properties:{},required:[]})),{additionalProperties:kB(t,e)});return n.required.length||delete n.required,n}d(Ty,"parseObjectDef");var IB=d((t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return Ie(t.innerType._def,e);let r=Ie(t.innerType._def,N(b({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),AB=d((t,e)=>{if(e.pipeStrategy==="input")return Ie(t.in._def,e);if(e.pipeStrategy==="output")return Ie(t.out._def,e);let n=Ie(t.in._def,N(b({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=Ie(t.out._def,N(b({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(o=>o!==void 0)}},"parsePipelineDef");function _y(t,e){return Ie(t.type._def,e)}d(_y,"parsePromiseDef");function by(t,e){let r={type:"array",uniqueItems:!0,items:Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&Re(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Re(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}d(by,"parseSetDef");function wy(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(b({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ie(t.rest._def,N(b({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(b({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}d(wy,"parseTupleDef");function xy(){return{not:{}}}d(xy,"parseUndefinedDef");function Py(){return{}}d(Py,"parseUnknownDef");var CB=d((t,e)=>Ie(t.innerType._def,e),"parseReadonlyDef");function By(t){return{$ref:t.uri}}d(By,"parseRefDef");function Ie(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=OB(r,e);if(i!==void 0)return i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let a=MB(t,t.typeName,e);return a&&Ea(t,e,a),o.jsonSchema=a,a}d(Ie,"parseDef");var OB=d((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:RB(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},"get$ref"),RB=d((t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")},"getRelativePath"),MB=d((t,e,n)=>{switch(e){case"ZodString":return ja(t,n);case"ZodNumber":return vy(t,n);case"ZodObject":return Ty(t,n);case"ZodBigInt":return ry(t,n);case"ZodBoolean":return iy(t);case"ZodDate":return ay(t,n);case"ZodUndefined":return xy();case"ZodNull":return yy(n);case"ZodArray":return ny(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return my(t,n);case"ZodIntersection":return cy(t,n);case"ZodTuple":return wy(t,n);case"ZodRecord":return is(t,n);case"ZodRef":return By(t);case"ZodLiteral":return fy(t,n);case"ZodEnum":return uy(t);case"ZodNativeEnum":return py(t);case"ZodNullable":return hy(t,n);case"ZodOptional":return IB(t,n);case"ZodMap":return dy(t,n);case"ZodSet":return by(t,n);case"ZodLazy":return Ie(t.getter()._def,n);case"ZodPromise":return _y(t,n);case"ZodNaN":case"ZodNever":return gy();case"ZodEffects":return ly(t,n);case"ZodAny":return ty();case"ZodUnknown":return Py();case"ZodDefault":return sy(t,n);case"ZodBranded":return oy(t,n);case"ZodReadonly":return CB(t,n);case"ZodCatch":return BB(t,n);case"ZodPipeline":return AB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),Ea=d((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[le]:b(b({},t[le]),n[le])}),n),"addMeta"),ef={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"string",mapStrategy:"entries",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",discriminator:!1,unionStrategy:"anyOf"},NB=d(t=>typeof t=="string"?N(b({},ef),{name:t}):b(b({},ef),t),"getDefaultOptions"),DB=d(t=>{let e=NB(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return N(b({},e),{currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),HB=d((t,e)=>{var n;let r=DB(e),o=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,p])=>{var y;return N(b({},l),{[f]:(y=Ie(p._def,N(b({},r),{currentPath:[...r.basePath,r.definitionPath,f]}),!0))!=null?y:{}})},{}):void 0,a=typeof e=="string"?e:e?.name,i=(n=Ie(t._def,a===void 0?r:N(b({},r),{currentPath:[...r.basePath,r.definitionPath,a]}),!1))!=null?n:{},s=a===void 0?o?N(b({},i),{[r.definitionPath]:o}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:N(b({},o),{[a]:i})};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s},"zodToJsonSchema"),UB=d((t,e={target:"openApi3"})=>{let n=HB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy");var Gr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===X.ZodFirstPartyTypeKind.ZodObject&&r.typeName===X.ZodFirstPartyTypeKind.ZodObject){let o=n.shape(),a=r.shape();return X.object({...o,...a})}if(n.typeName===X.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===X.ZodFirstPartyTypeKind.ZodRecord)return X.record(X.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},Ey=X;var mt=X.string().min(1),ky=X.object({text:mt}),Iy=X.object({markdown:mt}),Ay=X.object({imageUrl:mt}),Cy=X.object({audioUrl:mt}),Oy=X.object({videoUrl:mt}),Ry=X.object({fileUrl:mt,title:mt.optional()}),My=X.object({latitude:X.number(),longitude:X.number(),address:X.string().optional(),title:X.string().optional()}),Ny=X.object({title:mt,subtitle:mt.optional(),imageUrl:mt.optional(),actions:X.array(X.object({action:X.enum(["postback","url","say"]),label:mt,value:mt}))}),Sy=X.object({text:mt,options:X.array(X.object({label:mt,value:mt}))}),$B=X.object({items:X.array(Ny)}),ZB=X.union([X.object({type:X.literal("text"),payload:ky}),X.object({type:X.literal("markdown"),payload:Iy}),X.object({type:X.literal("image"),payload:Ay}),X.object({type:X.literal("audio"),payload:Cy}),X.object({type:X.literal("video"),payload:Oy}),X.object({type:X.literal("file"),payload:Ry}),X.object({type:X.literal("location"),payload:My})]),jB=X.object({items:X.array(ZB)}),KB={schema:Iy},LB={text:{schema:ky},image:{schema:Ay},audio:{schema:Cy},video:{schema:Oy},file:{schema:Ry},location:{schema:My},carousel:{schema:$B},card:{schema:Ny},dropdown:{schema:Sy},choice:{schema:Sy},bloc:{schema:jB}};A();O();C();var fC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};A();O();C();import{isNode as Fk}from"browser-or-node";A();O();C();var os=console;function Mt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Wo(t,e=8072,n=Gk){if(!Fk)throw new Error("This function can only be called in Node.js");let o=(Mh(),Gv(Rh)).createServer(async(a,i)=>{try{let s=await Wk(a);if(s.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(s);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(s){let l=s instanceof Error?s.message:String(s);os.error("Error while handling request",{error:l??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function Wk(t){let e=await qk(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let a=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[a]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:zk(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function zk(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function qk(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function Gk(t){os.info(`Listening on port ${t}`)}import{isApiError as MU,RuntimeError as NU}from"@botpress/client";A();O();C();A();O();C();A();O();C();A();O();C();var Le={};hn(Le,{mapKeys:()=>Yk,mapValues:()=>Jk,mergeRecords:()=>Qk,pairs:()=>zo,stripUndefinedProps:()=>Xk,values:()=>Vk});A();O();C();var zo=t=>Object.entries(t),Vk=t=>Object.values(t),Jk=(t,e)=>Object.fromEntries(zo(t).map(([n,r])=>[n,e(r,n)])),Yk=(t,e)=>Object.fromEntries(zo(t).map(([n,r])=>[e(n),r])),Xk=t=>Object.fromEntries(zo(t).filter(([,e])=>e!==void 0)),Qk=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],a={};for(let i of o){let s=t[i],l=e[i];s&&l?a[i]=n(s,l):s?a[i]=s:l&&(a[i]=l)}return a};var ye={};hn(ye,{safePush:()=>eI,unique:()=>tI});A();O();C();var eI=(t,...e)=>t?[...t,...e]:[...e],tI=t=>Array.from(new Set(t));A();O();C();var ft={};hn(ft,{setName:()=>nI});A();O();C();var nI=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Nh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:Le.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},a=Le.mapValues(t.entities,i=>i.schema);for(let[i,s]of Object.entries(t.definition.actions??{})){let l=s.input.schema.dereference(a),f=s.output.schema.dereference(a),p=t.actions?.[i]?.name??i;r.actions[p]={...s,...t.actions?.[i]??{},input:{schema:l},output:{schema:f}},o.actions[i]={name:p}}for(let[i,s]of Object.entries(t.definition.events??{})){let l=s.schema.dereference(a),f=t.events?.[i]?.name??i;r.events[f]={...s,...t.events?.[i]??{},schema:l},o.events[i]={name:f}}for(let[i,s]of Object.entries(t.definition.channels??{})){let l={};for(let[p,y]of Object.entries(s.messages)){let g=y.schema.dereference(a);l[p]={...y,schema:g}}let f=t.channels?.[i]?.name??i;r.channels[f]={...s,...t.channels?.[i]??{},message:{...s.message??{},tags:{...s.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...s.conversation??{},tags:{...s.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:f}}return{resolved:r,statement:o}};A();O();C();var Dh="4.20.2";var gn=Dh;A();O();C();var qo=Symbol("schemaName"),Hh=t=>t?Le.mapValues(t,(n,r)=>({...n,[qo]:r})):{},Uh=t=>qo in t&&t[qo]!==void 0,$h=t=>t[qo];A();O();C();var nl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:gn}}extend(e,n){let{entities:r,actions:o,events:a,channels:i}=this._callBuilder(e,n),s=this;s.interfaces??={};let l=Object.values(r).map(g=>g.name),f=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:p,statement:y}=Nh({...e,entities:r,actions:Le.stripUndefinedProps(o),events:Le.stripUndefinedProps(a),channels:Le.stripUndefinedProps(i)});return s.actions=Le.mergeRecords(s.actions??{},p.actions,this._mergeActions),s.channels=Le.mergeRecords(s.channels??{},p.channels,this._mergeChannels),s.events=Le.mergeRecords(s.events??{},p.events,this._mergeEvents),s.interfaces[f]={id:e.id,...y},this}_callBuilder(e,n){let o={entities:Hh(this.entities)},a=n(o),i=Le.pairs(a.entities).find(([l,f])=>!Uh(f));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:Le.mapValues(a.entities,l=>({name:$h(l),schema:l.schema})),actions:a.actions??{},events:a.events??{},channels:a.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:Gr(e.input.schema,n.input.schema)},output:{schema:Gr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:Gr(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=Le.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let a;return(e.message||n.message)&&(a={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:a}};_mergeMessage=(e,n)=>({schema:Gr(e.schema,n.schema)})};A();O();C();A();O();C();import{isApiError as RI,Client as MI,RuntimeError as Iv,InvalidPayloadError as NI}from"@botpress/client";A();O();C();import*as Zh from"@botpress/client";var Go={retries:3,retryCondition:t=>Zh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(iI(e.response?.headers??{})??t)*1e3},iI=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let n of e){let r=t[n];if(r!==void 0)return oI(String(r))}},oI=t=>{let e=aI(t)?sI(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},aI=t=>t.includes(" "),sI=t=>{let e=lI(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},lI=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};A();O();C();A();O();C();var ri=class{constructor(e){this._client=e}get _inner(){return this._client}createConversation=(e=>this._client.createConversation(e));getConversation=(e=>this._client.getConversation(e));listConversations=(e=>this._client.listConversations(e));getOrCreateConversation=(e=>this._client.getOrCreateConversation(e));updateConversation=(e=>this._client.updateConversation(e));deleteConversation=(e=>this._client.deleteConversation(e));listParticipants=(e=>this._client.listParticipants(e));addParticipant=(e=>this._client.addParticipant(e));getParticipant=(e=>this._client.getParticipant(e));removeParticipant=(e=>this._client.removeParticipant(e));createEvent=(e=>this._client.createEvent(e));getEvent=(e=>this._client.getEvent(e));listEvents=(e=>this._client.listEvents(e));createMessage=(e=>this._client.createMessage(e));getOrCreateMessage=(e=>this._client.getOrCreateMessage(e));getMessage=(e=>this._client.getMessage(e).then(n=>n));updateMessage=(e=>this._client.updateMessage(e).then(n=>n));listMessages=(e=>this._client.listMessages(e));deleteMessage=(e=>this._client.deleteMessage(e));createUser=(e=>this._client.createUser(e));getUser=(e=>this._client.getUser(e));listUsers=e=>this._client.listUsers(e);getOrCreateUser=(e=>this._client.getOrCreateUser(e));updateUser=(e=>this._client.updateUser(e));deleteUser=e=>this._client.deleteUser(e);getState=(e=>this._client.getState(e));setState=(e=>this._client.setState(e));getOrSetState=(e=>this._client.getOrSetState(e));patchState=(e=>this._client.patchState(e));configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e);trackAnalytics=e=>this._client.trackAnalytics(e)};A();O();C();var Vo=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};A();O();C();A();O();C();var yn="#",Jo="x-bot-id",jh="x-bot-user-id",Kh="x-integration-id",Lh="x-integration-alias",Fh="x-webhook-id",Wh="x-bp-configuration-type",Yo="x-bp-configuration",Xo="x-bp-operation",zh="x-bp-type";A();O();C();var It=t=>{throw t instanceof Error?t:new Error(t)};var YR=X.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),qh=t=>({botId:t[Jo]||It("Missing bot header"),botUserId:t[jh]||It("Missing bot user header"),integrationId:t[Kh]||It("Missing integration header"),integrationAlias:t[Lh]||It("Missing integration alias header"),webhookId:t[Fh]||It("Missing webhook header"),operation:t[Xo]||It("Missing operation header"),configurationType:t[Wh]??null,configuration:JSON.parse(q.from(t[Yo]||It("Missing configuration header"),"base64").toString("utf-8"))});A();O();C();A();O();C();A();O();C();A();O();C();var il={},Gh=!1;function Pl(){return Gh||(Gh=!0,il=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),il}var ol={},Vh=!1;function uI(){return Vh||(Vh=!0,ol=Error),ol}var al={},Jh=!1;function cI(){return Jh||(Jh=!0,al=EvalError),al}var sl={},Yh=!1;function fI(){return Yh||(Yh=!0,sl=RangeError),sl}var ll={},Xh=!1;function dI(){return Xh||(Xh=!0,ll=ReferenceError),ll}var ul={},Qh=!1;function yv(){return Qh||(Qh=!0,ul=SyntaxError),ul}var cl={},ev=!1;function Qo(){return ev||(ev=!0,cl=TypeError),cl}var fl={},tv=!1;function pI(){return tv||(tv=!0,fl=URIError),fl}var dl={},nv=!1;function gI(){if(nv)return dl;nv=!0;var t=typeof Symbol<"u"&&Symbol,e=Pl();return dl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},dl}var pl={},rv=!1;function yI(){if(rv)return pl;rv=!0;var t={__proto__:null,foo:{}},e=Object;return pl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},pl}var gl={},iv=!1;function mI(){if(iv)return gl;iv=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,f){for(var p=[],y=0;y<l.length;y+=1)p[y]=l[y];for(var g=0;g<f.length;g+=1)p[g+l.length]=f[g];return p},a=function(l,f){for(var p=[],y=f,g=0;y<l.length;y+=1,g+=1)p[g]=l[y];return p},i=function(s,l){for(var f="",p=0;p<s.length;p+=1)f+=s[p],p+1<s.length&&(f+=l);return f};return gl=function(l){var f=this;if(typeof f!="function"||e.apply(f)!==r)throw new TypeError(t+f);for(var p=a(arguments,1),y,g=function(){if(this instanceof y){var T=f.apply(this,o(p,arguments));return Object(T)===T?T:this}return f.apply(l,o(p,arguments))},h=n(0,f.length-p.length),v=[],P=0;P<h;P++)v[P]="$"+P;if(y=Function("binder","return function ("+i(v,",")+"){ return binder.apply(this,arguments); }")(g),f.prototype){var B=function(){};B.prototype=f.prototype,y.prototype=new B,B.prototype=null}return y},gl}var yl={},ov=!1;function Bl(){if(ov)return yl;ov=!0;var t=mI();return yl=Function.prototype.bind||t,yl}var ml={},av=!1;function hI(){if(av)return ml;av=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=Bl();return ml=n.call(t,e),ml}var hl={},sv=!1;function oi(){if(sv)return hl;sv=!0;var t,e=uI(),n=cI(),r=fI(),o=dI(),a=yv(),i=Qo(),s=pI(),l=Function,f=function(Ue){try{return l('"use strict"; return ('+Ue+").constructor;")()}catch{}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch{p=null}var y=function(){throw new i},g=p?(function(){try{return arguments.callee,y}catch{try{return p(arguments,"callee").get}catch{return y}}})():y,h=gI()(),v=yI()(),P=Object.getPrototypeOf||(v?function(Ue){return Ue.__proto__}:null),B={},T=typeof Uint8Array>"u"||!P?t:P(Uint8Array),S={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":h&&P?P([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":B,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!P?t:P(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&P?P(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":a,"%ThrowTypeError%":g,"%TypedArray%":T,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":s,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(P)try{null.error}catch(Ue){var E=P(P(Ue));S["%Error.prototype%"]=E}var H=function Ue(Pe){var Se;if(Pe==="%AsyncFunction%")Se=f("async function () {}");else if(Pe==="%GeneratorFunction%")Se=f("function* () {}");else if(Pe==="%AsyncGeneratorFunction%")Se=f("async function* () {}");else if(Pe==="%AsyncGenerator%"){var fe=Ue("%AsyncGeneratorFunction%");fe&&(Se=fe.prototype)}else if(Pe==="%AsyncIteratorPrototype%"){var ve=Ue("%AsyncGenerator%");ve&&P&&(Se=P(ve.prototype))}return S[Pe]=Se,Se},j={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},re=Bl(),ee=hI(),ge=re.call(Function.call,Array.prototype.concat),ae=re.call(Function.apply,Array.prototype.splice),ie=re.call(Function.call,String.prototype.replace),Oe=re.call(Function.call,String.prototype.slice),ze=re.call(Function.call,RegExp.prototype.exec),tt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ve=/\\(\\)?/g,Je=function(Pe){var Se=Oe(Pe,0,1),fe=Oe(Pe,-1);if(Se==="%"&&fe!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(fe==="%"&&Se!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var ve=[];return ie(Pe,tt,function(D,K,F,de){ve[ve.length]=F?ie(de,Ve,"$1"):K||D}),ve},ht=function(Pe,Se){var fe=Pe,ve;if(ee(j,fe)&&(ve=j[fe],fe="%"+ve[0]+"%"),ee(S,fe)){var D=S[fe];if(D===B&&(D=H(fe)),typeof D>"u"&&!Se)throw new i("intrinsic "+Pe+" exists, but is not available. Please file an issue!");return{alias:ve,name:fe,value:D}}throw new a("intrinsic "+Pe+" does not exist!")};return hl=function(Pe,Se){if(typeof Pe!="string"||Pe.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Se!="boolean")throw new i('"allowMissing" argument must be a boolean');if(ze(/^%?[^%]*%?$/,Pe)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var fe=Je(Pe),ve=fe.length>0?fe[0]:"",D=ht("%"+ve+"%",Se),K=D.name,F=D.value,de=!1,Te=D.alias;Te&&(ve=Te[0],ae(fe,ge([0,1],Te)));for(var M=1,k=!0;M<fe.length;M+=1){var Z=fe[M],Y=Oe(Z,0,1),oe=Oe(Z,-1);if((Y==='"'||Y==="'"||Y==="`"||oe==='"'||oe==="'"||oe==="`")&&Y!==oe)throw new a("property names with quotes must have matching quotes");if((Z==="constructor"||!k)&&(de=!0),ve+="."+Z,K="%"+ve+"%",ee(S,K))F=S[K];else if(F!=null){if(!(Z in F)){if(!Se)throw new i("base intrinsic for "+Pe+" exists, but the property is not available.");return}if(p&&M+1>=fe.length){var w=p(F,Z);k=!!w,k&&"get"in w&&!("originalValue"in w.get)?F=w.get:F=F[Z]}else k=ee(F,Z),F=F[Z];k&&!de&&(S[K]=F)}}return F},hl}var vl={},lv=!1;function El(){if(lv)return vl;lv=!0;var t=oi(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return vl=e,vl}var Tl={},uv=!1;function ea(){if(uv)return Tl;uv=!0;var t=oi(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return Tl=e,Tl}var _l={},cv=!1;function vI(){if(cv)return _l;cv=!0;var t=El(),e=yv(),n=Qo(),r=ea();return _l=function(a,i,s){if(!a||typeof a!="object"&&typeof a!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,f=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!r&&r(a,i);if(t)t(a,i,{configurable:p===null&&g?g.configurable:!p,enumerable:l===null&&g?g.enumerable:!l,value:s,writable:f===null&&g?g.writable:!f});else if(y||!l&&!f&&!p)a[i]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_l}var bl={},fv=!1;function TI(){if(fv)return bl;fv=!0;var t=El(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},bl=e,bl}var wl={},dv=!1;function _I(){if(dv)return wl;dv=!0;var t=oi(),e=vI(),n=TI()(),r=ea(),o=Qo(),a=t("%Math.floor%");return wl=function(s,l){if(typeof s!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||a(l)!==l)throw new o("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],p=!0,y=!0;if("length"in s&&r){var g=r(s,"length");g&&!g.configurable&&(p=!1),g&&!g.writable&&(y=!1)}return(p||y||!f)&&(n?e(s,"length",l,!0,!0):e(s,"length",l)),s},wl}var ii={},pv=!1;function Sl(){if(pv)return ii;pv=!0;var t=Bl(),e=oi(),n=_I(),r=Qo(),o=e("%Function.prototype.apply%"),a=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(a,o),s=El(),l=e("%Math.max%");ii=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,a,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var f=function(){return i(t,o,arguments)};return s?s(ii,"apply",{value:f}):ii.apply=f,ii}var xl={},gv=!1;function kl(){if(gv)return xl;gv=!0;var t=oi(),e=Sl(),n=e(t("String.prototype.indexOf"));return xl=function(o,a){var i=t(o,!!a);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},xl}as();xs();var Il={},mv=!1;function $l(){if(mv)return Il;mv=!0;var t=Pl();return Il=function(){return t()&&!!Symbol.toStringTag},Il}var Al={},hv=!1;function bI(){if(hv)return Al;hv=!0;var t=$l()(),e=kl(),n=e("Object.prototype.toString"),r=function(s){return t&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:n(s)==="[object Arguments]"},o=function(s){return r(s)?!0:s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&n(s)!=="[object Array]"&&n(s.callee)==="[object Function]"},a=(function(){return r(arguments)})();return r.isLegacyArguments=o,Al=a?r:o,Al}var Cl={},vv=!1;function wI(){if(vv)return Cl;vv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=$l()(),o=Object.getPrototypeOf,a=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Cl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var f=t.call(l);return f==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var p=a();i=p?o(p):!1}return o(l)===i},Cl}var Ol={},Tv=!1;function xI(){if(Tv)return Ol;Tv=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(S){S!==r&&(e=null)}else e=null;var o=/^\s*class\b/,a=function(E){try{var H=t.call(E);return o.test(H)}catch{return!1}},i=function(E){try{return a(E)?!1:(t.call(E),!0)}catch{return!1}},s=Object.prototype.toString,l="[object Object]",f="[object Function]",p="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",h="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var T=document.all;s.call(T)===s.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var H=s.call(E);return(H===y||H===g||H===h||H===l)&&E("")==null}catch{}return!1})}return Ol=e?function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,n)}catch(H){if(H!==r)return!1}return!a(E)&&i(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(v)return i(E);if(a(E))return!1;var H=s.call(E);return H!==f&&H!==p&&!/^\[object HTML/.test(H)?!1:i(E)},Ol}var Rl={},_v=!1;function PI(){if(_v)return Rl;_v=!0;var t=xI(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,f,p){for(var y=0,g=l.length;y<g;y++)n.call(l,y)&&(p==null?f(l[y],y,l):f.call(p,l[y],y,l))},o=function(l,f,p){for(var y=0,g=l.length;y<g;y++)p==null?f(l.charAt(y),y,l):f.call(p,l.charAt(y),y,l)},a=function(l,f,p){for(var y in l)n.call(l,y)&&(p==null?f(l[y],y,l):f.call(p,l[y],y,l))},i=function(l,f,p){if(!t(f))throw new TypeError("iterator must be a function");var y;arguments.length>=3&&(y=p),e.call(l)==="[object Array]"?r(l,f,y):typeof l=="string"?o(l,f,y):a(l,f,y)};return Rl=i,Rl}var Ml={},bv=!1;function BI(){return bv||(bv=!0,Ml=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ml}var Nl={},wv=!1,EI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function SI(){if(wv)return Nl;wv=!0;var t=BI(),e=typeof globalThis>"u"?EI:globalThis;return Nl=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},Nl}var Dl={},xv=!1,kI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function kv(){if(xv)return Dl;xv=!0;var t=PI(),e=SI(),n=Sl(),r=kl(),o=ea(),a=r("Object.prototype.toString"),i=$l()(),s=typeof globalThis>"u"?kI:globalThis,l=e(),f=r("String.prototype.slice"),p=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,T){for(var S=0;S<B.length;S+=1)if(B[S]===T)return S;return-1},g={__proto__:null};i&&o&&p?t(l,function(P){var B=new s[P];if(Symbol.toStringTag in B){var T=p(B),S=o(T,Symbol.toStringTag);if(!S){var E=p(T);S=o(E,Symbol.toStringTag)}g["$"+P]=n(S.get)}}):t(l,function(P){var B=new s[P],T=B.slice||B.set;T&&(g["$"+P]=n(T))});var h=function(B){var T=!1;return t(g,function(S,E){if(!T)try{"$"+S(B)===E&&(T=f(E,1))}catch{}}),T},v=function(B){var T=!1;return t(g,function(S,E){if(!T)try{S(B),T=f(E,1)}catch{}}),T};return Dl=function(B){if(!B||typeof B!="object")return!1;if(!i){var T=f(a(B),8,-1);return y(l,T)>-1?T:T!=="Object"?!1:v(B)}return o?h(B):null},Dl}var Hl={},Pv=!1;function II(){if(Pv)return Hl;Pv=!0;var t=kv();return Hl=function(n){return!!t(n)},Hl}var we={},Bv=!1;function AI(){if(Bv)return we;Bv=!0;var t=bI(),e=wI(),n=kv(),r=II();function o($){return $.call.bind($)}var a=typeof BigInt<"u",i=typeof Symbol<"u",s=o(Object.prototype.toString),l=o(Number.prototype.valueOf),f=o(String.prototype.valueOf),p=o(Boolean.prototype.valueOf);if(a)var y=o(BigInt.prototype.valueOf);if(i)var g=o(Symbol.prototype.valueOf);function h($,Ct){if(typeof $!="object")return!1;try{return Ct($),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function v($){return typeof Promise<"u"&&$ instanceof Promise||$!==null&&typeof $=="object"&&typeof $.then=="function"&&typeof $.catch=="function"}we.isPromise=v;function P($){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView($):r($)||D($)}we.isArrayBufferView=P;function B($){return n($)==="Uint8Array"}we.isUint8Array=B;function T($){return n($)==="Uint8ClampedArray"}we.isUint8ClampedArray=T;function S($){return n($)==="Uint16Array"}we.isUint16Array=S;function E($){return n($)==="Uint32Array"}we.isUint32Array=E;function H($){return n($)==="Int8Array"}we.isInt8Array=H;function j($){return n($)==="Int16Array"}we.isInt16Array=j;function re($){return n($)==="Int32Array"}we.isInt32Array=re;function ee($){return n($)==="Float32Array"}we.isFloat32Array=ee;function ge($){return n($)==="Float64Array"}we.isFloat64Array=ge;function ae($){return n($)==="BigInt64Array"}we.isBigInt64Array=ae;function ie($){return n($)==="BigUint64Array"}we.isBigUint64Array=ie;function Oe($){return s($)==="[object Map]"}Oe.working=typeof Map<"u"&&Oe(new Map);function ze($){return typeof Map>"u"?!1:Oe.working?Oe($):$ instanceof Map}we.isMap=ze;function tt($){return s($)==="[object Set]"}tt.working=typeof Set<"u"&&tt(new Set);function Ve($){return typeof Set>"u"?!1:tt.working?tt($):$ instanceof Set}we.isSet=Ve;function Je($){return s($)==="[object WeakMap]"}Je.working=typeof WeakMap<"u"&&Je(new WeakMap);function ht($){return typeof WeakMap>"u"?!1:Je.working?Je($):$ instanceof WeakMap}we.isWeakMap=ht;function Ue($){return s($)==="[object WeakSet]"}Ue.working=typeof WeakSet<"u"&&Ue(new WeakSet);function Pe($){return Ue($)}we.isWeakSet=Pe;function Se($){return s($)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function fe($){return typeof ArrayBuffer>"u"?!1:Se.working?Se($):$ instanceof ArrayBuffer}we.isArrayBuffer=fe;function ve($){return s($)==="[object DataView]"}ve.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&ve(new DataView(new ArrayBuffer(1),0,1));function D($){return typeof DataView>"u"?!1:ve.working?ve($):$ instanceof DataView}we.isDataView=D;var K=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F($){return s($)==="[object SharedArrayBuffer]"}function de($){return typeof K>"u"?!1:(typeof F.working>"u"&&(F.working=F(new K)),F.working?F($):$ instanceof K)}we.isSharedArrayBuffer=de;function Te($){return s($)==="[object AsyncFunction]"}we.isAsyncFunction=Te;function M($){return s($)==="[object Map Iterator]"}we.isMapIterator=M;function k($){return s($)==="[object Set Iterator]"}we.isSetIterator=k;function Z($){return s($)==="[object Generator]"}we.isGeneratorObject=Z;function Y($){return s($)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=Y;function oe($){return h($,l)}we.isNumberObject=oe;function w($){return h($,f)}we.isStringObject=w;function x($){return h($,p)}we.isBooleanObject=x;function z($){return a&&h($,y)}we.isBigIntObject=z;function Q($){return i&&h($,g)}we.isSymbolObject=Q;function Me($){return oe($)||w($)||x($)||z($)||Q($)}we.isBoxedPrimitive=Me;function _e($){return typeof Uint8Array<"u"&&(fe($)||de($))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function($){Object.defineProperty(we,$,{enumerable:!1,value:function(){throw new Error($+" is not supported in userland")}})}),we}var Ul={},Ev=!1;function CI(){return Ev||(Ev=!0,Ul=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Ul}var xe={},Sv=!1,ai=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function OI(){if(Sv)return xe;Sv=!0;var t=Rt,e=Object.getOwnPropertyDescriptors||function(K){for(var F=Object.keys(K),de={},Te=0;Te<F.length;Te++)de[F[Te]]=Object.getOwnPropertyDescriptor(K,F[Te]);return de},n=/%[sdj%]/g;xe.format=function(D){if(!j(D)){for(var K=[],F=0;F<arguments.length;F++)K.push(i(arguments[F]));return K.join(" ")}for(var F=1,de=arguments,Te=de.length,M=String(D).replace(n,function(Z){if(Z==="%%")return"%";if(F>=Te)return Z;switch(Z){case"%s":return String(de[F++]);case"%d":return Number(de[F++]);case"%j":try{return JSON.stringify(de[F++])}catch{return"[Circular]"}default:return Z}}),k=de[F];F<Te;k=de[++F])S(k)||!ae(k)?M+=" "+k:M+=" "+i(k);return M},xe.deprecate=function(D,K){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,K).apply(this||ai,arguments)};var F=!1;function de(){if(!F){if(t.throwDeprecation)throw new Error(K);t.traceDeprecation?console.trace(K):console.error(K),F=!0}return D.apply(this||ai,arguments)}return de};var r={},o=/^$/;if(t.env.NODE_DEBUG){var a=t.env.NODE_DEBUG;a=a.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+a+"$","i")}xe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(o.test(D)){var K=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,K,F)}}else r[D]=function(){};return r[D]};function i(D,K){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),T(K)?F.showHidden=K:K&&xe._extend(F,K),ee(F.showHidden)&&(F.showHidden=!1),ee(F.depth)&&(F.depth=2),ee(F.colors)&&(F.colors=!1),ee(F.customInspect)&&(F.customInspect=!0),F.colors&&(F.stylize=s),p(F,D,F.depth)}xe.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function s(D,K){var F=i.styles[K];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,K){return D}function f(D){var K={};return D.forEach(function(F,de){K[F]=!0}),K}function p(D,K,F){if(D.customInspect&&K&&ze(K.inspect)&&K.inspect!==xe.inspect&&!(K.constructor&&K.constructor.prototype===K)){var de=K.inspect(F,D);return j(de)||(de=p(D,de,F)),de}var Te=y(D,K);if(Te)return Te;var M=Object.keys(K),k=f(M);if(D.showHidden&&(M=Object.getOwnPropertyNames(K)),Oe(K)&&(M.indexOf("message")>=0||M.indexOf("description")>=0))return g(K);if(M.length===0){if(ze(K)){var Z=K.name?": "+K.name:"";return D.stylize("[Function"+Z+"]","special")}if(ge(K))return D.stylize(RegExp.prototype.toString.call(K),"regexp");if(ie(K))return D.stylize(Date.prototype.toString.call(K),"date");if(Oe(K))return g(K)}var Y="",oe=!1,w=["{","}"];if(B(K)&&(oe=!0,w=["[","]"]),ze(K)){var x=K.name?": "+K.name:"";Y=" [Function"+x+"]"}if(ge(K)&&(Y=" "+RegExp.prototype.toString.call(K)),ie(K)&&(Y=" "+Date.prototype.toUTCString.call(K)),Oe(K)&&(Y=" "+g(K)),M.length===0&&(!oe||K.length==0))return w[0]+Y+w[1];if(F<0)return ge(K)?D.stylize(RegExp.prototype.toString.call(K),"regexp"):D.stylize("[Object]","special");D.seen.push(K);var z;return oe?z=h(D,K,F,k,M):z=M.map(function(Q){return v(D,K,F,k,Q,oe)}),D.seen.pop(),P(z,Y,w)}function y(D,K){if(ee(K))return D.stylize("undefined","undefined");if(j(K)){var F="'"+JSON.stringify(K).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(K))return D.stylize(""+K,"number");if(T(K))return D.stylize(""+K,"boolean");if(S(K))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,K,F,de,Te){for(var M=[],k=0,Z=K.length;k<Z;++k)Pe(K,String(k))?M.push(v(D,K,F,de,String(k),!0)):M.push("");return Te.forEach(function(Y){Y.match(/^\d+$/)||M.push(v(D,K,F,de,Y,!0))}),M}function v(D,K,F,de,Te,M){var k,Z,Y;if(Y=Object.getOwnPropertyDescriptor(K,Te)||{value:K[Te]},Y.get?Y.set?Z=D.stylize("[Getter/Setter]","special"):Z=D.stylize("[Getter]","special"):Y.set&&(Z=D.stylize("[Setter]","special")),Pe(de,Te)||(k="["+Te+"]"),Z||(D.seen.indexOf(Y.value)<0?(S(F)?Z=p(D,Y.value,null):Z=p(D,Y.value,F-1),Z.indexOf(`
|
|
84
|
+
`,o+="})"}let a=n?o?n+o:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:o||(r?`z.record(${r})`:"z.record(z.any())");return Ye.an.anyOf(t)&&(a+=`.and(${Yg(N(b({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),Ye.a.oneOf(t)&&(a+=`.and(${rs(N(b({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),Ye.an.allOf(t)&&(a+=`.and(${Wr(N(b({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?N(b({},i),{type:"object"}):i)}),e)})`),a}d(Xg,"parseObject");var rB=d(t=>{var e;let n="z.string()";if((e=t[le])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";n="z.coerce.string()"}return n+=ut(t,"format",({value:r})=>{switch(r){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),n+=ut(t,"pattern",({json:r})=>[`.regex(new RegExp(${r})`,", ",")"]),n+=ut(t,"minLength",({json:r})=>[`.min(${r}`,", ",")"]),n+=ut(t,"maxLength",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseString"),iB=d((t,e)=>`${it(JP(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),oB=d(t=>`z.ref('${t.$ref}')`,"parseRef"),aB=d((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return rs(t,e);let o=t.oneOf.map((a,i)=>it(a,N(b({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${o.join(", ")}])`},"parseDiscriminator"),it=d((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let a=e.parserOverride(t,e);if(typeof a=="string")return a}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let o=uB(t,e);return n||(o=sB(t,o),e.withoutDefaults||(o=lB(t,o))),r.r=o,o},"parseSchema"),sB=d((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),lB=d((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),uB=d((t,e)=>Ye.a.nullable(t)?iB(t,e):Ye.an.object(t)?Xg(t,e):Ye.an.array(t)?XP(t,e):Ye.an.anyOf(t)?Yg(t,e):Ye.an.allOf(t)?Wr(t,e):Ye.a.discriminator(t)?aB(t,e):Ye.a.oneOf(t)?rs(t,e):Ye.a.not(t)?qP(t,e):Ye.an.enum(t)?eB(t):Ye.a.const(t)?QP(t):Ye.a.multipleType(t)?zP(t,e):Ye.a.primitive(t,"string")?rB(t):Ye.a.primitive(t,"number")||Ye.a.primitive(t,"integer")?nB(t):Ye.a.primitive(t,"boolean")?FP(t):Ye.a.primitive(t,"null")?GP(t):Ye.a.conditional(t)?tB(t,e):Ye.a.ref(t)?oB(t):WP(t),"selectParser"),Ye={an:{object:d(t=>t.type==="object","object"),array:d(t=>t.type==="array","array"),anyOf:d(t=>t.anyOf!==void 0,"anyOf"),allOf:d(t=>t.allOf!==void 0,"allOf"),enum:d(t=>t.enum!==void 0,"enum")},a:{nullable:d(t=>t.nullable===!0,"nullable"),multipleType:d(t=>Array.isArray(t.type),"multipleType"),not:d(t=>t.not!==void 0,"not"),const:d(t=>t.const!==void 0,"const"),primitive:d((t,e)=>t.type===e,"primitive"),conditional:d(t=>!!("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:d(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:d(t=>t.oneOf!==void 0,"oneOf"),ref:d(t=>t.$ref!==void 0,"ref")}},cB=d(t=>{let e;try{e=new Function("z",`return ${t}`)(R)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof R.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),fB=d(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),dB=d(t=>{let e=fB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=cB(e);if(!n.sucess)throw new lo(n.error);return n.value},"jsonSchemaToZod"),Rr=d((t,e)=>{var n,r;if(e[le]&&t._def&&(t.naked()._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([o,a])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[o]&&Rr(i[o],a)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Rr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let o=e.items;if(typeof o=="object"&&!Array.isArray(o)){let a=t._def.type;a&&Rr(a,o)}else Array.isArray(o)&&o.forEach((a,i)=>{let s=t._def;s.typeName===X.ZodFirstPartyTypeKind.ZodTuple&&Rr(s.items[i],a)})}},"applyZuiPropsRecursively"),pB=d(t=>{let e=dB(t);return Rr(e,t),e},"fromJSONSchemaLegacy"),gB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Qg(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),yB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&r.type==="null")&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),Qg=d(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),mB=d(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===R.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),hB=d(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:o,multipleOf:a,format:i})=>{let s=R.number();return t==="integer"&&(s=s.int()),i==="finite"&&(s=s.finite()),n!==void 0?s=s.gt(n):e!==void 0&&(s=s.gte(e)),o!==void 0?s=s.lt(o):r!==void 0&&(s=s.lte(r)),a!==void 0&&(s=s.multipleOf(a)),s},"numberJSONSchemaToZuiNumber"),vB=d(({format:t,pattern:e,minLength:n,maxLength:r})=>{let o=R.string();if(n&&r&&n===r?o=o.length(n):(n&&(o=o.min(n)),r&&(o=o.max(r))),t==="cuid"||e===Xe.cuid)o=o.cuid();else if(t==="cuid2"||e===Xe.cuid2)o=o.cuid2();else if(t==="emoji"||e===Xe.emoji)o=o.emoji();else if(t==="ulid"||e===Xe.ulid)o=o.ulid();else if(t==="date-time"){let{precision:a,offset:i}=e?Cx(e):{};o=o.datetime({precision:a,offset:i})}else t==="email"||e===Xe.email?o=o.email():t==="ipv4"||e===Xe.ipv4?o=o.ip():t==="ipv6"||e===Xe.ipv6?o=o.ip("v6"):t==="uri"?o=o.url():t==="uuid"||e===Xe.uuid?o=o.uuid():e&&(o=o.regex(new RegExp(e)));return o},"stringJSONSchemaToZuiString"),br=d((t,e)=>{let n=[];e.enum!==void 0&&n.push(...e.enum),e.const!==void 0&&n.push(e.const);let r=n.filter(i=>typeof i===t),[o]=r;if(!o){if(t==="string"&&e.type==="string")return vB(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return hB(e);if(t==="boolean")return R.boolean();if(t==="null")return R.null();throw new lo(`Unknown primitive type: "${t}"`)}if(r.length===1)return R.literal(o);let a=r.map(i=>R.literal(i));return R.union(a)},"toZuiPrimitive"),TB=d((t,e)=>_B(t)?wB(t,e):bB(t)?xB(t,e):PB(t,e),"arrayJSONSchemaToZuiArray"),_B=d(t=>Array.isArray(t.items),"_isTuple"),bB=d(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),wB=d(({items:t,additionalItems:e},n)=>{let r=t.map(n),o=R.tuple(r);return e!==void 0&&(o=o.rest(n(e))),o},"_handleTuple"),xB=d(({items:t,minItems:e,maxItems:n},r)=>{let o=R.set(r(t));return e&&(o=o.min(e)),n&&(o=o.max(n)),o},"_handleSet"),PB=d(({minItems:t,maxItems:e,items:n},r)=>{let o=R.array(r(n));return t&&t===e?o.length(t):(t&&(o=o.min(t)),e&&(o=o.max(e)),o)},"_handleArray"),zn=R.any();function ey(t){return rt(t)}d(ey,"fromJSONSchema");function rt(t){var e;if(t===void 0)return zn;if(t===!0)return R.any();if(t===!1)return R.never();if(t.default!==void 0)return rt(N(b({},t),{default:void 0})).default(t.default);if(t.readOnly)return rt(N(b({},t),{readOnly:void 0})).readonly();if(t.oneOf!==void 0)throw new an({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new an({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new an({propertyNames:t.propertyNames});if(t.if!==void 0)throw new an({if:t.if});if(t.then!==void 0)throw new an({then:t.then});if(t.else!==void 0)throw new an({else:t.else});if(t.$ref!==void 0)return R.ref(t.$ref);if(t.not!==void 0){if(Qg(t))return R.undefined();if(t.not===!0)return R.never();throw new an({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return zn;if(t.type.length===1)return rt(N(b({},t),{type:t.type[0]}));let n=t,{type:r}=n,o=rf(n,["type"]),a=t.type.map(i=>rt(N(b({},o),{type:i})));return R.union(a)}if(t.type==="string")return t.enum&&t.enum.length>0?R.enum(t.enum):br("string",t);if(t.type==="integer"){let n=br("number",t);return n instanceof R.ZodNumber?n.int():n}if(t.type==="number")return br("number",t);if(t.type==="boolean")return br("boolean",t);if(t.type==="null")return br("null",t);if(t.type==="array")return TB(t,rt);if(t.type==="object"){if(t.additionalProperties!==void 0&&t.properties!==void 0){let n=rt(t.additionalProperties);return rt(N(b({},t),{additionalProperties:void 0})).catchall(n)}if(t.properties!==void 0){let n={};for(let[r,o]of Object.entries(t.properties)){let a=rt(o),i=(e=t.required)!=null?e:[];n[r]=i.includes(r)?a:a.optional()}return R.object(n)}if(t.additionalProperties!==void 0){let n=rt(t.additionalProperties);return R.record(n)}return R.record(zn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return zn;if(t.anyOf.length===1)return rt(t.anyOf[0]);if(gB(t))return rt(t.anyOf[0]).optional();if(yB(t))return rt(t.anyOf[0]).nullable();let n=t.anyOf.map(rt);return R.union(n)}if(t.allOf!==void 0){if(t.allOf.length===0)return zn;if(t.allOf.length===1)return rt(t.allOf[0]);let[n,...r]=t.allOf,o=rt(n),a=rt({allOf:r});return R.intersection(o,a)}return mB(t)?R.unknown():zn}d(rt,"_fromJSONSchema");var BB=/^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/,Ba=d((t,e,n=!0)=>{if(typeof t!="object")throw new pa("Input must be an object");let r=d(i=>{let s=i;return e?.nullable&&(s=s.nullable()),e?.optional&&(s=s.optional()),e?.passtrough&&typeof s.passthrough=="function"&&(s=s.passthrough()),s},"applyOptions"),o=Object.entries(t).reduce((i,[s,l])=>{if(l===null)i[s]=r(X.null());else switch(typeof l){case"string":i[s]=BB.test(l)?r(X.string().datetime()):r(X.string());break;case"number":i[s]=r(X.number());break;case"boolean":i[s]=r(X.boolean());break;case"object":Array.isArray(l)?l.length===0?i[s]=r(X.array(X.unknown())):typeof l[0]=="object"?i[s]=r(X.array(Ba(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[s]=r(X.array(X[typeof l[0]]()))):i[s]=r(Ba(l,e,!1));break;default:throw new pa(`Unsupported type for key ${s}`)}return i},{}),a=Object.keys(o).length>0;return e?.passtrough||!n&&!a?X.object(o).passthrough():X.object(o)},"fromObject");function ty(){return{}}d(ty,"parseAnyDef");function ny(t,e){var n,r;let o={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!=="ZodAny"&&(o.items=Ie(t.type._def,N(b({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Re(o,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(o,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(o,"minItems",t.exactLength.value,t.exactLength.message,e),Re(o,"maxItems",t.exactLength.value,t.exactLength.message,e)),o}d(ny,"parseArrayDef");function ry(t,e){let n=b({type:"integer",format:"int64"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"?r.inclusive?Re(n,"minimum",r.value,r.message,e):Re(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Re(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Re(n,"maximum",r.value,r.message,e):Re(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Re(n,"maximum",r.value,r.message,e));break;case"multipleOf":Re(n,"multipleOf",r.value,r.message,e);break}return n}d(ry,"parseBigintDef");function iy(t){return b({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(iy,"parseBooleanDef");function oy(t,e){return Ie(t.type._def,e)}d(oy,"parseBrandedDef");var EB=d((t,e)=>Ie(t.innerType._def,e),"parseCatchDef");function ay(t,e){return e.dateStrategy=="integer"?SB(t,e):b({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(ay,"parseDateDef");var SB=d((t,e)=>{let n=b({type:"integer",format:"unix-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"&&Re(n,"minimum",r.value,r.message,e);break;case"max":e.target==="jsonSchema7"&&Re(n,"maximum",r.value,r.message,e);break}return n},"integerDateParser");function sy(t,e){return N(b({},Ie(t.innerType._def,e)),{default:t.defaultValue()})}d(sy,"parseDefaultDef");function ly(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):{}}d(ly,"parseEffectsDef");function uy(t){return{type:"string",enum:t.values}}d(uy,"parseEnumDef");var kB=d(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function cy(t,e){let n=[Ie(t.left._def,N(b({},e),{currentPath:[...e.currentPath,"allOf","0"]})),Ie(t.right._def,N(b({},e),{currentPath:[...e.currentPath,"allOf","1"]}))].filter(a=>!!a),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(a=>{if(kB(a))o.push(...a.allOf),a.unevaluatedProperties===void 0&&(r=void 0);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let s=a,{additionalProperties:l}=s;i=rf(s,["additionalProperties"])}else r=void 0;o.push(i)}}),o.length?b({allOf:o},r):void 0}d(cy,"parseIntersectionDef");function fy(t,e){let n=typeof t.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[t.value]}:{type:n==="bigint"?"integer":n,const:t.value}}d(fy,"parseLiteralDef");function is(t,e){var n,r,o,a,i;if(e.target==="openApi3"&&((n=t.keyType)==null?void 0:n._def.typeName)==="ZodEnum")return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((l,f)=>{var p;return N(b({},l),{[f]:(p=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"properties",f]})))!=null?p:{}})},{}),additionalProperties:!1};let s={type:"object",additionalProperties:(r=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return s;if(((o=t.keyType)==null?void 0:o._def.typeName)==="ZodString"&&((a=t.keyType._def.checks)!=null&&a.length)){let l=Object.entries(ja(t.keyType._def,e)).reduce((f,[p,y])=>p==="type"?f:N(b({},f),{[p]:y}),{});return N(b({},s),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(b({},s),{propertyNames:{enum:t.keyType._def.values}});return s}d(is,"parseRecordDef");function dy(t,e){if(e.mapStrategy==="record")return is(t,e);let n=Ie(t.keyType._def,N(b({},e),{currentPath:[...e.currentPath,"items","items","0"]}))||{},r=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"items","items","1"]}))||{};return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}d(dy,"parseMapDef");function py(t){let e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),o=Array.from(new Set(r.map(a=>typeof a)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r.filter(a=>typeof a=="string"||typeof a=="number")}}d(py,"parseNativeEnumDef");function gy(){return{not:{}}}d(gy,"parseNeverDef");function yy(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}d(yy,"parseNullDef");var ao={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function my(t,e){if(e.target==="openApi3")return Qc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in ao&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,a)=>{let i=ao[a._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,a)=>{let i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(a._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((a,i,s)=>s.indexOf(a)===i);return{type:o.length>1?o:o[0],enum:n.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(a=>!r.includes(a))],[])};return Qc(t,e)}d(my,"parseUnionDef");var Qc=d((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((o,a)=>Ie(o._def,N(b({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${a}`]}))).filter(o=>!!o&&(!e.strictUnions||typeof o=="object"&&Object.keys(o).length>0)),r=e.discriminator&&t.typeName==="ZodDiscriminatedUnion"&&typeof t.discriminator=="string"?{discriminator:{propertyName:t.discriminator}}:{};if(n.length)return e.unionStrategy==="anyOf"?b({anyOf:n},r):b({oneOf:n},r)},"asUnionOf");function hy(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length)){let r=t.innerType;if(e.target==="openApi3"){let a={type:ao[r._def.typeName],nullable:!0};return Ea(r._def,e,a)}let o={type:[ao[r._def.typeName],"null"]};return Ea(r._def,e,o)}if(e.target==="openApi3"){let r=Ie(t.innerType._def,N(b({},e),{currentPath:[...e.currentPath]}));return r&&N(b({},r),{nullable:!0})}let n=Ie(t.innerType._def,N(b({},e),{currentPath:[...e.currentPath,"anyOf","0"]}));return n&&{anyOf:[n,{type:"null"}]}}d(hy,"parseNullableDef");function vy(t,e){let n=b({type:"number"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",Za(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?Re(n,"minimum",r.value,r.message,e):Re(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),Re(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?Re(n,"maximum",r.value,r.message,e):Re(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),Re(n,"maximum",r.value,r.message,e));break;case"multipleOf":Re(n,"multipleOf",r.value,r.message,e);break}return n}d(vy,"parseNumberDef");var IB=d((t,e)=>{var n;return t.unknownKeys instanceof he?(n=Ie(t.unknownKeys._def,N(b({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?n:!0:t.unknownKeys==="passthrough"},"getAdditionalProperties");function Ty(t,e){let n=N(b({type:"object"},Object.entries(t.shape()).reduce((r,[o,a])=>{if(a===void 0||a._def===void 0)return r;let i=Ie(a._def,N(b({},e),{currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]}));return i===void 0?r:{properties:N(b({},r.properties),{[o]:i}),required:a.isOptional()?r.required:[...r.required,o]}},{properties:{},required:[]})),{additionalProperties:IB(t,e)});return n.required.length||delete n.required,n}d(Ty,"parseObjectDef");var AB=d((t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return Ie(t.innerType._def,e);let r=Ie(t.innerType._def,N(b({},e),{currentPath:[...e.currentPath,"anyOf","1"]}));return r?{anyOf:[{not:{}},r]}:{}},"parseOptionalDef"),CB=d((t,e)=>{if(e.pipeStrategy==="input")return Ie(t.in._def,e);if(e.pipeStrategy==="output")return Ie(t.out._def,e);let n=Ie(t.in._def,N(b({},e),{currentPath:[...e.currentPath,"allOf","0"]})),r=Ie(t.out._def,N(b({},e),{currentPath:[...e.currentPath,"allOf",n?"1":"0"]}));return{allOf:[n,r].filter(o=>o!==void 0)}},"parsePipelineDef");function _y(t,e){return Ie(t.type._def,e)}d(_y,"parsePromiseDef");function by(t,e){let r={type:"array",uniqueItems:!0,items:Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"items"]}))};return t.minSize&&Re(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Re(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}d(by,"parseSetDef");function wy(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(b({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Ie(t.rest._def,N(b({},e),{currentPath:[...e.currentPath,"additionalItems"]}))}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Ie(n._def,N(b({},e),{currentPath:[...e.currentPath,"items",`${r}`]}))).reduce((n,r)=>r===void 0?n:[...n,r],[])}}d(wy,"parseTupleDef");function xy(){return{not:{}}}d(xy,"parseUndefinedDef");function Py(){return{}}d(Py,"parseUnknownDef");var OB=d((t,e)=>Ie(t.innerType._def,e),"parseReadonlyDef");function By(t){return{$ref:t.uri}}d(By,"parseRefDef");function Ie(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=RB(r,e);if(i!==void 0)return i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let a=NB(t,t.typeName,e);return a&&Ea(t,e,a),o.jsonSchema=a,a}d(Ie,"parseDef");var RB=d((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:MB(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},"get$ref"),MB=d((t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")},"getRelativePath"),NB=d((t,e,n)=>{switch(e){case"ZodString":return ja(t,n);case"ZodNumber":return vy(t,n);case"ZodObject":return Ty(t,n);case"ZodBigInt":return ry(t,n);case"ZodBoolean":return iy(t);case"ZodDate":return ay(t,n);case"ZodUndefined":return xy();case"ZodNull":return yy(n);case"ZodArray":return ny(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return my(t,n);case"ZodIntersection":return cy(t,n);case"ZodTuple":return wy(t,n);case"ZodRecord":return is(t,n);case"ZodRef":return By(t);case"ZodLiteral":return fy(t,n);case"ZodEnum":return uy(t);case"ZodNativeEnum":return py(t);case"ZodNullable":return hy(t,n);case"ZodOptional":return AB(t,n);case"ZodMap":return dy(t,n);case"ZodSet":return by(t,n);case"ZodLazy":return Ie(t.getter()._def,n);case"ZodPromise":return _y(t,n);case"ZodNaN":case"ZodNever":return gy();case"ZodEffects":return ly(t,n);case"ZodAny":return ty();case"ZodUnknown":return Py();case"ZodDefault":return sy(t,n);case"ZodBranded":return oy(t,n);case"ZodReadonly":return OB(t,n);case"ZodCatch":return EB(t,n);case"ZodPipeline":return CB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),Ea=d((t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),Object.assign(n,{[le]:b(b({},t[le]),n[le])}),n),"addMeta"),ef={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"string",mapStrategy:"entries",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",discriminator:!1,unionStrategy:"anyOf"},DB=d(t=>typeof t=="string"?N(b({},ef),{name:t}):b(b({},ef),t),"getDefaultOptions"),HB=d(t=>{let e=DB(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return N(b({},e),{currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),UB=d((t,e)=>{var n;let r=HB(e),o=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,p])=>{var y;return N(b({},l),{[f]:(y=Ie(p._def,N(b({},r),{currentPath:[...r.basePath,r.definitionPath,f]}),!0))!=null?y:{}})},{}):void 0,a=typeof e=="string"?e:e?.name,i=(n=Ie(t._def,a===void 0?r:N(b({},r),{currentPath:[...r.basePath,r.definitionPath,a]}),!1))!=null?n:{},s=a===void 0?o?N(b({},i),{[r.definitionPath]:o}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:N(b({},o),{[a]:i})};return r.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),s},"zodToJsonSchema"),$B=d((t,e={target:"openApi3"})=>{let n=UB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy");var Gr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===X.ZodFirstPartyTypeKind.ZodObject&&r.typeName===X.ZodFirstPartyTypeKind.ZodObject){let o=n.shape(),a=r.shape();return X.object({...o,...a})}if(n.typeName===X.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===X.ZodFirstPartyTypeKind.ZodRecord)return X.record(X.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},Ey=X;var mt=X.string().min(1),ky=X.object({text:mt}),Iy=X.object({markdown:mt}),Ay=X.object({imageUrl:mt}),Cy=X.object({audioUrl:mt}),Oy=X.object({videoUrl:mt}),Ry=X.object({fileUrl:mt,title:mt.optional()}),My=X.object({latitude:X.number(),longitude:X.number(),address:X.string().optional(),title:X.string().optional()}),Ny=X.object({title:mt,subtitle:mt.optional(),imageUrl:mt.optional(),actions:X.array(X.object({action:X.enum(["postback","url","say"]),label:mt,value:mt}))}),Sy=X.object({text:mt,options:X.array(X.object({label:mt,value:mt}))}),ZB=X.object({items:X.array(Ny)}),Dy=X.union([X.object({type:X.literal("text"),payload:ky}),X.object({type:X.literal("image"),payload:Ay}),X.object({type:X.literal("audio"),payload:Cy}),X.object({type:X.literal("video"),payload:Oy}),X.object({type:X.literal("file"),payload:Ry}),X.object({type:X.literal("location"),payload:My})]),jB=X.object({items:X.array(Dy)}),KB={schema:Iy},LB={schema:X.object({items:X.array(X.union([...Dy.options,X.object({type:X.literal("markdown"),payload:Iy})]))})},FB={text:{schema:ky},image:{schema:Ay},audio:{schema:Cy},video:{schema:Oy},file:{schema:Ry},location:{schema:My},carousel:{schema:ZB},card:{schema:Ny},dropdown:{schema:Sy},choice:{schema:Sy},bloc:{schema:jB}};A();O();C();var dC={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};A();O();C();import{isNode as Wk}from"browser-or-node";A();O();C();var os=console;function Mt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Wo(t,e=8072,n=Vk){if(!Wk)throw new Error("This function can only be called in Node.js");let o=(Nh(),Vv(Mh)).createServer(async(a,i)=>{try{let s=await zk(a);if(s.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(s);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(s){let l=s instanceof Error?s.message:String(s);os.error("Error while handling request",{error:l??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:l??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function zk(t){let e=await Gk(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let a=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[a]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:qk(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function qk(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function Gk(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function Vk(t){os.info(`Listening on port ${t}`)}import{isApiError as NU,RuntimeError as DU}from"@botpress/client";A();O();C();A();O();C();A();O();C();A();O();C();var Le={};hn(Le,{mapKeys:()=>Xk,mapValues:()=>Yk,mergeRecords:()=>eI,pairs:()=>zo,stripUndefinedProps:()=>Qk,values:()=>Jk});A();O();C();var zo=t=>Object.entries(t),Jk=t=>Object.values(t),Yk=(t,e)=>Object.fromEntries(zo(t).map(([n,r])=>[n,e(r,n)])),Xk=(t,e)=>Object.fromEntries(zo(t).map(([n,r])=>[e(n),r])),Qk=t=>Object.fromEntries(zo(t).filter(([,e])=>e!==void 0)),eI=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],a={};for(let i of o){let s=t[i],l=e[i];s&&l?a[i]=n(s,l):s?a[i]=s:l&&(a[i]=l)}return a};var ye={};hn(ye,{safePush:()=>tI,unique:()=>nI});A();O();C();var tI=(t,...e)=>t?[...t,...e]:[...e],nI=t=>Array.from(new Set(t));A();O();C();var ft={};hn(ft,{setName:()=>rI});A();O();C();var rI=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Dh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:Le.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},a=Le.mapValues(t.entities,i=>i.schema);for(let[i,s]of Object.entries(t.definition.actions??{})){let l=s.input.schema.dereference(a),f=s.output.schema.dereference(a),p=t.actions?.[i]?.name??i;r.actions[p]={...s,...t.actions?.[i]??{},input:{schema:l},output:{schema:f}},o.actions[i]={name:p}}for(let[i,s]of Object.entries(t.definition.events??{})){let l=s.schema.dereference(a),f=t.events?.[i]?.name??i;r.events[f]={...s,...t.events?.[i]??{},schema:l},o.events[i]={name:f}}for(let[i,s]of Object.entries(t.definition.channels??{})){let l={};for(let[p,y]of Object.entries(s.messages)){let g=y.schema.dereference(a);l[p]={...y,schema:g}}let f=t.channels?.[i]?.name??i;r.channels[f]={...s,...t.channels?.[i]??{},message:{...s.message??{},tags:{...s.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...s.conversation??{},tags:{...s.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:f}}return{resolved:r,statement:o}};A();O();C();var Hh="4.21.0";var gn=Hh;A();O();C();var qo=Symbol("schemaName"),Uh=t=>t?Le.mapValues(t,(n,r)=>({...n,[qo]:r})):{},$h=t=>qo in t&&t[qo]!==void 0,Zh=t=>t[qo];A();O();C();var nl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced,this.attributes=e.attributes}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;get metadata(){return{sdkVersion:gn}}extend(e,n){let{entities:r,actions:o,events:a,channels:i}=this._callBuilder(e,n),s=this;s.interfaces??={};let l=Object.values(r).map(g=>g.name),f=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:p,statement:y}=Dh({...e,entities:r,actions:Le.stripUndefinedProps(o),events:Le.stripUndefinedProps(a),channels:Le.stripUndefinedProps(i)});return s.actions=Le.mergeRecords(s.actions??{},p.actions,this._mergeActions),s.channels=Le.mergeRecords(s.channels??{},p.channels,this._mergeChannels),s.events=Le.mergeRecords(s.events??{},p.events,this._mergeEvents),s.interfaces[f]={id:e.id,...y},this}_callBuilder(e,n){let o={entities:Uh(this.entities)},a=n(o),i=Le.pairs(a.entities).find(([l,f])=>!$h(f));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:Le.mapValues(a.entities,l=>({name:Zh(l),schema:l.schema})),actions:a.actions??{},events:a.events??{},channels:a.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:Gr(e.input.schema,n.input.schema)},output:{schema:Gr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:Gr(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=Le.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let a;return(e.message||n.message)&&(a={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:a}};_mergeMessage=(e,n)=>({schema:Gr(e.schema,n.schema)})};A();O();C();A();O();C();import{isApiError as MI,Client as NI,RuntimeError as Av,InvalidPayloadError as DI}from"@botpress/client";A();O();C();import*as jh from"@botpress/client";var Go={retries:3,retryCondition:t=>jh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(oI(e.response?.headers??{})??t)*1e3},oI=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let n of e){let r=t[n];if(r!==void 0)return aI(String(r))}},aI=t=>{let e=sI(t)?lI(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},sI=t=>t.includes(" "),lI=t=>{let e=uI(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},uI=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};A();O();C();A();O();C();var ri=class{constructor(e){this._client=e}get _inner(){return this._client}createConversation=(e=>this._client.createConversation(e));getConversation=(e=>this._client.getConversation(e));listConversations=(e=>this._client.listConversations(e));getOrCreateConversation=(e=>this._client.getOrCreateConversation(e));updateConversation=(e=>this._client.updateConversation(e));deleteConversation=(e=>this._client.deleteConversation(e));listParticipants=(e=>this._client.listParticipants(e));addParticipant=(e=>this._client.addParticipant(e));getParticipant=(e=>this._client.getParticipant(e));removeParticipant=(e=>this._client.removeParticipant(e));createEvent=(e=>this._client.createEvent(e));getEvent=(e=>this._client.getEvent(e));listEvents=(e=>this._client.listEvents(e));createMessage=(e=>this._client.createMessage(e));getOrCreateMessage=(e=>this._client.getOrCreateMessage(e));getMessage=(e=>this._client.getMessage(e).then(n=>n));updateMessage=(e=>this._client.updateMessage(e).then(n=>n));listMessages=(e=>this._client.listMessages(e));deleteMessage=(e=>this._client.deleteMessage(e));createUser=(e=>this._client.createUser(e));getUser=(e=>this._client.getUser(e));listUsers=e=>this._client.listUsers(e);getOrCreateUser=(e=>this._client.getOrCreateUser(e));updateUser=(e=>this._client.updateUser(e));deleteUser=e=>this._client.deleteUser(e);getState=(e=>this._client.getState(e));setState=(e=>this._client.setState(e));getOrSetState=(e=>this._client.getOrSetState(e));patchState=(e=>this._client.patchState(e));configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e);trackAnalytics=e=>this._client.trackAnalytics(e)};A();O();C();var Vo=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};A();O();C();A();O();C();var yn="#",Jo="x-bot-id",Kh="x-bot-user-id",Lh="x-integration-id",Fh="x-integration-alias",Wh="x-webhook-id",zh="x-bp-configuration-type",Yo="x-bp-configuration",Xo="x-bp-operation",qh="x-bp-type";A();O();C();var It=t=>{throw t instanceof Error?t:new Error(t)};var XR=X.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Gh=t=>({botId:t[Jo]||It("Missing bot header"),botUserId:t[Kh]||It("Missing bot user header"),integrationId:t[Lh]||It("Missing integration header"),integrationAlias:t[Fh]||It("Missing integration alias header"),webhookId:t[Wh]||It("Missing webhook header"),operation:t[Xo]||It("Missing operation header"),configurationType:t[zh]??null,configuration:JSON.parse(q.from(t[Yo]||It("Missing configuration header"),"base64").toString("utf-8"))});A();O();C();A();O();C();A();O();C();A();O();C();var il={},Vh=!1;function Pl(){return Vh||(Vh=!0,il=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),il}var ol={},Jh=!1;function cI(){return Jh||(Jh=!0,ol=Error),ol}var al={},Yh=!1;function fI(){return Yh||(Yh=!0,al=EvalError),al}var sl={},Xh=!1;function dI(){return Xh||(Xh=!0,sl=RangeError),sl}var ll={},Qh=!1;function pI(){return Qh||(Qh=!0,ll=ReferenceError),ll}var ul={},ev=!1;function mv(){return ev||(ev=!0,ul=SyntaxError),ul}var cl={},tv=!1;function Qo(){return tv||(tv=!0,cl=TypeError),cl}var fl={},nv=!1;function gI(){return nv||(nv=!0,fl=URIError),fl}var dl={},rv=!1;function yI(){if(rv)return dl;rv=!0;var t=typeof Symbol<"u"&&Symbol,e=Pl();return dl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},dl}var pl={},iv=!1;function mI(){if(iv)return pl;iv=!0;var t={__proto__:null,foo:{}},e=Object;return pl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},pl}var gl={},ov=!1;function hI(){if(ov)return gl;ov=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,f){for(var p=[],y=0;y<l.length;y+=1)p[y]=l[y];for(var g=0;g<f.length;g+=1)p[g+l.length]=f[g];return p},a=function(l,f){for(var p=[],y=f,g=0;y<l.length;y+=1,g+=1)p[g]=l[y];return p},i=function(s,l){for(var f="",p=0;p<s.length;p+=1)f+=s[p],p+1<s.length&&(f+=l);return f};return gl=function(l){var f=this;if(typeof f!="function"||e.apply(f)!==r)throw new TypeError(t+f);for(var p=a(arguments,1),y,g=function(){if(this instanceof y){var T=f.apply(this,o(p,arguments));return Object(T)===T?T:this}return f.apply(l,o(p,arguments))},h=n(0,f.length-p.length),v=[],P=0;P<h;P++)v[P]="$"+P;if(y=Function("binder","return function ("+i(v,",")+"){ return binder.apply(this,arguments); }")(g),f.prototype){var B=function(){};B.prototype=f.prototype,y.prototype=new B,B.prototype=null}return y},gl}var yl={},av=!1;function Bl(){if(av)return yl;av=!0;var t=hI();return yl=Function.prototype.bind||t,yl}var ml={},sv=!1;function vI(){if(sv)return ml;sv=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=Bl();return ml=n.call(t,e),ml}var hl={},lv=!1;function oi(){if(lv)return hl;lv=!0;var t,e=cI(),n=fI(),r=dI(),o=pI(),a=mv(),i=Qo(),s=gI(),l=Function,f=function(Ue){try{return l('"use strict"; return ('+Ue+").constructor;")()}catch{}},p=Object.getOwnPropertyDescriptor;if(p)try{p({},"")}catch{p=null}var y=function(){throw new i},g=p?(function(){try{return arguments.callee,y}catch{try{return p(arguments,"callee").get}catch{return y}}})():y,h=yI()(),v=mI()(),P=Object.getPrototypeOf||(v?function(Ue){return Ue.__proto__}:null),B={},T=typeof Uint8Array>"u"||!P?t:P(Uint8Array),S={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":h&&P?P([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":B,"%AsyncGenerator%":B,"%AsyncGeneratorFunction%":B,"%AsyncIteratorPrototype%":B,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":B,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&P?P(P([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!P?t:P(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!P?t:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&P?P(""[Symbol.iterator]()):t,"%Symbol%":h?Symbol:t,"%SyntaxError%":a,"%ThrowTypeError%":g,"%TypedArray%":T,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":s,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(P)try{null.error}catch(Ue){var E=P(P(Ue));S["%Error.prototype%"]=E}var H=function Ue(Pe){var Se;if(Pe==="%AsyncFunction%")Se=f("async function () {}");else if(Pe==="%GeneratorFunction%")Se=f("function* () {}");else if(Pe==="%AsyncGeneratorFunction%")Se=f("async function* () {}");else if(Pe==="%AsyncGenerator%"){var fe=Ue("%AsyncGeneratorFunction%");fe&&(Se=fe.prototype)}else if(Pe==="%AsyncIteratorPrototype%"){var ve=Ue("%AsyncGenerator%");ve&&P&&(Se=P(ve.prototype))}return S[Pe]=Se,Se},j={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},re=Bl(),ee=vI(),ge=re.call(Function.call,Array.prototype.concat),ae=re.call(Function.apply,Array.prototype.splice),ie=re.call(Function.call,String.prototype.replace),Oe=re.call(Function.call,String.prototype.slice),ze=re.call(Function.call,RegExp.prototype.exec),tt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ve=/\\(\\)?/g,Je=function(Pe){var Se=Oe(Pe,0,1),fe=Oe(Pe,-1);if(Se==="%"&&fe!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(fe==="%"&&Se!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var ve=[];return ie(Pe,tt,function(D,K,F,de){ve[ve.length]=F?ie(de,Ve,"$1"):K||D}),ve},ht=function(Pe,Se){var fe=Pe,ve;if(ee(j,fe)&&(ve=j[fe],fe="%"+ve[0]+"%"),ee(S,fe)){var D=S[fe];if(D===B&&(D=H(fe)),typeof D>"u"&&!Se)throw new i("intrinsic "+Pe+" exists, but is not available. Please file an issue!");return{alias:ve,name:fe,value:D}}throw new a("intrinsic "+Pe+" does not exist!")};return hl=function(Pe,Se){if(typeof Pe!="string"||Pe.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Se!="boolean")throw new i('"allowMissing" argument must be a boolean');if(ze(/^%?[^%]*%?$/,Pe)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var fe=Je(Pe),ve=fe.length>0?fe[0]:"",D=ht("%"+ve+"%",Se),K=D.name,F=D.value,de=!1,Te=D.alias;Te&&(ve=Te[0],ae(fe,ge([0,1],Te)));for(var M=1,k=!0;M<fe.length;M+=1){var Z=fe[M],Y=Oe(Z,0,1),oe=Oe(Z,-1);if((Y==='"'||Y==="'"||Y==="`"||oe==='"'||oe==="'"||oe==="`")&&Y!==oe)throw new a("property names with quotes must have matching quotes");if((Z==="constructor"||!k)&&(de=!0),ve+="."+Z,K="%"+ve+"%",ee(S,K))F=S[K];else if(F!=null){if(!(Z in F)){if(!Se)throw new i("base intrinsic for "+Pe+" exists, but the property is not available.");return}if(p&&M+1>=fe.length){var w=p(F,Z);k=!!w,k&&"get"in w&&!("originalValue"in w.get)?F=w.get:F=F[Z]}else k=ee(F,Z),F=F[Z];k&&!de&&(S[K]=F)}}return F},hl}var vl={},uv=!1;function El(){if(uv)return vl;uv=!0;var t=oi(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return vl=e,vl}var Tl={},cv=!1;function ea(){if(cv)return Tl;cv=!0;var t=oi(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return Tl=e,Tl}var _l={},fv=!1;function TI(){if(fv)return _l;fv=!0;var t=El(),e=mv(),n=Qo(),r=ea();return _l=function(a,i,s){if(!a||typeof a!="object"&&typeof a!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,f=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!r&&r(a,i);if(t)t(a,i,{configurable:p===null&&g?g.configurable:!p,enumerable:l===null&&g?g.enumerable:!l,value:s,writable:f===null&&g?g.writable:!f});else if(y||!l&&!f&&!p)a[i]=s;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_l}var bl={},dv=!1;function _I(){if(dv)return bl;dv=!0;var t=El(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},bl=e,bl}var wl={},pv=!1;function bI(){if(pv)return wl;pv=!0;var t=oi(),e=TI(),n=_I()(),r=ea(),o=Qo(),a=t("%Math.floor%");return wl=function(s,l){if(typeof s!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||a(l)!==l)throw new o("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],p=!0,y=!0;if("length"in s&&r){var g=r(s,"length");g&&!g.configurable&&(p=!1),g&&!g.writable&&(y=!1)}return(p||y||!f)&&(n?e(s,"length",l,!0,!0):e(s,"length",l)),s},wl}var ii={},gv=!1;function Sl(){if(gv)return ii;gv=!0;var t=Bl(),e=oi(),n=bI(),r=Qo(),o=e("%Function.prototype.apply%"),a=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(a,o),s=El(),l=e("%Math.max%");ii=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,a,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var f=function(){return i(t,o,arguments)};return s?s(ii,"apply",{value:f}):ii.apply=f,ii}var xl={},yv=!1;function kl(){if(yv)return xl;yv=!0;var t=oi(),e=Sl(),n=e(t("String.prototype.indexOf"));return xl=function(o,a){var i=t(o,!!a);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},xl}as();xs();var Il={},hv=!1;function $l(){if(hv)return Il;hv=!0;var t=Pl();return Il=function(){return t()&&!!Symbol.toStringTag},Il}var Al={},vv=!1;function wI(){if(vv)return Al;vv=!0;var t=$l()(),e=kl(),n=e("Object.prototype.toString"),r=function(s){return t&&s&&typeof s=="object"&&Symbol.toStringTag in s?!1:n(s)==="[object Arguments]"},o=function(s){return r(s)?!0:s!==null&&typeof s=="object"&&typeof s.length=="number"&&s.length>=0&&n(s)!=="[object Array]"&&n(s.callee)==="[object Function]"},a=(function(){return r(arguments)})();return r.isLegacyArguments=o,Al=a?r:o,Al}var Cl={},Tv=!1;function xI(){if(Tv)return Cl;Tv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=$l()(),o=Object.getPrototypeOf,a=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Cl=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var f=t.call(l);return f==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var p=a();i=p?o(p):!1}return o(l)===i},Cl}var Ol={},_v=!1;function PI(){if(_v)return Ol;_v=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(S){S!==r&&(e=null)}else e=null;var o=/^\s*class\b/,a=function(E){try{var H=t.call(E);return o.test(H)}catch{return!1}},i=function(E){try{return a(E)?!1:(t.call(E),!0)}catch{return!1}},s=Object.prototype.toString,l="[object Object]",f="[object Function]",p="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",h="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var T=document.all;s.call(T)===s.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var H=s.call(E);return(H===y||H===g||H===h||H===l)&&E("")==null}catch{}return!1})}return Ol=e?function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,n)}catch(H){if(H!==r)return!1}return!a(E)&&i(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(v)return i(E);if(a(E))return!1;var H=s.call(E);return H!==f&&H!==p&&!/^\[object HTML/.test(H)?!1:i(E)},Ol}var Rl={},bv=!1;function BI(){if(bv)return Rl;bv=!0;var t=PI(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,f,p){for(var y=0,g=l.length;y<g;y++)n.call(l,y)&&(p==null?f(l[y],y,l):f.call(p,l[y],y,l))},o=function(l,f,p){for(var y=0,g=l.length;y<g;y++)p==null?f(l.charAt(y),y,l):f.call(p,l.charAt(y),y,l)},a=function(l,f,p){for(var y in l)n.call(l,y)&&(p==null?f(l[y],y,l):f.call(p,l[y],y,l))},i=function(l,f,p){if(!t(f))throw new TypeError("iterator must be a function");var y;arguments.length>=3&&(y=p),e.call(l)==="[object Array]"?r(l,f,y):typeof l=="string"?o(l,f,y):a(l,f,y)};return Rl=i,Rl}var Ml={},wv=!1;function EI(){return wv||(wv=!0,Ml=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ml}var Nl={},xv=!1,SI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function kI(){if(xv)return Nl;xv=!0;var t=EI(),e=typeof globalThis>"u"?SI:globalThis;return Nl=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},Nl}var Dl={},Pv=!1,II=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Iv(){if(Pv)return Dl;Pv=!0;var t=BI(),e=kI(),n=Sl(),r=kl(),o=ea(),a=r("Object.prototype.toString"),i=$l()(),s=typeof globalThis>"u"?II:globalThis,l=e(),f=r("String.prototype.slice"),p=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,T){for(var S=0;S<B.length;S+=1)if(B[S]===T)return S;return-1},g={__proto__:null};i&&o&&p?t(l,function(P){var B=new s[P];if(Symbol.toStringTag in B){var T=p(B),S=o(T,Symbol.toStringTag);if(!S){var E=p(T);S=o(E,Symbol.toStringTag)}g["$"+P]=n(S.get)}}):t(l,function(P){var B=new s[P],T=B.slice||B.set;T&&(g["$"+P]=n(T))});var h=function(B){var T=!1;return t(g,function(S,E){if(!T)try{"$"+S(B)===E&&(T=f(E,1))}catch{}}),T},v=function(B){var T=!1;return t(g,function(S,E){if(!T)try{S(B),T=f(E,1)}catch{}}),T};return Dl=function(B){if(!B||typeof B!="object")return!1;if(!i){var T=f(a(B),8,-1);return y(l,T)>-1?T:T!=="Object"?!1:v(B)}return o?h(B):null},Dl}var Hl={},Bv=!1;function AI(){if(Bv)return Hl;Bv=!0;var t=Iv();return Hl=function(n){return!!t(n)},Hl}var we={},Ev=!1;function CI(){if(Ev)return we;Ev=!0;var t=wI(),e=xI(),n=Iv(),r=AI();function o($){return $.call.bind($)}var a=typeof BigInt<"u",i=typeof Symbol<"u",s=o(Object.prototype.toString),l=o(Number.prototype.valueOf),f=o(String.prototype.valueOf),p=o(Boolean.prototype.valueOf);if(a)var y=o(BigInt.prototype.valueOf);if(i)var g=o(Symbol.prototype.valueOf);function h($,Ct){if(typeof $!="object")return!1;try{return Ct($),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function v($){return typeof Promise<"u"&&$ instanceof Promise||$!==null&&typeof $=="object"&&typeof $.then=="function"&&typeof $.catch=="function"}we.isPromise=v;function P($){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView($):r($)||D($)}we.isArrayBufferView=P;function B($){return n($)==="Uint8Array"}we.isUint8Array=B;function T($){return n($)==="Uint8ClampedArray"}we.isUint8ClampedArray=T;function S($){return n($)==="Uint16Array"}we.isUint16Array=S;function E($){return n($)==="Uint32Array"}we.isUint32Array=E;function H($){return n($)==="Int8Array"}we.isInt8Array=H;function j($){return n($)==="Int16Array"}we.isInt16Array=j;function re($){return n($)==="Int32Array"}we.isInt32Array=re;function ee($){return n($)==="Float32Array"}we.isFloat32Array=ee;function ge($){return n($)==="Float64Array"}we.isFloat64Array=ge;function ae($){return n($)==="BigInt64Array"}we.isBigInt64Array=ae;function ie($){return n($)==="BigUint64Array"}we.isBigUint64Array=ie;function Oe($){return s($)==="[object Map]"}Oe.working=typeof Map<"u"&&Oe(new Map);function ze($){return typeof Map>"u"?!1:Oe.working?Oe($):$ instanceof Map}we.isMap=ze;function tt($){return s($)==="[object Set]"}tt.working=typeof Set<"u"&&tt(new Set);function Ve($){return typeof Set>"u"?!1:tt.working?tt($):$ instanceof Set}we.isSet=Ve;function Je($){return s($)==="[object WeakMap]"}Je.working=typeof WeakMap<"u"&&Je(new WeakMap);function ht($){return typeof WeakMap>"u"?!1:Je.working?Je($):$ instanceof WeakMap}we.isWeakMap=ht;function Ue($){return s($)==="[object WeakSet]"}Ue.working=typeof WeakSet<"u"&&Ue(new WeakSet);function Pe($){return Ue($)}we.isWeakSet=Pe;function Se($){return s($)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function fe($){return typeof ArrayBuffer>"u"?!1:Se.working?Se($):$ instanceof ArrayBuffer}we.isArrayBuffer=fe;function ve($){return s($)==="[object DataView]"}ve.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&ve(new DataView(new ArrayBuffer(1),0,1));function D($){return typeof DataView>"u"?!1:ve.working?ve($):$ instanceof DataView}we.isDataView=D;var K=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F($){return s($)==="[object SharedArrayBuffer]"}function de($){return typeof K>"u"?!1:(typeof F.working>"u"&&(F.working=F(new K)),F.working?F($):$ instanceof K)}we.isSharedArrayBuffer=de;function Te($){return s($)==="[object AsyncFunction]"}we.isAsyncFunction=Te;function M($){return s($)==="[object Map Iterator]"}we.isMapIterator=M;function k($){return s($)==="[object Set Iterator]"}we.isSetIterator=k;function Z($){return s($)==="[object Generator]"}we.isGeneratorObject=Z;function Y($){return s($)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=Y;function oe($){return h($,l)}we.isNumberObject=oe;function w($){return h($,f)}we.isStringObject=w;function x($){return h($,p)}we.isBooleanObject=x;function z($){return a&&h($,y)}we.isBigIntObject=z;function Q($){return i&&h($,g)}we.isSymbolObject=Q;function Me($){return oe($)||w($)||x($)||z($)||Q($)}we.isBoxedPrimitive=Me;function _e($){return typeof Uint8Array<"u"&&(fe($)||de($))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function($){Object.defineProperty(we,$,{enumerable:!1,value:function(){throw new Error($+" is not supported in userland")}})}),we}var Ul={},Sv=!1;function OI(){return Sv||(Sv=!0,Ul=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Ul}var xe={},kv=!1,ai=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function RI(){if(kv)return xe;kv=!0;var t=Rt,e=Object.getOwnPropertyDescriptors||function(K){for(var F=Object.keys(K),de={},Te=0;Te<F.length;Te++)de[F[Te]]=Object.getOwnPropertyDescriptor(K,F[Te]);return de},n=/%[sdj%]/g;xe.format=function(D){if(!j(D)){for(var K=[],F=0;F<arguments.length;F++)K.push(i(arguments[F]));return K.join(" ")}for(var F=1,de=arguments,Te=de.length,M=String(D).replace(n,function(Z){if(Z==="%%")return"%";if(F>=Te)return Z;switch(Z){case"%s":return String(de[F++]);case"%d":return Number(de[F++]);case"%j":try{return JSON.stringify(de[F++])}catch{return"[Circular]"}default:return Z}}),k=de[F];F<Te;k=de[++F])S(k)||!ae(k)?M+=" "+k:M+=" "+i(k);return M},xe.deprecate=function(D,K){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,K).apply(this||ai,arguments)};var F=!1;function de(){if(!F){if(t.throwDeprecation)throw new Error(K);t.traceDeprecation?console.trace(K):console.error(K),F=!0}return D.apply(this||ai,arguments)}return de};var r={},o=/^$/;if(t.env.NODE_DEBUG){var a=t.env.NODE_DEBUG;a=a.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+a+"$","i")}xe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(o.test(D)){var K=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,K,F)}}else r[D]=function(){};return r[D]};function i(D,K){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),T(K)?F.showHidden=K:K&&xe._extend(F,K),ee(F.showHidden)&&(F.showHidden=!1),ee(F.depth)&&(F.depth=2),ee(F.colors)&&(F.colors=!1),ee(F.customInspect)&&(F.customInspect=!0),F.colors&&(F.stylize=s),p(F,D,F.depth)}xe.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function s(D,K){var F=i.styles[K];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,K){return D}function f(D){var K={};return D.forEach(function(F,de){K[F]=!0}),K}function p(D,K,F){if(D.customInspect&&K&&ze(K.inspect)&&K.inspect!==xe.inspect&&!(K.constructor&&K.constructor.prototype===K)){var de=K.inspect(F,D);return j(de)||(de=p(D,de,F)),de}var Te=y(D,K);if(Te)return Te;var M=Object.keys(K),k=f(M);if(D.showHidden&&(M=Object.getOwnPropertyNames(K)),Oe(K)&&(M.indexOf("message")>=0||M.indexOf("description")>=0))return g(K);if(M.length===0){if(ze(K)){var Z=K.name?": "+K.name:"";return D.stylize("[Function"+Z+"]","special")}if(ge(K))return D.stylize(RegExp.prototype.toString.call(K),"regexp");if(ie(K))return D.stylize(Date.prototype.toString.call(K),"date");if(Oe(K))return g(K)}var Y="",oe=!1,w=["{","}"];if(B(K)&&(oe=!0,w=["[","]"]),ze(K)){var x=K.name?": "+K.name:"";Y=" [Function"+x+"]"}if(ge(K)&&(Y=" "+RegExp.prototype.toString.call(K)),ie(K)&&(Y=" "+Date.prototype.toUTCString.call(K)),Oe(K)&&(Y=" "+g(K)),M.length===0&&(!oe||K.length==0))return w[0]+Y+w[1];if(F<0)return ge(K)?D.stylize(RegExp.prototype.toString.call(K),"regexp"):D.stylize("[Object]","special");D.seen.push(K);var z;return oe?z=h(D,K,F,k,M):z=M.map(function(Q){return v(D,K,F,k,Q,oe)}),D.seen.pop(),P(z,Y,w)}function y(D,K){if(ee(K))return D.stylize("undefined","undefined");if(j(K)){var F="'"+JSON.stringify(K).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(K))return D.stylize(""+K,"number");if(T(K))return D.stylize(""+K,"boolean");if(S(K))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,K,F,de,Te){for(var M=[],k=0,Z=K.length;k<Z;++k)Pe(K,String(k))?M.push(v(D,K,F,de,String(k),!0)):M.push("");return Te.forEach(function(Y){Y.match(/^\d+$/)||M.push(v(D,K,F,de,Y,!0))}),M}function v(D,K,F,de,Te,M){var k,Z,Y;if(Y=Object.getOwnPropertyDescriptor(K,Te)||{value:K[Te]},Y.get?Y.set?Z=D.stylize("[Getter/Setter]","special"):Z=D.stylize("[Getter]","special"):Y.set&&(Z=D.stylize("[Setter]","special")),Pe(de,Te)||(k="["+Te+"]"),Z||(D.seen.indexOf(Y.value)<0?(S(F)?Z=p(D,Y.value,null):Z=p(D,Y.value,F-1),Z.indexOf(`
|
|
85
85
|
`)>-1&&(M?Z=Z.split(`
|
|
86
86
|
`).map(function(oe){return" "+oe}).join(`
|
|
87
87
|
`).slice(2):Z=`
|
|
@@ -90,7 +90,7 @@ declare function ${r}${i};${l}`);if(t.props.type==="variable")return oa(`${o}dec
|
|
|
90
90
|
`))):Z=D.stylize("[Circular]","special")),ee(k)){if(M&&Te.match(/^\d+$/))return Z;k=JSON.stringify(""+Te),k.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(k=k.slice(1,-1),k=D.stylize(k,"name")):(k=k.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),k=D.stylize(k,"string"))}return k+": "+Z}function P(D,K,F){var de=D.reduce(function(Te,M){return M.indexOf(`
|
|
91
91
|
`)>=0,Te+M.replace(/\u001b\[\d\d?m/g,"").length+1},0);return de>60?F[0]+(K===""?"":K+`
|
|
92
92
|
`)+" "+D.join(`,
|
|
93
|
-
`)+" "+F[1]:F[0]+K+" "+D.join(", ")+" "+F[1]}xe.types=AI();function B(D){return Array.isArray(D)}xe.isArray=B;function T(D){return typeof D=="boolean"}xe.isBoolean=T;function S(D){return D===null}xe.isNull=S;function E(D){return D==null}xe.isNullOrUndefined=E;function H(D){return typeof D=="number"}xe.isNumber=H;function j(D){return typeof D=="string"}xe.isString=j;function re(D){return typeof D=="symbol"}xe.isSymbol=re;function ee(D){return D===void 0}xe.isUndefined=ee;function ge(D){return ae(D)&&Ve(D)==="[object RegExp]"}xe.isRegExp=ge,xe.types.isRegExp=ge;function ae(D){return typeof D=="object"&&D!==null}xe.isObject=ae;function ie(D){return ae(D)&&Ve(D)==="[object Date]"}xe.isDate=ie,xe.types.isDate=ie;function Oe(D){return ae(D)&&(Ve(D)==="[object Error]"||D instanceof Error)}xe.isError=Oe,xe.types.isNativeError=Oe;function ze(D){return typeof D=="function"}xe.isFunction=ze;function tt(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}xe.isPrimitive=tt,xe.isBuffer=CI();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var ht=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,K=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),ht[D.getMonth()],K].join(" ")}xe.log=function(){console.log("%s - %s",Ue(),xe.format.apply(xe,arguments))},xe.inherits=Ht(),xe._extend=function(D,K){if(!K||!ae(K))return D;for(var F=Object.keys(K),de=F.length;de--;)D[F[de]]=K[F[de]];return D};function Pe(D,K){return Object.prototype.hasOwnProperty.call(D,K)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(K){if(typeof K!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&K[Se]){if(F=K[Se],typeof F!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),F}function F(){for(var de,Te,M=new Promise(function(Y,oe){de=Y,Te=oe}),k=[],Z=0;Z<arguments.length;Z++)k.push(arguments[Z]);k.push(function(Y,oe){Y?Te(Y):de(oe)});try{K.apply(this||ai,k)}catch(Y){Te(Y)}return M}return Object.setPrototypeOf(F,Object.getPrototypeOf(K)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(K))},xe.promisify.custom=Se;function fe(D,K){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return K(D)}function ve(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function K(){for(var F=[],de=0;de<arguments.length;de++)F.push(arguments[de]);var Te=F.pop();if(typeof Te!="function")throw new TypeError("The last argument must be of type Function");var M=this||ai,k=function(){return Te.apply(M,arguments)};D.apply(this||ai,F).then(function(Z){t.nextTick(k.bind(null,null,Z))},function(Z){t.nextTick(fe.bind(null,Z,k))})}return Object.setPrototypeOf(K,Object.getPrototypeOf(D)),Object.defineProperties(K,e(D)),K}return xe.callbackify=ve,xe}var ce=OI();ce.format;ce.deprecate;ce.debuglog;ce.inspect;ce.types;ce.isArray;ce.isBoolean;ce.isNull;ce.isNullOrUndefined;ce.isNumber;ce.isString;ce.isSymbol;ce.isUndefined;ce.isRegExp;ce.isObject;ce.isDate;ce.isError;ce.isFunction;ce.isPrimitive;ce.isBuffer;ce.log;ce.inherits;ce._extend;ce.promisify;ce.callbackify;var u0=ce._extend,c0=ce.callbackify,f0=ce.debuglog,d0=ce.deprecate,p0=ce.format,g0=ce.inherits,y0=ce.inspect,m0=ce.isArray,h0=ce.isBoolean,v0=ce.isBuffer,T0=ce.isDate,_0=ce.isError,b0=ce.isFunction,w0=ce.isNull,x0=ce.isNullOrUndefined,P0=ce.isNumber,B0=ce.isObject,E0=ce.isPrimitive,S0=ce.isRegExp,k0=ce.isString,I0=ce.isSymbol,A0=ce.isUndefined,C0=ce.log,O0=ce.promisify,R0=ce.types,M0=ce.TextEncoder=globalThis.TextEncoder,N0=ce.TextDecoder=globalThis.TextDecoder;var mr=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(n))}_serializeMessage(e){let n=ce.format(...e);return J.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(n):n}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var si=class t extends mr{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};A();O();C();var DI=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),HI=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),o=new MI({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Go,headers:DI(e.headers)}),a=new ri(o),i=new si({traceId:r});return{ctx:t,req:e,client:a,logger:i,instance:n}},UI=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await ZI(t);case"register":return await jI(t);case"unregister":return await KI(t);case"message_created":return await WI(t);case"action_triggered":return await zI(t);case"ping":return await $I(t);case"create_user":return await LI(t);case"create_conversation":return await FI(t);default:throw new NI(`Unknown operation ${e.operation}`)}},Av=t=>async e=>{let n=qh(e.headers),r=HI(n,e,t),{logger:o}=r;try{let a;return a=await qI(r),a?{...a,status:a.status??200}:(a=await UI(r),a?{...a,status:a.status??200}:{status:200})}catch(a){if(RI(a)){let s=a.type==="Runtime"?a:new Iv(a.message,a);return o.forBot().error(s.message),{status:s.code,body:JSON.stringify(s.toJSON())}}console.error(a);let i=new Iv("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return o.forBot().error(i.message),{status:i.code,body:JSON.stringify(i.toJSON())}}},$I=async t=>{},ZI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{let{req:a}=Mt(n);return o.webhook({client:t,ctx:e,req:a,logger:r})},jI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.register)return;let{webhookUrl:a}=Mt(n);await o.register({client:t,ctx:e,webhookUrl:a,logger:r})},KI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.unregister)return;let{webhookUrl:a}=Mt(n);await o.unregister({ctx:e,webhookUrl:a,client:t,logger:r})},LI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createUser)return;let{tags:a}=Mt(n);return await o.createUser({ctx:e,client:t,tags:a,logger:r})},FI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createConversation)return;let{channel:a,tags:i}=Mt(n);return await o.createConversation({ctx:e,client:t,channel:a,tags:i,logger:r})},WI=async({ctx:t,req:e,client:n,logger:r,instance:o})=>{let{conversation:a,user:i,type:s,payload:l,message:f}=Mt(e),p=o.channels[a.channel];if(!p)throw new Error(`Channel ${a.channel} not found`);let y=p.messages[s];if(!y)throw new Error(`Message of type ${s} not found in channel ${a.channel}`);await y({ctx:t,conversation:a,message:f,user:i,type:s,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:f.id,tags:h})},logger:r})},zI=async({req:t,ctx:e,client:n,logger:r,instance:o})=>{let{input:a,type:i}=Mt(t);if(!i)throw new Error("Missing action type");let s=o.actions[i];if(!s)throw new Error(`Action ${i} not found`);let l=new Vo,p={output:await s({ctx:e,input:a,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},qI=async({instance:t,client:e,ctx:n,logger:r,req:o})=>{let a=t.unknownOperationHandler;if(a)return await a({client:e,ctx:n,logger:r,req:o})};var Zl=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler,this.unknownOperationHandler=e.__advanced?.unknownOperationHandler}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;handler=Av(this);start=e=>Wo(this.handler,e)};A();O();C();A();O();C();A();O();C();A();O();C();A();O();C();var jl=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.withPlugins={user:e.user,conversation:e.conversation,message:e.message,states:e.states,events:e.events,recurringEvents:e.recurringEvents,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;__advanced;withPlugins;get metadata(){return{sdkVersion:gn}}addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let o=n?.alias??e.name;if(r.integrations[o])throw new Error(`Another integration with alias "${o}" is already installed in the bot`);return r.integrations[o]={...e,alias:o,enabled:n?.enabled,configurationType:n?.configurationType,configuration:n?.configuration,disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let o=n.alias??e.name;if(r.plugins[o])throw new Error(`Another plugin with alias "${o}" is already installed in the bot`);return r.plugins[o]={...e,alias:o,configuration:n.configuration,interfaces:n.interfaces},r.withPlugins.user=this._mergeUser(r.withPlugins.user,e.definition.user),r.withPlugins.conversation=this._mergeConversation(r.withPlugins.conversation,e.definition.conversation),r.withPlugins.message=this._mergeMessage(r.withPlugins.message,e.definition.message),r.withPlugins.recurringEvents=this._mergeRecurringEvents(r.withPlugins.recurringEvents,e.definition.recurringEvents),r.withPlugins.tables=this._mergeTables(r.withPlugins.tables,e.definition.tables),r.withPlugins.workflows=this._mergeWorkflows(r.withPlugins.workflows,e.definition.workflows),r.withPlugins.states=this._mergeStates(r.withPlugins.states,this._prefixKeysWithPluginAlias(e.definition.states,o)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,o)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,o)),this}_mergeUser=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeConversation=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeMessage=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeStates=(e,n)=>({...e,...n});_mergeEvents=(e,n)=>({...e,...n});_mergeRecurringEvents=(e,n)=>({...e,...n});_mergeActions=(e,n)=>({...e,...n});_mergeTables=(e,n)=>({...e,...n});_mergeWorkflows=(e,n)=>({...e,...n});_prefixKeysWithPluginAlias=(e,n)=>Le.mapKeys(e??{},r=>`${n}${yn}${r}`);dereferencePluginEntities(){let e=this._buildZuiReferenceMap();return{...this,withPlugins:{...this.withPlugins,events:this._dereferenceDefinitionSchemas(this.withPlugins.events,e),states:this._dereferenceDefinitionSchemas(this.withPlugins.states,e),tables:this._dereferenceDefinitionSchemas(this.withPlugins.tables,e),actions:this._dereferenceActionDefinitionSchemas(this.withPlugins.actions,e)},plugins:Object.fromEntries(Object.entries(this.plugins??{}).map(([n,r])=>[n,{...r,definition:{...r.definition,configuration:this._dereferenceDefinitionSchema(r.definition.configuration,e),events:this._dereferenceDefinitionSchemas(r.definition.events,e),states:this._dereferenceDefinitionSchemas(r.definition.states,e),tables:this._dereferenceDefinitionSchemas(r.definition.tables,e),actions:this._dereferenceActionDefinitionSchemas(r.definition.actions,e)}}]))}}_buildZuiReferenceMap(){let e={},n=Object.entries(this.plugins??{});for(let[r,o]of n){let a=Object.entries(o.interfaces??{});for(let[i,s]of a){let l=this.integrations?.[s.name];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${s.name}" which is not installed`);let f=Object.entries(s.entities??{});for(let[p,{name:y}]of f){let g=l.definition.entities?.[y]?.schema;if(!g)throw new Error(`Interface entity "${y}" does not exist in integration "${l.name}"`);e[`interface:${i}/entities/${p}`]=g}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,this._dereferenceDefinitionSchema(o,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};A();O();C();A();O();C();import{isApiError as QI,Client as eA,RuntimeError as Rv}from"@botpress/client";A();O();C();var li=class t extends mr{constructor(e){super({...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};A();O();C();A();O();C();var nn=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}get _inner(){return this._client}getConversation=(e=>this._run("getConversation",e));listConversations=(e=>this._run("listConversations",e));updateConversation=(e=>this._run("updateConversation",e));deleteConversation=(e=>this._run("deleteConversation",e));listParticipants=(e=>this._run("listParticipants",e));addParticipant=(e=>this._run("addParticipant",e));getParticipant=(e=>this._run("getParticipant",e));removeParticipant=(e=>this._run("removeParticipant",e));createEvent=(e=>this._run("createEvent",e));getEvent=(e=>this._run("getEvent",e));listEvents=(e=>this._run("listEvents",e));createMessage=(e=>this._run("createMessage",e));getOrCreateMessage=(e=>this._run("getOrCreateMessage",e));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let o=await this._client[e](n),a=this._hooks.after[e];return a&&(o=await a(o,n)),o}};A();O();C();var GI=X.enum(["event_received","register","unregister","ping","action_triggered"]),Cv=t=>({botId:t[Jo]||It("Missing bot id header"),operation:GI.parse(t[Xo]),type:t[zh]||It("Missing type header"),configuration:JSON.parse(q.from(t[Yo]||It("Missing configuration header"),"base64").toString("utf-8"))});A();O();C();var dt={status:200};A();O();C();A();O();C();var Kl=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var VI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Ov=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!VI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:JI(t,e)};if(!e.payload.workflow.name)return n.logger.warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),dt;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":n.logger.info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);break;case"workflow_timedout":case"workflow_started":case"workflow_continued":return await YI(n,e);default:e.payload.type}return dt},JI=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),YI=async(t,e)=>{let n=Kl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];if(!r||r.length===0)return t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),dt;let{updatedWorkflow:o}=await XI(t,e);return o.status==="pending"&&t.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `),dt},XI=async(t,e)=>{let n=Kl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],o=structuredClone(e.payload.workflow);for(let a of r??[])o=await a({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:o});return{updatedWorkflow:o}};A();O();C();var Mv=t=>async e=>{let n=Cv(e.headers),r=new li,o=new eA({botId:n.botId,retry:Go}),a=new nn(o,{before:{createMessage:async s=>{let l=t.hookHandlers.before_outgoing_message[s.type]??[];for(let f of l){let p=new nn(o);s=(await f({client:p,ctx:n,logger:r.with({conversationId:s.conversationId,userId:s.userId}),data:s}))?.data??s}return s},callAction:async s=>{let l=t.hookHandlers.before_outgoing_call_action[s.type]??[];for(let f of l){let p=new nn(o);s=(await f({client:p,ctx:n,logger:r,data:s}))?.data??s}return s}},after:{createMessage:async s=>{let l=t.hookHandlers.after_outgoing_message[s.message.type]??[];for(let f of l){let p=new nn(o);s=(await f({client:p,ctx:n,logger:r.with({messageId:s.message.id,conversationId:s.message.conversationId,userId:s.message.userId}),data:s}))?.data??s}return s},callAction:async(s,l)=>{let{type:f}=l,p=t.hookHandlers.after_outgoing_call_action[f]??[];for(let y of p){let g=new nn(o);s=(await y({client:g,ctx:n,logger:r,data:{type:f,...s}}))?.data??s}return s}}}),i={req:e,ctx:n,logger:r,client:a,self:t};try{switch(n.operation){case"action_triggered":return await oA(i);case"event_received":return await iA(i);case"register":return await nA(i);case"unregister":return await rA(i);case"ping":return await tA(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(s){let l=s instanceof Error?s:new Error(String(s));if(QI(l)){let p=l.type==="Runtime"?l:new Rv(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let f=new Rv("An unexpected error occurred in the bot.",l);return r.error(f.message,l),{status:f.code,body:JSON.stringify(f.toJSON())}}},tA=async t=>dt,nA=async t=>dt,rA=async t=>dt,iA=async t=>{let{ctx:e,logger:n,req:r,client:o,self:a}=t,i={client:o,ctx:e,logger:n},s=Mt(r);if(i.logger=i.logger.with({eventId:s.event.id,messageId:s.event.messageId,conversationId:s.event.conversationId,userId:s.event.userId}),e.type==="workflow_update")return await Ov(t,s.event);if(e.type==="message_created"){let h=s.event,v=h.payload.message;i.logger=i.logger.with({messageId:v.id,conversationId:v.conversationId,userId:v.userId});let P=a.hookHandlers.before_incoming_message[v.type]??[];for(let E of P){let H=await E({...i,data:v});if(v=H?.data??v,H?.stop)return dt}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:v,event:h},T=a.messageHandlers[v.type]??[];for(let E of T)await E(B);let S=a.hookHandlers.after_incoming_message[v.type]??[];for(let E of S){let H=await E({...i,data:v});if(v=H?.data??v,H?.stop)return dt}return dt}if(e.type==="state_expired"){let v=s.event.payload.state,P={...i,state:v},B=a.stateExpiredHandlers[v.name]??[];for(let T of B)await T(P);return dt}let l=s.event,f=a.hookHandlers.before_incoming_event[l.type]??[];for(let h of f){let v=await h({...i,data:l});if(l=v?.data??l,v?.stop)return dt}let p={...i,event:l},y=a.eventHandlers[l.type]??[];for(let h of y)await h(p);let g=a.hookHandlers.after_incoming_event[l.type]??[];for(let h of g){let v=await h({...i,data:l});if(l=v?.data??l,v?.stop)return dt}return dt},oA=async({ctx:t,logger:e,req:n,client:r,self:o})=>{let{input:a,type:i}=Mt(n);if(!i)throw new Error("Missing action type");let s=o.hookHandlers.before_incoming_call_action[i]??[];for(let g of s){let h=await g({ctx:t,logger:e,client:r,data:{type:i,input:a}});a=h?.data?.input??a,i=h?.data?.type??i}let l=o.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let f=await l({ctx:t,logger:e,input:a,client:r,type:i}),p=o.hookHandlers.after_incoming_call_action[i]??[];for(let g of p){let h=await g({ctx:t,logger:e,client:r,data:{type:i,output:f}});i=h?.data?.type??i,f=h?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}};A();O();C();A();O();C();var rn=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>mn({workflowName:n,client:t,input:r}),running:r=>mn({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>mn({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>mn({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>mn({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>mn({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>mn({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>mn({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:o}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:At({client:t,workflow:o})}}})}),mn=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>At({client:t.client,workflow:n}))}},At=t=>{let e=!1;return{...t.workflow,async update(n){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:At(t)};let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"in_progress",eventId:t.event.id});return e=!0,await t.onWorkflowUpdate?.(n),{workflow:At({...t,workflow:n})}},async setFailed({failureReason:n}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async setCompleted({output:n}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:At({...t,workflow:n})}}}};A();O();C();var Ll=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get actionHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._actionHandlers[n];if(r)return r;for(let[o,a]of Object.entries(this._plugins)){let[i,s]=n.split(yn);if(!(i!==o||!s)&&(r=a.actionHandlers[s],r))return ft.setName(l=>r({...l,workflows:rn(l.client)}),r.name)}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.messageHandlers[n]??[]),o=this._messageHandlers[n]??[],a=this._messageHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.eventHandlers[n]??[]),o=this._eventHandlers[n]??[],a=this._eventHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.stateExpiredHandlers[n]??[]),o=this._stateExpiredHandlers[n]??[],a=this._stateExpiredHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(o,a)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[a]??[]),s=this._hookHandlers[n]??{},l=s[a]??[],f=s["*"]??[],p=[...l,...f].sort((y,g)=>y.order-g.order).map(({handler:y})=>y);return ye.unique([...i,...p]).map(y=>ft.setName(g=>y({...g,workflows:rn(g.client)}),y.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,a)=>{let i=r[a]?.sort((l,f)=>l.order-f.order).map(({handler:l})=>l)??[],s=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[a]??[]);return ye.unique([...i,...s]).map(l=>ft.setName(async f=>{let p=f.workflow;return await l({...f,workflow:At({...f,onWorkflowUpdate(y){p=y}}),workflows:rn(f.client)}),p},l.name))}})}})}on={message:(e,n)=>{this._messageHandlers[e]=ye.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ye.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ye.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ye.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ye.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ye.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ye.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ye.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ye.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ye.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ye.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ye.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ye.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ye.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ye.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ye.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=Mv(this);start=e=>Wo(this.handler,e)};A();O();C();A();O();C();A();O();C();A();O();C();A();O();C();var Fl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.title=e.title,this.description=e.description,this.readme=e.readme,this.entities=e.entities??{},this.attributes=e.attributes,this.__advanced=e.__advanced;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),o=e.actions===void 0?{}:Le.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(n)},output:{...i.output,schema:i.output.schema(n)}})),a=e.channels===void 0?{}:Le.mapValues(e.channels,i=>({...i,messages:Le.mapValues(i.messages,s=>({...s,schema:s.schema(n)}))}));this.events=r,this.actions=o,this.channels=a}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:gn}}_getEntityReference=e=>{let n={};for(let[r,o]of Object.entries(e)){let a=o.schema._def["x-zui"]?.title,i=o.schema._def.description,s=Ey.ref(r);a&&s.title(a),i&&s.describe(i),n[r]=s}return n}};A();O();C();A();O();C();A();O();C();A();O();C();var Wl=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([r,o])=>[r,Object.fromEntries(Object.entries(o.definition.entities??{}).map(([a])=>[a,X.ref(`interface:${r}/entities/${a}`)]))]));this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.recurringEvents=e.recurringEvents,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.configuration=e.configuration?{...e.configuration,schema:typeof e.configuration.schema=="object"?e.configuration.schema:e.configuration.schema({entities:n})}:void 0,this.states=Object.fromEntries(Object.entries(e.states??{}).map(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([r,o])=>[r,{...o,input:{...o.input,schema:typeof o.input.schema=="object"?o.input.schema:o.input.schema({entities:n})},output:{...o.output,schema:typeof o.output.schema=="object"?o.output.schema:o.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;__advanced;get metadata(){return{sdkVersion:gn}}dereferenceEntities({intersectWithUnknownRecord:e}={intersectWithUnknownRecord:!0}){let n=this._buildZuiReferenceMap(e);return{...this,configuration:this.configuration?{...this.configuration,schema:this._dereferenceZuiSchema(this.configuration.schema,n)}:void 0,events:this._dereferenceDefinitionSchemas(this.events,n),states:this._dereferenceDefinitionSchemas(this.states,n),tables:this._dereferenceDefinitionSchemas(this.tables,n),actions:this._dereferenceActionDefinitionSchemas(this.actions,n)}}_buildZuiReferenceMap(e){return Object.fromEntries(Object.entries(this.interfaces??{}).flatMap(([n,r])=>Object.entries(r.definition.entities??{}).map(([o,a])=>[`interface:${n}/entities/${o}`,e?a.schema.and(X.record(X.string(),X.unknown())):a.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,schema:this._dereferenceZuiSchema(o.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};A();O();C();A();O();C();A();O();C();A();O();C();var zl=":";var Nv=t=>{let[e,n]=t.split(zl);return!e||!n?null:{namespace:e,eventName:n}},Dv=t=>`${t.namespace}${zl}${t.actionName}`,Hv=t=>`${t.namespace}${zl}${t.eventName}`,Uv=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.actions[t.actionName]?.name??t.actionName;return{namespace:r,actionName:o}},$v=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.events[t.eventName]?.name??t.eventName;return{namespace:r,eventName:o}};var Zv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,a)=>i=>aA({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:a,input:i})})}),aA=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:o})=>{let a=Uv({namespace:n,actionName:r},e),i=Dv(a);return(await t.callAction({type:i,input:o})).output};A();O();C();A();O();C();A();O();C();var ql=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:o}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:o})}async schedule(e,n){let{conversationId:r,userId:o,messageId:a}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:o,messageId:a,schedule:n})}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}},jv=(t,e)=>new Proxy({},{get:(n,r)=>{let o=e.alias!==void 0?`${e.alias}${yn}${r}`:r;return new ql({client:t,eventName:o})}});A();O();C();A();O();C();A();O();C();var Gl=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs})}async getOrSet(e,n,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs}).then(o=>o.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,n){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:n})}},Kv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,a)=>{let i=e.alias!==void 0?`${e.alias}${yn}${a}`:a;return new Gl(t,r,i)}})});A();O();C();var Vl=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:n,interfaces:r,alias:o}=this._runtime,a=Zv(e,this._runtime),i=Kv(e,this._runtime),s=rn(e),l=jv(e,this._runtime);return{configuration:n,interfaces:r,actions:a,states:i,alias:o,workflows:s,events:l}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return ft.setName(o=>r({...o,...this._getTools(o.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,s)=>i.order-s.order).map(({handler:i})=>ft.setName(s=>i({...s,message:s.message,...this._getTools(s.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._eventHandlers[n]??[],o=Object.entries(this._eventHandlers).filter(([s])=>this._eventResolvesTo(s,n)).flatMap(([,s])=>s??[]),a=this._eventHandlers["*"]??[];return ye.unique([...r,...o,...a]).sort((s,l)=>s.order-l.order).map(({handler:s})=>ft.setName(l=>s({...l,event:l.event,...this._getTools(l.client)}),s.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,s)=>i.order-s.order).map(({handler:i})=>ft.setName(s=>i({...s,state:s.state,...this._getTools(s.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(o,a)=>{a=this._stripAliasPrefix(a);let i=r[a]??[],s=Object.entries(r).filter(([p])=>this._eventResolvesTo(p,a)).flatMap(([,p])=>p??[]),l=r["*"]??[];return ye.unique([...i,...s,...l]).sort((p,y)=>p.order-y.order).map(({handler:p})=>ft.setName(y=>p({...y,data:y.data,...this._getTools(y.client)}),p.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,a)=>(r[a]?.sort((s,l)=>s.order-l.order)??[]).map(({handler:s})=>ft.setName(async l=>{let f=l.workflow;return await s({...l,workflow:At({...l,onWorkflowUpdate(p){f=p}}),...this._getTools(l.client)}),f},s.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=ye.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ye.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ye.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ye.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ye.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ye.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ye.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ye.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ye.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ye.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ye.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ye.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ye.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ye.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ye.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ye.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let r=Nv(e);if(!r)return!1;let o=$v(r,this._runtime.interfaces);return Hv(o)===n};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};A();O();C();A();O();C();A();O();C();A();O();C();A();O();C();var Lv={};hn(Lv,{allWithinMajorOf:()=>sA,allWithinMinorOf:()=>lA});A();O();C();import*as ui from"semver";function sA(t){let e=ui.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function lA(t){let e=ui.major(t.version),n=ui.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}A();O();C();export{Kx as BRAND,Ll as Bot,jl as BotDefinition,li as BotLogger,nn as BotSpecificClient,Jn as DIRTY,Ux as EMPTY_PATH,pe as INVALID,Zl as Integration,nl as IntegrationDefinition,si as IntegrationLogger,ri as IntegrationSpecificClient,Fl as InterfaceDefinition,KP as NEVER,gt as OK,Ot as ParseInputLazyPath,Tt as ParseStatus,Vl as Plugin,Wl as PluginDefinition,NU as RuntimeError,he as Schema,fC as WELL_KNOWN_ATTRIBUTES,Lr as ZodAny,Fr as ZodArray,La as ZodBigInt,Fa as ZodBoolean,Wa as ZodBranded,za as ZodCatch,qa as ZodDate,To as ZodDefault,mg as ZodDiscriminatedUnion,In as ZodEffects,or as ZodEnum,Wt as ZodError,rg as ZodFirstPartyTypeKind,vg as ZodFunction,Va as ZodIntersection,V as ZodIssueCode,Ja as ZodLazy,Ya as ZodLiteral,_g as ZodMap,wg as ZodNaN,Xa as ZodNativeEnum,qr as ZodNever,Qa as ZodNull,er as ZodNullable,es as ZodNumber,tr as ZodObject,ln as ZodOptional,ne as ZodParsedType,ts as ZodPipeline,bo as ZodPromise,wo as ZodReadonly,Ig as ZodRecord,Cg as ZodRef,he as ZodSchema,Og as ZodSet,yt as ZodString,Lg as ZodSymbol,In as ZodTransformer,rr as ZodTuple,he as ZodType,xo as ZodUndefined,ns as ZodUnion,Hr as ZodUnknown,qg as ZodVoid,te as addIssueToContext,Vx as agent,eP as aimodel,fP as any,yP as array,aP as bigint,Jg as boolean,jP as coerce,zx as conversation,_o as createZodEnum,Mg as cuid2Regex,Rg as cuidRegex,gg as custom,tP as datasource,sP as date,TP as discriminatedUnion,Xc as effect,Hg as emailRegex,AP as enum,ue as errorUtil,Jx as event,SP as function,jr as getErrorMap,sn as getParsedType,iP as instanceof,Qx as intent,_P as intersection,$g as ipv4Regex,Zg as ipv6Regex,wa as isAborted,MU as isApiError,Ii as isAsync,xa as isDirty,Lx as isEmojiRegex,Kr as isValid,IA as json,nP as knowledgebase,rP as late,kP as lazy,IP as literal,ki as makeIssue,BP as map,Gr as mergeObjectSchemas,Gx as message,Dy as messages,oP as nan,CP as nativeEnum,pP as never,cP as null,MP as nullable,Vg as number,mP as object,ba as objectUtil,ZP as oboolean,$P as onumber,RP as optional,UP as ostring,Mt as parseBody,HP as pipeline,DP as preprocess,me as processCreateParams,OP as promise,Hx as quotelessJson,PP as readonly,wP as record,xP as ref,Wo as serve,EP as set,ag as setErrorMap,hP as strictObject,Gg as string,lP as symbol,Yx as table,Xx as tablerow,Xc as transformer,eT as transforms,bP as tuple,Ng as ulidRegex,uP as undefined,vP as union,dP as unknown,qx as user,be as util,Dg as uuidRegex,Wx as variable,Lv as version,gP as void,X as z};
|
|
93
|
+
`)+" "+F[1]:F[0]+K+" "+D.join(", ")+" "+F[1]}xe.types=CI();function B(D){return Array.isArray(D)}xe.isArray=B;function T(D){return typeof D=="boolean"}xe.isBoolean=T;function S(D){return D===null}xe.isNull=S;function E(D){return D==null}xe.isNullOrUndefined=E;function H(D){return typeof D=="number"}xe.isNumber=H;function j(D){return typeof D=="string"}xe.isString=j;function re(D){return typeof D=="symbol"}xe.isSymbol=re;function ee(D){return D===void 0}xe.isUndefined=ee;function ge(D){return ae(D)&&Ve(D)==="[object RegExp]"}xe.isRegExp=ge,xe.types.isRegExp=ge;function ae(D){return typeof D=="object"&&D!==null}xe.isObject=ae;function ie(D){return ae(D)&&Ve(D)==="[object Date]"}xe.isDate=ie,xe.types.isDate=ie;function Oe(D){return ae(D)&&(Ve(D)==="[object Error]"||D instanceof Error)}xe.isError=Oe,xe.types.isNativeError=Oe;function ze(D){return typeof D=="function"}xe.isFunction=ze;function tt(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}xe.isPrimitive=tt,xe.isBuffer=OI();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var ht=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,K=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),ht[D.getMonth()],K].join(" ")}xe.log=function(){console.log("%s - %s",Ue(),xe.format.apply(xe,arguments))},xe.inherits=Ht(),xe._extend=function(D,K){if(!K||!ae(K))return D;for(var F=Object.keys(K),de=F.length;de--;)D[F[de]]=K[F[de]];return D};function Pe(D,K){return Object.prototype.hasOwnProperty.call(D,K)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(K){if(typeof K!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&K[Se]){if(F=K[Se],typeof F!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),F}function F(){for(var de,Te,M=new Promise(function(Y,oe){de=Y,Te=oe}),k=[],Z=0;Z<arguments.length;Z++)k.push(arguments[Z]);k.push(function(Y,oe){Y?Te(Y):de(oe)});try{K.apply(this||ai,k)}catch(Y){Te(Y)}return M}return Object.setPrototypeOf(F,Object.getPrototypeOf(K)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(K))},xe.promisify.custom=Se;function fe(D,K){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return K(D)}function ve(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function K(){for(var F=[],de=0;de<arguments.length;de++)F.push(arguments[de]);var Te=F.pop();if(typeof Te!="function")throw new TypeError("The last argument must be of type Function");var M=this||ai,k=function(){return Te.apply(M,arguments)};D.apply(this||ai,F).then(function(Z){t.nextTick(k.bind(null,null,Z))},function(Z){t.nextTick(fe.bind(null,Z,k))})}return Object.setPrototypeOf(K,Object.getPrototypeOf(D)),Object.defineProperties(K,e(D)),K}return xe.callbackify=ve,xe}var ce=RI();ce.format;ce.deprecate;ce.debuglog;ce.inspect;ce.types;ce.isArray;ce.isBoolean;ce.isNull;ce.isNullOrUndefined;ce.isNumber;ce.isString;ce.isSymbol;ce.isUndefined;ce.isRegExp;ce.isObject;ce.isDate;ce.isError;ce.isFunction;ce.isPrimitive;ce.isBuffer;ce.log;ce.inherits;ce._extend;ce.promisify;ce.callbackify;var c0=ce._extend,f0=ce.callbackify,d0=ce.debuglog,p0=ce.deprecate,g0=ce.format,y0=ce.inherits,m0=ce.inspect,h0=ce.isArray,v0=ce.isBoolean,T0=ce.isBuffer,_0=ce.isDate,b0=ce.isError,w0=ce.isFunction,x0=ce.isNull,P0=ce.isNullOrUndefined,B0=ce.isNumber,E0=ce.isObject,S0=ce.isPrimitive,k0=ce.isRegExp,I0=ce.isString,A0=ce.isSymbol,C0=ce.isUndefined,O0=ce.log,R0=ce.promisify,M0=ce.types,N0=ce.TextEncoder=globalThis.TextEncoder,D0=ce.TextDecoder=globalThis.TextDecoder;var mr=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(n))}_serializeMessage(e){let n=ce.format(...e);return J.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(n):n}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var si=class t extends mr{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};A();O();C();var HI=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),UI=(t,e,n)=>{let[,r]=(e.headers.traceparent||"").split("-"),o=new NI({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Go,headers:HI(e.headers)}),a=new ri(o),i=new si({traceId:r});return{ctx:t,req:e,client:a,logger:i,instance:n}},$I=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await jI(t);case"register":return await KI(t);case"unregister":return await LI(t);case"message_created":return await zI(t);case"action_triggered":return await qI(t);case"ping":return await ZI(t);case"create_user":return await FI(t);case"create_conversation":return await WI(t);default:throw new DI(`Unknown operation ${e.operation}`)}},Cv=t=>async e=>{let n=Gh(e.headers),r=UI(n,e,t),{logger:o}=r;try{let a;return a=await GI(r),a?{...a,status:a.status??200}:(a=await $I(r),a?{...a,status:a.status??200}:{status:200})}catch(a){if(MI(a)){let s=a.type==="Runtime"?a:new Av(a.message,a);return o.forBot().error(s.message),{status:s.code,body:JSON.stringify(s.toJSON())}}console.error(a);let i=new Av("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return o.forBot().error(i.message),{status:i.code,body:JSON.stringify(i.toJSON())}}},ZI=async t=>{},jI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{let{req:a}=Mt(n);return o.webhook({client:t,ctx:e,req:a,logger:r})},KI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.register)return;let{webhookUrl:a}=Mt(n);await o.register({client:t,ctx:e,webhookUrl:a,logger:r})},LI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.unregister)return;let{webhookUrl:a}=Mt(n);await o.unregister({ctx:e,webhookUrl:a,client:t,logger:r})},FI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createUser)return;let{tags:a}=Mt(n);return await o.createUser({ctx:e,client:t,tags:a,logger:r})},WI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createConversation)return;let{channel:a,tags:i}=Mt(n);return await o.createConversation({ctx:e,client:t,channel:a,tags:i,logger:r})},zI=async({ctx:t,req:e,client:n,logger:r,instance:o})=>{let{conversation:a,user:i,type:s,payload:l,message:f}=Mt(e),p=o.channels[a.channel];if(!p)throw new Error(`Channel ${a.channel} not found`);let y=p.messages[s];if(!y)throw new Error(`Message of type ${s} not found in channel ${a.channel}`);await y({ctx:t,conversation:a,message:f,user:i,type:s,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:f.id,tags:h})},logger:r})},qI=async({req:t,ctx:e,client:n,logger:r,instance:o})=>{let{input:a,type:i}=Mt(t);if(!i)throw new Error("Missing action type");let s=o.actions[i];if(!s)throw new Error(`Action ${i} not found`);let l=new Vo,p={output:await s({ctx:e,input:a,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},GI=async({instance:t,client:e,ctx:n,logger:r,req:o})=>{let a=t.unknownOperationHandler;if(a)return await a({client:e,ctx:n,logger:r,req:o})};var Zl=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler,this.unknownOperationHandler=e.__advanced?.unknownOperationHandler}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;handler=Cv(this);start=e=>Wo(this.handler,e)};A();O();C();A();O();C();A();O();C();A();O();C();A();O();C();var jl=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.withPlugins={user:e.user,conversation:e.conversation,message:e.message,states:e.states,events:e.events,recurringEvents:e.recurringEvents,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;__advanced;withPlugins;get metadata(){return{sdkVersion:gn}}addIntegration(e,n){let r=this;r.integrations||(r.integrations={});let o=n?.alias??e.name;if(r.integrations[o])throw new Error(`Another integration with alias "${o}" is already installed in the bot`);return r.integrations[o]={...e,alias:o,enabled:n?.enabled,configurationType:n?.configurationType,configuration:n?.configuration,disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let o=n.alias??e.name;if(r.plugins[o])throw new Error(`Another plugin with alias "${o}" is already installed in the bot`);return r.plugins[o]={...e,alias:o,configuration:n.configuration,interfaces:n.interfaces},r.withPlugins.user=this._mergeUser(r.withPlugins.user,e.definition.user),r.withPlugins.conversation=this._mergeConversation(r.withPlugins.conversation,e.definition.conversation),r.withPlugins.message=this._mergeMessage(r.withPlugins.message,e.definition.message),r.withPlugins.recurringEvents=this._mergeRecurringEvents(r.withPlugins.recurringEvents,e.definition.recurringEvents),r.withPlugins.tables=this._mergeTables(r.withPlugins.tables,e.definition.tables),r.withPlugins.workflows=this._mergeWorkflows(r.withPlugins.workflows,e.definition.workflows),r.withPlugins.states=this._mergeStates(r.withPlugins.states,this._prefixKeysWithPluginAlias(e.definition.states,o)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,o)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,o)),this}_mergeUser=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeConversation=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeMessage=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeStates=(e,n)=>({...e,...n});_mergeEvents=(e,n)=>({...e,...n});_mergeRecurringEvents=(e,n)=>({...e,...n});_mergeActions=(e,n)=>({...e,...n});_mergeTables=(e,n)=>({...e,...n});_mergeWorkflows=(e,n)=>({...e,...n});_prefixKeysWithPluginAlias=(e,n)=>Le.mapKeys(e??{},r=>`${n}${yn}${r}`);dereferencePluginEntities(){let e=this._buildZuiReferenceMap();return{...this,withPlugins:{...this.withPlugins,events:this._dereferenceDefinitionSchemas(this.withPlugins.events,e),states:this._dereferenceDefinitionSchemas(this.withPlugins.states,e),tables:this._dereferenceDefinitionSchemas(this.withPlugins.tables,e),actions:this._dereferenceActionDefinitionSchemas(this.withPlugins.actions,e)},plugins:Object.fromEntries(Object.entries(this.plugins??{}).map(([n,r])=>[n,{...r,definition:{...r.definition,configuration:this._dereferenceDefinitionSchema(r.definition.configuration,e),events:this._dereferenceDefinitionSchemas(r.definition.events,e),states:this._dereferenceDefinitionSchemas(r.definition.states,e),tables:this._dereferenceDefinitionSchemas(r.definition.tables,e),actions:this._dereferenceActionDefinitionSchemas(r.definition.actions,e)}}]))}}_buildZuiReferenceMap(){let e={},n=Object.entries(this.plugins??{});for(let[r,o]of n){let a=Object.entries(o.interfaces??{});for(let[i,s]of a){let l=this.integrations?.[s.name];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${s.name}" which is not installed`);let f=Object.entries(s.entities??{});for(let[p,{name:y}]of f){let g=l.definition.entities?.[y]?.schema;if(!g)throw new Error(`Interface entity "${y}" does not exist in integration "${l.name}"`);e[`interface:${i}/entities/${p}`]=g}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,this._dereferenceDefinitionSchema(o,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};A();O();C();A();O();C();import{isApiError as eA,Client as tA,RuntimeError as Mv}from"@botpress/client";A();O();C();var li=class t extends mr{constructor(e){super({...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};A();O();C();A();O();C();var nn=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}get _inner(){return this._client}getConversation=(e=>this._run("getConversation",e));listConversations=(e=>this._run("listConversations",e));updateConversation=(e=>this._run("updateConversation",e));deleteConversation=(e=>this._run("deleteConversation",e));listParticipants=(e=>this._run("listParticipants",e));addParticipant=(e=>this._run("addParticipant",e));getParticipant=(e=>this._run("getParticipant",e));removeParticipant=(e=>this._run("removeParticipant",e));createEvent=(e=>this._run("createEvent",e));getEvent=(e=>this._run("getEvent",e));listEvents=(e=>this._run("listEvents",e));createMessage=(e=>this._run("createMessage",e));getOrCreateMessage=(e=>this._run("getOrCreateMessage",e));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let o=await this._client[e](n),a=this._hooks.after[e];return a&&(o=await a(o,n)),o}};A();O();C();var VI=X.enum(["event_received","register","unregister","ping","action_triggered"]),Ov=t=>({botId:t[Jo]||It("Missing bot id header"),operation:VI.parse(t[Xo]),type:t[qh]||It("Missing type header"),configuration:JSON.parse(q.from(t[Yo]||It("Missing configuration header"),"base64").toString("utf-8"))});A();O();C();var dt={status:200};A();O();C();A();O();C();var Kl=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var JI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Rv=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!JI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:YI(t,e)};if(!e.payload.workflow.name)return n.logger.warn("Received workflow update event without a workflow name. Assuming this workflow was not defined by the bot.",e.payload.workflow),dt;switch(e.payload.type){case"child_workflow_deleted":case"child_workflow_finished":n.logger.info(`Received child workflow event "${e.payload.type}", but child workflows are not yet supported`);break;case"workflow_timedout":case"workflow_started":case"workflow_continued":return await XI(n,e);default:e.payload.type}return dt},YI=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),XI=async(t,e)=>{let n=Kl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];if(!r||r.length===0)return t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),dt;let{updatedWorkflow:o}=await QI(t,e);return o.status==="pending"&&t.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `),dt},QI=async(t,e)=>{let n=Kl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name],o=structuredClone(e.payload.workflow);for(let a of r??[])o=await a({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:o});return{updatedWorkflow:o}};A();O();C();var Nv=t=>async e=>{let n=Ov(e.headers),r=new li,o=new tA({botId:n.botId,retry:Go}),a=new nn(o,{before:{createMessage:async s=>{let l=t.hookHandlers.before_outgoing_message[s.type]??[];for(let f of l){let p=new nn(o);s=(await f({client:p,ctx:n,logger:r.with({conversationId:s.conversationId,userId:s.userId}),data:s}))?.data??s}return s},callAction:async s=>{let l=t.hookHandlers.before_outgoing_call_action[s.type]??[];for(let f of l){let p=new nn(o);s=(await f({client:p,ctx:n,logger:r,data:s}))?.data??s}return s}},after:{createMessage:async s=>{let l=t.hookHandlers.after_outgoing_message[s.message.type]??[];for(let f of l){let p=new nn(o);s=(await f({client:p,ctx:n,logger:r.with({messageId:s.message.id,conversationId:s.message.conversationId,userId:s.message.userId}),data:s}))?.data??s}return s},callAction:async(s,l)=>{let{type:f}=l,p=t.hookHandlers.after_outgoing_call_action[f]??[];for(let y of p){let g=new nn(o);s=(await y({client:g,ctx:n,logger:r,data:{type:f,...s}}))?.data??s}return s}}}),i={req:e,ctx:n,logger:r,client:a,self:t};try{switch(n.operation){case"action_triggered":return await aA(i);case"event_received":return await oA(i);case"register":return await rA(i);case"unregister":return await iA(i);case"ping":return await nA(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(s){let l=s instanceof Error?s:new Error(String(s));if(eA(l)){let p=l.type==="Runtime"?l:new Mv(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let f=new Mv("An unexpected error occurred in the bot.",l);return r.error(f.message,l),{status:f.code,body:JSON.stringify(f.toJSON())}}},nA=async t=>dt,rA=async t=>dt,iA=async t=>dt,oA=async t=>{let{ctx:e,logger:n,req:r,client:o,self:a}=t,i={client:o,ctx:e,logger:n},s=Mt(r);if(i.logger=i.logger.with({eventId:s.event.id,messageId:s.event.messageId,conversationId:s.event.conversationId,userId:s.event.userId}),e.type==="workflow_update")return await Rv(t,s.event);if(e.type==="message_created"){let h=s.event,v=h.payload.message;i.logger=i.logger.with({messageId:v.id,conversationId:v.conversationId,userId:v.userId});let P=a.hookHandlers.before_incoming_message[v.type]??[];for(let E of P){let H=await E({...i,data:v});if(v=H?.data??v,H?.stop)return dt}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:v,event:h},T=a.messageHandlers[v.type]??[];for(let E of T)await E(B);let S=a.hookHandlers.after_incoming_message[v.type]??[];for(let E of S){let H=await E({...i,data:v});if(v=H?.data??v,H?.stop)return dt}return dt}if(e.type==="state_expired"){let v=s.event.payload.state,P={...i,state:v},B=a.stateExpiredHandlers[v.name]??[];for(let T of B)await T(P);return dt}let l=s.event,f=a.hookHandlers.before_incoming_event[l.type]??[];for(let h of f){let v=await h({...i,data:l});if(l=v?.data??l,v?.stop)return dt}let p={...i,event:l},y=a.eventHandlers[l.type]??[];for(let h of y)await h(p);let g=a.hookHandlers.after_incoming_event[l.type]??[];for(let h of g){let v=await h({...i,data:l});if(l=v?.data??l,v?.stop)return dt}return dt},aA=async({ctx:t,logger:e,req:n,client:r,self:o})=>{let{input:a,type:i}=Mt(n);if(!i)throw new Error("Missing action type");let s=o.hookHandlers.before_incoming_call_action[i]??[];for(let g of s){let h=await g({ctx:t,logger:e,client:r,data:{type:i,input:a}});a=h?.data?.input??a,i=h?.data?.type??i}let l=o.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let f=await l({ctx:t,logger:e,input:a,client:r,type:i}),p=o.hookHandlers.after_incoming_call_action[i]??[];for(let g of p){let h=await g({ctx:t,logger:e,client:r,data:{type:i,output:f}});i=h?.data?.type??i,f=h?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}};A();O();C();A();O();C();var rn=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>mn({workflowName:n,client:t,input:r}),running:r=>mn({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>mn({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>mn({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>mn({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>mn({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>mn({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>mn({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:o}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:At({client:t,workflow:o})}}})}),mn=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>At({client:t.client,workflow:n}))}},At=t=>{let e=!1;return{...t.workflow,async update(n){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,...n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:At(t)};let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"in_progress",eventId:t.event.id});return e=!0,await t.onWorkflowUpdate?.(n),{workflow:At({...t,workflow:n})}},async setFailed({failureReason:n}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async setCompleted({output:n}={}){let{workflow:r}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:n});return await t.onWorkflowUpdate?.(r),{workflow:At({...t,workflow:r})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:At({...t,workflow:n})}}}};A();O();C();var Ll=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get actionHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._actionHandlers[n];if(r)return r;for(let[o,a]of Object.entries(this._plugins)){let[i,s]=n.split(yn);if(!(i!==o||!s)&&(r=a.actionHandlers[s],r))return ft.setName(l=>r({...l,workflows:rn(l.client)}),r.name)}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.messageHandlers[n]??[]),o=this._messageHandlers[n]??[],a=this._messageHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.eventHandlers[n]??[]),o=this._eventHandlers[n]??[],a=this._eventHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(s=>s.stateExpiredHandlers[n]??[]),o=this._stateExpiredHandlers[n]??[],a=this._stateExpiredHandlers["*"]??[],i=[...o,...a].sort((s,l)=>s.order-l.order).map(({handler:s})=>s);return ye.unique([...r,...i]).map(s=>ft.setName(l=>s({...l,workflows:rn(l.client)}),s.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(o,a)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[a]??[]),s=this._hookHandlers[n]??{},l=s[a]??[],f=s["*"]??[],p=[...l,...f].sort((y,g)=>y.order-g.order).map(({handler:y})=>y);return ye.unique([...i,...p]).map(y=>ft.setName(g=>y({...g,workflows:rn(g.client)}),y.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,a)=>{let i=r[a]?.sort((l,f)=>l.order-f.order).map(({handler:l})=>l)??[],s=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[a]??[]);return ye.unique([...i,...s]).map(l=>ft.setName(async f=>{let p=f.workflow;return await l({...f,workflow:At({...f,onWorkflowUpdate(y){p=y}}),workflows:rn(f.client)}),p},l.name))}})}})}on={message:(e,n)=>{this._messageHandlers[e]=ye.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ye.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ye.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ye.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ye.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ye.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ye.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ye.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ye.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ye.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ye.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ye.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ye.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ye.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ye.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ye.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=Nv(this);start=e=>Wo(this.handler,e)};A();O();C();A();O();C();A();O();C();A();O();C();A();O();C();var Fl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.title=e.title,this.description=e.description,this.readme=e.readme,this.entities=e.entities??{},this.attributes=e.attributes,this.__advanced=e.__advanced;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),o=e.actions===void 0?{}:Le.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(n)},output:{...i.output,schema:i.output.schema(n)}})),a=e.channels===void 0?{}:Le.mapValues(e.channels,i=>({...i,messages:Le.mapValues(i.messages,s=>({...s,schema:s.schema(n)}))}));this.events=r,this.actions=o,this.channels=a}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:gn}}_getEntityReference=e=>{let n={};for(let[r,o]of Object.entries(e)){let a=o.schema._def["x-zui"]?.title,i=o.schema._def.description,s=Ey.ref(r);a&&s.title(a),i&&s.describe(i),n[r]=s}return n}};A();O();C();A();O();C();A();O();C();A();O();C();var Wl=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([r,o])=>[r,Object.fromEntries(Object.entries(o.definition.entities??{}).map(([a])=>[a,X.ref(`interface:${r}/entities/${a}`)]))]));this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.recurringEvents=e.recurringEvents,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.configuration=e.configuration?{...e.configuration,schema:typeof e.configuration.schema=="object"?e.configuration.schema:e.configuration.schema({entities:n})}:void 0,this.states=Object.fromEntries(Object.entries(e.states??{}).map(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([r,o])=>[r,{...o,input:{...o.input,schema:typeof o.input.schema=="object"?o.input.schema:o.input.schema({entities:n})},output:{...o.output,schema:typeof o.output.schema=="object"?o.output.schema:o.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([r,o])=>[r,{...o,schema:typeof o.schema=="object"?o.schema:o.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;__advanced;get metadata(){return{sdkVersion:gn}}dereferenceEntities({intersectWithUnknownRecord:e}={intersectWithUnknownRecord:!0}){let n=this._buildZuiReferenceMap(e);return{...this,configuration:this.configuration?{...this.configuration,schema:this._dereferenceZuiSchema(this.configuration.schema,n)}:void 0,events:this._dereferenceDefinitionSchemas(this.events,n),states:this._dereferenceDefinitionSchemas(this.states,n),tables:this._dereferenceDefinitionSchemas(this.tables,n),actions:this._dereferenceActionDefinitionSchemas(this.actions,n)}}_buildZuiReferenceMap(e){return Object.fromEntries(Object.entries(this.interfaces??{}).flatMap(([n,r])=>Object.entries(r.definition.entities??{}).map(([o,a])=>[`interface:${n}/entities/${o}`,e?a.schema.and(X.record(X.string(),X.unknown())):a.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,schema:this._dereferenceZuiSchema(o.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,o])=>[r,{...o,input:{schema:this._dereferenceZuiSchema(o.input.schema,n)},output:{schema:this._dereferenceZuiSchema(o.output.schema,n)}}]))}};A();O();C();A();O();C();A();O();C();A();O();C();var zl=":";var Dv=t=>{let[e,n]=t.split(zl);return!e||!n?null:{namespace:e,eventName:n}},Hv=t=>`${t.namespace}${zl}${t.actionName}`,Uv=t=>`${t.namespace}${zl}${t.eventName}`,$v=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.actions[t.actionName]?.name??t.actionName;return{namespace:r,actionName:o}},Zv=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.events[t.eventName]?.name??t.eventName;return{namespace:r,eventName:o}};var jv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,a)=>i=>sA({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:a,input:i})})}),sA=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:o})=>{let a=$v({namespace:n,actionName:r},e),i=Hv(a);return(await t.callAction({type:i,input:o})).output};A();O();C();A();O();C();A();O();C();var ql=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:o}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:o})}async schedule(e,n){let{conversationId:r,userId:o,messageId:a}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:o,messageId:a,schedule:n})}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}},Kv=(t,e)=>new Proxy({},{get:(n,r)=>{let o=e.alias!==void 0?`${e.alias}${yn}${r}`:r;return new ql({client:t,eventName:o})}});A();O();C();A();O();C();A();O();C();var Gl=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n,r){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs})}async getOrSet(e,n,r){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:r?.expiryMs}).then(o=>o.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,n){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:n})}},Lv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,a)=>{let i=e.alias!==void 0?`${e.alias}${yn}${a}`:a;return new Gl(t,r,i)}})});A();O();C();var Vl=class{constructor(e){this.props=e;this._actionHandlers=e.actions}_runtimeProps;_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},before_incoming_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{},after_incoming_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:n,interfaces:r,alias:o}=this._runtime,a=jv(e,this._runtime),i=Lv(e,this._runtime),s=rn(e),l=Kv(e,this._runtime);return{configuration:n,interfaces:r,actions:a,states:i,alias:o,workflows:s,events:l}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return ft.setName(o=>r({...o,...this._getTools(o.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,s)=>i.order-s.order).map(({handler:i})=>ft.setName(s=>i({...s,message:s.message,...this._getTools(s.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._eventHandlers[n]??[],o=Object.entries(this._eventHandlers).filter(([s])=>this._eventResolvesTo(s,n)).flatMap(([,s])=>s??[]),a=this._eventHandlers["*"]??[];return ye.unique([...r,...o,...a]).sort((s,l)=>s.order-l.order).map(({handler:s})=>ft.setName(l=>s({...l,event:l.event,...this._getTools(l.client)}),s.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[];return ye.unique([...r,...o]).sort((i,s)=>i.order-s.order).map(({handler:i})=>ft.setName(s=>i({...s,state:s.state,...this._getTools(s.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(o,a)=>{a=this._stripAliasPrefix(a);let i=r[a]??[],s=Object.entries(r).filter(([p])=>this._eventResolvesTo(p,a)).flatMap(([,p])=>p??[]),l=r["*"]??[];return ye.unique([...i,...s,...l]).sort((p,y)=>p.order-y.order).map(({handler:p})=>ft.setName(y=>p({...y,data:y.data,...this._getTools(y.client)}),p.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,a)=>(r[a]?.sort((s,l)=>s.order-l.order)??[]).map(({handler:s})=>ft.setName(async l=>{let f=l.workflow;return await s({...l,workflow:At({...l,onWorkflowUpdate(p){f=p}}),...this._getTools(l.client)}),f},s.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=ye.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=ye.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=ye.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=ye.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=ye.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=ye.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=ye.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=ye.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=ye.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=ye.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=ye.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=ye.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=ye.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=ye.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=ye.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=ye.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let r=Dv(e);if(!r)return!1;let o=Zv(r,this._runtime.interfaces);return Uv(o)===n};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}#`;return e.startsWith(r)?e.slice(r.length):e}};A();O();C();A();O();C();A();O();C();A();O();C();A();O();C();var Fv={};hn(Fv,{allWithinMajorOf:()=>lA,allWithinMinorOf:()=>uA});A();O();C();import*as ui from"semver";function lA(t){let e=ui.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function uA(t){let e=ui.major(t.version),n=ui.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}A();O();C();export{Lx as BRAND,Ll as Bot,jl as BotDefinition,li as BotLogger,nn as BotSpecificClient,Jn as DIRTY,$x as EMPTY_PATH,pe as INVALID,Zl as Integration,nl as IntegrationDefinition,si as IntegrationLogger,ri as IntegrationSpecificClient,Fl as InterfaceDefinition,LP as NEVER,gt as OK,Ot as ParseInputLazyPath,Tt as ParseStatus,Vl as Plugin,Wl as PluginDefinition,DU as RuntimeError,he as Schema,dC as WELL_KNOWN_ATTRIBUTES,Lr as ZodAny,Fr as ZodArray,La as ZodBigInt,Fa as ZodBoolean,Wa as ZodBranded,za as ZodCatch,qa as ZodDate,To as ZodDefault,mg as ZodDiscriminatedUnion,In as ZodEffects,or as ZodEnum,Wt as ZodError,rg as ZodFirstPartyTypeKind,vg as ZodFunction,Va as ZodIntersection,V as ZodIssueCode,Ja as ZodLazy,Ya as ZodLiteral,_g as ZodMap,wg as ZodNaN,Xa as ZodNativeEnum,qr as ZodNever,Qa as ZodNull,er as ZodNullable,es as ZodNumber,tr as ZodObject,ln as ZodOptional,ne as ZodParsedType,ts as ZodPipeline,bo as ZodPromise,wo as ZodReadonly,Ig as ZodRecord,Cg as ZodRef,he as ZodSchema,Og as ZodSet,yt as ZodString,Lg as ZodSymbol,In as ZodTransformer,rr as ZodTuple,he as ZodType,xo as ZodUndefined,ns as ZodUnion,Hr as ZodUnknown,qg as ZodVoid,te as addIssueToContext,Jx as agent,tP as aimodel,dP as any,mP as array,sP as bigint,Jg as boolean,KP as coerce,qx as conversation,_o as createZodEnum,Mg as cuid2Regex,Rg as cuidRegex,gg as custom,nP as datasource,lP as date,_P as discriminatedUnion,Xc as effect,Hg as emailRegex,CP as enum,ue as errorUtil,Yx as event,kP as function,jr as getErrorMap,sn as getParsedType,oP as instanceof,eP as intent,bP as intersection,$g as ipv4Regex,Zg as ipv6Regex,wa as isAborted,NU as isApiError,Ii as isAsync,xa as isDirty,Fx as isEmojiRegex,Kr as isValid,AA as json,rP as knowledgebase,iP as late,IP as lazy,AP as literal,ki as makeIssue,EP as map,Gr as mergeObjectSchemas,Vx as message,Hy as messages,aP as nan,OP as nativeEnum,gP as never,fP as null,NP as nullable,Vg as number,hP as object,ba as objectUtil,jP as oboolean,ZP as onumber,MP as optional,$P as ostring,Mt as parseBody,UP as pipeline,HP as preprocess,me as processCreateParams,RP as promise,Ux as quotelessJson,BP as readonly,xP as record,PP as ref,Wo as serve,SP as set,ag as setErrorMap,vP as strictObject,Gg as string,uP as symbol,Xx as table,Qx as tablerow,Xc as transformer,tT as transforms,wP as tuple,Ng as ulidRegex,cP as undefined,TP as union,pP as unknown,Gx as user,be as util,Dg as uuidRegex,zx as variable,Fv as version,yP as void,X as z};
|
|
94
94
|
/*! Bundled license information:
|
|
95
95
|
|
|
96
96
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|