@botpress/sdk 4.10.0 → 4.11.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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var Qa=Object.defineProperty;var Dv=Object.getOwnPropertyDescriptor;var Hv=Object.getOwnPropertyNames;var Uv=Object.prototype.hasOwnProperty;var ot=(t,e)=>()=>(t&&(e=t(t=0)),e);var Fn=(t,e)=>{for(var n in e)Qa(t,n,{get:e[n],enumerable:!0})},$v=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Hv(e))!Uv.call(t,a)&&a!==n&&Qa(t,a,{get:()=>e[a],enumerable:!(r=Dv(e,a))||r.enumerable});return t};var Zv=t=>$v(Qa({},"__esModule",{value:!0}),t);var C=ot(()=>{});var J={};Fn(J,{_debugEnd:()=>Nu,_debugProcess:()=>Mu,_events:()=>Xu,_eventsCount:()=>Yu,_exiting:()=>yu,_fatalExceptions:()=>Au,_getActiveHandles:()=>Tu,_getActiveRequests:()=>vu,_kill:()=>bu,_linkedBinding:()=>pu,_maxListeners:()=>Ju,_preload_modules:()=>qu,_rawDebug:()=>fu,_startProfilerIdleNotifier:()=>Du,_stopProfilerIdleNotifier:()=>Hu,_tickCallback:()=>Ru,abort:()=>ju,addListener:()=>Qu,allowedNodeEnvironmentFlags:()=>Su,arch:()=>Xl,argv:()=>eu,argv0:()=>zu,assert:()=>ku,binding:()=>au,browser:()=>cu,chdir:()=>lu,config:()=>mu,cpuUsage:()=>fi,cwd:()=>su,debugPort:()=>Wu,default:()=>lc,dlopen:()=>hu,domain:()=>gu,emit:()=>ic,emitWarning:()=>iu,env:()=>Ql,execArgv:()=>tu,execPath:()=>Fu,exit:()=>Bu,features:()=>Iu,hasUncaughtExceptionCaptureCallback:()=>Ou,hrtime:()=>ci,kill:()=>Pu,listeners:()=>sc,memoryUsage:()=>xu,moduleLoadList:()=>du,nextTick:()=>Gl,off:()=>tc,on:()=>$t,once:()=>ec,openStdin:()=>Eu,pid:()=>Ku,platform:()=>Yl,ppid:()=>Lu,prependListener:()=>ac,prependOnceListener:()=>oc,reallyExit:()=>_u,release:()=>uu,removeAllListeners:()=>rc,removeListener:()=>nc,resourceUsage:()=>wu,setSourceMapsEnabled:()=>Gu,setUncaughtExceptionCaptureCallback:()=>Cu,stderr:()=>$u,stdin:()=>Zu,stdout:()=>Uu,title:()=>Jl,umask:()=>ou,uptime:()=>Vu,version:()=>nu,versions:()=>ru});function no(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function jv(){!Wn||!gn||(Wn=!1,gn.length?Ut=gn.concat(Ut):ui=-1,Ut.length&&ql())}function ql(){if(!Wn){var t=setTimeout(jv,0);Wn=!0;for(var e=Ut.length;e;){for(gn=Ut,Ut=[];++ui<e;)gn&&gn[ui].run();ui=-1,e=Ut.length}gn=null,Wn=!1,clearTimeout(t)}}function Gl(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];Ut.push(new Vl(t,e)),Ut.length===1&&!Wn&&setTimeout(ql,0)}function Vl(t,e){this.fun=t,this.array=e}function lt(){}function pu(t){no("_linkedBinding")}function hu(t){no("dlopen")}function vu(){return[]}function Tu(){return[]}function ku(t,e){if(!t)throw new Error(e||"assertion error")}function Ou(){return!1}function Vu(){return tn.now()/1e3}function ci(t){var e=Math.floor((Date.now()-tn.now())*.001),n=tn.now()*.001,r=Math.floor(n)+e,a=Math.floor(n%1*1e9);return t&&(r=r-t[0],a=a-t[1],a<0&&(r--,a+=to)),[r,a]}function $t(){return lc}function sc(t){return[]}var Ut,Wn,gn,ui,Jl,Xl,Yl,Ql,eu,tu,nu,ru,iu,au,ou,su,lu,uu,cu,fu,du,gu,yu,mu,_u,bu,fi,wu,xu,Pu,Bu,Eu,Su,Iu,Au,Cu,Ru,Mu,Nu,Du,Hu,Uu,$u,Zu,ju,Ku,Lu,Fu,Wu,zu,qu,Gu,tn,eo,to,Ju,Xu,Yu,Qu,ec,tc,nc,rc,ic,ac,oc,lc,uc=ot(()=>{C();R();O();Ut=[],Wn=!1,ui=-1;Vl.prototype.run=function(){this.fun.apply(null,this.array)};Jl="browser",Xl="x64",Yl="browser",Ql={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},eu=["/usr/bin/node"],tu=[],nu="v16.8.0",ru={},iu=function(t,e){console.warn((e?e+": ":"")+t)},au=function(t){no("binding")},ou=function(t){return 0},su=function(){return"/"},lu=function(t){},uu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};cu=!0,fu=lt,du=[];gu={},yu=!1,mu={};_u=lt,bu=lt,fi=function(){return{}},wu=fi,xu=fi,Pu=lt,Bu=lt,Eu=lt,Su={};Iu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Au=lt,Cu=lt;Ru=lt,Mu=lt,Nu=lt,Du=lt,Hu=lt,Uu=void 0,$u=void 0,Zu=void 0,ju=lt,Ku=2,Lu=1,Fu="/bin/usr/node",Wu=9229,zu="node",qu=[],Gu=lt,tn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};tn.now===void 0&&(eo=Date.now(),tn.timing&&tn.timing.navigationStart&&(eo=tn.timing.navigationStart),tn.now=()=>Date.now()-eo);to=1e9;ci.bigint=function(t){var e=ci(t);return typeof BigInt>"u"?e[0]*to+e[1]:BigInt(e[0]*to)+BigInt(e[1])};Ju=10,Xu={},Yu=0;Qu=$t,ec=$t,tc=$t,nc=$t,rc=$t,ic=lt,ac=$t,oc=$t;lc={version:nu,versions:ru,arch:Xl,platform:Yl,browser:cu,release:uu,_rawDebug:fu,moduleLoadList:du,binding:au,_linkedBinding:pu,_events:Xu,_eventsCount:Yu,_maxListeners:Ju,on:$t,addListener:Qu,once:ec,off:tc,removeListener:nc,removeAllListeners:rc,emit:ic,prependListener:ac,prependOnceListener:oc,listeners:sc,domain:gu,_exiting:yu,config:mu,dlopen:hu,uptime:Vu,_getActiveRequests:vu,_getActiveHandles:Tu,reallyExit:_u,_kill:bu,cpuUsage:fi,resourceUsage:wu,memoryUsage:xu,kill:Pu,exit:Bu,openStdin:Eu,allowedNodeEnvironmentFlags:Su,assert:ku,features:Iu,_fatalExceptions:Au,setUncaughtExceptionCaptureCallback:Cu,hasUncaughtExceptionCaptureCallback:Ou,emitWarning:iu,nextTick:Gl,_tickCallback:Ru,_debugProcess:Mu,_debugEnd:Nu,_startProfilerIdleNotifier:Du,_stopProfilerIdleNotifier:Hu,stdout:Uu,stdin:Zu,stderr:$u,abort:ju,umask:ou,chdir:lu,cwd:su,env:Ql,title:Jl,argv:eu,execArgv:tu,pid:Ku,ppid:Lu,execPath:Fu,debugPort:Wu,hrtime:ci,argv0:zu,_preload_modules:qu,setSourceMapsEnabled:Gu}});var O=ot(()=>{uc()});function Kv(){if(cc)return br;cc=!0,br.byteLength=o,br.toByteArray=f,br.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=r.length;a<s;++a)t[a]=r[a],e[r.charCodeAt(a)]=a;e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63;function i(h){var w=h.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=w);var B=P===w?0:4-P%4;return[P,B]}function o(h){var w=i(h),P=w[0],B=w[1];return(P+B)*3/4-B}function l(h,w,P){return(w+P)*3/4-P}function f(h){var w,P=i(h),B=P[0],v=P[1],S=new n(l(h,B,v)),E=0,H=v>0?B-4:B,K;for(K=0;K<H;K+=4)w=e[h.charCodeAt(K)]<<18|e[h.charCodeAt(K+1)]<<12|e[h.charCodeAt(K+2)]<<6|e[h.charCodeAt(K+3)],S[E++]=w>>16&255,S[E++]=w>>8&255,S[E++]=w&255;return v===2&&(w=e[h.charCodeAt(K)]<<2|e[h.charCodeAt(K+1)]>>4,S[E++]=w&255),v===1&&(w=e[h.charCodeAt(K)]<<10|e[h.charCodeAt(K+1)]<<4|e[h.charCodeAt(K+2)]>>2,S[E++]=w>>8&255,S[E++]=w&255),S}function p(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,w,P){for(var B,v=[],S=w;S<P;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),v.push(p(B));return v.join("")}function g(h){for(var w,P=h.length,B=P%3,v=[],S=16383,E=0,H=P-B;E<H;E+=S)v.push(y(h,E,E+S>H?H:E+S));return B===1?(w=h[P-1],v.push(t[w>>2]+t[w<<4&63]+"==")):B===2&&(w=(h[P-2]<<8)+h[P-1],v.push(t[w>>10]+t[w>>4&63]+t[w<<2&63]+"=")),v.join("")}return br}function Lv(){if(fc)return di;fc=!0;return di.read=function(t,e,n,r,a){var s,i,o=a*8-r-1,l=(1<<o)-1,f=l>>1,p=-7,y=n?a-1:0,g=n?-1:1,h=t[e+y];for(y+=g,s=h&(1<<-p)-1,h>>=-p,p+=o;p>0;s=s*256+t[e+y],y+=g,p-=8);for(i=s&(1<<-p)-1,s>>=-p,p+=r;p>0;i=i*256+t[e+y],y+=g,p-=8);if(s===0)s=1-f;else{if(s===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),s=s-f}return(h?-1:1)*i*Math.pow(2,s-r)},di.write=function(t,e,n,r,a,s){var i,o,l,f=s*8-a-1,p=(1<<f)-1,y=p>>1,g=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,w=r?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=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?(o=0,i=p):i+y>=1?(o=(e*l-1)*Math.pow(2,a),i=i+y):(o=e*Math.pow(2,y-1)*Math.pow(2,a),i=0));a>=8;t[n+h]=o&255,h+=w,o/=256,a-=8);for(i=i<<a|o,f+=a;f>0;t[n+h]=i&255,h+=w,i/=256,f-=8);t[n+h-w]|=P*128},di}function Rt(){if(dc)return yn;dc=!0;let t=Kv(),e=Lv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;yn.Buffer=i,yn.SlowBuffer=v,yn.INSPECT_MAX_BYTES=50;let r=2147483647;yn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=a(),!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 a(){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 s(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 o(m,u,c)}i.poolSize=8192;function o(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(wt(m,ArrayBuffer)||m&&wt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(wt(m,SharedArrayBuffer)||m&&wt(m.buffer,SharedArrayBuffer)))return w(m,u,c);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let T=m.valueOf&&m.valueOf();if(T!=null&&T!==m)return i.from(T,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 o(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?s(m):u!==void 0?typeof c=="string"?s(m).fill(u,c):s(m).fill(u):s(m)}i.alloc=function(m,u,c){return f(m,u,c)};function p(m){return l(m),s(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,T=s(c),I=T.write(m,u);return I!==c&&(T=T.slice(0,I)),T}function g(m){let u=m.length<0?0:B(m.length)|0,c=s(u);for(let T=0;T<u;T+=1)c[T]=m[T]&255;return c}function h(m){if(wt(m,Uint8Array)){let u=new Uint8Array(m);return w(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function w(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 T;return u===void 0&&c===void 0?T=new Uint8Array(m):c===void 0?T=new Uint8Array(m,u):T=new Uint8Array(m,u,c),Object.setPrototypeOf(T,i.prototype),T}function P(m){if(i.isBuffer(m)){let u=B(m.length)|0,c=s(u);return c.length===0||m.copy(c,0,0,u),c}if(m.length!==void 0)return typeof m.length!="number"||Tr(m.length)?s(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 v(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(wt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),wt(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 T=u.length,I=c.length;for(let U=0,W=Math.min(T,I);U<W;++U)if(u[U]!==c[U]){T=u[U],I=c[U];break}return T<I?-1:I<T?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 T;if(c===void 0)for(c=0,T=0;T<u.length;++T)c+=u[T].length;let I=i.allocUnsafe(c),U=0;for(T=0;T<u.length;++T){let W=u[T];if(wt(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)||wt(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,T=arguments.length>2&&arguments[2]===!0;if(!T&&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 kt(m).length;default:if(I)return T?-1:Me(m).length;u=(""+u).toLowerCase(),I=!0}}i.byteLength=S;function E(m,u,c){let T=!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 mt(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(T)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),T=!0}}i.prototype._isBuffer=!0;function H(m,u,c){let T=m[u];m[u]=m[c],m[c]=T}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=yn.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,T,I,U){if(wt(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),T===void 0&&(T=u?u.length:0),I===void 0&&(I=0),U===void 0&&(U=this.length),c<0||T>u.length||I<0||U>this.length)throw new RangeError("out of range index");if(I>=U&&c>=T)return 0;if(I>=U)return-1;if(c>=T)return 1;if(c>>>=0,T>>>=0,I>>>=0,U>>>=0,this===u)return 0;let W=U-I,Be=T-c,qe=Math.min(W,Be),Ze=this.slice(I,U),Ge=u.slice(c,T);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 K(m,u,c,T,I){if(m.length===0)return-1;if(typeof c=="string"?(T=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,Tr(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,T)),i.isBuffer(u))return u.length===0?-1:ae(m,u,c,T,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):ae(m,[u],c,T,I);throw new TypeError("val must be string, number or Buffer")}function ae(m,u,c,T,I){let U=1,W=m.length,Be=u.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="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,T){return this.indexOf(u,c,T)!==-1},i.prototype.indexOf=function(u,c,T){return K(this,u,c,T,!0)},i.prototype.lastIndexOf=function(u,c,T){return K(this,u,c,T,!1)};function Q(m,u,c,T){c=Number(c)||0;let I=m.length-c;T?(T=Number(T),T>I&&(T=I)):T=I;let U=u.length;T>U/2&&(T=U/2);let W;for(W=0;W<T;++W){let Be=parseInt(u.substr(W*2,2),16);if(Tr(Be))return W;m[c+W]=Be}return W}function ge(m,u,c,T){return Ot(Me(u,m.length-c),m,c,T)}function oe(m,u,c,T){return Ot(_e(u),m,c,T)}function re(m,u,c,T){return Ot(kt(u),m,c,T)}function Oe(m,u,c,T){return Ot($(u,m.length-c),m,c,T)}i.prototype.write=function(u,c,T,I){if(c===void 0)I="utf8",T=this.length,c=0;else if(T===void 0&&typeof c=="string")I=c,T=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(T)?(T=T>>>0,I===void 0&&(I="utf8")):(I=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-c;if((T===void 0||T>U)&&(T=U),u.length>0&&(T<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 Q(this,u,c,T);case"utf8":case"utf-8":return ge(this,u,c,T);case"ascii":case"latin1":case"binary":return oe(this,u,c,T);case"base64":return re(this,u,c,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,c,T);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 T=[],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,T.push(W>>>10&1023|55296),W=56320|W&1023),T.push(W),I+=Be}return Je(T)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let c="",T=0;for(;T<u;)c+=String.fromCharCode.apply(String,m.slice(T,T+=Ve));return c}function mt(m,u,c){let T="";c=Math.min(m.length,c);for(let I=u;I<c;++I)T+=String.fromCharCode(m[I]&127);return T}function Ue(m,u,c){let T="";c=Math.min(m.length,c);for(let I=u;I<c;++I)T+=String.fromCharCode(m[I]);return T}function Pe(m,u,c){let T=m.length;(!u||u<0)&&(u=0),(!c||c<0||c>T)&&(c=T);let I="";for(let U=u;U<c;++U)I+=li[m[U]];return I}function Se(m,u,c){let T=m.slice(u,c),I="";for(let U=0;U<T.length-1;U+=2)I+=String.fromCharCode(T[U]+T[U+1]*256);return I}i.prototype.slice=function(u,c){let T=this.length;u=~~u,c=c===void 0?T:~~c,u<0?(u+=T,u<0&&(u=0)):u>T&&(u=T),c<0?(c+=T,c<0&&(c=0)):c>T&&(c=T),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,T){u=u>>>0,c=c>>>0,T||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,T){u=u>>>0,c=c>>>0,T||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=Bt(function(u){u=u>>>0,_(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===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+T*2**24;return BigInt(I)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=Bt(function(u){u=u>>>0,_(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===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+T;return(BigInt(I)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,c,T){u=u>>>0,c=c>>>0,T||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,T){u=u>>>0,c=c>>>0,T||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 T=this[u]|this[u+1]<<8;return T&32768?T|4294901760:T},i.prototype.readInt16BE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let T=this[u+1]|this[u]<<8;return T&32768?T|4294901760:T},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=Bt(function(u){u=u>>>0,_(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(T<<24);return(BigInt(I)<<BigInt(32))+BigInt(c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=Bt(function(u){u=u>>>0,_(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===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+T)}),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,T,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+T>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,c,T,I){if(u=+u,c=c>>>0,T=T>>>0,!I){let Be=Math.pow(2,8*T)-1;ve(this,u,c,T,Be,0)}let U=1,W=0;for(this[c]=u&255;++W<T&&(U*=256);)this[c+W]=u/U&255;return c+T},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,c,T,I){if(u=+u,c=c>>>0,T=T>>>0,!I){let Be=Math.pow(2,8*T)-1;ve(this,u,c,T,Be,0)}let U=T-1,W=1;for(this[c+U]=u&255;--U>=0&&(W*=256);)this[c+U]=u/W&255;return c+T},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,1,255,0),this[c]=u&255,c+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,c,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||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,T,I){ie(u,T,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 j(m,u,c,T,I){ie(u,T,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=Bt(function(u,c=0){return D(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Bt(function(u,c=0){return j(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,c,T,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*T-1);ve(this,u,c,T,qe-1,-qe)}let U=0,W=1,Be=0;for(this[c]=u&255;++U<T&&(W*=256);)u<0&&Be===0&&this[c+U-1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+T},i.prototype.writeIntBE=function(u,c,T,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*T-1);ve(this,u,c,T,qe-1,-qe)}let U=T-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+T},i.prototype.writeInt8=function(u,c,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeInt16BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeInt32LE=function(u,c,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||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=Bt(function(u,c=0){return D(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Bt(function(u,c=0){return j(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,c,T,I,U){if(c+T>m.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function de(m,u,c,T,I){return u=+u,c=c>>>0,I||F(m,u,c,4),e.write(m,u,c,T,23,4),c+4}i.prototype.writeFloatLE=function(u,c,T){return de(this,u,c,!0,T)},i.prototype.writeFloatBE=function(u,c,T){return de(this,u,c,!1,T)};function Te(m,u,c,T,I){return u=+u,c=c>>>0,I||F(m,u,c,8),e.write(m,u,c,T,52,8),c+8}i.prototype.writeDoubleLE=function(u,c,T){return Te(this,u,c,!0,T)},i.prototype.writeDoubleBE=function(u,c,T){return Te(this,u,c,!1,T)},i.prototype.copy=function(u,c,T,I){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(T||(T=0),!I&&I!==0&&(I=this.length),c>=u.length&&(c=u.length),c||(c=0),I>0&&I<T&&(I=T),I===T||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=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-T&&(I=u.length-c+T);let U=I-T;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,T,I):Uint8Array.prototype.set.call(u,this.subarray(T,I),c),U},i.prototype.fill=function(u,c,T,I){if(typeof u=="string"){if(typeof c=="string"?(I=c,c=0,T=this.length):typeof T=="string"&&(I=T,T=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<T)throw new RangeError("Out of range index");if(T<=c)return this;c=c>>>0,T=T===void 0?this.length:T>>>0,u||(u=0);let U;if(typeof u=="number")for(U=c;U<T;++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<T-c;++U)this[U+c]=W[U%Be]}return this};let A={};function k(m,u,c){A[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 T=`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"),T+=` It must be ${u}. Received ${I}`,T},RangeError);function Z(m){let u="",c=m.length,T=m[0]==="-"?1:0;for(;c>=T+4;c-=3)u=`_${m.slice(c-3,c)}${u}`;return`${m.slice(0,c)}${u}`}function X(m,u,c){_(u,"offset"),(m[u]===void 0||m[u+c]===void 0)&&x(u,m.length-(c+1))}function ie(m,u,c,T,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 A.ERR_OUT_OF_RANGE("value",Be,m)}X(T,I,U)}function _(m,u){if(typeof m!="number")throw new A.ERR_INVALID_ARG_TYPE(u,"number",m)}function x(m,u,c){throw Math.floor(m)!==m?(_(m,c),new A.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${u}`,m)}let z=/[^+/0-9A-Za-z-_]/g;function Y(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,T=m.length,I=null,U=[];for(let W=0;W<T;++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===T){(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,T,I,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)c=m.charCodeAt(W),T=c>>8,I=c%256,U.push(I),U.push(T);return U}function kt(m){return t.toByteArray(Y(m))}function Ot(m,u,c,T){let I;for(I=0;I<T&&!(I+c>=u.length||I>=m.length);++I)u[I+c]=m[I];return I}function wt(m,u){return m instanceof u||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===u.name}function Tr(m){return m!==m}let li=function(){let m="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){let T=c*16;for(let I=0;I<16;++I)u[T+I]=m[c]+m[I]}return u}();function Bt(m){return typeof BigInt>"u"?_r:m}function _r(){throw new Error("BigInt not supported")}return yn}var br,cc,di,fc,yn,dc,pi=ot(()=>{C();R();O();br={},cc=!1;di={},fc=!1;yn={},dc=!1});var mn,q,lA,uA,pc=ot(()=>{C();R();O();pi();mn=Rt();mn.Buffer;mn.SlowBuffer;mn.INSPECT_MAX_BYTES;mn.kMaxLength;q=mn.Buffer,lA=mn.INSPECT_MAX_BYTES,uA=mn.kMaxLength});var R=ot(()=>{pc()});function Mt(){return Hy||(Hy=!0,typeof Object.create=="function"?Ba=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ba=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Ba}var Ba,Hy,is=ot(()=>{C();R();O();Ba={},Hy=!1});function Ne(){Ne.init.call(this)}function Ea(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 a,s,i,o;if(Ea(n),(s=t._events)===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),i=s[e]),i===void 0)i=s[e]=n,++t._eventsCount;else if(typeof i=="function"?i=s[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(a=qy(t))>0&&i.length>a&&!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,o=l,console&&console.warn&&console.warn(o)}return t}function NB(){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},a=NB.bind(r);return a.listener=n,r.wrapFn=a,a}function Ly(t,e,n){var r=t._events;if(r===void 0)return[];var a=r[e];return a===void 0?[]:typeof a=="function"?n?[a.listener||a]:[a]:n?function(s){for(var i=new Array(s.length),o=0;o<i.length;++o)i[o]=s[o].listener||s[o];return i}(a):Gy(a,a.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,or,Uy,$y,Zy,Tt,as=ot(()=>{C();R();O();or=typeof Reflect=="object"?Reflect:null,Uy=or&&typeof or.apply=="function"?or.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};zy=or&&typeof or.ownKeys=="function"?or.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",a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var i=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw i.context=s,i}var o=a[t];if(o===void 0)return!1;if(typeof o=="function")Uy(o,this,e);else{var l=o.length,f=Gy(o,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 Ea(e),this.on(t,Ky(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return Ea(e),this.prependListener(t,Ky(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,a,s,i;if(Ea(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(a=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){i=n[s].listener,a=s;break}if(a<0)return this;a===0?n.shift():function(o,l){for(;l+1<o.length;l++)o[l]=o[l+1];o.pop()}(n,a),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 a,s=Object.keys(n);for(r=0;r<s.length;++r)(a=s[r])!=="removeListener"&&this.removeAllListeners(a);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):[]};Tt=Wy;Tt.EventEmitter;Tt.defaultMaxListeners;Tt.init;Tt.listenerCount;Tt.EventEmitter;Tt.defaultMaxListeners;Tt.init;Tt.listenerCount});var Vy=ot(()=>{C();R();O();as();Tt.once=function(t,e){return new Promise((n,r)=>{function a(...i){s!==void 0&&t.removeListener("error",s),n(i)}let s;e!=="error"&&(s=i=>{t.removeListener(name,a),r(i)},t.once("error",s)),t.once(e,a)})};Tt.on=function(t,e){let n=[],r=[],a=null,s=!1,i={async next(){let f=n.shift();if(f)return createIterResult(f,!1);if(a){let p=Promise.reject(a);return a=null,p}return s?createIterResult(void 0,!0):new Promise((p,y)=>r.push({resolve:p,reject:y}))},async return(){t.removeListener(e,o),t.removeListener("error",l),s=!0;for(let f of r)f.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(f){a=f,t.removeListener(e,o),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,o),t.on("error",l),i;function o(...f){let p=r.shift();p?p.resolve(createIterResult(f,!1)):n.push(f)}function l(f){s=!0;let p=r.shift();p?p.reject(f):a=f,i.return()}}});function cs(){throw new Error("setTimeout has not been defined")}function fs(){throw new Error("clearTimeout has not been defined")}function um(t){if(qt===setTimeout)return setTimeout(t,0);if((qt===cs||!qt)&&setTimeout)return qt=setTimeout,setTimeout(t,0);try{return qt(t,0)}catch{try{return qt.call(null,t,0)}catch{return qt.call(this||lr,t,0)}}}function DB(){sr&&Mn&&(sr=!1,Mn.length?Vt=Mn.concat(Vt):Oa=-1,Vt.length&&cm())}function cm(){if(!sr){var t=um(DB);sr=!0;for(var e=Vt.length;e;){for(Mn=Vt,Vt=[];++Oa<e;)Mn&&Mn[Oa].run();Oa=-1,e=Vt.length}Mn=null,sr=!1,function(n){if(Gt===clearTimeout)return clearTimeout(n);if((Gt===fs||!Gt)&&clearTimeout)return Gt=clearTimeout,clearTimeout(n);try{Gt(n)}catch{try{return Gt.call(null,n)}catch{return Gt.call(this||lr,n)}}}(t)}}function Jy(t,e){(this||lr).fun=t,(this||lr).array=e}function zt(){}function Dn(t){return t.call.bind(t)}function Qr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function Yy(t){return _t&&xt?Et(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 _t&&xt?Et(t)==="Uint8Array":We(t)==="[object Uint8Array]"||zB(t)&&t.buffer!==void 0}function hm(t){return _t&&xt?Et(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function vm(t){return _t&&xt?Et(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function Tm(t){return _t&&xt?Et(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function _m(t){return _t&&xt?Et(t)==="Int8Array":We(t)==="[object Int8Array]"}function bm(t){return _t&&xt?Et(t)==="Int16Array":We(t)==="[object Int16Array]"}function wm(t){return _t&&xt?Et(t)==="Int32Array":We(t)==="[object Int32Array]"}function xm(t){return _t&&xt?Et(t)==="Float32Array":We(t)==="[object Float32Array]"}function Pm(t){return _t&&xt?Et(t)==="Float64Array":We(t)==="[object Float64Array]"}function Bm(t){return _t&&xt?Et(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Em(t){return _t&&xt?Et(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function Sa(t){return We(t)==="[object Map]"}function ka(t){return We(t)==="[object Set]"}function Ia(t){return We(t)==="[object WeakMap]"}function os(t){return We(t)==="[object WeakSet]"}function Ma(t){return We(t)==="[object ArrayBuffer]"}function Qy(t){return typeof ArrayBuffer<"u"&&(Ma.working?Ma(t):t instanceof ArrayBuffer)}function Na(t){return We(t)==="[object DataView]"}function em(t){return typeof DataView<"u"&&(Na.working?Na(t):t instanceof DataView)}function Da(t){return We(t)==="[object SharedArrayBuffer]"}function tm(t){return typeof SharedArrayBuffer<"u"&&(Da.working?Da(t):t instanceof SharedArrayBuffer)}function nm(t){return Qr(t,XB)}function rm(t){return Qr(t,YB)}function im(t){return Qr(t,QB)}function am(t){return ym&&Qr(t,eE)}function om(t){return ps&&Qr(t,tE)}function ln(t,e){var n={seen:[],stylize:iE};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),gs(e)?n.showHidden=e:e&&L._extend(n,e),Nn(n.showHidden)&&(n.showHidden=!1),Nn(n.depth)&&(n.depth=2),Nn(n.colors)&&(n.colors=!1),Nn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=rE),Ha(n,t,n.depth)}function rE(t,e){var n=ln.styles[e];return n?"\x1B["+ln.colors[n][0]+"m"+t+"\x1B["+ln.colors[n][1]+"m":t}function iE(t,e){return t}function Ha(t,e,n){if(t.customInspect&&e&&Ra(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ua(r)||(r=Ha(t,r,n)),r}var a=function(g,h){if(Nn(h))return g.stylize("undefined","undefined");if(Ua(h)){var w="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(w,"string")}if(Im(h))return g.stylize(""+h,"number");if(gs(h))return g.stylize(""+h,"boolean");if(ja(h))return g.stylize("null","null")}(t,e);if(a)return a;var s=Object.keys(e),i=function(g){var h={};return g.forEach(function(w,P){h[w]=!0}),h}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),Yr(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return ss(e);if(s.length===0){if(Ra(e)){var o=e.name?": "+e.name:"";return t.stylize("[Function"+o+"]","special")}if(Xr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if($a(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Yr(e))return ss(e)}var l,f="",p=!1,y=["{","}"];return km(e)&&(p=!0,y=["[","]"]),Ra(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),Xr(e)&&(f=" "+RegExp.prototype.toString.call(e)),$a(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Yr(e)&&(f=" "+ss(e)),s.length!==0||p&&e.length!=0?n<0?Xr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=p?function(g,h,w,P,B){for(var v=[],S=0,E=h.length;S<E;++S)Am(h,String(S))?v.push(ls(g,h,w,P,String(S),!0)):v.push("");return B.forEach(function(H){H.match(/^\d+$/)||v.push(ls(g,h,w,P,H,!0))}),v}(t,e,n,i,s):s.map(function(g){return ls(t,e,n,i,g,p)}),t.seen.pop(),function(g,h,w){var P=0;return g.reduce(function(B,v){return P++,v.indexOf(`
1
+ var Qa=Object.defineProperty;var Dv=Object.getOwnPropertyDescriptor;var Hv=Object.getOwnPropertyNames;var Uv=Object.prototype.hasOwnProperty;var ot=(t,e)=>()=>(t&&(e=t(t=0)),e);var Wn=(t,e)=>{for(var n in e)Qa(t,n,{get:e[n],enumerable:!0})},Zv=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Hv(e))!Uv.call(t,a)&&a!==n&&Qa(t,a,{get:()=>e[a],enumerable:!(r=Dv(e,a))||r.enumerable});return t};var $v=t=>Zv(Qa({},"__esModule",{value:!0}),t);var C=ot(()=>{});var J={};Wn(J,{_debugEnd:()=>Nu,_debugProcess:()=>Mu,_events:()=>Xu,_eventsCount:()=>Yu,_exiting:()=>yu,_fatalExceptions:()=>Au,_getActiveHandles:()=>Tu,_getActiveRequests:()=>vu,_kill:()=>bu,_linkedBinding:()=>pu,_maxListeners:()=>Ju,_preload_modules:()=>qu,_rawDebug:()=>fu,_startProfilerIdleNotifier:()=>Du,_stopProfilerIdleNotifier:()=>Hu,_tickCallback:()=>Ru,abort:()=>ju,addListener:()=>Qu,allowedNodeEnvironmentFlags:()=>Su,arch:()=>Xl,argv:()=>eu,argv0:()=>zu,assert:()=>ku,binding:()=>au,browser:()=>cu,chdir:()=>lu,config:()=>mu,cpuUsage:()=>fi,cwd:()=>su,debugPort:()=>Wu,default:()=>lc,dlopen:()=>hu,domain:()=>gu,emit:()=>ic,emitWarning:()=>iu,env:()=>Ql,execArgv:()=>tu,execPath:()=>Fu,exit:()=>Bu,features:()=>Iu,hasUncaughtExceptionCaptureCallback:()=>Ou,hrtime:()=>ci,kill:()=>Pu,listeners:()=>sc,memoryUsage:()=>xu,moduleLoadList:()=>du,nextTick:()=>Gl,off:()=>tc,on:()=>Zt,once:()=>ec,openStdin:()=>Eu,pid:()=>Ku,platform:()=>Yl,ppid:()=>Lu,prependListener:()=>ac,prependOnceListener:()=>oc,reallyExit:()=>_u,release:()=>uu,removeAllListeners:()=>rc,removeListener:()=>nc,resourceUsage:()=>wu,setSourceMapsEnabled:()=>Gu,setUncaughtExceptionCaptureCallback:()=>Cu,stderr:()=>Zu,stdin:()=>$u,stdout:()=>Uu,title:()=>Jl,umask:()=>ou,uptime:()=>Vu,version:()=>nu,versions:()=>ru});function no(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function jv(){!zn||!yn||(zn=!1,yn.length?Ut=yn.concat(Ut):ui=-1,Ut.length&&ql())}function ql(){if(!zn){var t=setTimeout(jv,0);zn=!0;for(var e=Ut.length;e;){for(yn=Ut,Ut=[];++ui<e;)yn&&yn[ui].run();ui=-1,e=Ut.length}yn=null,zn=!1,clearTimeout(t)}}function Gl(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];Ut.push(new Vl(t,e)),Ut.length===1&&!zn&&setTimeout(ql,0)}function Vl(t,e){this.fun=t,this.array=e}function lt(){}function pu(t){no("_linkedBinding")}function hu(t){no("dlopen")}function vu(){return[]}function Tu(){return[]}function ku(t,e){if(!t)throw new Error(e||"assertion error")}function Ou(){return!1}function Vu(){return tn.now()/1e3}function ci(t){var e=Math.floor((Date.now()-tn.now())*.001),n=tn.now()*.001,r=Math.floor(n)+e,a=Math.floor(n%1*1e9);return t&&(r=r-t[0],a=a-t[1],a<0&&(r--,a+=to)),[r,a]}function Zt(){return lc}function sc(t){return[]}var Ut,zn,yn,ui,Jl,Xl,Yl,Ql,eu,tu,nu,ru,iu,au,ou,su,lu,uu,cu,fu,du,gu,yu,mu,_u,bu,fi,wu,xu,Pu,Bu,Eu,Su,Iu,Au,Cu,Ru,Mu,Nu,Du,Hu,Uu,Zu,$u,ju,Ku,Lu,Fu,Wu,zu,qu,Gu,tn,eo,to,Ju,Xu,Yu,Qu,ec,tc,nc,rc,ic,ac,oc,lc,uc=ot(()=>{C();R();O();Ut=[],zn=!1,ui=-1;Vl.prototype.run=function(){this.fun.apply(null,this.array)};Jl="browser",Xl="x64",Yl="browser",Ql={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},eu=["/usr/bin/node"],tu=[],nu="v16.8.0",ru={},iu=function(t,e){console.warn((e?e+": ":"")+t)},au=function(t){no("binding")},ou=function(t){return 0},su=function(){return"/"},lu=function(t){},uu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};cu=!0,fu=lt,du=[];gu={},yu=!1,mu={};_u=lt,bu=lt,fi=function(){return{}},wu=fi,xu=fi,Pu=lt,Bu=lt,Eu=lt,Su={};Iu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Au=lt,Cu=lt;Ru=lt,Mu=lt,Nu=lt,Du=lt,Hu=lt,Uu=void 0,Zu=void 0,$u=void 0,ju=lt,Ku=2,Lu=1,Fu="/bin/usr/node",Wu=9229,zu="node",qu=[],Gu=lt,tn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};tn.now===void 0&&(eo=Date.now(),tn.timing&&tn.timing.navigationStart&&(eo=tn.timing.navigationStart),tn.now=()=>Date.now()-eo);to=1e9;ci.bigint=function(t){var e=ci(t);return typeof BigInt>"u"?e[0]*to+e[1]:BigInt(e[0]*to)+BigInt(e[1])};Ju=10,Xu={},Yu=0;Qu=Zt,ec=Zt,tc=Zt,nc=Zt,rc=Zt,ic=lt,ac=Zt,oc=Zt;lc={version:nu,versions:ru,arch:Xl,platform:Yl,browser:cu,release:uu,_rawDebug:fu,moduleLoadList:du,binding:au,_linkedBinding:pu,_events:Xu,_eventsCount:Yu,_maxListeners:Ju,on:Zt,addListener:Qu,once:ec,off:tc,removeListener:nc,removeAllListeners:rc,emit:ic,prependListener:ac,prependOnceListener:oc,listeners:sc,domain:gu,_exiting:yu,config:mu,dlopen:hu,uptime:Vu,_getActiveRequests:vu,_getActiveHandles:Tu,reallyExit:_u,_kill:bu,cpuUsage:fi,resourceUsage:wu,memoryUsage:xu,kill:Pu,exit:Bu,openStdin:Eu,allowedNodeEnvironmentFlags:Su,assert:ku,features:Iu,_fatalExceptions:Au,setUncaughtExceptionCaptureCallback:Cu,hasUncaughtExceptionCaptureCallback:Ou,emitWarning:iu,nextTick:Gl,_tickCallback:Ru,_debugProcess:Mu,_debugEnd:Nu,_startProfilerIdleNotifier:Du,_stopProfilerIdleNotifier:Hu,stdout:Uu,stdin:$u,stderr:Zu,abort:ju,umask:ou,chdir:lu,cwd:su,env:Ql,title:Jl,argv:eu,execArgv:tu,pid:Ku,ppid:Lu,execPath:Fu,debugPort:Wu,hrtime:ci,argv0:zu,_preload_modules:qu,setSourceMapsEnabled:Gu}});var O=ot(()=>{uc()});function Kv(){if(cc)return br;cc=!0,br.byteLength=o,br.toByteArray=f,br.fromByteArray=g;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=r.length;a<s;++a)t[a]=r[a],e[r.charCodeAt(a)]=a;e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63;function i(h){var w=h.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=h.indexOf("=");P===-1&&(P=w);var B=P===w?0:4-P%4;return[P,B]}function o(h){var w=i(h),P=w[0],B=w[1];return(P+B)*3/4-B}function l(h,w,P){return(w+P)*3/4-P}function f(h){var w,P=i(h),B=P[0],v=P[1],S=new n(l(h,B,v)),E=0,H=v>0?B-4:B,K;for(K=0;K<H;K+=4)w=e[h.charCodeAt(K)]<<18|e[h.charCodeAt(K+1)]<<12|e[h.charCodeAt(K+2)]<<6|e[h.charCodeAt(K+3)],S[E++]=w>>16&255,S[E++]=w>>8&255,S[E++]=w&255;return v===2&&(w=e[h.charCodeAt(K)]<<2|e[h.charCodeAt(K+1)]>>4,S[E++]=w&255),v===1&&(w=e[h.charCodeAt(K)]<<10|e[h.charCodeAt(K+1)]<<4|e[h.charCodeAt(K+2)]>>2,S[E++]=w>>8&255,S[E++]=w&255),S}function p(h){return t[h>>18&63]+t[h>>12&63]+t[h>>6&63]+t[h&63]}function y(h,w,P){for(var B,v=[],S=w;S<P;S+=3)B=(h[S]<<16&16711680)+(h[S+1]<<8&65280)+(h[S+2]&255),v.push(p(B));return v.join("")}function g(h){for(var w,P=h.length,B=P%3,v=[],S=16383,E=0,H=P-B;E<H;E+=S)v.push(y(h,E,E+S>H?H:E+S));return B===1?(w=h[P-1],v.push(t[w>>2]+t[w<<4&63]+"==")):B===2&&(w=(h[P-2]<<8)+h[P-1],v.push(t[w>>10]+t[w>>4&63]+t[w<<2&63]+"=")),v.join("")}return br}function Lv(){if(fc)return di;fc=!0;return di.read=function(t,e,n,r,a){var s,i,o=a*8-r-1,l=(1<<o)-1,f=l>>1,p=-7,y=n?a-1:0,g=n?-1:1,h=t[e+y];for(y+=g,s=h&(1<<-p)-1,h>>=-p,p+=o;p>0;s=s*256+t[e+y],y+=g,p-=8);for(i=s&(1<<-p)-1,s>>=-p,p+=r;p>0;i=i*256+t[e+y],y+=g,p-=8);if(s===0)s=1-f;else{if(s===l)return i?NaN:(h?-1:1)*(1/0);i=i+Math.pow(2,r),s=s-f}return(h?-1:1)*i*Math.pow(2,s-r)},di.write=function(t,e,n,r,a,s){var i,o,l,f=s*8-a-1,p=(1<<f)-1,y=p>>1,g=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,w=r?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=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?(o=0,i=p):i+y>=1?(o=(e*l-1)*Math.pow(2,a),i=i+y):(o=e*Math.pow(2,y-1)*Math.pow(2,a),i=0));a>=8;t[n+h]=o&255,h+=w,o/=256,a-=8);for(i=i<<a|o,f+=a;f>0;t[n+h]=i&255,h+=w,i/=256,f-=8);t[n+h-w]|=P*128},di}function Rt(){if(dc)return mn;dc=!0;let t=Kv(),e=Lv(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;mn.Buffer=i,mn.SlowBuffer=v,mn.INSPECT_MAX_BYTES=50;let r=2147483647;mn.kMaxLength=r,i.TYPED_ARRAY_SUPPORT=a(),!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 a(){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 s(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 o(m,u,c)}i.poolSize=8192;function o(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(wt(m,ArrayBuffer)||m&&wt(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(wt(m,SharedArrayBuffer)||m&&wt(m.buffer,SharedArrayBuffer)))return w(m,u,c);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let T=m.valueOf&&m.valueOf();if(T!=null&&T!==m)return i.from(T,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 o(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?s(m):u!==void 0?typeof c=="string"?s(m).fill(u,c):s(m).fill(u):s(m)}i.alloc=function(m,u,c){return f(m,u,c)};function p(m){return l(m),s(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,T=s(c),I=T.write(m,u);return I!==c&&(T=T.slice(0,I)),T}function g(m){let u=m.length<0?0:B(m.length)|0,c=s(u);for(let T=0;T<u;T+=1)c[T]=m[T]&255;return c}function h(m){if(wt(m,Uint8Array)){let u=new Uint8Array(m);return w(u.buffer,u.byteOffset,u.byteLength)}return g(m)}function w(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 T;return u===void 0&&c===void 0?T=new Uint8Array(m):c===void 0?T=new Uint8Array(m,u):T=new Uint8Array(m,u,c),Object.setPrototypeOf(T,i.prototype),T}function P(m){if(i.isBuffer(m)){let u=B(m.length)|0,c=s(u);return c.length===0||m.copy(c,0,0,u),c}if(m.length!==void 0)return typeof m.length!="number"||Tr(m.length)?s(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 v(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(wt(u,Uint8Array)&&(u=i.from(u,u.offset,u.byteLength)),wt(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 T=u.length,I=c.length;for(let U=0,W=Math.min(T,I);U<W;++U)if(u[U]!==c[U]){T=u[U],I=c[U];break}return T<I?-1:I<T?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 T;if(c===void 0)for(c=0,T=0;T<u.length;++T)c+=u[T].length;let I=i.allocUnsafe(c),U=0;for(T=0;T<u.length;++T){let W=u[T];if(wt(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)||wt(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,T=arguments.length>2&&arguments[2]===!0;if(!T&&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 kt(m).length;default:if(I)return T?-1:Me(m).length;u=(""+u).toLowerCase(),I=!0}}i.byteLength=S;function E(m,u,c){let T=!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 mt(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(T)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),T=!0}}i.prototype._isBuffer=!0;function H(m,u,c){let T=m[u];m[u]=m[c],m[c]=T}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=mn.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,T,I,U){if(wt(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),T===void 0&&(T=u?u.length:0),I===void 0&&(I=0),U===void 0&&(U=this.length),c<0||T>u.length||I<0||U>this.length)throw new RangeError("out of range index");if(I>=U&&c>=T)return 0;if(I>=U)return-1;if(c>=T)return 1;if(c>>>=0,T>>>=0,I>>>=0,U>>>=0,this===u)return 0;let W=U-I,Be=T-c,qe=Math.min(W,Be),$e=this.slice(I,U),Ge=u.slice(c,T);for(let He=0;He<qe;++He)if($e[He]!==Ge[He]){W=$e[He],Be=Ge[He];break}return W<Be?-1:Be<W?1:0};function K(m,u,c,T,I){if(m.length===0)return-1;if(typeof c=="string"?(T=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,Tr(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,T)),i.isBuffer(u))return u.length===0?-1:ae(m,u,c,T,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):ae(m,[u],c,T,I);throw new TypeError("val must be string, number or Buffer")}function ae(m,u,c,T,I){let U=1,W=m.length,Be=u.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="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 $e;if(I){let Ge=-1;for($e=c;$e<W;$e++)if(qe(m,$e)===qe(u,Ge===-1?0:$e-Ge)){if(Ge===-1&&(Ge=$e),$e-Ge+1===Be)return Ge*U}else Ge!==-1&&($e-=$e-Ge),Ge=-1}else for(c+Be>W&&(c=W-Be),$e=c;$e>=0;$e--){let Ge=!0;for(let He=0;He<Be;He++)if(qe(m,$e+He)!==qe(u,He)){Ge=!1;break}if(Ge)return $e}return-1}i.prototype.includes=function(u,c,T){return this.indexOf(u,c,T)!==-1},i.prototype.indexOf=function(u,c,T){return K(this,u,c,T,!0)},i.prototype.lastIndexOf=function(u,c,T){return K(this,u,c,T,!1)};function ee(m,u,c,T){c=Number(c)||0;let I=m.length-c;T?(T=Number(T),T>I&&(T=I)):T=I;let U=u.length;T>U/2&&(T=U/2);let W;for(W=0;W<T;++W){let Be=parseInt(u.substr(W*2,2),16);if(Tr(Be))return W;m[c+W]=Be}return W}function ge(m,u,c,T){return Ot(Me(u,m.length-c),m,c,T)}function oe(m,u,c,T){return Ot(_e(u),m,c,T)}function re(m,u,c,T){return Ot(kt(u),m,c,T)}function Oe(m,u,c,T){return Ot(Z(u,m.length-c),m,c,T)}i.prototype.write=function(u,c,T,I){if(c===void 0)I="utf8",T=this.length,c=0;else if(T===void 0&&typeof c=="string")I=c,T=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(T)?(T=T>>>0,I===void 0&&(I="utf8")):(I=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let U=this.length-c;if((T===void 0||T>U)&&(T=U),u.length>0&&(T<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,T);case"utf8":case"utf-8":return ge(this,u,c,T);case"ascii":case"latin1":case"binary":return oe(this,u,c,T);case"base64":return re(this,u,c,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Oe(this,u,c,T);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 T=[],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,$e,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],$e=m[I+2],(qe&192)===128&&($e&192)===128&&(He=(U&15)<<12|(qe&63)<<6|$e&63,He>2047&&(He<55296||He>57343)&&(W=He));break;case 4:qe=m[I+1],$e=m[I+2],Ge=m[I+3],(qe&192)===128&&($e&192)===128&&(Ge&192)===128&&(He=(U&15)<<18|(qe&63)<<12|($e&63)<<6|Ge&63,He>65535&&He<1114112&&(W=He))}}W===null?(W=65533,Be=1):W>65535&&(W-=65536,T.push(W>>>10&1023|55296),W=56320|W&1023),T.push(W),I+=Be}return Je(T)}let Ve=4096;function Je(m){let u=m.length;if(u<=Ve)return String.fromCharCode.apply(String,m);let c="",T=0;for(;T<u;)c+=String.fromCharCode.apply(String,m.slice(T,T+=Ve));return c}function mt(m,u,c){let T="";c=Math.min(m.length,c);for(let I=u;I<c;++I)T+=String.fromCharCode(m[I]&127);return T}function Ue(m,u,c){let T="";c=Math.min(m.length,c);for(let I=u;I<c;++I)T+=String.fromCharCode(m[I]);return T}function Pe(m,u,c){let T=m.length;(!u||u<0)&&(u=0),(!c||c<0||c>T)&&(c=T);let I="";for(let U=u;U<c;++U)I+=li[m[U]];return I}function Se(m,u,c){let T=m.slice(u,c),I="";for(let U=0;U<T.length-1;U+=2)I+=String.fromCharCode(T[U]+T[U+1]*256);return I}i.prototype.slice=function(u,c){let T=this.length;u=~~u,c=c===void 0?T:~~c,u<0?(u+=T,u<0&&(u=0)):u>T&&(u=T),c<0?(c+=T,c<0&&(c=0)):c>T&&(c=T),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,T){u=u>>>0,c=c>>>0,T||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,T){u=u>>>0,c=c>>>0,T||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=Bt(function(u){u=u>>>0,_(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===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+T*2**24;return BigInt(I)+(BigInt(U)<<BigInt(32))}),i.prototype.readBigUInt64BE=Bt(function(u){u=u>>>0,_(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===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+T;return(BigInt(I)<<BigInt(32))+BigInt(U)}),i.prototype.readIntLE=function(u,c,T){u=u>>>0,c=c>>>0,T||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,T){u=u>>>0,c=c>>>0,T||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 T=this[u]|this[u+1]<<8;return T&32768?T|4294901760:T},i.prototype.readInt16BE=function(u,c){u=u>>>0,c||fe(u,2,this.length);let T=this[u+1]|this[u]<<8;return T&32768?T|4294901760:T},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=Bt(function(u){u=u>>>0,_(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===void 0)&&x(u,this.length-8);let I=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(T<<24);return(BigInt(I)<<BigInt(32))+BigInt(c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),i.prototype.readBigInt64BE=Bt(function(u){u=u>>>0,_(u,"offset");let c=this[u],T=this[u+7];(c===void 0||T===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+T)}),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,T,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+T>m.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(u,c,T,I){if(u=+u,c=c>>>0,T=T>>>0,!I){let Be=Math.pow(2,8*T)-1;ve(this,u,c,T,Be,0)}let U=1,W=0;for(this[c]=u&255;++W<T&&(U*=256);)this[c+W]=u/U&255;return c+T},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(u,c,T,I){if(u=+u,c=c>>>0,T=T>>>0,!I){let Be=Math.pow(2,8*T)-1;ve(this,u,c,T,Be,0)}let U=T-1,W=1;for(this[c+U]=u&255;--U>=0&&(W*=256);)this[c+U]=u/W&255;return c+T},i.prototype.writeUint8=i.prototype.writeUInt8=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,1,255,0),this[c]=u&255,c+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(u,c,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||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,T,I){ie(u,T,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 j(m,u,c,T,I){ie(u,T,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=Bt(function(u,c=0){return D(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Bt(function(u,c=0){return j(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(u,c,T,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*T-1);ve(this,u,c,T,qe-1,-qe)}let U=0,W=1,Be=0;for(this[c]=u&255;++U<T&&(W*=256);)u<0&&Be===0&&this[c+U-1]!==0&&(Be=1),this[c+U]=(u/W>>0)-Be&255;return c+T},i.prototype.writeIntBE=function(u,c,T,I){if(u=+u,c=c>>>0,!I){let qe=Math.pow(2,8*T-1);ve(this,u,c,T,qe-1,-qe)}let U=T-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+T},i.prototype.writeInt8=function(u,c,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},i.prototype.writeInt16BE=function(u,c,T){return u=+u,c=c>>>0,T||ve(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},i.prototype.writeInt32LE=function(u,c,T){return u=+u,c=c>>>0,T||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,T){return u=+u,c=c>>>0,T||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=Bt(function(u,c=0){return D(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Bt(function(u,c=0){return j(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(m,u,c,T,I,U){if(c+T>m.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function de(m,u,c,T,I){return u=+u,c=c>>>0,I||F(m,u,c,4),e.write(m,u,c,T,23,4),c+4}i.prototype.writeFloatLE=function(u,c,T){return de(this,u,c,!0,T)},i.prototype.writeFloatBE=function(u,c,T){return de(this,u,c,!1,T)};function Te(m,u,c,T,I){return u=+u,c=c>>>0,I||F(m,u,c,8),e.write(m,u,c,T,52,8),c+8}i.prototype.writeDoubleLE=function(u,c,T){return Te(this,u,c,!0,T)},i.prototype.writeDoubleBE=function(u,c,T){return Te(this,u,c,!1,T)},i.prototype.copy=function(u,c,T,I){if(!i.isBuffer(u))throw new TypeError("argument should be a Buffer");if(T||(T=0),!I&&I!==0&&(I=this.length),c>=u.length&&(c=u.length),c||(c=0),I>0&&I<T&&(I=T),I===T||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=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-T&&(I=u.length-c+T);let U=I-T;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,T,I):Uint8Array.prototype.set.call(u,this.subarray(T,I),c),U},i.prototype.fill=function(u,c,T,I){if(typeof u=="string"){if(typeof c=="string"?(I=c,c=0,T=this.length):typeof T=="string"&&(I=T,T=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<T)throw new RangeError("Out of range index");if(T<=c)return this;c=c>>>0,T=T===void 0?this.length:T>>>0,u||(u=0);let U;if(typeof u=="number")for(U=c;U<T;++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<T-c;++U)this[U+c]=W[U%Be]}return this};let A={};function k(m,u,c){A[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 T=`The value of "${m}" is out of range.`,I=c;return Number.isInteger(c)&&Math.abs(c)>2**32?I=$(String(c)):typeof c=="bigint"&&(I=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(I=$(I)),I+="n"),T+=` It must be ${u}. Received ${I}`,T},RangeError);function $(m){let u="",c=m.length,T=m[0]==="-"?1:0;for(;c>=T+4;c-=3)u=`_${m.slice(c-3,c)}${u}`;return`${m.slice(0,c)}${u}`}function X(m,u,c){_(u,"offset"),(m[u]===void 0||m[u+c]===void 0)&&x(u,m.length-(c+1))}function ie(m,u,c,T,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 A.ERR_OUT_OF_RANGE("value",Be,m)}X(T,I,U)}function _(m,u){if(typeof m!="number")throw new A.ERR_INVALID_ARG_TYPE(u,"number",m)}function x(m,u,c){throw Math.floor(m)!==m?(_(m,c),new A.ERR_OUT_OF_RANGE("offset","an integer",m)):u<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.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,T=m.length,I=null,U=[];for(let W=0;W<T;++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===T){(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 Z(m,u){let c,T,I,U=[];for(let W=0;W<m.length&&!((u-=2)<0);++W)c=m.charCodeAt(W),T=c>>8,I=c%256,U.push(I),U.push(T);return U}function kt(m){return t.toByteArray(Q(m))}function Ot(m,u,c,T){let I;for(I=0;I<T&&!(I+c>=u.length||I>=m.length);++I)u[I+c]=m[I];return I}function wt(m,u){return m instanceof u||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===u.name}function Tr(m){return m!==m}let li=function(){let m="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){let T=c*16;for(let I=0;I<16;++I)u[T+I]=m[c]+m[I]}return u}();function Bt(m){return typeof BigInt>"u"?_r:m}function _r(){throw new Error("BigInt not supported")}return mn}var br,cc,di,fc,mn,dc,pi=ot(()=>{C();R();O();br={},cc=!1;di={},fc=!1;mn={},dc=!1});var hn,q,lA,uA,pc=ot(()=>{C();R();O();pi();hn=Rt();hn.Buffer;hn.SlowBuffer;hn.INSPECT_MAX_BYTES;hn.kMaxLength;q=hn.Buffer,lA=hn.INSPECT_MAX_BYTES,uA=hn.kMaxLength});var R=ot(()=>{pc()});function Mt(){return Hy||(Hy=!0,typeof Object.create=="function"?Ba=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ba=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}),Ba}var Ba,Hy,is=ot(()=>{C();R();O();Ba={},Hy=!1});function Ne(){Ne.init.call(this)}function Ea(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 a,s,i,o;if(Ea(n),(s=t._events)===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),i=s[e]),i===void 0)i=s[e]=n,++t._eventsCount;else if(typeof i=="function"?i=s[e]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(a=qy(t))>0&&i.length>a&&!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,o=l,console&&console.warn&&console.warn(o)}return t}function NB(){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},a=NB.bind(r);return a.listener=n,r.wrapFn=a,a}function Ly(t,e,n){var r=t._events;if(r===void 0)return[];var a=r[e];return a===void 0?[]:typeof a=="function"?n?[a.listener||a]:[a]:n?function(s){for(var i=new Array(s.length),o=0;o<i.length;++o)i[o]=s[o].listener||s[o];return i}(a):Gy(a,a.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,sr,Uy,Zy,$y,Tt,as=ot(()=>{C();R();O();sr=typeof Reflect=="object"?Reflect:null,Uy=sr&&typeof sr.apply=="function"?sr.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};zy=sr&&typeof sr.ownKeys=="function"?sr.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};Wy=Ne,Ne.EventEmitter=Ne,Ne.prototype._events=void 0,Ne.prototype._eventsCount=0,Ne.prototype._maxListeners=void 0;$y=10;Object.defineProperty(Ne,"defaultMaxListeners",{enumerable:!0,get:function(){return $y},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+".");$y=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 qy(this)},Ne.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var i=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw i.context=s,i}var o=a[t];if(o===void 0)return!1;if(typeof o=="function")Uy(o,this,e);else{var l=o.length,f=Gy(o,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 Ea(e),this.on(t,Ky(this,t,e)),this},Ne.prototype.prependOnceListener=function(t,e){return Ea(e),this.prependListener(t,Ky(this,t,e)),this},Ne.prototype.removeListener=function(t,e){var n,r,a,s,i;if(Ea(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(a=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){i=n[s].listener,a=s;break}if(a<0)return this;a===0?n.shift():function(o,l){for(;l+1<o.length;l++)o[l]=o[l+1];o.pop()}(n,a),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 a,s=Object.keys(n);for(r=0;r<s.length;++r)(a=s[r])!=="removeListener"&&this.removeAllListeners(a);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):[]};Tt=Wy;Tt.EventEmitter;Tt.defaultMaxListeners;Tt.init;Tt.listenerCount;Tt.EventEmitter;Tt.defaultMaxListeners;Tt.init;Tt.listenerCount});var Vy=ot(()=>{C();R();O();as();Tt.once=function(t,e){return new Promise((n,r)=>{function a(...i){s!==void 0&&t.removeListener("error",s),n(i)}let s;e!=="error"&&(s=i=>{t.removeListener(name,a),r(i)},t.once("error",s)),t.once(e,a)})};Tt.on=function(t,e){let n=[],r=[],a=null,s=!1,i={async next(){let f=n.shift();if(f)return createIterResult(f,!1);if(a){let p=Promise.reject(a);return a=null,p}return s?createIterResult(void 0,!0):new Promise((p,y)=>r.push({resolve:p,reject:y}))},async return(){t.removeListener(e,o),t.removeListener("error",l),s=!0;for(let f of r)f.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(f){a=f,t.removeListener(e,o),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,o),t.on("error",l),i;function o(...f){let p=r.shift();p?p.resolve(createIterResult(f,!1)):n.push(f)}function l(f){s=!0;let p=r.shift();p?p.reject(f):a=f,i.return()}}});function cs(){throw new Error("setTimeout has not been defined")}function fs(){throw new Error("clearTimeout has not been defined")}function um(t){if(qt===setTimeout)return setTimeout(t,0);if((qt===cs||!qt)&&setTimeout)return qt=setTimeout,setTimeout(t,0);try{return qt(t,0)}catch{try{return qt.call(null,t,0)}catch{return qt.call(this||ur,t,0)}}}function DB(){lr&&Nn&&(lr=!1,Nn.length?Vt=Nn.concat(Vt):Oa=-1,Vt.length&&cm())}function cm(){if(!lr){var t=um(DB);lr=!0;for(var e=Vt.length;e;){for(Nn=Vt,Vt=[];++Oa<e;)Nn&&Nn[Oa].run();Oa=-1,e=Vt.length}Nn=null,lr=!1,function(n){if(Gt===clearTimeout)return clearTimeout(n);if((Gt===fs||!Gt)&&clearTimeout)return Gt=clearTimeout,clearTimeout(n);try{Gt(n)}catch{try{return Gt.call(null,n)}catch{return Gt.call(this||ur,n)}}}(t)}}function Jy(t,e){(this||ur).fun=t,(this||ur).array=e}function zt(){}function Hn(t){return t.call.bind(t)}function Qr(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function Yy(t){return _t&&xt?Et(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 _t&&xt?Et(t)==="Uint8Array":We(t)==="[object Uint8Array]"||zB(t)&&t.buffer!==void 0}function hm(t){return _t&&xt?Et(t)==="Uint8ClampedArray":We(t)==="[object Uint8ClampedArray]"}function vm(t){return _t&&xt?Et(t)==="Uint16Array":We(t)==="[object Uint16Array]"}function Tm(t){return _t&&xt?Et(t)==="Uint32Array":We(t)==="[object Uint32Array]"}function _m(t){return _t&&xt?Et(t)==="Int8Array":We(t)==="[object Int8Array]"}function bm(t){return _t&&xt?Et(t)==="Int16Array":We(t)==="[object Int16Array]"}function wm(t){return _t&&xt?Et(t)==="Int32Array":We(t)==="[object Int32Array]"}function xm(t){return _t&&xt?Et(t)==="Float32Array":We(t)==="[object Float32Array]"}function Pm(t){return _t&&xt?Et(t)==="Float64Array":We(t)==="[object Float64Array]"}function Bm(t){return _t&&xt?Et(t)==="BigInt64Array":We(t)==="[object BigInt64Array]"}function Em(t){return _t&&xt?Et(t)==="BigUint64Array":We(t)==="[object BigUint64Array]"}function Sa(t){return We(t)==="[object Map]"}function ka(t){return We(t)==="[object Set]"}function Ia(t){return We(t)==="[object WeakMap]"}function os(t){return We(t)==="[object WeakSet]"}function Ma(t){return We(t)==="[object ArrayBuffer]"}function Qy(t){return typeof ArrayBuffer<"u"&&(Ma.working?Ma(t):t instanceof ArrayBuffer)}function Na(t){return We(t)==="[object DataView]"}function em(t){return typeof DataView<"u"&&(Na.working?Na(t):t instanceof DataView)}function Da(t){return We(t)==="[object SharedArrayBuffer]"}function tm(t){return typeof SharedArrayBuffer<"u"&&(Da.working?Da(t):t instanceof SharedArrayBuffer)}function nm(t){return Qr(t,XB)}function rm(t){return Qr(t,YB)}function im(t){return Qr(t,QB)}function am(t){return ym&&Qr(t,eE)}function om(t){return ps&&Qr(t,tE)}function ln(t,e){var n={seen:[],stylize:iE};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),gs(e)?n.showHidden=e:e&&L._extend(n,e),Dn(n.showHidden)&&(n.showHidden=!1),Dn(n.depth)&&(n.depth=2),Dn(n.colors)&&(n.colors=!1),Dn(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=rE),Ha(n,t,n.depth)}function rE(t,e){var n=ln.styles[e];return n?"\x1B["+ln.colors[n][0]+"m"+t+"\x1B["+ln.colors[n][1]+"m":t}function iE(t,e){return t}function Ha(t,e,n){if(t.customInspect&&e&&Ra(e.inspect)&&e.inspect!==L.inspect&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Ua(r)||(r=Ha(t,r,n)),r}var a=function(g,h){if(Dn(h))return g.stylize("undefined","undefined");if(Ua(h)){var w="'"+JSON.stringify(h).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(w,"string")}if(Im(h))return g.stylize(""+h,"number");if(gs(h))return g.stylize(""+h,"boolean");if(ja(h))return g.stylize("null","null")}(t,e);if(a)return a;var s=Object.keys(e),i=function(g){var h={};return g.forEach(function(w,P){h[w]=!0}),h}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),Yr(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return ss(e);if(s.length===0){if(Ra(e)){var o=e.name?": "+e.name:"";return t.stylize("[Function"+o+"]","special")}if(Xr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Za(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Yr(e))return ss(e)}var l,f="",p=!1,y=["{","}"];return km(e)&&(p=!0,y=["[","]"]),Ra(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),Xr(e)&&(f=" "+RegExp.prototype.toString.call(e)),Za(e)&&(f=" "+Date.prototype.toUTCString.call(e)),Yr(e)&&(f=" "+ss(e)),s.length!==0||p&&e.length!=0?n<0?Xr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=p?function(g,h,w,P,B){for(var v=[],S=0,E=h.length;S<E;++S)Am(h,String(S))?v.push(ls(g,h,w,P,String(S),!0)):v.push("");return B.forEach(function(H){H.match(/^\d+$/)||v.push(ls(g,h,w,P,H,!0))}),v}(t,e,n,i,s):s.map(function(g){return ls(t,e,n,i,g,p)}),t.seen.pop(),function(g,h,w){var P=0;return g.reduce(function(B,v){return P++,v.indexOf(`
2
2
  `)>=0&&P++,B+v.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?w[0]+(h===""?"":h+`
3
3
  `)+" "+g.join(`,
4
4
  `)+" "+w[1]:w[0]+h+" "+g.join(", ")+" "+w[1]}(l,f,y)):y[0]+f+y[1]}function ss(t){return"["+Error.prototype.toString.call(t)+"]"}function ls(t,e,n,r,a,s){var i,o,l;if((l=Object.getOwnPropertyDescriptor(e,a)||{value:e[a]}).get?o=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(o=t.stylize("[Setter]","special")),Am(r,a)||(i="["+a+"]"),o||(t.seen.indexOf(l.value)<0?(o=ja(n)?Ha(t,l.value,null):Ha(t,l.value,n-1)).indexOf(`
@@ -7,20 +7,20 @@ var Qa=Object.defineProperty;var Dv=Object.getOwnPropertyDescriptor;var Hv=Objec
7
7
  `).substr(2):`
8
8
  `+o.split(`
9
9
  `).map(function(f){return" "+f}).join(`
10
- `)):o=t.stylize("[Circular]","special")),Nn(i)){if(s&&a.match(/^\d+$/))return o;(i=JSON.stringify(""+a)).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+": "+o}function km(t){return Array.isArray(t)}function gs(t){return typeof t=="boolean"}function ja(t){return t===null}function Im(t){return typeof t=="number"}function Ua(t){return typeof t=="string"}function Nn(t){return t===void 0}function Xr(t){return ur(t)&&ys(t)==="[object RegExp]"}function ur(t){return typeof t=="object"&&t!==null}function $a(t){return ur(t)&&ys(t)==="[object Date]"}function Yr(t){return ur(t)&&(ys(t)==="[object Error]"||t instanceof Error)}function Ra(t){return typeof t=="function"}function ys(t){return Object.prototype.toString.call(t)}function us(t){return t<10?"0"+t.toString(10):t.toString(10)}function oE(){var t=new Date,e=[us(t.getHours()),us(t.getMinutes()),us(t.getSeconds())].join(":");return[t.getDate(),aE[t.getMonth()],e].join(" ")}function Am(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function sE(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,qt,Gt,lr,Qe,Mn,Vt,sr,Oa,je,HB,ds,Za,fm,UB,$B,ZB,jB,KB,dm,pm,Xy,LB,FB,WB,gm,Ee,zB,qB,GB,ym,ps,xt,_t,VB,We,XB,YB,QB,Jr,L,Nt,sm,nE,Aa,Sm,Ca,aE,Rn,vC,Ka=ot(()=>{C();R();O();lr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=lm={};(function(){try{qt=typeof setTimeout=="function"?setTimeout:cs}catch{qt=cs}try{Gt=typeof clearTimeout=="function"?clearTimeout:fs}catch{Gt=fs}})();Vt=[],sr=!1,Oa=-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];Vt.push(new Jy(t,e)),Vt.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=zt,Qe.addListener=zt,Qe.once=zt,Qe.off=zt,Qe.removeListener=zt,Qe.removeAllListeners=zt,Qe.emit=zt,Qe.prependListener=zt,Qe.prependOnceListener=zt,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;HB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ds=Object.prototype.toString,Za=function(t){return!(HB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ds.call(t)==="[object Arguments]"},fm=function(t){return!!Za(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ds.call(t)!=="[object Array]"&&ds.call(t.callee)==="[object Function]"},UB=function(){return Za(arguments)}();Za.isLegacyArguments=fm;$B=UB?Za:fm,ZB=Object.prototype.toString,jB=Function.prototype.toString,KB=/^\s*(?:function)?\*/,dm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",pm=Object.getPrototypeOf,Xy=function(){if(!dm)return!1;try{return Function("return function*() {}")()}catch{}}(),LB=Xy?pm(Xy):{},FB=function(t){return typeof t=="function"&&(!!KB.test(jB.call(t))||(dm?pm(t)===LB:ZB.call(t)==="[object GeneratorFunction]"))},WB=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={},zB=gm,qB=$B,GB=FB;ym=typeof BigInt<"u",ps=typeof Symbol<"u",xt=ps&&Symbol.toStringTag!==void 0,_t=typeof Uint8Array<"u",VB=typeof ArrayBuffer<"u";if(_t&&xt)var JB=Object.getPrototypeOf(Uint8Array.prototype),Et=Dn(Object.getOwnPropertyDescriptor(JB,Symbol.toStringTag).get);We=Dn(Object.prototype.toString),XB=Dn(Number.prototype.valueOf),YB=Dn(String.prototype.valueOf),QB=Dn(Boolean.prototype.valueOf);if(ym)var eE=Dn(BigInt.prototype.valueOf);if(ps)var tE=Dn(Symbol.prototype.valueOf);Ee.isArgumentsObject=qB,Ee.isGeneratorFunction=GB,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 VB&&ArrayBuffer.isView?ArrayBuffer.isView(t):Yy(t)||em(t)},Ee.isTypedArray=Yy,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,Sa.working=typeof Map<"u"&&Sa(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(Sa.working?Sa(t):t instanceof Map)},ka.working=typeof Set<"u"&&ka(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(ka.working?ka(t):t instanceof Set)},Ia.working=typeof WeakMap<"u"&&Ia(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Ia.working?Ia(t):t instanceof WeakMap)},os.working=typeof WeakSet<"u"&&os(new WeakSet),Ee.isWeakSet=function(t){return os(t)},Ma.working=typeof ArrayBuffer<"u"&&Ma(new ArrayBuffer),Ee.isArrayBuffer=Qy,Na.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Na(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=em,Da.working=typeof SharedArrayBuffer<"u"&&Da(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=am,Ee.isSymbolObject=om,Ee.isBoxedPrimitive=function(t){return nm(t)||rm(t)||im(t)||am(t)||om(t)},Ee.isAnyArrayBuffer=function(t){return _t&&(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")}})});Jr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Nt=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},nE=/%[sdj%]/g;L.format=function(t){if(!Ua(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(ln(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,a=r.length,s=String(t).replace(nE,function(o){if(o==="%%")return"%";if(n>=a)return o;switch(o){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 o}}),i=r[n];n<a;i=r[++n])ja(i)||!ur(i)?s+=" "+i:s+=" "+ln(i);return s},L.deprecate=function(t,e){if(Nt!==void 0&&Nt.noDeprecation===!0)return t;if(Nt===void 0)return function(){return L.deprecate(t,e).apply(this||Jr,arguments)};var n=!1;return function(){if(!n){if(Nt.throwDeprecation)throw new Error(e);Nt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Jr,arguments)}};Aa={},Sm=/^$/;Nt.env.NODE_DEBUG&&(Ca=Nt.env.NODE_DEBUG,Ca=Ca.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Sm=new RegExp("^"+Ca+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Aa[t])if(Sm.test(t)){var e=Nt.pid;Aa[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Aa[t]=function(){};return Aa[t]},L.inspect=ln,ln.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]},ln.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=gs,L.isNull=ja,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Im,L.isString=Ua,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Nn,L.isRegExp=Xr,L.types.isRegExp=Xr,L.isObject=ur,L.isDate=$a,L.types.isDate=$a,L.isError=Yr,L.types.isNativeError=Yr,L.isFunction=Ra,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;aE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",oE(),L.format.apply(L,arguments))},L.inherits=WB,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};Rn=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(Rn&&t[Rn]){var e;if(typeof(e=t[Rn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Rn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,a=new Promise(function(o,l){n=o,r=l}),s=[],i=0;i<arguments.length;i++)s.push(arguments[i]);s.push(function(o,l){o?r(o):n(l)});try{t.apply(this||Jr,s)}catch(o){r(o)}return a}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Rn&&Object.defineProperty(e,Rn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,sm(t))},L.promisify.custom=Rn,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 a=n.pop();if(typeof a!="function")throw new TypeError("The last argument must be of type Function");var s=this||Jr,i=function(){return a.apply(s,arguments)};t.apply(this||Jr,n).then(function(o){Nt.nextTick(i.bind(null,null,o))},function(o){Nt.nextTick(sE.bind(null,o,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;vC=L.promisify;L.types});var PC,Cm=ot(()=>{C();R();O();Ka();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;PC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function Ts(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function lE(){!cr||!Hn||(cr=!1,Hn.length?Jt=Hn.concat(Jt):La=-1,Jt.length&&Om())}function Om(){if(!cr){var t=setTimeout(lE,0);cr=!0;for(var e=Jt.length;e;){for(Hn=Jt,Jt=[];++La<e;)Hn&&Hn[La].run();La=-1,e=Jt.length}Hn=null,cr=!1,clearTimeout(t)}}function uE(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 Rm(t,e)),Jt.length===1&&!cr&&setTimeout(Om,0)}function Rm(t,e){this.fun=t,this.array=e}function ct(){}function EE(t){Ts("_linkedBinding")}function AE(t){Ts("dlopen")}function CE(){return[]}function OE(){return[]}function jE(t,e){if(!t)throw new Error(e||"assertion error")}function WE(){return!1}function lS(){return un.now()/1e3}function vs(t){var e=Math.floor((Date.now()-un.now())*.001),n=un.now()*.001,r=Math.floor(n)+e,a=Math.floor(n%1*1e9);return t&&(r=r-t[0],a=a-t[1],a<0&&(r--,a+=hs)),[r,a]}function cn(){return At}function _S(t){return[]}var Jt,cr,Hn,La,cE,fE,dE,pE,gE,yE,mE,hE,vE,TE,_E,bE,wE,xE,PE,BE,SE,kE,IE,RE,ME,_s,NE,DE,HE,UE,$E,ZE,KE,LE,FE,zE,qE,GE,VE,JE,XE,YE,QE,eS,tS,nS,rS,iS,aS,oS,sS,un,ms,hs,uS,cS,fS,dS,pS,gS,yS,mS,hS,vS,TS,At,bs=ot(()=>{C();R();O();Jt=[],cr=!1,La=-1;Rm.prototype.run=function(){this.fun.apply(null,this.array)};cE="browser",fE="x64",dE="browser",pE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},gE=["/usr/bin/node"],yE=[],mE="v16.8.0",hE={},vE=function(t,e){console.warn((e?e+": ":"")+t)},TE=function(t){Ts("binding")},_E=function(t){return 0},bE=function(){return"/"},wE=function(t){},xE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};PE=ct,BE=[];SE={},kE=!1,IE={};RE=ct,ME=ct,_s=function(){return{}},NE=_s,DE=_s,HE=ct,UE=ct,$E=ct,ZE={};KE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},LE=ct,FE=ct;zE=ct,qE=ct,GE=ct,VE=ct,JE=ct,XE=void 0,YE=void 0,QE=void 0,eS=ct,tS=2,nS=1,rS="/bin/usr/node",iS=9229,aS="node",oS=[],sS=ct,un={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};un.now===void 0&&(ms=Date.now(),un.timing&&un.timing.navigationStart&&(ms=un.timing.navigationStart),un.now=()=>Date.now()-ms);hs=1e9;vs.bigint=function(t){var e=vs(t);return typeof BigInt>"u"?e[0]*hs+e[1]:BigInt(e[0]*hs)+BigInt(e[1])};uS=10,cS={},fS=0;dS=cn,pS=cn,gS=cn,yS=cn,mS=cn,hS=ct,vS=cn,TS=cn;At={version:mE,versions:hE,arch:fE,platform:dE,release:xE,_rawDebug:PE,moduleLoadList:BE,binding:TE,_linkedBinding:EE,_events:cS,_eventsCount:fS,_maxListeners:uS,on:cn,addListener:dS,once:pS,off:gS,removeListener:yS,removeAllListeners:mS,emit:hS,prependListener:vS,prependOnceListener:TS,listeners:_S,domain:SE,_exiting:kE,config:IE,dlopen:AE,uptime:lS,_getActiveRequests:CE,_getActiveHandles:OE,reallyExit:RE,_kill:ME,cpuUsage:_s,resourceUsage:NE,memoryUsage:DE,kill:HE,exit:UE,openStdin:$E,allowedNodeEnvironmentFlags:ZE,assert:jE,features:KE,_fatalExceptions:LE,setUncaughtExceptionCaptureCallback:FE,hasUncaughtExceptionCaptureCallback:WE,emitWarning:vE,nextTick:uE,_tickCallback:zE,_debugProcess:qE,_debugEnd:GE,_startProfilerIdleNotifier:VE,_stopProfilerIdleNotifier:JE,stdout:XE,stdin:QE,stderr:YE,abort:eS,umask:_E,chdir:wE,cwd:bE,env:pE,title:cE,argv:gE,execArgv:yE,pid:tS,ppid:nS,execPath:rS,debugPort:iS,hrtime:vs,argv0:aS,_preload_modules:oS,setSourceMapsEnabled:sS}});function Nm(){if(Mm)return ws;Mm=!0,ws=t;function t(n,r){if(e("noDeprecation"))return n;var a=!1;function s(){if(!a){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),a=!0}return n.apply(this||xs,arguments)}return s}function e(n){try{if(!xs.localStorage)return!1}catch{return!1}var r=xs.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return ws}var ws,Mm,xs,Dm=ot(()=>{C();R();O();ws={},Mm=!1,xs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function bS(){if(Hm)return ei;Hm=!0;var t=Rt(),e=t.Buffer;function n(a,s){for(var i in a)s[i]=a[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?ei=t:(n(t,ei),ei.Buffer=r);function r(a,s,i){return e(a,s,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(a,s,i){if(typeof a=="number")throw new TypeError("Argument must not be a number");return e(a,s,i)},r.alloc=function(a,s,i){if(typeof a!="number")throw new TypeError("Argument must be a number");var o=e(a);return s!==void 0?typeof i=="string"?o.fill(s,i):o.fill(s):o.fill(0),o},r.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return e(a)},r.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)},ei}function wS(){if(Um)return Ps;Um=!0;var t=bS().Buffer,e=t.isEncoding||function(v){switch(v=""+v,v&&v.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(v){if(!v)return"utf8";for(var S;;)switch(v){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 v;default:if(S)return;v=(""+v).toLowerCase(),S=!0}}function r(v){var S=n(v);if(typeof S!="string"&&(t.isEncoding===e||!e(v)))throw new Error("Unknown encoding: "+v);return S||v}Ps.StringDecoder=a;function a(v){this.encoding=r(v);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=w,S=3;break;default:this.write=P,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}a.prototype.write=function(v){if(v.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(v),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<v.length?S?S+this.text(v,E):this.text(v,E):S||""},a.prototype.end=p,a.prototype.text=f,a.prototype.fillLast=function(v){if(this.lastNeed<=v.length)return v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,v.length),this.lastNeed-=v.length};function s(v){return v<=127?0:v>>5===6?2:v>>4===14?3:v>>3===30?4:v>>6===2?-1:-2}function i(v,S,E){var H=S.length-1;if(H<E)return 0;var K=s(S[H]);return K>=0?(K>0&&(v.lastNeed=K-1),K):--H<E||K===-2?0:(K=s(S[H]),K>=0?(K>0&&(v.lastNeed=K-2),K):--H<E||K===-2?0:(K=s(S[H]),K>=0?(K>0&&(K===2?K=0:v.lastNeed=K-3),K):0))}function o(v,S,E){if((S[0]&192)!==128)return v.lastNeed=0,"\uFFFD";if(v.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return v.lastNeed=1,"\uFFFD";if(v.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return v.lastNeed=2,"\uFFFD"}}function l(v){var S=this.lastTotal-this.lastNeed,E=o(this,v);if(E!==void 0)return E;if(this.lastNeed<=v.length)return v.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,S,0,v.length),this.lastNeed-=v.length}function f(v,S){var E=i(this,v,S);if(!this.lastNeed)return v.toString("utf8",S);this.lastTotal=E;var H=v.length-(E-this.lastNeed);return v.copy(this.lastChar,0,H),v.toString("utf8",S,H)}function p(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+"\uFFFD":S}function y(v,S){if((v.length-S)%2===0){var E=v.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]=v[v.length-2],this.lastChar[1]=v[v.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",S,v.length-1)}function g(v){var S=v&&v.length?this.write(v):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(v,S){var E=(v.length-S)%3;return E===0?v.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=v[v.length-1]:(this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1]),v.toString("base64",S,v.length-E))}function w(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function P(v){return v.toString(this.encoding)}function B(v){return v&&v.length?this.write(v):""}return Ps}var ei,Hm,Ps,Um,ti,UC,$m=ot(()=>{C();R();O();pi();ei={},Hm=!1;Ps={},Um=!1;ti=wS();ti.StringDecoder;UC=ti.StringDecoder});function xS(){if(Zm)return Bs;Zm=!0;var t=Bs={},e,n;function r(){throw new Error("setTimeout has not been defined")}function a(){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=a}catch{n=a}})();function s(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===a||!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 o=[],l=!1,f,p=-1;function y(){!l||!f||(l=!1,f.length?o=f.concat(o):p=-1,o.length&&g())}function g(){if(!l){var P=s(y);l=!0;for(var B=o.length;B;){for(f=o,o=[];++p<B;)f&&f[p].run();p=-1,B=o.length}f=null,l=!1,i(P)}}t.nextTick=function(P){var B=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)B[v-1]=arguments[v];o.push(new h(P,B)),o.length===1&&!l&&s(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 w(){}return t.on=w,t.addListener=w,t.once=w,t.off=w,t.removeListener=w,t.removeAllListeners=w,t.emit=w,t.prependListener=w,t.prependOnceListener=w,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},Bs}var Bs,Zm,fr,Ke,Es=ot(()=>{C();R();O();Bs={},Zm=!1,fr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=xS();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 PS(){if(jm)return Ss;jm=!0;var t=Ke;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var o="",l=0,f=-1,p=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.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(o.length<2||l!==2||o.charCodeAt(o.length-1)!==46||o.charCodeAt(o.length-2)!==46){if(o.length>2){var h=o.lastIndexOf("/");if(h!==o.length-1){h===-1?(o="",l=0):(o=o.slice(0,h),l=o.length-1-o.lastIndexOf("/")),f=g,p=0;continue}}else if(o.length===2||o.length===1){o="",l=0,f=g,p=0;continue}}i&&(o.length>0?o+="/..":o="..",l=2)}else o.length>0?o+="/"+s.slice(f+1,g):o=s.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return o}function r(s,i){var o=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return o?o===i.root?o+l:o+s+l:l}var a={resolve:function(){for(var i="",o=!1,l,f=arguments.length-1;f>=-1&&!o;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,o=p.charCodeAt(0)===47)}return i=n(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var o=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!o),i.length===0&&!o&&(i="."),i.length>0&&l&&(i+="/"),o?"/"+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,o=0;o<arguments.length;++o){var l=arguments[o];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":a.normalize(i)},relative:function(i,o){if(e(i),e(o),i===o||(i=a.resolve(i),o=a.resolve(o),i===o))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<o.length&&o.charCodeAt(y)===47;++y);for(var g=o.length,h=g-y,w=p<h?p:h,P=-1,B=0;B<=w;++B){if(B===w){if(h>w){if(o.charCodeAt(y+B)===47)return o.slice(y+B+1);if(B===0)return o.slice(y+B)}else p>w&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var v=i.charCodeAt(l+B),S=o.charCodeAt(y+B);if(v!==S)break;v===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+o.slice(y+P):(y+=P,o.charCodeAt(y)===47&&++y,o.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var o=i.charCodeAt(0),l=o===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(o=i.charCodeAt(y),o===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(o!==void 0&&o.length>0&&o.length<=i.length){if(o.length===i.length&&o===i)return"";var g=o.length-1,h=-1;for(y=i.length-1;y>=0;--y){var w=i.charCodeAt(y);if(w===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(w===o.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 o=-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?o===-1?o=g:y!==1&&(y=1):o!==-1&&(y=-1)}return o===-1||f===-1||y===0||y===1&&o===f-1&&o===l+1?"":i.slice(o,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 o={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return o;var l=i.charCodeAt(0),f=l===47,p;f?(o.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,w=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!w){g=P+1;break}continue}h===-1&&(w=!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?o.base=o.name=i.slice(1,h):o.base=o.name=i.slice(g,h)):(g===0&&f?(o.name=i.slice(1,y),o.base=i.slice(1,h)):(o.name=i.slice(g,y),o.base=i.slice(g,h)),o.ext=i.slice(y,h)),g>0?o.dir=i.slice(0,g-1):f&&(o.dir="/"),o},sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,Ss=a,Ss}function Un(t){throw new RangeError(kS[t])}function Lm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let a=function(s,i){let o=[],l=s.length;for(;l--;)o[l]=i(s[l]);return o}((t=t.replace(SS,".")).split("."),e).join(".");return r+a}function Ym(t){let e=[],n=0,r=t.length;for(;n<r;){let a=t.charCodeAt(n++);if(a>=55296&&a<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&a)<<10)+(1023&s)+65536):(e.push(a),n--)}else e.push(a)}return e}function AS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function St(){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 ri(t,e,n){if(t&&Dt.isObject(t)&&t instanceof St)return t;var r=new St;return r.parse(t,e,n),r}function ZS(){if(Jm)return Cs;Jm=!0;var t=je;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var o="",l=0,f=-1,p=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.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(o.length<2||l!==2||o.charCodeAt(o.length-1)!==46||o.charCodeAt(o.length-2)!==46){if(o.length>2){var h=o.lastIndexOf("/");if(h!==o.length-1){h===-1?(o="",l=0):(o=o.slice(0,h),l=o.length-1-o.lastIndexOf("/")),f=g,p=0;continue}}else if(o.length===2||o.length===1){o="",l=0,f=g,p=0;continue}}i&&(o.length>0?o+="/..":o="..",l=2)}else o.length>0?o+="/"+s.slice(f+1,g):o=s.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return o}function r(s,i){var o=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return o?o===i.root?o+l:o+s+l:l}var a={resolve:function(){for(var i="",o=!1,l,f=arguments.length-1;f>=-1&&!o;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,o=p.charCodeAt(0)===47)}return i=n(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var o=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!o),i.length===0&&!o&&(i="."),i.length>0&&l&&(i+="/"),o?"/"+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,o=0;o<arguments.length;++o){var l=arguments[o];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":a.normalize(i)},relative:function(i,o){if(e(i),e(o),i===o||(i=a.resolve(i),o=a.resolve(o),i===o))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<o.length&&o.charCodeAt(y)===47;++y);for(var g=o.length,h=g-y,w=p<h?p:h,P=-1,B=0;B<=w;++B){if(B===w){if(h>w){if(o.charCodeAt(y+B)===47)return o.slice(y+B+1);if(B===0)return o.slice(y+B)}else p>w&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var v=i.charCodeAt(l+B),S=o.charCodeAt(y+B);if(v!==S)break;v===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+o.slice(y+P):(y+=P,o.charCodeAt(y)===47&&++y,o.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var o=i.charCodeAt(0),l=o===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(o=i.charCodeAt(y),o===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(o!==void 0&&o.length>0&&o.length<=i.length){if(o.length===i.length&&o===i)return"";var g=o.length-1,h=-1;for(y=i.length-1;y>=0;--y){var w=i.charCodeAt(y);if(w===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(w===o.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 o=-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?o===-1?o=g:y!==1&&(y=1):o!==-1&&(y=-1)}return o===-1||f===-1||y===0||y===1&&o===f-1&&o===l+1?"":i.slice(o,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 o={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return o;var l=i.charCodeAt(0),f=l===47,p;f?(o.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,w=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!w){g=P+1;break}continue}h===-1&&(w=!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?o.base=o.name=i.slice(1,h):o.base=o.name=i.slice(g,h)):(g===0&&f?(o.name=i.slice(1,y),o.base=i.slice(1,h)):(o.name=i.slice(g,y),o.base=i.slice(g,h)),o.ext=i.slice(y,h)),g>0?o.dir=i.slice(0,g-1):f&&(o.dir="/"),o},sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,Cs=a,Cs}function YS(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 Rs?QS(t):ek(t)}function QS(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let a=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&a===102||n[r+1]==="5"&&a===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(zS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,a=n[2];if(r<FS||r>WS||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function ek(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 tk(t){let e=Xm.resolve(t),n=t.charCodeAt(t.length-1);(n===LS||Rs&&n===KS)&&e[e.length-1]!==Xm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(qS,"%25")),!Rs&&e.includes("\\")&&(e=e.replace(GS,"%5C")),e.includes(`
10
+ `)):o=t.stylize("[Circular]","special")),Dn(i)){if(s&&a.match(/^\d+$/))return o;(i=JSON.stringify(""+a)).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+": "+o}function km(t){return Array.isArray(t)}function gs(t){return typeof t=="boolean"}function ja(t){return t===null}function Im(t){return typeof t=="number"}function Ua(t){return typeof t=="string"}function Dn(t){return t===void 0}function Xr(t){return cr(t)&&ys(t)==="[object RegExp]"}function cr(t){return typeof t=="object"&&t!==null}function Za(t){return cr(t)&&ys(t)==="[object Date]"}function Yr(t){return cr(t)&&(ys(t)==="[object Error]"||t instanceof Error)}function Ra(t){return typeof t=="function"}function ys(t){return Object.prototype.toString.call(t)}function us(t){return t<10?"0"+t.toString(10):t.toString(10)}function oE(){var t=new Date,e=[us(t.getHours()),us(t.getMinutes()),us(t.getSeconds())].join(":");return[t.getDate(),aE[t.getMonth()],e].join(" ")}function Am(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function sE(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,qt,Gt,ur,Qe,Nn,Vt,lr,Oa,je,HB,ds,$a,fm,UB,ZB,$B,jB,KB,dm,pm,Xy,LB,FB,WB,gm,Ee,zB,qB,GB,ym,ps,xt,_t,VB,We,XB,YB,QB,Jr,L,Nt,sm,nE,Aa,Sm,Ca,aE,Mn,vC,Ka=ot(()=>{C();R();O();ur=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qe=lm={};(function(){try{qt=typeof setTimeout=="function"?setTimeout:cs}catch{qt=cs}try{Gt=typeof clearTimeout=="function"?clearTimeout:fs}catch{Gt=fs}})();Vt=[],lr=!1,Oa=-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];Vt.push(new Jy(t,e)),Vt.length!==1||lr||um(cm)},Jy.prototype.run=function(){(this||ur).fun.apply(null,(this||ur).array)},Qe.title="browser",Qe.browser=!0,Qe.env={},Qe.argv=[],Qe.version="",Qe.versions={},Qe.on=zt,Qe.addListener=zt,Qe.once=zt,Qe.off=zt,Qe.removeListener=zt,Qe.removeAllListeners=zt,Qe.emit=zt,Qe.prependListener=zt,Qe.prependOnceListener=zt,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;HB=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ds=Object.prototype.toString,$a=function(t){return!(HB&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ds.call(t)==="[object Arguments]"},fm=function(t){return!!$a(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ds.call(t)!=="[object Array]"&&ds.call(t.callee)==="[object Function]"},UB=function(){return $a(arguments)}();$a.isLegacyArguments=fm;ZB=UB?$a:fm,$B=Object.prototype.toString,jB=Function.prototype.toString,KB=/^\s*(?:function)?\*/,dm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",pm=Object.getPrototypeOf,Xy=function(){if(!dm)return!1;try{return Function("return function*() {}")()}catch{}}(),LB=Xy?pm(Xy):{},FB=function(t){return typeof t=="function"&&(!!KB.test(jB.call(t))||(dm?pm(t)===LB:$B.call(t)==="[object GeneratorFunction]"))},WB=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={},zB=gm,qB=ZB,GB=FB;ym=typeof BigInt<"u",ps=typeof Symbol<"u",xt=ps&&Symbol.toStringTag!==void 0,_t=typeof Uint8Array<"u",VB=typeof ArrayBuffer<"u";if(_t&&xt)var JB=Object.getPrototypeOf(Uint8Array.prototype),Et=Hn(Object.getOwnPropertyDescriptor(JB,Symbol.toStringTag).get);We=Hn(Object.prototype.toString),XB=Hn(Number.prototype.valueOf),YB=Hn(String.prototype.valueOf),QB=Hn(Boolean.prototype.valueOf);if(ym)var eE=Hn(BigInt.prototype.valueOf);if(ps)var tE=Hn(Symbol.prototype.valueOf);Ee.isArgumentsObject=qB,Ee.isGeneratorFunction=GB,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 VB&&ArrayBuffer.isView?ArrayBuffer.isView(t):Yy(t)||em(t)},Ee.isTypedArray=Yy,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,Sa.working=typeof Map<"u"&&Sa(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(Sa.working?Sa(t):t instanceof Map)},ka.working=typeof Set<"u"&&ka(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(ka.working?ka(t):t instanceof Set)},Ia.working=typeof WeakMap<"u"&&Ia(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Ia.working?Ia(t):t instanceof WeakMap)},os.working=typeof WeakSet<"u"&&os(new WeakSet),Ee.isWeakSet=function(t){return os(t)},Ma.working=typeof ArrayBuffer<"u"&&Ma(new ArrayBuffer),Ee.isArrayBuffer=Qy,Na.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Na(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=em,Da.working=typeof SharedArrayBuffer<"u"&&Da(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=am,Ee.isSymbolObject=om,Ee.isBoxedPrimitive=function(t){return nm(t)||rm(t)||im(t)||am(t)||om(t)},Ee.isAnyArrayBuffer=function(t){return _t&&(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")}})});Jr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Nt=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},nE=/%[sdj%]/g;L.format=function(t){if(!Ua(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(ln(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,a=r.length,s=String(t).replace(nE,function(o){if(o==="%%")return"%";if(n>=a)return o;switch(o){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 o}}),i=r[n];n<a;i=r[++n])ja(i)||!cr(i)?s+=" "+i:s+=" "+ln(i);return s},L.deprecate=function(t,e){if(Nt!==void 0&&Nt.noDeprecation===!0)return t;if(Nt===void 0)return function(){return L.deprecate(t,e).apply(this||Jr,arguments)};var n=!1;return function(){if(!n){if(Nt.throwDeprecation)throw new Error(e);Nt.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Jr,arguments)}};Aa={},Sm=/^$/;Nt.env.NODE_DEBUG&&(Ca=Nt.env.NODE_DEBUG,Ca=Ca.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Sm=new RegExp("^"+Ca+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Aa[t])if(Sm.test(t)){var e=Nt.pid;Aa[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Aa[t]=function(){};return Aa[t]},L.inspect=ln,ln.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]},ln.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=gs,L.isNull=ja,L.isNullOrUndefined=function(t){return t==null},L.isNumber=Im,L.isString=Ua,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=Dn,L.isRegExp=Xr,L.types.isRegExp=Xr,L.isObject=cr,L.isDate=Za,L.types.isDate=Za,L.isError=Yr,L.types.isNativeError=Yr,L.isFunction=Ra,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;aE=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",oE(),L.format.apply(L,arguments))},L.inherits=WB,L._extend=function(t,e){if(!e||!cr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};Mn=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(Mn&&t[Mn]){var e;if(typeof(e=t[Mn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Mn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,a=new Promise(function(o,l){n=o,r=l}),s=[],i=0;i<arguments.length;i++)s.push(arguments[i]);s.push(function(o,l){o?r(o):n(l)});try{t.apply(this||Jr,s)}catch(o){r(o)}return a}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Mn&&Object.defineProperty(e,Mn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,sm(t))},L.promisify.custom=Mn,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 a=n.pop();if(typeof a!="function")throw new TypeError("The last argument must be of type Function");var s=this||Jr,i=function(){return a.apply(s,arguments)};t.apply(this||Jr,n).then(function(o){Nt.nextTick(i.bind(null,null,o))},function(o){Nt.nextTick(sE.bind(null,o,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;vC=L.promisify;L.types});var PC,Cm=ot(()=>{C();R();O();Ka();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;PC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function Ts(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function lE(){!fr||!Un||(fr=!1,Un.length?Jt=Un.concat(Jt):La=-1,Jt.length&&Om())}function Om(){if(!fr){var t=setTimeout(lE,0);fr=!0;for(var e=Jt.length;e;){for(Un=Jt,Jt=[];++La<e;)Un&&Un[La].run();La=-1,e=Jt.length}Un=null,fr=!1,clearTimeout(t)}}function uE(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 Rm(t,e)),Jt.length===1&&!fr&&setTimeout(Om,0)}function Rm(t,e){this.fun=t,this.array=e}function ct(){}function EE(t){Ts("_linkedBinding")}function AE(t){Ts("dlopen")}function CE(){return[]}function OE(){return[]}function jE(t,e){if(!t)throw new Error(e||"assertion error")}function WE(){return!1}function lS(){return un.now()/1e3}function vs(t){var e=Math.floor((Date.now()-un.now())*.001),n=un.now()*.001,r=Math.floor(n)+e,a=Math.floor(n%1*1e9);return t&&(r=r-t[0],a=a-t[1],a<0&&(r--,a+=hs)),[r,a]}function cn(){return At}function _S(t){return[]}var Jt,fr,Un,La,cE,fE,dE,pE,gE,yE,mE,hE,vE,TE,_E,bE,wE,xE,PE,BE,SE,kE,IE,RE,ME,_s,NE,DE,HE,UE,ZE,$E,KE,LE,FE,zE,qE,GE,VE,JE,XE,YE,QE,eS,tS,nS,rS,iS,aS,oS,sS,un,ms,hs,uS,cS,fS,dS,pS,gS,yS,mS,hS,vS,TS,At,bs=ot(()=>{C();R();O();Jt=[],fr=!1,La=-1;Rm.prototype.run=function(){this.fun.apply(null,this.array)};cE="browser",fE="x64",dE="browser",pE={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},gE=["/usr/bin/node"],yE=[],mE="v16.8.0",hE={},vE=function(t,e){console.warn((e?e+": ":"")+t)},TE=function(t){Ts("binding")},_E=function(t){return 0},bE=function(){return"/"},wE=function(t){},xE={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};PE=ct,BE=[];SE={},kE=!1,IE={};RE=ct,ME=ct,_s=function(){return{}},NE=_s,DE=_s,HE=ct,UE=ct,ZE=ct,$E={};KE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},LE=ct,FE=ct;zE=ct,qE=ct,GE=ct,VE=ct,JE=ct,XE=void 0,YE=void 0,QE=void 0,eS=ct,tS=2,nS=1,rS="/bin/usr/node",iS=9229,aS="node",oS=[],sS=ct,un={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};un.now===void 0&&(ms=Date.now(),un.timing&&un.timing.navigationStart&&(ms=un.timing.navigationStart),un.now=()=>Date.now()-ms);hs=1e9;vs.bigint=function(t){var e=vs(t);return typeof BigInt>"u"?e[0]*hs+e[1]:BigInt(e[0]*hs)+BigInt(e[1])};uS=10,cS={},fS=0;dS=cn,pS=cn,gS=cn,yS=cn,mS=cn,hS=ct,vS=cn,TS=cn;At={version:mE,versions:hE,arch:fE,platform:dE,release:xE,_rawDebug:PE,moduleLoadList:BE,binding:TE,_linkedBinding:EE,_events:cS,_eventsCount:fS,_maxListeners:uS,on:cn,addListener:dS,once:pS,off:gS,removeListener:yS,removeAllListeners:mS,emit:hS,prependListener:vS,prependOnceListener:TS,listeners:_S,domain:SE,_exiting:kE,config:IE,dlopen:AE,uptime:lS,_getActiveRequests:CE,_getActiveHandles:OE,reallyExit:RE,_kill:ME,cpuUsage:_s,resourceUsage:NE,memoryUsage:DE,kill:HE,exit:UE,openStdin:ZE,allowedNodeEnvironmentFlags:$E,assert:jE,features:KE,_fatalExceptions:LE,setUncaughtExceptionCaptureCallback:FE,hasUncaughtExceptionCaptureCallback:WE,emitWarning:vE,nextTick:uE,_tickCallback:zE,_debugProcess:qE,_debugEnd:GE,_startProfilerIdleNotifier:VE,_stopProfilerIdleNotifier:JE,stdout:XE,stdin:QE,stderr:YE,abort:eS,umask:_E,chdir:wE,cwd:bE,env:pE,title:cE,argv:gE,execArgv:yE,pid:tS,ppid:nS,execPath:rS,debugPort:iS,hrtime:vs,argv0:aS,_preload_modules:oS,setSourceMapsEnabled:sS}});function Nm(){if(Mm)return ws;Mm=!0,ws=t;function t(n,r){if(e("noDeprecation"))return n;var a=!1;function s(){if(!a){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),a=!0}return n.apply(this||xs,arguments)}return s}function e(n){try{if(!xs.localStorage)return!1}catch{return!1}var r=xs.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return ws}var ws,Mm,xs,Dm=ot(()=>{C();R();O();ws={},Mm=!1,xs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function bS(){if(Hm)return ei;Hm=!0;var t=Rt(),e=t.Buffer;function n(a,s){for(var i in a)s[i]=a[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?ei=t:(n(t,ei),ei.Buffer=r);function r(a,s,i){return e(a,s,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(a,s,i){if(typeof a=="number")throw new TypeError("Argument must not be a number");return e(a,s,i)},r.alloc=function(a,s,i){if(typeof a!="number")throw new TypeError("Argument must be a number");var o=e(a);return s!==void 0?typeof i=="string"?o.fill(s,i):o.fill(s):o.fill(0),o},r.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return e(a)},r.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)},ei}function wS(){if(Um)return Ps;Um=!0;var t=bS().Buffer,e=t.isEncoding||function(v){switch(v=""+v,v&&v.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(v){if(!v)return"utf8";for(var S;;)switch(v){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 v;default:if(S)return;v=(""+v).toLowerCase(),S=!0}}function r(v){var S=n(v);if(typeof S!="string"&&(t.isEncoding===e||!e(v)))throw new Error("Unknown encoding: "+v);return S||v}Ps.StringDecoder=a;function a(v){this.encoding=r(v);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=w,S=3;break;default:this.write=P,this.end=B;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}a.prototype.write=function(v){if(v.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(v),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<v.length?S?S+this.text(v,E):this.text(v,E):S||""},a.prototype.end=p,a.prototype.text=f,a.prototype.fillLast=function(v){if(this.lastNeed<=v.length)return v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,this.lastTotal-this.lastNeed,0,v.length),this.lastNeed-=v.length};function s(v){return v<=127?0:v>>5===6?2:v>>4===14?3:v>>3===30?4:v>>6===2?-1:-2}function i(v,S,E){var H=S.length-1;if(H<E)return 0;var K=s(S[H]);return K>=0?(K>0&&(v.lastNeed=K-1),K):--H<E||K===-2?0:(K=s(S[H]),K>=0?(K>0&&(v.lastNeed=K-2),K):--H<E||K===-2?0:(K=s(S[H]),K>=0?(K>0&&(K===2?K=0:v.lastNeed=K-3),K):0))}function o(v,S,E){if((S[0]&192)!==128)return v.lastNeed=0,"\uFFFD";if(v.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return v.lastNeed=1,"\uFFFD";if(v.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return v.lastNeed=2,"\uFFFD"}}function l(v){var S=this.lastTotal-this.lastNeed,E=o(this,v);if(E!==void 0)return E;if(this.lastNeed<=v.length)return v.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,S,0,v.length),this.lastNeed-=v.length}function f(v,S){var E=i(this,v,S);if(!this.lastNeed)return v.toString("utf8",S);this.lastTotal=E;var H=v.length-(E-this.lastNeed);return v.copy(this.lastChar,0,H),v.toString("utf8",S,H)}function p(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+"\uFFFD":S}function y(v,S){if((v.length-S)%2===0){var E=v.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]=v[v.length-2],this.lastChar[1]=v[v.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",S,v.length-1)}function g(v){var S=v&&v.length?this.write(v):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function h(v,S){var E=(v.length-S)%3;return E===0?v.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=v[v.length-1]:(this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1]),v.toString("base64",S,v.length-E))}function w(v){var S=v&&v.length?this.write(v):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function P(v){return v.toString(this.encoding)}function B(v){return v&&v.length?this.write(v):""}return Ps}var ei,Hm,Ps,Um,ti,UC,Zm=ot(()=>{C();R();O();pi();ei={},Hm=!1;Ps={},Um=!1;ti=wS();ti.StringDecoder;UC=ti.StringDecoder});function xS(){if($m)return Bs;$m=!0;var t=Bs={},e,n;function r(){throw new Error("setTimeout has not been defined")}function a(){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=a}catch{n=a}})();function s(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||dr,P,0)}}}function i(P){if(n===clearTimeout)return clearTimeout(P);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(P);try{return n(P)}catch{try{return n.call(null,P)}catch{return n.call(this||dr,P)}}}var o=[],l=!1,f,p=-1;function y(){!l||!f||(l=!1,f.length?o=f.concat(o):p=-1,o.length&&g())}function g(){if(!l){var P=s(y);l=!0;for(var B=o.length;B;){for(f=o,o=[];++p<B;)f&&f[p].run();p=-1,B=o.length}f=null,l=!1,i(P)}}t.nextTick=function(P){var B=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)B[v-1]=arguments[v];o.push(new h(P,B)),o.length===1&&!l&&s(g)};function h(P,B){(this||dr).fun=P,(this||dr).array=B}h.prototype.run=function(){(this||dr).fun.apply(null,(this||dr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function w(){}return t.on=w,t.addListener=w,t.once=w,t.off=w,t.removeListener=w,t.removeAllListeners=w,t.emit=w,t.prependListener=w,t.prependOnceListener=w,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},Bs}var Bs,$m,dr,Ke,Es=ot(()=>{C();R();O();Bs={},$m=!1,dr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ke=xS();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 PS(){if(jm)return Ss;jm=!0;var t=Ke;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var o="",l=0,f=-1,p=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.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(o.length<2||l!==2||o.charCodeAt(o.length-1)!==46||o.charCodeAt(o.length-2)!==46){if(o.length>2){var h=o.lastIndexOf("/");if(h!==o.length-1){h===-1?(o="",l=0):(o=o.slice(0,h),l=o.length-1-o.lastIndexOf("/")),f=g,p=0;continue}}else if(o.length===2||o.length===1){o="",l=0,f=g,p=0;continue}}i&&(o.length>0?o+="/..":o="..",l=2)}else o.length>0?o+="/"+s.slice(f+1,g):o=s.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return o}function r(s,i){var o=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return o?o===i.root?o+l:o+s+l:l}var a={resolve:function(){for(var i="",o=!1,l,f=arguments.length-1;f>=-1&&!o;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,o=p.charCodeAt(0)===47)}return i=n(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var o=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!o),i.length===0&&!o&&(i="."),i.length>0&&l&&(i+="/"),o?"/"+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,o=0;o<arguments.length;++o){var l=arguments[o];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":a.normalize(i)},relative:function(i,o){if(e(i),e(o),i===o||(i=a.resolve(i),o=a.resolve(o),i===o))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<o.length&&o.charCodeAt(y)===47;++y);for(var g=o.length,h=g-y,w=p<h?p:h,P=-1,B=0;B<=w;++B){if(B===w){if(h>w){if(o.charCodeAt(y+B)===47)return o.slice(y+B+1);if(B===0)return o.slice(y+B)}else p>w&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var v=i.charCodeAt(l+B),S=o.charCodeAt(y+B);if(v!==S)break;v===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+o.slice(y+P):(y+=P,o.charCodeAt(y)===47&&++y,o.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var o=i.charCodeAt(0),l=o===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(o=i.charCodeAt(y),o===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(o!==void 0&&o.length>0&&o.length<=i.length){if(o.length===i.length&&o===i)return"";var g=o.length-1,h=-1;for(y=i.length-1;y>=0;--y){var w=i.charCodeAt(y);if(w===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(w===o.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 o=-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?o===-1?o=g:y!==1&&(y=1):o!==-1&&(y=-1)}return o===-1||f===-1||y===0||y===1&&o===f-1&&o===l+1?"":i.slice(o,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 o={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return o;var l=i.charCodeAt(0),f=l===47,p;f?(o.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,w=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!w){g=P+1;break}continue}h===-1&&(w=!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?o.base=o.name=i.slice(1,h):o.base=o.name=i.slice(g,h)):(g===0&&f?(o.name=i.slice(1,y),o.base=i.slice(1,h)):(o.name=i.slice(g,y),o.base=i.slice(g,h)),o.ext=i.slice(y,h)),g>0?o.dir=i.slice(0,g-1):f&&(o.dir="/"),o},sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,Ss=a,Ss}function Zn(t){throw new RangeError(kS[t])}function Lm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let a=function(s,i){let o=[],l=s.length;for(;l--;)o[l]=i(s[l]);return o}((t=t.replace(SS,".")).split("."),e).join(".");return r+a}function Ym(t){let e=[],n=0,r=t.length;for(;n<r;){let a=t.charCodeAt(n++);if(a>=55296&&a<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&a)<<10)+(1023&s)+65536):(e.push(a),n--)}else e.push(a)}return e}function AS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function St(){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 ri(t,e,n){if(t&&Dt.isObject(t)&&t instanceof St)return t;var r=new St;return r.parse(t,e,n),r}function $S(){if(Jm)return Cs;Jm=!0;var t=je;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var o="",l=0,f=-1,p=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.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(o.length<2||l!==2||o.charCodeAt(o.length-1)!==46||o.charCodeAt(o.length-2)!==46){if(o.length>2){var h=o.lastIndexOf("/");if(h!==o.length-1){h===-1?(o="",l=0):(o=o.slice(0,h),l=o.length-1-o.lastIndexOf("/")),f=g,p=0;continue}}else if(o.length===2||o.length===1){o="",l=0,f=g,p=0;continue}}i&&(o.length>0?o+="/..":o="..",l=2)}else o.length>0?o+="/"+s.slice(f+1,g):o=s.slice(f+1,g),l=g-f-1;f=g,p=0}else y===46&&p!==-1?++p:p=-1}return o}function r(s,i){var o=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return o?o===i.root?o+l:o+s+l:l}var a={resolve:function(){for(var i="",o=!1,l,f=arguments.length-1;f>=-1&&!o;f--){var p;f>=0?p=arguments[f]:(l===void 0&&(l=t.cwd()),p=l),e(p),p.length!==0&&(i=p+"/"+i,o=p.charCodeAt(0)===47)}return i=n(i,!o),o?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var o=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!o),i.length===0&&!o&&(i="."),i.length>0&&l&&(i+="/"),o?"/"+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,o=0;o<arguments.length;++o){var l=arguments[o];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":a.normalize(i)},relative:function(i,o){if(e(i),e(o),i===o||(i=a.resolve(i),o=a.resolve(o),i===o))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,p=f-l,y=1;y<o.length&&o.charCodeAt(y)===47;++y);for(var g=o.length,h=g-y,w=p<h?p:h,P=-1,B=0;B<=w;++B){if(B===w){if(h>w){if(o.charCodeAt(y+B)===47)return o.slice(y+B+1);if(B===0)return o.slice(y+B)}else p>w&&(i.charCodeAt(l+B)===47?P=B:B===0&&(P=0));break}var v=i.charCodeAt(l+B),S=o.charCodeAt(y+B);if(v!==S)break;v===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+o.slice(y+P):(y+=P,o.charCodeAt(y)===47&&++y,o.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var o=i.charCodeAt(0),l=o===47,f=-1,p=!0,y=i.length-1;y>=1;--y)if(o=i.charCodeAt(y),o===47){if(!p){f=y;break}}else p=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,p=!0,y;if(o!==void 0&&o.length>0&&o.length<=i.length){if(o.length===i.length&&o===i)return"";var g=o.length-1,h=-1;for(y=i.length-1;y>=0;--y){var w=i.charCodeAt(y);if(w===47){if(!p){l=y+1;break}}else h===-1&&(p=!1,h=y+1),g>=0&&(w===o.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 o=-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?o===-1?o=g:y!==1&&(y=1):o!==-1&&(y=-1)}return o===-1||f===-1||y===0||y===1&&o===f-1&&o===l+1?"":i.slice(o,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 o={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return o;var l=i.charCodeAt(0),f=l===47,p;f?(o.root="/",p=1):p=0;for(var y=-1,g=0,h=-1,w=!0,P=i.length-1,B=0;P>=p;--P){if(l=i.charCodeAt(P),l===47){if(!w){g=P+1;break}continue}h===-1&&(w=!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?o.base=o.name=i.slice(1,h):o.base=o.name=i.slice(g,h)):(g===0&&f?(o.name=i.slice(1,y),o.base=i.slice(1,h)):(o.name=i.slice(g,y),o.base=i.slice(g,h)),o.ext=i.slice(y,h)),g>0?o.dir=i.slice(0,g-1):f&&(o.dir="/"),o},sep:"/",delimiter:":",win32:null,posix:null};return a.posix=a,Cs=a,Cs}function YS(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 Rs?QS(t):ek(t)}function QS(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let a=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&a===102||n[r+1]==="5"&&a===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(zS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,a=n[2];if(r<FS||r>WS||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function ek(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 tk(t){let e=Xm.resolve(t),n=t.charCodeAt(t.length-1);(n===LS||Rs&&n===KS)&&e[e.length-1]!==Xm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(qS,"%25")),!Rs&&e.includes("\\")&&(e=e.replace(GS,"%5C")),e.includes(`
11
11
  `)&&(e=e.replace(VS,"%0A")),e.includes("\r")&&(e=e.replace(JS,"%0D")),e.includes(" ")&&(e=e.replace(XS,"%09")),r.pathname=e,r}function pk(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 Ms?gk(t):yk(t)}function gk(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let a=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&a===102||n[r+1]==="5"&&a===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(sk,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,a=n[2];if(r<ak||r>ok||a!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function yk(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 mk(t){let e=Km.resolve(t),n=t.charCodeAt(t.length-1);(n===ik||Ms&&n===rk)&&e[e.length-1]!==Km.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(lk,"%25")),!Ms&&e.includes("\\")&&(e=e.replace(uk,"%5C")),e.includes(`
12
- `)&&(e=e.replace(ck,"%0A")),e.includes("\r")&&(e=e.replace(fk,"%0D")),e.includes(" ")&&(e=e.replace(dk,"%09")),r.pathname=e,r}var Ss,jm,Km,pr,BS,ES,SS,kS,Ht,ks,Fm,Qm,Wm,zm,IS,CS,ni,OS,Xt,De,RS,Dt,MS,NS,DS,HS,Os,qm,Gm,Vm,US,$S,Is,dr,As,Cs,Jm,Xm,jS,KS,LS,FS,WS,Rs,zS,qS,GS,VS,JS,XS,nk,rk,ik,ak,ok,Ms,sk,lk,uk,ck,fk,dk,eh=ot(()=>{C();R();O();Ka();Es();Ss={},jm=!1;Km=PS(),pr=2147483647,BS=/^xn--/,ES=/[^\0-\x7E]/,SS=/[\x2E\u3002\uFF0E\uFF61]/g,kS={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ht=Math.floor,ks=String.fromCharCode;Fm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Qm=function(t,e,n){let r=0;for(t=n?Ht(t/700):t>>1,t+=Ht(t/e);t>455;r+=36)t=Ht(t/35);return Ht(r+36*t/(t+38))},Wm=function(t){let e=[],n=t.length,r=0,a=128,s=72,i=t.lastIndexOf("-");i<0&&(i=0);for(let l=0;l<i;++l)t.charCodeAt(l)>=128&&Un("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&&Un("invalid-input");let h=(o=t.charCodeAt(l++))-48<10?o-22:o-65<26?o-65:o-97<26?o-97:36;(h>=36||h>Ht((pr-r)/y))&&Un("overflow"),r+=h*y;let w=g<=s?1:g>=s+26?26:g-s;if(h<w)break;let P=36-w;y>Ht(pr/P)&&Un("overflow"),y*=P}let p=e.length+1;s=Qm(r-f,p,f==0),Ht(r/p)>pr-a&&Un("overflow"),a+=Ht(r/p),r%=p,e.splice(r++,0,a)}var o;return String.fromCodePoint(...e)},zm=function(t){let e=[],n=(t=Ym(t)).length,r=128,a=0,s=72;for(let l of t)l<128&&e.push(ks(l));let i=e.length,o=i;for(i&&e.push("-");o<n;){let l=pr;for(let p of t)p>=r&&p<l&&(l=p);let f=o+1;l-r>Ht((pr-a)/f)&&Un("overflow"),a+=(l-r)*f,r=l;for(let p of t)if(p<r&&++a>pr&&Un("overflow"),p==r){let y=a;for(let g=36;;g+=36){let h=g<=s?1:g>=s+26?26:g-s;if(y<h)break;let w=y-h,P=36-h;e.push(ks(Fm(h+w%P,0))),y=Ht(w/P)}e.push(ks(Fm(y,0))),s=Qm(a,f,o==i),a=0,++o}++a,++r}return e.join("")},IS={version:"2.1.0",ucs2:{decode:Ym,encode:t=>String.fromCodePoint(...t)},decode:Wm,encode:zm,toASCII:function(t){return Lm(t,function(e){return ES.test(e)?"xn--"+zm(e):e})},toUnicode:function(t){return Lm(t,function(e){return BS.test(e)?Wm(e.slice(4).toLowerCase()):e})}};CS=function(t,e,n,r){e=e||"&",n=n||"=";var a={};if(typeof t!="string"||t.length===0)return a;var s=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var o=t.length;i>0&&o>i&&(o=i);for(var l=0;l<o;++l){var f,p,y,g,h=t[l].replace(s,"%20"),w=h.indexOf(n);w>=0?(f=h.substr(0,w),p=h.substr(w+1)):(f=h,p=""),y=decodeURIComponent(f),g=decodeURIComponent(p),AS(a,y)?Array.isArray(a[y])?a[y].push(g):a[y]=[a[y],g]:a[y]=g}return a},ni=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},OS=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(a){var s=encodeURIComponent(ni(a))+n;return Array.isArray(t[a])?t[a].map(function(i){return s+encodeURIComponent(ni(i))}).join(e):s+encodeURIComponent(ni(t[a]))}).join(e):r?encodeURIComponent(ni(r))+n+encodeURIComponent(ni(t)):""},Xt={};Xt.decode=Xt.parse=CS,Xt.encode=Xt.stringify=OS;Xt.decode;Xt.encode;Xt.parse;Xt.stringify;De={},RS=IS,Dt={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=ri,De.resolve=function(t,e){return ri(t,!1,!0).resolve(e)},De.resolveObject=function(t,e){return t?ri(t,!1,!0).resolveObject(e):e},De.format=function(t){return Dt.isString(t)&&(t=ri(t)),t instanceof St?t.format():St.prototype.format.call(t)},De.Url=St;MS=/^([a-z0-9.+-]+:)/i,NS=/:[0-9]*$/,DS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,HS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
13
- `," "]),Os=["'"].concat(HS),qm=["%","/","?",";","#"].concat(Os),Gm=["/","?","#"],Vm=/^[+a-z0-9A-Z_-]{0,63}$/,US=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,$S={javascript:!0,"javascript:":!0},Is={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},As=Xt;St.prototype.parse=function(t,e,n){if(!Dt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),a=r!==-1&&r<t.indexOf("#")?"?":"#",s=t.split(a);s[0]=s[0].replace(/\\/g,"/");var i=t=s.join(a);if(i=i.trim(),!n&&t.split("#").length===1){var o=DS.exec(i);if(o)return this.path=i,this.href=i,this.pathname=o[1],o[2]?(this.search=o[2],this.query=e?As.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=MS.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&&Is[l]||(i=i.substr(2),this.slashes=!0)}if(!Is[l]&&(p||l&&!dr[l])){for(var y,g,h=-1,w=0;w<Gm.length;w++)(P=i.indexOf(Gm[w]))!==-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,w=0;w<qm.length;w++){var P;(P=i.indexOf(qm[w]))!==-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 v=this.hostname.split(/\./),S=(w=0,v.length);w<S;w++){var E=v[w];if(E&&!E.match(Vm)){for(var H="",K=0,ae=E.length;K<ae;K++)E.charCodeAt(K)>127?H+="x":H+=E[K];if(!H.match(Vm)){var Q=v.slice(0,w),ge=v.slice(w+1),oe=E.match(US);oe&&(Q.push(oe[1]),ge.unshift(oe[2])),ge.length&&(i="/"+ge.join(".")+i),this.hostname=Q.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=RS.toASCII(this.hostname));var re=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+re,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!$S[f])for(w=0,S=Os.length;w<S;w++){var ze=Os[w];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=As.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){re=this.pathname||"";var mt=this.search||"";this.path=re+mt}return this.href=this.format(),this},St.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||"",a=!1,s="";this.host?a=t+this.host:this.hostname&&(a=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(a+=":"+this.port)),this.query&&Dt.isObject(this.query)&&Object.keys(this.query).length&&(s=As.stringify(this.query));var i=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||dr[e])&&a!==!1?(a="//"+(a||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):a||(a=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+a+(n=n.replace(/[?#]/g,function(o){return encodeURIComponent(o)}))+(i=i.replace("#","%23"))+r},St.prototype.resolve=function(t){return this.resolveObject(ri(t,!1,!0)).format()},St.prototype.resolveObject=function(t){if(Dt.isString(t)){var e=new St;e.parse(t,!1,!0),t=e}for(var n=new St,r=Object.keys(this),a=0;a<r.length;a++){var s=r[a];n[s]=this[s]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),o=0;o<i.length;o++){var l=i[o];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||Is[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||"",w=n.search||"";n.path=h+w}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)==="/",v=B||P||n.host&&t.pathname,S=v,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),v=v&&(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(!Dt.isNullOrUndefined(t.search))return H&&(n.hostname=n.host=E.shift(),(oe=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=oe.shift(),n.host=n.hostname=oe.shift())),n.search=t.search,n.query=t.query,Dt.isNull(n.pathname)&&Dt.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 K=E.slice(-1)[0],ae=(n.host||t.host||E.length>1)&&(K==="."||K==="..")||K==="",Q=0,ge=E.length;ge>=0;ge--)(K=E[ge])==="."?E.splice(ge,1):K===".."?(E.splice(ge,1),Q++):Q&&(E.splice(ge,1),Q--);if(!v&&!S)for(;Q--;Q)E.unshift("..");!v||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),ae&&E.join("/").substr(-1)!=="/"&&E.push("");var oe,re=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=re?"":E.length?E.shift():"",(oe=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=oe.shift(),n.host=n.hostname=oe.shift())),(v=v||n.host&&E.length)&&!re&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),Dt.isNull(n.pathname)&&Dt.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},St.prototype.parseHost=function(){var t=this.host,e=NS.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;Cs={},Jm=!1;Xm=ZS(),jS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=tk;De.fileURLToPath=YS;De.Url;De.format;De.resolve;De.resolveObject;De.URL;KS=92,LS=47,FS=97,WS=122,Rs=jS==="win32",zS=/\//g,qS=/%/g,GS=/\\/g,VS=/\n/g,JS=/\r/g,XS=/\t/g;nk=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=mk;De.fileURLToPath=pk;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;rk=92,ik=47,ak=97,ok=122,Ms=nk==="win32",sk=/\//g,lk=/%/g,uk=/\\/g,ck=/\n/g,fk=/\r/g,dk=/\t/g});var Rh={};Fn(Rh,{Agent:()=>Sk,ClientRequest:()=>kk,IncomingMessage:()=>Ik,METHODS:()=>Ak,STATUS_CODES:()=>Ck,default:()=>Yt,get:()=>Ok,globalAgent:()=>Rk,request:()=>Mk});function Ph(){if(th)return Pt;th=!0,Pt.fetch=r($n.fetch)&&r($n.ReadableStream),Pt.writableStream=r($n.WritableStream),Pt.abortController=r($n.AbortController);var t;function e(){if(t!==void 0)return t;if($n.XMLHttpRequest){t=new $n.XMLHttpRequest;try{t.open("GET",$n.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(a){var s=e();if(!s)return!1;try{return s.responseType=a,s.responseType===a}catch{}return!1}Pt.arraybuffer=Pt.fetch||n("arraybuffer"),Pt.msstream=!Pt.fetch&&n("ms-stream"),Pt.mozchunkedarraybuffer=!Pt.fetch&&n("moz-chunked-arraybuffer"),Pt.overrideMimeType=Pt.fetch||(e()?r(e().overrideMimeType):!1);function r(a){return typeof a=="function"}return t=null,Pt}function Bh(){return nh||(nh=!0,Ns=Tt.EventEmitter),Ns}function hk(){if(rh)return Ds;rh=!0;function t(w,P){var B=Object.keys(w);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(w);P&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(w,S).enumerable})),B.push.apply(B,v)}return B}function e(w){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(v){n(w,v,B[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(v){Object.defineProperty(w,v,Object.getOwnPropertyDescriptor(B,v))})}return w}function n(w,P,B){return P=i(P),P in w?Object.defineProperty(w,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):w[P]=B,w}function r(w,P){if(!(w instanceof P))throw new TypeError("Cannot call a class as a function")}function a(w,P){for(var B=0;B<P.length;B++){var v=P[B];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(w,i(v.key),v)}}function s(w,P,B){return P&&a(w.prototype,P),Object.defineProperty(w,"prototype",{writable:!1}),w}function i(w){var P=o(w,"string");return typeof P=="symbol"?P:String(P)}function o(w,P){if(typeof w!="object"||w===null)return w;var B=w[Symbol.toPrimitive];if(B!==void 0){var v=B.call(w,P||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(w)}var l=Rt(),f=l.Buffer,p=L,y=p.inspect,g=y&&y.custom||"inspect";function h(w,P,B){f.prototype.copy.call(w,P,B)}return Ds=function(){function w(){r(this,w),this.head=null,this.tail=null,this.length=0}return s(w,[{key:"push",value:function(B){var v={data:B,next:null};this.length>0?this.tail.next=v:this.head=v,this.tail=v,++this.length}},{key:"unshift",value:function(B){var v={data:B,next:this.head};this.length===0&&(this.tail=v),this.head=v,++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 v=this.head,S=""+v.data;v=v.next;)S+=B+v.data;return S}},{key:"concat",value:function(B){if(this.length===0)return f.alloc(0);for(var v=f.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,v,E),E+=S.data.length,S=S.next;return v}},{key:"consume",value:function(B,v){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=v?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var v=this.head,S=1,E=v.data;for(B-=E.length;v=v.next;){var H=v.data,K=B>H.length?H.length:B;if(K===H.length?E+=H:E+=H.slice(0,B),B-=K,B===0){K===H.length?(++S,v.next?this.head=v.next:this.head=this.tail=null):(this.head=v,v.data=H.slice(K));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var v=f.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(v),B-=S.data.length;S=S.next;){var H=S.data,K=B>H.length?H.length:B;if(H.copy(v,v.length-B,0,K),B-=K,B===0){K===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(K));break}++E}return this.length-=E,v}},{key:g,value:function(B,v){return y(this,e(e({},v),{},{depth:0,customInspect:!1}))}}]),w}(),Ds}function Eh(){if(ih)return Hs;ih=!0;var t=At;function e(o,l){var f=this,p=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return p||y?(l?l(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,o)):t.nextTick(s,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||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(o,l){s(o,l),r(o)}function r(o){o._writableState&&!o._writableState.emitClose||o._readableState&&!o._readableState.emitClose||o.emit("close")}function a(){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 s(o,l){o.emit("error",l)}function i(o,l){var f=o._readableState,p=o._writableState;f&&f.autoDestroy||p&&p.autoDestroy?o.destroy(l):o.emit("error",l)}return Hs={destroy:e,undestroy:a,errorOrDestroy:i},Hs}function yr(){if(ah)return Us;ah=!0;let t={};function e(i,o,l){l||(l=Error);function f(y,g,h){return typeof o=="string"?o:o(y,g,h)}class p extends l{constructor(g,h,w){super(f(g,h,w))}}p.prototype.name=l.name,p.prototype.code=i,t[i]=p}function n(i,o){if(Array.isArray(i)){let l=i.length;return i=i.map(f=>String(f)),l>2?`one of ${o} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${o} ${i[0]} or ${i[1]}`:`of ${o} ${i[0]}`}else return`of ${o} ${String(i)}`}function r(i,o,l){return i.substr(0,o.length)===o}function a(i,o,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-o.length,l)===o}function s(i,o,l){return typeof l!="number"&&(l=0),l+o.length>i.length?!1:i.indexOf(o,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,o){return'The value "'+o+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,o,l){let f;typeof o=="string"&&r(o,"not ")?(f="must not be",o=o.replace(/^not /,"")):f="must be";let p;if(a(i," argument"))p=`The ${i} ${f} ${n(o,"type")}`;else{let y=s(i,".")?"property":"argument";p=`The "${i}" ${y} ${f} ${n(o,"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"),Us.codes=t,Us}function Sh(){if(oh)return $s;oh=!0;var t=yr().codes.ERR_INVALID_OPT_VALUE;function e(r,a,s){return r.highWaterMark!=null?r.highWaterMark:a?r[s]:null}function n(r,a,s,i){var o=e(a,i,s);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var l=i?s:"highWaterMark";throw new t(l,o)}return Math.floor(o)}return r.objectMode?16:16*1024}return $s={getHighWaterMark:n},$s}function kh(){if(sh)return Zs;sh=!0;var t=At;Zs=oe;function e(A){var k=this;this.next=null,this.entry=null,this.finish=function(){Te(k,A)}}var n;oe.WritableState=Q;var r={deprecate:Nm()},a=Bh(),s=Rt().Buffer,i=(typeof lh<"u"?lh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(A){return s.from(A)}function l(A){return s.isBuffer(A)||A instanceof i}var f=Eh(),p=Sh(),y=p.getHighWaterMark,g=yr().codes,h=g.ERR_INVALID_ARG_TYPE,w=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,v=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,K=f.errorOrDestroy;Mt()(oe,a);function ae(){}function Q(A,k,Z){n=n||gr(),A=A||{},typeof Z!="boolean"&&(Z=k instanceof n),this.objectMode=!!A.objectMode,Z&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=y(this,A,"writableHighWaterMark",Z),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var X=A.decodeStrings===!1;this.decodeStrings=!X,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ie){Ue(k,ie)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}Q.prototype.getBuffer=function(){for(var k=this.bufferedRequest,Z=[];k;)Z.push(k),k=k.next;return Z},function(){try{Object.defineProperty(Q.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(oe,Symbol.hasInstance,{value:function(k){return ge.call(this,k)?!0:this!==oe?!1:k&&k._writableState instanceof Q}})):ge=function(k){return k instanceof this};function oe(A){n=n||gr();var k=this instanceof n;if(!k&&!ge.call(oe,this))return new oe(A);this._writableState=new Q(A,this,k),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),a.call(this)}oe.prototype.pipe=function(){K(this,new B)};function re(A,k){var Z=new E;K(A,Z),t.nextTick(k,Z)}function Oe(A,k,Z,X){var ie;return Z===null?ie=new S:typeof Z!="string"&&!k.objectMode&&(ie=new h("chunk",["string","Buffer"],Z)),ie?(K(A,ie),t.nextTick(X,ie),!1):!0}oe.prototype.write=function(A,k,Z){var X=this._writableState,ie=!1,_=!X.objectMode&&l(A);return _&&!s.isBuffer(A)&&(A=o(A)),typeof k=="function"&&(Z=k,k=null),_?k="buffer":k||(k=X.defaultEncoding),typeof Z!="function"&&(Z=ae),X.ending?re(this,Z):(_||Oe(this,X,A,Z))&&(X.pendingcb++,ie=tt(this,X,_,A,k,Z)),ie},oe.prototype.cork=function(){this._writableState.corked++},oe.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&fe(this,A))},oe.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(oe.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ze(A,k,Z){return!A.objectMode&&A.decodeStrings!==!1&&typeof k=="string"&&(k=s.from(k,Z)),k}Object.defineProperty(oe.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function tt(A,k,Z,X,ie,_){if(!Z){var x=ze(k,X,ie);X!==x&&(Z=!0,ie="buffer",X=x)}var z=k.objectMode?1:X.length;k.length+=z;var Y=k.length<k.highWaterMark;if(Y||(k.needDrain=!0),k.writing||k.corked){var Me=k.lastBufferedRequest;k.lastBufferedRequest={chunk:X,encoding:ie,isBuf:Z,callback:_,next:null},Me?Me.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else Ve(A,k,!1,z,X,ie,_);return Y}function Ve(A,k,Z,X,ie,_,x){k.writelen=X,k.writecb=x,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new v("write")):Z?A._writev(ie,k.onwrite):A._write(ie,_,k.onwrite),k.sync=!1}function Je(A,k,Z,X,ie){--k.pendingcb,Z?(t.nextTick(ie,X),t.nextTick(F,A,k),A._writableState.errorEmitted=!0,K(A,X)):(ie(X),A._writableState.errorEmitted=!0,K(A,X),F(A,k))}function mt(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}function Ue(A,k){var Z=A._writableState,X=Z.sync,ie=Z.writecb;if(typeof ie!="function")throw new P;if(mt(Z),k)Je(A,Z,X,k,ie);else{var _=ve(Z)||A.destroyed;!_&&!Z.corked&&!Z.bufferProcessing&&Z.bufferedRequest&&fe(A,Z),X?t.nextTick(Pe,A,Z,_,ie):Pe(A,Z,_,ie)}}function Pe(A,k,Z,X){Z||Se(A,k),k.pendingcb--,X(),F(A,k)}function Se(A,k){k.length===0&&k.needDrain&&(k.needDrain=!1,A.emit("drain"))}function fe(A,k){k.bufferProcessing=!0;var Z=k.bufferedRequest;if(A._writev&&Z&&Z.next){var X=k.bufferedRequestCount,ie=new Array(X),_=k.corkedRequestsFree;_.entry=Z;for(var x=0,z=!0;Z;)ie[x]=Z,Z.isBuf||(z=!1),Z=Z.next,x+=1;ie.allBuffers=z,Ve(A,k,!0,k.length,ie,"",_.finish),k.pendingcb++,k.lastBufferedRequest=null,_.next?(k.corkedRequestsFree=_.next,_.next=null):k.corkedRequestsFree=new e(k),k.bufferedRequestCount=0}else{for(;Z;){var Y=Z.chunk,Me=Z.encoding,_e=Z.callback,$=k.objectMode?1:Y.length;if(Ve(A,k,!1,$,Y,Me,_e),Z=Z.next,k.bufferedRequestCount--,k.writing)break}Z===null&&(k.lastBufferedRequest=null)}k.bufferedRequest=Z,k.bufferProcessing=!1}oe.prototype._write=function(A,k,Z){Z(new w("_write()"))},oe.prototype._writev=null,oe.prototype.end=function(A,k,Z){var X=this._writableState;return typeof A=="function"?(Z=A,A=null,k=null):typeof k=="function"&&(Z=k,k=null),A!=null&&this.write(A,k),X.corked&&(X.corked=1,this.uncork()),X.ending||de(this,X,Z),this},Object.defineProperty(oe.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ve(A){return A.ending&&A.length===0&&A.bufferedRequest===null&&!A.finished&&!A.writing}function D(A,k){A._final(function(Z){k.pendingcb--,Z&&K(A,Z),k.prefinished=!0,A.emit("prefinish"),F(A,k)})}function j(A,k){!k.prefinished&&!k.finalCalled&&(typeof A._final=="function"&&!k.destroyed?(k.pendingcb++,k.finalCalled=!0,t.nextTick(D,A,k)):(k.prefinished=!0,A.emit("prefinish")))}function F(A,k){var Z=ve(k);if(Z&&(j(A,k),k.pendingcb===0&&(k.finished=!0,A.emit("finish"),k.autoDestroy))){var X=A._readableState;(!X||X.autoDestroy&&X.endEmitted)&&A.destroy()}return Z}function de(A,k,Z){k.ending=!0,F(A,k),Z&&(k.finished?t.nextTick(Z):A.once("finish",Z)),k.ended=!0,A.writable=!1}function Te(A,k,Z){var X=A.entry;for(A.entry=null;X;){var ie=X.callback;k.pendingcb--,ie(Z),X=X.next}k.corkedRequestsFree.next=A}return Object.defineProperty(oe.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(k){this._writableState&&(this._writableState.destroyed=k)}}),oe.prototype.destroy=f.destroy,oe.prototype._undestroy=f.undestroy,oe.prototype._destroy=function(A,k){k(A)},Zs}function gr(){if(uh)return js;uh=!0;var t=At,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};js=o;var n=Ih(),r=kh();Mt()(o,n);for(var a=e(r.prototype),s=0;s<a.length;s++){var i=a[s];o.prototype[i]||(o.prototype[i]=r.prototype[i])}function o(p){if(!(this instanceof o))return new o(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(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.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(o.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)}}),js}function Qs(){if(ch)return Ks;ch=!0;var t=yr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var i=!1;return function(){if(!i){i=!0;for(var o=arguments.length,l=new Array(o),f=0;f<o;f++)l[f]=arguments[f];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function a(s,i,o){if(typeof i=="function")return a(s,null,i);i||(i={}),o=e(o||n);var l=i.readable||i.readable!==!1&&s.readable,f=i.writable||i.writable!==!1&&s.writable,p=function(){s.writable||g()},y=s._writableState&&s._writableState.finished,g=function(){f=!1,y=!0,l||o.call(s)},h=s._readableState&&s._readableState.endEmitted,w=function(){l=!1,h=!0,f||o.call(s)},P=function(E){o.call(s,E)},B=function(){var E;if(l&&!h)return(!s._readableState||!s._readableState.ended)&&(E=new t),o.call(s,E);if(f&&!y)return(!s._writableState||!s._writableState.ended)&&(E=new t),o.call(s,E)},v=function(){s.req.on("finish",g)};return r(s)?(s.on("complete",g),s.on("abort",B),s.req?v():s.on("request",v)):f&&!s._writableState&&(s.on("end",p),s.on("close",p)),s.on("end",w),s.on("finish",g),i.error!==!1&&s.on("error",P),s.on("close",B),function(){s.removeListener("complete",g),s.removeListener("abort",B),s.removeListener("request",v),s.req&&s.req.removeListener("finish",g),s.removeListener("end",p),s.removeListener("close",p),s.removeListener("finish",g),s.removeListener("end",w),s.removeListener("error",P),s.removeListener("close",B)}}return Ks=a,Ks}function vk(){if(fh)return Ls;fh=!0;var t=At,e;function n(H,K,ae){return K=r(K),K in H?Object.defineProperty(H,K,{value:ae,enumerable:!0,configurable:!0,writable:!0}):H[K]=ae,H}function r(H){var K=a(H,"string");return typeof K=="symbol"?K:String(K)}function a(H,K){if(typeof H!="object"||H===null)return H;var ae=H[Symbol.toPrimitive];if(ae!==void 0){var Q=ae.call(H,K||"default");if(typeof Q!="object")return Q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(K==="string"?String:Number)(H)}var s=Qs(),i=Symbol("lastResolve"),o=Symbol("lastReject"),l=Symbol("error"),f=Symbol("ended"),p=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function h(H,K){return{value:H,done:K}}function w(H){var K=H[i];if(K!==null){var ae=H[g].read();ae!==null&&(H[p]=null,H[i]=null,H[o]=null,K(h(ae,!1)))}}function P(H){t.nextTick(w,H)}function B(H,K){return function(ae,Q){H.then(function(){if(K[f]){ae(h(void 0,!0));return}K[y](ae,Q)},Q)}}var v=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var K=this,ae=this[l];if(ae!==null)return Promise.reject(ae);if(this[f])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(re,Oe){t.nextTick(function(){K[l]?Oe(K[l]):re(h(void 0,!0))})});var Q=this[p],ge;if(Q)ge=new Promise(B(Q,this));else{var oe=this[g].read();if(oe!==null)return Promise.resolve(h(oe,!1));ge=new Promise(this[y])}return this[p]=ge,ge}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var K=this;return new Promise(function(ae,Q){K[g].destroy(null,function(ge){if(ge){Q(ge);return}ae(h(void 0,!0))})})}),e),v),E=function(K){var ae,Q=Object.create(S,(ae={},n(ae,g,{value:K,writable:!0}),n(ae,i,{value:null,writable:!0}),n(ae,o,{value:null,writable:!0}),n(ae,l,{value:null,writable:!0}),n(ae,f,{value:K._readableState.endEmitted,writable:!0}),n(ae,y,{value:function(oe,re){var Oe=Q[g].read();Oe?(Q[p]=null,Q[i]=null,Q[o]=null,oe(h(Oe,!1))):(Q[i]=oe,Q[o]=re)},writable:!0}),ae));return Q[p]=null,s(K,function(ge){if(ge&&ge.code!=="ERR_STREAM_PREMATURE_CLOSE"){var oe=Q[o];oe!==null&&(Q[p]=null,Q[i]=null,Q[o]=null,oe(ge)),Q[l]=ge;return}var re=Q[i];re!==null&&(Q[p]=null,Q[i]=null,Q[o]=null,re(h(void 0,!0))),Q[f]=!0}),K.on("readable",P.bind(null,Q)),Q};return Ls=E,Ls}function Tk(){return dh||(dh=!0,Fs=function(){throw new Error("Readable.from is not available in the browser")}),Fs}function Ih(){if(ph)return Ws;ph=!0;var t=At;Ws=re;var e;re.ReadableState=oe,Tt.EventEmitter;var n=function(x,z){return x.listeners(z).length},r=Bh(),a=Rt().Buffer,s=(typeof gh<"u"?gh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(_){return a.from(_)}function o(_){return a.isBuffer(_)||_ instanceof s}var l=L,f;l&&l.debuglog?f=l.debuglog("stream"):f=function(){};var p=hk(),y=Eh(),g=Sh(),h=g.getHighWaterMark,w=yr().codes,P=w.ERR_INVALID_ARG_TYPE,B=w.ERR_STREAM_PUSH_AFTER_EOF,v=w.ERR_METHOD_NOT_IMPLEMENTED,S=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,K;Mt()(re,r);var ae=y.errorOrDestroy,Q=["error","close","destroy","pause","resume"];function ge(_,x,z){if(typeof _.prependListener=="function")return _.prependListener(x,z);!_._events||!_._events[x]?_.on(x,z):Array.isArray(_._events[x])?_._events[x].unshift(z):_._events[x]=[z,_._events[x]]}function oe(_,x,z){e=e||gr(),_=_||{},typeof z!="boolean"&&(z=x instanceof e),this.objectMode=!!_.objectMode,z&&(this.objectMode=this.objectMode||!!_.readableObjectMode),this.highWaterMark=h(this,_,"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=_.emitClose!==!1,this.autoDestroy=!!_.autoDestroy,this.destroyed=!1,this.defaultEncoding=_.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,_.encoding&&(E||(E=ti.StringDecoder),this.decoder=new E(_.encoding),this.encoding=_.encoding)}function re(_){if(e=e||gr(),!(this instanceof re))return new re(_);var x=this instanceof e;this._readableState=new oe(_,this,x),this.readable=!0,_&&(typeof _.read=="function"&&(this._read=_.read),typeof _.destroy=="function"&&(this._destroy=_.destroy)),r.call(this)}Object.defineProperty(re.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),re.prototype.destroy=y.destroy,re.prototype._undestroy=y.undestroy,re.prototype._destroy=function(_,x){x(_)},re.prototype.push=function(_,x){var z=this._readableState,Y;return z.objectMode?Y=!0:typeof _=="string"&&(x=x||z.defaultEncoding,x!==z.encoding&&(_=a.from(_,x),x=""),Y=!0),Oe(this,_,x,!1,Y)},re.prototype.unshift=function(_){return Oe(this,_,null,!0,!1)};function Oe(_,x,z,Y,Me){f("readableAddChunk",x);var _e=_._readableState;if(x===null)_e.reading=!1,Ue(_,_e);else{var $;if(Me||($=tt(_e,x)),$)ae(_,$);else if(_e.objectMode||x&&x.length>0)if(typeof x!="string"&&!_e.objectMode&&Object.getPrototypeOf(x)!==a.prototype&&(x=i(x)),Y)_e.endEmitted?ae(_,new S):ze(_,_e,x,!0);else if(_e.ended)ae(_,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(_,_e,x,!1):fe(_,_e)):ze(_,_e,x,!1)}else Y||(_e.reading=!1,fe(_,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(_,x,z,Y){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,_.emit("data",z)):(x.length+=x.objectMode?1:z.length,Y?x.buffer.unshift(z):x.buffer.push(z),x.needReadable&&Pe(_)),fe(_,x)}function tt(_,x){var z;return!o(x)&&typeof x!="string"&&x!==void 0&&!_.objectMode&&(z=new P("chunk",["string","Buffer","Uint8Array"],x)),z}re.prototype.isPaused=function(){return this._readableState.flowing===!1},re.prototype.setEncoding=function(_){E||(E=ti.StringDecoder);var x=new E(_);this._readableState.decoder=x,this._readableState.encoding=this._readableState.decoder.encoding;for(var z=this._readableState.buffer.head,Y="";z!==null;)Y+=x.write(z.data),z=z.next;return this._readableState.buffer.clear(),Y!==""&&this._readableState.buffer.push(Y),this._readableState.length=Y.length,this};var Ve=1073741824;function Je(_){return _>=Ve?_=Ve:(_--,_|=_>>>1,_|=_>>>2,_|=_>>>4,_|=_>>>8,_|=_>>>16,_++),_}function mt(_,x){return _<=0||x.length===0&&x.ended?0:x.objectMode?1:_!==_?x.flowing&&x.length?x.buffer.head.data.length:x.length:(_>x.highWaterMark&&(x.highWaterMark=Je(_)),_<=x.length?_:x.ended?x.length:(x.needReadable=!0,0))}re.prototype.read=function(_){f("read",_),_=parseInt(_,10);var x=this._readableState,z=_;if(_!==0&&(x.emittedReadable=!1),_===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(_=mt(_,x),_===0&&x.ended)return x.length===0&&Z(this),null;var Y=x.needReadable;f("need readable",Y),(x.length===0||x.length-_<x.highWaterMark)&&(Y=!0,f("length less than watermark",Y)),x.ended||x.reading?(Y=!1,f("reading or ended",Y)):Y&&(f("do read"),x.reading=!0,x.sync=!0,x.length===0&&(x.needReadable=!0),this._read(x.highWaterMark),x.sync=!1,x.reading||(_=mt(z,x)));var Me;return _>0?Me=k(_,x):Me=null,Me===null?(x.needReadable=x.length<=x.highWaterMark,_=0):(x.length-=_,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),z!==_&&x.ended&&Z(this)),Me!==null&&this.emit("data",Me),Me};function Ue(_,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(_):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,Se(_)))}}function Pe(_){var x=_._readableState;f("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(f("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(Se,_))}function Se(_){var x=_._readableState;f("emitReadable_",x.destroyed,x.length,x.ended),!x.destroyed&&(x.length||x.ended)&&(_.emit("readable"),x.emittedReadable=!1),x.needReadable=!x.flowing&&!x.ended&&x.length<=x.highWaterMark,A(_)}function fe(_,x){x.readingMore||(x.readingMore=!0,t.nextTick(ve,_,x))}function ve(_,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var z=x.length;if(f("maybeReadMore read 0"),_.read(0),z===x.length)break}x.readingMore=!1}re.prototype._read=function(_){ae(this,new v("_read()"))},re.prototype.pipe=function(_,x){var z=this,Y=this._readableState;switch(Y.pipesCount){case 0:Y.pipes=_;break;case 1:Y.pipes=[Y.pipes,_];break;default:Y.pipes.push(_);break}Y.pipesCount+=1,f("pipe count=%d opts=%j",Y.pipesCount,x);var Me=(!x||x.end!==!1)&&_!==t.stdout&&_!==t.stderr,_e=Me?kt:u;Y.endEmitted?t.nextTick(_e):z.once("end",_e),_.on("unpipe",$);function $(c,T){f("onunpipe"),c===z&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,Tr())}function kt(){f("onend"),_.end()}var Ot=D(z);_.on("drain",Ot);var wt=!1;function Tr(){f("cleanup"),_.removeListener("close",_r),_.removeListener("finish",m),_.removeListener("drain",Ot),_.removeListener("error",Bt),_.removeListener("unpipe",$),z.removeListener("end",kt),z.removeListener("end",u),z.removeListener("data",li),wt=!0,Y.awaitDrain&&(!_._writableState||_._writableState.needDrain)&&Ot()}z.on("data",li);function li(c){f("ondata");var T=_.write(c);f("dest.write",T),T===!1&&((Y.pipesCount===1&&Y.pipes===_||Y.pipesCount>1&&ie(Y.pipes,_)!==-1)&&!wt&&(f("false write response, pause",Y.awaitDrain),Y.awaitDrain++),z.pause())}function Bt(c){f("onerror",c),u(),_.removeListener("error",Bt),n(_,"error")===0&&ae(_,c)}ge(_,"error",Bt);function _r(){_.removeListener("finish",m),u()}_.once("close",_r);function m(){f("onfinish"),_.removeListener("close",_r),u()}_.once("finish",m);function u(){f("unpipe"),z.unpipe(_)}return _.emit("pipe",z),Y.flowing||(f("pipe resume"),z.resume()),_};function D(_){return function(){var z=_._readableState;f("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(_,"data")&&(z.flowing=!0,A(_))}}re.prototype.unpipe=function(_){var x=this._readableState,z={hasUnpiped:!1};if(x.pipesCount===0)return this;if(x.pipesCount===1)return _&&_!==x.pipes?this:(_||(_=x.pipes),x.pipes=null,x.pipesCount=0,x.flowing=!1,_&&_.emit("unpipe",this,z),this);if(!_){var Y=x.pipes,Me=x.pipesCount;x.pipes=null,x.pipesCount=0,x.flowing=!1;for(var _e=0;_e<Me;_e++)Y[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var $=ie(x.pipes,_);return $===-1?this:(x.pipes.splice($,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),_.emit("unpipe",this,z),this)},re.prototype.on=function(_,x){var z=r.prototype.on.call(this,_,x),Y=this._readableState;return _==="data"?(Y.readableListening=this.listenerCount("readable")>0,Y.flowing!==!1&&this.resume()):_==="readable"&&!Y.endEmitted&&!Y.readableListening&&(Y.readableListening=Y.needReadable=!0,Y.flowing=!1,Y.emittedReadable=!1,f("on readable",Y.length,Y.reading),Y.length?Pe(this):Y.reading||t.nextTick(F,this)),z},re.prototype.addListener=re.prototype.on,re.prototype.removeListener=function(_,x){var z=r.prototype.removeListener.call(this,_,x);return _==="readable"&&t.nextTick(j,this),z},re.prototype.removeAllListeners=function(_){var x=r.prototype.removeAllListeners.apply(this,arguments);return(_==="readable"||_===void 0)&&t.nextTick(j,this),x};function j(_){var x=_._readableState;x.readableListening=_.listenerCount("readable")>0,x.resumeScheduled&&!x.paused?x.flowing=!0:_.listenerCount("data")>0&&_.resume()}function F(_){f("readable nexttick read 0"),_.read(0)}re.prototype.resume=function(){var _=this._readableState;return _.flowing||(f("resume"),_.flowing=!_.readableListening,de(this,_)),_.paused=!1,this};function de(_,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(Te,_,x))}function Te(_,x){f("resume",x.reading),x.reading||_.read(0),x.resumeScheduled=!1,_.emit("resume"),A(_),x.flowing&&!x.reading&&_.read(0)}re.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 A(_){var x=_._readableState;for(f("flow",x.flowing);x.flowing&&_.read()!==null;);}re.prototype.wrap=function(_){var x=this,z=this._readableState,Y=!1;_.on("end",function(){if(f("wrapped end"),z.decoder&&!z.ended){var $=z.decoder.end();$&&$.length&&x.push($)}x.push(null)}),_.on("data",function($){if(f("wrapped data"),z.decoder&&($=z.decoder.write($)),!(z.objectMode&&$==null)&&!(!z.objectMode&&(!$||!$.length))){var kt=x.push($);kt||(Y=!0,_.pause())}});for(var Me in _)this[Me]===void 0&&typeof _[Me]=="function"&&(this[Me]=function(kt){return function(){return _[kt].apply(_,arguments)}}(Me));for(var _e=0;_e<Q.length;_e++)_.on(Q[_e],this.emit.bind(this,Q[_e]));return this._read=function($){f("wrapped _read",$),Y&&(Y=!1,_.resume())},this},typeof Symbol=="function"&&(re.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=vk()),H(this)}),Object.defineProperty(re.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(re.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(re.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),re._fromList=k,Object.defineProperty(re.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function k(_,x){if(x.length===0)return null;var z;return x.objectMode?z=x.buffer.shift():!_||_>=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(_,x.decoder),z}function Z(_){var x=_._readableState;f("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(X,x,_))}function X(_,x){if(f("endReadableNT",_.endEmitted,_.length),!_.endEmitted&&_.length===0&&(_.endEmitted=!0,x.readable=!1,x.emit("end"),_.autoDestroy)){var z=x._writableState;(!z||z.autoDestroy&&z.finished)&&x.destroy()}}typeof Symbol=="function"&&(re.from=function(_,x){return K===void 0&&(K=Tk()),K(re,_,x)});function ie(_,x){for(var z=0,Y=_.length;z<Y;z++)if(_[z]===x)return z;return-1}return Ws}function Ah(){if(yh)return zs;yh=!0,zs=o;var t=yr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=t.ERR_TRANSFORM_WITH_LENGTH_0,s=gr();Mt()(o,s);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 w=this._readableState;w.reading=!1,(w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}function o(p){if(!(this instanceof o))return new o(p);s.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)}o.prototype.push=function(p,y){return this._transformState.needTransform=!1,s.prototype.push.call(this,p,y)},o.prototype._transform=function(p,y,g){g(new e("_transform()"))},o.prototype._write=function(p,y,g){var h=this._transformState;if(h.writecb=g,h.writechunk=p,h.writeencoding=y,!h.transforming){var w=this._readableState;(h.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},o.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},o.prototype._destroy=function(p,y){s.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 a;if(p._transformState.transforming)throw new r;return p.push(null)}return zs}function _k(){if(mh)return qs;mh=!0,qs=e;var t=Ah();Mt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,a){a(null,n)},qs}function bk(){if(hh)return Gs;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,a=n.ERR_STREAM_DESTROYED;function s(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function o(g,h,w,P){P=e(P);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=Qs()),t(g,{readable:h,writable:w},function(S){if(S)return P(S);B=!0,P()});var v=!1;return function(S){if(!B&&!v){if(v=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();P(S||new a("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"?s:g.pop()}function y(){for(var g=arguments.length,h=new Array(g),w=0;w<g;w++)h[w]=arguments[w];var P=p(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,v=h.map(function(S,E){var H=E<h.length-1,K=E>0;return o(S,H,K,function(ae){B||(B=ae),ae&&v.forEach(l),!H&&(v.forEach(l),P(B))})});return h.reduce(f)}return Gs=y,Gs}function Ch(){return vh||(vh=!0,bt=bt=Ih(),bt.Stream=bt,bt.Readable=bt,bt.Writable=kh(),bt.Duplex=gr(),bt.Transform=Ah(),bt.PassThrough=_k(),bt.finished=Qs(),bt.pipeline=bk()),bt}function Oh(){if(Th)return Fa;Th=!0;var t=Rt().Buffer,e=At,n=Ph(),r=Mt(),a=Ch(),s=Fa.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Fa.IncomingMessage=function(o,l,f,p){var y=this||Wa;if(a.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 v=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)),v()}}).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();v()}else{y._xhr=o,y._pos=0,y.url=o.responseURL,y.statusCode=o.status,y.statusMessage=o.statusText;var w=o.getAllResponseHeaders().split(/\r?\n/);if(w.forEach(function(v){var S=v.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,a.Readable),i.prototype._read=function(){var o=this||Wa,l=o._resumeFetch;l&&(o._resumeFetch=null,l())},i.prototype._onXHRProgress=function(o){var l=this||Wa,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!==s.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!==s.LOADING||!p)break;l.push(t.from(new Uint8Array(p)));break;case"ms-stream":if(p=f.response,f.readyState!==s.LOADING)break;var w=new Wa.MSStreamReader;w.onprogress=function(){w.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(w.result.slice(l._pos)))),l._pos=w.result.byteLength)},w.onload=function(){o(!0),l.push(null)},w.readAsArrayBuffer(p);break}l._xhr.readyState===s.DONE&&l._mode!=="ms-stream"&&(o(!0),l.push(null))},Fa}function wk(){if(_h)return Vs;_h=!0;var t=Rt().Buffer,e=At,n=Ph(),r=Mt(),a=Oh(),s=Ch(),i=a.IncomingMessage,o=a.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=Vs=function(g){var h=this||at;s.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 w,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,w=!0;else if(g.mode==="prefer-streaming")w=!1;else if(g.mode==="allow-wrong-content-type")w=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")w=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(w,P),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(f,s.Writable),f.prototype.setHeader=function(g,h){var w=this||at,P=g.toLowerCase();y.indexOf(P)===-1&&(w._headers[P]={name:g,value:h})},f.prototype.getHeader=function(g){var h=(this||at)._headers[g.toLowerCase()];return h?h.value:null},f.prototype.removeHeader=function(g){var h=this||at;delete h._headers[g.toLowerCase()]},f.prototype._onFinish=function(){var g=this||at;if(!g._destroyed){var h=g._opts;"timeout"in h&&h.timeout!==0&&g.setTimeout(h.timeout);var w=g._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(g._body,{type:(w["content-type"]||{}).value||""}));var B=[];if(Object.keys(w).forEach(function(H){var K=w[H].name,ae=w[H].value;Array.isArray(ae)?ae.forEach(function(Q){B.push([K,Q])}):B.push([K,ae])}),g._mode==="fetch"){var v=null;if(n.abortController){var S=new AbortController;v=S.signal,g._fetchAbortController=S,"requestTimeout"in h&&h.requestTimeout!==0&&(g._fetchTimer=at.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},h.requestTimeout))}at.fetch(g._opts.url,{method:g._opts.method,headers:B,body:P||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:v}).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 at.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 o.LOADING:case o.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||at;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||at;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,w){var P=this||at;P._body.push(g),w()},f.prototype._resetTimers=function(g){var h=this||at;at.clearTimeout(h._socketTimer),h._socketTimer=null,g?(at.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=at.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},f.prototype.abort=f.prototype.destroy=function(g){var h=this||at;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,w){var P=this||at;typeof g=="function"&&(w=g,g=void 0),s.Writable.prototype.end.call(P,g,h,w)},f.prototype.setTimeout=function(g,h){var w=this||at;h&&w.once("timeout",h),w._socketTimeout=g,w._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 Vs}function xk(){if(bh)return Js;bh=!0,Js=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var a=arguments[r];for(var s in a)t.call(a,s)&&(n[s]=a[s])}return n}return Js}function Pk(){return wh||(wh=!0,Xs={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"}),Xs}function Ek(){if(xh)return Ys;xh=!0;var t=wk(),e=Oh(),n=xk(),r=Pk(),a=De,s=Ys;return s.request=function(i,o){typeof i=="string"?i=a.parse(i):i=n(i);var l=Bk.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 o&&h.on("response",o),h},s.get=function(o,l){var f=s.request(o,l);return f.end(),f},s.ClientRequest=t,s.IncomingMessage=e.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=r,s.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"],Ys}var Pt,th,$n,Ns,nh,Ds,rh,Hs,ih,Us,ah,$s,oh,Zs,sh,lh,js,uh,Ks,ch,Ls,fh,Fs,dh,Ws,ph,gh,zs,yh,qs,mh,Gs,hh,bt,vh,Fa,Th,Wa,Vs,_h,at,Js,bh,Xs,wh,Ys,xh,Bk,Yt,Sk,kk,Ik,Ak,Ck,Ok,Rk,Mk,Mh=ot(()=>{C();R();O();is();Vy();as();pi();Cm();Ka();bs();Dm();$m();eh();Es();Pt={},th=!1,$n=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ns={},nh=!1;Ds={},rh=!1;Hs={},ih=!1;Us={},ah=!1;$s={},oh=!1;Zs={},sh=!1,lh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;js={},uh=!1;Ks={},ch=!1;Ls={},fh=!1;Fs={},dh=!1;Ws={},ph=!1,gh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;zs={},yh=!1;qs={},mh=!1;Gs={},hh=!1;bt={},vh=!1;Fa={},Th=!1,Wa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Vs={},_h=!1,at=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Js={},bh=!1;Xs={},wh=!1;Ys={},xh=!1,Bk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Yt=Ek(),Sk=Yt.Agent,kk=Yt.ClientRequest,Ik=Yt.IncomingMessage,Ak=Yt.METHODS,Ck=Yt.STATUS_CODES,Ok=Yt.get,Rk=Yt.globalAgent,Mk=Yt.request});C();R();O();var Cy={};Fn(Cy,{defaults:()=>MB,markdown:()=>RB});C();R();O();C();R();O();C();R();O();var Bo=Object.defineProperty,Fv=Object.defineProperties,Wv=Object.getOwnPropertyDescriptors,Bi=Object.getOwnPropertySymbols,Xc=Object.prototype.hasOwnProperty,Yc=Object.prototype.propertyIsEnumerable,gc=(t,e,n)=>e in t?Bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))Xc.call(e,n)&&gc(t,n,e[n]);if(Bi)for(var n of Bi(e))Yc.call(e,n)&&gc(t,n,e[n]);return t},N=(t,e)=>Fv(t,Wv(e)),d=(t,e)=>Bo(t,"name",{value:e,configurable:!0}),Qc=(t,e)=>{var n={};for(var r in t)Xc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Bi)for(var r of Bi(t))e.indexOf(r)<0&&Yc.call(t,r)&&(n[r]=t[r]);return n},oa=(t,e)=>{for(var n in e)Bo(t,n,{get:e[n],enumerable:!0})},zv={};oa(zv,{errors:()=>rf,fromJSONSchema:()=>Vg,fromJSONSchemaLegacy:()=>rB,fromObject:()=>xo,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>IB,toTypescriptSchema:()=>Ho,toTypescriptType:()=>Eo});var ne={};oa(ne,{BRAND:()=>Rx,DIRTY:()=>Jn,EMPTY_PATH:()=>Ix,INVALID:()=>pe,NEVER:()=>RP,OK:()=>pt,ParseInputLazyPath:()=>It,ParseStatus:()=>vt,Schema:()=>he,ZodAny:()=>Fr,ZodArray:()=>Wr,ZodBigInt:()=>jo,ZodBoolean:()=>Ko,ZodBranded:()=>Lo,ZodCatch:()=>Fo,ZodDate:()=>Wo,ZodDefault:()=>ha,ZodDiscriminatedUnion:()=>fg,ZodEffects:()=>Bn,ZodEnum:()=>ar,ZodError:()=>Kt,ZodFirstPartyTypeKind:()=>Yp,ZodFunction:()=>pg,ZodIntersection:()=>qo,ZodIssueCode:()=>G,ZodLazy:()=>Go,ZodLiteral:()=>Vo,ZodMap:()=>yg,ZodNaN:()=>hg,ZodNativeEnum:()=>Jo,ZodNever:()=>Gr,ZodNull:()=>Xo,ZodNullable:()=>er,ZodNumber:()=>Yo,ZodObject:()=>tr,ZodOptional:()=>an,ZodParsedType:()=>te,ZodPipeline:()=>Qo,ZodPromise:()=>Ta,ZodReadonly:()=>_a,ZodRecord:()=>Pg,ZodRef:()=>Eg,ZodSchema:()=>he,ZodSet:()=>Sg,ZodString:()=>gt,ZodSymbol:()=>Ug,ZodTransformer:()=>Bn,ZodTuple:()=>rr,ZodType:()=>he,ZodUndefined:()=>ba,ZodUnion:()=>es,ZodUnknown:()=>Ur,ZodVoid:()=>Kg,addIssueToContext:()=>ee,agent:()=>Zx,aimodel:()=>Wx,any:()=>nP,array:()=>oP,bigint:()=>Xx,boolean:()=>Wg,coerce:()=>OP,conversation:()=>Hx,createZodEnum:()=>va,cuid2Regex:()=>Ig,cuidRegex:()=>kg,custom:()=>ug,datasource:()=>zx,date:()=>Yx,default:()=>EP,discriminatedUnion:()=>cP,effect:()=>Gc,emailRegex:()=>Og,enum:()=>bP,errorUtil:()=>ue,event:()=>jx,function:()=>vP,getErrorMap:()=>Kr,getParsedType:()=>rn,instanceof:()=>Vx,intent:()=>Fx,intersection:()=>fP,ipv4Regex:()=>Mg,ipv6Regex:()=>Ng,isAborted:()=>_o,isAsync:()=>ki,isDirty:()=>bo,isEmojiRegex:()=>Mx,isValid:()=>Lr,knowledgebase:()=>qx,late:()=>Gx,lazy:()=>TP,literal:()=>_P,makeIssue:()=>Si,map:()=>mP,message:()=>$x,nan:()=>Jx,nativeEnum:()=>wP,never:()=>iP,null:()=>tP,nullable:()=>BP,number:()=>Fg,object:()=>sP,objectUtil:()=>To,oboolean:()=>CP,onumber:()=>AP,optional:()=>PP,ostring:()=>IP,pipeline:()=>kP,preprocess:()=>SP,processCreateParams:()=>me,promise:()=>xP,quotelessJson:()=>kx,readonly:()=>yP,record:()=>pP,ref:()=>gP,set:()=>hP,setErrorMap:()=>tg,strictObject:()=>lP,string:()=>Lg,symbol:()=>Qx,table:()=>Kx,tablerow:()=>Lx,transformer:()=>Gc,tuple:()=>dP,ulidRegex:()=>Ag,undefined:()=>eP,union:()=>uP,unknown:()=>rP,user:()=>Ux,util:()=>be,uuidRegex:()=>Cg,variable:()=>Dx,void:()=>aP});var le="x-zui";function ef(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:se(t)}d(ef,"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()})`:JSON.stringify(t)}d(se,"primitiveToTypescriptValue");function Xn(t){return typeof t>"u"?"undefined":JSON.stringify(t)}d(Xn,"unknownToTypescriptValue");var tf=d((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([a,s])=>`${uo(a)}: ${Xn(s)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),uo=d(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:se(t),"toPropertyKey"),qv=d(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),nf=d(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(qv).filter(r=>!!r).join("")},"toTypeArgumentName"),nt=d(t=>{let e=(t??"").split(`
12
+ `)&&(e=e.replace(ck,"%0A")),e.includes("\r")&&(e=e.replace(fk,"%0D")),e.includes(" ")&&(e=e.replace(dk,"%09")),r.pathname=e,r}var Ss,jm,Km,gr,BS,ES,SS,kS,Ht,ks,Fm,Qm,Wm,zm,IS,CS,ni,OS,Xt,De,RS,Dt,MS,NS,DS,HS,Os,qm,Gm,Vm,US,ZS,Is,pr,As,Cs,Jm,Xm,jS,KS,LS,FS,WS,Rs,zS,qS,GS,VS,JS,XS,nk,rk,ik,ak,ok,Ms,sk,lk,uk,ck,fk,dk,eh=ot(()=>{C();R();O();Ka();Es();Ss={},jm=!1;Km=PS(),gr=2147483647,BS=/^xn--/,ES=/[^\0-\x7E]/,SS=/[\x2E\u3002\uFF0E\uFF61]/g,kS={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ht=Math.floor,ks=String.fromCharCode;Fm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Qm=function(t,e,n){let r=0;for(t=n?Ht(t/700):t>>1,t+=Ht(t/e);t>455;r+=36)t=Ht(t/35);return Ht(r+36*t/(t+38))},Wm=function(t){let e=[],n=t.length,r=0,a=128,s=72,i=t.lastIndexOf("-");i<0&&(i=0);for(let l=0;l<i;++l)t.charCodeAt(l)>=128&&Zn("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&&Zn("invalid-input");let h=(o=t.charCodeAt(l++))-48<10?o-22:o-65<26?o-65:o-97<26?o-97:36;(h>=36||h>Ht((gr-r)/y))&&Zn("overflow"),r+=h*y;let w=g<=s?1:g>=s+26?26:g-s;if(h<w)break;let P=36-w;y>Ht(gr/P)&&Zn("overflow"),y*=P}let p=e.length+1;s=Qm(r-f,p,f==0),Ht(r/p)>gr-a&&Zn("overflow"),a+=Ht(r/p),r%=p,e.splice(r++,0,a)}var o;return String.fromCodePoint(...e)},zm=function(t){let e=[],n=(t=Ym(t)).length,r=128,a=0,s=72;for(let l of t)l<128&&e.push(ks(l));let i=e.length,o=i;for(i&&e.push("-");o<n;){let l=gr;for(let p of t)p>=r&&p<l&&(l=p);let f=o+1;l-r>Ht((gr-a)/f)&&Zn("overflow"),a+=(l-r)*f,r=l;for(let p of t)if(p<r&&++a>gr&&Zn("overflow"),p==r){let y=a;for(let g=36;;g+=36){let h=g<=s?1:g>=s+26?26:g-s;if(y<h)break;let w=y-h,P=36-h;e.push(ks(Fm(h+w%P,0))),y=Ht(w/P)}e.push(ks(Fm(y,0))),s=Qm(a,f,o==i),a=0,++o}++a,++r}return e.join("")},IS={version:"2.1.0",ucs2:{decode:Ym,encode:t=>String.fromCodePoint(...t)},decode:Wm,encode:zm,toASCII:function(t){return Lm(t,function(e){return ES.test(e)?"xn--"+zm(e):e})},toUnicode:function(t){return Lm(t,function(e){return BS.test(e)?Wm(e.slice(4).toLowerCase()):e})}};CS=function(t,e,n,r){e=e||"&",n=n||"=";var a={};if(typeof t!="string"||t.length===0)return a;var s=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var o=t.length;i>0&&o>i&&(o=i);for(var l=0;l<o;++l){var f,p,y,g,h=t[l].replace(s,"%20"),w=h.indexOf(n);w>=0?(f=h.substr(0,w),p=h.substr(w+1)):(f=h,p=""),y=decodeURIComponent(f),g=decodeURIComponent(p),AS(a,y)?Array.isArray(a[y])?a[y].push(g):a[y]=[a[y],g]:a[y]=g}return a},ni=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},OS=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(a){var s=encodeURIComponent(ni(a))+n;return Array.isArray(t[a])?t[a].map(function(i){return s+encodeURIComponent(ni(i))}).join(e):s+encodeURIComponent(ni(t[a]))}).join(e):r?encodeURIComponent(ni(r))+n+encodeURIComponent(ni(t)):""},Xt={};Xt.decode=Xt.parse=CS,Xt.encode=Xt.stringify=OS;Xt.decode;Xt.encode;Xt.parse;Xt.stringify;De={},RS=IS,Dt={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=ri,De.resolve=function(t,e){return ri(t,!1,!0).resolve(e)},De.resolveObject=function(t,e){return t?ri(t,!1,!0).resolveObject(e):e},De.format=function(t){return Dt.isString(t)&&(t=ri(t)),t instanceof St?t.format():St.prototype.format.call(t)},De.Url=St;MS=/^([a-z0-9.+-]+:)/i,NS=/:[0-9]*$/,DS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,HS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
13
+ `," "]),Os=["'"].concat(HS),qm=["%","/","?",";","#"].concat(Os),Gm=["/","?","#"],Vm=/^[+a-z0-9A-Z_-]{0,63}$/,US=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ZS={javascript:!0,"javascript:":!0},Is={javascript:!0,"javascript:":!0},pr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},As=Xt;St.prototype.parse=function(t,e,n){if(!Dt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),a=r!==-1&&r<t.indexOf("#")?"?":"#",s=t.split(a);s[0]=s[0].replace(/\\/g,"/");var i=t=s.join(a);if(i=i.trim(),!n&&t.split("#").length===1){var o=DS.exec(i);if(o)return this.path=i,this.href=i,this.pathname=o[1],o[2]?(this.search=o[2],this.query=e?As.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=MS.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&&Is[l]||(i=i.substr(2),this.slashes=!0)}if(!Is[l]&&(p||l&&!pr[l])){for(var y,g,h=-1,w=0;w<Gm.length;w++)(P=i.indexOf(Gm[w]))!==-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,w=0;w<qm.length;w++){var P;(P=i.indexOf(qm[w]))!==-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 v=this.hostname.split(/\./),S=(w=0,v.length);w<S;w++){var E=v[w];if(E&&!E.match(Vm)){for(var H="",K=0,ae=E.length;K<ae;K++)E.charCodeAt(K)>127?H+="x":H+=E[K];if(!H.match(Vm)){var ee=v.slice(0,w),ge=v.slice(w+1),oe=E.match(US);oe&&(ee.push(oe[1]),ge.unshift(oe[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=RS.toASCII(this.hostname));var re=this.port?":"+this.port:"",Oe=this.hostname||"";this.host=Oe+re,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!ZS[f])for(w=0,S=Os.length;w<S;w++){var ze=Os[w];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=As.parse(this.query)),i=i.slice(0,Je)):e&&(this.search="",this.query={}),i&&(this.pathname=i),pr[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){re=this.pathname||"";var mt=this.search||"";this.path=re+mt}return this.href=this.format(),this},St.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||"",a=!1,s="";this.host?a=t+this.host:this.hostname&&(a=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(a+=":"+this.port)),this.query&&Dt.isObject(this.query)&&Object.keys(this.query).length&&(s=As.stringify(this.query));var i=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||pr[e])&&a!==!1?(a="//"+(a||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):a||(a=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+a+(n=n.replace(/[?#]/g,function(o){return encodeURIComponent(o)}))+(i=i.replace("#","%23"))+r},St.prototype.resolve=function(t){return this.resolveObject(ri(t,!1,!0)).format()},St.prototype.resolveObject=function(t){if(Dt.isString(t)){var e=new St;e.parse(t,!1,!0),t=e}for(var n=new St,r=Object.keys(this),a=0;a<r.length;a++){var s=r[a];n[s]=this[s]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),o=0;o<i.length;o++){var l=i[o];l!=="protocol"&&(n[l]=t[l])}return pr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!pr[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||Is[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||"",w=n.search||"";n.path=h+w}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)==="/",v=B||P||n.host&&t.pathname,S=v,E=n.pathname&&n.pathname.split("/")||[],H=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!pr[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),v=v&&(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(!Dt.isNullOrUndefined(t.search))return H&&(n.hostname=n.host=E.shift(),(oe=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=oe.shift(),n.host=n.hostname=oe.shift())),n.search=t.search,n.query=t.query,Dt.isNull(n.pathname)&&Dt.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 K=E.slice(-1)[0],ae=(n.host||t.host||E.length>1)&&(K==="."||K==="..")||K==="",ee=0,ge=E.length;ge>=0;ge--)(K=E[ge])==="."?E.splice(ge,1):K===".."?(E.splice(ge,1),ee++):ee&&(E.splice(ge,1),ee--);if(!v&&!S)for(;ee--;ee)E.unshift("..");!v||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),ae&&E.join("/").substr(-1)!=="/"&&E.push("");var oe,re=E[0]===""||E[0]&&E[0].charAt(0)==="/";return H&&(n.hostname=n.host=re?"":E.length?E.shift():"",(oe=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=oe.shift(),n.host=n.hostname=oe.shift())),(v=v||n.host&&E.length)&&!re&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),Dt.isNull(n.pathname)&&Dt.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},St.prototype.parseHost=function(){var t=this.host,e=NS.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;Cs={},Jm=!1;Xm=$S(),jS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=tk;De.fileURLToPath=YS;De.Url;De.format;De.resolve;De.resolveObject;De.URL;KS=92,LS=47,FS=97,WS=122,Rs=jS==="win32",zS=/\//g,qS=/%/g,GS=/\\/g,VS=/\n/g,JS=/\r/g,XS=/\t/g;nk=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;De.URL=typeof URL<"u"?URL:null;De.pathToFileURL=mk;De.fileURLToPath=pk;De.Url;De.format;De.resolve;De.resolveObject;De.parse;De.URL;rk=92,ik=47,ak=97,ok=122,Ms=nk==="win32",sk=/\//g,lk=/%/g,uk=/\\/g,ck=/\n/g,fk=/\r/g,dk=/\t/g});var Rh={};Wn(Rh,{Agent:()=>Sk,ClientRequest:()=>kk,IncomingMessage:()=>Ik,METHODS:()=>Ak,STATUS_CODES:()=>Ck,default:()=>Yt,get:()=>Ok,globalAgent:()=>Rk,request:()=>Mk});function Ph(){if(th)return Pt;th=!0,Pt.fetch=r($n.fetch)&&r($n.ReadableStream),Pt.writableStream=r($n.WritableStream),Pt.abortController=r($n.AbortController);var t;function e(){if(t!==void 0)return t;if($n.XMLHttpRequest){t=new $n.XMLHttpRequest;try{t.open("GET",$n.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(a){var s=e();if(!s)return!1;try{return s.responseType=a,s.responseType===a}catch{}return!1}Pt.arraybuffer=Pt.fetch||n("arraybuffer"),Pt.msstream=!Pt.fetch&&n("ms-stream"),Pt.mozchunkedarraybuffer=!Pt.fetch&&n("moz-chunked-arraybuffer"),Pt.overrideMimeType=Pt.fetch||(e()?r(e().overrideMimeType):!1);function r(a){return typeof a=="function"}return t=null,Pt}function Bh(){return nh||(nh=!0,Ns=Tt.EventEmitter),Ns}function hk(){if(rh)return Ds;rh=!0;function t(w,P){var B=Object.keys(w);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(w);P&&(v=v.filter(function(S){return Object.getOwnPropertyDescriptor(w,S).enumerable})),B.push.apply(B,v)}return B}function e(w){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?t(Object(B),!0).forEach(function(v){n(w,v,B[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(B)):t(Object(B)).forEach(function(v){Object.defineProperty(w,v,Object.getOwnPropertyDescriptor(B,v))})}return w}function n(w,P,B){return P=i(P),P in w?Object.defineProperty(w,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):w[P]=B,w}function r(w,P){if(!(w instanceof P))throw new TypeError("Cannot call a class as a function")}function a(w,P){for(var B=0;B<P.length;B++){var v=P[B];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(w,i(v.key),v)}}function s(w,P,B){return P&&a(w.prototype,P),Object.defineProperty(w,"prototype",{writable:!1}),w}function i(w){var P=o(w,"string");return typeof P=="symbol"?P:String(P)}function o(w,P){if(typeof w!="object"||w===null)return w;var B=w[Symbol.toPrimitive];if(B!==void 0){var v=B.call(w,P||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(w)}var l=Rt(),f=l.Buffer,p=L,y=p.inspect,g=y&&y.custom||"inspect";function h(w,P,B){f.prototype.copy.call(w,P,B)}return Ds=function(){function w(){r(this,w),this.head=null,this.tail=null,this.length=0}return s(w,[{key:"push",value:function(B){var v={data:B,next:null};this.length>0?this.tail.next=v:this.head=v,this.tail=v,++this.length}},{key:"unshift",value:function(B){var v={data:B,next:this.head};this.length===0&&(this.tail=v),this.head=v,++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 v=this.head,S=""+v.data;v=v.next;)S+=B+v.data;return S}},{key:"concat",value:function(B){if(this.length===0)return f.alloc(0);for(var v=f.allocUnsafe(B>>>0),S=this.head,E=0;S;)h(S.data,v,E),E+=S.data.length,S=S.next;return v}},{key:"consume",value:function(B,v){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=v?this._getString(B):this._getBuffer(B),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(B){var v=this.head,S=1,E=v.data;for(B-=E.length;v=v.next;){var H=v.data,K=B>H.length?H.length:B;if(K===H.length?E+=H:E+=H.slice(0,B),B-=K,B===0){K===H.length?(++S,v.next?this.head=v.next:this.head=this.tail=null):(this.head=v,v.data=H.slice(K));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(B){var v=f.allocUnsafe(B),S=this.head,E=1;for(S.data.copy(v),B-=S.data.length;S=S.next;){var H=S.data,K=B>H.length?H.length:B;if(H.copy(v,v.length-B,0,K),B-=K,B===0){K===H.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=H.slice(K));break}++E}return this.length-=E,v}},{key:g,value:function(B,v){return y(this,e(e({},v),{},{depth:0,customInspect:!1}))}}]),w}(),Ds}function Eh(){if(ih)return Hs;ih=!0;var t=At;function e(o,l){var f=this,p=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return p||y?(l?l(o):o&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,o)):t.nextTick(s,this,o)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(o||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(o,l){s(o,l),r(o)}function r(o){o._writableState&&!o._writableState.emitClose||o._readableState&&!o._readableState.emitClose||o.emit("close")}function a(){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 s(o,l){o.emit("error",l)}function i(o,l){var f=o._readableState,p=o._writableState;f&&f.autoDestroy||p&&p.autoDestroy?o.destroy(l):o.emit("error",l)}return Hs={destroy:e,undestroy:a,errorOrDestroy:i},Hs}function mr(){if(ah)return Us;ah=!0;let t={};function e(i,o,l){l||(l=Error);function f(y,g,h){return typeof o=="string"?o:o(y,g,h)}class p extends l{constructor(g,h,w){super(f(g,h,w))}}p.prototype.name=l.name,p.prototype.code=i,t[i]=p}function n(i,o){if(Array.isArray(i)){let l=i.length;return i=i.map(f=>String(f)),l>2?`one of ${o} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${o} ${i[0]} or ${i[1]}`:`of ${o} ${i[0]}`}else return`of ${o} ${String(i)}`}function r(i,o,l){return i.substr(0,o.length)===o}function a(i,o,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-o.length,l)===o}function s(i,o,l){return typeof l!="number"&&(l=0),l+o.length>i.length?!1:i.indexOf(o,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,o){return'The value "'+o+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,o,l){let f;typeof o=="string"&&r(o,"not ")?(f="must not be",o=o.replace(/^not /,"")):f="must be";let p;if(a(i," argument"))p=`The ${i} ${f} ${n(o,"type")}`;else{let y=s(i,".")?"property":"argument";p=`The "${i}" ${y} ${f} ${n(o,"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"),Us.codes=t,Us}function Sh(){if(oh)return Zs;oh=!0;var t=mr().codes.ERR_INVALID_OPT_VALUE;function e(r,a,s){return r.highWaterMark!=null?r.highWaterMark:a?r[s]:null}function n(r,a,s,i){var o=e(a,i,s);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var l=i?s:"highWaterMark";throw new t(l,o)}return Math.floor(o)}return r.objectMode?16:16*1024}return Zs={getHighWaterMark:n},Zs}function kh(){if(sh)return $s;sh=!0;var t=At;$s=oe;function e(A){var k=this;this.next=null,this.entry=null,this.finish=function(){Te(k,A)}}var n;oe.WritableState=ee;var r={deprecate:Nm()},a=Bh(),s=Rt().Buffer,i=(typeof lh<"u"?lh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(A){return s.from(A)}function l(A){return s.isBuffer(A)||A instanceof i}var f=Eh(),p=Sh(),y=p.getHighWaterMark,g=mr().codes,h=g.ERR_INVALID_ARG_TYPE,w=g.ERR_METHOD_NOT_IMPLEMENTED,P=g.ERR_MULTIPLE_CALLBACK,B=g.ERR_STREAM_CANNOT_PIPE,v=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,H=g.ERR_UNKNOWN_ENCODING,K=f.errorOrDestroy;Mt()(oe,a);function ae(){}function ee(A,k,$){n=n||yr(),A=A||{},typeof $!="boolean"&&($=k instanceof n),this.objectMode=!!A.objectMode,$&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=y(this,A,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var X=A.decodeStrings===!1;this.decodeStrings=!X,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ie){Ue(k,ie)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ee.prototype.getBuffer=function(){for(var k=this.bufferedRequest,$=[];k;)$.push(k),k=k.next;return $},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(oe,Symbol.hasInstance,{value:function(k){return ge.call(this,k)?!0:this!==oe?!1:k&&k._writableState instanceof ee}})):ge=function(k){return k instanceof this};function oe(A){n=n||yr();var k=this instanceof n;if(!k&&!ge.call(oe,this))return new oe(A);this._writableState=new ee(A,this,k),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),a.call(this)}oe.prototype.pipe=function(){K(this,new B)};function re(A,k){var $=new E;K(A,$),t.nextTick(k,$)}function Oe(A,k,$,X){var ie;return $===null?ie=new S:typeof $!="string"&&!k.objectMode&&(ie=new h("chunk",["string","Buffer"],$)),ie?(K(A,ie),t.nextTick(X,ie),!1):!0}oe.prototype.write=function(A,k,$){var X=this._writableState,ie=!1,_=!X.objectMode&&l(A);return _&&!s.isBuffer(A)&&(A=o(A)),typeof k=="function"&&($=k,k=null),_?k="buffer":k||(k=X.defaultEncoding),typeof $!="function"&&($=ae),X.ending?re(this,$):(_||Oe(this,X,A,$))&&(X.pendingcb++,ie=tt(this,X,_,A,k,$)),ie},oe.prototype.cork=function(){this._writableState.corked++},oe.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&fe(this,A))},oe.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(oe.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ze(A,k,$){return!A.objectMode&&A.decodeStrings!==!1&&typeof k=="string"&&(k=s.from(k,$)),k}Object.defineProperty(oe.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function tt(A,k,$,X,ie,_){if(!$){var x=ze(k,X,ie);X!==x&&($=!0,ie="buffer",X=x)}var z=k.objectMode?1:X.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:X,encoding:ie,isBuf:$,callback:_,next:null},Me?Me.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else Ve(A,k,!1,z,X,ie,_);return Q}function Ve(A,k,$,X,ie,_,x){k.writelen=X,k.writecb=x,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new v("write")):$?A._writev(ie,k.onwrite):A._write(ie,_,k.onwrite),k.sync=!1}function Je(A,k,$,X,ie){--k.pendingcb,$?(t.nextTick(ie,X),t.nextTick(F,A,k),A._writableState.errorEmitted=!0,K(A,X)):(ie(X),A._writableState.errorEmitted=!0,K(A,X),F(A,k))}function mt(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}function Ue(A,k){var $=A._writableState,X=$.sync,ie=$.writecb;if(typeof ie!="function")throw new P;if(mt($),k)Je(A,$,X,k,ie);else{var _=ve($)||A.destroyed;!_&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&fe(A,$),X?t.nextTick(Pe,A,$,_,ie):Pe(A,$,_,ie)}}function Pe(A,k,$,X){$||Se(A,k),k.pendingcb--,X(),F(A,k)}function Se(A,k){k.length===0&&k.needDrain&&(k.needDrain=!1,A.emit("drain"))}function fe(A,k){k.bufferProcessing=!0;var $=k.bufferedRequest;if(A._writev&&$&&$.next){var X=k.bufferedRequestCount,ie=new Array(X),_=k.corkedRequestsFree;_.entry=$;for(var x=0,z=!0;$;)ie[x]=$,$.isBuf||(z=!1),$=$.next,x+=1;ie.allBuffers=z,Ve(A,k,!0,k.length,ie,"",_.finish),k.pendingcb++,k.lastBufferedRequest=null,_.next?(k.corkedRequestsFree=_.next,_.next=null):k.corkedRequestsFree=new e(k),k.bufferedRequestCount=0}else{for(;$;){var Q=$.chunk,Me=$.encoding,_e=$.callback,Z=k.objectMode?1:Q.length;if(Ve(A,k,!1,Z,Q,Me,_e),$=$.next,k.bufferedRequestCount--,k.writing)break}$===null&&(k.lastBufferedRequest=null)}k.bufferedRequest=$,k.bufferProcessing=!1}oe.prototype._write=function(A,k,$){$(new w("_write()"))},oe.prototype._writev=null,oe.prototype.end=function(A,k,$){var X=this._writableState;return typeof A=="function"?($=A,A=null,k=null):typeof k=="function"&&($=k,k=null),A!=null&&this.write(A,k),X.corked&&(X.corked=1,this.uncork()),X.ending||de(this,X,$),this},Object.defineProperty(oe.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ve(A){return A.ending&&A.length===0&&A.bufferedRequest===null&&!A.finished&&!A.writing}function D(A,k){A._final(function($){k.pendingcb--,$&&K(A,$),k.prefinished=!0,A.emit("prefinish"),F(A,k)})}function j(A,k){!k.prefinished&&!k.finalCalled&&(typeof A._final=="function"&&!k.destroyed?(k.pendingcb++,k.finalCalled=!0,t.nextTick(D,A,k)):(k.prefinished=!0,A.emit("prefinish")))}function F(A,k){var $=ve(k);if($&&(j(A,k),k.pendingcb===0&&(k.finished=!0,A.emit("finish"),k.autoDestroy))){var X=A._readableState;(!X||X.autoDestroy&&X.endEmitted)&&A.destroy()}return $}function de(A,k,$){k.ending=!0,F(A,k),$&&(k.finished?t.nextTick($):A.once("finish",$)),k.ended=!0,A.writable=!1}function Te(A,k,$){var X=A.entry;for(A.entry=null;X;){var ie=X.callback;k.pendingcb--,ie($),X=X.next}k.corkedRequestsFree.next=A}return Object.defineProperty(oe.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(k){this._writableState&&(this._writableState.destroyed=k)}}),oe.prototype.destroy=f.destroy,oe.prototype._undestroy=f.undestroy,oe.prototype._destroy=function(A,k){k(A)},$s}function yr(){if(uh)return js;uh=!0;var t=At,e=Object.keys||function(p){var y=[];for(var g in p)y.push(g);return y};js=o;var n=Ih(),r=kh();Mt()(o,n);for(var a=e(r.prototype),s=0;s<a.length;s++){var i=a[s];o.prototype[i]||(o.prototype[i]=r.prototype[i])}function o(p){if(!(this instanceof o))return new o(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(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.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(o.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)}}),js}function Qs(){if(ch)return Ks;ch=!0;var t=mr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var i=!1;return function(){if(!i){i=!0;for(var o=arguments.length,l=new Array(o),f=0;f<o;f++)l[f]=arguments[f];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function a(s,i,o){if(typeof i=="function")return a(s,null,i);i||(i={}),o=e(o||n);var l=i.readable||i.readable!==!1&&s.readable,f=i.writable||i.writable!==!1&&s.writable,p=function(){s.writable||g()},y=s._writableState&&s._writableState.finished,g=function(){f=!1,y=!0,l||o.call(s)},h=s._readableState&&s._readableState.endEmitted,w=function(){l=!1,h=!0,f||o.call(s)},P=function(E){o.call(s,E)},B=function(){var E;if(l&&!h)return(!s._readableState||!s._readableState.ended)&&(E=new t),o.call(s,E);if(f&&!y)return(!s._writableState||!s._writableState.ended)&&(E=new t),o.call(s,E)},v=function(){s.req.on("finish",g)};return r(s)?(s.on("complete",g),s.on("abort",B),s.req?v():s.on("request",v)):f&&!s._writableState&&(s.on("end",p),s.on("close",p)),s.on("end",w),s.on("finish",g),i.error!==!1&&s.on("error",P),s.on("close",B),function(){s.removeListener("complete",g),s.removeListener("abort",B),s.removeListener("request",v),s.req&&s.req.removeListener("finish",g),s.removeListener("end",p),s.removeListener("close",p),s.removeListener("finish",g),s.removeListener("end",w),s.removeListener("error",P),s.removeListener("close",B)}}return Ks=a,Ks}function vk(){if(fh)return Ls;fh=!0;var t=At,e;function n(H,K,ae){return K=r(K),K in H?Object.defineProperty(H,K,{value:ae,enumerable:!0,configurable:!0,writable:!0}):H[K]=ae,H}function r(H){var K=a(H,"string");return typeof K=="symbol"?K:String(K)}function a(H,K){if(typeof H!="object"||H===null)return H;var ae=H[Symbol.toPrimitive];if(ae!==void 0){var ee=ae.call(H,K||"default");if(typeof ee!="object")return ee;throw new TypeError("@@toPrimitive must return a primitive value.")}return(K==="string"?String:Number)(H)}var s=Qs(),i=Symbol("lastResolve"),o=Symbol("lastReject"),l=Symbol("error"),f=Symbol("ended"),p=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function h(H,K){return{value:H,done:K}}function w(H){var K=H[i];if(K!==null){var ae=H[g].read();ae!==null&&(H[p]=null,H[i]=null,H[o]=null,K(h(ae,!1)))}}function P(H){t.nextTick(w,H)}function B(H,K){return function(ae,ee){H.then(function(){if(K[f]){ae(h(void 0,!0));return}K[y](ae,ee)},ee)}}var v=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var K=this,ae=this[l];if(ae!==null)return Promise.reject(ae);if(this[f])return Promise.resolve(h(void 0,!0));if(this[g].destroyed)return new Promise(function(re,Oe){t.nextTick(function(){K[l]?Oe(K[l]):re(h(void 0,!0))})});var ee=this[p],ge;if(ee)ge=new Promise(B(ee,this));else{var oe=this[g].read();if(oe!==null)return Promise.resolve(h(oe,!1));ge=new Promise(this[y])}return this[p]=ge,ge}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var K=this;return new Promise(function(ae,ee){K[g].destroy(null,function(ge){if(ge){ee(ge);return}ae(h(void 0,!0))})})}),e),v),E=function(K){var ae,ee=Object.create(S,(ae={},n(ae,g,{value:K,writable:!0}),n(ae,i,{value:null,writable:!0}),n(ae,o,{value:null,writable:!0}),n(ae,l,{value:null,writable:!0}),n(ae,f,{value:K._readableState.endEmitted,writable:!0}),n(ae,y,{value:function(oe,re){var Oe=ee[g].read();Oe?(ee[p]=null,ee[i]=null,ee[o]=null,oe(h(Oe,!1))):(ee[i]=oe,ee[o]=re)},writable:!0}),ae));return ee[p]=null,s(K,function(ge){if(ge&&ge.code!=="ERR_STREAM_PREMATURE_CLOSE"){var oe=ee[o];oe!==null&&(ee[p]=null,ee[i]=null,ee[o]=null,oe(ge)),ee[l]=ge;return}var re=ee[i];re!==null&&(ee[p]=null,ee[i]=null,ee[o]=null,re(h(void 0,!0))),ee[f]=!0}),K.on("readable",P.bind(null,ee)),ee};return Ls=E,Ls}function Tk(){return dh||(dh=!0,Fs=function(){throw new Error("Readable.from is not available in the browser")}),Fs}function Ih(){if(ph)return Ws;ph=!0;var t=At;Ws=re;var e;re.ReadableState=oe,Tt.EventEmitter;var n=function(x,z){return x.listeners(z).length},r=Bh(),a=Rt().Buffer,s=(typeof gh<"u"?gh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(_){return a.from(_)}function o(_){return a.isBuffer(_)||_ instanceof s}var l=L,f;l&&l.debuglog?f=l.debuglog("stream"):f=function(){};var p=hk(),y=Eh(),g=Sh(),h=g.getHighWaterMark,w=mr().codes,P=w.ERR_INVALID_ARG_TYPE,B=w.ERR_STREAM_PUSH_AFTER_EOF,v=w.ERR_METHOD_NOT_IMPLEMENTED,S=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,H,K;Mt()(re,r);var ae=y.errorOrDestroy,ee=["error","close","destroy","pause","resume"];function ge(_,x,z){if(typeof _.prependListener=="function")return _.prependListener(x,z);!_._events||!_._events[x]?_.on(x,z):Array.isArray(_._events[x])?_._events[x].unshift(z):_._events[x]=[z,_._events[x]]}function oe(_,x,z){e=e||yr(),_=_||{},typeof z!="boolean"&&(z=x instanceof e),this.objectMode=!!_.objectMode,z&&(this.objectMode=this.objectMode||!!_.readableObjectMode),this.highWaterMark=h(this,_,"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=_.emitClose!==!1,this.autoDestroy=!!_.autoDestroy,this.destroyed=!1,this.defaultEncoding=_.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,_.encoding&&(E||(E=ti.StringDecoder),this.decoder=new E(_.encoding),this.encoding=_.encoding)}function re(_){if(e=e||yr(),!(this instanceof re))return new re(_);var x=this instanceof e;this._readableState=new oe(_,this,x),this.readable=!0,_&&(typeof _.read=="function"&&(this._read=_.read),typeof _.destroy=="function"&&(this._destroy=_.destroy)),r.call(this)}Object.defineProperty(re.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(x){this._readableState&&(this._readableState.destroyed=x)}}),re.prototype.destroy=y.destroy,re.prototype._undestroy=y.undestroy,re.prototype._destroy=function(_,x){x(_)},re.prototype.push=function(_,x){var z=this._readableState,Q;return z.objectMode?Q=!0:typeof _=="string"&&(x=x||z.defaultEncoding,x!==z.encoding&&(_=a.from(_,x),x=""),Q=!0),Oe(this,_,x,!1,Q)},re.prototype.unshift=function(_){return Oe(this,_,null,!0,!1)};function Oe(_,x,z,Q,Me){f("readableAddChunk",x);var _e=_._readableState;if(x===null)_e.reading=!1,Ue(_,_e);else{var Z;if(Me||(Z=tt(_e,x)),Z)ae(_,Z);else if(_e.objectMode||x&&x.length>0)if(typeof x!="string"&&!_e.objectMode&&Object.getPrototypeOf(x)!==a.prototype&&(x=i(x)),Q)_e.endEmitted?ae(_,new S):ze(_,_e,x,!0);else if(_e.ended)ae(_,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(_,_e,x,!1):fe(_,_e)):ze(_,_e,x,!1)}else Q||(_e.reading=!1,fe(_,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function ze(_,x,z,Q){x.flowing&&x.length===0&&!x.sync?(x.awaitDrain=0,_.emit("data",z)):(x.length+=x.objectMode?1:z.length,Q?x.buffer.unshift(z):x.buffer.push(z),x.needReadable&&Pe(_)),fe(_,x)}function tt(_,x){var z;return!o(x)&&typeof x!="string"&&x!==void 0&&!_.objectMode&&(z=new P("chunk",["string","Buffer","Uint8Array"],x)),z}re.prototype.isPaused=function(){return this._readableState.flowing===!1},re.prototype.setEncoding=function(_){E||(E=ti.StringDecoder);var x=new E(_);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(_){return _>=Ve?_=Ve:(_--,_|=_>>>1,_|=_>>>2,_|=_>>>4,_|=_>>>8,_|=_>>>16,_++),_}function mt(_,x){return _<=0||x.length===0&&x.ended?0:x.objectMode?1:_!==_?x.flowing&&x.length?x.buffer.head.data.length:x.length:(_>x.highWaterMark&&(x.highWaterMark=Je(_)),_<=x.length?_:x.ended?x.length:(x.needReadable=!0,0))}re.prototype.read=function(_){f("read",_),_=parseInt(_,10);var x=this._readableState,z=_;if(_!==0&&(x.emittedReadable=!1),_===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?$(this):Pe(this),null;if(_=mt(_,x),_===0&&x.ended)return x.length===0&&$(this),null;var Q=x.needReadable;f("need readable",Q),(x.length===0||x.length-_<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||(_=mt(z,x)));var Me;return _>0?Me=k(_,x):Me=null,Me===null?(x.needReadable=x.length<=x.highWaterMark,_=0):(x.length-=_,x.awaitDrain=0),x.length===0&&(x.ended||(x.needReadable=!0),z!==_&&x.ended&&$(this)),Me!==null&&this.emit("data",Me),Me};function Ue(_,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(_):(x.needReadable=!1,x.emittedReadable||(x.emittedReadable=!0,Se(_)))}}function Pe(_){var x=_._readableState;f("emitReadable",x.needReadable,x.emittedReadable),x.needReadable=!1,x.emittedReadable||(f("emitReadable",x.flowing),x.emittedReadable=!0,t.nextTick(Se,_))}function Se(_){var x=_._readableState;f("emitReadable_",x.destroyed,x.length,x.ended),!x.destroyed&&(x.length||x.ended)&&(_.emit("readable"),x.emittedReadable=!1),x.needReadable=!x.flowing&&!x.ended&&x.length<=x.highWaterMark,A(_)}function fe(_,x){x.readingMore||(x.readingMore=!0,t.nextTick(ve,_,x))}function ve(_,x){for(;!x.reading&&!x.ended&&(x.length<x.highWaterMark||x.flowing&&x.length===0);){var z=x.length;if(f("maybeReadMore read 0"),_.read(0),z===x.length)break}x.readingMore=!1}re.prototype._read=function(_){ae(this,new v("_read()"))},re.prototype.pipe=function(_,x){var z=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=_;break;case 1:Q.pipes=[Q.pipes,_];break;default:Q.pipes.push(_);break}Q.pipesCount+=1,f("pipe count=%d opts=%j",Q.pipesCount,x);var Me=(!x||x.end!==!1)&&_!==t.stdout&&_!==t.stderr,_e=Me?kt:u;Q.endEmitted?t.nextTick(_e):z.once("end",_e),_.on("unpipe",Z);function Z(c,T){f("onunpipe"),c===z&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,Tr())}function kt(){f("onend"),_.end()}var Ot=D(z);_.on("drain",Ot);var wt=!1;function Tr(){f("cleanup"),_.removeListener("close",_r),_.removeListener("finish",m),_.removeListener("drain",Ot),_.removeListener("error",Bt),_.removeListener("unpipe",Z),z.removeListener("end",kt),z.removeListener("end",u),z.removeListener("data",li),wt=!0,Q.awaitDrain&&(!_._writableState||_._writableState.needDrain)&&Ot()}z.on("data",li);function li(c){f("ondata");var T=_.write(c);f("dest.write",T),T===!1&&((Q.pipesCount===1&&Q.pipes===_||Q.pipesCount>1&&ie(Q.pipes,_)!==-1)&&!wt&&(f("false write response, pause",Q.awaitDrain),Q.awaitDrain++),z.pause())}function Bt(c){f("onerror",c),u(),_.removeListener("error",Bt),n(_,"error")===0&&ae(_,c)}ge(_,"error",Bt);function _r(){_.removeListener("finish",m),u()}_.once("close",_r);function m(){f("onfinish"),_.removeListener("close",_r),u()}_.once("finish",m);function u(){f("unpipe"),z.unpipe(_)}return _.emit("pipe",z),Q.flowing||(f("pipe resume"),z.resume()),_};function D(_){return function(){var z=_._readableState;f("pipeOnDrain",z.awaitDrain),z.awaitDrain&&z.awaitDrain--,z.awaitDrain===0&&n(_,"data")&&(z.flowing=!0,A(_))}}re.prototype.unpipe=function(_){var x=this._readableState,z={hasUnpiped:!1};if(x.pipesCount===0)return this;if(x.pipesCount===1)return _&&_!==x.pipes?this:(_||(_=x.pipes),x.pipes=null,x.pipesCount=0,x.flowing=!1,_&&_.emit("unpipe",this,z),this);if(!_){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 Z=ie(x.pipes,_);return Z===-1?this:(x.pipes.splice(Z,1),x.pipesCount-=1,x.pipesCount===1&&(x.pipes=x.pipes[0]),_.emit("unpipe",this,z),this)},re.prototype.on=function(_,x){var z=r.prototype.on.call(this,_,x),Q=this._readableState;return _==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):_==="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},re.prototype.addListener=re.prototype.on,re.prototype.removeListener=function(_,x){var z=r.prototype.removeListener.call(this,_,x);return _==="readable"&&t.nextTick(j,this),z},re.prototype.removeAllListeners=function(_){var x=r.prototype.removeAllListeners.apply(this,arguments);return(_==="readable"||_===void 0)&&t.nextTick(j,this),x};function j(_){var x=_._readableState;x.readableListening=_.listenerCount("readable")>0,x.resumeScheduled&&!x.paused?x.flowing=!0:_.listenerCount("data")>0&&_.resume()}function F(_){f("readable nexttick read 0"),_.read(0)}re.prototype.resume=function(){var _=this._readableState;return _.flowing||(f("resume"),_.flowing=!_.readableListening,de(this,_)),_.paused=!1,this};function de(_,x){x.resumeScheduled||(x.resumeScheduled=!0,t.nextTick(Te,_,x))}function Te(_,x){f("resume",x.reading),x.reading||_.read(0),x.resumeScheduled=!1,_.emit("resume"),A(_),x.flowing&&!x.reading&&_.read(0)}re.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 A(_){var x=_._readableState;for(f("flow",x.flowing);x.flowing&&_.read()!==null;);}re.prototype.wrap=function(_){var x=this,z=this._readableState,Q=!1;_.on("end",function(){if(f("wrapped end"),z.decoder&&!z.ended){var Z=z.decoder.end();Z&&Z.length&&x.push(Z)}x.push(null)}),_.on("data",function(Z){if(f("wrapped data"),z.decoder&&(Z=z.decoder.write(Z)),!(z.objectMode&&Z==null)&&!(!z.objectMode&&(!Z||!Z.length))){var kt=x.push(Z);kt||(Q=!0,_.pause())}});for(var Me in _)this[Me]===void 0&&typeof _[Me]=="function"&&(this[Me]=function(kt){return function(){return _[kt].apply(_,arguments)}}(Me));for(var _e=0;_e<ee.length;_e++)_.on(ee[_e],this.emit.bind(this,ee[_e]));return this._read=function(Z){f("wrapped _read",Z),Q&&(Q=!1,_.resume())},this},typeof Symbol=="function"&&(re.prototype[Symbol.asyncIterator]=function(){return H===void 0&&(H=vk()),H(this)}),Object.defineProperty(re.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(re.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(re.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(x){this._readableState&&(this._readableState.flowing=x)}}),re._fromList=k,Object.defineProperty(re.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function k(_,x){if(x.length===0)return null;var z;return x.objectMode?z=x.buffer.shift():!_||_>=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(_,x.decoder),z}function $(_){var x=_._readableState;f("endReadable",x.endEmitted),x.endEmitted||(x.ended=!0,t.nextTick(X,x,_))}function X(_,x){if(f("endReadableNT",_.endEmitted,_.length),!_.endEmitted&&_.length===0&&(_.endEmitted=!0,x.readable=!1,x.emit("end"),_.autoDestroy)){var z=x._writableState;(!z||z.autoDestroy&&z.finished)&&x.destroy()}}typeof Symbol=="function"&&(re.from=function(_,x){return K===void 0&&(K=Tk()),K(re,_,x)});function ie(_,x){for(var z=0,Q=_.length;z<Q;z++)if(_[z]===x)return z;return-1}return Ws}function Ah(){if(yh)return zs;yh=!0,zs=o;var t=mr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=t.ERR_TRANSFORM_WITH_LENGTH_0,s=yr();Mt()(o,s);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 w=this._readableState;w.reading=!1,(w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}function o(p){if(!(this instanceof o))return new o(p);s.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)}o.prototype.push=function(p,y){return this._transformState.needTransform=!1,s.prototype.push.call(this,p,y)},o.prototype._transform=function(p,y,g){g(new e("_transform()"))},o.prototype._write=function(p,y,g){var h=this._transformState;if(h.writecb=g,h.writechunk=p,h.writeencoding=y,!h.transforming){var w=this._readableState;(h.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},o.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},o.prototype._destroy=function(p,y){s.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 a;if(p._transformState.transforming)throw new r;return p.push(null)}return zs}function _k(){if(mh)return qs;mh=!0,qs=e;var t=Ah();Mt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,a){a(null,n)},qs}function bk(){if(hh)return Gs;hh=!0;var t;function e(g){var h=!1;return function(){h||(h=!0,g.apply(void 0,arguments))}}var n=mr().codes,r=n.ERR_MISSING_ARGS,a=n.ERR_STREAM_DESTROYED;function s(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function o(g,h,w,P){P=e(P);var B=!1;g.on("close",function(){B=!0}),t===void 0&&(t=Qs()),t(g,{readable:h,writable:w},function(S){if(S)return P(S);B=!0,P()});var v=!1;return function(S){if(!B&&!v){if(v=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();P(S||new a("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"?s:g.pop()}function y(){for(var g=arguments.length,h=new Array(g),w=0;w<g;w++)h[w]=arguments[w];var P=p(h);if(Array.isArray(h[0])&&(h=h[0]),h.length<2)throw new r("streams");var B,v=h.map(function(S,E){var H=E<h.length-1,K=E>0;return o(S,H,K,function(ae){B||(B=ae),ae&&v.forEach(l),!H&&(v.forEach(l),P(B))})});return h.reduce(f)}return Gs=y,Gs}function Ch(){return vh||(vh=!0,bt=bt=Ih(),bt.Stream=bt,bt.Readable=bt,bt.Writable=kh(),bt.Duplex=yr(),bt.Transform=Ah(),bt.PassThrough=_k(),bt.finished=Qs(),bt.pipeline=bk()),bt}function Oh(){if(Th)return Fa;Th=!0;var t=Rt().Buffer,e=At,n=Ph(),r=Mt(),a=Ch(),s=Fa.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=Fa.IncomingMessage=function(o,l,f,p){var y=this||Wa;if(a.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 v=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)),v()}}).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();v()}else{y._xhr=o,y._pos=0,y.url=o.responseURL,y.statusCode=o.status,y.statusMessage=o.statusText;var w=o.getAllResponseHeaders().split(/\r?\n/);if(w.forEach(function(v){var S=v.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,a.Readable),i.prototype._read=function(){var o=this||Wa,l=o._resumeFetch;l&&(o._resumeFetch=null,l())},i.prototype._onXHRProgress=function(o){var l=this||Wa,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!==s.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!==s.LOADING||!p)break;l.push(t.from(new Uint8Array(p)));break;case"ms-stream":if(p=f.response,f.readyState!==s.LOADING)break;var w=new Wa.MSStreamReader;w.onprogress=function(){w.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(w.result.slice(l._pos)))),l._pos=w.result.byteLength)},w.onload=function(){o(!0),l.push(null)},w.readAsArrayBuffer(p);break}l._xhr.readyState===s.DONE&&l._mode!=="ms-stream"&&(o(!0),l.push(null))},Fa}function wk(){if(_h)return Vs;_h=!0;var t=Rt().Buffer,e=At,n=Ph(),r=Mt(),a=Oh(),s=Ch(),i=a.IncomingMessage,o=a.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=Vs=function(g){var h=this||at;s.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 w,P=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)P=!1,w=!0;else if(g.mode==="prefer-streaming")w=!1;else if(g.mode==="allow-wrong-content-type")w=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")w=!0;else throw new Error("Invalid value for opts.mode");h._mode=l(w,P),h._fetchTimer=null,h._socketTimeout=null,h._socketTimer=null,h.on("finish",function(){h._onFinish()})};r(f,s.Writable),f.prototype.setHeader=function(g,h){var w=this||at,P=g.toLowerCase();y.indexOf(P)===-1&&(w._headers[P]={name:g,value:h})},f.prototype.getHeader=function(g){var h=(this||at)._headers[g.toLowerCase()];return h?h.value:null},f.prototype.removeHeader=function(g){var h=this||at;delete h._headers[g.toLowerCase()]},f.prototype._onFinish=function(){var g=this||at;if(!g._destroyed){var h=g._opts;"timeout"in h&&h.timeout!==0&&g.setTimeout(h.timeout);var w=g._headers,P=null;h.method!=="GET"&&h.method!=="HEAD"&&(P=new Blob(g._body,{type:(w["content-type"]||{}).value||""}));var B=[];if(Object.keys(w).forEach(function(H){var K=w[H].name,ae=w[H].value;Array.isArray(ae)?ae.forEach(function(ee){B.push([K,ee])}):B.push([K,ae])}),g._mode==="fetch"){var v=null;if(n.abortController){var S=new AbortController;v=S.signal,g._fetchAbortController=S,"requestTimeout"in h&&h.requestTimeout!==0&&(g._fetchTimer=at.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},h.requestTimeout))}at.fetch(g._opts.url,{method:g._opts.method,headers:B,body:P||void 0,mode:"cors",credentials:h.withCredentials?"include":"same-origin",signal:v}).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 at.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 o.LOADING:case o.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||at;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||at;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,w){var P=this||at;P._body.push(g),w()},f.prototype._resetTimers=function(g){var h=this||at;at.clearTimeout(h._socketTimer),h._socketTimer=null,g?(at.clearTimeout(h._fetchTimer),h._fetchTimer=null):h._socketTimeout&&(h._socketTimer=at.setTimeout(function(){h.emit("timeout")},h._socketTimeout))},f.prototype.abort=f.prototype.destroy=function(g){var h=this||at;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,w){var P=this||at;typeof g=="function"&&(w=g,g=void 0),s.Writable.prototype.end.call(P,g,h,w)},f.prototype.setTimeout=function(g,h){var w=this||at;h&&w.once("timeout",h),w._socketTimeout=g,w._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 Vs}function xk(){if(bh)return Js;bh=!0,Js=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var a=arguments[r];for(var s in a)t.call(a,s)&&(n[s]=a[s])}return n}return Js}function Pk(){return wh||(wh=!0,Xs={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"}),Xs}function Ek(){if(xh)return Ys;xh=!0;var t=wk(),e=Oh(),n=xk(),r=Pk(),a=De,s=Ys;return s.request=function(i,o){typeof i=="string"?i=a.parse(i):i=n(i);var l=Bk.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 o&&h.on("response",o),h},s.get=function(o,l){var f=s.request(o,l);return f.end(),f},s.ClientRequest=t,s.IncomingMessage=e.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=r,s.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"],Ys}var Pt,th,$n,Ns,nh,Ds,rh,Hs,ih,Us,ah,Zs,oh,$s,sh,lh,js,uh,Ks,ch,Ls,fh,Fs,dh,Ws,ph,gh,zs,yh,qs,mh,Gs,hh,bt,vh,Fa,Th,Wa,Vs,_h,at,Js,bh,Xs,wh,Ys,xh,Bk,Yt,Sk,kk,Ik,Ak,Ck,Ok,Rk,Mk,Mh=ot(()=>{C();R();O();is();Vy();as();pi();Cm();Ka();bs();Dm();Zm();eh();Es();Pt={},th=!1,$n=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ns={},nh=!1;Ds={},rh=!1;Hs={},ih=!1;Us={},ah=!1;Zs={},oh=!1;$s={},sh=!1,lh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;js={},uh=!1;Ks={},ch=!1;Ls={},fh=!1;Fs={},dh=!1;Ws={},ph=!1,gh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;zs={},yh=!1;qs={},mh=!1;Gs={},hh=!1;bt={},vh=!1;Fa={},Th=!1,Wa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Vs={},_h=!1,at=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Js={},bh=!1;Xs={},wh=!1;Ys={},xh=!1,Bk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Yt=Ek(),Sk=Yt.Agent,kk=Yt.ClientRequest,Ik=Yt.IncomingMessage,Ak=Yt.METHODS,Ck=Yt.STATUS_CODES,Ok=Yt.get,Rk=Yt.globalAgent,Mk=Yt.request});C();R();O();var Cy={};Wn(Cy,{defaults:()=>MB,markdown:()=>RB});C();R();O();C();R();O();C();R();O();var Bo=Object.defineProperty,Fv=Object.defineProperties,Wv=Object.getOwnPropertyDescriptors,Bi=Object.getOwnPropertySymbols,Xc=Object.prototype.hasOwnProperty,Yc=Object.prototype.propertyIsEnumerable,gc=(t,e,n)=>e in t?Bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))Xc.call(e,n)&&gc(t,n,e[n]);if(Bi)for(var n of Bi(e))Yc.call(e,n)&&gc(t,n,e[n]);return t},N=(t,e)=>Fv(t,Wv(e)),d=(t,e)=>Bo(t,"name",{value:e,configurable:!0}),Qc=(t,e)=>{var n={};for(var r in t)Xc.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Bi)for(var r of Bi(t))e.indexOf(r)<0&&Yc.call(t,r)&&(n[r]=t[r]);return n},oa=(t,e)=>{for(var n in e)Bo(t,n,{get:e[n],enumerable:!0})},zv={};oa(zv,{errors:()=>rf,fromJSONSchema:()=>Vg,fromJSONSchemaLegacy:()=>rB,fromObject:()=>xo,toJSONSchema:()=>st,toJSONSchemaLegacy:()=>IB,toTypescriptSchema:()=>Ho,toTypescriptType:()=>Eo});var Y={};oa(Y,{BRAND:()=>Rx,DIRTY:()=>Xn,EMPTY_PATH:()=>Ix,INVALID:()=>pe,NEVER:()=>RP,OK:()=>pt,ParseInputLazyPath:()=>It,ParseStatus:()=>vt,Schema:()=>he,ZodAny:()=>Fr,ZodArray:()=>Wr,ZodBigInt:()=>jo,ZodBoolean:()=>Ko,ZodBranded:()=>Lo,ZodCatch:()=>Fo,ZodDate:()=>Wo,ZodDefault:()=>ha,ZodDiscriminatedUnion:()=>fg,ZodEffects:()=>En,ZodEnum:()=>or,ZodError:()=>Kt,ZodFirstPartyTypeKind:()=>Yp,ZodFunction:()=>pg,ZodIntersection:()=>qo,ZodIssueCode:()=>G,ZodLazy:()=>Go,ZodLiteral:()=>Vo,ZodMap:()=>yg,ZodNaN:()=>hg,ZodNativeEnum:()=>Jo,ZodNever:()=>Gr,ZodNull:()=>Xo,ZodNullable:()=>tr,ZodNumber:()=>Yo,ZodObject:()=>nr,ZodOptional:()=>an,ZodParsedType:()=>ne,ZodPipeline:()=>Qo,ZodPromise:()=>Ta,ZodReadonly:()=>_a,ZodRecord:()=>Pg,ZodRef:()=>Eg,ZodSchema:()=>he,ZodSet:()=>Sg,ZodString:()=>gt,ZodSymbol:()=>Ug,ZodTransformer:()=>En,ZodTuple:()=>ir,ZodType:()=>he,ZodUndefined:()=>ba,ZodUnion:()=>es,ZodUnknown:()=>Ur,ZodVoid:()=>Kg,addIssueToContext:()=>te,agent:()=>$x,aimodel:()=>Wx,any:()=>nP,array:()=>oP,bigint:()=>Xx,boolean:()=>Wg,coerce:()=>OP,conversation:()=>Hx,createZodEnum:()=>va,cuid2Regex:()=>Ig,cuidRegex:()=>kg,custom:()=>ug,datasource:()=>zx,date:()=>Yx,default:()=>EP,discriminatedUnion:()=>cP,effect:()=>Gc,emailRegex:()=>Og,enum:()=>bP,errorUtil:()=>ue,event:()=>jx,function:()=>vP,getErrorMap:()=>Kr,getParsedType:()=>rn,instanceof:()=>Vx,intent:()=>Fx,intersection:()=>fP,ipv4Regex:()=>Mg,ipv6Regex:()=>Ng,isAborted:()=>_o,isAsync:()=>ki,isDirty:()=>bo,isEmojiRegex:()=>Mx,isValid:()=>Lr,knowledgebase:()=>qx,late:()=>Gx,lazy:()=>TP,literal:()=>_P,makeIssue:()=>Si,map:()=>mP,message:()=>Zx,nan:()=>Jx,nativeEnum:()=>wP,never:()=>iP,null:()=>tP,nullable:()=>BP,number:()=>Fg,object:()=>sP,objectUtil:()=>To,oboolean:()=>CP,onumber:()=>AP,optional:()=>PP,ostring:()=>IP,pipeline:()=>kP,preprocess:()=>SP,processCreateParams:()=>me,promise:()=>xP,quotelessJson:()=>kx,readonly:()=>yP,record:()=>pP,ref:()=>gP,set:()=>hP,setErrorMap:()=>tg,strictObject:()=>lP,string:()=>Lg,symbol:()=>Qx,table:()=>Kx,tablerow:()=>Lx,transformer:()=>Gc,tuple:()=>dP,ulidRegex:()=>Ag,undefined:()=>eP,union:()=>uP,unknown:()=>rP,user:()=>Ux,util:()=>be,uuidRegex:()=>Cg,variable:()=>Dx,void:()=>aP});var le="x-zui";function ef(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:se(t)}d(ef,"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()})`:JSON.stringify(t)}d(se,"primitiveToTypescriptValue");function Yn(t){return typeof t>"u"?"undefined":JSON.stringify(t)}d(Yn,"unknownToTypescriptValue");var tf=d((t,e)=>{let n=Object.entries(t),r=e?" as const":"";return`{ ${n.map(([a,s])=>`${uo(a)}: ${Yn(s)}`).join(", ")} }${r}`},"recordOfUnknownToTypescriptRecord"),uo=d(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:se(t),"toPropertyKey"),qv=d(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),nf=d(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(qv).filter(r=>!!r).join("")},"toTypeArgumentName"),nt=d(t=>{let e=(t??"").split(`
14
14
  `).filter(n=>n.trim().length>0);return e.length===0?"":e.length===1?`/** ${e[0]} */`:`/**
15
15
  * ${e.join(`
16
16
  * `)}
17
- */`},"getMultilineComment"),rf={};oa(rf,{JSONSchemaToZuiError:()=>sa,ObjectToZuiError:()=>co,UnrepresentableGenericError:()=>fo,UnsupportedJSONSchemaToZuiError:()=>nn,UnsupportedZuiCheckToJSONSchemaError:()=>ff,UnsupportedZuiToJSONSchemaError:()=>dt,UnsupportedZuiToTypescriptSchemaError:()=>vn,UnsupportedZuiToTypescriptTypeError:()=>vf,UntitledDeclarationError:()=>_f,ZuiToJSONSchemaError:()=>la,ZuiToTypescriptSchemaError:()=>gf,ZuiToTypescriptTypeError:()=>ua,ZuiTransformError:()=>ir});var af=class extends Error{constructor(e,n){super(n),this.transform=e}};d(af,"ZuiTransformError");var ir=af,of=class extends ir{constructor(e){super("json-schema-to-zui",e)}};d(of,"JSONSchemaToZuiError");var sa=of,sf=class extends ir{constructor(e){super("object-to-zui",e)}};d(sf,"ObjectToZuiError");var co=sf,lf=class extends ir{constructor(e){super("zui-to-json-schema",e)}};d(lf,"ZuiToJSONSchemaError");var la=lf,uf=class extends la{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};d(uf,"UnsupportedZuiToJSONSchemaError");var dt=uf,cf=class extends la{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};d(cf,"UnsupportedZuiCheckToJSONSchemaError");var ff=cf,df=class extends sa{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};d(df,"UnsupportedJSONSchemaToZuiError");var nn=df,pf=class extends ir{constructor(e){super("zui-to-typescript-schema",e)}};d(pf,"ZuiToTypescriptSchemaError");var gf=pf,yf=class extends gf{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};d(yf,"UnsupportedZuiToTypescriptSchemaError");var vn=yf,mf=class extends ir{constructor(e){super("zui-to-typescript-type",e)}};d(mf,"ZuiToTypescriptTypeError");var ua=mf,hf=class extends ua{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};d(hf,"UnsupportedZuiToTypescriptTypeError");var vf=hf,Tf=class extends ua{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};d(Tf,"UntitledDeclarationError");var _f=Tf,bf=class extends ua{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};d(bf,"UnrepresentableGenericError");var fo=bf,wf=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],Gv=d(t=>wf.includes(t),"isPrimitive"),Vv=d(t=>wf.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),yc=d(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),xf=class{constructor(e,n,r=!1){this.key=e,this.value=n,this.optional=r}};d(xf,"KeyValue");var gi=xf,Pf=class{constructor(e){this.schema=e}};d(Pf,"FnParameters");var mc=Pf,Bf=class{constructor(e){this.schema=e}};d(Bf,"FnReturn");var hc=Bf,Ef=class{constructor(e){this.props=e}};d(Ef,"Declaration");var mi=Ef;function Eo(t,e={}){let n=Yv(t,e),r=ke(n,{});return e.formatter&&(r=e.formatter(r)),r}d(Eo,"toTypescriptType");function ke(t,e){var n,r,a;let s=N(b({},e),{parent:t});if(t===null)return"";if(t instanceof mi)return Jv(t,s);if(t instanceof gi){if(t.value instanceof M.ZodOptional){let h=t.value._def.innerType;return ke(new gi(t.key,h,!0),s)}let l=nt(t.value.description),f=l?.trim().length>0?`
17
+ */`},"getMultilineComment"),rf={};oa(rf,{JSONSchemaToZuiError:()=>sa,ObjectToZuiError:()=>co,UnrepresentableGenericError:()=>fo,UnsupportedJSONSchemaToZuiError:()=>nn,UnsupportedZuiCheckToJSONSchemaError:()=>ff,UnsupportedZuiToJSONSchemaError:()=>dt,UnsupportedZuiToTypescriptSchemaError:()=>Tn,UnsupportedZuiToTypescriptTypeError:()=>vf,UntitledDeclarationError:()=>_f,ZuiToJSONSchemaError:()=>la,ZuiToTypescriptSchemaError:()=>gf,ZuiToTypescriptTypeError:()=>ua,ZuiTransformError:()=>ar});var af=class extends Error{constructor(e,n){super(n),this.transform=e}};d(af,"ZuiTransformError");var ar=af,of=class extends ar{constructor(e){super("json-schema-to-zui",e)}};d(of,"JSONSchemaToZuiError");var sa=of,sf=class extends ar{constructor(e){super("object-to-zui",e)}};d(sf,"ObjectToZuiError");var co=sf,lf=class extends ar{constructor(e){super("zui-to-json-schema",e)}};d(lf,"ZuiToJSONSchemaError");var la=lf,uf=class extends la{constructor(e,{suggestedAlternative:n}={}){super(`Zod type ${e} cannot be transformed to JSON Schema.`+(n?` Suggested alternative: ${n}`:""))}};d(uf,"UnsupportedZuiToJSONSchemaError");var dt=uf,cf=class extends la{constructor({zodType:e,checkKind:n}){super(`Zod check .${n}() of type ${e} cannot be transformed to JSON Schema.`)}};d(cf,"UnsupportedZuiCheckToJSONSchemaError");var ff=cf,df=class extends sa{constructor(e){super(`JSON Schema ${JSON.stringify(e)} cannot be transformed to ZUI type.`)}};d(df,"UnsupportedJSONSchemaToZuiError");var nn=df,pf=class extends ar{constructor(e){super("zui-to-typescript-schema",e)}};d(pf,"ZuiToTypescriptSchemaError");var gf=pf,yf=class extends gf{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript schema.`)}};d(yf,"UnsupportedZuiToTypescriptSchemaError");var Tn=yf,mf=class extends ar{constructor(e){super("zui-to-typescript-type",e)}};d(mf,"ZuiToTypescriptTypeError");var ua=mf,hf=class extends ua{constructor(e){super(`Zod type ${e} cannot be transformed to TypeScript type.`)}};d(hf,"UnsupportedZuiToTypescriptTypeError");var vf=hf,Tf=class extends ua{constructor(){super("Schema must have a title to be transformed to a TypeScript type with a declaration.")}};d(Tf,"UntitledDeclarationError");var _f=Tf,bf=class extends ua{constructor(){super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.')}};d(bf,"UnrepresentableGenericError");var fo=bf,wf=["string","number","boolean","unknown","void","any","null","undefined","never","bigint","symbol","object"],Gv=d(t=>wf.includes(t),"isPrimitive"),Vv=d(t=>wf.map(e=>`${e}[]`).includes(t),"isArrayOfPrimitives"),yc=d(t=>t.replace(/ +/g," ").trim(),"stripSpaces"),xf=class{constructor(e,n,r=!1){this.key=e,this.value=n,this.optional=r}};d(xf,"KeyValue");var gi=xf,Pf=class{constructor(e){this.schema=e}};d(Pf,"FnParameters");var mc=Pf,Bf=class{constructor(e){this.schema=e}};d(Bf,"FnReturn");var hc=Bf,Ef=class{constructor(e){this.props=e}};d(Ef,"Declaration");var mi=Ef;function Eo(t,e={}){let n=Yv(t,e),r=ke(n,{});return e.formatter&&(r=e.formatter(r)),r}d(Eo,"toTypescriptType");function ke(t,e){var n,r,a;let s=N(b({},e),{parent:t});if(t===null)return"";if(t instanceof mi)return Jv(t,s);if(t instanceof gi){if(t.value instanceof M.ZodOptional){let h=t.value._def.innerType;return ke(new gi(t.key,h,!0),s)}let l=nt(t.value.description),f=l?.trim().length>0?`
18
18
  `:"",p=t.value.describe(""),g=t.optional||t.value.isOptional()?"?":"";return`${f}${l}${f}${t.key}${g}: ${ke(p,s)}${f}`}if(t instanceof mc){if(t.schema instanceof M.ZodTuple){let p="";for(let y=0;y<t.schema.items.length;y++){let g=(a=(r=(n=t.schema.items[y])==null?void 0:n.ui)==null?void 0:r.title)!=null?a:`arg${y}`,h=t.schema.items[y];p+=`${ke(new gi(uo(g),h),s)}${y<t.schema.items.length-1?", ":""} `}return p}let l=ke(t.schema,s);return l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]")||l.startsWith("(")&&l.endsWith(")")||l.startsWith("Array<")&&l.endsWith(">")||l.startsWith("Record<")&&l.endsWith(">")||Vv(l)?`args: ${l}`:l}if(t instanceof hc)return t.schema instanceof M.ZodOptional?`${ke(t.schema.unwrap(),s)} | undefined`:ke(t.schema,s);let i=t,o=i._def;switch(o.typeName){case M.ZodFirstPartyTypeKind.ZodString:return`${nt(i.description)} string`.trim();case M.ZodFirstPartyTypeKind.ZodNumber:case M.ZodFirstPartyTypeKind.ZodNaN:case M.ZodFirstPartyTypeKind.ZodBigInt:return`${nt(i.description)} number`.trim();case M.ZodFirstPartyTypeKind.ZodBoolean:return`${nt(i.description)} boolean`.trim();case M.ZodFirstPartyTypeKind.ZodDate:return`${nt(i.description)} Date`.trim();case M.ZodFirstPartyTypeKind.ZodUndefined:return`${nt(i.description)} undefined`.trim();case M.ZodFirstPartyTypeKind.ZodNull:return`${nt(i.description)} null`.trim();case M.ZodFirstPartyTypeKind.ZodAny:return`${nt(i.description)} any`.trim();case M.ZodFirstPartyTypeKind.ZodUnknown:return`${nt(i.description)} unknown`.trim();case M.ZodFirstPartyTypeKind.ZodNever:return`${nt(i.description)} never`.trim();case M.ZodFirstPartyTypeKind.ZodVoid:return`${nt(i.description)} void`.trim();case M.ZodFirstPartyTypeKind.ZodArray:let l=ke(o.type,s);return Gv(l)?`${l}[]`:`Array<${l}>`;case M.ZodFirstPartyTypeKind.ZodObject:return`{ ${Object.entries(o.shape()).map(([E,H])=>ke(new gi(uo(E),H),s)).join("; ")} }`;case M.ZodFirstPartyTypeKind.ZodUnion:let p=o.options.map(E=>ke(E,s));return`${nt(i.description)}
19
19
  ${p.join(" | ")}`;case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let y=o.options.map(E=>ke(E,s));return`${nt(i.description)}
20
20
  ${y.join(" | ")}`;case M.ZodFirstPartyTypeKind.ZodIntersection:return`${ke(o.left,s)} & ${ke(o.right,s)}`;case M.ZodFirstPartyTypeKind.ZodTuple:return o.items.length===0?"":`[${o.items.map(E=>ke(E,s)).join(", ")}]`;case M.ZodFirstPartyTypeKind.ZodRecord:let h=ke(o.keyType,s),w=ke(o.valueType,s);return`${nt(i.description)} { [key: ${h}]: ${w} }`;case M.ZodFirstPartyTypeKind.ZodMap:return`Map<${ke(o.keyType,s)}, ${ke(o.valueType,s)}>`;case M.ZodFirstPartyTypeKind.ZodSet:return`Set<${ke(o.valueType,s)}>`;case M.ZodFirstPartyTypeKind.ZodFunction:let P=ke(new mc(o.args),s),B=ke(new hc(o.returns),s);return`${nt(i.description)}
21
21
  (${P}) => ${B}`;case M.ZodFirstPartyTypeKind.ZodLazy:return ke(o.getter(),s);case M.ZodFirstPartyTypeKind.ZodLiteral:let v=ef(o.value);return`${nt(i.description)}
22
- ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(se).join(" | ");case M.ZodFirstPartyTypeKind.ZodEffects:return ke(o.schema,s);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new vf(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return`${ke(o.innerType,s)} | undefined`;case M.ZodFirstPartyTypeKind.ZodNullable:return`${ke(o.innerType,s)} | null`;case M.ZodFirstPartyTypeKind.ZodDefault:return ke(o.innerType,s);case M.ZodFirstPartyTypeKind.ZodCatch:return ke(o.innerType,s);case M.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${ke(o.type,s)}>`;case M.ZodFirstPartyTypeKind.ZodBranded:return ke(o.type,s);case M.ZodFirstPartyTypeKind.ZodPipeline:return ke(o.in,s);case M.ZodFirstPartyTypeKind.ZodSymbol:return`${nt(i.description)} symbol`.trim();case M.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${ke(o.innerType,s)}>`;case M.ZodFirstPartyTypeKind.ZodRef:return nf(o.uri);default:be.assertNever(o)}}d(ke,"sUnwrapZod");var Jv=d((t,e)=>{if(t.props.type==="none")return ke(t.props.schema,e);let n=nt(t.props.schema.description),r=t.props.schema.describe(""),a=ke(r,e);if(t.props.type==="variable")return yc(`${n}declare const ${t.props.identifier}: ${a};`);let s=t.props.args.length>0?`<${t.props.args.map(nf).join(", ")}>`:"";return yc(`${n}type ${t.props.identifier}${s} = ${a};`)},"unwrapDeclaration"),Xv=d(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),Yv=d((t,e)=>{let n=Xv(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new fo;return new mi({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new _f;if(n==="variable"){if(r.length>0)throw new fo;return new mi({type:"variable",identifier:a,schema:t})}return new mi({type:"type",identifier:a,schema:t,args:r})},"getDeclarationProps"),Qv=typeof global=="object"&&global&&global.Object===Object&&global,Sf=Qv,eT=typeof self=="object"&&self&&self.Object===Object&&self,tT=Sf||eT||Function("return this")(),Ft=tT,nT=Ft.Symbol,on=nT,kf=Object.prototype,rT=kf.hasOwnProperty,iT=kf.toString,wr=on?on.toStringTag:void 0;function If(t){var e=rT.call(t,wr),n=t[wr];try{t[wr]=void 0;var r=!0}catch{}var a=iT.call(t);return r&&(e?t[wr]=n:delete t[wr]),a}d(If,"getRawTag");var aT=If,oT=Object.prototype,sT=oT.toString;function Af(t){return sT.call(t)}d(Af,"objectToString");var lT=Af,uT="[object Null]",cT="[object Undefined]",vc=on?on.toStringTag:void 0;function Cf(t){return t==null?t===void 0?cT:uT:vc&&vc in Object(t)?aT(t):lT(t)}d(Cf,"baseGetTag");var En=Cf;function Of(t){return t!=null&&typeof t=="object"}d(Of,"isObjectLike");var Pn=Of,fT="[object Symbol]";function Rf(t){return typeof t=="symbol"||Pn(t)&&En(t)==fT}d(Rf,"isSymbol");var So=Rf;function Mf(t,e){for(var n=-1,r=t==null?0:t.length,a=Array(r);++n<r;)a[n]=e(t[n],n,t);return a}d(Mf,"arrayMap");var Nf=Mf,dT=Array.isArray,Lt=dT,pT=1/0,Tc=on?on.prototype:void 0,_c=Tc?Tc.toString:void 0;function ko(t){if(typeof t=="string")return t;if(Lt(t))return Nf(t,ko)+"";if(So(t))return _c?_c.call(t):"";var e=t+"";return e=="0"&&1/t==-pT?"-0":e}d(ko,"baseToString");var gT=ko;function Df(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}d(Df,"isObject");var Qn=Df;function Hf(t){return t}d(Hf,"identity");var yT=Hf,mT="[object AsyncFunction]",hT="[object Function]",vT="[object GeneratorFunction]",TT="[object Proxy]";function Uf(t){if(!Qn(t))return!1;var e=En(t);return e==hT||e==vT||e==mT||e==TT}d(Uf,"isFunction");var $f=Uf,_T=Ft["__core-js_shared__"],ro=_T,bc=function(){var t=/[^.]+$/.exec(ro&&ro.keys&&ro.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Zf(t){return!!bc&&bc in t}d(Zf,"isMasked");var bT=Zf,wT=Function.prototype,xT=wT.toString;function jf(t){if(t!=null){try{return xT.call(t)}catch{}try{return t+""}catch{}}return""}d(jf,"toSource");var Sn=jf,PT=/[\\^$.*+?()[\]{}|]/g,BT=/^\[object .+?Constructor\]$/,ET=Function.prototype,ST=Object.prototype,kT=ET.toString,IT=ST.hasOwnProperty,AT=RegExp("^"+kT.call(IT).replace(PT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(t){if(!Qn(t)||bT(t))return!1;var e=$f(t)?AT:BT;return e.test(Sn(t))}d(Kf,"baseIsNative");var CT=Kf;function Lf(t,e){return t?.[e]}d(Lf,"getValue");var OT=Lf;function Ff(t,e){var n=OT(t,e);return CT(n)?n:void 0}d(Ff,"getNative");var kn=Ff,RT=kn(Ft,"WeakMap"),po=RT,MT=function(){try{var t=kn(Object,"defineProperty");return t({},"",{}),t}catch{}}(),wc=MT,NT=9007199254740991,DT=/^(?:0|[1-9]\d*)$/;function Wf(t,e){var n=typeof t;return e=e??NT,!!e&&(n=="number"||n!="symbol"&&DT.test(t))&&t>-1&&t%1==0&&t<e}d(Wf,"isIndex");var Io=Wf;function zf(t,e,n){e=="__proto__"&&wc?wc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}d(zf,"baseAssignValue");var qf=zf;function Gf(t,e){return t===e||t!==t&&e!==e}d(Gf,"eq");var Ao=Gf,HT=Object.prototype,UT=HT.hasOwnProperty;function Vf(t,e,n){var r=t[e];(!(UT.call(t,e)&&Ao(r,n))||n===void 0&&!(e in t))&&qf(t,e,n)}d(Vf,"assignValue");var $T=Vf,ZT=9007199254740991;function Jf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ZT}d(Jf,"isLength");var Co=Jf;function Xf(t){return t!=null&&Co(t.length)&&!$f(t)}d(Xf,"isArrayLike");var Yf=Xf,jT=Object.prototype;function Qf(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||jT;return t===n}d(Qf,"isPrototype");var ed=Qf;function td(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}d(td,"baseTimes");var KT=td,LT="[object Arguments]";function nd(t){return Pn(t)&&En(t)==LT}d(nd,"baseIsArguments");var xc=nd,rd=Object.prototype,FT=rd.hasOwnProperty,WT=rd.propertyIsEnumerable,zT=xc(function(){return arguments}())?xc:function(t){return Pn(t)&&FT.call(t,"callee")&&!WT.call(t,"callee")},id=zT;function ad(){return!1}d(ad,"stubFalse");var qT=ad,od=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pc=od&&typeof module=="object"&&module&&!module.nodeType&&module,GT=Pc&&Pc.exports===od,Bc=GT?Ft.Buffer:void 0,VT=Bc?Bc.isBuffer:void 0,JT=VT||qT,go=JT,XT="[object Arguments]",YT="[object Array]",QT="[object Boolean]",e_="[object Date]",t_="[object Error]",n_="[object Function]",r_="[object Map]",i_="[object Number]",a_="[object Object]",o_="[object RegExp]",s_="[object Set]",l_="[object String]",u_="[object WeakMap]",c_="[object ArrayBuffer]",f_="[object DataView]",d_="[object Float32Array]",p_="[object Float64Array]",g_="[object Int8Array]",y_="[object Int16Array]",m_="[object Int32Array]",h_="[object Uint8Array]",v_="[object Uint8ClampedArray]",T_="[object Uint16Array]",__="[object Uint32Array]",$e={};$e[d_]=$e[p_]=$e[g_]=$e[y_]=$e[m_]=$e[h_]=$e[v_]=$e[T_]=$e[__]=!0;$e[XT]=$e[YT]=$e[c_]=$e[QT]=$e[f_]=$e[e_]=$e[t_]=$e[n_]=$e[r_]=$e[i_]=$e[a_]=$e[o_]=$e[s_]=$e[l_]=$e[u_]=!1;function sd(t){return Pn(t)&&Co(t.length)&&!!$e[En(t)]}d(sd,"baseIsTypedArray");var b_=sd;function ld(t){return function(e){return t(e)}}d(ld,"baseUnary");var w_=ld,ud=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dr=ud&&typeof module=="object"&&module&&!module.nodeType&&module,x_=Dr&&Dr.exports===ud,io=x_&&Sf.process,P_=function(){try{var t=Dr&&Dr.require&&Dr.require("util").types;return t||io&&io.binding&&io.binding("util")}catch{}}(),Ec=P_,Sc=Ec&&Ec.isTypedArray,B_=Sc?w_(Sc):b_,cd=B_,E_=Object.prototype,S_=E_.hasOwnProperty;function fd(t,e){var n=Lt(t),r=!n&&id(t),a=!n&&!r&&go(t),s=!n&&!r&&!a&&cd(t),i=n||r||a||s,o=i?KT(t.length,String):[],l=o.length;for(var f in t)(e||S_.call(t,f))&&!(i&&(f=="length"||a&&(f=="offset"||f=="parent")||s&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Io(f,l)))&&o.push(f);return o}d(fd,"arrayLikeKeys");var dd=fd;function pd(t,e){return function(n){return t(e(n))}}d(pd,"overArg");var gd=pd,k_=gd(Object.keys,Object),I_=k_,A_=Object.prototype,C_=A_.hasOwnProperty;function yd(t){if(!ed(t))return I_(t);var e=[];for(var n in Object(t))C_.call(t,n)&&n!="constructor"&&e.push(n);return e}d(yd,"baseKeys");var O_=yd;function md(t){return Yf(t)?dd(t):O_(t)}d(md,"keys");var Oo=md;function hd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}d(hd,"nativeKeysIn");var R_=hd,M_=Object.prototype,N_=M_.hasOwnProperty;function vd(t){if(!Qn(t))return R_(t);var e=ed(t),n=[];for(var r in t)r=="constructor"&&(e||!N_.call(t,r))||n.push(r);return n}d(vd,"baseKeysIn");var D_=vd;function Td(t){return Yf(t)?dd(t,!0):D_(t)}d(Td,"keysIn");var H_=Td,U_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$_=/^\w*$/;function _d(t,e){if(Lt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||So(t)?!0:$_.test(t)||!U_.test(t)||e!=null&&t in Object(e)}d(_d,"isKey");var Ro=_d,Z_=kn(Object,"create"),$r=Z_;function bd(){this.__data__=$r?$r(null):{},this.size=0}d(bd,"hashClear");var j_=bd;function wd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}d(wd,"hashDelete");var K_=wd,L_="__lodash_hash_undefined__",F_=Object.prototype,W_=F_.hasOwnProperty;function xd(t){var e=this.__data__;if($r){var n=e[t];return n===L_?void 0:n}return W_.call(e,t)?e[t]:void 0}d(xd,"hashGet");var z_=xd,q_=Object.prototype,G_=q_.hasOwnProperty;function Pd(t){var e=this.__data__;return $r?e[t]!==void 0:G_.call(e,t)}d(Pd,"hashHas");var V_=Pd,J_="__lodash_hash_undefined__";function Bd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=$r&&e===void 0?J_:e,this}d(Bd,"hashSet");var X_=Bd;function In(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(In,"Hash");In.prototype.clear=j_;In.prototype.delete=K_;In.prototype.get=z_;In.prototype.has=V_;In.prototype.set=X_;var kc=In;function Ed(){this.__data__=[],this.size=0}d(Ed,"listCacheClear");var Y_=Ed;function Sd(t,e){for(var n=t.length;n--;)if(Ao(t[n][0],e))return n;return-1}d(Sd,"assocIndexOf");var ca=Sd,Q_=Array.prototype,eb=Q_.splice;function kd(t){var e=this.__data__,n=ca(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():eb.call(e,n,1),--this.size,!0}d(kd,"listCacheDelete");var tb=kd;function Id(t){var e=this.__data__,n=ca(e,t);return n<0?void 0:e[n][1]}d(Id,"listCacheGet");var nb=Id;function Ad(t){return ca(this.__data__,t)>-1}d(Ad,"listCacheHas");var rb=Ad;function Cd(t,e){var n=this.__data__,r=ca(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}d(Cd,"listCacheSet");var ib=Cd;function An(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(An,"ListCache");An.prototype.clear=Y_;An.prototype.delete=tb;An.prototype.get=nb;An.prototype.has=rb;An.prototype.set=ib;var fa=An,ab=kn(Ft,"Map"),Zr=ab;function Od(){this.size=0,this.__data__={hash:new kc,map:new(Zr||fa),string:new kc}}d(Od,"mapCacheClear");var ob=Od;function Rd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}d(Rd,"isKeyable");var sb=Rd;function Md(t,e){var n=t.__data__;return sb(e)?n[typeof e=="string"?"string":"hash"]:n.map}d(Md,"getMapData");var da=Md;function Nd(t){var e=da(this,t).delete(t);return this.size-=e?1:0,e}d(Nd,"mapCacheDelete");var lb=Nd;function Dd(t){return da(this,t).get(t)}d(Dd,"mapCacheGet");var ub=Dd;function Hd(t){return da(this,t).has(t)}d(Hd,"mapCacheHas");var cb=Hd;function Ud(t,e){var n=da(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}d(Ud,"mapCacheSet");var fb=Ud;function Cn(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(Cn,"MapCache");Cn.prototype.clear=ob;Cn.prototype.delete=lb;Cn.prototype.get=ub;Cn.prototype.has=cb;Cn.prototype.set=fb;var pa=Cn,db="Expected a function";function ga(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(db);var n=d(function(){var r=arguments,a=e?e.apply(this,r):r[0],s=n.cache;if(s.has(a))return s.get(a);var i=t.apply(this,r);return n.cache=s.set(a,i)||s,i},"memoized");return n.cache=new(ga.Cache||pa),n}d(ga,"memoize");ga.Cache=pa;var pb=ga,gb=500;function $d(t){var e=pb(t,function(r){return n.size===gb&&n.clear(),r}),n=e.cache;return e}d($d,"memoizeCapped");var yb=$d,mb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hb=/\\(\\)?/g,vb=yb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(mb,function(n,r,a,s){e.push(a?s.replace(hb,"$1"):r||n)}),e}),Tb=vb;function Zd(t){return t==null?"":gT(t)}d(Zd,"toString");var _b=Zd;function jd(t,e){return Lt(t)?t:Ro(t,e)?[t]:Tb(_b(t))}d(jd,"castPath");var ya=jd,bb=1/0;function Kd(t){if(typeof t=="string"||So(t))return t;var e=t+"";return e=="0"&&1/t==-bb?"-0":e}d(Kd,"toKey");var qr=Kd;function Ld(t,e){e=ya(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[qr(e[n++])];return n&&n==r?t:void 0}d(Ld,"baseGet");var Mo=Ld;function Fd(t,e,n){var r=t==null?void 0:Mo(t,e);return r===void 0?n:r}d(Fd,"get");var wb=Fd;function Wd(t,e){for(var n=-1,r=e.length,a=t.length;++n<r;)t[a+n]=e[n];return t}d(Wd,"arrayPush");var zd=Wd,xb=gd(Object.getPrototypeOf,Object),qd=xb,Pb="[object Object]",Bb=Function.prototype,Eb=Object.prototype,Gd=Bb.toString,Sb=Eb.hasOwnProperty,kb=Gd.call(Object);function Vd(t){if(!Pn(t)||En(t)!=Pb)return!1;var e=qd(t);if(e===null)return!0;var n=Sb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Gd.call(n)==kb}d(Vd,"isPlainObject");var Ic=Vd;function Jd(){this.__data__=new fa,this.size=0}d(Jd,"stackClear");var Ib=Jd;function Xd(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}d(Xd,"stackDelete");var Ab=Xd;function Yd(t){return this.__data__.get(t)}d(Yd,"stackGet");var Cb=Yd;function Qd(t){return this.__data__.has(t)}d(Qd,"stackHas");var Ob=Qd,Rb=200;function ep(t,e){var n=this.__data__;if(n instanceof fa){var r=n.__data__;if(!Zr||r.length<Rb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new pa(r)}return n.set(t,e),this.size=n.size,this}d(ep,"stackSet");var Mb=ep;function On(t){var e=this.__data__=new fa(t);this.size=e.size}d(On,"Stack");On.prototype.clear=Ib;On.prototype.delete=Ab;On.prototype.get=Cb;On.prototype.has=Ob;On.prototype.set=Mb;var hi=On;function tp(t,e){for(var n=-1,r=t==null?0:t.length,a=0,s=[];++n<r;){var i=t[n];e(i,n,t)&&(s[a++]=i)}return s}d(tp,"arrayFilter");var Nb=tp;function np(){return[]}d(np,"stubArray");var rp=np,Db=Object.prototype,Hb=Db.propertyIsEnumerable,Ac=Object.getOwnPropertySymbols,Ub=Ac?function(t){return t==null?[]:(t=Object(t),Nb(Ac(t),function(e){return Hb.call(t,e)}))}:rp,ip=Ub,$b=Object.getOwnPropertySymbols,Zb=$b?function(t){for(var e=[];t;)zd(e,ip(t)),t=qd(t);return e}:rp,jb=Zb;function ap(t,e,n){var r=e(t);return Lt(t)?r:zd(r,n(t))}d(ap,"baseGetAllKeys");var op=ap;function sp(t){return op(t,Oo,ip)}d(sp,"getAllKeys");var Cc=sp;function lp(t){return op(t,H_,jb)}d(lp,"getAllKeysIn");var Kb=lp,Lb=kn(Ft,"DataView"),yo=Lb,Fb=kn(Ft,"Promise"),mo=Fb,Wb=kn(Ft,"Set"),ho=Wb,Oc="[object Map]",zb="[object Object]",Rc="[object Promise]",Mc="[object Set]",Nc="[object WeakMap]",Dc="[object DataView]",qb=Sn(yo),Gb=Sn(Zr),Vb=Sn(mo),Jb=Sn(ho),Xb=Sn(po),Tn=En;(yo&&Tn(new yo(new ArrayBuffer(1)))!=Dc||Zr&&Tn(new Zr)!=Oc||mo&&Tn(mo.resolve())!=Rc||ho&&Tn(new ho)!=Mc||po&&Tn(new po)!=Nc)&&(Tn=d(function(t){var e=En(t),n=e==zb?t.constructor:void 0,r=n?Sn(n):"";if(r)switch(r){case qb:return Dc;case Gb:return Oc;case Vb:return Rc;case Jb:return Mc;case Xb:return Nc}return e},"getTag"));var Hc=Tn,Yb=Ft.Uint8Array,Uc=Yb,Qb="__lodash_hash_undefined__";function up(t){return this.__data__.set(t,Qb),this}d(up,"setCacheAdd");var ew=up;function cp(t){return this.__data__.has(t)}d(cp,"setCacheHas");var tw=cp;function jr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new pa;++e<n;)this.add(t[e])}d(jr,"SetCache");jr.prototype.add=jr.prototype.push=ew;jr.prototype.has=tw;var nw=jr;function fp(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(fp,"arraySome");var rw=fp;function dp(t,e){return t.has(e)}d(dp,"cacheHas");var iw=dp,aw=1,ow=2;function pp(t,e,n,r,a,s){var i=n&aw,o=t.length,l=e.length;if(o!=l&&!(i&&l>o))return!1;var f=s.get(t),p=s.get(e);if(f&&p)return f==e&&p==t;var y=-1,g=!0,h=n&ow?new nw:void 0;for(s.set(t,e),s.set(e,t);++y<o;){var w=t[y],P=e[y];if(r)var B=i?r(P,w,y,e,t,s):r(w,P,y,t,e,s);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!rw(e,function(v,S){if(!iw(h,S)&&(w===v||a(w,v,n,r,s)))return h.push(S)})){g=!1;break}}else if(!(w===P||a(w,P,n,r,s))){g=!1;break}}return s.delete(t),s.delete(e),g}d(pp,"equalArrays");var gp=pp;function yp(t){var e=-1,n=Array(t.size);return t.forEach(function(r,a){n[++e]=[a,r]}),n}d(yp,"mapToArray");var sw=yp;function mp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}d(mp,"setToArray");var lw=mp,uw=1,cw=2,fw="[object Boolean]",dw="[object Date]",pw="[object Error]",gw="[object Map]",yw="[object Number]",mw="[object RegExp]",hw="[object Set]",vw="[object String]",Tw="[object Symbol]",_w="[object ArrayBuffer]",bw="[object DataView]",$c=on?on.prototype:void 0,ao=$c?$c.valueOf:void 0;function hp(t,e,n,r,a,s,i){switch(n){case bw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case _w:return!(t.byteLength!=e.byteLength||!s(new Uc(t),new Uc(e)));case fw:case dw:case yw:return Ao(+t,+e);case pw:return t.name==e.name&&t.message==e.message;case mw:case vw:return t==e+"";case gw:var o=sw;case hw:var l=r&uw;if(o||(o=lw),t.size!=e.size&&!l)return!1;var f=i.get(t);if(f)return f==e;r|=cw,i.set(t,e);var p=gp(o(t),o(e),r,a,s,i);return i.delete(t),p;case Tw:if(ao)return ao.call(t)==ao.call(e)}return!1}d(hp,"equalByTag");var ww=hp,xw=1,Pw=Object.prototype,Bw=Pw.hasOwnProperty;function vp(t,e,n,r,a,s){var i=n&xw,o=Cc(t),l=o.length,f=Cc(e),p=f.length;if(l!=p&&!i)return!1;for(var y=l;y--;){var g=o[y];if(!(i?g in e:Bw.call(e,g)))return!1}var h=s.get(t),w=s.get(e);if(h&&w)return h==e&&w==t;var P=!0;s.set(t,e),s.set(e,t);for(var B=i;++y<l;){g=o[y];var v=t[g],S=e[g];if(r)var E=i?r(S,v,g,e,t,s):r(v,S,g,t,e,s);if(!(E===void 0?v===S||a(v,S,n,r,s):E)){P=!1;break}B||(B=g=="constructor")}if(P&&!B){var H=t.constructor,K=e.constructor;H!=K&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof K=="function"&&K instanceof K)&&(P=!1)}return s.delete(t),s.delete(e),P}d(vp,"equalObjects");var Ew=vp,Sw=1,Zc="[object Arguments]",jc="[object Array]",yi="[object Object]",kw=Object.prototype,Kc=kw.hasOwnProperty;function Tp(t,e,n,r,a,s){var i=Lt(t),o=Lt(e),l=i?jc:Hc(t),f=o?jc:Hc(e);l=l==Zc?yi:l,f=f==Zc?yi:f;var p=l==yi,y=f==yi,g=l==f;if(g&&go(t)){if(!go(e))return!1;i=!0,p=!1}if(g&&!p)return s||(s=new hi),i||cd(t)?gp(t,e,n,r,a,s):ww(t,e,l,n,r,a,s);if(!(n&Sw)){var h=p&&Kc.call(t,"__wrapped__"),w=y&&Kc.call(e,"__wrapped__");if(h||w){var P=h?t.value():t,B=w?e.value():e;return s||(s=new hi),a(P,B,n,r,s)}}return g?(s||(s=new hi),Ew(t,e,n,r,a,s)):!1}d(Tp,"baseIsEqualDeep");var Iw=Tp;function No(t,e,n,r,a){return t===e?!0:t==null||e==null||!Pn(t)&&!Pn(e)?t!==t&&e!==e:Iw(t,e,n,r,No,a)}d(No,"baseIsEqual");var ma=No,Aw=1,Cw=2;function _p(t,e,n,r){var a=n.length,s=a,i=!r;if(t==null)return!s;for(t=Object(t);a--;){var o=n[a];if(i&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++a<s;){o=n[a];var l=o[0],f=t[l],p=o[1];if(i&&o[2]){if(f===void 0&&!(l in t))return!1}else{var y=new hi;if(r)var g=r(f,p,l,t,e,y);if(!(g===void 0?ma(p,f,Aw|Cw,r,y):g))return!1}}return!0}d(_p,"baseIsMatch");var Ow=_p;function bp(t){return t===t&&!Qn(t)}d(bp,"isStrictComparable");var wp=bp;function xp(t){for(var e=Oo(t),n=e.length;n--;){var r=e[n],a=t[r];e[n]=[r,a,wp(a)]}return e}d(xp,"getMatchData");var Rw=xp;function Pp(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}d(Pp,"matchesStrictComparable");var Bp=Pp;function Ep(t){var e=Rw(t);return e.length==1&&e[0][2]?Bp(e[0][0],e[0][1]):function(n){return n===t||Ow(n,t,e)}}d(Ep,"baseMatches");var Mw=Ep;function Sp(t,e){return t!=null&&e in Object(t)}d(Sp,"baseHasIn");var Nw=Sp;function kp(t,e,n){e=ya(e,t);for(var r=-1,a=e.length,s=!1;++r<a;){var i=qr(e[r]);if(!(s=t!=null&&n(t,i)))break;t=t[i]}return s||++r!=a?s:(a=t==null?0:t.length,!!a&&Co(a)&&Io(i,a)&&(Lt(t)||id(t)))}d(kp,"hasPath");var Dw=kp;function Ip(t,e){return t!=null&&Dw(t,e,Nw)}d(Ip,"hasIn");var Hw=Ip,Uw=1,$w=2;function Ap(t,e){return Ro(t)&&wp(e)?Bp(qr(t),e):function(n){var r=wb(n,t);return r===void 0&&r===e?Hw(n,t):ma(e,r,Uw|$w)}}d(Ap,"baseMatchesProperty");var Zw=Ap;function Cp(t){return function(e){return e?.[t]}}d(Cp,"baseProperty");var jw=Cp;function Op(t){return function(e){return Mo(e,t)}}d(Op,"basePropertyDeep");var Kw=Op;function Rp(t){return Ro(t)?jw(qr(t)):Kw(t)}d(Rp,"property");var Lw=Rp;function Mp(t){return typeof t=="function"?t:t==null?yT:typeof t=="object"?Lt(t)?Zw(t[0],t[1]):Mw(t):Lw(t)}d(Mp,"baseIteratee");var Do=Mp;function Np(t){return function(e,n,r){for(var a=-1,s=Object(e),i=r(e),o=i.length;o--;){var l=i[t?o:++a];if(n(s[l],l,s)===!1)break}return e}}d(Np,"createBaseFor");var Fw=Np,Ww=Fw(),zw=Ww;function Dp(t,e){return t&&zw(t,e,Oo)}d(Dp,"baseForOwn");var qw=Dp;function Hp(t,e){return ma(t,e)}d(Hp,"isEqual");var Yn=Hp;function Up(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?ma(t,e,void 0,n):!!r}d(Up,"isEqualWith");var Gw=Up;function $p(t){return t===void 0}d($p,"isUndefined");var Lc=$p;function Zp(t,e){var n={};return e=Do(e,3),qw(t,function(r,a,s){qf(n,a,e(r,a,s))}),n}d(Zp,"mapValues");var Vw=Zp,Jw="Expected a function";function jp(t){if(typeof t!="function")throw new TypeError(Jw);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(jp,"negate");var Xw=jp;function Kp(t,e,n,r){if(!Qn(t))return t;e=ya(e,t);for(var a=-1,s=e.length,i=s-1,o=t;o!=null&&++a<s;){var l=qr(e[a]),f=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(a!=i){var p=o[l];f=r?r(p,l,o):void 0,f===void 0&&(f=Qn(p)?p:Io(e[a+1])?[]:{})}$T(o,l,f),o=o[l]}return t}d(Kp,"baseSet");var Yw=Kp;function Lp(t,e,n){for(var r=-1,a=e.length,s={};++r<a;){var i=e[r],o=Mo(t,i);n(o,i)&&Yw(s,ya(i,t),o)}return s}d(Lp,"basePickBy");var Qw=Lp;function Fp(t,e){if(t==null)return{};var n=Nf(Kb(t),function(r){return[r]});return e=Do(e),Qw(t,n,function(r,a){return e(r,a[0])})}d(Fp,"pickBy");var ex=Fp;function Wp(t,e){return ex(t,Xw(Do(e)))}d(Wp,"omitBy");var Fc=Wp,tx=d(t=>{let e=t.checks;return e.length===0?"":e.map(nx).join("")},"generateStringChecks"),nx=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=Xn({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(${Xn({message:t.message,precision:r,offset:t.offset})})`;case"ip":return`.ip(${Xn({message:t.message,version:t.version})})`;default:return""}},"_generateStringCheck"),rx=d(t=>{let e=t.checks;return e.length===0?"":e.map(ix).join("")},"generateNumberChecks"),ix=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"),ax=d(t=>{let e=t.checks;return e.length===0?"":e.map(ox).join("")},"generateBigIntChecks"),ox=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"),sx=d(t=>{let e=t.checks;return e.length===0?"":e.map(lx).join("")},"generateDateChecks"),lx=d(t=>{switch(t.kind){case"min":return`.min(${Wc(t.value)}, ${se(t.message)})`;case"max":return`.max(${Wc(t.value)}, ${se(t.message)})`;default:return""}},"_generateDateCheck"),Wc=d(t=>`new Date(${t})`,"dateTs"),ux=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"),cx=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 Ho(t){return Fe(t)}d(Ho,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case M.ZodFirstPartyTypeKind.ZodString:return`z.string()${tx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${rx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${ax(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case M.ZodFirstPartyTypeKind.ZodDate:return`z.date()${sx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${ux(n)}${Ce(n)}${Ae(n)}`;case M.ZodFirstPartyTypeKind.ZodObject:let r=Vw(n.shape(),Fe),a=t.additionalProperties(),s=a?`.catchall(${Fe(a)})`:"";return["z.object({",...Object.entries(r).map(([Q,ge])=>` ${Q}: ${ge},`),`})${s}${Ce(n)}${Ae(n)}`].join(`
23
- `).trim();case M.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let o=n.options.map(Fe);return`z.discriminatedUnion(${se(n.discriminator)}, [${o.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodIntersection:let f=Fe(n.left),p=Fe(n.right);return`z.intersection(${f}, ${p})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodMap:let w=Fe(n.keyType),P=Fe(n.valueType);return`z.map(${w}, ${P})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${cx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),v=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${v}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${se(n.value)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(se).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodEffects:throw new vn(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new vn(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodDefault:let K=Xn(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${K})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodCatch:throw new vn(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBranded:throw new vn(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new vn(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new vn(M.ZodFirstPartyTypeKind.ZodSymbol);case M.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.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=>`${fx(t)}${dx(t)}${px(t)}${gx(t)}${yx(t)}${mx(t)}${hx(t)}`,"_addZuiExtensions"),fx=d(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${se(t[le].title)})`:""},"_maybeTitle"),dx=d(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${tf({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),px=d(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),gx=d(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),yx=d(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${se(t[le].placeholder)})`:""},"_maybePlaceholder"),mx=d(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),hx=d(t=>{var e;let n=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],r=Object.entries((e=t[le])!=null?e:{}).filter(([a])=>!n.includes(a));return r.length>0?`.metadata(${tf(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),vx=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",a=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[a];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",a=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[a];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),zp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",qp="(([+-]\\d{2}(:?\\d{2})?)|Z)",Tx="Z",Gp="(\\.\\d+)?",vo="\\.\\d{",_x="}",Vp=d(t=>{let e=t.precision?vo+t.precision+_x:t.precision===0?"":Gp,n=t.offset?qp:Tx;return new RegExp(`^${zp}${e}${n}$`)},"generateDatetimeRegex"),bx=d(t=>({precision:wx(t),offset:t.endsWith(`${qp}$`)}),"extractPrecisionAndOffset"),wx=d(t=>{let e=t.slice(1+zp.length);return e.startsWith(Gp)?null:e.startsWith(vo)?parseInt(e.slice(vo.length)):0},"_extractPrecision"),Hr={};oa(Hr,{escapeSpecialChars:()=>xx});var xx=d(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Uo(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(b({},t.errorMessage),{[e]:n}))}d(Uo,"addErrorMessage");function Re(t,e,n,r,a){t[e]=n,Uo(t,e,r,a)}d(Re,"setResponseValueAndErrors");var Ye={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 $o(t,e){let n=b({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(a){return e.patternStrategy==="escape"?Hr.escapeSpecialChars(a):a}if(d(r,"processPattern"),t.checks)for(let a of t.checks)switch(a.kind){case"min":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,a.value):a.value,a.message,e);break;case"max":Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,a.value):a.value,a.message,e);break;case"email":switch(e.emailStrategy){case"format:email":hn(n,"email",a.message,e);break;case"format:idn-email":hn(n,"idn-email",a.message,e);break;case"pattern:zod":Zt(n,Ye.email,a.message,e);break}break;case"url":hn(n,"uri",a.message,e);break;case"uuid":hn(n,"uuid",a.message,e);break;case"regex":Zt(n,a.regex.source,a.message,e);break;case"cuid":Zt(n,Ye.cuid,a.message,e);break;case"cuid2":Zt(n,Ye.cuid2,a.message,e);break;case"startsWith":Zt(n,"^"+r(a.value),a.message,e);break;case"endsWith":Zt(n,r(a.value)+"$",a.message,e);break;case"datetime":hn(n,"date-time",a.message,e);break;case"length":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,a.value):a.value,a.message,e),Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,a.value):a.value,a.message,e);break;case"includes":{Zt(n,r(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&hn(n,"ipv4",a.message,e),a.version!=="v4"&&hn(n,"ipv6",a.message,e);break}case"emoji":Zt(n,Ye.emoji,a.message,e);break;case"ulid":{Zt(n,Ye.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}d($o,"parseStringDef");var hn=d((t,e,n,r)=>{var a;t.format||(a=t.anyOf)!=null&&a.some(s=>s.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"),Zt=d((t,e,n,r)=>{var a;t.pattern||(a=t.allOf)!=null&&a.some(s=>s.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"),Px=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=Ye.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Ye.cuid2;break;case"ulid":e.format="ulid",e.pattern=Ye.ulid;break;case"uuid":e.format="uuid",e.pattern=Ye.uuid;break;case"emoji":e.format="emoji",e.pattern=Ye.emoji;break;case"email":e.format="email",e.pattern=Ye.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Ye.ipv6:Ye.ipv4;break;case"datetime":e.format="date-time",e.pattern=Vp(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=`${Hr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Hr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Hr.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 ff({zodType:M.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),Bx=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"),Ex=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"),Sx=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 M.ZodFirstPartyTypeKind.ZodString:return Px(e);case M.ZodFirstPartyTypeKind.ZodNumber:return vx(e);case M.ZodFirstPartyTypeKind.ZodNaN:throw new dt(M.ZodFirstPartyTypeKind.ZodNaN);case M.ZodFirstPartyTypeKind.ZodBigInt:throw new dt(M.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case M.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodDate:throw new dt(M.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case M.ZodFirstPartyTypeKind.ZodUndefined:return oo(n);case M.ZodFirstPartyTypeKind.ZodNull:return so(n);case M.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(b({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUnknown}})};case M.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodVoid:throw new dt(M.ZodFirstPartyTypeKind.ZodVoid);case M.ZodFirstPartyTypeKind.ZodArray:return Bx(e,st);case M.ZodFirstPartyTypeKind.ZodObject:let r=Object.entries(n.shape()),a=r.filter(([p,y])=>!y.isOptional()),s=a.length?a.map(([p])=>p):void 0,i=r.map(([p,y])=>[p,y.mandatory()]).map(([p,y])=>[p,st(y)]),o=!1;return n.unknownKeys instanceof M.ZodType?o=st(n.unknownKeys):n.unknownKeys==="passthrough"&&(o=!0),{type:"object",description:n.description,properties:Object.fromEntries(i),required:s,additionalProperties:o,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case M.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 M.ZodFirstPartyTypeKind.ZodTuple:return Sx(e,st);case M.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:st(n.valueType),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodMap:throw new dt(M.ZodFirstPartyTypeKind.ZodMap);case M.ZodFirstPartyTypeKind.ZodSet:return Ex(e,st);case M.ZodFirstPartyTypeKind.ZodFunction:throw new dt(M.ZodFirstPartyTypeKind.ZodFunction);case M.ZodFirstPartyTypeKind.ZodLazy:throw new dt(M.ZodFirstPartyTypeKind.ZodLazy);case M.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 so(n);if(n.value===void 0)return oo(n);{M.util.assertEqual(!0);let p=typeof n.value;throw new la(`Unsupported literal type: "${p}"`)}case M.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodEffects:throw new dt(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new dt(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[st(n.innerType),oo()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodOptional}})};case M.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[st(n.innerType),so()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodNullable}})};case M.ZodFirstPartyTypeKind.ZodDefault:return N(b({},st(n.innerType)),{default:n.defaultValue()});case M.ZodFirstPartyTypeKind.ZodCatch:throw new dt(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:throw new dt(M.ZodFirstPartyTypeKind.ZodPromise);case M.ZodFirstPartyTypeKind.ZodBranded:throw new dt(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new dt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new dt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodReadonly:return N(b({},st(n.innerType)),{readOnly:!0});case M.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:M.util.assertNever(n)}}d(st,"toJSONSchema");var oo=d(t=>({not:!0,description:t?.description,"x-zui":N(b({},t?.["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),so=d(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),Jp=class{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}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(Jp,"ParseInputLazyPath");var It=Jp,zc=d((t,e)=>{if(Lr(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 Kt(t.common.issues);return this._error=n,this._error}}},"handleResult"),Xp=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 rn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new vt,ctx:{common:e.parent.common,data:e.data,parsedType:rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ki(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 a={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rn(e)},s=this._parseSync({data:e,path:a.path,parent:a});return zc(a,s)}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:rn(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(ki(a)?a:Promise.resolve(a));return zc(r,s)}refine(e,n){let r=d(a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n,"getIssueProperties");return this._refinement((a,s)=>{let i=e(a),o=d(()=>s.addIssue(b({code:G.custom},r(a))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new Bn({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return an.create(this,this._def)}nullable(){return er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wr.create(this,this._def)}promise(){return Ta.create(this,this._def)}mandatory(){return this}or(e){return es.create([this,e],this._def)}and(e){return qo.create(this,e,this._def)}transform(e){return new Bn(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 ha(N(b({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Lo(b({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new Fo(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 Qo.create(this,e)}readonly(){return _a.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,a;let s=this.clone(),i=s._metadataRoot;(a=(n=i._def)[r=le])!=null||(n[r]={});for(let[o,l]of Object.entries(e))i._def[le]=N(b({},i._def[le]),{[o]:l});return s}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 Eo(this,e)}toTypescriptSchema(){return Ho(this)}naked(){return this}};d(Xp,"ZodType");var he=Xp,Yp=(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))(Yp||{}),be;(t=>{t.assertEqual=d(a=>a,"assertEqual");function e(a){}t.assertIs=e,d(e,"assertIs");function n(a){throw new Error("assertNever called")}t.assertNever=n,d(n,"assertNever"),t.arrayToEnum=d(a=>{let s={};for(let i of a)s[i]=i;return s},"arrayToEnum"),t.getValidEnumValues=d(a=>{let s=(0,t.objectKeys)(a).filter(o=>typeof a[a[o]]!="number"),i={};for(let o of s)i[o]=a[o];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=d(a=>(0,t.objectKeys)(a).map(function(s){return a[s]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=d((a,s)=>{for(let i of a)if(s(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,d(r,"joinValues"),t.jsonStringifyReplacer=d((a,s)=>typeof s=="bigint"?s.toString():s,"jsonStringifyReplacer"),t.compareFunctions=d((a,s)=>a.toString()===s.toString(),"compareFunctions"),t.mock=d(()=>({}),"mock")})(be||(be={}));var To;(t=>{t.mergeShapes=d((e,n)=>b(b({},e),n),"mergeShapes")})(To||(To={}));var te=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rn=d(t=>{switch(typeof t){case"undefined":return te.undefined;case"string":return te.string;case"number":return isNaN(t)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(t)?te.array:t===null?te.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?te.promise:typeof Map<"u"&&t instanceof Map?te.map:typeof Set<"u"&&t instanceof Set?te.set:typeof Date<"u"&&t instanceof Date?te.date:te.object;default:return te.unknown}},"getParsedType");function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:a}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a,[le]:t?.[le]}:{errorMap:d((i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:r??o.defaultError}:{message:n??o.defaultError},"customMap"),description:a,[le]:t?.[le]}}d(me,"processCreateParams");var Zo=d((t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===te.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.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 G.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 G.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 G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;case G.unresolved_reference:n="Unresolved reference";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},"errorMap"),qc=Zo,G=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"]),kx=d(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ei=class Qp 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(s){return s.message},r={_errors:[]},a=d(s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,l=0;for(;l<i.path.length;){let f=i.path[l];l===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(n(i))):o[f]=o[f]||{_errors:[]},o=o[f],l++}}},"processError");return a(this),r}static assert(e){if(!(e instanceof Qp))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 a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};d(Ei,"ZodError");Ei.create=d(t=>new Ei(t),"create");var Kt=Ei,eg=Zo;function tg(t){eg=t}d(tg,"setErrorMap");function Kr(){return eg}d(Kr,"getErrorMap");var Si=d(t=>{var e;let{data:n,path:r,errorMaps:a,issueData:s}=t,i=[...r,...s.path||[]],o=N(b({},s),{path:i}),l="",f=a.filter(p=>!!p).slice().reverse();for(let p of f)l=p(o,{data:n,defaultError:l}).message;return N(b({},s),{path:i,message:(e=s.message)!=null?e:l})},"makeIssue"),Ix=[];function ee(t,e){let n=Si({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),Zo].filter(r=>!!r)});t.common.issues.push(n)}d(ee,"addIssueToContext");var ng=class rg{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 a of n){if(a.status==="aborted")return pe;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let a of n)r.push({key:await a.key,value:await a.value});return rg.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return pe;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}};d(ng,"ParseStatus");var vt=ng,pe=Object.freeze({status:"aborted"}),Jn=d(t=>({status:"dirty",value:t}),"DIRTY"),pt=d(t=>({status:"valid",value:t}),"OK"),_o=d(t=>t.status==="aborted","isAborted"),bo=d(t=>t.status==="dirty","isDirty"),Lr=d(t=>t.status==="valid","isValid"),ki=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 Ii=class ig extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return pt(e.data)}isEqual(e){return e instanceof ig}};d(Ii,"ZodAny");Ii.create=d(t=>new Ii(b({typeName:"ZodAny"},me(t))),"create");var Fr=Ii,Ai=class _n extends he{dereference(e){return new _n(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new _n(N(b({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,a,s,i,o;return e instanceof _n?Yn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&Yn((a=this._def.maxLength)==null?void 0:a.value,(s=e._def.maxLength)==null?void 0:s.value)&&Yn((i=this._def.minLength)==null?void 0:i.value,(o=e._def.minLength)==null?void 0:o.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==te.array)return ee(n,{code:G.invalid_type,expected:te.array,received:n.parsedType}),pe;if(a.exactLength!==null){let i=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(i||o)&&(ee(n,{code:i?G.too_big:G.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(ee(n,{code:G.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(ee(n,{code:G.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>a.type._parseAsync(new It(n,i,n.path,o)))).then(i=>vt.mergeArray(r,i));let s=[...n.data].map((i,o)=>a.type._parseSync(new It(n,i,n.path,o)));return vt.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new _n(N(b({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new _n(N(b({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new _n(N(b({},this._def),{exactLength:{value:e,message:ue.toString(n)}}))}nonempty(e){return this.min(1,e)}};d(Ai,"ZodArray");Ai.create=d((t,e)=>new Ai(b({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Wr=Ai,Ax=d((t,e)=>ag(t,e,new WeakSet),"isEqual"),ag=d((t,e,n)=>Gw(t,e,Cx(n)),"_isEqualWithVisitedTracking"),Cx=d(t=>(e,n)=>{if(Ic(e)&&!t.has(e)&&Ic(n)&&!t.has(n)){let r=Fc(e,Lc),a=Fc(n,Lc);return t.add(r).add(a).add(e).add(n),ag(r,a,t)}},"_customizerWithVisitedTracking"),Ox={compare:Ax},og=class{constructor(e=[],n={}){this._options=b(b({},Ox),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(og,"CustomSet");var et=og,Ci=class vi 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)!==te.bigint){let s=this._getOrReturnCtx(e);return ee(s,{code:G.invalid_type,expected:te.bigint,received:s.parsedType}),pe}let r,a=new vt;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:G.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:G.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):be.assertNever(s);return{status:a.value,value:e.data}}isEqual(e){if(!(e instanceof vi)||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,a){return new vi(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_addCheck(e){return new vi(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(Ci,"ZodBigInt");Ci.create=d(t=>{var e;return new Ci(b({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var jo=Ci,Oi=class sg extends he{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==te.boolean){let r=this._getOrReturnCtx(e);return ee(r,{code:G.invalid_type,expected:te.boolean,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof sg?this._def.coerce===e._def.coerce:!1}};d(Oi,"ZodBoolean");Oi.create=d(t=>new Oi(b({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var Ko=Oi,Rx=Symbol("zod_brand"),lg=class Pr extends he{dereference(e){return new Pr(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pr(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 Pr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Pr(N(b({},this._def),{type:this._def.type.mandatory()}))}};d(lg,"ZodBranded");var Lo=lg,Ri=class Br extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(b({},n),{common:N(b({},n.common),{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:b({},r)});return ki(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Kt(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Kt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType)&&be.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new Br(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Br(N(b({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new Br(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Ri,"ZodCatch");Ri.create=d((t,e)=>new Ri(b({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var Fo=Ri,ug=d((t,e={},n)=>t?Fr.create().superRefine((r,a)=>{var s,i;if(!t(r)){let o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(i=(s=o.fatal)!=null?s:n)!=null?i:!0,f=typeof o=="string"?{message:o}:o;a.addIssue(N(b({code:"custom"},f),{fatal:l}))}}):Fr.create(),"custom"),Mi=class wo extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==te.date){let s=this._getOrReturnCtx(e);return ee(s,{code:G.invalid_type,expected:te.date,received:s.parsedType}),pe}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return ee(s,{code:G.invalid_date}),pe}let r=new vt,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),ee(a,{code:G.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),ee(a,{code:G.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):be.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new wo(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 wo))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(Mi,"ZodDate");Mi.create=d(t=>new Mi(b({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var Wo=Mi,Ni=class Er extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===te.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 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()}))}isEqual(e){return e instanceof Er?this._def.innerType.isEqual(e._def.innerType)&&Yn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Er(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Ni,"ZodDefault");Ni.create=d((t,e,n)=>new Ni(b({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var ha=Ni,Wt=d(t=>Array.from(new Set(t)),"unique"),jt=d(t=>t instanceof Go?jt(t.schema):t instanceof Bn?jt(t.innerType()):t instanceof Vo?[t.value]:t instanceof ar?t.options:t instanceof Jo?be.objectValues(t.enum):t instanceof ha?jt(t._def.innerType):t instanceof ba?[void 0]:t instanceof Xo?[null]:t instanceof an?[void 0,...jt(t.unwrap())]:t instanceof er?[null,...jt(t.unwrap())]:t instanceof Lo||t instanceof _a?jt(t.unwrap()):t instanceof Fo?jt(t._def.innerType):[],"getDiscriminator"),cg=class bn extends he{dereference(e){let n=this.options.map(a=>a.dereference(e)),r=bn._getOptionsMap(this.discriminator,n);return new bn(N(b({},this._def),{options:n,optionsMap:r}))}getReferences(){return Wt(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!==te.object)return ee(n,{code:G.invalid_type,expected:te.object,received:n.parsedType}),pe;let r=this.discriminator,a=n.data[r],s=this.optionsMap.get(a);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ee(n,{code:G.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 a=bn._getOptionsMap(e,n);return new bn(b({typeName:"ZodDiscriminatedUnion",discriminator:e,options:n,optionsMap:a},me(r)))}static _getOptionsMap(e,n){let r=new Map;for(let a of n){let s=jt(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,a)}}return r}isEqual(e){if(!(e instanceof bn)||this._def.discriminator!==e._def.discriminator)return!1;let n=d((s,i)=>s.isEqual(i),"compare"),r=new et(this._def.options,{compare:n}),a=new et(e._def.options,{compare:n});return r.isEqual(a)}};d(cg,"ZodDiscriminatedUnion");var fg=cg;function va(t,e){return new ar(b({values:t,typeName:"ZodEnum"},me(e)))}d(va,"createZodEnum");var zo=class Ti extends he{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return ee(n,{expected:be.joinValues(r),received:n.parsedType,code:G.invalid_type}),pe}if(this._def.values.indexOf(e.data)===-1){let n=this._getOrReturnCtx(e),r=this._def.values;return ee(n,{received:n.data,code:G.invalid_enum_value,options:r}),pe}return pt(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 Ti.create(e,b(b({},this._def),n))}exclude(e,n=this._def){return Ti.create(this.options.filter(r=>!e.includes(r)),b(b({},this._def),n))}isEqual(e){if(!(e instanceof Ti))return!1;let n=new et(this._def.values),r=new et(e._def.values);return n.isEqual(r)}};d(zo,"ZodEnum");zo.create=va;var ar=zo,dg=class wn 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 wn(N(b({},this._def),{args:n,returns:r}))}getReferences(){return Wt([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new wn(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!==te.function)return ee(n,{code:G.invalid_type,expected:te.function,received:n.parsedType}),pe;function r(o,l){return Si({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Kr(),qc].filter(f=>!!f),issueData:{code:G.invalid_arguments,argumentsError:l}})}d(r,"makeArgsIssue");function a(o,l){return Si({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Kr(),qc].filter(f=>!!f),issueData:{code:G.invalid_return_type,returnTypeError:l}})}d(a,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Ta){let o=this;return pt(async function(...l){let f=new Kt([]),p=await o._def.args.parseAsync(l,s).catch(h=>{throw f.addIssue(r(l,h)),f}),y=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(y,s).catch(h=>{throw f.addIssue(a(y,h)),f})})}else{let o=this;return pt(function(...l){let f=o._def.args.safeParse(l,s);if(!f.success)throw new Kt([r(l,f.error)]);let p=Reflect.apply(i,this,f.data),y=o._def.returns.safeParse(p,s);if(!y.success)throw new Kt([a(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new wn(N(b({},this._def),{args:rr.create(e).rest(Ur.create())}))}returns(e){return new wn(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 wn(b({args:e||rr.create([]).rest(Ur.create()),returns:n||Ur.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof wn&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};d(dg,"ZodFunction");var pg=dg;function Di(t,e){let n=rn(t),r=rn(e);if(t===e)return{valid:!0,data:t};if(n===te.object&&r===te.object){let a=be.objectKeys(e),s=be.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i=b(b({},t),e);for(let o of s){let l=Di(t[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(n===te.array&&r===te.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let i=t[s],o=e[s],l=Di(i,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return n===te.date&&r===te.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}d(Di,"mergeValues");var Hi=class _i extends he{dereference(e){return new _i(N(b({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Wt([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new _i(N(b({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=d((s,i)=>{if(_o(s)||_o(i))return pe;let o=Di(s.value,i.value);return o.valid?((bo(s)||bo(i))&&n.dirty(),{status:n.value,value:o.data}):(ee(r,{code:G.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(([s,i])=>a(s,i)):a(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 _i))return!1;let n=d((s,i)=>s.isEqual(i),"compare"),r=new et([this._def.left,this._def.right],{compare:n}),a=new et([e._def.left,e._def.right],{compare:n});return r.isEqual(a)}};d(Hi,"ZodIntersection");Hi.create=d((t,e,n)=>new Hi(b({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var qo=Hi,Ui=class Sr extends he{get schema(){return this._def.getter()}dereference(e){return new Sr(N(b({},this._def),{getter:d(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Sr(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 Sr?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Sr(N(b({},this._def),{getter:d(()=>this._def.getter().mandatory(),"getter")}))}};d(Ui,"ZodLazy");Ui.create=d((t,e)=>new Ui(b({getter:t,typeName:"ZodLazy"},me(e))),"create");var Go=Ui,$i=class gg extends he{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return ee(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof gg?Yn(this._def.value,e._def.value):!1}};d($i,"ZodLiteral");$i.create=d((t,e)=>new $i(b({value:t,typeName:"ZodLiteral"},me(e))),"create");var Vo=$i,Zi=class bi 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 bi(N(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Wt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new bi(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!==te.map)return ee(r,{code:G.invalid_type,expected:te.map,received:r.parsedType}),pe;let a=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([o,l],f)=>({key:a._parse(new It(r,o,r.path,[f,"key"])),value:s._parse(new It(r,l,r.path,[f,"value"]))}));if(r.common.async){let o=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(),o.set(f.value,p.value)}return{status:n.value,value:o}})}else{let o=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(),o.set(f.value,p.value)}return{status:n.value,value:o}}}isEqual(e){return!(!(e instanceof bi)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(Zi,"ZodMap");Zi.create=d((t,e,n)=>new Zi(b({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var yg=Zi,ji=class mg extends he{_parse(e){if(this._getType(e)!==te.nan){let r=this._getOrReturnCtx(e);return ee(r,{code:G.invalid_type,expected:te.nan,received:r.parsedType}),pe}return{status:"valid",value:e.data}}isEqual(e){return e instanceof mg}};d(ji,"ZodNaN");ji.create=d(t=>new ji(b({typeName:"ZodNaN"},me(t))),"create");var hg=ji,Ki=class vg extends he{_parse(e){let n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==te.string&&r.parsedType!==te.number){let a=be.objectValues(n);return ee(r,{expected:be.joinValues(a),received:r.parsedType,code:G.invalid_type}),pe}if(n.indexOf(e.data)===-1){let a=be.objectValues(n);return ee(r,{received:r.data,code:G.invalid_enum_value,options:a}),pe}return pt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof vg?Yn(this._def.values,e._def.values):!1}};d(Ki,"ZodNativeEnum");Ki.create=d((t,e)=>new Ki(b({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var Jo=Ki,Li=class Tg extends he{_parse(e){let n=this._getOrReturnCtx(e);return ee(n,{code:G.invalid_type,expected:te.never,received:n.parsedType}),pe}isEqual(e){return e instanceof Tg}};d(Li,"ZodNever");Li.create=d(t=>new Li(b({typeName:"ZodNever"},me(t))),"create");var Gr=Li,Fi=class _g extends he{_parse(e){if(this._getType(e)!==te.null){let r=this._getOrReturnCtx(e);return ee(r,{code:G.invalid_type,expected:te.null,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof _g}};d(Fi,"ZodNull");Fi.create=d(t=>new Fi(b({typeName:"ZodNull"},me(t))),"create");var Xo=Fi,Wi=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){return this._getType(e)===te.null?pt(null):this._def.innerType._parse(e)}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(Wi,"ZodNullable");Wi.create=d((t,e)=>new Wi(b({innerType:t,typeName:"ZodNullable"},me(e))),"create");var er=Wi;function bg(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,s=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return s%i/Math.pow(10,a)}d(bg,"floatSafeRemainder");var zi=class wi 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)!==te.number){let s=this._getOrReturnCtx(e);return ee(s,{code:G.invalid_type,expected:te.number,received:s.parsedType}),pe}let r,a=new vt;for(let s of this._def.checks)s.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:G.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:G.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ee(r,{code:G.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?bg(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),ee(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ee(r,{code:G.not_finite,message:s.message}),a.dirty()):be.assertNever(s);return{status:a.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,a){return new wi(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_addCheck(e){return new wi(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 wi))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(zi,"ZodNumber");zi.create=d(t=>new zi(b({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var Yo=zi;function xn(t){if(t instanceof tr){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=an.create(xn(r))}return new tr(N(b({},t._def),{shape:d(()=>e,"shape")}))}else return t instanceof Wr?new Wr(N(b({},t._def),{type:xn(t.element)})):t instanceof an?an.create(xn(t.unwrap())):t instanceof er?er.create(xn(t.unwrap())):t instanceof rr?rr.create(t.items.map(e=>xn(e))):t}d(xn,"deepPartialify");var sn=class ht 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 a in n)r[a]=n[a].dereference(e);return new ht(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 Wt(n)}clone(){let e={},n=this._def.shape();for(let[r,a]of Object.entries(n))e[r]=a.clone();return new ht(N(b({},this._def),{shape:d(()=>e,"shape")}))}_parse(e){if(this._getType(e)!==te.object){let p=this._getOrReturnCtx(e);return ee(p,{code:G.invalid_type,expected:te.object,received:p.parsedType}),pe}let{status:r,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(this._def.unknownKeys!=="strip")for(let p in a.data)i.includes(p)||o.push(p);let l=[];for(let p of i){let y=s[p],g=a.data[p];l.push({key:{status:"valid",value:p},value:y._parse(new It(a,g,a.path,p)),alwaysSet:p in a.data})}let f=this._def.unknownKeys;if(f==="passthrough")for(let p of o)l.push({key:{status:"valid",value:p},value:{status:"valid",value:a.data[p]}});else if(f==="strict")o.length>0&&(ee(a,{code:G.unrecognized_keys,keys:o}),r.dirty());else if(f!=="strip")for(let p of o){let y=a.data[p];l.push({key:{status:"valid",value:p},value:f._parse(new It(a,y,a.path,p)),alwaysSet:p in a.data})}return a.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=>vt.mergeObjectSync(r,p)):vt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new ht(b(N(b({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:d((n,r)=>{var a,s,i,o;let l=(i=(s=(a=this._def).errorMap)==null?void 0:s.call(a,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=ue.errToObj(e).message)!=null?o:l}:{message:l}},"errorMap")}:{}))}strip(){return new ht(N(b({},this._def),{unknownKeys:"strip"}))}passthrough(){return new ht(N(b({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return Fr.create();if(this._def.unknownKeys==="strict")return Gr.create()}extend(e){return new ht(N(b({},this._def),{shape:d(()=>b(b({},this._def.shape()),e),"shape")}))}merge(e){return new ht({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 ht(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 ht(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 ht(N(b({},this._def),{shape:d(()=>n,"shape")}))}deepPartial(){return xn(this)}partial(e){let n={};return be.objectKeys(this.shape).forEach(r=>{let a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a?.optional()}),new ht(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 s=this.shape[r];for(;s instanceof an;)s=s._def.innerType;n[r]=s}}),new ht(N(b({},this._def),{shape:d(()=>n,"shape")}))}keyof(){return va(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof ht)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),a=d((o,l)=>o[0]===l[0]&&o[1].isEqual(l[1]),"compare"),s=new et(Object.entries(n),{compare:a}),i=new et(Object.entries(r),{compare:a});return s.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};d(sn,"ZodObject");sn.create=d((t,e)=>new sn(b({shape:d(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");sn.strictCreate=d((t,e)=>new sn(b({shape:d(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");sn.lazycreate=d((t,e)=>new sn(b({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var tr=sn,qi=class xi extends he{dereference(e){return new xi(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xi(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===te.undefined?pt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof xi?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};d(qi,"ZodOptional");qi.create=d((t,e)=>new qi(b({innerType:t,typeName:"ZodOptional"},me(e))),"create");var an=qi,wg=class Ir extends he{dereference(e){return new Ir(N(b({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Wt([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Ir(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 s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?pe:s.status==="dirty"?(n.dirty(),Jn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})},"handleAsync")();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pe:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new Ir({in:e,out:n,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Ir)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};d(wg,"ZodPipeline");var Qo=wg,Gi=class Pi extends he{unwrap(){return this._def.type}dereference(e){return new Pi(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pi(N(b({},this._def),{type:this._def.type.clone()}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==te.promise&&n.common.async===!1)return ee(n,{code:G.invalid_type,expected:te.promise,received:n.parsedType}),pe;let r=n.parsedType===te.promise?n.data:Promise.resolve(n.data);return pt(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}isEqual(e){return e instanceof Pi?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};d(Gi,"ZodPromise");Gi.create=d((t,e)=>new Gi(b({type:t,typeName:"ZodPromise"},me(e))),"create");var Ta=Gi,Vi=class Ar extends he{dereference(e){return new Ar(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ar(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return Lr(n)&&(n.value=Object.freeze(n.value)),n}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Ar?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Ar(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Vi,"ZodReadonly");Vi.create=d((t,e)=>new Vi(b({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var _a=Vi,xg=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 Wt([...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!==te.object)return ee(r,{code:G.invalid_type,expected:te.object,received:r.parsedType}),pe;let a=[],s=this._def.keyType,i=this._def.valueType;for(let o in r.data)a.push({key:s._parse(new It(r,o,r.path,o)),value:i._parse(new It(r,r.data[o],r.path,o))});return r.common.async?vt.mergeObjectAsync(n,a):vt.mergeObjectSync(n,a)}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:gt.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(xg,"ZodRecord");var Pg=xg,Ji=class Bg 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 ee(n,{code:G.unresolved_reference}),pe}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Bg?this._def.uri===e._def.uri:!1}};d(Ji,"ZodRef");Ji.create=d(t=>new Ji({typeName:"ZodRef",uri:t}),"create");var Eg=Ji,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!==te.set)return ee(r,{code:G.invalid_type,expected:te.set,received:r.parsedType}),pe;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(ee(r,{code:G.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(ee(r,{code:G.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let s=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 o=[...r.data.values()].map((l,f)=>s._parse(new It(r,l,r.path,f)));return r.common.async?Promise.all(o).then(l=>i(l)):i(o)}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,a,s;if(!(e instanceof Gn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,o=(r=e._def.minSize)==null?void 0:r.value;if(i!==o)return!1;let l=(a=this._def.maxSize)==null?void 0:a.value,f=(s=e._def.maxSize)==null?void 0:s.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 Sg=Xi,kg=/^c[^\s-]{8,}$/i,Ig=/^[a-z][a-z0-9]*$/,Ag=/^[0-9A-HJKMNP-TV-Z]{26}$/,Cg=/^[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,Og=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Mx=d(t=>t===Rg,"isEmojiRegex"),lo,Mg=/^(((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}))$/,Ng=/^(([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 Dg(t,e){return!!((e==="v4"||!e)&&Mg.test(t)||(e==="v6"||!e)&&Ng.test(t))}d(Dg,"isValidIP");var Yi=class Vn extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==te.string){let s=this._getOrReturnCtx(e);return ee(s,{code:G.invalid_type,expected:te.string,received:s.parsedType}),pe}let r=new vt,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),ee(a,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),ee(a,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?ee(a,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&ee(a,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Og.test(e.data)||(a=this._getOrReturnCtx(e,a),ee(a,{validation:"email",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")lo||(lo=new RegExp(Rg,"u")),lo.test(e.data)||(a=this._getOrReturnCtx(e,a),ee(a,{validation:"emoji",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Cg.test(e.data)||(a=this._getOrReturnCtx(e,a),ee(a,{validation:"uuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")kg.test(e.data)||(a=this._getOrReturnCtx(e,a),ee(a,{validation:"cuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Ig.test(e.data)||(a=this._getOrReturnCtx(e,a),ee(a,{validation:"cuid2",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Ag.test(e.data)||(a=this._getOrReturnCtx(e,a),ee(a,{validation:"ulid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),ee(a,{validation:"url",code:G.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),ee(a,{validation:"regex",code:G.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),ee(a,{code:G.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),ee(a,{code:G.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),ee(a,{code:G.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Vp(s).test(e.data)||(a=this._getOrReturnCtx(e,a),ee(a,{code:G.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="ip"?Dg(e.data,s.version)||(a=this._getOrReturnCtx(e,a),ee(a,{validation:"ip",code:G.invalid_string,message:s.message}),r.dirty()):be.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),b({validation:n,code:G.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(Yi,"ZodString");Yi.create=d(t=>{var e;return new Yi(b({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var gt=Yi,Qi=class Hg extends he{_parse(e){if(this._getType(e)!==te.symbol){let r=this._getOrReturnCtx(e);return ee(r,{code:G.invalid_type,expected:te.symbol,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof Hg}};d(Qi,"ZodSymbol");Qi.create=d(t=>new Qi(b({typeName:"ZodSymbol"},me(t))),"create");var Ug=Qi,nr=class Cr 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 Cr(N(b({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Cr(N(b({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:d(i=>{ee(r,i),i.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let i=a.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async o=>{if(n.value==="aborted")return pe;let l=await this._def.schema._parseAsync({data:o,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 o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?pe:o.status==="dirty"||n.value==="dirty"?Jn(o.value):o}}if(a.type==="refinement"){let i=d(o=>{let l=a.refinement(o,s);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 o},"executeRefinement");if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pe:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?pe:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Lr(i))return i;let o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Lr(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:n.value,value:o})):i);be.assertNever(a)}isEqual(e){return!(e instanceof Cr)||!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 Cr(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 Bn=nr,ea=class Or extends he{dereference(e){let n=this._def.items.map(a=>a.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Or(N(b({},this._def),{items:n,rest:r}))}getReferences(){return Wt([...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 Or(N(b({},this._def),{items:e,rest:n}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.array)return ee(r,{code:G.invalid_type,expected:te.array,received:r.parsedType}),pe;if(r.data.length<this._def.items.length)return ee(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),pe;!this._def.rest&&r.data.length>this._def.items.length&&(ee(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new It(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>vt.mergeArray(n,i)):vt.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Or(N(b({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Or)||!this._restEquals(e))return!1;let n=d((s,i)=>s.isEqual(i),"compare"),r=new et(this._def.items,{compare:n}),a=new et(e._def.items,{compare:n});return r.isEqual(a)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};d(ea,"ZodTuple");ea.create=d((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ea(b({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var rr=ea,ta=class $g extends he{_parse(e){if(this._getType(e)!==te.undefined){let r=this._getOrReturnCtx(e);return ee(r,{code:G.invalid_type,expected:te.undefined,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof $g}mandatory(){return Gr.create(b({},this._def))}};d(ta,"ZodUndefined");ta.create=d(t=>new ta(b({typeName:"ZodUndefined"},me(t))),"create");var ba=ta,na=class Rr extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Rr(N(b({},this._def),{options:n}))}getReferences(){return Wt(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Rr(N(b({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(o=>new Kt(o.ctx.common.issues));return ee(n,{code:G.invalid_union,unionErrors:i}),pe}if(d(a,"handleResults"),n.common.async)return Promise.all(r.map(async s=>{let i=N(b({},n),{common:N(b({},n.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(a);{let s,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"&&!s&&(s={result:p,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(l=>new Kt(l));return ee(n,{code:G.invalid_union,unionErrors:o}),pe}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Rr))return!1;let n=d((s,i)=>s.isEqual(i),"compare"),r=new et([...this._def.options],{compare:n}),a=new et([...e._def.options],{compare:n});return r.isEqual(a)}mandatory(){let e=this._def.options.filter(s=>!(s instanceof ba)).map(s=>s.mandatory()),[n,r,...a]=e;return n?r?new Rr(N(b({},this._def),{options:[n,r,...a]})):n:Gr.create(b({},this._def))}};d(na,"ZodUnion");na.create=d((t,e)=>new na(b({options:t,typeName:"ZodUnion"},me(e))),"create");var es=na,ra=class Zg extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pt(e.data)}isEqual(e){return e instanceof Zg}};d(ra,"ZodUnknown");ra.create=d(t=>new ra(b({typeName:"ZodUnknown"},me(t))),"create");var Ur=ra,ia=class jg extends he{_parse(e){if(this._getType(e)!==te.undefined){let r=this._getOrReturnCtx(e);return ee(r,{code:G.invalid_type,expected:te.void,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof jg}};d(ia,"ZodVoid");ia.create=d(t=>new ia(b({typeName:"ZodVoid"},me(t))),"create");var Kg=ia,Nx=["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"],DA=ar.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Dx=d(t=>gt.create().displayAs({id:"variable",params:b({type:t?.type||"any"},t?.params)}),"variable"),Hx=d(t=>gt.create().displayAs({id:"conversation",params:b({},t?.params)}),"conversation"),Ux=d(t=>gt.create().displayAs({id:"user",params:b({},t?.params)}),"user"),$x=d(t=>gt.create().displayAs({id:"message",params:b({},t?.params)}),"message"),Zx=d(t=>gt.create().displayAs({id:"agent",params:b({},t?.params)}),"agent"),jx=d(t=>gt.create().displayAs({id:"event",params:b({},t?.params)}),"event"),Kx=d(t=>gt.create().displayAs({id:"table",params:b({},t?.params)}),"table"),Lx=d(t=>gt.create().displayAs({id:"tablerow",params:b({},t?.params)}),"tablerow"),Fx=d(t=>gt.create().displayAs({id:"intent",params:b({},t?.params)}),"intent"),Wx=d(()=>ar.create(Nx).displayAs({id:"dropdown",params:{}}),"aimodel"),zx=d(t=>gt.create().displayAs({id:"datasource",params:b({},t)}),"datasource"),qx=d(t=>gt.create().displayAs({id:"knowledgebase",params:b({},t)}),"knowledgebase"),Gx={object:tr.lazycreate},Vx=d((t,e={message:`Input not instance of ${t.name}`})=>ug(n=>n instanceof t,e),"instanceOfType"),Lg=gt.create,Fg=Yo.create,Jx=hg.create,Xx=jo.create,Wg=Ko.create,Yx=Wo.create,Qx=Ug.create,eP=ba.create,tP=Xo.create,nP=Fr.create,rP=Ur.create,iP=Gr.create,aP=Kg.create,oP=Wr.create,sP=tr.create,lP=tr.strictCreate,uP=es.create,cP=fg.create,fP=qo.create,dP=rr.create,pP=Pg.create,gP=Eg.create,yP=_a.create,mP=yg.create,hP=Sg.create,vP=pg.create,TP=Go.create,_P=Vo.create,bP=ar.create,wP=Jo.create,xP=Ta.create,Gc=Bn.create,PP=an.create,BP=er.create,EP=ha.create,SP=Bn.createWithPreprocess,kP=Qo.create,IP=d(()=>Lg().optional(),"ostring"),AP=d(()=>Fg().optional(),"onumber"),CP=d(()=>Wg().optional(),"oboolean"),OP={string:d(t=>gt.create(N(b({},t),{coerce:!0})),"string"),number:d(t=>Yo.create(N(b({},t),{coerce:!0})),"number"),boolean:d(t=>Ko.create(N(b({},t),{coerce:!0})),"boolean"),bigint:d(t=>jo.create(N(b({},t),{coerce:!0})),"bigint"),date:d(t=>Wo.create(N(b({},t),{coerce:!0})),"date")},RP=pe,M=ne,zg=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"),MP=d(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),NP=d(t=>"z.any()","parseDefault"),DP=d((t,e)=>`z.union([${t.type.map(n=>it(N(b({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),HP=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"),UP=d(t=>"z.null()","parseNull"),$P=d(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),ZP=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 a=t[e],s="";if(a!==void 0){let i=n({value:a,json:JSON.stringify(a)});if(i){let o=i[0],l=i.length===3?i[1]:"",f=i.length===3?i[2]:i[1];s+=o,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(s+=l+JSON.stringify(t.errorMessage[e])),s+=f}}return s}d(ut,"withMessage");var Mr=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?{[Mr]:n}:{[Mr]:n,not:{}});else{if(Mr in r)return t;e.push(N(b({},r),{[Mr]:n}))}}return e},"ensureOriginalIndex");function zr(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[Mr]]}))}else{let[n,r]=$P(jP(t.allOf));return`z.intersection(${zr({allOf:n},e)}, ${zr({allOf:r},e)})`}}d(zr,"parseAllOf");var KP=d((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,a)=>it(r,N(b({},e),{path:[...e.path,"items",a]})))}])`;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"),LP=d(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),FP=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"),WP=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"]})),a=it(t.else,N(b({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${a}]).superRefine((value,ctx) => {
22
+ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(se).join(" | ");case M.ZodFirstPartyTypeKind.ZodEffects:return ke(o.schema,s);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new vf(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return`${ke(o.innerType,s)} | undefined`;case M.ZodFirstPartyTypeKind.ZodNullable:return`${ke(o.innerType,s)} | null`;case M.ZodFirstPartyTypeKind.ZodDefault:return ke(o.innerType,s);case M.ZodFirstPartyTypeKind.ZodCatch:return ke(o.innerType,s);case M.ZodFirstPartyTypeKind.ZodPromise:return`Promise<${ke(o.type,s)}>`;case M.ZodFirstPartyTypeKind.ZodBranded:return ke(o.type,s);case M.ZodFirstPartyTypeKind.ZodPipeline:return ke(o.in,s);case M.ZodFirstPartyTypeKind.ZodSymbol:return`${nt(i.description)} symbol`.trim();case M.ZodFirstPartyTypeKind.ZodReadonly:return`Readonly<${ke(o.innerType,s)}>`;case M.ZodFirstPartyTypeKind.ZodRef:return nf(o.uri);default:be.assertNever(o)}}d(ke,"sUnwrapZod");var Jv=d((t,e)=>{if(t.props.type==="none")return ke(t.props.schema,e);let n=nt(t.props.schema.description),r=t.props.schema.describe(""),a=ke(r,e);if(t.props.type==="variable")return yc(`${n}declare const ${t.props.identifier}: ${a};`);let s=t.props.args.length>0?`<${t.props.args.map(nf).join(", ")}>`:"";return yc(`${n}type ${t.props.identifier}${s} = ${a};`)},"unwrapDeclaration"),Xv=d(t=>t.declaration?t.declaration===!0?"variable":t.declaration:"none","getDeclarationType"),Yv=d((t,e)=>{let n=Xv(e),r=t.getReferences();if(n==="none"){if(r.length>0)throw new fo;return new mi({type:"none",schema:t})}let a="title"in t.ui?t.ui.title:null;if(!a)throw new _f;if(n==="variable"){if(r.length>0)throw new fo;return new mi({type:"variable",identifier:a,schema:t})}return new mi({type:"type",identifier:a,schema:t,args:r})},"getDeclarationProps"),Qv=typeof global=="object"&&global&&global.Object===Object&&global,Sf=Qv,eT=typeof self=="object"&&self&&self.Object===Object&&self,tT=Sf||eT||Function("return this")(),Ft=tT,nT=Ft.Symbol,on=nT,kf=Object.prototype,rT=kf.hasOwnProperty,iT=kf.toString,wr=on?on.toStringTag:void 0;function If(t){var e=rT.call(t,wr),n=t[wr];try{t[wr]=void 0;var r=!0}catch{}var a=iT.call(t);return r&&(e?t[wr]=n:delete t[wr]),a}d(If,"getRawTag");var aT=If,oT=Object.prototype,sT=oT.toString;function Af(t){return sT.call(t)}d(Af,"objectToString");var lT=Af,uT="[object Null]",cT="[object Undefined]",vc=on?on.toStringTag:void 0;function Cf(t){return t==null?t===void 0?cT:uT:vc&&vc in Object(t)?aT(t):lT(t)}d(Cf,"baseGetTag");var Sn=Cf;function Of(t){return t!=null&&typeof t=="object"}d(Of,"isObjectLike");var Bn=Of,fT="[object Symbol]";function Rf(t){return typeof t=="symbol"||Bn(t)&&Sn(t)==fT}d(Rf,"isSymbol");var So=Rf;function Mf(t,e){for(var n=-1,r=t==null?0:t.length,a=Array(r);++n<r;)a[n]=e(t[n],n,t);return a}d(Mf,"arrayMap");var Nf=Mf,dT=Array.isArray,Lt=dT,pT=1/0,Tc=on?on.prototype:void 0,_c=Tc?Tc.toString:void 0;function ko(t){if(typeof t=="string")return t;if(Lt(t))return Nf(t,ko)+"";if(So(t))return _c?_c.call(t):"";var e=t+"";return e=="0"&&1/t==-pT?"-0":e}d(ko,"baseToString");var gT=ko;function Df(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}d(Df,"isObject");var er=Df;function Hf(t){return t}d(Hf,"identity");var yT=Hf,mT="[object AsyncFunction]",hT="[object Function]",vT="[object GeneratorFunction]",TT="[object Proxy]";function Uf(t){if(!er(t))return!1;var e=Sn(t);return e==hT||e==vT||e==mT||e==TT}d(Uf,"isFunction");var Zf=Uf,_T=Ft["__core-js_shared__"],ro=_T,bc=function(){var t=/[^.]+$/.exec(ro&&ro.keys&&ro.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function $f(t){return!!bc&&bc in t}d($f,"isMasked");var bT=$f,wT=Function.prototype,xT=wT.toString;function jf(t){if(t!=null){try{return xT.call(t)}catch{}try{return t+""}catch{}}return""}d(jf,"toSource");var kn=jf,PT=/[\\^$.*+?()[\]{}|]/g,BT=/^\[object .+?Constructor\]$/,ET=Function.prototype,ST=Object.prototype,kT=ET.toString,IT=ST.hasOwnProperty,AT=RegExp("^"+kT.call(IT).replace(PT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(t){if(!er(t)||bT(t))return!1;var e=Zf(t)?AT:BT;return e.test(kn(t))}d(Kf,"baseIsNative");var CT=Kf;function Lf(t,e){return t?.[e]}d(Lf,"getValue");var OT=Lf;function Ff(t,e){var n=OT(t,e);return CT(n)?n:void 0}d(Ff,"getNative");var In=Ff,RT=In(Ft,"WeakMap"),po=RT,MT=function(){try{var t=In(Object,"defineProperty");return t({},"",{}),t}catch{}}(),wc=MT,NT=9007199254740991,DT=/^(?:0|[1-9]\d*)$/;function Wf(t,e){var n=typeof t;return e=e??NT,!!e&&(n=="number"||n!="symbol"&&DT.test(t))&&t>-1&&t%1==0&&t<e}d(Wf,"isIndex");var Io=Wf;function zf(t,e,n){e=="__proto__"&&wc?wc(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}d(zf,"baseAssignValue");var qf=zf;function Gf(t,e){return t===e||t!==t&&e!==e}d(Gf,"eq");var Ao=Gf,HT=Object.prototype,UT=HT.hasOwnProperty;function Vf(t,e,n){var r=t[e];(!(UT.call(t,e)&&Ao(r,n))||n===void 0&&!(e in t))&&qf(t,e,n)}d(Vf,"assignValue");var ZT=Vf,$T=9007199254740991;function Jf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=$T}d(Jf,"isLength");var Co=Jf;function Xf(t){return t!=null&&Co(t.length)&&!Zf(t)}d(Xf,"isArrayLike");var Yf=Xf,jT=Object.prototype;function Qf(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||jT;return t===n}d(Qf,"isPrototype");var ed=Qf;function td(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}d(td,"baseTimes");var KT=td,LT="[object Arguments]";function nd(t){return Bn(t)&&Sn(t)==LT}d(nd,"baseIsArguments");var xc=nd,rd=Object.prototype,FT=rd.hasOwnProperty,WT=rd.propertyIsEnumerable,zT=xc(function(){return arguments}())?xc:function(t){return Bn(t)&&FT.call(t,"callee")&&!WT.call(t,"callee")},id=zT;function ad(){return!1}d(ad,"stubFalse");var qT=ad,od=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pc=od&&typeof module=="object"&&module&&!module.nodeType&&module,GT=Pc&&Pc.exports===od,Bc=GT?Ft.Buffer:void 0,VT=Bc?Bc.isBuffer:void 0,JT=VT||qT,go=JT,XT="[object Arguments]",YT="[object Array]",QT="[object Boolean]",e_="[object Date]",t_="[object Error]",n_="[object Function]",r_="[object Map]",i_="[object Number]",a_="[object Object]",o_="[object RegExp]",s_="[object Set]",l_="[object String]",u_="[object WeakMap]",c_="[object ArrayBuffer]",f_="[object DataView]",d_="[object Float32Array]",p_="[object Float64Array]",g_="[object Int8Array]",y_="[object Int16Array]",m_="[object Int32Array]",h_="[object Uint8Array]",v_="[object Uint8ClampedArray]",T_="[object Uint16Array]",__="[object Uint32Array]",Ze={};Ze[d_]=Ze[p_]=Ze[g_]=Ze[y_]=Ze[m_]=Ze[h_]=Ze[v_]=Ze[T_]=Ze[__]=!0;Ze[XT]=Ze[YT]=Ze[c_]=Ze[QT]=Ze[f_]=Ze[e_]=Ze[t_]=Ze[n_]=Ze[r_]=Ze[i_]=Ze[a_]=Ze[o_]=Ze[s_]=Ze[l_]=Ze[u_]=!1;function sd(t){return Bn(t)&&Co(t.length)&&!!Ze[Sn(t)]}d(sd,"baseIsTypedArray");var b_=sd;function ld(t){return function(e){return t(e)}}d(ld,"baseUnary");var w_=ld,ud=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dr=ud&&typeof module=="object"&&module&&!module.nodeType&&module,x_=Dr&&Dr.exports===ud,io=x_&&Sf.process,P_=function(){try{var t=Dr&&Dr.require&&Dr.require("util").types;return t||io&&io.binding&&io.binding("util")}catch{}}(),Ec=P_,Sc=Ec&&Ec.isTypedArray,B_=Sc?w_(Sc):b_,cd=B_,E_=Object.prototype,S_=E_.hasOwnProperty;function fd(t,e){var n=Lt(t),r=!n&&id(t),a=!n&&!r&&go(t),s=!n&&!r&&!a&&cd(t),i=n||r||a||s,o=i?KT(t.length,String):[],l=o.length;for(var f in t)(e||S_.call(t,f))&&!(i&&(f=="length"||a&&(f=="offset"||f=="parent")||s&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Io(f,l)))&&o.push(f);return o}d(fd,"arrayLikeKeys");var dd=fd;function pd(t,e){return function(n){return t(e(n))}}d(pd,"overArg");var gd=pd,k_=gd(Object.keys,Object),I_=k_,A_=Object.prototype,C_=A_.hasOwnProperty;function yd(t){if(!ed(t))return I_(t);var e=[];for(var n in Object(t))C_.call(t,n)&&n!="constructor"&&e.push(n);return e}d(yd,"baseKeys");var O_=yd;function md(t){return Yf(t)?dd(t):O_(t)}d(md,"keys");var Oo=md;function hd(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}d(hd,"nativeKeysIn");var R_=hd,M_=Object.prototype,N_=M_.hasOwnProperty;function vd(t){if(!er(t))return R_(t);var e=ed(t),n=[];for(var r in t)r=="constructor"&&(e||!N_.call(t,r))||n.push(r);return n}d(vd,"baseKeysIn");var D_=vd;function Td(t){return Yf(t)?dd(t,!0):D_(t)}d(Td,"keysIn");var H_=Td,U_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z_=/^\w*$/;function _d(t,e){if(Lt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||So(t)?!0:Z_.test(t)||!U_.test(t)||e!=null&&t in Object(e)}d(_d,"isKey");var Ro=_d,$_=In(Object,"create"),Zr=$_;function bd(){this.__data__=Zr?Zr(null):{},this.size=0}d(bd,"hashClear");var j_=bd;function wd(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}d(wd,"hashDelete");var K_=wd,L_="__lodash_hash_undefined__",F_=Object.prototype,W_=F_.hasOwnProperty;function xd(t){var e=this.__data__;if(Zr){var n=e[t];return n===L_?void 0:n}return W_.call(e,t)?e[t]:void 0}d(xd,"hashGet");var z_=xd,q_=Object.prototype,G_=q_.hasOwnProperty;function Pd(t){var e=this.__data__;return Zr?e[t]!==void 0:G_.call(e,t)}d(Pd,"hashHas");var V_=Pd,J_="__lodash_hash_undefined__";function Bd(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Zr&&e===void 0?J_:e,this}d(Bd,"hashSet");var X_=Bd;function An(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(An,"Hash");An.prototype.clear=j_;An.prototype.delete=K_;An.prototype.get=z_;An.prototype.has=V_;An.prototype.set=X_;var kc=An;function Ed(){this.__data__=[],this.size=0}d(Ed,"listCacheClear");var Y_=Ed;function Sd(t,e){for(var n=t.length;n--;)if(Ao(t[n][0],e))return n;return-1}d(Sd,"assocIndexOf");var ca=Sd,Q_=Array.prototype,eb=Q_.splice;function kd(t){var e=this.__data__,n=ca(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():eb.call(e,n,1),--this.size,!0}d(kd,"listCacheDelete");var tb=kd;function Id(t){var e=this.__data__,n=ca(e,t);return n<0?void 0:e[n][1]}d(Id,"listCacheGet");var nb=Id;function Ad(t){return ca(this.__data__,t)>-1}d(Ad,"listCacheHas");var rb=Ad;function Cd(t,e){var n=this.__data__,r=ca(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}d(Cd,"listCacheSet");var ib=Cd;function Cn(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(Cn,"ListCache");Cn.prototype.clear=Y_;Cn.prototype.delete=tb;Cn.prototype.get=nb;Cn.prototype.has=rb;Cn.prototype.set=ib;var fa=Cn,ab=In(Ft,"Map"),$r=ab;function Od(){this.size=0,this.__data__={hash:new kc,map:new($r||fa),string:new kc}}d(Od,"mapCacheClear");var ob=Od;function Rd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}d(Rd,"isKeyable");var sb=Rd;function Md(t,e){var n=t.__data__;return sb(e)?n[typeof e=="string"?"string":"hash"]:n.map}d(Md,"getMapData");var da=Md;function Nd(t){var e=da(this,t).delete(t);return this.size-=e?1:0,e}d(Nd,"mapCacheDelete");var lb=Nd;function Dd(t){return da(this,t).get(t)}d(Dd,"mapCacheGet");var ub=Dd;function Hd(t){return da(this,t).has(t)}d(Hd,"mapCacheHas");var cb=Hd;function Ud(t,e){var n=da(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}d(Ud,"mapCacheSet");var fb=Ud;function On(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(On,"MapCache");On.prototype.clear=ob;On.prototype.delete=lb;On.prototype.get=ub;On.prototype.has=cb;On.prototype.set=fb;var pa=On,db="Expected a function";function ga(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(db);var n=d(function(){var r=arguments,a=e?e.apply(this,r):r[0],s=n.cache;if(s.has(a))return s.get(a);var i=t.apply(this,r);return n.cache=s.set(a,i)||s,i},"memoized");return n.cache=new(ga.Cache||pa),n}d(ga,"memoize");ga.Cache=pa;var pb=ga,gb=500;function Zd(t){var e=pb(t,function(r){return n.size===gb&&n.clear(),r}),n=e.cache;return e}d(Zd,"memoizeCapped");var yb=Zd,mb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hb=/\\(\\)?/g,vb=yb(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(mb,function(n,r,a,s){e.push(a?s.replace(hb,"$1"):r||n)}),e}),Tb=vb;function $d(t){return t==null?"":gT(t)}d($d,"toString");var _b=$d;function jd(t,e){return Lt(t)?t:Ro(t,e)?[t]:Tb(_b(t))}d(jd,"castPath");var ya=jd,bb=1/0;function Kd(t){if(typeof t=="string"||So(t))return t;var e=t+"";return e=="0"&&1/t==-bb?"-0":e}d(Kd,"toKey");var qr=Kd;function Ld(t,e){e=ya(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[qr(e[n++])];return n&&n==r?t:void 0}d(Ld,"baseGet");var Mo=Ld;function Fd(t,e,n){var r=t==null?void 0:Mo(t,e);return r===void 0?n:r}d(Fd,"get");var wb=Fd;function Wd(t,e){for(var n=-1,r=e.length,a=t.length;++n<r;)t[a+n]=e[n];return t}d(Wd,"arrayPush");var zd=Wd,xb=gd(Object.getPrototypeOf,Object),qd=xb,Pb="[object Object]",Bb=Function.prototype,Eb=Object.prototype,Gd=Bb.toString,Sb=Eb.hasOwnProperty,kb=Gd.call(Object);function Vd(t){if(!Bn(t)||Sn(t)!=Pb)return!1;var e=qd(t);if(e===null)return!0;var n=Sb.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Gd.call(n)==kb}d(Vd,"isPlainObject");var Ic=Vd;function Jd(){this.__data__=new fa,this.size=0}d(Jd,"stackClear");var Ib=Jd;function Xd(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}d(Xd,"stackDelete");var Ab=Xd;function Yd(t){return this.__data__.get(t)}d(Yd,"stackGet");var Cb=Yd;function Qd(t){return this.__data__.has(t)}d(Qd,"stackHas");var Ob=Qd,Rb=200;function ep(t,e){var n=this.__data__;if(n instanceof fa){var r=n.__data__;if(!$r||r.length<Rb-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new pa(r)}return n.set(t,e),this.size=n.size,this}d(ep,"stackSet");var Mb=ep;function Rn(t){var e=this.__data__=new fa(t);this.size=e.size}d(Rn,"Stack");Rn.prototype.clear=Ib;Rn.prototype.delete=Ab;Rn.prototype.get=Cb;Rn.prototype.has=Ob;Rn.prototype.set=Mb;var hi=Rn;function tp(t,e){for(var n=-1,r=t==null?0:t.length,a=0,s=[];++n<r;){var i=t[n];e(i,n,t)&&(s[a++]=i)}return s}d(tp,"arrayFilter");var Nb=tp;function np(){return[]}d(np,"stubArray");var rp=np,Db=Object.prototype,Hb=Db.propertyIsEnumerable,Ac=Object.getOwnPropertySymbols,Ub=Ac?function(t){return t==null?[]:(t=Object(t),Nb(Ac(t),function(e){return Hb.call(t,e)}))}:rp,ip=Ub,Zb=Object.getOwnPropertySymbols,$b=Zb?function(t){for(var e=[];t;)zd(e,ip(t)),t=qd(t);return e}:rp,jb=$b;function ap(t,e,n){var r=e(t);return Lt(t)?r:zd(r,n(t))}d(ap,"baseGetAllKeys");var op=ap;function sp(t){return op(t,Oo,ip)}d(sp,"getAllKeys");var Cc=sp;function lp(t){return op(t,H_,jb)}d(lp,"getAllKeysIn");var Kb=lp,Lb=In(Ft,"DataView"),yo=Lb,Fb=In(Ft,"Promise"),mo=Fb,Wb=In(Ft,"Set"),ho=Wb,Oc="[object Map]",zb="[object Object]",Rc="[object Promise]",Mc="[object Set]",Nc="[object WeakMap]",Dc="[object DataView]",qb=kn(yo),Gb=kn($r),Vb=kn(mo),Jb=kn(ho),Xb=kn(po),_n=Sn;(yo&&_n(new yo(new ArrayBuffer(1)))!=Dc||$r&&_n(new $r)!=Oc||mo&&_n(mo.resolve())!=Rc||ho&&_n(new ho)!=Mc||po&&_n(new po)!=Nc)&&(_n=d(function(t){var e=Sn(t),n=e==zb?t.constructor:void 0,r=n?kn(n):"";if(r)switch(r){case qb:return Dc;case Gb:return Oc;case Vb:return Rc;case Jb:return Mc;case Xb:return Nc}return e},"getTag"));var Hc=_n,Yb=Ft.Uint8Array,Uc=Yb,Qb="__lodash_hash_undefined__";function up(t){return this.__data__.set(t,Qb),this}d(up,"setCacheAdd");var ew=up;function cp(t){return this.__data__.has(t)}d(cp,"setCacheHas");var tw=cp;function jr(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new pa;++e<n;)this.add(t[e])}d(jr,"SetCache");jr.prototype.add=jr.prototype.push=ew;jr.prototype.has=tw;var nw=jr;function fp(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(fp,"arraySome");var rw=fp;function dp(t,e){return t.has(e)}d(dp,"cacheHas");var iw=dp,aw=1,ow=2;function pp(t,e,n,r,a,s){var i=n&aw,o=t.length,l=e.length;if(o!=l&&!(i&&l>o))return!1;var f=s.get(t),p=s.get(e);if(f&&p)return f==e&&p==t;var y=-1,g=!0,h=n&ow?new nw:void 0;for(s.set(t,e),s.set(e,t);++y<o;){var w=t[y],P=e[y];if(r)var B=i?r(P,w,y,e,t,s):r(w,P,y,t,e,s);if(B!==void 0){if(B)continue;g=!1;break}if(h){if(!rw(e,function(v,S){if(!iw(h,S)&&(w===v||a(w,v,n,r,s)))return h.push(S)})){g=!1;break}}else if(!(w===P||a(w,P,n,r,s))){g=!1;break}}return s.delete(t),s.delete(e),g}d(pp,"equalArrays");var gp=pp;function yp(t){var e=-1,n=Array(t.size);return t.forEach(function(r,a){n[++e]=[a,r]}),n}d(yp,"mapToArray");var sw=yp;function mp(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}d(mp,"setToArray");var lw=mp,uw=1,cw=2,fw="[object Boolean]",dw="[object Date]",pw="[object Error]",gw="[object Map]",yw="[object Number]",mw="[object RegExp]",hw="[object Set]",vw="[object String]",Tw="[object Symbol]",_w="[object ArrayBuffer]",bw="[object DataView]",Zc=on?on.prototype:void 0,ao=Zc?Zc.valueOf:void 0;function hp(t,e,n,r,a,s,i){switch(n){case bw:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case _w:return!(t.byteLength!=e.byteLength||!s(new Uc(t),new Uc(e)));case fw:case dw:case yw:return Ao(+t,+e);case pw:return t.name==e.name&&t.message==e.message;case mw:case vw:return t==e+"";case gw:var o=sw;case hw:var l=r&uw;if(o||(o=lw),t.size!=e.size&&!l)return!1;var f=i.get(t);if(f)return f==e;r|=cw,i.set(t,e);var p=gp(o(t),o(e),r,a,s,i);return i.delete(t),p;case Tw:if(ao)return ao.call(t)==ao.call(e)}return!1}d(hp,"equalByTag");var ww=hp,xw=1,Pw=Object.prototype,Bw=Pw.hasOwnProperty;function vp(t,e,n,r,a,s){var i=n&xw,o=Cc(t),l=o.length,f=Cc(e),p=f.length;if(l!=p&&!i)return!1;for(var y=l;y--;){var g=o[y];if(!(i?g in e:Bw.call(e,g)))return!1}var h=s.get(t),w=s.get(e);if(h&&w)return h==e&&w==t;var P=!0;s.set(t,e),s.set(e,t);for(var B=i;++y<l;){g=o[y];var v=t[g],S=e[g];if(r)var E=i?r(S,v,g,e,t,s):r(v,S,g,t,e,s);if(!(E===void 0?v===S||a(v,S,n,r,s):E)){P=!1;break}B||(B=g=="constructor")}if(P&&!B){var H=t.constructor,K=e.constructor;H!=K&&"constructor"in t&&"constructor"in e&&!(typeof H=="function"&&H instanceof H&&typeof K=="function"&&K instanceof K)&&(P=!1)}return s.delete(t),s.delete(e),P}d(vp,"equalObjects");var Ew=vp,Sw=1,$c="[object Arguments]",jc="[object Array]",yi="[object Object]",kw=Object.prototype,Kc=kw.hasOwnProperty;function Tp(t,e,n,r,a,s){var i=Lt(t),o=Lt(e),l=i?jc:Hc(t),f=o?jc:Hc(e);l=l==$c?yi:l,f=f==$c?yi:f;var p=l==yi,y=f==yi,g=l==f;if(g&&go(t)){if(!go(e))return!1;i=!0,p=!1}if(g&&!p)return s||(s=new hi),i||cd(t)?gp(t,e,n,r,a,s):ww(t,e,l,n,r,a,s);if(!(n&Sw)){var h=p&&Kc.call(t,"__wrapped__"),w=y&&Kc.call(e,"__wrapped__");if(h||w){var P=h?t.value():t,B=w?e.value():e;return s||(s=new hi),a(P,B,n,r,s)}}return g?(s||(s=new hi),Ew(t,e,n,r,a,s)):!1}d(Tp,"baseIsEqualDeep");var Iw=Tp;function No(t,e,n,r,a){return t===e?!0:t==null||e==null||!Bn(t)&&!Bn(e)?t!==t&&e!==e:Iw(t,e,n,r,No,a)}d(No,"baseIsEqual");var ma=No,Aw=1,Cw=2;function _p(t,e,n,r){var a=n.length,s=a,i=!r;if(t==null)return!s;for(t=Object(t);a--;){var o=n[a];if(i&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++a<s;){o=n[a];var l=o[0],f=t[l],p=o[1];if(i&&o[2]){if(f===void 0&&!(l in t))return!1}else{var y=new hi;if(r)var g=r(f,p,l,t,e,y);if(!(g===void 0?ma(p,f,Aw|Cw,r,y):g))return!1}}return!0}d(_p,"baseIsMatch");var Ow=_p;function bp(t){return t===t&&!er(t)}d(bp,"isStrictComparable");var wp=bp;function xp(t){for(var e=Oo(t),n=e.length;n--;){var r=e[n],a=t[r];e[n]=[r,a,wp(a)]}return e}d(xp,"getMatchData");var Rw=xp;function Pp(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}d(Pp,"matchesStrictComparable");var Bp=Pp;function Ep(t){var e=Rw(t);return e.length==1&&e[0][2]?Bp(e[0][0],e[0][1]):function(n){return n===t||Ow(n,t,e)}}d(Ep,"baseMatches");var Mw=Ep;function Sp(t,e){return t!=null&&e in Object(t)}d(Sp,"baseHasIn");var Nw=Sp;function kp(t,e,n){e=ya(e,t);for(var r=-1,a=e.length,s=!1;++r<a;){var i=qr(e[r]);if(!(s=t!=null&&n(t,i)))break;t=t[i]}return s||++r!=a?s:(a=t==null?0:t.length,!!a&&Co(a)&&Io(i,a)&&(Lt(t)||id(t)))}d(kp,"hasPath");var Dw=kp;function Ip(t,e){return t!=null&&Dw(t,e,Nw)}d(Ip,"hasIn");var Hw=Ip,Uw=1,Zw=2;function Ap(t,e){return Ro(t)&&wp(e)?Bp(qr(t),e):function(n){var r=wb(n,t);return r===void 0&&r===e?Hw(n,t):ma(e,r,Uw|Zw)}}d(Ap,"baseMatchesProperty");var $w=Ap;function Cp(t){return function(e){return e?.[t]}}d(Cp,"baseProperty");var jw=Cp;function Op(t){return function(e){return Mo(e,t)}}d(Op,"basePropertyDeep");var Kw=Op;function Rp(t){return Ro(t)?jw(qr(t)):Kw(t)}d(Rp,"property");var Lw=Rp;function Mp(t){return typeof t=="function"?t:t==null?yT:typeof t=="object"?Lt(t)?$w(t[0],t[1]):Mw(t):Lw(t)}d(Mp,"baseIteratee");var Do=Mp;function Np(t){return function(e,n,r){for(var a=-1,s=Object(e),i=r(e),o=i.length;o--;){var l=i[t?o:++a];if(n(s[l],l,s)===!1)break}return e}}d(Np,"createBaseFor");var Fw=Np,Ww=Fw(),zw=Ww;function Dp(t,e){return t&&zw(t,e,Oo)}d(Dp,"baseForOwn");var qw=Dp;function Hp(t,e){return ma(t,e)}d(Hp,"isEqual");var Qn=Hp;function Up(t,e,n){n=typeof n=="function"?n:void 0;var r=n?n(t,e):void 0;return r===void 0?ma(t,e,void 0,n):!!r}d(Up,"isEqualWith");var Gw=Up;function Zp(t){return t===void 0}d(Zp,"isUndefined");var Lc=Zp;function $p(t,e){var n={};return e=Do(e,3),qw(t,function(r,a,s){qf(n,a,e(r,a,s))}),n}d($p,"mapValues");var Vw=$p,Jw="Expected a function";function jp(t){if(typeof t!="function")throw new TypeError(Jw);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(jp,"negate");var Xw=jp;function Kp(t,e,n,r){if(!er(t))return t;e=ya(e,t);for(var a=-1,s=e.length,i=s-1,o=t;o!=null&&++a<s;){var l=qr(e[a]),f=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(a!=i){var p=o[l];f=r?r(p,l,o):void 0,f===void 0&&(f=er(p)?p:Io(e[a+1])?[]:{})}ZT(o,l,f),o=o[l]}return t}d(Kp,"baseSet");var Yw=Kp;function Lp(t,e,n){for(var r=-1,a=e.length,s={};++r<a;){var i=e[r],o=Mo(t,i);n(o,i)&&Yw(s,ya(i,t),o)}return s}d(Lp,"basePickBy");var Qw=Lp;function Fp(t,e){if(t==null)return{};var n=Nf(Kb(t),function(r){return[r]});return e=Do(e),Qw(t,n,function(r,a){return e(r,a[0])})}d(Fp,"pickBy");var ex=Fp;function Wp(t,e){return ex(t,Xw(Do(e)))}d(Wp,"omitBy");var Fc=Wp,tx=d(t=>{let e=t.checks;return e.length===0?"":e.map(nx).join("")},"generateStringChecks"),nx=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"),rx=d(t=>{let e=t.checks;return e.length===0?"":e.map(ix).join("")},"generateNumberChecks"),ix=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"),ax=d(t=>{let e=t.checks;return e.length===0?"":e.map(ox).join("")},"generateBigIntChecks"),ox=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"),sx=d(t=>{let e=t.checks;return e.length===0?"":e.map(lx).join("")},"generateDateChecks"),lx=d(t=>{switch(t.kind){case"min":return`.min(${Wc(t.value)}, ${se(t.message)})`;case"max":return`.max(${Wc(t.value)}, ${se(t.message)})`;default:return""}},"_generateDateCheck"),Wc=d(t=>`new Date(${t})`,"dateTs"),ux=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"),cx=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 Ho(t){return Fe(t)}d(Ho,"toTypescriptSchema");function Fe(t){let n=t._def;switch(n.typeName){case M.ZodFirstPartyTypeKind.ZodString:return`z.string()${tx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNumber:return`z.number()${rx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNaN:return`z.nan()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBigInt:return`z.bigint()${ax(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBoolean:return`z.boolean()${Ce(n)}${Ae(t._def)}`.trim();case M.ZodFirstPartyTypeKind.ZodDate:return`z.date()${sx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodUndefined:return`z.undefined()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNull:return`z.null()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodAny:return`z.any()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodUnknown:return`z.unknown()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNever:return`z.never()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodVoid:return`z.void()${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodArray:return`z.array(${Fe(n.type)})${ux(n)}${Ce(n)}${Ae(n)}`;case M.ZodFirstPartyTypeKind.ZodObject:let r=Vw(n.shape(),Fe),a=t.additionalProperties(),s=a?`.catchall(${Fe(a)})`:"";return["z.object({",...Object.entries(r).map(([ee,ge])=>` ${ee}: ${ge},`),`})${s}${Ce(n)}${Ae(n)}`].join(`
23
+ `).trim();case M.ZodFirstPartyTypeKind.ZodUnion:return`z.union([${n.options.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:let o=n.options.map(Fe);return`z.discriminatedUnion(${se(n.discriminator)}, [${o.join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodIntersection:let f=Fe(n.left),p=Fe(n.right);return`z.intersection(${f}, ${p})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodTuple:return`z.tuple([${n.items.map(Fe).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodRecord:let g=Fe(n.keyType),h=Fe(n.valueType);return`z.record(${g}, ${h})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodMap:let w=Fe(n.keyType),P=Fe(n.valueType);return`z.map(${w}, ${P})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodSet:return`z.set(${Fe(n.valueType)})${cx(n)}${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodFunction:let B=n.args.items.map(Fe),v=B.length?`.args(${B.join(", ")})`:"",S=Fe(n.returns);return`z.function()${v}.returns(${S})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodLazy:return`z.lazy(() => ${Fe(n.getter())})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodLiteral:return`z.literal(${se(n.value)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return`z.enum([${n.values.map(se).join(", ")}])${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodEffects:throw new Tn(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new Tn(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return`z.optional(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodNullable:return`z.nullable(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodDefault:let K=Yn(n.defaultValue());return`z.default(${Fe(n.innerType)}, ${K})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodCatch:throw new Tn(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:return`z.promise(${Fe(n.type)})${Ce(n)}${Ae(n)}`.trim();case M.ZodFirstPartyTypeKind.ZodBranded:throw new Tn(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new Tn(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new Tn(M.ZodFirstPartyTypeKind.ZodSymbol);case M.ZodFirstPartyTypeKind.ZodReadonly:return`z.readonly(${Fe(n.innerType)})${Ce(n)}${Ae(n)}`.trim();case M.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=>`${fx(t)}${dx(t)}${px(t)}${gx(t)}${yx(t)}${mx(t)}${hx(t)}`,"_addZuiExtensions"),fx=d(t=>{var e;return(e=t[le])!=null&&e.title?`.title(${se(t[le].title)})`:""},"_maybeTitle"),dx=d(t=>{var e;return(e=t[le])!=null&&e.displayAs?`.displayAs(${tf({id:t[le].displayAs[0],params:t[le].displayAs[1]})})`:""},"_maybeDisplayAs"),px=d(t=>{var e;return(e=t[le])!=null&&e.disabled?`.disabled(${t[le].disabled})`:""},"_maybeDisabled"),gx=d(t=>{var e;return(e=t[le])!=null&&e.hidden?`.hidden(${t[le].hidden})`:""},"_maybeHidden"),yx=d(t=>{var e;return(e=t[le])!=null&&e.placeholder?`.placeholder(${se(t[le].placeholder)})`:""},"_maybePlaceholder"),mx=d(t=>{var e;return(e=t[le])!=null&&e.secret?".secret()":""},"_maybeSecret"),hx=d(t=>{var e;let n=["title","tooltip","displayAs","disabled","hidden","placeholder","secret","coerce"],r=Object.entries((e=t[le])!=null?e:{}).filter(([a])=>!n.includes(a));return r.length>0?`.metadata(${tf(Object.fromEntries(r))})`:""},"_maybeSetMetadata"),vx=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",a=n.inclusive?"exclusiveMinimum":"minimum";e[r]=n.value,delete e[a];break}case"max":{let r=n.inclusive?"maximum":"exclusiveMaximum",a=n.inclusive?"exclusiveMaximum":"maximum";e[r]=n.value,delete e[a];break}case"int":e.type="integer";break;case"finite":{e.format="finite";break}case"multipleOf":e.multipleOf=n.value;break;default:}return e},"zodNumberToJsonNumber"),zp="\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}",qp="(([+-]\\d{2}(:?\\d{2})?)|Z)",Tx="Z",Gp="(\\.\\d+)?",vo="\\.\\d{",_x="}",Vp=d(t=>{let e=t.precision?vo+t.precision+_x:t.precision===0?"":Gp,n=t.offset?qp:Tx;return new RegExp(`^${zp}${e}${n}$`)},"generateDatetimeRegex"),bx=d(t=>({precision:wx(t),offset:t.endsWith(`${qp}$`)}),"extractPrecisionAndOffset"),wx=d(t=>{let e=t.slice(1+zp.length);return e.startsWith(Gp)?null:e.startsWith(vo)?parseInt(e.slice(vo.length)):0},"_extractPrecision"),Hr={};oa(Hr,{escapeSpecialChars:()=>xx});var xx=d(t=>t.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeSpecialChars");function Uo(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage=N(b({},t.errorMessage),{[e]:n}))}d(Uo,"addErrorMessage");function Re(t,e,n,r,a){t[e]=n,Uo(t,e,r,a)}d(Re,"setResponseValueAndErrors");var Ye={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 Zo(t,e){let n=b({type:"string"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{});function r(a){return e.patternStrategy==="escape"?Hr.escapeSpecialChars(a):a}if(d(r,"processPattern"),t.checks)for(let a of t.checks)switch(a.kind){case"min":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,a.value):a.value,a.message,e);break;case"max":Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,a.value):a.value,a.message,e);break;case"email":switch(e.emailStrategy){case"format:email":vn(n,"email",a.message,e);break;case"format:idn-email":vn(n,"idn-email",a.message,e);break;case"pattern:zod":$t(n,Ye.email,a.message,e);break}break;case"url":vn(n,"uri",a.message,e);break;case"uuid":vn(n,"uuid",a.message,e);break;case"regex":$t(n,a.regex.source,a.message,e);break;case"cuid":$t(n,Ye.cuid,a.message,e);break;case"cuid2":$t(n,Ye.cuid2,a.message,e);break;case"startsWith":$t(n,"^"+r(a.value),a.message,e);break;case"endsWith":$t(n,r(a.value)+"$",a.message,e);break;case"datetime":vn(n,"date-time",a.message,e);break;case"length":Re(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,a.value):a.value,a.message,e),Re(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,a.value):a.value,a.message,e);break;case"includes":{$t(n,r(a.value),a.message,e);break}case"ip":{a.version!=="v6"&&vn(n,"ipv4",a.message,e),a.version!=="v4"&&vn(n,"ipv6",a.message,e);break}case"emoji":$t(n,Ye.emoji,a.message,e);break;case"ulid":{$t(n,Ye.ulid,a.message,e);break}case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}d(Zo,"parseStringDef");var vn=d((t,e,n,r)=>{var a;t.format||(a=t.anyOf)!=null&&a.some(s=>s.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"),$t=d((t,e,n,r)=>{var a;t.pattern||(a=t.allOf)!=null&&a.some(s=>s.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"),Px=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=Ye.cuid;break;case"cuid2":e.format="cuid2",e.pattern=Ye.cuid2;break;case"ulid":e.format="ulid",e.pattern=Ye.ulid;break;case"uuid":e.format="uuid",e.pattern=Ye.uuid;break;case"emoji":e.format="emoji",e.pattern=Ye.emoji;break;case"email":e.format="email",e.pattern=Ye.email;break;case"ip":e.format=n.version==="v6"?"ipv6":"ipv4",e.pattern=n.version==="v6"?Ye.ipv6:Ye.ipv4;break;case"datetime":e.format="date-time",e.pattern=Vp(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=`${Hr.escapeSpecialChars(n.value)}$`;break;case"startsWith":e.pattern=`^${Hr.escapeSpecialChars(n.value)}`;break;case"includes":let r=n.position&&n.position>=1?`^(?:.{${n.position}}).*`:"";e.pattern=`${r}${Hr.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 ff({zodType:M.ZodFirstPartyTypeKind.ZodString,checkKind:n.kind})}return e},"zodStringToJsonString"),Bx=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"),Ex=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"),Sx=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 M.ZodFirstPartyTypeKind.ZodString:return Px(e);case M.ZodFirstPartyTypeKind.ZodNumber:return vx(e);case M.ZodFirstPartyTypeKind.ZodNaN:throw new dt(M.ZodFirstPartyTypeKind.ZodNaN);case M.ZodFirstPartyTypeKind.ZodBigInt:throw new dt(M.ZodFirstPartyTypeKind.ZodBigInt,{suggestedAlternative:"serialize bigint to string"});case M.ZodFirstPartyTypeKind.ZodBoolean:return{type:"boolean",description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodDate:throw new dt(M.ZodFirstPartyTypeKind.ZodDate,{suggestedAlternative:"use z.string().datetime() instead"});case M.ZodFirstPartyTypeKind.ZodUndefined:return oo(n);case M.ZodFirstPartyTypeKind.ZodNull:return so(n);case M.ZodFirstPartyTypeKind.ZodAny:return{description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodUnknown:return{description:n.description,"x-zui":N(b({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUnknown}})};case M.ZodFirstPartyTypeKind.ZodNever:return{not:!0,description:n.description,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodVoid:throw new dt(M.ZodFirstPartyTypeKind.ZodVoid);case M.ZodFirstPartyTypeKind.ZodArray:return Bx(e,st);case M.ZodFirstPartyTypeKind.ZodObject:let r=Object.entries(n.shape()),a=r.filter(([p,y])=>!y.isOptional()),s=a.length?a.map(([p])=>p):void 0,i=r.map(([p,y])=>[p,y.mandatory()]).map(([p,y])=>[p,st(y)]),o=!1;return n.unknownKeys instanceof M.ZodType?o=st(n.unknownKeys):n.unknownKeys==="passthrough"&&(o=!0),{type:"object",description:n.description,properties:Object.fromEntries(i),required:s,additionalProperties:o,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return{description:n.description,anyOf:n.options.map(p=>st(p)),"x-zui":n["x-zui"]};case M.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 M.ZodFirstPartyTypeKind.ZodTuple:return Sx(e,st);case M.ZodFirstPartyTypeKind.ZodRecord:return{type:"object",description:n.description,additionalProperties:st(n.valueType),"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodMap:throw new dt(M.ZodFirstPartyTypeKind.ZodMap);case M.ZodFirstPartyTypeKind.ZodSet:return Ex(e,st);case M.ZodFirstPartyTypeKind.ZodFunction:throw new dt(M.ZodFirstPartyTypeKind.ZodFunction);case M.ZodFirstPartyTypeKind.ZodLazy:throw new dt(M.ZodFirstPartyTypeKind.ZodLazy);case M.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 so(n);if(n.value===void 0)return oo(n);{M.util.assertEqual(!0);let p=typeof n.value;throw new la(`Unsupported literal type: "${p}"`)}case M.ZodFirstPartyTypeKind.ZodEnum:return{type:"string",description:n.description,enum:n.values,"x-zui":n["x-zui"]};case M.ZodFirstPartyTypeKind.ZodEffects:throw new dt(M.ZodFirstPartyTypeKind.ZodEffects);case M.ZodFirstPartyTypeKind.ZodNativeEnum:throw new dt(M.ZodFirstPartyTypeKind.ZodNativeEnum);case M.ZodFirstPartyTypeKind.ZodOptional:return{description:n.description,anyOf:[st(n.innerType),oo()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodOptional}})};case M.ZodFirstPartyTypeKind.ZodNullable:return{anyOf:[st(n.innerType),so()],"x-zui":N(b({},n["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodNullable}})};case M.ZodFirstPartyTypeKind.ZodDefault:return N(b({},st(n.innerType)),{default:n.defaultValue()});case M.ZodFirstPartyTypeKind.ZodCatch:throw new dt(M.ZodFirstPartyTypeKind.ZodCatch);case M.ZodFirstPartyTypeKind.ZodPromise:throw new dt(M.ZodFirstPartyTypeKind.ZodPromise);case M.ZodFirstPartyTypeKind.ZodBranded:throw new dt(M.ZodFirstPartyTypeKind.ZodBranded);case M.ZodFirstPartyTypeKind.ZodPipeline:throw new dt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodSymbol:throw new dt(M.ZodFirstPartyTypeKind.ZodPipeline);case M.ZodFirstPartyTypeKind.ZodReadonly:return N(b({},st(n.innerType)),{readOnly:!0});case M.ZodFirstPartyTypeKind.ZodRef:return{$ref:n.uri,description:n.description,"x-zui":n["x-zui"]};default:M.util.assertNever(n)}}d(st,"toJSONSchema");var oo=d(t=>({not:!0,description:t?.description,"x-zui":N(b({},t?.["x-zui"]),{def:{typeName:M.ZodFirstPartyTypeKind.ZodUndefined}})}),"undefinedSchema"),so=d(t=>({type:"null",description:t?.description,"x-zui":t?.["x-zui"]}),"nullSchema"),Jp=class{constructor(e,n,r,a){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=a}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(Jp,"ParseInputLazyPath");var It=Jp,zc=d((t,e)=>{if(Lr(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 Kt(t.common.issues);return this._error=n,this._error}}},"handleResult"),Xp=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 rn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new vt,ctx:{common:e.parent.common,data:e.data,parsedType:rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ki(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 a={common:{issues:[],async:(r=n?.async)!=null?r:!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rn(e)},s=this._parseSync({data:e,path:a.path,parent:a});return zc(a,s)}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:rn(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(ki(a)?a:Promise.resolve(a));return zc(r,s)}refine(e,n){let r=d(a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n,"getIssueProperties");return this._refinement((a,s)=>{let i=e(a),o=d(()=>s.addIssue(b({code:G.custom},r(a))),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(e){return new En({schema:this,typeName:"ZodEffects",effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return an.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wr.create(this,this._def)}promise(){return Ta.create(this,this._def)}mandatory(){return this}or(e){return es.create([this,e],this._def)}and(e){return qo.create(this,e,this._def)}transform(e){return new En(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 ha(N(b({},me(this._def)),{innerType:this,defaultValue:n,typeName:"ZodDefault"}))}brand(){return new Lo(b({typeName:"ZodBranded",type:this},me(this._def)))}catch(e){let n=typeof e=="function"?e:()=>e;return new Fo(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 Qo.create(this,e)}readonly(){return _a.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}metadata(e){var n,r,a;let s=this.clone(),i=s._metadataRoot;(a=(n=i._def)[r=le])!=null||(n[r]={});for(let[o,l]of Object.entries(e))i._def[le]=N(b({},i._def[le]),{[o]:l});return s}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 Eo(this,e)}toTypescriptSchema(){return Ho(this)}naked(){return this}};d(Xp,"ZodType");var he=Xp,Yp=(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))(Yp||{}),be;(t=>{t.assertEqual=d(a=>a,"assertEqual");function e(a){}t.assertIs=e,d(e,"assertIs");function n(a){throw new Error("assertNever called")}t.assertNever=n,d(n,"assertNever"),t.arrayToEnum=d(a=>{let s={};for(let i of a)s[i]=i;return s},"arrayToEnum"),t.getValidEnumValues=d(a=>{let s=(0,t.objectKeys)(a).filter(o=>typeof a[a[o]]!="number"),i={};for(let o of s)i[o]=a[o];return(0,t.objectValues)(i)},"getValidEnumValues"),t.objectValues=d(a=>(0,t.objectKeys)(a).map(function(s){return a[s]}),"objectValues"),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},t.find=d((a,s)=>{for(let i of a)if(s(i))return i},"find"),t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=r,d(r,"joinValues"),t.jsonStringifyReplacer=d((a,s)=>typeof s=="bigint"?s.toString():s,"jsonStringifyReplacer"),t.compareFunctions=d((a,s)=>a.toString()===s.toString(),"compareFunctions"),t.mock=d(()=>({}),"mock")})(be||(be={}));var To;(t=>{t.mergeShapes=d((e,n)=>b(b({},e),n),"mergeShapes")})(To||(To={}));var ne=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rn=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:a}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a,[le]:t?.[le]}:{errorMap:d((i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:r??o.defaultError}:{message:n??o.defaultError},"customMap"),description:a,[le]:t?.[le]}}d(me,"processCreateParams");var $o=d((t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===ne.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.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 G.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 G.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 G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;case G.unresolved_reference:n="Unresolved reference";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},"errorMap"),qc=$o,G=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"]),kx=d(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ei=class Qp 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(s){return s.message},r={_errors:[]},a=d(s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,l=0;for(;l<i.path.length;){let f=i.path[l];l===i.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(n(i))):o[f]=o[f]||{_errors:[]},o=o[f],l++}}},"processError");return a(this),r}static assert(e){if(!(e instanceof Qp))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 a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};d(Ei,"ZodError");Ei.create=d(t=>new Ei(t),"create");var Kt=Ei,eg=$o;function tg(t){eg=t}d(tg,"setErrorMap");function Kr(){return eg}d(Kr,"getErrorMap");var Si=d(t=>{var e;let{data:n,path:r,errorMaps:a,issueData:s}=t,i=[...r,...s.path||[]],o=N(b({},s),{path:i}),l="",f=a.filter(p=>!!p).slice().reverse();for(let p of f)l=p(o,{data:n,defaultError:l}).message;return N(b({},s),{path:i,message:(e=s.message)!=null?e:l})},"makeIssue"),Ix=[];function te(t,e){let n=Si({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),$o].filter(r=>!!r)});t.common.issues.push(n)}d(te,"addIssueToContext");var ng=class rg{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 a of n){if(a.status==="aborted")return pe;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let a of n)r.push({key:await a.key,value:await a.value});return rg.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let a of n){let{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return pe;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[s.value]=i.value)}return{status:e.value,value:r}}};d(ng,"ParseStatus");var vt=ng,pe=Object.freeze({status:"aborted"}),Xn=d(t=>({status:"dirty",value:t}),"DIRTY"),pt=d(t=>({status:"valid",value:t}),"OK"),_o=d(t=>t.status==="aborted","isAborted"),bo=d(t=>t.status==="dirty","isDirty"),Lr=d(t=>t.status==="valid","isValid"),ki=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 Ii=class ig extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return pt(e.data)}isEqual(e){return e instanceof ig}};d(Ii,"ZodAny");Ii.create=d(t=>new Ii(b({typeName:"ZodAny"},me(t))),"create");var Fr=Ii,Ai=class bn extends he{dereference(e){return new bn(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new bn(N(b({},this._def),{type:this._def.type.clone()}))}isEqual(e){var n,r,a,s,i,o;return e instanceof bn?Qn((n=this._def.exactLength)==null?void 0:n.value,(r=e._def.exactLength)==null?void 0:r.value)&&Qn((a=this._def.maxLength)==null?void 0:a.value,(s=e._def.maxLength)==null?void 0:s.value)&&Qn((i=this._def.minLength)==null?void 0:i.value,(o=e._def.minLength)==null?void 0:o.value)&&this._def.type.isEqual(e._def.type):!1}_parse(e){let{ctx:n,status:r}=this._processInputParams(e),a=this._def;if(n.parsedType!==ne.array)return te(n,{code:G.invalid_type,expected:ne.array,received:n.parsedType}),pe;if(a.exactLength!==null){let i=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(i||o)&&(te(n,{code:i?G.too_big:G.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(te(n,{code:G.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(te(n,{code:G.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>a.type._parseAsync(new It(n,i,n.path,o)))).then(i=>vt.mergeArray(r,i));let s=[...n.data].map((i,o)=>a.type._parseSync(new It(n,i,n.path,o)));return vt.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new bn(N(b({},this._def),{minLength:{value:e,message:ue.toString(n)}}))}max(e,n){return new bn(N(b({},this._def),{maxLength:{value:e,message:ue.toString(n)}}))}length(e,n){return new bn(N(b({},this._def),{exactLength:{value:e,message:ue.toString(n)}}))}nonempty(e){return this.min(1,e)}};d(Ai,"ZodArray");Ai.create=d((t,e)=>new Ai(b({type:t,minLength:null,maxLength:null,exactLength:null,typeName:"ZodArray"},me(e))),"create");var Wr=Ai,Ax=d((t,e)=>ag(t,e,new WeakSet),"isEqual"),ag=d((t,e,n)=>Gw(t,e,Cx(n)),"_isEqualWithVisitedTracking"),Cx=d(t=>(e,n)=>{if(Ic(e)&&!t.has(e)&&Ic(n)&&!t.has(n)){let r=Fc(e,Lc),a=Fc(n,Lc);return t.add(r).add(a).add(e).add(n),ag(r,a,t)}},"_customizerWithVisitedTracking"),Ox={compare:Ax},og=class{constructor(e=[],n={}){this._options=b(b({},Ox),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(og,"CustomSet");var et=og,Ci=class vi 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 s=this._getOrReturnCtx(e);return te(s,{code:G.invalid_type,expected:ne.bigint,received:s.parsedType}),pe}let r,a=new vt;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):be.assertNever(s);return{status:a.value,value:e.data}}isEqual(e){if(!(e instanceof vi)||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,a){return new vi(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_addCheck(e){return new vi(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(Ci,"ZodBigInt");Ci.create=d(t=>{var e;return new Ci(b({checks:[],typeName:"ZodBigInt",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var jo=Ci,Oi=class sg extends he{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==ne.boolean){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.boolean,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof sg?this._def.coerce===e._def.coerce:!1}};d(Oi,"ZodBoolean");Oi.create=d(t=>new Oi(b({typeName:"ZodBoolean",coerce:t?.coerce||!1},me(t))),"create");var Ko=Oi,Rx=Symbol("zod_brand"),lg=class Pr extends he{dereference(e){return new Pr(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pr(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 Pr?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}mandatory(){return new Pr(N(b({},this._def),{type:this._def.type.mandatory()}))}};d(lg,"ZodBranded");var Lo=lg,Ri=class Br extends he{_parse(e){let{ctx:n}=this._processInputParams(e),r=N(b({},n),{common:N(b({},n.common),{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:b({},r)});return ki(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Kt(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Kt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}isEqual(e){return e instanceof Br?this._def.innerType.isEqual(e._def.innerType)&&be.compareFunctions(this._def.catchValue,e._def.catchValue):!1}dereference(e){return new Br(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Br(N(b({},this._def),{innerType:this._def.innerType.clone()}))}naked(){return this._def.innerType.naked()}mandatory(){return new Br(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Ri,"ZodCatch");Ri.create=d((t,e)=>new Ri(b({innerType:t,typeName:"ZodCatch",catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},me(e))),"create");var Fo=Ri,ug=d((t,e={},n)=>t?Fr.create().superRefine((r,a)=>{var s,i;if(!t(r)){let o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(i=(s=o.fatal)!=null?s:n)!=null?i:!0,f=typeof o=="string"?{message:o}:o;a.addIssue(N(b({code:"custom"},f),{fatal:l}))}}):Fr.create(),"custom"),Mi=class wo extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ne.date){let s=this._getOrReturnCtx(e);return te(s,{code:G.invalid_type,expected:ne.date,received:s.parsedType}),pe}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return te(s,{code:G.invalid_date}),pe}let r=new vt,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),te(a,{code:G.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),te(a,{code:G.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):be.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new wo(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 wo))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(Mi,"ZodDate");Mi.create=d(t=>new Mi(b({checks:[],coerce:t?.coerce||!1,typeName:"ZodDate"},me(t))),"create");var Wo=Mi,Ni=class Er 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 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()}))}isEqual(e){return e instanceof Er?this._def.innerType.isEqual(e._def.innerType)&&Qn(this._def.defaultValue(),e._def.defaultValue()):!1}unwrap(){return this._def.innerType}naked(){return this._def.innerType.naked()}mandatory(){return new Er(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Ni,"ZodDefault");Ni.create=d((t,e,n)=>new Ni(b({innerType:t,typeName:"ZodDefault",defaultValue:typeof e=="function"?e:()=>e},me(n))),"create");var ha=Ni,Wt=d(t=>Array.from(new Set(t)),"unique"),jt=d(t=>t instanceof Go?jt(t.schema):t instanceof En?jt(t.innerType()):t instanceof Vo?[t.value]:t instanceof or?t.options:t instanceof Jo?be.objectValues(t.enum):t instanceof ha?jt(t._def.innerType):t instanceof ba?[void 0]:t instanceof Xo?[null]:t instanceof an?[void 0,...jt(t.unwrap())]:t instanceof tr?[null,...jt(t.unwrap())]:t instanceof Lo||t instanceof _a?jt(t.unwrap()):t instanceof Fo?jt(t._def.innerType):[],"getDiscriminator"),cg=class wn extends he{dereference(e){let n=this.options.map(a=>a.dereference(e)),r=wn._getOptionsMap(this.discriminator,n);return new wn(N(b({},this._def),{options:n,optionsMap:r}))}getReferences(){return Wt(this.options.flatMap(e=>e.getReferences()))}clone(){let e=this.options.map(n=>n.clone());return new wn(N(b({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==ne.object)return te(n,{code:G.invalid_type,expected:ne.object,received:n.parsedType}),pe;let r=this.discriminator,a=n.data[r],s=this.optionsMap.get(a);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(te(n,{code:G.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 a=wn._getOptionsMap(e,n);return new wn(b({typeName:"ZodDiscriminatedUnion",discriminator:e,options:n,optionsMap:a},me(r)))}static _getOptionsMap(e,n){let r=new Map;for(let a of n){let s=jt(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,a)}}return r}isEqual(e){if(!(e instanceof wn)||this._def.discriminator!==e._def.discriminator)return!1;let n=d((s,i)=>s.isEqual(i),"compare"),r=new et(this._def.options,{compare:n}),a=new et(e._def.options,{compare:n});return r.isEqual(a)}};d(cg,"ZodDiscriminatedUnion");var fg=cg;function va(t,e){return new or(b({values:t,typeName:"ZodEnum"},me(e)))}d(va,"createZodEnum");var zo=class Ti 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:G.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:G.invalid_enum_value,options:r}),pe}return pt(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 Ti.create(e,b(b({},this._def),n))}exclude(e,n=this._def){return Ti.create(this.options.filter(r=>!e.includes(r)),b(b({},this._def),n))}isEqual(e){if(!(e instanceof Ti))return!1;let n=new et(this._def.values),r=new et(e._def.values);return n.isEqual(r)}};d(zo,"ZodEnum");zo.create=va;var or=zo,dg=class xn 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 xn(N(b({},this._def),{args:n,returns:r}))}getReferences(){return Wt([...this._def.args.getReferences(),...this._def.returns.getReferences()])}clone(){return new xn(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:G.invalid_type,expected:ne.function,received:n.parsedType}),pe;function r(o,l){return Si({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Kr(),qc].filter(f=>!!f),issueData:{code:G.invalid_arguments,argumentsError:l}})}d(r,"makeArgsIssue");function a(o,l){return Si({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Kr(),qc].filter(f=>!!f),issueData:{code:G.invalid_return_type,returnTypeError:l}})}d(a,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Ta){let o=this;return pt(async function(...l){let f=new Kt([]),p=await o._def.args.parseAsync(l,s).catch(h=>{throw f.addIssue(r(l,h)),f}),y=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(y,s).catch(h=>{throw f.addIssue(a(y,h)),f})})}else{let o=this;return pt(function(...l){let f=o._def.args.safeParse(l,s);if(!f.success)throw new Kt([r(l,f.error)]);let p=Reflect.apply(i,this,f.data),y=o._def.returns.safeParse(p,s);if(!y.success)throw new Kt([a(p,y.error)]);return y.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new xn(N(b({},this._def),{args:ir.create(e).rest(Ur.create())}))}returns(e){return new xn(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 xn(b({args:e||ir.create([]).rest(Ur.create()),returns:n||Ur.create(),typeName:"ZodFunction"},me(r)))}isEqual(e){return e instanceof xn&&this._def.args.isEqual(e._def.args)&&this._def.returns.isEqual(e._def.returns)}};d(dg,"ZodFunction");var pg=dg;function Di(t,e){let n=rn(t),r=rn(e);if(t===e)return{valid:!0,data:t};if(n===ne.object&&r===ne.object){let a=be.objectKeys(e),s=be.objectKeys(t).filter(o=>a.indexOf(o)!==-1),i=b(b({},t),e);for(let o of s){let l=Di(t[o],e[o]);if(!l.valid)return{valid:!1};i[o]=l.data}return{valid:!0,data:i}}else if(n===ne.array&&r===ne.array){if(t.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let i=t[s],o=e[s],l=Di(i,o);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return n===ne.date&&r===ne.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}d(Di,"mergeValues");var Hi=class _i extends he{dereference(e){return new _i(N(b({},this._def),{left:this._def.left.dereference(e),right:this._def.right.dereference(e)}))}getReferences(){return Wt([...this._def.left.getReferences(),...this._def.right.getReferences()])}clone(){return new _i(N(b({},this._def),{left:this._def.left.clone(),right:this._def.right.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=d((s,i)=>{if(_o(s)||_o(i))return pe;let o=Di(s.value,i.value);return o.valid?((bo(s)||bo(i))&&n.dirty(),{status:n.value,value:o.data}):(te(r,{code:G.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(([s,i])=>a(s,i)):a(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 _i))return!1;let n=d((s,i)=>s.isEqual(i),"compare"),r=new et([this._def.left,this._def.right],{compare:n}),a=new et([e._def.left,e._def.right],{compare:n});return r.isEqual(a)}};d(Hi,"ZodIntersection");Hi.create=d((t,e,n)=>new Hi(b({left:t,right:e,typeName:"ZodIntersection"},me(n))),"create");var qo=Hi,Ui=class Sr extends he{get schema(){return this._def.getter()}dereference(e){return new Sr(N(b({},this._def),{getter:d(()=>this._def.getter().dereference(e),"getter")}))}getReferences(){return this._def.getter().getReferences()}clone(){return new Sr(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 Sr?this._def.getter().isEqual(e._def.getter()):!1}naked(){return this._def.getter().naked()}mandatory(){return new Sr(N(b({},this._def),{getter:d(()=>this._def.getter().mandatory(),"getter")}))}};d(Ui,"ZodLazy");Ui.create=d((t,e)=>new Ui(b({getter:t,typeName:"ZodLazy"},me(e))),"create");var Go=Ui,Zi=class gg extends he{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return te(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),pe}return{status:"valid",value:e.data}}get value(){return this._def.value}isEqual(e){return e instanceof gg?Qn(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 Vo=Zi,$i=class bi 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 bi(N(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Wt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new bi(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:G.invalid_type,expected:ne.map,received:r.parsedType}),pe;let a=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([o,l],f)=>({key:a._parse(new It(r,o,r.path,[f,"key"])),value:s._parse(new It(r,l,r.path,[f,"value"]))}));if(r.common.async){let o=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(),o.set(f.value,p.value)}return{status:n.value,value:o}})}else{let o=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(),o.set(f.value,p.value)}return{status:n.value,value:o}}}isEqual(e){return!(!(e instanceof bi)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d($i,"ZodMap");$i.create=d((t,e,n)=>new $i(b({valueType:e,keyType:t,typeName:"ZodMap"},me(n))),"create");var yg=$i,ji=class mg extends he{_parse(e){if(this._getType(e)!==ne.nan){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.nan,received:r.parsedType}),pe}return{status:"valid",value:e.data}}isEqual(e){return e instanceof mg}};d(ji,"ZodNaN");ji.create=d(t=>new ji(b({typeName:"ZodNaN"},me(t))),"create");var hg=ji,Ki=class vg 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 a=be.objectValues(n);return te(r,{expected:be.joinValues(a),received:r.parsedType,code:G.invalid_type}),pe}if(n.indexOf(e.data)===-1){let a=be.objectValues(n);return te(r,{received:r.data,code:G.invalid_enum_value,options:a}),pe}return pt(e.data)}get enum(){return this._def.values}isEqual(e){return e instanceof vg?Qn(this._def.values,e._def.values):!1}};d(Ki,"ZodNativeEnum");Ki.create=d((t,e)=>new Ki(b({values:t,typeName:"ZodNativeEnum"},me(e))),"create");var Jo=Ki,Li=class Tg extends he{_parse(e){let n=this._getOrReturnCtx(e);return te(n,{code:G.invalid_type,expected:ne.never,received:n.parsedType}),pe}isEqual(e){return e instanceof Tg}};d(Li,"ZodNever");Li.create=d(t=>new Li(b({typeName:"ZodNever"},me(t))),"create");var Gr=Li,Fi=class _g extends he{_parse(e){if(this._getType(e)!==ne.null){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.null,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof _g}};d(Fi,"ZodNull");Fi.create=d(t=>new Fi(b({typeName:"ZodNull"},me(t))),"create");var Xo=Fi,Wi=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){return this._getType(e)===ne.null?pt(null):this._def.innerType._parse(e)}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(Wi,"ZodNullable");Wi.create=d((t,e)=>new Wi(b({innerType:t,typeName:"ZodNullable"},me(e))),"create");var tr=Wi;function bg(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=n>r?n:r,s=parseInt(t.toFixed(a).replace(".","")),i=parseInt(e.toFixed(a).replace(".",""));return s%i/Math.pow(10,a)}d(bg,"floatSafeRemainder");var zi=class wi 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 s=this._getOrReturnCtx(e);return te(s,{code:G.invalid_type,expected:ne.number,received:s.parsedType}),pe}let r,a=new vt;for(let s of this._def.checks)s.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:G.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?bg(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),te(r,{code:G.not_finite,message:s.message}),a.dirty()):be.assertNever(s);return{status:a.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,a){return new wi(N(b({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ue.toString(a)}]}))}_addCheck(e){return new wi(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 wi))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(zi,"ZodNumber");zi.create=d(t=>new zi(b({checks:[],typeName:"ZodNumber",coerce:t?.coerce||!1},me(t))),"create");var Yo=zi;function Pn(t){if(t instanceof nr){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=an.create(Pn(r))}return new nr(N(b({},t._def),{shape:d(()=>e,"shape")}))}else return t instanceof Wr?new Wr(N(b({},t._def),{type:Pn(t.element)})):t instanceof an?an.create(Pn(t.unwrap())):t instanceof tr?tr.create(Pn(t.unwrap())):t instanceof ir?ir.create(t.items.map(e=>Pn(e))):t}d(Pn,"deepPartialify");var sn=class ht 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 a in n)r[a]=n[a].dereference(e);return new ht(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 Wt(n)}clone(){let e={},n=this._def.shape();for(let[r,a]of Object.entries(n))e[r]=a.clone();return new ht(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:G.invalid_type,expected:ne.object,received:p.parsedType}),pe}let{status:r,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(this._def.unknownKeys!=="strip")for(let p in a.data)i.includes(p)||o.push(p);let l=[];for(let p of i){let y=s[p],g=a.data[p];l.push({key:{status:"valid",value:p},value:y._parse(new It(a,g,a.path,p)),alwaysSet:p in a.data})}let f=this._def.unknownKeys;if(f==="passthrough")for(let p of o)l.push({key:{status:"valid",value:p},value:{status:"valid",value:a.data[p]}});else if(f==="strict")o.length>0&&(te(a,{code:G.unrecognized_keys,keys:o}),r.dirty());else if(f!=="strip")for(let p of o){let y=a.data[p];l.push({key:{status:"valid",value:p},value:f._parse(new It(a,y,a.path,p)),alwaysSet:p in a.data})}return a.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=>vt.mergeObjectSync(r,p)):vt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ue.errToObj,new ht(b(N(b({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:d((n,r)=>{var a,s,i,o;let l=(i=(s=(a=this._def).errorMap)==null?void 0:s.call(a,n,r).message)!=null?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=ue.errToObj(e).message)!=null?o:l}:{message:l}},"errorMap")}:{}))}strip(){return new ht(N(b({},this._def),{unknownKeys:"strip"}))}passthrough(){return new ht(N(b({},this._def),{unknownKeys:"passthrough"}))}additionalProperties(){if(this._def.unknownKeys instanceof he)return this._def.unknownKeys;if(this._def.unknownKeys==="passthrough")return Fr.create();if(this._def.unknownKeys==="strict")return Gr.create()}extend(e){return new ht(N(b({},this._def),{shape:d(()=>b(b({},this._def.shape()),e),"shape")}))}merge(e){return new ht({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 ht(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 ht(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 ht(N(b({},this._def),{shape:d(()=>n,"shape")}))}deepPartial(){return Pn(this)}partial(e){let n={};return be.objectKeys(this.shape).forEach(r=>{let a=this.shape[r];e&&!e[r]?n[r]=a:n[r]=a?.optional()}),new ht(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 s=this.shape[r];for(;s instanceof an;)s=s._def.innerType;n[r]=s}}),new ht(N(b({},this._def),{shape:d(()=>n,"shape")}))}keyof(){return va(be.objectKeys(this.shape))}isEqual(e){if(!(e instanceof ht)||!this._unknownKeysEqual(e))return!1;let n=this._def.shape(),r=e._def.shape(),a=d((o,l)=>o[0]===l[0]&&o[1].isEqual(l[1]),"compare"),s=new et(Object.entries(n),{compare:a}),i=new et(Object.entries(r),{compare:a});return s.isEqual(i)}_unknownKeysEqual(e){let n=this.additionalProperties(),r=e.additionalProperties();return n===void 0||r===void 0?n===r:n.isEqual(r)}};d(sn,"ZodObject");sn.create=d((t,e)=>new sn(b({shape:d(()=>t,"shape"),unknownKeys:"strip",typeName:"ZodObject"},me(e))),"create");sn.strictCreate=d((t,e)=>new sn(b({shape:d(()=>t,"shape"),unknownKeys:"strict",typeName:"ZodObject"},me(e))),"strictCreate");sn.lazycreate=d((t,e)=>new sn(b({shape:t,unknownKeys:"strip",typeName:"ZodObject"},me(e))),"lazycreate");var nr=sn,qi=class xi extends he{dereference(e){return new xi(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new xi(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){return this._getType(e)===ne.undefined?pt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}isEqual(e){return e instanceof xi?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return this._def.innerType.mandatory()}};d(qi,"ZodOptional");qi.create=d((t,e)=>new qi(b({innerType:t,typeName:"ZodOptional"},me(e))),"create");var an=qi,wg=class Ir extends he{dereference(e){return new Ir(N(b({},this._def),{in:this._def.in.dereference(e),out:this._def.out.dereference(e)}))}getReferences(){return Wt([...this._def.in.getReferences(),...this._def.out.getReferences()])}clone(){return new Ir(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 s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?pe:s.status==="dirty"?(n.dirty(),Xn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})},"handleAsync")();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?pe:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,n){return new Ir({in:e,out:n,typeName:"ZodPipeline"})}isEqual(e){return!(!(e instanceof Ir)||!this._def.in.isEqual(e._def.in)||!this._def.out.isEqual(e._def.out))}};d(wg,"ZodPipeline");var Qo=wg,Gi=class Pi extends he{unwrap(){return this._def.type}dereference(e){return new Pi(N(b({},this._def),{type:this._def.type.dereference(e)}))}getReferences(){return this._def.type.getReferences()}clone(){return new Pi(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:G.invalid_type,expected:ne.promise,received:n.parsedType}),pe;let r=n.parsedType===ne.promise?n.data:Promise.resolve(n.data);return pt(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}isEqual(e){return e instanceof Pi?this._def.type.isEqual(e._def.type):!1}naked(){return this._def.type.naked()}};d(Gi,"ZodPromise");Gi.create=d((t,e)=>new Gi(b({type:t,typeName:"ZodPromise"},me(e))),"create");var Ta=Gi,Vi=class Ar extends he{dereference(e){return new Ar(N(b({},this._def),{innerType:this._def.innerType.dereference(e)}))}getReferences(){return this._def.innerType.getReferences()}clone(){return new Ar(N(b({},this._def),{innerType:this._def.innerType.clone()}))}_parse(e){let n=this._def.innerType._parse(e);return Lr(n)&&(n.value=Object.freeze(n.value)),n}unwrap(){return this._def.innerType}isEqual(e){return e instanceof Ar?this._def.innerType.isEqual(e._def.innerType):!1}naked(){return this._def.innerType.naked()}mandatory(){return new Ar(N(b({},this._def),{innerType:this._def.innerType.mandatory()}))}};d(Vi,"ZodReadonly");Vi.create=d((t,e)=>new Vi(b({innerType:t,typeName:"ZodReadonly"},me(e))),"create");var _a=Vi,xg=class Gn 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 Gn(N(b({},this._def),{keyType:n,valueType:r}))}getReferences(){return Wt([...this._def.keyType.getReferences(),...this._def.valueType.getReferences()])}clone(){return new Gn(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:G.invalid_type,expected:ne.object,received:r.parsedType}),pe;let a=[],s=this._def.keyType,i=this._def.valueType;for(let o in r.data)a.push({key:s._parse(new It(r,o,r.path,o)),value:i._parse(new It(r,r.data[o],r.path,o))});return r.common.async?vt.mergeObjectAsync(n,a):vt.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof he?new Gn(b({keyType:e,valueType:n,typeName:"ZodRecord"},me(r))):new Gn(b({keyType:gt.create(),valueType:e,typeName:"ZodRecord"},me(n)))}isEqual(e){return!(!(e instanceof Gn)||!this._def.keyType.isEqual(e._def.keyType)||!this._def.valueType.isEqual(e._def.valueType))}};d(xg,"ZodRecord");var Pg=xg,Ji=class Bg 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:G.unresolved_reference}),pe}isOptional(){return!1}isNullable(){return!1}isEqual(e){return e instanceof Bg?this._def.uri===e._def.uri:!1}};d(Ji,"ZodRef");Ji.create=d(t=>new Ji({typeName:"ZodRef",uri:t}),"create");var Eg=Ji,Xi=class Vn extends he{dereference(e){return new Vn(N(b({},this._def),{valueType:this._def.valueType.dereference(e)}))}getReferences(){return this._def.valueType.getReferences()}clone(){return new Vn(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:G.invalid_type,expected:ne.set,received:r.parsedType}),pe;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(te(r,{code:G.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(te(r,{code:G.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());let s=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 o=[...r.data.values()].map((l,f)=>s._parse(new It(r,l,r.path,f)));return r.common.async?Promise.all(o).then(l=>i(l)):i(o)}min(e,n){return new Vn(N(b({},this._def),{minSize:{value:e,message:ue.toString(n)}}))}max(e,n){return new Vn(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,a,s;if(!(e instanceof Vn))return!1;let i=(n=this._def.minSize)==null?void 0:n.value,o=(r=e._def.minSize)==null?void 0:r.value;if(i!==o)return!1;let l=(a=this._def.maxSize)==null?void 0:a.value,f=(s=e._def.maxSize)==null?void 0:s.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 Sg=Xi,kg=/^c[^\s-]{8,}$/i,Ig=/^[a-z][a-z0-9]*$/,Ag=/^[0-9A-HJKMNP-TV-Z]{26}$/,Cg=/^[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,Og=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Mx=d(t=>t===Rg,"isEmojiRegex"),lo,Mg=/^(((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}))$/,Ng=/^(([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 Dg(t,e){return!!((e==="v4"||!e)&&Mg.test(t)||(e==="v6"||!e)&&Ng.test(t))}d(Dg,"isValidIP");var Yi=class Jn extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ne.string){let s=this._getOrReturnCtx(e);return te(s,{code:G.invalid_type,expected:ne.string,received:s.parsedType}),pe}let r=new vt,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),te(a,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),te(a,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?te(a,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&te(a,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Og.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"email",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")lo||(lo=new RegExp(Rg,"u")),lo.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"emoji",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Cg.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"uuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")kg.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"cuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Ig.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"cuid2",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Ag.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"ulid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),te(a,{validation:"url",code:G.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"regex",code:G.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),te(a,{code:G.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),te(a,{code:G.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),te(a,{code:G.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Vp(s).test(e.data)||(a=this._getOrReturnCtx(e,a),te(a,{code:G.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="ip"?Dg(e.data,s.version)||(a=this._getOrReturnCtx(e,a),te(a,{validation:"ip",code:G.invalid_string,message:s.message}),r.dirty()):be.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(a=>e.test(a),b({validation:n,code:G.invalid_string},ue.errToObj(r)))}_addCheck(e){return new Jn(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 Jn(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 Jn(N(b({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new Jn(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 Jn))return!1;let n=new et(this._def.checks),r=new et(e._def.checks);return n.isEqual(r)}};d(Yi,"ZodString");Yi.create=d(t=>{var e;return new Yi(b({checks:[],typeName:"ZodString",coerce:(e=t?.coerce)!=null?e:!1},me(t)))},"create");var gt=Yi,Qi=class Hg extends he{_parse(e){if(this._getType(e)!==ne.symbol){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.symbol,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof Hg}};d(Qi,"ZodSymbol");Qi.create=d(t=>new Qi(b({typeName:"ZodSymbol"},me(t))),"create");var Ug=Qi,rr=class Cr 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 Cr(N(b({},this._def),{schema:this._def.schema.dereference(e)}))}getReferences(){return this._def.schema.getReferences()}clone(){return new Cr(N(b({},this._def),{schema:this._def.schema.clone()}))}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:d(i=>{te(r,i),i.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let i=a.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async o=>{if(n.value==="aborted")return pe;let l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?pe:l.status==="dirty"||n.value==="dirty"?Xn(l.value):l});{if(n.value==="aborted")return pe;let o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?pe:o.status==="dirty"||n.value==="dirty"?Xn(o.value):o}}if(a.type==="refinement"){let i=d(o=>{let l=a.refinement(o,s);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 o},"executeRefinement");if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?pe:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?pe:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Lr(i))return i;let o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Lr(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:n.value,value:o})):i);be.assertNever(a)}isEqual(e){return!(e instanceof Cr)||!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 Cr(N(b({},this._def),{schema:this._def.schema.mandatory()}))}};d(rr,"ZodEffects");rr.create=d((t,e,n)=>new rr(b({schema:t,typeName:"ZodEffects",effect:e},me(n))),"create");rr.createWithPreprocess=d((t,e,n)=>new rr(b({schema:e,effect:{type:"preprocess",transform:t},typeName:"ZodEffects"},me(n))),"createWithPreprocess");var En=rr,ea=class Or extends he{dereference(e){let n=this._def.items.map(a=>a.dereference(e)),r=this._def.rest?this._def.rest.dereference(e):null;return new Or(N(b({},this._def),{items:n,rest:r}))}getReferences(){return Wt([...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 Or(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:G.invalid_type,expected:ne.array,received:r.parsedType}),pe;if(r.data.length<this._def.items.length)return te(r,{code:G.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:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...r.data].map((i,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new It(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>vt.mergeArray(n,i)):vt.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Or(N(b({},this._def),{rest:e}))}isEqual(e){if(!(e instanceof Or)||!this._restEquals(e))return!1;let n=d((s,i)=>s.isEqual(i),"compare"),r=new et(this._def.items,{compare:n}),a=new et(e._def.items,{compare:n});return r.isEqual(a)}_restEquals(e){return this._def.rest===null?e._def.rest===null:e._def.rest!==null&&this._def.rest.isEqual(e._def.rest)}};d(ea,"ZodTuple");ea.create=d((t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ea(b({items:t,typeName:"ZodTuple",rest:null},me(e)))},"create");var ir=ea,ta=class Zg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.undefined,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof Zg}mandatory(){return Gr.create(b({},this._def))}};d(ta,"ZodUndefined");ta.create=d(t=>new ta(b({typeName:"ZodUndefined"},me(t))),"create");var ba=ta,na=class Rr extends he{dereference(e){let n=this._def.options.map(r=>r.dereference(e));return new Rr(N(b({},this._def),{options:n}))}getReferences(){return Wt(this._def.options.reduce((e,n)=>[...e,...n.getReferences()],[]))}clone(){let e=this._def.options.map(n=>n.clone());return new Rr(N(b({},this._def),{options:e}))}_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(o=>new Kt(o.ctx.common.issues));return te(n,{code:G.invalid_union,unionErrors:i}),pe}if(d(a,"handleResults"),n.common.async)return Promise.all(r.map(async s=>{let i=N(b({},n),{common:N(b({},n.common),{issues:[]}),parent:null});return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(a);{let s,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"&&!s&&(s={result:p,ctx:f}),f.common.issues.length&&i.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(l=>new Kt(l));return te(n,{code:G.invalid_union,unionErrors:o}),pe}}get options(){return this._def.options}isEqual(e){if(!(e instanceof Rr))return!1;let n=d((s,i)=>s.isEqual(i),"compare"),r=new et([...this._def.options],{compare:n}),a=new et([...e._def.options],{compare:n});return r.isEqual(a)}mandatory(){let e=this._def.options.filter(s=>!(s instanceof ba)).map(s=>s.mandatory()),[n,r,...a]=e;return n?r?new Rr(N(b({},this._def),{options:[n,r,...a]})):n:Gr.create(b({},this._def))}};d(na,"ZodUnion");na.create=d((t,e)=>new na(b({options:t,typeName:"ZodUnion"},me(e))),"create");var es=na,ra=class $g extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pt(e.data)}isEqual(e){return e instanceof $g}};d(ra,"ZodUnknown");ra.create=d(t=>new ra(b({typeName:"ZodUnknown"},me(t))),"create");var Ur=ra,ia=class jg extends he{_parse(e){if(this._getType(e)!==ne.undefined){let r=this._getOrReturnCtx(e);return te(r,{code:G.invalid_type,expected:ne.void,received:r.parsedType}),pe}return pt(e.data)}isEqual(e){return e instanceof jg}};d(ia,"ZodVoid");ia.create=d(t=>new ia(b({typeName:"ZodVoid"},me(t))),"create");var Kg=ia,Nx=["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"],DA=or.create(["any","string","number","boolean","object","pattern","date","array","target","time","enum"]),Dx=d(t=>gt.create().displayAs({id:"variable",params:b({type:t?.type||"any"},t?.params)}),"variable"),Hx=d(t=>gt.create().displayAs({id:"conversation",params:b({},t?.params)}),"conversation"),Ux=d(t=>gt.create().displayAs({id:"user",params:b({},t?.params)}),"user"),Zx=d(t=>gt.create().displayAs({id:"message",params:b({},t?.params)}),"message"),$x=d(t=>gt.create().displayAs({id:"agent",params:b({},t?.params)}),"agent"),jx=d(t=>gt.create().displayAs({id:"event",params:b({},t?.params)}),"event"),Kx=d(t=>gt.create().displayAs({id:"table",params:b({},t?.params)}),"table"),Lx=d(t=>gt.create().displayAs({id:"tablerow",params:b({},t?.params)}),"tablerow"),Fx=d(t=>gt.create().displayAs({id:"intent",params:b({},t?.params)}),"intent"),Wx=d(()=>or.create(Nx).displayAs({id:"dropdown",params:{}}),"aimodel"),zx=d(t=>gt.create().displayAs({id:"datasource",params:b({},t)}),"datasource"),qx=d(t=>gt.create().displayAs({id:"knowledgebase",params:b({},t)}),"knowledgebase"),Gx={object:nr.lazycreate},Vx=d((t,e={message:`Input not instance of ${t.name}`})=>ug(n=>n instanceof t,e),"instanceOfType"),Lg=gt.create,Fg=Yo.create,Jx=hg.create,Xx=jo.create,Wg=Ko.create,Yx=Wo.create,Qx=Ug.create,eP=ba.create,tP=Xo.create,nP=Fr.create,rP=Ur.create,iP=Gr.create,aP=Kg.create,oP=Wr.create,sP=nr.create,lP=nr.strictCreate,uP=es.create,cP=fg.create,fP=qo.create,dP=ir.create,pP=Pg.create,gP=Eg.create,yP=_a.create,mP=yg.create,hP=Sg.create,vP=pg.create,TP=Go.create,_P=Vo.create,bP=or.create,wP=Jo.create,xP=Ta.create,Gc=En.create,PP=an.create,BP=tr.create,EP=ha.create,SP=En.createWithPreprocess,kP=Qo.create,IP=d(()=>Lg().optional(),"ostring"),AP=d(()=>Fg().optional(),"onumber"),CP=d(()=>Wg().optional(),"oboolean"),OP={string:d(t=>gt.create(N(b({},t),{coerce:!0})),"string"),number:d(t=>Yo.create(N(b({},t),{coerce:!0})),"number"),boolean:d(t=>Ko.create(N(b({},t),{coerce:!0})),"boolean"),bigint:d(t=>jo.create(N(b({},t),{coerce:!0})),"bigint"),date:d(t=>Wo.create(N(b({},t),{coerce:!0})),"date")},RP=pe,M=Y,zg=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"),MP=d(t=>{var e;return(e=t[le])!=null&&e.coerce?"z.coerce.boolean()":"z.boolean()"},"parseBoolean"),NP=d(t=>"z.any()","parseDefault"),DP=d((t,e)=>`z.union([${t.type.map(n=>it(N(b({},t),{type:n}),e)).join(", ")}])`,"parseMultipleType"),HP=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"),UP=d(t=>"z.null()","parseNull"),ZP=d(t=>[t.slice(0,t.length/2),t.slice(t.length/2)],"half"),$P=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 a=t[e],s="";if(a!==void 0){let i=n({value:a,json:JSON.stringify(a)});if(i){let o=i[0],l=i.length===3?i[1]:"",f=i.length===3?i[2]:i[1];s+=o,((r=t.errorMessage)==null?void 0:r[e])!==void 0&&(s+=l+JSON.stringify(t.errorMessage[e])),s+=f}}return s}d(ut,"withMessage");var Mr=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?{[Mr]:n}:{[Mr]:n,not:{}});else{if(Mr in r)return t;e.push(N(b({},r),{[Mr]:n}))}}return e},"ensureOriginalIndex");function zr(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[Mr]]}))}else{let[n,r]=ZP(jP(t.allOf));return`z.intersection(${zr({allOf:n},e)}, ${zr({allOf:r},e)})`}}d(zr,"parseAllOf");var KP=d((t,e)=>{if(Array.isArray(t.items))return`z.tuple([${t.items.map((r,a)=>it(r,N(b({},e),{path:[...e.path,"items",a]})))}])`;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"),LP=d(t=>`z.literal(${JSON.stringify(t.const)})`,"parseConst"),FP=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"),WP=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"]})),a=it(t.else,N(b({},e),{path:[...e.path,"else"]}));return`z.union([${r}, ${a}]).superRefine((value,ctx) => {
24
24
  const result = ${n}.safeParse(value).success
25
25
  ? ${r}.safeParse(value)
26
26
  : ${a}.safeParse(value);
@@ -76,16 +76,16 @@ ${v}`.trim();case M.ZodFirstPartyTypeKind.ZodEnum:return o.values.map(se).join("
76
76
  `,a+=`}
77
77
  `,a+=`}
78
78
  `),a+=`}
79
- `,a+="})"}let s=n?a?n+a:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:a||(r?`z.record(${r})`:"z.record(z.any())");return Xe.an.anyOf(t)&&(s+=`.and(${zg(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)})`),Xe.a.oneOf(t)&&(s+=`.and(${ts(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)})`),Xe.an.allOf(t)&&(s+=`.and(${zr(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)})`),s}d(qg,"parseObject");var qP=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"),GP=d((t,e)=>`${it(ZP(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),VP=d(t=>`z.ref('${t.$ref}')`,"parseRef"),JP=d((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return ts(t,e);let a=t.oneOf.map((s,i)=>it(s,N(b({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${a.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 s=e.parserOverride(t,e);if(typeof s=="string")return s}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 a=QP(t,e);return n||(a=XP(t,a),e.withoutDefaults||(a=YP(t,a))),r.r=a,a},"parseSchema"),XP=d((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),YP=d((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),QP=d((t,e)=>Xe.a.nullable(t)?GP(t,e):Xe.an.object(t)?qg(t,e):Xe.an.array(t)?KP(t,e):Xe.an.anyOf(t)?zg(t,e):Xe.an.allOf(t)?zr(t,e):Xe.a.discriminator(t)?JP(t,e):Xe.a.oneOf(t)?ts(t,e):Xe.a.not(t)?HP(t,e):Xe.an.enum(t)?FP(t):Xe.a.const(t)?LP(t):Xe.a.multipleType(t)?DP(t,e):Xe.a.primitive(t,"string")?qP(t):Xe.a.primitive(t,"number")||Xe.a.primitive(t,"integer")?zP(t):Xe.a.primitive(t,"boolean")?MP(t):Xe.a.primitive(t,"null")?UP(t):Xe.a.conditional(t)?WP(t,e):Xe.a.ref(t)?VP(t):NP(t),"selectParser"),Xe={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=>Boolean("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")}},eB=d(t=>{let e;try{e=new Function("z",`return ${t}`)(M)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof M.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),tB=d(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),nB=d(t=>{let e=tB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=eB(e);if(!n.sucess)throw new sa(n.error);return n.value},"jsonSchemaToZod"),Nr=d((t,e)=>{var n,r;if(e[le]&&t._def&&(t._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([a,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[a]&&Nr(i[a],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Nr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let a=e.items;if(typeof a=="object"&&!Array.isArray(a)){let s=t._def.type;s&&Nr(s,a)}else Array.isArray(a)&&a.forEach((s,i)=>{let o=t._def;o.typeName===ne.ZodFirstPartyTypeKind.ZodTuple&&Nr(o.items[i],s)})}},"applyZuiPropsRecursively"),rB=d(t=>{let e=nB(t);return Nr(e,t),e},"fromJSONSchemaLegacy"),iB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Gg(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),aB=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)===M.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),Gg=d(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),oB=d(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),sB=d(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:a,multipleOf:s,format:i})=>{let o=M.number();return t==="integer"&&(o=o.int()),i==="finite"&&(o=o.finite()),n!==void 0?o=o.gt(n):e!==void 0&&(o=o.gte(e)),a!==void 0?o=o.lt(a):r!==void 0&&(o=o.lte(r)),s!==void 0&&(o=o.multipleOf(s)),o},"numberJSONSchemaToZuiNumber"),lB=d(({format:t,pattern:e,minLength:n,maxLength:r})=>{let a=M.string();if(n&&r&&n===r?a=a.length(n):(n&&(a=a.min(n)),r&&(a=a.max(r))),t==="cuid"||e===Ye.cuid)a=a.cuid();else if(t==="cuid2"||e===Ye.cuid2)a=a.cuid2();else if(t==="emoji"||e===Ye.emoji)a=a.emoji();else if(t==="ulid"||e===Ye.ulid)a=a.ulid();else if(t==="date-time"){let{precision:s,offset:i}=e?bx(e):{};a=a.datetime({precision:s,offset:i})}else t==="email"||e===Ye.email?a=a.email():t==="ipv4"||e===Ye.ipv4?a=a.ip():t==="ipv6"||e===Ye.ipv6?a=a.ip("v6"):t==="uri"?a=a.url():t==="uuid"||e===Ye.uuid?a=a.uuid():e&&(a=a.regex(new RegExp(e)));return a},"stringJSONSchemaToZuiString"),xr=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),[a]=r;if(!a){if(t==="string"&&e.type==="string")return lB(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return sB(e);if(t==="boolean")return M.boolean();if(t==="null")return M.null();throw new sa(`Unknown primitive type: "${t}"`)}if(r.length===1)return M.literal(a);let s=r.map(i=>M.literal(i));return M.union(s)},"toZuiPrimitive"),uB=d((t,e)=>cB(t)?dB(t,e):fB(t)?pB(t,e):gB(t,e),"arrayJSONSchemaToZuiArray"),cB=d(t=>Array.isArray(t.items),"_isTuple"),fB=d(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),dB=d(({items:t,additionalItems:e},n)=>{let r=t.map(n),a=M.tuple(r);return e!==void 0&&(a=a.rest(n(e))),a},"_handleTuple"),pB=d(({items:t,minItems:e,maxItems:n},r)=>{let a=M.set(r(t));return e&&(a=a.min(e)),n&&(a=a.max(n)),a},"_handleSet"),gB=d(({minItems:t,maxItems:e,items:n},r)=>{let a=M.array(r(n));return t&&t===e?a.length(t):(t&&(a=a.min(t)),e&&(a=a.max(e)),a)},"_handleArray"),zn=M.any();function Vg(t){return rt(t)}d(Vg,"fromJSONSchema");function rt(t){var e;if(t===void 0)return zn;if(t===!0)return M.any();if(t===!1)return M.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 nn({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new nn({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new nn({propertyNames:t.propertyNames});if(t.if!==void 0)throw new nn({if:t.if});if(t.then!==void 0)throw new nn({then:t.then});if(t.else!==void 0)throw new nn({else:t.else});if(t.$ref!==void 0)return M.ref(t.$ref);if(t.not!==void 0){if(Gg(t))return M.undefined();if(t.not===!0)return M.never();throw new nn({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,a=Qc(n,["type"]),s=t.type.map(i=>rt(N(b({},a),{type:i})));return M.union(s)}if(t.type==="string")return t.enum&&t.enum.length>0?M.enum(t.enum):xr("string",t);if(t.type==="integer"){let n=xr("number",t);return n instanceof M.ZodNumber?n.int():n}if(t.type==="number")return xr("number",t);if(t.type==="boolean")return xr("boolean",t);if(t.type==="null")return xr("null",t);if(t.type==="array")return uB(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,a]of Object.entries(t.properties)){let s=rt(a),i=(e=t.required)!=null?e:[];n[r]=i.includes(r)?s:s.optional()}return M.object(n)}if(t.additionalProperties!==void 0){let n=rt(t.additionalProperties);return M.record(n)}return M.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(iB(t))return rt(t.anyOf[0]).optional();if(aB(t))return rt(t.anyOf[0]).nullable();let n=t.anyOf.map(rt);return M.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,a=rt(n),s=rt({allOf:r});return M.intersection(a,s)}return oB(t)?M.unknown():zn}d(rt,"_fromJSONSchema");var yB=/^\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))?$/,xo=d((t,e,n=!0)=>{if(typeof t!="object")throw new co("Input must be an object");let r=d(i=>{let o=i;return e?.nullable&&(o=o.nullable()),e?.optional&&(o=o.optional()),e?.passtrough&&typeof o.passthrough=="function"&&(o=o.passthrough()),o},"applyOptions"),a=Object.entries(t).reduce((i,[o,l])=>{if(l===null)i[o]=r(ne.null());else switch(typeof l){case"string":i[o]=yB.test(l)?r(ne.string().datetime()):r(ne.string());break;case"number":i[o]=r(ne.number());break;case"boolean":i[o]=r(ne.boolean());break;case"object":Array.isArray(l)?l.length===0?i[o]=r(ne.array(ne.unknown())):typeof l[0]=="object"?i[o]=r(ne.array(xo(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[o]=r(ne.array(ne[typeof l[0]]()))):i[o]=r(xo(l,e,!1));break;default:throw new co(`Unsupported type for key ${o}`)}return i},{}),s=Object.keys(a).length>0;return e?.passtrough||!n&&!s?ne.object(a).passthrough():ne.object(a)},"fromObject");function Jg(){return{}}d(Jg,"parseAnyDef");function Xg(t,e){var n,r;let a={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!=="ZodAny"&&(a.items=Ie(t.type._def,N(b({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Re(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(a,"minItems",t.exactLength.value,t.exactLength.message,e),Re(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}d(Xg,"parseArrayDef");function Yg(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(Yg,"parseBigintDef");function Qg(t){return b({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(Qg,"parseBooleanDef");function ey(t,e){return Ie(t.type._def,e)}d(ey,"parseBrandedDef");var mB=d((t,e)=>Ie(t.innerType._def,e),"parseCatchDef");function ty(t,e){return e.dateStrategy=="integer"?hB(t,e):b({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(ty,"parseDateDef");var hB=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 ny(t,e){return N(b({},Ie(t.innerType._def,e)),{default:t.defaultValue()})}d(ny,"parseDefaultDef");function ry(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):{}}d(ry,"parseEffectsDef");function iy(t){return{type:"string",enum:t.values}}d(iy,"parseEnumDef");var vB=d(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function ay(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(s=>!!s),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return n.forEach(s=>{if(vB(s))a.push(...s.allOf),s.unevaluatedProperties===void 0&&(r=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let o=s,{additionalProperties:l}=o;i=Qc(o,["additionalProperties"])}else r=void 0;a.push(i)}}),a.length?b({allOf:a},r):void 0}d(ay,"parseIntersectionDef");function oy(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(oy,"parseLiteralDef");function ns(t,e){var n,r,a,s,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 o={type:"object",additionalProperties:(r=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return o;if(((a=t.keyType)==null?void 0:a._def.typeName)==="ZodString"&&((s=t.keyType._def.checks)!=null&&s.length)){let l=Object.entries($o(t.keyType._def,e)).reduce((f,[p,y])=>p==="type"?f:N(b({},f),{[p]:y}),{});return N(b({},o),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(b({},o),{propertyNames:{enum:t.keyType._def.values}});return o}d(ns,"parseRecordDef");function sy(t,e){if(e.mapStrategy==="record")return ns(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(sy,"parseMapDef");function ly(t){let e=t.values,r=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),a=Array.from(new Set(r.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:r.filter(s=>typeof s=="string"||typeof s=="number")}}d(ly,"parseNativeEnumDef");function uy(){return{not:{}}}d(uy,"parseNeverDef");function cy(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}d(cy,"parseNullDef");var aa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fy(t,e){if(e.target==="openApi3")return Vc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in aa&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((a,s)=>{let i=aa[s._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((a,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(r.length===n.length){let a=r.filter((s,i,o)=>o.indexOf(s)===i);return{type:a.length>1?a:a[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,a)=>[...r,...a._def.values.filter(s=>!r.includes(s))],[])};return Vc(t,e)}d(fy,"parseUnionDef");var Vc=d((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,s)=>Ie(a._def,N(b({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).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 dy(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 s={type:aa[r._def.typeName],nullable:!0};return Po(r._def,e,s)}let a={type:[aa[r._def.typeName],"null"]};return Po(r._def,e,a)}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(dy,"parseNullableDef");function py(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",Uo(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(py,"parseNumberDef");var TB=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 gy(t,e){let n=N(b({type:"object"},Object.entries(t.shape()).reduce((r,[a,s])=>{if(s===void 0||s._def===void 0)return r;let i=Ie(s._def,N(b({},e),{currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]}));return i===void 0?r:{properties:N(b({},r.properties),{[a]:i}),required:s.isOptional()?r.required:[...r.required,a]}},{properties:{},required:[]})),{additionalProperties:TB(t,e)});return n.required.length||delete n.required,n}d(gy,"parseObjectDef");var _B=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"),bB=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(a=>a!==void 0)}},"parsePipelineDef");function yy(t,e){return Ie(t.type._def,e)}d(yy,"parsePromiseDef");function my(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(my,"parseSetDef");function hy(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(hy,"parseTupleDef");function vy(){return{not:{}}}d(vy,"parseUndefinedDef");function Ty(){return{}}d(Ty,"parseUnknownDef");var wB=d((t,e)=>Ie(t.innerType._def,e),"parseReadonlyDef");function _y(t){return{$ref:t.uri}}d(_y,"parseRefDef");function Ie(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=xB(r,e);if(i!==void 0)return i}let a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);let s=BB(t,t.typeName,e);return s&&Po(t,e,s),a.jsonSchema=s,s}d(Ie,"parseDef");var xB=d((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:PB(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"),PB=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"),BB=d((t,e,n)=>{switch(e){case"ZodString":return $o(t,n);case"ZodNumber":return py(t,n);case"ZodObject":return gy(t,n);case"ZodBigInt":return Yg(t,n);case"ZodBoolean":return Qg(t);case"ZodDate":return ty(t,n);case"ZodUndefined":return vy();case"ZodNull":return cy(n);case"ZodArray":return Xg(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return fy(t,n);case"ZodIntersection":return ay(t,n);case"ZodTuple":return hy(t,n);case"ZodRecord":return ns(t,n);case"ZodRef":return _y(t);case"ZodLiteral":return oy(t,n);case"ZodEnum":return iy(t);case"ZodNativeEnum":return ly(t);case"ZodNullable":return dy(t,n);case"ZodOptional":return _B(t,n);case"ZodMap":return sy(t,n);case"ZodSet":return my(t,n);case"ZodLazy":return Ie(t.getter()._def,n);case"ZodPromise":return yy(t,n);case"ZodNaN":case"ZodNever":return uy();case"ZodEffects":return ry(t,n);case"ZodAny":return Jg();case"ZodUnknown":return Ty();case"ZodDefault":return ny(t,n);case"ZodBranded":return ey(t,n);case"ZodReadonly":return wB(t,n);case"ZodCatch":return mB(t,n);case"ZodPipeline":return bB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),Po=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"),Jc={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"},EB=d(t=>typeof t=="string"?N(b({},Jc),{name:t}):b(b({},Jc),t),"getDefaultOptions"),SB=d(t=>{let e=EB(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,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),kB=d((t,e)=>{var n;let r=SB(e),a=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,s=typeof e=="string"?e:e?.name,i=(n=Ie(t._def,s===void 0?r:N(b({},r),{currentPath:[...r.basePath,r.definitionPath,s]}),!1))!=null?n:{},o=s===void 0?a?N(b({},i),{[r.definitionPath]:a}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:N(b({},a),{[s]:i})};return r.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),o},"zodToJsonSchema"),IB=d((t,e={target:"openApi3"})=>{let n=kB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy");var Vr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===ne.ZodFirstPartyTypeKind.ZodObject&&r.typeName===ne.ZodFirstPartyTypeKind.ZodObject){let a=n.shape(),s=r.shape();return ne.object({...a,...s})}if(n.typeName===ne.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===ne.ZodFirstPartyTypeKind.ZodRecord)return ne.record(ne.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},by=ne;var yt=ne.string().min(1),xy=ne.object({text:yt}),Py=ne.object({markdown:yt}),By=ne.object({imageUrl:yt}),Ey=ne.object({audioUrl:yt}),Sy=ne.object({videoUrl:yt}),ky=ne.object({fileUrl:yt,title:yt.optional()}),Iy=ne.object({latitude:ne.number(),longitude:ne.number(),address:ne.string().optional(),title:ne.string().optional()}),Ay=ne.object({title:yt,subtitle:yt.optional(),imageUrl:yt.optional(),actions:ne.array(ne.object({action:ne.enum(["postback","url","say"]),label:yt,value:yt}))}),wy=ne.object({text:yt,options:ne.array(ne.object({label:yt,value:yt}))}),AB=ne.object({items:ne.array(Ay)}),CB=ne.union([ne.object({type:ne.literal("text"),payload:xy}),ne.object({type:ne.literal("markdown"),payload:Py}),ne.object({type:ne.literal("image"),payload:By}),ne.object({type:ne.literal("audio"),payload:Ey}),ne.object({type:ne.literal("video"),payload:Sy}),ne.object({type:ne.literal("file"),payload:ky}),ne.object({type:ne.literal("location"),payload:Iy})]),OB=ne.object({items:ne.array(CB)}),RB={schema:Py},MB={text:{schema:xy},image:{schema:By},audio:{schema:Ey},video:{schema:Sy},file:{schema:ky},location:{schema:Iy},carousel:{schema:AB},card:{schema:Ay},dropdown:{schema:wy},choice:{schema:wy},bloc:{schema:OB}};C();R();O();var wa="x-bot-id",Oy="x-bot-user-id",Ry="x-integration-id",My="x-webhook-id",Ny="x-bp-configuration-type",xa="x-bp-configuration",Pa="x-bp-operation",Dy="x-bp-type",XA={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};C();R();O();import{isNode as Nk}from"browser-or-node";C();R();O();var rs=console;function Ct(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function za(t,e=8072,n=$k){if(!Nk)throw new Error("This function can only be called in Node.js");let a=(Mh(),Zv(Rh)).createServer(async(s,i)=>{try{let o=await Dk(s);if(o.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(o);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(o){rs.error("Error while handling request",{error:o?.message??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:o?.message??"Internal error occured"}))}});return a.listen(e,()=>n(e)),a}async function Dk(t){let e=await Uk(t),n={};for(let a=0;a<t.rawHeaders.length;a+=2){let s=t.rawHeaders[a].toLowerCase(),i=t.rawHeaders[a+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:Hk(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function Hk(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function Uk(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",a=>r+=a.toString()),t.on("error",a=>n(a)),t.on("end",()=>e(r))})}function $k(t){rs.info(`Listening on port ${t}`)}import{isApiError as tU,RuntimeError as nU}from"@botpress/client";C();R();O();C();R();O();C();R();O();C();R();O();var Le={};Fn(Le,{mapKeys:()=>Kk,mapValues:()=>jk,mergeRecords:()=>Fk,pairs:()=>qa,stripUndefinedProps:()=>Lk,values:()=>Zk});C();R();O();var qa=t=>Object.entries(t),Zk=t=>Object.values(t),jk=(t,e)=>Object.fromEntries(qa(t).map(([n,r])=>[n,e(r,n)])),Kk=(t,e)=>Object.fromEntries(qa(t).map(([n,r])=>[e(n),r])),Lk=t=>Object.fromEntries(qa(t).filter(([,e])=>e!==void 0)),Fk=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],a=[...new Set(r)],s={};for(let i of a){let o=t[i],l=e[i];o&&l?s[i]=n(o,l):o?s[i]=o:l&&(s[i]=l)}return s};var ye={};Fn(ye,{safePush:()=>Wk,unique:()=>zk});C();R();O();var Wk=(t,...e)=>t?[...t,...e]:[...e],zk=t=>Array.from(new Set(t));C();R();O();var Qt={};Fn(Qt,{setName:()=>qk});C();R();O();var qk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Nh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},a={name:e,version:n,entities:Le.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=Le.mapValues(t.entities,i=>i.schema);for(let[i,o]of Object.entries(t.definition.actions??{})){let l=o.input.schema.dereference(s),f=o.output.schema.dereference(s),p=t.actions?.[i]?.name??i;r.actions[p]={...o,...t.actions?.[i]??{},input:{schema:l},output:{schema:f}},a.actions[i]={name:p}}for(let[i,o]of Object.entries(t.definition.events??{})){let l=o.schema.dereference(s),f=t.events?.[i]?.name??i;r.events[f]={...o,...t.events?.[i]??{},schema:l},a.events[i]={name:f}}for(let[i,o]of Object.entries(t.definition.channels??{})){let l={};for(let[p,y]of Object.entries(o.messages)){let g=y.schema.dereference(s);l[p]={...y,schema:g}}let f=t.channels?.[i]?.name??i;r.channels[f]={...o,...t.channels?.[i]??{},message:{...o.message??{},tags:{...o.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...o.conversation??{},tags:{...o.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},a.channels[i]={name:f}}return{resolved:r,statement:a}};C();R();O();var Ga=Symbol("schemaName"),Dh=t=>t?Le.mapValues(t,(n,r)=>({...n,[Ga]:r})):{},Hh=t=>Ga in t&&t[Ga]!==void 0,Uh=t=>t[Ga];C();R();O();var el=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;extend(e,n){let{entities:r,actions:a,events:s,channels:i}=this._callBuilder(e,n),o=this;o.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(a),events:Le.stripUndefinedProps(s),channels:Le.stripUndefinedProps(i)});return o.actions=Le.mergeRecords(o.actions??{},p.actions,this._mergeActions),o.channels=Le.mergeRecords(o.channels??{},p.channels,this._mergeChannels),o.events=Le.mergeRecords(o.events??{},p.events,this._mergeEvents),o.interfaces[f]={id:e.id,...y},this}_callBuilder(e,n){let a={entities:Dh(this.entities)},s=n(a),i=Le.pairs(s.entities).find(([l,f])=>!Hh(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(s.entities,l=>({name:Uh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:Vr(e.input.schema,n.input.schema)},output:{schema:Vr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:Vr(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=Le.mergeRecords(e.messages,n.messages,this._mergeMessage),a;(e.conversation||n.conversation)&&(a={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:a,message:s}};_mergeMessage=(e,n)=>({schema:Vr(e.schema,n.schema)})};C();R();O();C();R();O();import{isApiError as PI,Client as BI,RuntimeError as wv}from"@botpress/client";C();R();O();import*as $h from"@botpress/client";var Va={retries:3,retryCondition:t=>$h.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(Gk(e.response?.headers??{})??t)*1e3},Gk=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 Vk(String(r))}},Vk=t=>{let e=Jk(t)?Xk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},Jk=t=>t.includes(" "),Xk=t=>{let e=Yk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},Yk=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};C();R();O();C();R();O();var ii=class{constructor(e){this._client=e}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);updateMessage=e=>this._client.updateMessage(e);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)};C();R();O();var Ja=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};C();R();O();C();R();O();var mr="#";var Qk=ne.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Zh=t=>{let e=t[wa],n=t[Oy],r=t[Ry],a=t[My],s=t[Ny],i=t[xa],o=Qk.parse(t[Pa]);if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing bot user headers");if(!r)throw new Error("Missing integration headers");if(!a)throw new Error("Missing webhook headers");if(!i)throw new Error("Missing configuration headers");if(!o)throw new Error("Missing operation headers");return{botId:e,botUserId:n,integrationId:r,webhookId:a,operation:o,configurationType:s??null,configuration:i?JSON.parse(q.from(i,"base64").toString("utf-8")):{}}};C();R();O();C();R();O();C();R();O();C();R();O();var nl={},jh=!1;function wl(){return jh||(jh=!0,nl=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 a=42;e[n]=a;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 s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==a||i.enumerable!==!0)return!1}return!0}),nl}var rl={},Kh=!1;function eI(){return Kh||(Kh=!0,rl=Error),rl}var il={},Lh=!1;function tI(){return Lh||(Lh=!0,il=EvalError),il}var al={},Fh=!1;function nI(){return Fh||(Fh=!0,al=RangeError),al}var ol={},Wh=!1;function rI(){return Wh||(Wh=!0,ol=ReferenceError),ol}var sl={},zh=!1;function lv(){return zh||(zh=!0,sl=SyntaxError),sl}var ll={},qh=!1;function Xa(){return qh||(qh=!0,ll=TypeError),ll}var ul={},Gh=!1;function iI(){return Gh||(Gh=!0,ul=URIError),ul}var cl={},Vh=!1;function aI(){if(Vh)return cl;Vh=!0;var t=typeof Symbol<"u"&&Symbol,e=wl();return cl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},cl}var fl={},Jh=!1;function oI(){if(Jh)return fl;Jh=!0;var t={__proto__:null,foo:{}},e=Object;return fl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},fl}var dl={},Xh=!1;function sI(){if(Xh)return dl;Xh=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",a=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},s=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(o,l){for(var f="",p=0;p<o.length;p+=1)f+=o[p],p+1<o.length&&(f+=l);return f};return dl=function(l){var f=this;if(typeof f!="function"||e.apply(f)!==r)throw new TypeError(t+f);for(var p=s(arguments,1),y,g=function(){if(this instanceof y){var v=f.apply(this,a(p,arguments));return Object(v)===v?v:this}return f.apply(l,a(p,arguments))},h=n(0,f.length-p.length),w=[],P=0;P<h;P++)w[P]="$"+P;if(y=Function("binder","return function ("+i(w,",")+"){ return binder.apply(this,arguments); }")(g),f.prototype){var B=function(){};B.prototype=f.prototype,y.prototype=new B,B.prototype=null}return y},dl}var pl={},Yh=!1;function xl(){if(Yh)return pl;Yh=!0;var t=sI();return pl=Function.prototype.bind||t,pl}var gl={},Qh=!1;function lI(){if(Qh)return gl;Qh=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=xl();return gl=n.call(t,e),gl}var yl={},ev=!1;function oi(){if(ev)return yl;ev=!0;var t,e=eI(),n=tI(),r=nI(),a=rI(),s=lv(),i=Xa(),o=iI(),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=aI()(),w=oI()(),P=Object.getPrototypeOf||(w?function(Ue){return Ue.__proto__}:null),B={},v=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%":a,"%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%":s,"%ThrowTypeError%":g,"%TypedArray%":v,"%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%":o,"%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},K={__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"]},ae=xl(),Q=lI(),ge=ae.call(Function.call,Array.prototype.concat),oe=ae.call(Function.apply,Array.prototype.splice),re=ae.call(Function.call,String.prototype.replace),Oe=ae.call(Function.call,String.prototype.slice),ze=ae.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 s("invalid intrinsic syntax, expected closing `%`");if(fe==="%"&&Se!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var ve=[];return re(Pe,tt,function(D,j,F,de){ve[ve.length]=F?re(de,Ve,"$1"):j||D}),ve},mt=function(Pe,Se){var fe=Pe,ve;if(Q(K,fe)&&(ve=K[fe],fe="%"+ve[0]+"%"),Q(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 s("intrinsic "+Pe+" does not exist!")};return yl=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 s("`%` 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=mt("%"+ve+"%",Se),j=D.name,F=D.value,de=!1,Te=D.alias;Te&&(ve=Te[0],oe(fe,ge([0,1],Te)));for(var A=1,k=!0;A<fe.length;A+=1){var Z=fe[A],X=Oe(Z,0,1),ie=Oe(Z,-1);if((X==='"'||X==="'"||X==="`"||ie==='"'||ie==="'"||ie==="`")&&X!==ie)throw new s("property names with quotes must have matching quotes");if((Z==="constructor"||!k)&&(de=!0),ve+="."+Z,j="%"+ve+"%",Q(S,j))F=S[j];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&&A+1>=fe.length){var _=p(F,Z);k=!!_,k&&"get"in _&&!("originalValue"in _.get)?F=_.get:F=F[Z]}else k=Q(F,Z),F=F[Z];k&&!de&&(S[j]=F)}}return F},yl}var ml={},tv=!1;function Pl(){if(tv)return ml;tv=!0;var t=oi(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ml=e,ml}var hl={},nv=!1;function Ya(){if(nv)return hl;nv=!0;var t=oi(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return hl=e,hl}var vl={},rv=!1;function uI(){if(rv)return vl;rv=!0;var t=Pl(),e=lv(),n=Xa(),r=Ya();return vl=function(s,i,o){if(!s||typeof s!="object"&&typeof s!="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(s,i);if(t)t(s,i,{configurable:p===null&&g?g.configurable:!p,enumerable:l===null&&g?g.enumerable:!l,value:o,writable:f===null&&g?g.writable:!f});else if(y||!l&&!f&&!p)s[i]=o;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},vl}var Tl={},iv=!1;function cI(){if(iv)return Tl;iv=!0;var t=Pl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},Tl=e,Tl}var _l={},av=!1;function fI(){if(av)return _l;av=!0;var t=oi(),e=uI(),n=cI()(),r=Ya(),a=Xa(),s=t("%Math.floor%");return _l=function(o,l){if(typeof o!="function")throw new a("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new a("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],p=!0,y=!0;if("length"in o&&r){var g=r(o,"length");g&&!g.configurable&&(p=!1),g&&!g.writable&&(y=!1)}return(p||y||!f)&&(n?e(o,"length",l,!0,!0):e(o,"length",l)),o},_l}var ai={},ov=!1;function Bl(){if(ov)return ai;ov=!0;var t=xl(),e=oi(),n=fI(),r=Xa(),a=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,a),o=Pl(),l=e("%Math.max%");ai=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,s,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var f=function(){return i(t,a,arguments)};return o?o(ai,"apply",{value:f}):ai.apply=f,ai}var bl={},sv=!1;function El(){if(sv)return bl;sv=!0;var t=oi(),e=Bl(),n=e(t("String.prototype.indexOf"));return bl=function(a,s){var i=t(a,!!s);return typeof i=="function"&&n(a,".prototype.")>-1?e(i):i},bl}is();bs();var Sl={},uv=!1;function Hl(){if(uv)return Sl;uv=!0;var t=wl();return Sl=function(){return t()&&!!Symbol.toStringTag},Sl}var kl={},cv=!1;function dI(){if(cv)return kl;cv=!0;var t=Hl()(),e=El(),n=e("Object.prototype.toString"),r=function(o){return t&&o&&typeof o=="object"&&Symbol.toStringTag in o?!1:n(o)==="[object Arguments]"},a=function(o){return r(o)?!0:o!==null&&typeof o=="object"&&typeof o.length=="number"&&o.length>=0&&n(o)!=="[object Array]"&&n(o.callee)==="[object Function]"},s=function(){return r(arguments)}();return r.isLegacyArguments=a,kl=s?r:a,kl}var Il={},fv=!1;function pI(){if(fv)return Il;fv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Hl()(),a=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Il=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(!a)return!1;if(typeof i>"u"){var p=s();i=p?a(p):!1}return a(l)===i},Il}var Al={},dv=!1;function gI(){if(dv)return Al;dv=!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 a=/^\s*class\b/,s=function(E){try{var H=t.call(E);return a.test(H)}catch{return!1}},i=function(E){try{return s(E)?!1:(t.call(E),!0)}catch{return!1}},o=Object.prototype.toString,l="[object Object]",f="[object Function]",p="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",h="[object HTMLCollection]",w=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var v=document.all;o.call(v)===o.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var H=o.call(E);return(H===y||H===g||H===h||H===l)&&E("")==null}catch{}return!1})}return Al=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!s(E)&&i(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(w)return i(E);if(s(E))return!1;var H=o.call(E);return H!==f&&H!==p&&!/^\[object HTML/.test(H)?!1:i(E)},Al}var Cl={},pv=!1;function yI(){if(pv)return Cl;pv=!0;var t=gI(),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))},a=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)},s=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"?a(l,f,y):s(l,f,y)};return Cl=i,Cl}var Ol={},gv=!1;function mI(){return gv||(gv=!0,Ol=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ol}var Rl={},yv=!1,hI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function vI(){if(yv)return Rl;yv=!0;var t=mI(),e=typeof globalThis>"u"?hI:globalThis;return Rl=function(){for(var r=[],a=0;a<t.length;a++)typeof e[t[a]]=="function"&&(r[r.length]=t[a]);return r},Rl}var Ml={},mv=!1,TI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function bv(){if(mv)return Ml;mv=!0;var t=yI(),e=vI(),n=Bl(),r=El(),a=Ya(),s=r("Object.prototype.toString"),i=Hl()(),o=typeof globalThis>"u"?TI:globalThis,l=e(),f=r("String.prototype.slice"),p=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,v){for(var S=0;S<B.length;S+=1)if(B[S]===v)return S;return-1},g={__proto__:null};i&&a&&p?t(l,function(P){var B=new o[P];if(Symbol.toStringTag in B){var v=p(B),S=a(v,Symbol.toStringTag);if(!S){var E=p(v);S=a(E,Symbol.toStringTag)}g["$"+P]=n(S.get)}}):t(l,function(P){var B=new o[P],v=B.slice||B.set;v&&(g["$"+P]=n(v))});var h=function(B){var v=!1;return t(g,function(S,E){if(!v)try{"$"+S(B)===E&&(v=f(E,1))}catch{}}),v},w=function(B){var v=!1;return t(g,function(S,E){if(!v)try{S(B),v=f(E,1)}catch{}}),v};return Ml=function(B){if(!B||typeof B!="object")return!1;if(!i){var v=f(s(B),8,-1);return y(l,v)>-1?v:v!=="Object"?!1:w(B)}return a?h(B):null},Ml}var Nl={},hv=!1;function _I(){if(hv)return Nl;hv=!0;var t=bv();return Nl=function(n){return!!t(n)},Nl}var we={},vv=!1;function bI(){if(vv)return we;vv=!0;var t=dI(),e=pI(),n=bv(),r=_I();function a($){return $.call.bind($)}var s=typeof BigInt<"u",i=typeof Symbol<"u",o=a(Object.prototype.toString),l=a(Number.prototype.valueOf),f=a(String.prototype.valueOf),p=a(Boolean.prototype.valueOf);if(s)var y=a(BigInt.prototype.valueOf);if(i)var g=a(Symbol.prototype.valueOf);function h($,kt){if(typeof $!="object")return!1;try{return kt($),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function w($){return typeof Promise<"u"&&$ instanceof Promise||$!==null&&typeof $=="object"&&typeof $.then=="function"&&typeof $.catch=="function"}we.isPromise=w;function P($){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView($):r($)||D($)}we.isArrayBufferView=P;function B($){return n($)==="Uint8Array"}we.isUint8Array=B;function v($){return n($)==="Uint8ClampedArray"}we.isUint8ClampedArray=v;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 K($){return n($)==="Int16Array"}we.isInt16Array=K;function ae($){return n($)==="Int32Array"}we.isInt32Array=ae;function Q($){return n($)==="Float32Array"}we.isFloat32Array=Q;function ge($){return n($)==="Float64Array"}we.isFloat64Array=ge;function oe($){return n($)==="BigInt64Array"}we.isBigInt64Array=oe;function re($){return n($)==="BigUint64Array"}we.isBigUint64Array=re;function Oe($){return o($)==="[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 o($)==="[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 o($)==="[object WeakMap]"}Je.working=typeof WeakMap<"u"&&Je(new WeakMap);function mt($){return typeof WeakMap>"u"?!1:Je.working?Je($):$ instanceof WeakMap}we.isWeakMap=mt;function Ue($){return o($)==="[object WeakSet]"}Ue.working=typeof WeakSet<"u"&&Ue(new WeakSet);function Pe($){return Ue($)}we.isWeakSet=Pe;function Se($){return o($)==="[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 o($)==="[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 j=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F($){return o($)==="[object SharedArrayBuffer]"}function de($){return typeof j>"u"?!1:(typeof F.working>"u"&&(F.working=F(new j)),F.working?F($):$ instanceof j)}we.isSharedArrayBuffer=de;function Te($){return o($)==="[object AsyncFunction]"}we.isAsyncFunction=Te;function A($){return o($)==="[object Map Iterator]"}we.isMapIterator=A;function k($){return o($)==="[object Set Iterator]"}we.isSetIterator=k;function Z($){return o($)==="[object Generator]"}we.isGeneratorObject=Z;function X($){return o($)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=X;function ie($){return h($,l)}we.isNumberObject=ie;function _($){return h($,f)}we.isStringObject=_;function x($){return h($,p)}we.isBooleanObject=x;function z($){return s&&h($,y)}we.isBigIntObject=z;function Y($){return i&&h($,g)}we.isSymbolObject=Y;function Me($){return ie($)||_($)||x($)||z($)||Y($)}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 Dl={},Tv=!1;function wI(){return Tv||(Tv=!0,Dl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Dl}var xe={},_v=!1,si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function xI(){if(_v)return xe;_v=!0;var t=At,e=Object.getOwnPropertyDescriptors||function(j){for(var F=Object.keys(j),de={},Te=0;Te<F.length;Te++)de[F[Te]]=Object.getOwnPropertyDescriptor(j,F[Te]);return de},n=/%[sdj%]/g;xe.format=function(D){if(!K(D)){for(var j=[],F=0;F<arguments.length;F++)j.push(i(arguments[F]));return j.join(" ")}for(var F=1,de=arguments,Te=de.length,A=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)||!oe(k)?A+=" "+k:A+=" "+i(k);return A},xe.deprecate=function(D,j){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,j).apply(this||si,arguments)};var F=!1;function de(){if(!F){if(t.throwDeprecation)throw new Error(j);t.traceDeprecation?console.trace(j):console.error(j),F=!0}return D.apply(this||si,arguments)}return de};var r={},a=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+s+"$","i")}xe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(a.test(D)){var j=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,j,F)}}else r[D]=function(){};return r[D]};function i(D,j){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),v(j)?F.showHidden=j:j&&xe._extend(F,j),Q(F.showHidden)&&(F.showHidden=!1),Q(F.depth)&&(F.depth=2),Q(F.colors)&&(F.colors=!1),Q(F.customInspect)&&(F.customInspect=!0),F.colors&&(F.stylize=o),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 o(D,j){var F=i.styles[j];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,j){return D}function f(D){var j={};return D.forEach(function(F,de){j[F]=!0}),j}function p(D,j,F){if(D.customInspect&&j&&ze(j.inspect)&&j.inspect!==xe.inspect&&!(j.constructor&&j.constructor.prototype===j)){var de=j.inspect(F,D);return K(de)||(de=p(D,de,F)),de}var Te=y(D,j);if(Te)return Te;var A=Object.keys(j),k=f(A);if(D.showHidden&&(A=Object.getOwnPropertyNames(j)),Oe(j)&&(A.indexOf("message")>=0||A.indexOf("description")>=0))return g(j);if(A.length===0){if(ze(j)){var Z=j.name?": "+j.name:"";return D.stylize("[Function"+Z+"]","special")}if(ge(j))return D.stylize(RegExp.prototype.toString.call(j),"regexp");if(re(j))return D.stylize(Date.prototype.toString.call(j),"date");if(Oe(j))return g(j)}var X="",ie=!1,_=["{","}"];if(B(j)&&(ie=!0,_=["[","]"]),ze(j)){var x=j.name?": "+j.name:"";X=" [Function"+x+"]"}if(ge(j)&&(X=" "+RegExp.prototype.toString.call(j)),re(j)&&(X=" "+Date.prototype.toUTCString.call(j)),Oe(j)&&(X=" "+g(j)),A.length===0&&(!ie||j.length==0))return _[0]+X+_[1];if(F<0)return ge(j)?D.stylize(RegExp.prototype.toString.call(j),"regexp"):D.stylize("[Object]","special");D.seen.push(j);var z;return ie?z=h(D,j,F,k,A):z=A.map(function(Y){return w(D,j,F,k,Y,ie)}),D.seen.pop(),P(z,X,_)}function y(D,j){if(Q(j))return D.stylize("undefined","undefined");if(K(j)){var F="'"+JSON.stringify(j).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(j))return D.stylize(""+j,"number");if(v(j))return D.stylize(""+j,"boolean");if(S(j))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,j,F,de,Te){for(var A=[],k=0,Z=j.length;k<Z;++k)Pe(j,String(k))?A.push(w(D,j,F,de,String(k),!0)):A.push("");return Te.forEach(function(X){X.match(/^\d+$/)||A.push(w(D,j,F,de,X,!0))}),A}function w(D,j,F,de,Te,A){var k,Z,X;if(X=Object.getOwnPropertyDescriptor(j,Te)||{value:j[Te]},X.get?X.set?Z=D.stylize("[Getter/Setter]","special"):Z=D.stylize("[Getter]","special"):X.set&&(Z=D.stylize("[Setter]","special")),Pe(de,Te)||(k="["+Te+"]"),Z||(D.seen.indexOf(X.value)<0?(S(F)?Z=p(D,X.value,null):Z=p(D,X.value,F-1),Z.indexOf(`
80
- `)>-1&&(A?Z=Z.split(`
79
+ `,a+="})"}let s=n?a?n+a:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:a||(r?`z.record(${r})`:"z.record(z.any())");return Xe.an.anyOf(t)&&(s+=`.and(${zg(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)})`),Xe.a.oneOf(t)&&(s+=`.and(${ts(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)})`),Xe.an.allOf(t)&&(s+=`.and(${zr(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)})`),s}d(qg,"parseObject");var qP=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"),GP=d((t,e)=>`${it($P(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),VP=d(t=>`z.ref('${t.$ref}')`,"parseRef"),JP=d((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return ts(t,e);let a=t.oneOf.map((s,i)=>it(s,N(b({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${a.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 s=e.parserOverride(t,e);if(typeof s=="string")return s}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 a=QP(t,e);return n||(a=XP(t,a),e.withoutDefaults||(a=YP(t,a))),r.r=a,a},"parseSchema"),XP=d((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),YP=d((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),QP=d((t,e)=>Xe.a.nullable(t)?GP(t,e):Xe.an.object(t)?qg(t,e):Xe.an.array(t)?KP(t,e):Xe.an.anyOf(t)?zg(t,e):Xe.an.allOf(t)?zr(t,e):Xe.a.discriminator(t)?JP(t,e):Xe.a.oneOf(t)?ts(t,e):Xe.a.not(t)?HP(t,e):Xe.an.enum(t)?FP(t):Xe.a.const(t)?LP(t):Xe.a.multipleType(t)?DP(t,e):Xe.a.primitive(t,"string")?qP(t):Xe.a.primitive(t,"number")||Xe.a.primitive(t,"integer")?zP(t):Xe.a.primitive(t,"boolean")?MP(t):Xe.a.primitive(t,"null")?UP(t):Xe.a.conditional(t)?WP(t,e):Xe.a.ref(t)?VP(t):NP(t),"selectParser"),Xe={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=>Boolean("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")}},eB=d(t=>{let e;try{e=new Function("z",`return ${t}`)(M)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof M.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),tB=d(t=>it(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),nB=d(t=>{let e=tB(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=eB(e);if(!n.sucess)throw new sa(n.error);return n.value},"jsonSchemaToZod"),Nr=d((t,e)=>{var n,r;if(e[le]&&t._def&&(t._def[le]=e[le]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([a,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[a]&&Nr(i[a],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&Nr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let a=e.items;if(typeof a=="object"&&!Array.isArray(a)){let s=t._def.type;s&&Nr(s,a)}else Array.isArray(a)&&a.forEach((s,i)=>{let o=t._def;o.typeName===Y.ZodFirstPartyTypeKind.ZodTuple&&Nr(o.items[i],s)})}},"applyZuiPropsRecursively"),rB=d(t=>{let e=nB(t);return Nr(e,t),e},"fromJSONSchemaLegacy"),iB=d(t=>{var e,n;return t.anyOf!==void 0&&t.anyOf.length===2&&t.anyOf.some(r=>typeof r!="boolean"&&Gg(r))&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodOptional},"isOptionalSchema"),aB=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)===M.ZodFirstPartyTypeKind.ZodNullable},"isNullableSchema"),Gg=d(t=>{var e,n;return t.not===!0&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodUndefined},"isUndefinedSchema"),oB=d(t=>{var e,n;return!t.not&&((n=(e=t["x-zui"])==null?void 0:e.def)==null?void 0:n.typeName)===M.ZodFirstPartyTypeKind.ZodUnknown},"isUnknownSchema"),sB=d(({type:t,minimum:e,exclusiveMinimum:n,maximum:r,exclusiveMaximum:a,multipleOf:s,format:i})=>{let o=M.number();return t==="integer"&&(o=o.int()),i==="finite"&&(o=o.finite()),n!==void 0?o=o.gt(n):e!==void 0&&(o=o.gte(e)),a!==void 0?o=o.lt(a):r!==void 0&&(o=o.lte(r)),s!==void 0&&(o=o.multipleOf(s)),o},"numberJSONSchemaToZuiNumber"),lB=d(({format:t,pattern:e,minLength:n,maxLength:r})=>{let a=M.string();if(n&&r&&n===r?a=a.length(n):(n&&(a=a.min(n)),r&&(a=a.max(r))),t==="cuid"||e===Ye.cuid)a=a.cuid();else if(t==="cuid2"||e===Ye.cuid2)a=a.cuid2();else if(t==="emoji"||e===Ye.emoji)a=a.emoji();else if(t==="ulid"||e===Ye.ulid)a=a.ulid();else if(t==="date-time"){let{precision:s,offset:i}=e?bx(e):{};a=a.datetime({precision:s,offset:i})}else t==="email"||e===Ye.email?a=a.email():t==="ipv4"||e===Ye.ipv4?a=a.ip():t==="ipv6"||e===Ye.ipv6?a=a.ip("v6"):t==="uri"?a=a.url():t==="uuid"||e===Ye.uuid?a=a.uuid():e&&(a=a.regex(new RegExp(e)));return a},"stringJSONSchemaToZuiString"),xr=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),[a]=r;if(!a){if(t==="string"&&e.type==="string")return lB(e);if(t==="number"&&(e.type==="number"||e.type==="integer"))return sB(e);if(t==="boolean")return M.boolean();if(t==="null")return M.null();throw new sa(`Unknown primitive type: "${t}"`)}if(r.length===1)return M.literal(a);let s=r.map(i=>M.literal(i));return M.union(s)},"toZuiPrimitive"),uB=d((t,e)=>cB(t)?dB(t,e):fB(t)?pB(t,e):gB(t,e),"arrayJSONSchemaToZuiArray"),cB=d(t=>Array.isArray(t.items),"_isTuple"),fB=d(t=>t.items!==void 0&&t.uniqueItems,"_isSet"),dB=d(({items:t,additionalItems:e},n)=>{let r=t.map(n),a=M.tuple(r);return e!==void 0&&(a=a.rest(n(e))),a},"_handleTuple"),pB=d(({items:t,minItems:e,maxItems:n},r)=>{let a=M.set(r(t));return e&&(a=a.min(e)),n&&(a=a.max(n)),a},"_handleSet"),gB=d(({minItems:t,maxItems:e,items:n},r)=>{let a=M.array(r(n));return t&&t===e?a.length(t):(t&&(a=a.min(t)),e&&(a=a.max(e)),a)},"_handleArray"),qn=M.any();function Vg(t){return rt(t)}d(Vg,"fromJSONSchema");function rt(t){var e;if(t===void 0)return qn;if(t===!0)return M.any();if(t===!1)return M.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 nn({oneOf:t.oneOf});if(t.patternProperties!==void 0)throw new nn({patternProperties:t.patternProperties});if(t.propertyNames!==void 0)throw new nn({propertyNames:t.propertyNames});if(t.if!==void 0)throw new nn({if:t.if});if(t.then!==void 0)throw new nn({then:t.then});if(t.else!==void 0)throw new nn({else:t.else});if(t.$ref!==void 0)return M.ref(t.$ref);if(t.not!==void 0){if(Gg(t))return M.undefined();if(t.not===!0)return M.never();throw new nn({not:t.not})}if(Array.isArray(t.type)){if(t.type.length===0)return qn;if(t.type.length===1)return rt(N(b({},t),{type:t.type[0]}));let n=t,{type:r}=n,a=Qc(n,["type"]),s=t.type.map(i=>rt(N(b({},a),{type:i})));return M.union(s)}if(t.type==="string")return t.enum&&t.enum.length>0?M.enum(t.enum):xr("string",t);if(t.type==="integer"){let n=xr("number",t);return n instanceof M.ZodNumber?n.int():n}if(t.type==="number")return xr("number",t);if(t.type==="boolean")return xr("boolean",t);if(t.type==="null")return xr("null",t);if(t.type==="array")return uB(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,a]of Object.entries(t.properties)){let s=rt(a),i=(e=t.required)!=null?e:[];n[r]=i.includes(r)?s:s.optional()}return M.object(n)}if(t.additionalProperties!==void 0){let n=rt(t.additionalProperties);return M.record(n)}return M.record(qn)}if(t.anyOf!==void 0){if(t.anyOf.length===0)return qn;if(t.anyOf.length===1)return rt(t.anyOf[0]);if(iB(t))return rt(t.anyOf[0]).optional();if(aB(t))return rt(t.anyOf[0]).nullable();let n=t.anyOf.map(rt);return M.union(n)}if(t.allOf!==void 0){if(t.allOf.length===0)return qn;if(t.allOf.length===1)return rt(t.allOf[0]);let[n,...r]=t.allOf,a=rt(n),s=rt({allOf:r});return M.intersection(a,s)}return oB(t)?M.unknown():qn}d(rt,"_fromJSONSchema");var yB=/^\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))?$/,xo=d((t,e,n=!0)=>{if(typeof t!="object")throw new co("Input must be an object");let r=d(i=>{let o=i;return e?.nullable&&(o=o.nullable()),e?.optional&&(o=o.optional()),e?.passtrough&&typeof o.passthrough=="function"&&(o=o.passthrough()),o},"applyOptions"),a=Object.entries(t).reduce((i,[o,l])=>{if(l===null)i[o]=r(Y.null());else switch(typeof l){case"string":i[o]=yB.test(l)?r(Y.string().datetime()):r(Y.string());break;case"number":i[o]=r(Y.number());break;case"boolean":i[o]=r(Y.boolean());break;case"object":Array.isArray(l)?l.length===0?i[o]=r(Y.array(Y.unknown())):typeof l[0]=="object"?i[o]=r(Y.array(xo(l[0],e,!1))):["string","number","boolean"].includes(typeof l[0])&&(i[o]=r(Y.array(Y[typeof l[0]]()))):i[o]=r(xo(l,e,!1));break;default:throw new co(`Unsupported type for key ${o}`)}return i},{}),s=Object.keys(a).length>0;return e?.passtrough||!n&&!s?Y.object(a).passthrough():Y.object(a)},"fromObject");function Jg(){return{}}d(Jg,"parseAnyDef");function Xg(t,e){var n,r;let a={type:"array"};return((r=(n=t.type)==null?void 0:n._def)==null?void 0:r.typeName)!=="ZodAny"&&(a.items=Ie(t.type._def,N(b({},e),{currentPath:[...e.currentPath,"items"]}))),t.minLength&&Re(a,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Re(a,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Re(a,"minItems",t.exactLength.value,t.exactLength.message,e),Re(a,"maxItems",t.exactLength.value,t.exactLength.message,e)),a}d(Xg,"parseArrayDef");function Yg(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(Yg,"parseBigintDef");function Qg(t){return b({type:"boolean"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(Qg,"parseBooleanDef");function ey(t,e){return Ie(t.type._def,e)}d(ey,"parseBrandedDef");var mB=d((t,e)=>Ie(t.innerType._def,e),"parseCatchDef");function ty(t,e){return e.dateStrategy=="integer"?hB(t,e):b({type:"string",format:"date-time"},t.coerce?{[le]:{coerce:t.coerce||void 0}}:{})}d(ty,"parseDateDef");var hB=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 ny(t,e){return N(b({},Ie(t.innerType._def,e)),{default:t.defaultValue()})}d(ny,"parseDefaultDef");function ry(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):{}}d(ry,"parseEffectsDef");function iy(t){return{type:"string",enum:t.values}}d(iy,"parseEnumDef");var vB=d(t=>"type"in t&&t.type==="string"?!1:"allOf"in t,"isJsonSchema7AllOfType");function ay(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(s=>!!s),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return n.forEach(s=>{if(vB(s))a.push(...s.allOf),s.unevaluatedProperties===void 0&&(r=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let o=s,{additionalProperties:l}=o;i=Qc(o,["additionalProperties"])}else r=void 0;a.push(i)}}),a.length?b({allOf:a},r):void 0}d(ay,"parseIntersectionDef");function oy(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(oy,"parseLiteralDef");function ns(t,e){var n,r,a,s,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 o={type:"object",additionalProperties:(r=Ie(t.valueType._def,N(b({},e),{currentPath:[...e.currentPath,"additionalProperties"]})))!=null?r:{}};if(e.target==="openApi3")return o;if(((a=t.keyType)==null?void 0:a._def.typeName)==="ZodString"&&((s=t.keyType._def.checks)!=null&&s.length)){let l=Object.entries(Zo(t.keyType._def,e)).reduce((f,[p,y])=>p==="type"?f:N(b({},f),{[p]:y}),{});return N(b({},o),{propertyNames:l})}else if(((i=t.keyType)==null?void 0:i._def.typeName)==="ZodEnum")return N(b({},o),{propertyNames:{enum:t.keyType._def.values}});return o}d(ns,"parseRecordDef");function sy(t,e){if(e.mapStrategy==="record")return ns(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(sy,"parseMapDef");function ly(t){let e=t.values,r=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),a=Array.from(new Set(r.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:r.filter(s=>typeof s=="string"||typeof s=="number")}}d(ly,"parseNativeEnumDef");function uy(){return{not:{}}}d(uy,"parseNeverDef");function cy(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}d(cy,"parseNullDef");var aa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fy(t,e){if(e.target==="openApi3")return Vc(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in aa&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((a,s)=>{let i=aa[s._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((a,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(r.length===n.length){let a=r.filter((s,i,o)=>o.indexOf(s)===i);return{type:a.length>1?a:a[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,a)=>[...r,...a._def.values.filter(s=>!r.includes(s))],[])};return Vc(t,e)}d(fy,"parseUnionDef");var Vc=d((t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((a,s)=>Ie(a._def,N(b({},e),{currentPath:[...e.currentPath,e.unionStrategy,`${s}`]}))).filter(a=>!!a&&(!e.strictUnions||typeof a=="object"&&Object.keys(a).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 dy(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 s={type:aa[r._def.typeName],nullable:!0};return Po(r._def,e,s)}let a={type:[aa[r._def.typeName],"null"]};return Po(r._def,e,a)}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(dy,"parseNullableDef");function py(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",Uo(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(py,"parseNumberDef");var TB=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 gy(t,e){let n=N(b({type:"object"},Object.entries(t.shape()).reduce((r,[a,s])=>{if(s===void 0||s._def===void 0)return r;let i=Ie(s._def,N(b({},e),{currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]}));return i===void 0?r:{properties:N(b({},r.properties),{[a]:i}),required:s.isOptional()?r.required:[...r.required,a]}},{properties:{},required:[]})),{additionalProperties:TB(t,e)});return n.required.length||delete n.required,n}d(gy,"parseObjectDef");var _B=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"),bB=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(a=>a!==void 0)}},"parsePipelineDef");function yy(t,e){return Ie(t.type._def,e)}d(yy,"parsePromiseDef");function my(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(my,"parseSetDef");function hy(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(hy,"parseTupleDef");function vy(){return{not:{}}}d(vy,"parseUndefinedDef");function Ty(){return{}}d(Ty,"parseUnknownDef");var wB=d((t,e)=>Ie(t.innerType._def,e),"parseReadonlyDef");function _y(t){return{$ref:t.uri}}d(_y,"parseRefDef");function Ie(t,e,n=!1){let r=e.seen.get(t);if(r&&!n){let i=xB(r,e);if(i!==void 0)return i}let a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);let s=BB(t,t.typeName,e);return s&&Po(t,e,s),a.jsonSchema=s,s}d(Ie,"parseDef");var xB=d((t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:PB(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"),PB=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"),BB=d((t,e,n)=>{switch(e){case"ZodString":return Zo(t,n);case"ZodNumber":return py(t,n);case"ZodObject":return gy(t,n);case"ZodBigInt":return Yg(t,n);case"ZodBoolean":return Qg(t);case"ZodDate":return ty(t,n);case"ZodUndefined":return vy();case"ZodNull":return cy(n);case"ZodArray":return Xg(t,n);case"ZodUnion":case"ZodDiscriminatedUnion":return fy(t,n);case"ZodIntersection":return ay(t,n);case"ZodTuple":return hy(t,n);case"ZodRecord":return ns(t,n);case"ZodRef":return _y(t);case"ZodLiteral":return oy(t,n);case"ZodEnum":return iy(t);case"ZodNativeEnum":return ly(t);case"ZodNullable":return dy(t,n);case"ZodOptional":return _B(t,n);case"ZodMap":return sy(t,n);case"ZodSet":return my(t,n);case"ZodLazy":return Ie(t.getter()._def,n);case"ZodPromise":return yy(t,n);case"ZodNaN":case"ZodNever":return uy();case"ZodEffects":return ry(t,n);case"ZodAny":return Jg();case"ZodUnknown":return Ty();case"ZodDefault":return ny(t,n);case"ZodBranded":return ey(t,n);case"ZodReadonly":return wB(t,n);case"ZodCatch":return mB(t,n);case"ZodPipeline":return bB(t,n);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return(r=>{})(e)}},"selectParser"),Po=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"),Jc={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"},EB=d(t=>typeof t=="string"?N(b({},Jc),{name:t}):b(b({},Jc),t),"getDefaultOptions"),SB=d(t=>{let e=EB(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,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))})},"getRefs"),kB=d((t,e)=>{var n;let r=SB(e),a=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,s=typeof e=="string"?e:e?.name,i=(n=Ie(t._def,s===void 0?r:N(b({},r),{currentPath:[...r.basePath,r.definitionPath,s]}),!1))!=null?n:{},o=s===void 0?a?N(b({},i),{[r.definitionPath]:a}):i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:N(b({},a),{[s]:i})};return r.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),o},"zodToJsonSchema"),IB=d((t,e={target:"openApi3"})=>{let n=kB(t,e);return e.$schemaUrl===!1?delete n.$schema:typeof e.$schemaUrl=="string"&&(n.$schema=e.$schemaUrl),n},"toJSONSchemaLegacy");var Vr=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===Y.ZodFirstPartyTypeKind.ZodObject&&r.typeName===Y.ZodFirstPartyTypeKind.ZodObject){let a=n.shape(),s=r.shape();return Y.object({...a,...s})}if(n.typeName===Y.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===Y.ZodFirstPartyTypeKind.ZodRecord)return Y.record(Y.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},by=Y;var yt=Y.string().min(1),xy=Y.object({text:yt}),Py=Y.object({markdown:yt}),By=Y.object({imageUrl:yt}),Ey=Y.object({audioUrl:yt}),Sy=Y.object({videoUrl:yt}),ky=Y.object({fileUrl:yt,title:yt.optional()}),Iy=Y.object({latitude:Y.number(),longitude:Y.number(),address:Y.string().optional(),title:Y.string().optional()}),Ay=Y.object({title:yt,subtitle:yt.optional(),imageUrl:yt.optional(),actions:Y.array(Y.object({action:Y.enum(["postback","url","say"]),label:yt,value:yt}))}),wy=Y.object({text:yt,options:Y.array(Y.object({label:yt,value:yt}))}),AB=Y.object({items:Y.array(Ay)}),CB=Y.union([Y.object({type:Y.literal("text"),payload:xy}),Y.object({type:Y.literal("markdown"),payload:Py}),Y.object({type:Y.literal("image"),payload:By}),Y.object({type:Y.literal("audio"),payload:Ey}),Y.object({type:Y.literal("video"),payload:Sy}),Y.object({type:Y.literal("file"),payload:ky}),Y.object({type:Y.literal("location"),payload:Iy})]),OB=Y.object({items:Y.array(CB)}),RB={schema:Py},MB={text:{schema:xy},image:{schema:By},audio:{schema:Ey},video:{schema:Sy},file:{schema:ky},location:{schema:Iy},carousel:{schema:AB},card:{schema:Ay},dropdown:{schema:wy},choice:{schema:wy},bloc:{schema:OB}};C();R();O();var wa="x-bot-id",Oy="x-bot-user-id",Ry="x-integration-id",My="x-webhook-id",Ny="x-bp-configuration-type",xa="x-bp-configuration",Pa="x-bp-operation",Dy="x-bp-type",XA={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};C();R();O();import{isNode as Nk}from"browser-or-node";C();R();O();var rs=console;function Ct(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function za(t,e=8072,n=Zk){if(!Nk)throw new Error("This function can only be called in Node.js");let a=(Mh(),$v(Rh)).createServer(async(s,i)=>{try{let o=await Dk(s);if(o.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(o);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(o){rs.error("Error while handling request",{error:o?.message??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:o?.message??"Internal error occured"}))}});return a.listen(e,()=>n(e)),a}async function Dk(t){let e=await Uk(t),n={};for(let a=0;a<t.rawHeaders.length;a+=2){let s=t.rawHeaders[a].toLowerCase(),i=t.rawHeaders[a+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:Hk(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function Hk(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function Uk(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",a=>r+=a.toString()),t.on("error",a=>n(a)),t.on("end",()=>e(r))})}function Zk(t){rs.info(`Listening on port ${t}`)}import{isApiError as eU,RuntimeError as tU}from"@botpress/client";C();R();O();C();R();O();C();R();O();C();R();O();var Le={};Wn(Le,{mapKeys:()=>Kk,mapValues:()=>jk,mergeRecords:()=>Fk,pairs:()=>qa,stripUndefinedProps:()=>Lk,values:()=>$k});C();R();O();var qa=t=>Object.entries(t),$k=t=>Object.values(t),jk=(t,e)=>Object.fromEntries(qa(t).map(([n,r])=>[n,e(r,n)])),Kk=(t,e)=>Object.fromEntries(qa(t).map(([n,r])=>[e(n),r])),Lk=t=>Object.fromEntries(qa(t).filter(([,e])=>e!==void 0)),Fk=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],a=[...new Set(r)],s={};for(let i of a){let o=t[i],l=e[i];o&&l?s[i]=n(o,l):o?s[i]=o:l&&(s[i]=l)}return s};var ye={};Wn(ye,{safePush:()=>Wk,unique:()=>zk});C();R();O();var Wk=(t,...e)=>t?[...t,...e]:[...e],zk=t=>Array.from(new Set(t));C();R();O();var Qt={};Wn(Qt,{setName:()=>qk});C();R();O();var qk=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Nh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},a={name:e,version:n,entities:Le.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=Le.mapValues(t.entities,i=>i.schema);for(let[i,o]of Object.entries(t.definition.actions??{})){let l=o.input.schema.dereference(s),f=o.output.schema.dereference(s),p=t.actions?.[i]?.name??i;r.actions[p]={...o,...t.actions?.[i]??{},input:{schema:l},output:{schema:f}},a.actions[i]={name:p}}for(let[i,o]of Object.entries(t.definition.events??{})){let l=o.schema.dereference(s),f=t.events?.[i]?.name??i;r.events[f]={...o,...t.events?.[i]??{},schema:l},a.events[i]={name:f}}for(let[i,o]of Object.entries(t.definition.channels??{})){let l={};for(let[p,y]of Object.entries(o.messages)){let g=y.schema.dereference(s);l[p]={...y,schema:g}}let f=t.channels?.[i]?.name??i;r.channels[f]={...o,...t.channels?.[i]??{},message:{...o.message??{},tags:{...o.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...o.conversation??{},tags:{...o.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},a.channels[i]={name:f}}return{resolved:r,statement:a}};C();R();O();var Ga=Symbol("schemaName"),Dh=t=>t?Le.mapValues(t,(n,r)=>({...n,[Ga]:r})):{},Hh=t=>Ga in t&&t[Ga]!==void 0,Uh=t=>t[Ga];C();R();O();var el=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;extend(e,n){let{entities:r,actions:a,events:s,channels:i}=this._callBuilder(e,n),o=this;o.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(a),events:Le.stripUndefinedProps(s),channels:Le.stripUndefinedProps(i)});return o.actions=Le.mergeRecords(o.actions??{},p.actions,this._mergeActions),o.channels=Le.mergeRecords(o.channels??{},p.channels,this._mergeChannels),o.events=Le.mergeRecords(o.events??{},p.events,this._mergeEvents),o.interfaces[f]={id:e.id,...y},this}_callBuilder(e,n){let a={entities:Dh(this.entities)},s=n(a),i=Le.pairs(s.entities).find(([l,f])=>!Hh(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(s.entities,l=>({name:Uh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:Vr(e.input.schema,n.input.schema)},output:{schema:Vr(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:Vr(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=Le.mergeRecords(e.messages,n.messages,this._mergeMessage),a;(e.conversation||n.conversation)&&(a={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:a,message:s}};_mergeMessage=(e,n)=>({schema:Vr(e.schema,n.schema)})};C();R();O();C();R();O();import{isApiError as PI,Client as BI,RuntimeError as wv}from"@botpress/client";C();R();O();import*as Zh from"@botpress/client";var Va={retries:3,retryCondition:t=>Zh.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(Gk(e.response?.headers??{})??t)*1e3},Gk=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 Vk(String(r))}},Vk=t=>{let e=Jk(t)?Xk(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},Jk=t=>t.includes(" "),Xk=t=>{let e=Yk(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},Yk=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};C();R();O();C();R();O();var ii=class{constructor(e){this._client=e}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);updateMessage=e=>this._client.updateMessage(e);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)};C();R();O();var Ja=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};C();R();O();C();R();O();var fn="#";var Qk=Y.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),$h=t=>{let e=t[wa],n=t[Oy],r=t[Ry],a=t[My],s=t[Ny],i=t[xa],o=Qk.parse(t[Pa]);if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing bot user headers");if(!r)throw new Error("Missing integration headers");if(!a)throw new Error("Missing webhook headers");if(!i)throw new Error("Missing configuration headers");if(!o)throw new Error("Missing operation headers");return{botId:e,botUserId:n,integrationId:r,webhookId:a,operation:o,configurationType:s??null,configuration:i?JSON.parse(q.from(i,"base64").toString("utf-8")):{}}};C();R();O();C();R();O();C();R();O();C();R();O();var nl={},jh=!1;function wl(){return jh||(jh=!0,nl=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 a=42;e[n]=a;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 s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==a||i.enumerable!==!0)return!1}return!0}),nl}var rl={},Kh=!1;function eI(){return Kh||(Kh=!0,rl=Error),rl}var il={},Lh=!1;function tI(){return Lh||(Lh=!0,il=EvalError),il}var al={},Fh=!1;function nI(){return Fh||(Fh=!0,al=RangeError),al}var ol={},Wh=!1;function rI(){return Wh||(Wh=!0,ol=ReferenceError),ol}var sl={},zh=!1;function lv(){return zh||(zh=!0,sl=SyntaxError),sl}var ll={},qh=!1;function Xa(){return qh||(qh=!0,ll=TypeError),ll}var ul={},Gh=!1;function iI(){return Gh||(Gh=!0,ul=URIError),ul}var cl={},Vh=!1;function aI(){if(Vh)return cl;Vh=!0;var t=typeof Symbol<"u"&&Symbol,e=wl();return cl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},cl}var fl={},Jh=!1;function oI(){if(Jh)return fl;Jh=!0;var t={__proto__:null,foo:{}},e=Object;return fl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},fl}var dl={},Xh=!1;function sI(){if(Xh)return dl;Xh=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",a=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},s=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(o,l){for(var f="",p=0;p<o.length;p+=1)f+=o[p],p+1<o.length&&(f+=l);return f};return dl=function(l){var f=this;if(typeof f!="function"||e.apply(f)!==r)throw new TypeError(t+f);for(var p=s(arguments,1),y,g=function(){if(this instanceof y){var v=f.apply(this,a(p,arguments));return Object(v)===v?v:this}return f.apply(l,a(p,arguments))},h=n(0,f.length-p.length),w=[],P=0;P<h;P++)w[P]="$"+P;if(y=Function("binder","return function ("+i(w,",")+"){ return binder.apply(this,arguments); }")(g),f.prototype){var B=function(){};B.prototype=f.prototype,y.prototype=new B,B.prototype=null}return y},dl}var pl={},Yh=!1;function xl(){if(Yh)return pl;Yh=!0;var t=sI();return pl=Function.prototype.bind||t,pl}var gl={},Qh=!1;function lI(){if(Qh)return gl;Qh=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=xl();return gl=n.call(t,e),gl}var yl={},ev=!1;function oi(){if(ev)return yl;ev=!0;var t,e=eI(),n=tI(),r=nI(),a=rI(),s=lv(),i=Xa(),o=iI(),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=aI()(),w=oI()(),P=Object.getPrototypeOf||(w?function(Ue){return Ue.__proto__}:null),B={},v=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%":a,"%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%":s,"%ThrowTypeError%":g,"%TypedArray%":v,"%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%":o,"%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},K={__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"]},ae=xl(),ee=lI(),ge=ae.call(Function.call,Array.prototype.concat),oe=ae.call(Function.apply,Array.prototype.splice),re=ae.call(Function.call,String.prototype.replace),Oe=ae.call(Function.call,String.prototype.slice),ze=ae.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 s("invalid intrinsic syntax, expected closing `%`");if(fe==="%"&&Se!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var ve=[];return re(Pe,tt,function(D,j,F,de){ve[ve.length]=F?re(de,Ve,"$1"):j||D}),ve},mt=function(Pe,Se){var fe=Pe,ve;if(ee(K,fe)&&(ve=K[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 s("intrinsic "+Pe+" does not exist!")};return yl=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 s("`%` 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=mt("%"+ve+"%",Se),j=D.name,F=D.value,de=!1,Te=D.alias;Te&&(ve=Te[0],oe(fe,ge([0,1],Te)));for(var A=1,k=!0;A<fe.length;A+=1){var $=fe[A],X=Oe($,0,1),ie=Oe($,-1);if((X==='"'||X==="'"||X==="`"||ie==='"'||ie==="'"||ie==="`")&&X!==ie)throw new s("property names with quotes must have matching quotes");if(($==="constructor"||!k)&&(de=!0),ve+="."+$,j="%"+ve+"%",ee(S,j))F=S[j];else if(F!=null){if(!($ in F)){if(!Se)throw new i("base intrinsic for "+Pe+" exists, but the property is not available.");return}if(p&&A+1>=fe.length){var _=p(F,$);k=!!_,k&&"get"in _&&!("originalValue"in _.get)?F=_.get:F=F[$]}else k=ee(F,$),F=F[$];k&&!de&&(S[j]=F)}}return F},yl}var ml={},tv=!1;function Pl(){if(tv)return ml;tv=!0;var t=oi(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ml=e,ml}var hl={},nv=!1;function Ya(){if(nv)return hl;nv=!0;var t=oi(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return hl=e,hl}var vl={},rv=!1;function uI(){if(rv)return vl;rv=!0;var t=Pl(),e=lv(),n=Xa(),r=Ya();return vl=function(s,i,o){if(!s||typeof s!="object"&&typeof s!="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(s,i);if(t)t(s,i,{configurable:p===null&&g?g.configurable:!p,enumerable:l===null&&g?g.enumerable:!l,value:o,writable:f===null&&g?g.writable:!f});else if(y||!l&&!f&&!p)s[i]=o;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},vl}var Tl={},iv=!1;function cI(){if(iv)return Tl;iv=!0;var t=Pl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},Tl=e,Tl}var _l={},av=!1;function fI(){if(av)return _l;av=!0;var t=oi(),e=uI(),n=cI()(),r=Ya(),a=Xa(),s=t("%Math.floor%");return _l=function(o,l){if(typeof o!="function")throw new a("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new a("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],p=!0,y=!0;if("length"in o&&r){var g=r(o,"length");g&&!g.configurable&&(p=!1),g&&!g.writable&&(y=!1)}return(p||y||!f)&&(n?e(o,"length",l,!0,!0):e(o,"length",l)),o},_l}var ai={},ov=!1;function Bl(){if(ov)return ai;ov=!0;var t=xl(),e=oi(),n=fI(),r=Xa(),a=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,a),o=Pl(),l=e("%Math.max%");ai=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,s,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var f=function(){return i(t,a,arguments)};return o?o(ai,"apply",{value:f}):ai.apply=f,ai}var bl={},sv=!1;function El(){if(sv)return bl;sv=!0;var t=oi(),e=Bl(),n=e(t("String.prototype.indexOf"));return bl=function(a,s){var i=t(a,!!s);return typeof i=="function"&&n(a,".prototype.")>-1?e(i):i},bl}is();bs();var Sl={},uv=!1;function Hl(){if(uv)return Sl;uv=!0;var t=wl();return Sl=function(){return t()&&!!Symbol.toStringTag},Sl}var kl={},cv=!1;function dI(){if(cv)return kl;cv=!0;var t=Hl()(),e=El(),n=e("Object.prototype.toString"),r=function(o){return t&&o&&typeof o=="object"&&Symbol.toStringTag in o?!1:n(o)==="[object Arguments]"},a=function(o){return r(o)?!0:o!==null&&typeof o=="object"&&typeof o.length=="number"&&o.length>=0&&n(o)!=="[object Array]"&&n(o.callee)==="[object Function]"},s=function(){return r(arguments)}();return r.isLegacyArguments=a,kl=s?r:a,kl}var Il={},fv=!1;function pI(){if(fv)return Il;fv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Hl()(),a=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Il=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(!a)return!1;if(typeof i>"u"){var p=s();i=p?a(p):!1}return a(l)===i},Il}var Al={},dv=!1;function gI(){if(dv)return Al;dv=!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 a=/^\s*class\b/,s=function(E){try{var H=t.call(E);return a.test(H)}catch{return!1}},i=function(E){try{return s(E)?!1:(t.call(E),!0)}catch{return!1}},o=Object.prototype.toString,l="[object Object]",f="[object Function]",p="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",h="[object HTMLCollection]",w=typeof Symbol=="function"&&!!Symbol.toStringTag,P=!(0 in[,]),B=function(){return!1};if(typeof document=="object"){var v=document.all;o.call(v)===o.call(document.all)&&(B=function(E){if((P||!E)&&(typeof E>"u"||typeof E=="object"))try{var H=o.call(E);return(H===y||H===g||H===h||H===l)&&E("")==null}catch{}return!1})}return Al=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!s(E)&&i(E)}:function(E){if(B(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(w)return i(E);if(s(E))return!1;var H=o.call(E);return H!==f&&H!==p&&!/^\[object HTML/.test(H)?!1:i(E)},Al}var Cl={},pv=!1;function yI(){if(pv)return Cl;pv=!0;var t=gI(),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))},a=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)},s=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"?a(l,f,y):s(l,f,y)};return Cl=i,Cl}var Ol={},gv=!1;function mI(){return gv||(gv=!0,Ol=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ol}var Rl={},yv=!1,hI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function vI(){if(yv)return Rl;yv=!0;var t=mI(),e=typeof globalThis>"u"?hI:globalThis;return Rl=function(){for(var r=[],a=0;a<t.length;a++)typeof e[t[a]]=="function"&&(r[r.length]=t[a]);return r},Rl}var Ml={},mv=!1,TI=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function bv(){if(mv)return Ml;mv=!0;var t=yI(),e=vI(),n=Bl(),r=El(),a=Ya(),s=r("Object.prototype.toString"),i=Hl()(),o=typeof globalThis>"u"?TI:globalThis,l=e(),f=r("String.prototype.slice"),p=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(B,v){for(var S=0;S<B.length;S+=1)if(B[S]===v)return S;return-1},g={__proto__:null};i&&a&&p?t(l,function(P){var B=new o[P];if(Symbol.toStringTag in B){var v=p(B),S=a(v,Symbol.toStringTag);if(!S){var E=p(v);S=a(E,Symbol.toStringTag)}g["$"+P]=n(S.get)}}):t(l,function(P){var B=new o[P],v=B.slice||B.set;v&&(g["$"+P]=n(v))});var h=function(B){var v=!1;return t(g,function(S,E){if(!v)try{"$"+S(B)===E&&(v=f(E,1))}catch{}}),v},w=function(B){var v=!1;return t(g,function(S,E){if(!v)try{S(B),v=f(E,1)}catch{}}),v};return Ml=function(B){if(!B||typeof B!="object")return!1;if(!i){var v=f(s(B),8,-1);return y(l,v)>-1?v:v!=="Object"?!1:w(B)}return a?h(B):null},Ml}var Nl={},hv=!1;function _I(){if(hv)return Nl;hv=!0;var t=bv();return Nl=function(n){return!!t(n)},Nl}var we={},vv=!1;function bI(){if(vv)return we;vv=!0;var t=dI(),e=pI(),n=bv(),r=_I();function a(Z){return Z.call.bind(Z)}var s=typeof BigInt<"u",i=typeof Symbol<"u",o=a(Object.prototype.toString),l=a(Number.prototype.valueOf),f=a(String.prototype.valueOf),p=a(Boolean.prototype.valueOf);if(s)var y=a(BigInt.prototype.valueOf);if(i)var g=a(Symbol.prototype.valueOf);function h(Z,kt){if(typeof Z!="object")return!1;try{return kt(Z),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function w(Z){return typeof Promise<"u"&&Z instanceof Promise||Z!==null&&typeof Z=="object"&&typeof Z.then=="function"&&typeof Z.catch=="function"}we.isPromise=w;function P(Z){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(Z):r(Z)||D(Z)}we.isArrayBufferView=P;function B(Z){return n(Z)==="Uint8Array"}we.isUint8Array=B;function v(Z){return n(Z)==="Uint8ClampedArray"}we.isUint8ClampedArray=v;function S(Z){return n(Z)==="Uint16Array"}we.isUint16Array=S;function E(Z){return n(Z)==="Uint32Array"}we.isUint32Array=E;function H(Z){return n(Z)==="Int8Array"}we.isInt8Array=H;function K(Z){return n(Z)==="Int16Array"}we.isInt16Array=K;function ae(Z){return n(Z)==="Int32Array"}we.isInt32Array=ae;function ee(Z){return n(Z)==="Float32Array"}we.isFloat32Array=ee;function ge(Z){return n(Z)==="Float64Array"}we.isFloat64Array=ge;function oe(Z){return n(Z)==="BigInt64Array"}we.isBigInt64Array=oe;function re(Z){return n(Z)==="BigUint64Array"}we.isBigUint64Array=re;function Oe(Z){return o(Z)==="[object Map]"}Oe.working=typeof Map<"u"&&Oe(new Map);function ze(Z){return typeof Map>"u"?!1:Oe.working?Oe(Z):Z instanceof Map}we.isMap=ze;function tt(Z){return o(Z)==="[object Set]"}tt.working=typeof Set<"u"&&tt(new Set);function Ve(Z){return typeof Set>"u"?!1:tt.working?tt(Z):Z instanceof Set}we.isSet=Ve;function Je(Z){return o(Z)==="[object WeakMap]"}Je.working=typeof WeakMap<"u"&&Je(new WeakMap);function mt(Z){return typeof WeakMap>"u"?!1:Je.working?Je(Z):Z instanceof WeakMap}we.isWeakMap=mt;function Ue(Z){return o(Z)==="[object WeakSet]"}Ue.working=typeof WeakSet<"u"&&Ue(new WeakSet);function Pe(Z){return Ue(Z)}we.isWeakSet=Pe;function Se(Z){return o(Z)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function fe(Z){return typeof ArrayBuffer>"u"?!1:Se.working?Se(Z):Z instanceof ArrayBuffer}we.isArrayBuffer=fe;function ve(Z){return o(Z)==="[object DataView]"}ve.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&ve(new DataView(new ArrayBuffer(1),0,1));function D(Z){return typeof DataView>"u"?!1:ve.working?ve(Z):Z instanceof DataView}we.isDataView=D;var j=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(Z){return o(Z)==="[object SharedArrayBuffer]"}function de(Z){return typeof j>"u"?!1:(typeof F.working>"u"&&(F.working=F(new j)),F.working?F(Z):Z instanceof j)}we.isSharedArrayBuffer=de;function Te(Z){return o(Z)==="[object AsyncFunction]"}we.isAsyncFunction=Te;function A(Z){return o(Z)==="[object Map Iterator]"}we.isMapIterator=A;function k(Z){return o(Z)==="[object Set Iterator]"}we.isSetIterator=k;function $(Z){return o(Z)==="[object Generator]"}we.isGeneratorObject=$;function X(Z){return o(Z)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=X;function ie(Z){return h(Z,l)}we.isNumberObject=ie;function _(Z){return h(Z,f)}we.isStringObject=_;function x(Z){return h(Z,p)}we.isBooleanObject=x;function z(Z){return s&&h(Z,y)}we.isBigIntObject=z;function Q(Z){return i&&h(Z,g)}we.isSymbolObject=Q;function Me(Z){return ie(Z)||_(Z)||x(Z)||z(Z)||Q(Z)}we.isBoxedPrimitive=Me;function _e(Z){return typeof Uint8Array<"u"&&(fe(Z)||de(Z))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(Z){Object.defineProperty(we,Z,{enumerable:!1,value:function(){throw new Error(Z+" is not supported in userland")}})}),we}var Dl={},Tv=!1;function wI(){return Tv||(Tv=!0,Dl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Dl}var xe={},_v=!1,si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function xI(){if(_v)return xe;_v=!0;var t=At,e=Object.getOwnPropertyDescriptors||function(j){for(var F=Object.keys(j),de={},Te=0;Te<F.length;Te++)de[F[Te]]=Object.getOwnPropertyDescriptor(j,F[Te]);return de},n=/%[sdj%]/g;xe.format=function(D){if(!K(D)){for(var j=[],F=0;F<arguments.length;F++)j.push(i(arguments[F]));return j.join(" ")}for(var F=1,de=arguments,Te=de.length,A=String(D).replace(n,function($){if($==="%%")return"%";if(F>=Te)return $;switch($){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 $}}),k=de[F];F<Te;k=de[++F])S(k)||!oe(k)?A+=" "+k:A+=" "+i(k);return A},xe.deprecate=function(D,j){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,j).apply(this||si,arguments)};var F=!1;function de(){if(!F){if(t.throwDeprecation)throw new Error(j);t.traceDeprecation?console.trace(j):console.error(j),F=!0}return D.apply(this||si,arguments)}return de};var r={},a=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+s+"$","i")}xe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(a.test(D)){var j=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,j,F)}}else r[D]=function(){};return r[D]};function i(D,j){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),v(j)?F.showHidden=j:j&&xe._extend(F,j),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=o),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 o(D,j){var F=i.styles[j];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,j){return D}function f(D){var j={};return D.forEach(function(F,de){j[F]=!0}),j}function p(D,j,F){if(D.customInspect&&j&&ze(j.inspect)&&j.inspect!==xe.inspect&&!(j.constructor&&j.constructor.prototype===j)){var de=j.inspect(F,D);return K(de)||(de=p(D,de,F)),de}var Te=y(D,j);if(Te)return Te;var A=Object.keys(j),k=f(A);if(D.showHidden&&(A=Object.getOwnPropertyNames(j)),Oe(j)&&(A.indexOf("message")>=0||A.indexOf("description")>=0))return g(j);if(A.length===0){if(ze(j)){var $=j.name?": "+j.name:"";return D.stylize("[Function"+$+"]","special")}if(ge(j))return D.stylize(RegExp.prototype.toString.call(j),"regexp");if(re(j))return D.stylize(Date.prototype.toString.call(j),"date");if(Oe(j))return g(j)}var X="",ie=!1,_=["{","}"];if(B(j)&&(ie=!0,_=["[","]"]),ze(j)){var x=j.name?": "+j.name:"";X=" [Function"+x+"]"}if(ge(j)&&(X=" "+RegExp.prototype.toString.call(j)),re(j)&&(X=" "+Date.prototype.toUTCString.call(j)),Oe(j)&&(X=" "+g(j)),A.length===0&&(!ie||j.length==0))return _[0]+X+_[1];if(F<0)return ge(j)?D.stylize(RegExp.prototype.toString.call(j),"regexp"):D.stylize("[Object]","special");D.seen.push(j);var z;return ie?z=h(D,j,F,k,A):z=A.map(function(Q){return w(D,j,F,k,Q,ie)}),D.seen.pop(),P(z,X,_)}function y(D,j){if(ee(j))return D.stylize("undefined","undefined");if(K(j)){var F="'"+JSON.stringify(j).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(H(j))return D.stylize(""+j,"number");if(v(j))return D.stylize(""+j,"boolean");if(S(j))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function h(D,j,F,de,Te){for(var A=[],k=0,$=j.length;k<$;++k)Pe(j,String(k))?A.push(w(D,j,F,de,String(k),!0)):A.push("");return Te.forEach(function(X){X.match(/^\d+$/)||A.push(w(D,j,F,de,X,!0))}),A}function w(D,j,F,de,Te,A){var k,$,X;if(X=Object.getOwnPropertyDescriptor(j,Te)||{value:j[Te]},X.get?X.set?$=D.stylize("[Getter/Setter]","special"):$=D.stylize("[Getter]","special"):X.set&&($=D.stylize("[Setter]","special")),Pe(de,Te)||(k="["+Te+"]"),$||(D.seen.indexOf(X.value)<0?(S(F)?$=p(D,X.value,null):$=p(D,X.value,F-1),$.indexOf(`
80
+ `)>-1&&(A?$=$.split(`
81
81
  `).map(function(ie){return" "+ie}).join(`
82
- `).slice(2):Z=`
83
- `+Z.split(`
82
+ `).slice(2):$=`
83
+ `+$.split(`
84
84
  `).map(function(ie){return" "+ie}).join(`
85
- `))):Z=D.stylize("[Circular]","special")),Q(k)){if(A&&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,j,F){var de=D.reduce(function(Te,A){return A.indexOf(`
85
+ `))):$=D.stylize("[Circular]","special")),ee(k)){if(A&&Te.match(/^\d+$/))return $;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+": "+$}function P(D,j,F){var de=D.reduce(function(Te,A){return A.indexOf(`
86
86
  `)>=0,Te+A.replace(/\u001b\[\d\d?m/g,"").length+1},0);return de>60?F[0]+(j===""?"":j+`
87
87
  `)+" "+D.join(`,
88
- `)+" "+F[1]:F[0]+j+" "+D.join(", ")+" "+F[1]}xe.types=bI();function B(D){return Array.isArray(D)}xe.isArray=B;function v(D){return typeof D=="boolean"}xe.isBoolean=v;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 K(D){return typeof D=="string"}xe.isString=K;function ae(D){return typeof D=="symbol"}xe.isSymbol=ae;function Q(D){return D===void 0}xe.isUndefined=Q;function ge(D){return oe(D)&&Ve(D)==="[object RegExp]"}xe.isRegExp=ge,xe.types.isRegExp=ge;function oe(D){return typeof D=="object"&&D!==null}xe.isObject=oe;function re(D){return oe(D)&&Ve(D)==="[object Date]"}xe.isDate=re,xe.types.isDate=re;function Oe(D){return oe(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=wI();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,j=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),mt[D.getMonth()],j].join(" ")}xe.log=function(){console.log("%s - %s",Ue(),xe.format.apply(xe,arguments))},xe.inherits=Mt(),xe._extend=function(D,j){if(!j||!oe(j))return D;for(var F=Object.keys(j),de=F.length;de--;)D[F[de]]=j[F[de]];return D};function Pe(D,j){return Object.prototype.hasOwnProperty.call(D,j)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(j){if(typeof j!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&j[Se]){if(F=j[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,A=new Promise(function(X,ie){de=X,Te=ie}),k=[],Z=0;Z<arguments.length;Z++)k.push(arguments[Z]);k.push(function(X,ie){X?Te(X):de(ie)});try{j.apply(this||si,k)}catch(X){Te(X)}return A}return Object.setPrototypeOf(F,Object.getPrototypeOf(j)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(j))},xe.promisify.custom=Se;function fe(D,j){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return j(D)}function ve(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function j(){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 A=this||si,k=function(){return Te.apply(A,arguments)};D.apply(this||si,F).then(function(Z){t.nextTick(k.bind(null,null,Z))},function(Z){t.nextTick(fe.bind(null,Z,k))})}return Object.setPrototypeOf(j,Object.getPrototypeOf(D)),Object.defineProperties(j,e(D)),j}return xe.callbackify=ve,xe}var ce=xI();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 D0=ce._extend,H0=ce.callbackify,U0=ce.debuglog,$0=ce.deprecate,Z0=ce.format,j0=ce.inherits,K0=ce.inspect,L0=ce.isArray,F0=ce.isBoolean,W0=ce.isBuffer,z0=ce.isDate,q0=ce.isError,G0=ce.isFunction,V0=ce.isNull,J0=ce.isNullOrUndefined,X0=ce.isNumber,Y0=ce.isObject,Q0=ce.isPrimitive,eR=ce.isRegExp,tR=ce.isString,nR=ce.isSymbol,rR=ce.isUndefined,iR=ce.log,aR=ce.promisify,oR=ce.types,sR=ce.TextEncoder=globalThis.TextEncoder,lR=ce.TextDecoder=globalThis.TextDecoder;var hr=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 jn=class extends hr{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new jn({...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})}};C();R();O();var EI=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),xv=t=>async e=>{let n=Zh(e.headers),[,r]=(e.headers.traceparent||"").split("-"),a=new BI({botId:n.botId,integrationId:n.integrationId,retry:Va,headers:EI(e.headers)}),s=new ii(a),i=new jn({traceId:r}),o={ctx:n,req:e,client:s,logger:i,instance:t};try{let l;switch(l=await NI(o),n.operation){case"webhook_received":l=await kI(o);break;case"register":l=await II(o);break;case"unregister":l=await AI(o);break;case"message_created":l=await RI(o);break;case"action_triggered":l=await MI(o);break;case"ping":l=await SI(o);break;case"create_user":l=await CI(o);break;case"create_conversation":l=await OI(o);break;default:if(!l)throw new Error(`Unknown operation ${n.operation}`)}return l?{...l,status:l.status??200}:{status:200}}catch(l){if(PI(l)){let p=l.type==="Runtime"?l:new wv(l.message,l);return i.forBot().error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}console.error(l);let f=new wv("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 i.forBot().error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}},SI=async t=>{},kI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{let{req:s}=Ct(n);return a.webhook({client:t,ctx:e,req:s,logger:r})},II=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.register)return;let{webhookUrl:s}=Ct(n);await a.register({client:t,ctx:e,webhookUrl:s,logger:r})},AI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.unregister)return;let{webhookUrl:s}=Ct(n);await a.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},CI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createUser)return;let{tags:s}=Ct(n);return await a.createUser({ctx:e,client:t,tags:s,logger:r})},OI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createConversation)return;let{channel:s,tags:i}=Ct(n);return await a.createConversation({ctx:e,client:t,channel:s,tags:i,logger:r})},RI=async({ctx:t,req:e,client:n,logger:r,instance:a})=>{let{conversation:s,user:i,type:o,payload:l,message:f}=Ct(e),p=a.channels[s.channel];if(!p)throw new Error(`Channel ${s.channel} not found`);let y=p.messages[o];if(!y)throw new Error(`Message of type ${o} not found in channel ${s.channel}`);await y({ctx:t,conversation:s,message:f,user:i,type:o,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:f.id,tags:h})},logger:r})},MI=async({req:t,ctx:e,client:n,logger:r,instance:a})=>{let{input:s,type:i}=Ct(t);if(!i)throw new Error("Missing action type");let o=a.actions[i];if(!o)throw new Error(`Action ${i} not found`);let l=new Ja,p={output:await o({ctx:e,input:s,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},NI=async({instance:t,client:e,ctx:n,logger:r,req:a})=>{let s=t.integrationOperationHandler;if(s)return await s({client:e,ctx:n,logger:r,req:a})??{status:200}};var Ul=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.integrationOperationHandler=e.__advanced?.integrationOperationHandler}actions;channels;register;unregister;createUser;createConversation;webhook;integrationOperationHandler;handler=xv(this);start=e=>za(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var $l=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}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;attributes;addIntegration(e,n){let r=this;return r.integrations||(r.integrations={}),r.integrations[e.name]={enabled:n.enabled,...e,configurationType:n.configurationType,configuration:n.configuration,disabledChannels:n.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let a=n.alias??e.name;return r.plugins[a]={...e,alias:n.alias,configuration:n.configuration,interfaces:n.interfaces},r.user=this._mergeUser(r.user,e.definition.user),r.conversation=this._mergeConversation(r.conversation,e.definition.conversation),r.message=this._mergeMessage(r.message,e.definition.message),r.recurringEvents=this._mergeRecurringEvents(r.recurringEvents,e.definition.recurringEvents),r.tables=this._mergeTables(r.tables,e.definition.tables),r.workflows=this._mergeWorkflows(r.workflows,e.definition.workflows),r.states=this._mergeStates(r.states,this._prefixKeys(e.definition.states,n.alias)),r.events=this._mergeEvents(r.events,this._prefixKeys(e.definition.events,n.alias)),r.actions=this._mergeActions(r.actions,this._prefixKeys(e.definition.actions,n.alias)),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});_prefixKeys=(e,n)=>!e||!n?e:Le.mapKeys(e,r=>`${n}${mr}${r}`)};C();R();O();C();R();O();import{isApiError as KI,Client as LI,RuntimeError as Ev}from"@botpress/client";C();R();O();var Kn=class extends hr{constructor(e){super({...e})}with(e){return new Kn({...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})}};C();R();O();C();R();O();var en=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}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);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 a=await this._client[e](n),s=this._hooks.after[e];return s&&(a=await s(a,n)),a}};C();R();O();C();R();O();var vr=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>fn({workflowName:n,client:t,input:r}),running:r=>fn({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>fn({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>fn({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>fn({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>fn({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>fn({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>fn({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:a}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:dn({client:t,workflow:a})}}})}),fn=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>dn({client:t.client,workflow:n}))}},dn=t=>({...t.workflow,async update(e){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:dn({client:t.client,workflow:n})}},async setFailed({failureReason:e}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:dn({client:t.client,workflow:n})}},async setCompleted({output:e}={}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:dn({client:t.client,workflow:n})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:dn({client:t.client,workflow:e})}}});C();R();O();C();R();O();var DI=ne.enum(["event_received","register","unregister","ping","action_triggered"]),Pv=t=>{let e=t[wa],n=t[xa],r=t[Dy],a=DI.parse(t[Pa]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing type headers");if(!n)throw new Error("Missing configuration headers");if(!a)throw new Error("Missing operation headers");return{botId:e,operation:a,type:r,configuration:n?JSON.parse(q.from(n,"base64").toString("utf-8")):{}}};C();R();O();var ft={status:200};C();R();O();C();R();O();var Zl=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 HI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Bv=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!HI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:UI(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),ft;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 $I(n,e);default:e.payload.type}return ft},UI=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),$I=async(t,e)=>{let n=Zl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];return!r||r.length===0?(t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),ft):(await ZI(t,e),await jI(t,e),ft)},ZI=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},jI=async(t,e)=>{let n=Zl(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];for(let a of r)await a({...t,conversation:e.payload.conversation,user:e.payload.user,workflow:dn({...t,workflow:e.payload.workflow}),workflows:vr(t.client)})};C();R();O();var Sv=t=>async e=>{let n=Pv(e.headers),r=new Kn,a=new LI({botId:n.botId,retry:Va}),s=new en(a,{before:{createMessage:async o=>{let l=t.hookHandlers.before_outgoing_message[o.type]??[];for(let f of l){let p=new en(a);o=(await f({client:p,ctx:n,logger:r.with({conversationId:o.conversationId,userId:o.userId}),data:o,...pn({client:p})}))?.data??o}return o},callAction:async o=>{let l=t.hookHandlers.before_outgoing_call_action[o.type]??[];for(let f of l){let p=new en(a);o=(await f({client:p,ctx:n,logger:r,data:o,...pn({client:p})}))?.data??o}return o}},after:{createMessage:async o=>{let l=t.hookHandlers.after_outgoing_message[o.message.type]??[];for(let f of l){let p=new en(a);o=(await f({client:p,ctx:n,logger:r.with({messageId:o.message.id,conversationId:o.message.conversationId,userId:o.message.userId}),data:o,...pn({client:p})}))?.data??o}return o},callAction:async(o,l)=>{let{type:f}=l,p=t.hookHandlers.after_outgoing_call_action[f]??[];for(let y of p){let g=new en(a);o=(await y({client:g,ctx:n,logger:r,data:{type:f,...o},...pn({client:g})}))?.data??o}return o}}}),i={req:e,ctx:n,logger:r,client:s,self:t};try{switch(n.operation){case"action_triggered":return await GI(i);case"event_received":return await qI(i);case"register":return await WI(i);case"unregister":return await zI(i);case"ping":return await FI(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(o){let l=o instanceof Error?o:new Error(String(o));if(KI(l)){let p=l.type==="Runtime"?l:new Ev(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let f=new Ev("An unexpected error occurred in the bot.",l);return r.error(f.message,l),{status:f.code,body:JSON.stringify(f.toJSON())}}},FI=async t=>ft,WI=async t=>ft,zI=async t=>ft,qI=async t=>{let{ctx:e,logger:n,req:r,client:a,self:s}=t,i={client:a,ctx:e,logger:n,...pn({client:a})},o=Ct(r);if(i.logger=i.logger.with({eventId:o.event.id,messageId:o.event.messageId,conversationId:o.event.conversationId,userId:o.event.userId}),e.type==="workflow_update")return await Bv(t,o.event);if(e.type==="message_created"){let h=o.event,w=h.payload.message;i.logger=i.logger.with({messageId:w.id,conversationId:w.conversationId,userId:w.userId});let P=s.hookHandlers.before_incoming_message[w.type]??[];for(let E of P){let H=await E({...i,data:w});if(w=H?.data??w,H?.stop)return ft}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:w,event:h},v=s.messageHandlers[w.type]??[];for(let E of v)await E(B);let S=s.hookHandlers.after_incoming_message[w.type]??[];for(let E of S){let H=await E({...i,data:w});if(w=H?.data??w,H?.stop)return ft}return ft}if(e.type==="state_expired"){let w=o.event.payload.state,P={...i,state:w},B=s.stateExpiredHandlers["*"]??[];for(let v of B)await v(P);return ft}let l=o.event,f=s.hookHandlers.before_incoming_event[l.type]??[];for(let h of f){let w=await h({...i,data:l});if(l=w?.data??l,w?.stop)return ft}let p={...i,event:l},y=s.eventHandlers[l.type]??[];for(let h of y)await h(p);let g=s.hookHandlers.after_incoming_event[l.type]??[];for(let h of g){let w=await h({...i,data:l});if(l=w?.data??l,w?.stop)return ft}return ft},GI=async({ctx:t,logger:e,req:n,client:r,self:a})=>{let{input:s,type:i}=Ct(n);if(!i)throw new Error("Missing action type");let o=a.hookHandlers.before_incoming_call_action[i]??[];for(let g of o){let h=await g({ctx:t,logger:e,client:r,data:{type:i,input:s},...pn({client:r})});s=h?.data?.input??s,i=h?.data?.type??i}let l=a.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let f=await l({ctx:t,logger:e,input:s,client:r,type:i,...pn({client:r})}),p=a.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},...pn({client:r})});i=h?.data?.type??i,f=h?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}},pn=t=>({workflows:vr(t.client)});var jl=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 a of Object.values(this._plugins))if(r=a.actionHandlers[n],r)return r}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(o=>o.messageHandlers[n]??[]),a=this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],i=[...a,...s].sort((o,l)=>o.order-l.order).map(({handler:o})=>o);return ye.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(o=>o.eventHandlers[n]??[]),a=this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],i=[...a,...s].sort((o,l)=>o.order-l.order).map(({handler:o})=>o);return ye.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(o=>o.stateExpiredHandlers[n]??[]),a=this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],i=[...a,...s].sort((o,l)=>o.order-l.order).map(({handler:o})=>o);return ye.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(a,s)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[s]??[]),o=this._hookHandlers[n]??{},l=o[s]??[],f=o["*"]??[],p=[...l,...f].sort((y,g)=>y.order-g.order).map(({handler:y})=>y);return ye.unique([...i,...p])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(a,s)=>{let i=r[s]?.sort((l,f)=>l.order-f.order).map(({handler:l})=>l)??[],o=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return ye.unique([...i,...o])}})}})}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=Sv(this);start=e=>za(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var Kl=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;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),a=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)}})),s=e.channels===void 0?{}:Le.mapValues(e.channels,i=>({...i,messages:Le.mapValues(i.messages,o=>({...o,schema:o.schema(n)}))}));this.events=r,this.actions=a,this.channels=s}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;_getEntityReference=e=>{let n={};for(let[r,a]of Object.entries(e)){let s=a.schema._def["x-zui"]?.title,i=a.schema._def.description,o=by.ref(r);s&&o.title(s),i&&o.describe(i),n[r]=o}return n}};C();R();O();C();R();O();C();R();O();C();R();O();var Ll=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.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,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}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows};C();R();O();C();R();O();C();R();O();C();R();O();var Fl=":";var kv=t=>{let[e,n]=t.split(Fl);return!e||!n?null:{namespace:e,eventName:n}},Iv=t=>`${t.namespace}${Fl}${t.actionName}`,Av=t=>`${t.namespace}${Fl}${t.eventName}`,Cv=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,a=n.actions[t.actionName]?.name??t.actionName;return{namespace:r,actionName:a}},Ov=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,a=n.events[t.eventName]?.name??t.eventName;return{namespace:r,eventName:a}};var Rv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,s)=>i=>VI({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:s,input:i})})}),VI=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:a})=>{let s=Cv({namespace:n,actionName:r},e),i=Iv(s);return(await t.callAction({type:i,input:a})).output};C();R();O();C();R();O();C();R();O();var Ln=class{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:a}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:a})}async schedule(e,n){let{conversationId:r,userId:a,messageId:s}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:a,messageId:s,schedule:n})}withConversationId(e){return new Ln({...this._props,conversationId:e})}withUserId(e){return new Ln({...this._props,userId:e})}withMessageId(e){return new Ln({...this._props,messageId:e})}},Mv=(t,e)=>new Proxy({},{get:(n,r)=>{let a=e.alias!==void 0?`${e.alias}${mr}${r}`:r;return new Ln({client:t,eventName:a})}});C();R();O();C();R();O();C();R();O();var Wl=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){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n})}async getOrSet(e,n){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n}).then(r=>r.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})}},Nv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,s)=>{let i=e.alias!==void 0?`${e.alias}${mr}${s}`:s;return new Wl(t,r,i)}})});C();R();O();var zl=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:a}=this._runtime,s=Rv(e,this._runtime),i=Nv(e,this._runtime),o=vr(e),l=Mv(e,this._runtime);return{configuration:n,interfaces:r,actions:s,states:i,alias:a,workflows:o,events:l}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return Qt.setName(a=>r({...a,...this._getTools(a.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._messageHandlers[n]??[],a=this._messageHandlers["*"]??[];return ye.unique([...r,...a]).sort((i,o)=>i.order-o.order).map(({handler:i})=>Qt.setName(o=>i({...o,...this._getTools(o.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._eventHandlers[n]??[],a=Object.entries(this._eventHandlers).filter(([o])=>this._eventResolvesTo(o,n)).flatMap(([,o])=>o??[]),s=this._eventHandlers["*"]??[];return ye.unique([...r,...a,...s]).sort((o,l)=>o.order-l.order).map(({handler:o})=>Qt.setName(l=>o({...l,...this._getTools(l.client)}),o.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._stateExpiredHandlers[n]??[],a=this._stateExpiredHandlers["*"]??[];return ye.unique([...r,...a]).sort((i,o)=>i.order-o.order).map(({handler:i})=>Qt.setName(o=>i({...o,...this._getTools(o.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(a,s)=>{s=this._stripAliasPrefix(s);let i=r[s]??[],o=Object.entries(r).filter(([p])=>this._eventResolvesTo(p,s)).flatMap(([,p])=>p??[]),l=r["*"]??[];return ye.unique([...i,...o,...l]).sort((p,y)=>p.order-y.order).map(({handler:p})=>Qt.setName(y=>p({...y,...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:(a,s)=>(r[s]?.sort((o,l)=>o.order-l.order)??[]).map(({handler:o})=>Qt.setName(l=>o({...l,...this._getTools(l.client)}),o.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=kv(e);if(!r)return!1;let a=Ov(r,this._runtime.interfaces);return Av(a)===n};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}:`;return e.startsWith(r)?e.slice(r.length):e}};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();export{Rx as BRAND,jl as Bot,$l as BotDefinition,Kn as BotLogger,en as BotSpecificClient,Jn as DIRTY,Ix as EMPTY_PATH,pe as INVALID,Ul as Integration,el as IntegrationDefinition,jn as IntegrationLogger,ii as IntegrationSpecificClient,Kl as InterfaceDefinition,RP as NEVER,pt as OK,It as ParseInputLazyPath,vt as ParseStatus,zl as Plugin,Ll as PluginDefinition,nU as RuntimeError,he as Schema,XA as WELL_KNOWN_ATTRIBUTES,Fr as ZodAny,Wr as ZodArray,jo as ZodBigInt,Ko as ZodBoolean,Lo as ZodBranded,Fo as ZodCatch,Wo as ZodDate,ha as ZodDefault,fg as ZodDiscriminatedUnion,Bn as ZodEffects,ar as ZodEnum,Kt as ZodError,Yp as ZodFirstPartyTypeKind,pg as ZodFunction,qo as ZodIntersection,G as ZodIssueCode,Go as ZodLazy,Vo as ZodLiteral,yg as ZodMap,hg as ZodNaN,Jo as ZodNativeEnum,Gr as ZodNever,Xo as ZodNull,er as ZodNullable,Yo as ZodNumber,tr as ZodObject,an as ZodOptional,te as ZodParsedType,Qo as ZodPipeline,Ta as ZodPromise,_a as ZodReadonly,Pg as ZodRecord,Eg as ZodRef,he as ZodSchema,Sg as ZodSet,gt as ZodString,Ug as ZodSymbol,Bn as ZodTransformer,rr as ZodTuple,he as ZodType,ba as ZodUndefined,es as ZodUnion,Ur as ZodUnknown,Kg as ZodVoid,ee as addIssueToContext,Zx as agent,Wx as aimodel,nP as any,oP as array,Xx as bigint,Wg as boolean,wa as botIdHeader,Oy as botUserIdHeader,OP as coerce,xa as configurationHeader,Ny as configurationTypeHeader,Hx as conversation,va as createZodEnum,Ig as cuid2Regex,kg as cuidRegex,ug as custom,zx as datasource,Yx as date,cP as discriminatedUnion,Gc as effect,Og as emailRegex,bP as enum,ue as errorUtil,jx as event,vP as function,Kr as getErrorMap,rn as getParsedType,Vx as instanceof,Ry as integrationIdHeader,Fx as intent,fP as intersection,Mg as ipv4Regex,Ng as ipv6Regex,_o as isAborted,tU as isApiError,ki as isAsync,bo as isDirty,Mx as isEmojiRegex,Lr as isValid,qx as knowledgebase,Gx as late,TP as lazy,_P as literal,Si as makeIssue,mP as map,Vr as mergeObjectSchemas,$x as message,Cy as messages,Jx as nan,wP as nativeEnum,iP as never,tP as null,BP as nullable,Fg as number,sP as object,To as objectUtil,CP as oboolean,AP as onumber,Pa as operationHeader,PP as optional,IP as ostring,Ct as parseBody,kP as pipeline,SP as preprocess,me as processCreateParams,xP as promise,kx as quotelessJson,yP as readonly,pP as record,gP as ref,za as serve,hP as set,tg as setErrorMap,lP as strictObject,Lg as string,Qx as symbol,Kx as table,Lx as tablerow,Gc as transformer,zv as transforms,dP as tuple,Dy as typeHeader,Ag as ulidRegex,eP as undefined,uP as union,rP as unknown,Ux as user,be as util,Cg as uuidRegex,Dx as variable,aP as void,My as webhookIdHeader,ne as z};
88
+ `)+" "+F[1]:F[0]+j+" "+D.join(", ")+" "+F[1]}xe.types=bI();function B(D){return Array.isArray(D)}xe.isArray=B;function v(D){return typeof D=="boolean"}xe.isBoolean=v;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 K(D){return typeof D=="string"}xe.isString=K;function ae(D){return typeof D=="symbol"}xe.isSymbol=ae;function ee(D){return D===void 0}xe.isUndefined=ee;function ge(D){return oe(D)&&Ve(D)==="[object RegExp]"}xe.isRegExp=ge,xe.types.isRegExp=ge;function oe(D){return typeof D=="object"&&D!==null}xe.isObject=oe;function re(D){return oe(D)&&Ve(D)==="[object Date]"}xe.isDate=re,xe.types.isDate=re;function Oe(D){return oe(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=wI();function Ve(D){return Object.prototype.toString.call(D)}function Je(D){return D<10?"0"+D.toString(10):D.toString(10)}var mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(){var D=new Date,j=[Je(D.getHours()),Je(D.getMinutes()),Je(D.getSeconds())].join(":");return[D.getDate(),mt[D.getMonth()],j].join(" ")}xe.log=function(){console.log("%s - %s",Ue(),xe.format.apply(xe,arguments))},xe.inherits=Mt(),xe._extend=function(D,j){if(!j||!oe(j))return D;for(var F=Object.keys(j),de=F.length;de--;)D[F[de]]=j[F[de]];return D};function Pe(D,j){return Object.prototype.hasOwnProperty.call(D,j)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(j){if(typeof j!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&j[Se]){if(F=j[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,A=new Promise(function(X,ie){de=X,Te=ie}),k=[],$=0;$<arguments.length;$++)k.push(arguments[$]);k.push(function(X,ie){X?Te(X):de(ie)});try{j.apply(this||si,k)}catch(X){Te(X)}return A}return Object.setPrototypeOf(F,Object.getPrototypeOf(j)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(j))},xe.promisify.custom=Se;function fe(D,j){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return j(D)}function ve(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function j(){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 A=this||si,k=function(){return Te.apply(A,arguments)};D.apply(this||si,F).then(function($){t.nextTick(k.bind(null,null,$))},function($){t.nextTick(fe.bind(null,$,k))})}return Object.setPrototypeOf(j,Object.getPrototypeOf(D)),Object.defineProperties(j,e(D)),j}return xe.callbackify=ve,xe}var ce=xI();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 DR=ce._extend,HR=ce.callbackify,UR=ce.debuglog,ZR=ce.deprecate,$R=ce.format,jR=ce.inherits,KR=ce.inspect,LR=ce.isArray,FR=ce.isBoolean,WR=ce.isBuffer,zR=ce.isDate,qR=ce.isError,GR=ce.isFunction,VR=ce.isNull,JR=ce.isNullOrUndefined,XR=ce.isNumber,YR=ce.isObject,QR=ce.isPrimitive,e0=ce.isRegExp,t0=ce.isString,n0=ce.isSymbol,r0=ce.isUndefined,i0=ce.log,a0=ce.promisify,o0=ce.types,s0=ce.TextEncoder=globalThis.TextEncoder,l0=ce.TextDecoder=globalThis.TextDecoder;var hr=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 Kn=class extends hr{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new Kn({...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})}};C();R();O();var EI=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),xv=t=>async e=>{let n=$h(e.headers),[,r]=(e.headers.traceparent||"").split("-"),a=new BI({botId:n.botId,integrationId:n.integrationId,retry:Va,headers:EI(e.headers)}),s=new ii(a),i=new Kn({traceId:r}),o={ctx:n,req:e,client:s,logger:i,instance:t};try{let l;switch(l=await NI(o),n.operation){case"webhook_received":l=await kI(o);break;case"register":l=await II(o);break;case"unregister":l=await AI(o);break;case"message_created":l=await RI(o);break;case"action_triggered":l=await MI(o);break;case"ping":l=await SI(o);break;case"create_user":l=await CI(o);break;case"create_conversation":l=await OI(o);break;default:if(!l)throw new Error(`Unknown operation ${n.operation}`)}return l?{...l,status:l.status??200}:{status:200}}catch(l){if(PI(l)){let p=l.type==="Runtime"?l:new wv(l.message,l);return i.forBot().error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}console.error(l);let f=new wv("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 i.forBot().error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}},SI=async t=>{},kI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{let{req:s}=Ct(n);return a.webhook({client:t,ctx:e,req:s,logger:r})},II=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.register)return;let{webhookUrl:s}=Ct(n);await a.register({client:t,ctx:e,webhookUrl:s,logger:r})},AI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.unregister)return;let{webhookUrl:s}=Ct(n);await a.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},CI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createUser)return;let{tags:s}=Ct(n);return await a.createUser({ctx:e,client:t,tags:s,logger:r})},OI=async({client:t,ctx:e,req:n,logger:r,instance:a})=>{if(!a.createConversation)return;let{channel:s,tags:i}=Ct(n);return await a.createConversation({ctx:e,client:t,channel:s,tags:i,logger:r})},RI=async({ctx:t,req:e,client:n,logger:r,instance:a})=>{let{conversation:s,user:i,type:o,payload:l,message:f}=Ct(e),p=a.channels[s.channel];if(!p)throw new Error(`Channel ${s.channel} not found`);let y=p.messages[o];if(!y)throw new Error(`Message of type ${o} not found in channel ${s.channel}`);await y({ctx:t,conversation:s,message:f,user:i,type:o,client:n,payload:l,ack:async({tags:h})=>{await n.updateMessage({id:f.id,tags:h})},logger:r})},MI=async({req:t,ctx:e,client:n,logger:r,instance:a})=>{let{input:s,type:i}=Ct(t);if(!i)throw new Error("Missing action type");let o=a.actions[i];if(!o)throw new Error(`Action ${i} not found`);let l=new Ja,p={output:await o({ctx:e,input:s,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(p)}},NI=async({instance:t,client:e,ctx:n,logger:r,req:a})=>{let s=t.integrationOperationHandler;if(s)return await s({client:e,ctx:n,logger:r,req:a})??{status:200}};var Ul=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.integrationOperationHandler=e.__advanced?.integrationOperationHandler}actions;channels;register;unregister;createUser;createConversation;webhook;integrationOperationHandler;handler=xv(this);start=e=>za(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var Zl=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.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;withPlugins;addIntegration(e,n){let r=this;return r.integrations||(r.integrations={}),r.integrations[e.name]={enabled:n.enabled,...e,configurationType:n.configurationType,configuration:n.configuration,disabledChannels:n.disabledChannels},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let a=n.alias??e.name.replace("/","-");return r.plugins[a]={...e,alias:a,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,a)),r.withPlugins.events=this._mergeEvents(r.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,a)),r.withPlugins.actions=this._mergeActions(r.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,a)),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}${fn}${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,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,a]of n){let s=Object.entries(a.interfaces??{});for(let[i,o]of s){let l=this.integrations?.[o.name];if(!l)throw new Error(`Interface with alias "${i}" of plugin with alias "${r}" references integration "${o.name}" which is not installed`);let f=Object.entries(o.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,a])=>[r,{...a,schema:this._dereferenceZuiSchema(a.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,a])=>[r,{...a,input:{schema:this._dereferenceZuiSchema(a.input.schema,n)},output:{schema:this._dereferenceZuiSchema(a.output.schema,n)}}]))}};C();R();O();C();R();O();import{isApiError as KI,Client as LI,RuntimeError as Ev}from"@botpress/client";C();R();O();var Ln=class extends hr{constructor(e){super({...e})}with(e){return new Ln({...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})}};C();R();O();C();R();O();var en=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}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);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 a=await this._client[e](n),s=this._hooks.after[e];return s&&(a=await s(a,n)),a}};C();R();O();C();R();O();var vr=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>dn({workflowName:n,client:t,input:r}),running:r=>dn({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>dn({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>dn({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>dn({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>dn({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>dn({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>dn({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:a}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:pn({client:t,workflow:a})}}})}),dn=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>pn({client:t.client,workflow:n}))}},pn=t=>({...t.workflow,async update(e){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:pn({client:t.client,workflow:n})}},async setFailed({failureReason:e}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:pn({client:t.client,workflow:n})}},async setCompleted({output:e}={}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:pn({client:t.client,workflow:n})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:pn({client:t.client,workflow:e})}}});C();R();O();C();R();O();var DI=Y.enum(["event_received","register","unregister","ping","action_triggered"]),Pv=t=>{let e=t[wa],n=t[xa],r=t[Dy],a=DI.parse(t[Pa]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing type headers");if(!n)throw new Error("Missing configuration headers");if(!a)throw new Error("Missing operation headers");return{botId:e,operation:a,type:r,configuration:n?JSON.parse(q.from(n,"base64").toString("utf-8")):{}}};C();R();O();var ft={status:200};C();R();O();C();R();O();var $l=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 HI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Bv=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!HI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:UI(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),ft;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 ZI(n,e);default:e.payload.type}return ft},UI=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),ZI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];return!r||r.length===0?(t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),ft):(await $I(t,e),await jI(t,e),ft)},$I=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},jI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];for(let a of r)await a({...t,conversation:e.payload.conversation,user:e.payload.user,workflow:pn({...t,workflow:e.payload.workflow}),workflows:vr(t.client)})};C();R();O();var Sv=t=>async e=>{let n=Pv(e.headers),r=new Ln,a=new LI({botId:n.botId,retry:Va}),s=new en(a,{before:{createMessage:async o=>{let l=t.hookHandlers.before_outgoing_message[o.type]??[];for(let f of l){let p=new en(a);o=(await f({client:p,ctx:n,logger:r.with({conversationId:o.conversationId,userId:o.userId}),data:o,...gn({client:p})}))?.data??o}return o},callAction:async o=>{let l=t.hookHandlers.before_outgoing_call_action[o.type]??[];for(let f of l){let p=new en(a);o=(await f({client:p,ctx:n,logger:r,data:o,...gn({client:p})}))?.data??o}return o}},after:{createMessage:async o=>{let l=t.hookHandlers.after_outgoing_message[o.message.type]??[];for(let f of l){let p=new en(a);o=(await f({client:p,ctx:n,logger:r.with({messageId:o.message.id,conversationId:o.message.conversationId,userId:o.message.userId}),data:o,...gn({client:p})}))?.data??o}return o},callAction:async(o,l)=>{let{type:f}=l,p=t.hookHandlers.after_outgoing_call_action[f]??[];for(let y of p){let g=new en(a);o=(await y({client:g,ctx:n,logger:r,data:{type:f,...o},...gn({client:g})}))?.data??o}return o}}}),i={req:e,ctx:n,logger:r,client:s,self:t};try{switch(n.operation){case"action_triggered":return await GI(i);case"event_received":return await qI(i);case"register":return await WI(i);case"unregister":return await zI(i);case"ping":return await FI(i);default:throw new Error(`Unknown operation ${n.operation}`)}}catch(o){let l=o instanceof Error?o:new Error(String(o));if(KI(l)){let p=l.type==="Runtime"?l:new Ev(l.message,l);return r.error(p.message),{status:p.code,body:JSON.stringify(p.toJSON())}}let f=new Ev("An unexpected error occurred in the bot.",l);return r.error(f.message,l),{status:f.code,body:JSON.stringify(f.toJSON())}}},FI=async t=>ft,WI=async t=>ft,zI=async t=>ft,qI=async t=>{let{ctx:e,logger:n,req:r,client:a,self:s}=t,i={client:a,ctx:e,logger:n,...gn({client:a})},o=Ct(r);if(i.logger=i.logger.with({eventId:o.event.id,messageId:o.event.messageId,conversationId:o.event.conversationId,userId:o.event.userId}),e.type==="workflow_update")return await Bv(t,o.event);if(e.type==="message_created"){let h=o.event,w=h.payload.message;i.logger=i.logger.with({messageId:w.id,conversationId:w.conversationId,userId:w.userId});let P=s.hookHandlers.before_incoming_message[w.type]??[];for(let E of P){let H=await E({...i,data:w});if(w=H?.data??w,H?.stop)return ft}let B={...i,user:h.payload.user,conversation:h.payload.conversation,message:w,event:h},v=s.messageHandlers[w.type]??[];for(let E of v)await E(B);let S=s.hookHandlers.after_incoming_message[w.type]??[];for(let E of S){let H=await E({...i,data:w});if(w=H?.data??w,H?.stop)return ft}return ft}if(e.type==="state_expired"){let w=o.event.payload.state,P={...i,state:w},B=s.stateExpiredHandlers["*"]??[];for(let v of B)await v(P);return ft}let l=o.event,f=s.hookHandlers.before_incoming_event[l.type]??[];for(let h of f){let w=await h({...i,data:l});if(l=w?.data??l,w?.stop)return ft}let p={...i,event:l},y=s.eventHandlers[l.type]??[];for(let h of y)await h(p);let g=s.hookHandlers.after_incoming_event[l.type]??[];for(let h of g){let w=await h({...i,data:l});if(l=w?.data??l,w?.stop)return ft}return ft},GI=async({ctx:t,logger:e,req:n,client:r,self:a})=>{let{input:s,type:i}=Ct(n);if(!i)throw new Error("Missing action type");let o=a.hookHandlers.before_incoming_call_action[i]??[];for(let g of o){let h=await g({ctx:t,logger:e,client:r,data:{type:i,input:s},...gn({client:r})});s=h?.data?.input??s,i=h?.data?.type??i}let l=a.actionHandlers[i];if(!l)throw new Error(`Action ${i} not found`);let f=await l({ctx:t,logger:e,input:s,client:r,type:i,...gn({client:r})}),p=a.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},...gn({client:r})});i=h?.data?.type??i,f=h?.data?.output??f}return{status:200,body:JSON.stringify({output:f})}},gn=t=>({workflows:vr(t.client)});var jl=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[a,s]of Object.entries(this._plugins)){let[i,o]=n.split(fn);if(!(i!==a||!o)&&(r=s.actionHandlers[o],r))return r}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(o=>o.messageHandlers[n]??[]),a=this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],i=[...a,...s].sort((o,l)=>o.order-l.order).map(({handler:o})=>o);return ye.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(o=>o.eventHandlers[n]??[]),a=this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],i=[...a,...s].sort((o,l)=>o.order-l.order).map(({handler:o})=>o);return ye.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(o=>o.stateExpiredHandlers[n]??[]),a=this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],i=[...a,...s].sort((o,l)=>o.order-l.order).map(({handler:o})=>o);return ye.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(a,s)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[s]??[]),o=this._hookHandlers[n]??{},l=o[s]??[],f=o["*"]??[],p=[...l,...f].sort((y,g)=>y.order-g.order).map(({handler:y})=>y);return ye.unique([...i,...p])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(a,s)=>{let i=r[s]?.sort((l,f)=>l.order-f.order).map(({handler:l})=>l)??[],o=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return ye.unique([...i,...o])}})}})}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=Sv(this);start=e=>za(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var Kl=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;let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:Le.mapValues(e.events,i=>({...i,schema:i.schema(n)})),a=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)}})),s=e.channels===void 0?{}:Le.mapValues(e.channels,i=>({...i,messages:Le.mapValues(i.messages,o=>({...o,schema:o.schema(n)}))}));this.events=r,this.actions=a,this.channels=s}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;_getEntityReference=e=>{let n={};for(let[r,a]of Object.entries(e)){let s=a.schema._def["x-zui"]?.title,i=a.schema._def.description,o=by.ref(r);s&&o.title(s),i&&o.describe(i),n[r]=o}return n}};C();R();O();C();R();O();C();R();O();C();R();O();var Ll=class{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([r,a])=>[r,Object.fromEntries(Object.entries(a.definition.entities??{}).map(([s])=>[s,Y.ref(`interface:${r}/entities/${s}`)]))]));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.configuration=e.configuration,this.states=Object.fromEntries(Object.entries(e.states??{}).map(([r,a])=>[r,{...a,schema:typeof a.schema=="object"?a.schema:a.schema({entities:n})}])),this.events=Object.fromEntries(Object.entries(e.events??{}).map(([r,a])=>[r,{...a,schema:typeof a.schema=="object"?a.schema:a.schema({entities:n})}])),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([r,a])=>[r,{...a,input:{...a.input,schema:typeof a.input.schema=="object"?a.input.schema:a.input.schema({entities:n})},output:{...a.output,schema:typeof a.output.schema=="object"?a.output.schema:a.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([r,a])=>[r,{...a,schema:typeof a.schema=="object"?a.schema:a.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;dereferenceEntities({intersectWithUnknownRecord:e}={intersectWithUnknownRecord:!0}){let n=this._buildZuiReferenceMap(e);return{...this,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(([a,s])=>[`interface:${n}/entities/${a}`,e?s.schema.and(Y.record(Y.string(),Y.unknown())):s.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,a])=>[r,{...a,schema:this._dereferenceZuiSchema(a.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([r,a])=>[r,{...a,input:{schema:this._dereferenceZuiSchema(a.input.schema,n)},output:{schema:this._dereferenceZuiSchema(a.output.schema,n)}}]))}};C();R();O();C();R();O();C();R();O();C();R();O();var Fl=":";var kv=t=>{let[e,n]=t.split(Fl);return!e||!n?null:{namespace:e,eventName:n}},Iv=t=>`${t.namespace}${Fl}${t.actionName}`,Av=t=>`${t.namespace}${Fl}${t.eventName}`,Cv=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,a=n.actions[t.actionName]?.name??t.actionName;return{namespace:r,actionName:a}},Ov=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,a=n.events[t.eventName]?.name??t.eventName;return{namespace:r,eventName:a}};var Rv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,s)=>i=>VI({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:s,input:i})})}),VI=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:a})=>{let s=Cv({namespace:n,actionName:r},e),i=Iv(s);return(await t.callAction({type:i,input:a})).output};C();R();O();C();R();O();C();R();O();var Fn=class{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:r,messageId:a}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:r,messageId:a})}async schedule(e,n){let{conversationId:r,userId:a,messageId:s}=this._props;await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:r,userId:a,messageId:s,schedule:n})}withConversationId(e){return new Fn({...this._props,conversationId:e})}withUserId(e){return new Fn({...this._props,userId:e})}withMessageId(e){return new Fn({...this._props,messageId:e})}},Mv=(t,e)=>new Proxy({},{get:(n,r)=>{let a=e.alias!==void 0?`${e.alias}${fn}${r}`:r;return new Fn({client:t,eventName:a})}});C();R();O();C();R();O();C();R();O();var Wl=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){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n})}async getOrSet(e,n){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n}).then(r=>r.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})}},Nv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(a,s)=>{let i=e.alias!==void 0?`${e.alias}${fn}${s}`:s;return new Wl(t,r,i)}})});C();R();O();var zl=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:a}=this._runtime,s=Rv(e,this._runtime),i=Nv(e,this._runtime),o=vr(e),l=Mv(e,this._runtime);return{configuration:n,interfaces:r,actions:s,states:i,alias:a,workflows:o,events:l}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return Qt.setName(a=>r({...a,...this._getTools(a.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._messageHandlers[n]??[],a=this._messageHandlers["*"]??[];return ye.unique([...r,...a]).sort((i,o)=>i.order-o.order).map(({handler:i})=>Qt.setName(o=>i({...o,...this._getTools(o.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._eventHandlers[n]??[],a=Object.entries(this._eventHandlers).filter(([o])=>this._eventResolvesTo(o,n)).flatMap(([,o])=>o??[]),s=this._eventHandlers["*"]??[];return ye.unique([...r,...a,...s]).sort((o,l)=>o.order-l.order).map(({handler:o})=>Qt.setName(l=>o({...l,...this._getTools(l.client)}),o.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._stateExpiredHandlers[n]??[],a=this._stateExpiredHandlers["*"]??[];return ye.unique([...r,...a]).sort((i,o)=>i.order-o.order).map(({handler:i})=>Qt.setName(o=>i({...o,...this._getTools(o.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(a,s)=>{s=this._stripAliasPrefix(s);let i=r[s]??[],o=Object.entries(r).filter(([p])=>this._eventResolvesTo(p,s)).flatMap(([,p])=>p??[]),l=r["*"]??[];return ye.unique([...i,...o,...l]).sort((p,y)=>p.order-y.order).map(({handler:p})=>Qt.setName(y=>p({...y,...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:(a,s)=>(r[s]?.sort((o,l)=>o.order-l.order)??[]).map(({handler:o})=>Qt.setName(l=>o({...l,...this._getTools(l.client)}),o.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=kv(e);if(!r)return!1;let a=Ov(r,this._runtime.interfaces);return Av(a)===n};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}:`;return e.startsWith(r)?e.slice(r.length):e}};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();export{Rx as BRAND,jl as Bot,Zl as BotDefinition,Ln as BotLogger,en as BotSpecificClient,Xn as DIRTY,Ix as EMPTY_PATH,pe as INVALID,Ul as Integration,el as IntegrationDefinition,Kn as IntegrationLogger,ii as IntegrationSpecificClient,Kl as InterfaceDefinition,RP as NEVER,pt as OK,It as ParseInputLazyPath,vt as ParseStatus,zl as Plugin,Ll as PluginDefinition,tU as RuntimeError,he as Schema,XA as WELL_KNOWN_ATTRIBUTES,Fr as ZodAny,Wr as ZodArray,jo as ZodBigInt,Ko as ZodBoolean,Lo as ZodBranded,Fo as ZodCatch,Wo as ZodDate,ha as ZodDefault,fg as ZodDiscriminatedUnion,En as ZodEffects,or as ZodEnum,Kt as ZodError,Yp as ZodFirstPartyTypeKind,pg as ZodFunction,qo as ZodIntersection,G as ZodIssueCode,Go as ZodLazy,Vo as ZodLiteral,yg as ZodMap,hg as ZodNaN,Jo as ZodNativeEnum,Gr as ZodNever,Xo as ZodNull,tr as ZodNullable,Yo as ZodNumber,nr as ZodObject,an as ZodOptional,ne as ZodParsedType,Qo as ZodPipeline,Ta as ZodPromise,_a as ZodReadonly,Pg as ZodRecord,Eg as ZodRef,he as ZodSchema,Sg as ZodSet,gt as ZodString,Ug as ZodSymbol,En as ZodTransformer,ir as ZodTuple,he as ZodType,ba as ZodUndefined,es as ZodUnion,Ur as ZodUnknown,Kg as ZodVoid,te as addIssueToContext,$x as agent,Wx as aimodel,nP as any,oP as array,Xx as bigint,Wg as boolean,wa as botIdHeader,Oy as botUserIdHeader,OP as coerce,xa as configurationHeader,Ny as configurationTypeHeader,Hx as conversation,va as createZodEnum,Ig as cuid2Regex,kg as cuidRegex,ug as custom,zx as datasource,Yx as date,cP as discriminatedUnion,Gc as effect,Og as emailRegex,bP as enum,ue as errorUtil,jx as event,vP as function,Kr as getErrorMap,rn as getParsedType,Vx as instanceof,Ry as integrationIdHeader,Fx as intent,fP as intersection,Mg as ipv4Regex,Ng as ipv6Regex,_o as isAborted,eU as isApiError,ki as isAsync,bo as isDirty,Mx as isEmojiRegex,Lr as isValid,qx as knowledgebase,Gx as late,TP as lazy,_P as literal,Si as makeIssue,mP as map,Vr as mergeObjectSchemas,Zx as message,Cy as messages,Jx as nan,wP as nativeEnum,iP as never,tP as null,BP as nullable,Fg as number,sP as object,To as objectUtil,CP as oboolean,AP as onumber,Pa as operationHeader,PP as optional,IP as ostring,Ct as parseBody,kP as pipeline,SP as preprocess,me as processCreateParams,xP as promise,kx as quotelessJson,yP as readonly,pP as record,gP as ref,za as serve,hP as set,tg as setErrorMap,lP as strictObject,Lg as string,Qx as symbol,Kx as table,Lx as tablerow,Gc as transformer,zv as transforms,dP as tuple,Dy as typeHeader,Ag as ulidRegex,eP as undefined,uP as union,rP as unknown,Ux as user,be as util,Cg as uuidRegex,Dx as variable,aP as void,My as webhookIdHeader,Y as z};
89
89
  /*! Bundled license information:
90
90
 
91
91
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: