@holocronlab/botruntime-sdk 6.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/dist/base-logger.d.ts +34 -0
- package/dist/base-logger.test.d.ts +1 -0
- package/dist/bot/bot-logger.d.ts +18 -0
- package/dist/bot/client/index.d.ts +80 -0
- package/dist/bot/client/types.d.ts +254 -0
- package/dist/bot/client/types.test.d.ts +1 -0
- package/dist/bot/common/generic.d.ts +41 -0
- package/dist/bot/common/generic.test.d.ts +1 -0
- package/dist/bot/common/index.d.ts +2 -0
- package/dist/bot/common/types.d.ts +54 -0
- package/dist/bot/common/types.test.d.ts +1 -0
- package/dist/bot/definition.d.ts +214 -0
- package/dist/bot/definition.test.d.ts +1 -0
- package/dist/bot/implementation.d.ts +72 -0
- package/dist/bot/implementation.test.d.ts +1 -0
- package/dist/bot/index.d.ts +6 -0
- package/dist/bot/server/context.d.ts +2 -0
- package/dist/bot/server/index.d.ts +5 -0
- package/dist/bot/server/responses.d.ts +3 -0
- package/dist/bot/server/types.d.ts +423 -0
- package/dist/bot/server/types.test.d.ts +1 -0
- package/dist/bot/server/workflows/update-handler.d.ts +3 -0
- package/dist/bot/server/workflows/update-type-conv.d.ts +2 -0
- package/dist/bot/workflow-proxy/index.d.ts +2 -0
- package/dist/bot/workflow-proxy/proxy.d.ts +17 -0
- package/dist/bot/workflow-proxy/types.d.ts +80 -0
- package/dist/bot/workflow-proxy/types.test.d.ts +1 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/recurring-events.d.ts +9 -0
- package/dist/common/recurring-events.test.d.ts +1 -0
- package/dist/common/types.d.ts +8 -0
- package/dist/consts.d.ts +11 -0
- package/dist/errors.d.ts +19 -0
- package/dist/fixtures.d.ts +357 -0
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.mjs +34 -0
- package/dist/index.mjs.map +7 -0
- package/dist/integration/client/index.d.ts +55 -0
- package/dist/integration/client/sub-types.d.ts +27 -0
- package/dist/integration/client/sub-types.test.d.ts +1 -0
- package/dist/integration/client/types.d.ts +209 -0
- package/dist/integration/client/types.test.d.ts +1 -0
- package/dist/integration/common/generic.d.ts +57 -0
- package/dist/integration/common/generic.test.d.ts +1 -0
- package/dist/integration/common/index.d.ts +1 -0
- package/dist/integration/definition/branded-schema.d.ts +21 -0
- package/dist/integration/definition/definition.test.d.ts +1 -0
- package/dist/integration/definition/generic.d.ts +9 -0
- package/dist/integration/definition/index.d.ts +130 -0
- package/dist/integration/definition/types.d.ts +119 -0
- package/dist/integration/implementation.d.ts +37 -0
- package/dist/integration/index.d.ts +5 -0
- package/dist/integration/server/action-metadata.d.ts +9 -0
- package/dist/integration/server/context.d.ts +4 -0
- package/dist/integration/server/index.d.ts +6 -0
- package/dist/integration/server/integration-logger.d.ts +36 -0
- package/dist/integration/server/types.d.ts +108 -0
- package/dist/interface/common/generic.d.ts +34 -0
- package/dist/interface/common/generic.test.d.ts +1 -0
- package/dist/interface/common/index.d.ts +1 -0
- package/dist/interface/definition.d.ts +87 -0
- package/dist/interface/index.d.ts +2 -0
- package/dist/interface/resolve.d.ts +18 -0
- package/dist/log.d.ts +7 -0
- package/dist/message.d.ts +742 -0
- package/dist/package.d.ts +64 -0
- package/dist/plugin/action-proxy/index.d.ts +2 -0
- package/dist/plugin/action-proxy/proxy.d.ts +5 -0
- package/dist/plugin/action-proxy/types.d.ts +14 -0
- package/dist/plugin/action-proxy/types.test.d.ts +1 -0
- package/dist/plugin/common/generic.d.ts +63 -0
- package/dist/plugin/common/generic.test.d.ts +1 -0
- package/dist/plugin/common/index.d.ts +2 -0
- package/dist/plugin/common/types.d.ts +59 -0
- package/dist/plugin/conversation-proxy/index.d.ts +2 -0
- package/dist/plugin/conversation-proxy/proxy.d.ts +13 -0
- package/dist/plugin/conversation-proxy/types.d.ts +54 -0
- package/dist/plugin/conversation-proxy/types.test.d.ts +1 -0
- package/dist/plugin/definition.d.ts +152 -0
- package/dist/plugin/definition.test.d.ts +1 -0
- package/dist/plugin/event-proxy/index.d.ts +2 -0
- package/dist/plugin/event-proxy/proxy.d.ts +5 -0
- package/dist/plugin/event-proxy/types.d.ts +19 -0
- package/dist/plugin/event-proxy/types.test.d.ts +1 -0
- package/dist/plugin/implementation.d.ts +71 -0
- package/dist/plugin/implementation.test.d.ts +1 -0
- package/dist/plugin/index.d.ts +4 -0
- package/dist/plugin/message-proxy/index.d.ts +2 -0
- package/dist/plugin/message-proxy/proxy.d.ts +13 -0
- package/dist/plugin/message-proxy/types.d.ts +22 -0
- package/dist/plugin/server/index.d.ts +1 -0
- package/dist/plugin/server/types.d.ts +505 -0
- package/dist/plugin/server/types.test.d.ts +1 -0
- package/dist/plugin/state-proxy/index.d.ts +2 -0
- package/dist/plugin/state-proxy/proxy.d.ts +5 -0
- package/dist/plugin/state-proxy/types.d.ts +29 -0
- package/dist/plugin/state-proxy/types.test.d.ts +1 -0
- package/dist/plugin/tag-prefixer.d.ts +10 -0
- package/dist/plugin/tag-prefixer.test.d.ts +1 -0
- package/dist/plugin/user-proxy/index.d.ts +2 -0
- package/dist/plugin/user-proxy/proxy.d.ts +14 -0
- package/dist/plugin/user-proxy/types.d.ts +30 -0
- package/dist/public-consts.d.ts +9 -0
- package/dist/retry.d.ts +2 -0
- package/dist/retry.test.d.ts +1 -0
- package/dist/schema.d.ts +18 -0
- package/dist/serve.d.ts +38 -0
- package/dist/utils/api-paging-utils.d.ts +43 -0
- package/dist/utils/api-paging-utils.test.d.ts +1 -0
- package/dist/utils/array-utils.d.ts +2 -0
- package/dist/utils/error-utils.d.ts +4 -0
- package/dist/utils/function-utils.d.ts +2 -0
- package/dist/utils/function-utils.test.d.ts +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/record-utils.d.ts +6 -0
- package/dist/utils/record-utils.test.d.ts +1 -0
- package/dist/utils/type-utils.d.ts +63 -0
- package/dist/utils/type-utils.test.d.ts +1 -0
- package/dist/version-utils.d.ts +18 -0
- package/dist/version.d.ts +1 -0
- package/dist/zui.d.ts +9 -0
- package/package.json +59 -0
- package/readme.md +11 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var sr=Object.defineProperty;var $c=Object.getOwnPropertyDescriptor;var Lc=Object.getOwnPropertyNames;var Fc=Object.prototype.hasOwnProperty;var He=(t,e)=>()=>(t&&(e=t(t=0)),e);var Pt=(t,e)=>{for(var n in e)sr(t,n,{get:e[n],enumerable:!0})},Gc=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of Lc(e))!Fc.call(t,c)&&c!==n&&sr(t,c,{get:()=>e[c],enumerable:!(s=$c(e,c))||s.enumerable});return t};var qc=t=>Gc(sr({},"__esModule",{value:!0}),t);var _=He(()=>{});var G={};Pt(G,{_debugEnd:()=>Vo,_debugProcess:()=>zo,_events:()=>us,_eventsCount:()=>fs,_exiting:()=>ko,_fatalExceptions:()=>Lo,_getActiveHandles:()=>Ro,_getActiveRequests:()=>Co,_kill:()=>Ho,_linkedBinding:()=>Io,_maxListeners:()=>cs,_preload_modules:()=>ss,_rawDebug:()=>Po,_startProfilerIdleNotifier:()=>Zo,_stopProfilerIdleNotifier:()=>Yo,_tickCallback:()=>qo,abort:()=>es,addListener:()=>gs,allowedNodeEnvironmentFlags:()=>Wo,arch:()=>co,argv:()=>go,argv0:()=>os,assert:()=>Ko,binding:()=>To,browser:()=>xo,chdir:()=>wo,config:()=>Ao,cpuUsage:()=>xn,cwd:()=>bo,debugPort:()=>is,default:()=>ws,dlopen:()=>So,domain:()=>Eo,emit:()=>hs,emitWarning:()=>ho,env:()=>fo,execArgv:()=>po,execPath:()=>rs,exit:()=>Uo,features:()=>$o,hasUncaughtExceptionCaptureCallback:()=>Go,hrtime:()=>Bn,kill:()=>No,listeners:()=>bs,memoryUsage:()=>Do,moduleLoadList:()=>_o,nextTick:()=>so,off:()=>ds,on:()=>dt,once:()=>ps,openStdin:()=>jo,pid:()=>ts,platform:()=>uo,ppid:()=>ns,prependListener:()=>Ts,prependOnceListener:()=>vs,reallyExit:()=>Oo,release:()=>Bo,removeAllListeners:()=>ys,removeListener:()=>ms,resourceUsage:()=>Mo,setSourceMapsEnabled:()=>as,setUncaughtExceptionCaptureCallback:()=>Fo,stderr:()=>Xo,stdin:()=>Qo,stdout:()=>Jo,title:()=>lo,umask:()=>vo,uptime:()=>ls,version:()=>mo,versions:()=>yo});function cr(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function zc(){!$t||!St||($t=!1,St.length?pt=St.concat(pt):wn=-1,pt.length&&oo())}function oo(){if(!$t){var t=setTimeout(zc,0);$t=!0;for(var e=pt.length;e;){for(St=pt,pt=[];++wn<e;)St&&St[wn].run();wn=-1,e=pt.length}St=null,$t=!1,clearTimeout(t)}}function so(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];pt.push(new ao(t,e)),pt.length===1&&!$t&&setTimeout(oo,0)}function ao(t,e){this.fun=t,this.array=e}function Me(){}function Io(t){cr("_linkedBinding")}function So(t){cr("dlopen")}function Co(){return[]}function Ro(){return[]}function Ko(t,e){if(!t)throw new Error(e||"assertion error")}function Go(){return!1}function ls(){return _t.now()/1e3}function Bn(t){var e=Math.floor((Date.now()-_t.now())*.001),n=_t.now()*.001,s=Math.floor(n)+e,c=Math.floor(n%1*1e9);return t&&(s=s-t[0],c=c-t[1],c<0&&(s--,c+=lr)),[s,c]}function dt(){return ws}function bs(t){return[]}var pt,$t,St,wn,lo,co,uo,fo,go,po,mo,yo,ho,To,vo,bo,wo,Bo,xo,Po,_o,Eo,ko,Ao,Oo,Ho,xn,Mo,Do,No,Uo,jo,Wo,$o,Lo,Fo,qo,zo,Vo,Zo,Yo,Jo,Xo,Qo,es,ts,ns,rs,is,os,ss,as,_t,ar,lr,cs,us,fs,gs,ps,ds,ms,ys,hs,Ts,vs,ws,Bs=He(()=>{_();E();I();pt=[],$t=!1,wn=-1;ao.prototype.run=function(){this.fun.apply(null,this.array)};lo="browser",co="x64",uo="browser",fo={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},go=["/usr/bin/node"],po=[],mo="v16.8.0",yo={},ho=function(t,e){console.warn((e?e+": ":"")+t)},To=function(t){cr("binding")},vo=function(t){return 0},bo=function(){return"/"},wo=function(t){},Bo={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};xo=!0,Po=Me,_o=[];Eo={},ko=!1,Ao={};Oo=Me,Ho=Me,xn=function(){return{}},Mo=xn,Do=xn,No=Me,Uo=Me,jo=Me,Wo={};$o={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Lo=Me,Fo=Me;qo=Me,zo=Me,Vo=Me,Zo=Me,Yo=Me,Jo=void 0,Xo=void 0,Qo=void 0,es=Me,ts=2,ns=1,rs="/bin/usr/node",is=9229,os="node",ss=[],as=Me,_t={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};_t.now===void 0&&(ar=Date.now(),_t.timing&&_t.timing.navigationStart&&(ar=_t.timing.navigationStart),_t.now=()=>Date.now()-ar);lr=1e9;Bn.bigint=function(t){var e=Bn(t);return typeof BigInt>"u"?e[0]*lr+e[1]:BigInt(e[0]*lr)+BigInt(e[1])};cs=10,us={},fs=0;gs=dt,ps=dt,ds=dt,ms=dt,ys=dt,hs=Me,Ts=dt,vs=dt;ws={version:mo,versions:yo,arch:co,platform:uo,browser:xo,release:Bo,_rawDebug:Po,moduleLoadList:_o,binding:To,_linkedBinding:Io,_events:us,_eventsCount:fs,_maxListeners:cs,on:dt,addListener:gs,once:ps,off:ds,removeListener:ms,removeAllListeners:ys,emit:hs,prependListener:Ts,prependOnceListener:vs,listeners:bs,domain:Eo,_exiting:ko,config:Ao,dlopen:So,uptime:ls,_getActiveRequests:Co,_getActiveHandles:Ro,reallyExit:Oo,_kill:Ho,cpuUsage:xn,resourceUsage:Mo,memoryUsage:Do,kill:No,exit:Uo,openStdin:jo,allowedNodeEnvironmentFlags:Wo,assert:Ko,features:$o,_fatalExceptions:Lo,setUncaughtExceptionCaptureCallback:Fo,hasUncaughtExceptionCaptureCallback:Go,emitWarning:ho,nextTick:so,_tickCallback:qo,_debugProcess:zo,_debugEnd:Vo,_startProfilerIdleNotifier:Zo,_stopProfilerIdleNotifier:Yo,stdout:Jo,stdin:Qo,stderr:Xo,abort:es,umask:vo,chdir:wo,cwd:bo,env:fo,title:lo,argv:go,execArgv:po,pid:ts,ppid:ns,execPath:rs,debugPort:is,hrtime:Bn,argv0:os,_preload_modules:ss,setSourceMapsEnabled:as}});var I=He(()=>{Bs()});function Vc(){if(xs)return nn;xs=!0,nn.byteLength=i,nn.toByteArray=g,nn.fromByteArray=f;for(var t=[],e=[],n=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=s.length;c<l;++c)t[c]=s[c],e[s.charCodeAt(c)]=c;e[45]=62,e[95]=63;function r(y){var b=y.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=y.indexOf("=");B===-1&&(B=b);var x=B===b?0:4-B%4;return[B,x]}function i(y){var b=r(y),B=b[0],x=b[1];return(B+x)*3/4-x}function u(y,b,B){return(b+B)*3/4-B}function g(y){var b,B=r(y),x=B[0],v=B[1],k=new n(u(y,x,v)),P=0,D=v>0?x-4:x,U;for(U=0;U<D;U+=4)b=e[y.charCodeAt(U)]<<18|e[y.charCodeAt(U+1)]<<12|e[y.charCodeAt(U+2)]<<6|e[y.charCodeAt(U+3)],k[P++]=b>>16&255,k[P++]=b>>8&255,k[P++]=b&255;return v===2&&(b=e[y.charCodeAt(U)]<<2|e[y.charCodeAt(U+1)]>>4,k[P++]=b&255),v===1&&(b=e[y.charCodeAt(U)]<<10|e[y.charCodeAt(U+1)]<<4|e[y.charCodeAt(U+2)]>>2,k[P++]=b>>8&255,k[P++]=b&255),k}function d(y){return t[y>>18&63]+t[y>>12&63]+t[y>>6&63]+t[y&63]}function p(y,b,B){for(var x,v=[],k=b;k<B;k+=3)x=(y[k]<<16&16711680)+(y[k+1]<<8&65280)+(y[k+2]&255),v.push(d(x));return v.join("")}function f(y){for(var b,B=y.length,x=B%3,v=[],k=16383,P=0,D=B-x;P<D;P+=k)v.push(p(y,P,P+k>D?D:P+k));return x===1?(b=y[B-1],v.push(t[b>>2]+t[b<<4&63]+"==")):x===2&&(b=(y[B-2]<<8)+y[B-1],v.push(t[b>>10]+t[b>>4&63]+t[b<<2&63]+"=")),v.join("")}return nn}function Zc(){if(Ps)return Pn;Ps=!0;return Pn.read=function(t,e,n,s,c){var l,r,i=c*8-s-1,u=(1<<i)-1,g=u>>1,d=-7,p=n?c-1:0,f=n?-1:1,y=t[e+p];for(p+=f,l=y&(1<<-d)-1,y>>=-d,d+=i;d>0;l=l*256+t[e+p],p+=f,d-=8);for(r=l&(1<<-d)-1,l>>=-d,d+=s;d>0;r=r*256+t[e+p],p+=f,d-=8);if(l===0)l=1-g;else{if(l===u)return r?NaN:(y?-1:1)*(1/0);r=r+Math.pow(2,s),l=l-g}return(y?-1:1)*r*Math.pow(2,l-s)},Pn.write=function(t,e,n,s,c,l){var r,i,u,g=l*8-c-1,d=(1<<g)-1,p=d>>1,f=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=s?0:l-1,b=s?1:-1,B=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(i=isNaN(e)?1:0,r=d):(r=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-r))<1&&(r--,u*=2),r+p>=1?e+=f/u:e+=f*Math.pow(2,1-p),e*u>=2&&(r++,u/=2),r+p>=d?(i=0,r=d):r+p>=1?(i=(e*u-1)*Math.pow(2,c),r=r+p):(i=e*Math.pow(2,p-1)*Math.pow(2,c),r=0));c>=8;t[n+y]=i&255,y+=b,i/=256,c-=8);for(r=r<<c|i,g+=c;g>0;t[n+y]=r&255,y+=b,r/=256,g-=8);t[n+y-b]|=B*128},Pn}function at(){if(_s)return Ct;_s=!0;let t=Vc(),e=Zc(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ct.Buffer=r,Ct.SlowBuffer=v,Ct.INSPECT_MAX_BYTES=50;let s=2147483647;Ct.kMaxLength=s,r.TYPED_ARRAY_SUPPORT=c(),!r.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 c(){try{let m=new Uint8Array(1),o={foo:function(){return 42}};return Object.setPrototypeOf(o,Uint8Array.prototype),Object.setPrototypeOf(m,o),m.foo()===42}catch{return!1}}Object.defineProperty(r.prototype,"parent",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.buffer}}),Object.defineProperty(r.prototype,"offset",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.byteOffset}});function l(m){if(m>s)throw new RangeError('The value "'+m+'" is invalid for option "size"');let o=new Uint8Array(m);return Object.setPrototypeOf(o,r.prototype),o}function r(m,o,a){if(typeof m=="number"){if(typeof o=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(m)}return i(m,o,a)}r.poolSize=8192;function i(m,o,a){if(typeof m=="string")return p(m,o);if(ArrayBuffer.isView(m))return y(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(Ge(m,ArrayBuffer)||m&&Ge(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ge(m,SharedArrayBuffer)||m&&Ge(m.buffer,SharedArrayBuffer)))return b(m,o,a);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let h=m.valueOf&&m.valueOf();if(h!=null&&h!==m)return r.from(h,o,a);let S=B(m);if(S)return S;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return r.from(m[Symbol.toPrimitive]("string"),o,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}r.from=function(m,o,a){return i(m,o,a)},Object.setPrototypeOf(r.prototype,Uint8Array.prototype),Object.setPrototypeOf(r,Uint8Array);function u(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 g(m,o,a){return u(m),m<=0?l(m):o!==void 0?typeof a=="string"?l(m).fill(o,a):l(m).fill(o):l(m)}r.alloc=function(m,o,a){return g(m,o,a)};function d(m){return u(m),l(m<0?0:x(m)|0)}r.allocUnsafe=function(m){return d(m)},r.allocUnsafeSlow=function(m){return d(m)};function p(m,o){if((typeof o!="string"||o==="")&&(o="utf8"),!r.isEncoding(o))throw new TypeError("Unknown encoding: "+o);let a=k(m,o)|0,h=l(a),S=h.write(m,o);return S!==a&&(h=h.slice(0,S)),h}function f(m){let o=m.length<0?0:x(m.length)|0,a=l(o);for(let h=0;h<o;h+=1)a[h]=m[h]&255;return a}function y(m){if(Ge(m,Uint8Array)){let o=new Uint8Array(m);return b(o.buffer,o.byteOffset,o.byteLength)}return f(m)}function b(m,o,a){if(o<0||m.byteLength<o)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<o+(a||0))throw new RangeError('"length" is outside of buffer bounds');let h;return o===void 0&&a===void 0?h=new Uint8Array(m):a===void 0?h=new Uint8Array(m,o):h=new Uint8Array(m,o,a),Object.setPrototypeOf(h,r.prototype),h}function B(m){if(r.isBuffer(m)){let o=x(m.length)|0,a=l(o);return a.length===0||m.copy(a,0,0,o),a}if(m.length!==void 0)return typeof m.length!="number"||en(m.length)?l(0):f(m);if(m.type==="Buffer"&&Array.isArray(m.data))return f(m.data)}function x(m){if(m>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return m|0}function v(m){return+m!=m&&(m=0),r.alloc(+m)}r.isBuffer=function(o){return o!=null&&o._isBuffer===!0&&o!==r.prototype},r.compare=function(o,a){if(Ge(o,Uint8Array)&&(o=r.from(o,o.offset,o.byteLength)),Ge(a,Uint8Array)&&(a=r.from(a,a.offset,a.byteLength)),!r.isBuffer(o)||!r.isBuffer(a))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(o===a)return 0;let h=o.length,S=a.length;for(let O=0,K=Math.min(h,S);O<K;++O)if(o[O]!==a[O]){h=o[O],S=a[O];break}return h<S?-1:S<h?1:0},r.isEncoding=function(o){switch(String(o).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}},r.concat=function(o,a){if(!Array.isArray(o))throw new TypeError('"list" argument must be an Array of Buffers');if(o.length===0)return r.alloc(0);let h;if(a===void 0)for(a=0,h=0;h<o.length;++h)a+=o[h].length;let S=r.allocUnsafe(a),O=0;for(h=0;h<o.length;++h){let K=o[h];if(Ge(K,Uint8Array))O+K.length>S.length?(r.isBuffer(K)||(K=r.from(K)),K.copy(S,O)):Uint8Array.prototype.set.call(S,K,O);else if(r.isBuffer(K))K.copy(S,O);else throw new TypeError('"list" argument must be an Array of Buffers');O+=K.length}return S};function k(m,o){if(r.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||Ge(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 a=m.length,h=arguments.length>2&&arguments[2]===!0;if(!h&&a===0)return 0;let S=!1;for(;;)switch(o){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return me(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a*2;case"hex":return a>>>1;case"base64":return et(m).length;default:if(S)return h?-1:me(m).length;o=(""+o).toLowerCase(),S=!0}}r.byteLength=k;function P(m,o,a){let h=!1;if((o===void 0||o<0)&&(o=0),o>this.length||((a===void 0||a>this.length)&&(a=this.length),a<=0)||(a>>>=0,o>>>=0,a<=o))return"";for(m||(m="utf8");;)switch(m){case"hex":return ue(this,o,a);case"utf8":case"utf-8":return Ce(this,o,a);case"ascii":return We(this,o,a);case"latin1":case"binary":return ve(this,o,a);case"base64":return _e(this,o,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pe(this,o,a);default:if(h)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),h=!0}}r.prototype._isBuffer=!0;function D(m,o,a){let h=m[o];m[o]=m[a],m[a]=h}r.prototype.swap16=function(){let o=this.length;if(o%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let a=0;a<o;a+=2)D(this,a,a+1);return this},r.prototype.swap32=function(){let o=this.length;if(o%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let a=0;a<o;a+=4)D(this,a,a+3),D(this,a+1,a+2);return this},r.prototype.swap64=function(){let o=this.length;if(o%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let a=0;a<o;a+=8)D(this,a,a+7),D(this,a+1,a+6),D(this,a+2,a+5),D(this,a+3,a+4);return this},r.prototype.toString=function(){let o=this.length;return o===0?"":arguments.length===0?Ce(this,0,o):P.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(o){if(!r.isBuffer(o))throw new TypeError("Argument must be a Buffer");return this===o?!0:r.compare(this,o)===0},r.prototype.inspect=function(){let o="",a=Ct.INSPECT_MAX_BYTES;return o=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(o+=" ... "),"<Buffer "+o+">"},n&&(r.prototype[n]=r.prototype.inspect),r.prototype.compare=function(o,a,h,S,O){if(Ge(o,Uint8Array)&&(o=r.from(o,o.offset,o.byteLength)),!r.isBuffer(o))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof o);if(a===void 0&&(a=0),h===void 0&&(h=o?o.length:0),S===void 0&&(S=0),O===void 0&&(O=this.length),a<0||h>o.length||S<0||O>this.length)throw new RangeError("out of range index");if(S>=O&&a>=h)return 0;if(S>=O)return-1;if(a>=h)return 1;if(a>>>=0,h>>>=0,S>>>=0,O>>>=0,this===o)return 0;let K=O-S,fe=h-a,Ie=Math.min(K,fe),be=this.slice(S,O),Ee=o.slice(a,h);for(let Te=0;Te<Ie;++Te)if(be[Te]!==Ee[Te]){K=be[Te],fe=Ee[Te];break}return K<fe?-1:fe<K?1:0};function U(m,o,a,h,S){if(m.length===0)return-1;if(typeof a=="string"?(h=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,en(a)&&(a=S?0:m.length-1),a<0&&(a=m.length+a),a>=m.length){if(S)return-1;a=m.length-1}else if(a<0)if(S)a=0;else return-1;if(typeof o=="string"&&(o=r.from(o,h)),r.isBuffer(o))return o.length===0?-1:Z(m,o,a,h,S);if(typeof o=="number")return o=o&255,typeof Uint8Array.prototype.indexOf=="function"?S?Uint8Array.prototype.indexOf.call(m,o,a):Uint8Array.prototype.lastIndexOf.call(m,o,a):Z(m,[o],a,h,S);throw new TypeError("val must be string, number or Buffer")}function Z(m,o,a,h,S){let O=1,K=m.length,fe=o.length;if(h!==void 0&&(h=String(h).toLowerCase(),h==="ucs2"||h==="ucs-2"||h==="utf16le"||h==="utf-16le")){if(m.length<2||o.length<2)return-1;O=2,K/=2,fe/=2,a/=2}function Ie(Ee,Te){return O===1?Ee[Te]:Ee.readUInt16BE(Te*O)}let be;if(S){let Ee=-1;for(be=a;be<K;be++)if(Ie(m,be)===Ie(o,Ee===-1?0:be-Ee)){if(Ee===-1&&(Ee=be),be-Ee+1===fe)return Ee*O}else Ee!==-1&&(be-=be-Ee),Ee=-1}else for(a+fe>K&&(a=K-fe),be=a;be>=0;be--){let Ee=!0;for(let Te=0;Te<fe;Te++)if(Ie(m,be+Te)!==Ie(o,Te)){Ee=!1;break}if(Ee)return be}return-1}r.prototype.includes=function(o,a,h){return this.indexOf(o,a,h)!==-1},r.prototype.indexOf=function(o,a,h){return U(this,o,a,h,!0)},r.prototype.lastIndexOf=function(o,a,h){return U(this,o,a,h,!1)};function V(m,o,a,h){a=Number(a)||0;let S=m.length-a;h?(h=Number(h),h>S&&(h=S)):h=S;let O=o.length;h>O/2&&(h=O/2);let K;for(K=0;K<h;++K){let fe=parseInt(o.substr(K*2,2),16);if(en(fe))return K;m[a+K]=fe}return K}function ie(m,o,a,h){return st(me(o,m.length-a),m,a,h)}function X(m,o,a,h){return st(ae(o),m,a,h)}function Y(m,o,a,h){return st(et(o),m,a,h)}function de(m,o,a,h){return st(H(o,m.length-a),m,a,h)}r.prototype.write=function(o,a,h,S){if(a===void 0)S="utf8",h=this.length,a=0;else if(h===void 0&&typeof a=="string")S=a,h=this.length,a=0;else if(isFinite(a))a=a>>>0,isFinite(h)?(h=h>>>0,S===void 0&&(S="utf8")):(S=h,h=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let O=this.length-a;if((h===void 0||h>O)&&(h=O),o.length>0&&(h<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");let K=!1;for(;;)switch(S){case"hex":return V(this,o,a,h);case"utf8":case"utf-8":return ie(this,o,a,h);case"ascii":case"latin1":case"binary":return X(this,o,a,h);case"base64":return Y(this,o,a,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,o,a,h);default:if(K)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),K=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function _e(m,o,a){return o===0&&a===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(o,a))}function Ce(m,o,a){a=Math.min(m.length,a);let h=[],S=o;for(;S<a;){let O=m[S],K=null,fe=O>239?4:O>223?3:O>191?2:1;if(S+fe<=a){let Ie,be,Ee,Te;switch(fe){case 1:O<128&&(K=O);break;case 2:Ie=m[S+1],(Ie&192)===128&&(Te=(O&31)<<6|Ie&63,Te>127&&(K=Te));break;case 3:Ie=m[S+1],be=m[S+2],(Ie&192)===128&&(be&192)===128&&(Te=(O&15)<<12|(Ie&63)<<6|be&63,Te>2047&&(Te<55296||Te>57343)&&(K=Te));break;case 4:Ie=m[S+1],be=m[S+2],Ee=m[S+3],(Ie&192)===128&&(be&192)===128&&(Ee&192)===128&&(Te=(O&15)<<18|(Ie&63)<<12|(be&63)<<6|Ee&63,Te>65535&&Te<1114112&&(K=Te))}}K===null?(K=65533,fe=1):K>65535&&(K-=65536,h.push(K>>>10&1023|55296),K=56320|K&1023),h.push(K),S+=fe}return Ae(h)}let ke=4096;function Ae(m){let o=m.length;if(o<=ke)return String.fromCharCode.apply(String,m);let a="",h=0;for(;h<o;)a+=String.fromCharCode.apply(String,m.slice(h,h+=ke));return a}function We(m,o,a){let h="";a=Math.min(m.length,a);for(let S=o;S<a;++S)h+=String.fromCharCode(m[S]&127);return h}function ve(m,o,a){let h="";a=Math.min(m.length,a);for(let S=o;S<a;++S)h+=String.fromCharCode(m[S]);return h}function ue(m,o,a){let h=m.length;(!o||o<0)&&(o=0),(!a||a<0||a>h)&&(a=h);let S="";for(let O=o;O<a;++O)S+=bn[m[O]];return S}function pe(m,o,a){let h=m.slice(o,a),S="";for(let O=0;O<h.length-1;O+=2)S+=String.fromCharCode(h[O]+h[O+1]*256);return S}r.prototype.slice=function(o,a){let h=this.length;o=~~o,a=a===void 0?h:~~a,o<0?(o+=h,o<0&&(o=0)):o>h&&(o=h),a<0?(a+=h,a<0&&(a=0)):a>h&&(a=h),a<o&&(a=o);let S=this.subarray(o,a);return Object.setPrototypeOf(S,r.prototype),S};function te(m,o,a){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+o>a)throw new RangeError("Trying to access beyond buffer length")}r.prototype.readUintLE=r.prototype.readUIntLE=function(o,a,h){o=o>>>0,a=a>>>0,h||te(o,a,this.length);let S=this[o],O=1,K=0;for(;++K<a&&(O*=256);)S+=this[o+K]*O;return S},r.prototype.readUintBE=r.prototype.readUIntBE=function(o,a,h){o=o>>>0,a=a>>>0,h||te(o,a,this.length);let S=this[o+--a],O=1;for(;a>0&&(O*=256);)S+=this[o+--a]*O;return S},r.prototype.readUint8=r.prototype.readUInt8=function(o,a){return o=o>>>0,a||te(o,1,this.length),this[o]},r.prototype.readUint16LE=r.prototype.readUInt16LE=function(o,a){return o=o>>>0,a||te(o,2,this.length),this[o]|this[o+1]<<8},r.prototype.readUint16BE=r.prototype.readUInt16BE=function(o,a){return o=o>>>0,a||te(o,2,this.length),this[o]<<8|this[o+1]},r.prototype.readUint32LE=r.prototype.readUInt32LE=function(o,a){return o=o>>>0,a||te(o,4,this.length),(this[o]|this[o+1]<<8|this[o+2]<<16)+this[o+3]*16777216},r.prototype.readUint32BE=r.prototype.readUInt32BE=function(o,a){return o=o>>>0,a||te(o,4,this.length),this[o]*16777216+(this[o+1]<<16|this[o+2]<<8|this[o+3])},r.prototype.readBigUInt64LE=Ve(function(o){o=o>>>0,T(o,"offset");let a=this[o],h=this[o+7];(a===void 0||h===void 0)&&w(o,this.length-8);let S=a+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24,O=this[++o]+this[++o]*2**8+this[++o]*2**16+h*2**24;return BigInt(S)+(BigInt(O)<<BigInt(32))}),r.prototype.readBigUInt64BE=Ve(function(o){o=o>>>0,T(o,"offset");let a=this[o],h=this[o+7];(a===void 0||h===void 0)&&w(o,this.length-8);let S=a*2**24+this[++o]*2**16+this[++o]*2**8+this[++o],O=this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+h;return(BigInt(S)<<BigInt(32))+BigInt(O)}),r.prototype.readIntLE=function(o,a,h){o=o>>>0,a=a>>>0,h||te(o,a,this.length);let S=this[o],O=1,K=0;for(;++K<a&&(O*=256);)S+=this[o+K]*O;return O*=128,S>=O&&(S-=Math.pow(2,8*a)),S},r.prototype.readIntBE=function(o,a,h){o=o>>>0,a=a>>>0,h||te(o,a,this.length);let S=a,O=1,K=this[o+--S];for(;S>0&&(O*=256);)K+=this[o+--S]*O;return O*=128,K>=O&&(K-=Math.pow(2,8*a)),K},r.prototype.readInt8=function(o,a){return o=o>>>0,a||te(o,1,this.length),this[o]&128?(255-this[o]+1)*-1:this[o]},r.prototype.readInt16LE=function(o,a){o=o>>>0,a||te(o,2,this.length);let h=this[o]|this[o+1]<<8;return h&32768?h|4294901760:h},r.prototype.readInt16BE=function(o,a){o=o>>>0,a||te(o,2,this.length);let h=this[o+1]|this[o]<<8;return h&32768?h|4294901760:h},r.prototype.readInt32LE=function(o,a){return o=o>>>0,a||te(o,4,this.length),this[o]|this[o+1]<<8|this[o+2]<<16|this[o+3]<<24},r.prototype.readInt32BE=function(o,a){return o=o>>>0,a||te(o,4,this.length),this[o]<<24|this[o+1]<<16|this[o+2]<<8|this[o+3]},r.prototype.readBigInt64LE=Ve(function(o){o=o>>>0,T(o,"offset");let a=this[o],h=this[o+7];(a===void 0||h===void 0)&&w(o,this.length-8);let S=this[o+4]+this[o+5]*2**8+this[o+6]*2**16+(h<<24);return(BigInt(S)<<BigInt(32))+BigInt(a+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24)}),r.prototype.readBigInt64BE=Ve(function(o){o=o>>>0,T(o,"offset");let a=this[o],h=this[o+7];(a===void 0||h===void 0)&&w(o,this.length-8);let S=(a<<24)+this[++o]*2**16+this[++o]*2**8+this[++o];return(BigInt(S)<<BigInt(32))+BigInt(this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+h)}),r.prototype.readFloatLE=function(o,a){return o=o>>>0,a||te(o,4,this.length),e.read(this,o,!0,23,4)},r.prototype.readFloatBE=function(o,a){return o=o>>>0,a||te(o,4,this.length),e.read(this,o,!1,23,4)},r.prototype.readDoubleLE=function(o,a){return o=o>>>0,a||te(o,8,this.length),e.read(this,o,!0,52,8)},r.prototype.readDoubleBE=function(o,a){return o=o>>>0,a||te(o,8,this.length),e.read(this,o,!1,52,8)};function oe(m,o,a,h,S,O){if(!r.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(o>S||o<O)throw new RangeError('"value" argument is out of bounds');if(a+h>m.length)throw new RangeError("Index out of range")}r.prototype.writeUintLE=r.prototype.writeUIntLE=function(o,a,h,S){if(o=+o,a=a>>>0,h=h>>>0,!S){let fe=Math.pow(2,8*h)-1;oe(this,o,a,h,fe,0)}let O=1,K=0;for(this[a]=o&255;++K<h&&(O*=256);)this[a+K]=o/O&255;return a+h},r.prototype.writeUintBE=r.prototype.writeUIntBE=function(o,a,h,S){if(o=+o,a=a>>>0,h=h>>>0,!S){let fe=Math.pow(2,8*h)-1;oe(this,o,a,h,fe,0)}let O=h-1,K=1;for(this[a+O]=o&255;--O>=0&&(K*=256);)this[a+O]=o/K&255;return a+h},r.prototype.writeUint8=r.prototype.writeUInt8=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,1,255,0),this[a]=o&255,a+1},r.prototype.writeUint16LE=r.prototype.writeUInt16LE=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,2,65535,0),this[a]=o&255,this[a+1]=o>>>8,a+2},r.prototype.writeUint16BE=r.prototype.writeUInt16BE=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,2,65535,0),this[a]=o>>>8,this[a+1]=o&255,a+2},r.prototype.writeUint32LE=r.prototype.writeUInt32LE=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,4,4294967295,0),this[a+3]=o>>>24,this[a+2]=o>>>16,this[a+1]=o>>>8,this[a]=o&255,a+4},r.prototype.writeUint32BE=r.prototype.writeUInt32BE=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,4,4294967295,0),this[a]=o>>>24,this[a+1]=o>>>16,this[a+2]=o>>>8,this[a+3]=o&255,a+4};function R(m,o,a,h,S){J(o,h,S,m,a,7);let O=Number(o&BigInt(4294967295));m[a++]=O,O=O>>8,m[a++]=O,O=O>>8,m[a++]=O,O=O>>8,m[a++]=O;let K=Number(o>>BigInt(32)&BigInt(4294967295));return m[a++]=K,K=K>>8,m[a++]=K,K=K>>8,m[a++]=K,K=K>>8,m[a++]=K,a}function N(m,o,a,h,S){J(o,h,S,m,a,7);let O=Number(o&BigInt(4294967295));m[a+7]=O,O=O>>8,m[a+6]=O,O=O>>8,m[a+5]=O,O=O>>8,m[a+4]=O;let K=Number(o>>BigInt(32)&BigInt(4294967295));return m[a+3]=K,K=K>>8,m[a+2]=K,K=K>>8,m[a+1]=K,K=K>>8,m[a]=K,a+8}r.prototype.writeBigUInt64LE=Ve(function(o,a=0){return R(this,o,a,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeBigUInt64BE=Ve(function(o,a=0){return N(this,o,a,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeIntLE=function(o,a,h,S){if(o=+o,a=a>>>0,!S){let Ie=Math.pow(2,8*h-1);oe(this,o,a,h,Ie-1,-Ie)}let O=0,K=1,fe=0;for(this[a]=o&255;++O<h&&(K*=256);)o<0&&fe===0&&this[a+O-1]!==0&&(fe=1),this[a+O]=(o/K>>0)-fe&255;return a+h},r.prototype.writeIntBE=function(o,a,h,S){if(o=+o,a=a>>>0,!S){let Ie=Math.pow(2,8*h-1);oe(this,o,a,h,Ie-1,-Ie)}let O=h-1,K=1,fe=0;for(this[a+O]=o&255;--O>=0&&(K*=256);)o<0&&fe===0&&this[a+O+1]!==0&&(fe=1),this[a+O]=(o/K>>0)-fe&255;return a+h},r.prototype.writeInt8=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,1,127,-128),o<0&&(o=255+o+1),this[a]=o&255,a+1},r.prototype.writeInt16LE=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,2,32767,-32768),this[a]=o&255,this[a+1]=o>>>8,a+2},r.prototype.writeInt16BE=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,2,32767,-32768),this[a]=o>>>8,this[a+1]=o&255,a+2},r.prototype.writeInt32LE=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,4,2147483647,-2147483648),this[a]=o&255,this[a+1]=o>>>8,this[a+2]=o>>>16,this[a+3]=o>>>24,a+4},r.prototype.writeInt32BE=function(o,a,h){return o=+o,a=a>>>0,h||oe(this,o,a,4,2147483647,-2147483648),o<0&&(o=4294967295+o+1),this[a]=o>>>24,this[a+1]=o>>>16,this[a+2]=o>>>8,this[a+3]=o&255,a+4},r.prototype.writeBigInt64LE=Ve(function(o,a=0){return R(this,o,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),r.prototype.writeBigInt64BE=Ve(function(o,a=0){return N(this,o,a,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function W(m,o,a,h,S,O){if(a+h>m.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function ne(m,o,a,h,S){return o=+o,a=a>>>0,S||W(m,o,a,4),e.write(m,o,a,h,23,4),a+4}r.prototype.writeFloatLE=function(o,a,h){return ne(this,o,a,!0,h)},r.prototype.writeFloatBE=function(o,a,h){return ne(this,o,a,!1,h)};function se(m,o,a,h,S){return o=+o,a=a>>>0,S||W(m,o,a,8),e.write(m,o,a,h,52,8),a+8}r.prototype.writeDoubleLE=function(o,a,h){return se(this,o,a,!0,h)},r.prototype.writeDoubleBE=function(o,a,h){return se(this,o,a,!1,h)},r.prototype.copy=function(o,a,h,S){if(!r.isBuffer(o))throw new TypeError("argument should be a Buffer");if(h||(h=0),!S&&S!==0&&(S=this.length),a>=o.length&&(a=o.length),a||(a=0),S>0&&S<h&&(S=h),S===h||o.length===0||this.length===0)return 0;if(a<0)throw new RangeError("targetStart out of bounds");if(h<0||h>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),o.length-a<S-h&&(S=o.length-a+h);let O=S-h;return this===o&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(a,h,S):Uint8Array.prototype.set.call(o,this.subarray(h,S),a),O},r.prototype.fill=function(o,a,h,S){if(typeof o=="string"){if(typeof a=="string"?(S=a,a=0,h=this.length):typeof h=="string"&&(S=h,h=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!r.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(o.length===1){let K=o.charCodeAt(0);(S==="utf8"&&K<128||S==="latin1")&&(o=K)}}else typeof o=="number"?o=o&255:typeof o=="boolean"&&(o=Number(o));if(a<0||this.length<a||this.length<h)throw new RangeError("Out of range index");if(h<=a)return this;a=a>>>0,h=h===void 0?this.length:h>>>0,o||(o=0);let O;if(typeof o=="number")for(O=a;O<h;++O)this[O]=o;else{let K=r.isBuffer(o)?o:r.from(o,S),fe=K.length;if(fe===0)throw new TypeError('The value "'+o+'" is invalid for argument "value"');for(O=0;O<h-a;++O)this[O+a]=K[O%fe]}return this};let C={};function A(m,o,a){C[m]=class extends a{constructor(){super(),Object.defineProperty(this,"message",{value:o.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${m}]`,this.stack,delete this.name}get code(){return m}set code(S){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:S,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}A("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),A("ERR_INVALID_ARG_TYPE",function(m,o){return`The "${m}" argument must be of type number. Received type ${typeof o}`},TypeError),A("ERR_OUT_OF_RANGE",function(m,o,a){let h=`The value of "${m}" is out of range.`,S=a;return Number.isInteger(a)&&Math.abs(a)>2**32?S=M(String(a)):typeof a=="bigint"&&(S=String(a),(a>BigInt(2)**BigInt(32)||a<-(BigInt(2)**BigInt(32)))&&(S=M(S)),S+="n"),h+=` It must be ${o}. Received ${S}`,h},RangeError);function M(m){let o="",a=m.length,h=m[0]==="-"?1:0;for(;a>=h+4;a-=3)o=`_${m.slice(a-3,a)}${o}`;return`${m.slice(0,a)}${o}`}function q(m,o,a){T(o,"offset"),(m[o]===void 0||m[o+a]===void 0)&&w(o,m.length-(a+1))}function J(m,o,a,h,S,O){if(m>a||m<o){let K=typeof o=="bigint"?"n":"",fe;throw o===0||o===BigInt(0)?fe=`>= 0${K} and < 2${K} ** ${(O+1)*8}${K}`:fe=`>= -(2${K} ** ${(O+1)*8-1}${K}) and < 2 ** ${(O+1)*8-1}${K}`,new C.ERR_OUT_OF_RANGE("value",fe,m)}q(h,S,O)}function T(m,o){if(typeof m!="number")throw new C.ERR_INVALID_ARG_TYPE(o,"number",m)}function w(m,o,a){throw Math.floor(m)!==m?(T(m,a),new C.ERR_OUT_OF_RANGE("offset","an integer",m)):o<0?new C.ERR_BUFFER_OUT_OF_BOUNDS:new C.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${o}`,m)}let $=/[^+/0-9A-Za-z-_]/g;function z(m){if(m=m.split("=")[0],m=m.trim().replace($,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function me(m,o){o=o||1/0;let a,h=m.length,S=null,O=[];for(let K=0;K<h;++K){if(a=m.charCodeAt(K),a>55295&&a<57344){if(!S){if(a>56319){(o-=3)>-1&&O.push(239,191,189);continue}else if(K+1===h){(o-=3)>-1&&O.push(239,191,189);continue}S=a;continue}if(a<56320){(o-=3)>-1&&O.push(239,191,189),S=a;continue}a=(S-55296<<10|a-56320)+65536}else S&&(o-=3)>-1&&O.push(239,191,189);if(S=null,a<128){if((o-=1)<0)break;O.push(a)}else if(a<2048){if((o-=2)<0)break;O.push(a>>6|192,a&63|128)}else if(a<65536){if((o-=3)<0)break;O.push(a>>12|224,a>>6&63|128,a&63|128)}else if(a<1114112){if((o-=4)<0)break;O.push(a>>18|240,a>>12&63|128,a>>6&63|128,a&63|128)}else throw new Error("Invalid code point")}return O}function ae(m){let o=[];for(let a=0;a<m.length;++a)o.push(m.charCodeAt(a)&255);return o}function H(m,o){let a,h,S,O=[];for(let K=0;K<m.length&&!((o-=2)<0);++K)a=m.charCodeAt(K),h=a>>8,S=a%256,O.push(S),O.push(h);return O}function et(m){return t.toByteArray(z(m))}function st(m,o,a,h){let S;for(S=0;S<h&&!(S+a>=o.length||S>=m.length);++S)o[S+a]=m[S];return S}function Ge(m,o){return m instanceof o||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===o.name}function en(m){return m!==m}let bn=(function(){let m="0123456789abcdef",o=new Array(256);for(let a=0;a<16;++a){let h=a*16;for(let S=0;S<16;++S)o[h+S]=m[a]+m[S]}return o})();function Ve(m){return typeof BigInt>"u"?tn:m}function tn(){throw new Error("BigInt not supported")}return Ct}var nn,xs,Pn,Ps,Ct,_s,_n=He(()=>{_();E();I();nn={},xs=!1;Pn={},Ps=!1;Ct={},_s=!1});var Rt,L,Od,Hd,Is=He(()=>{_();E();I();_n();Rt=at();Rt.Buffer;Rt.SlowBuffer;Rt.INSPECT_MAX_BYTES;Rt.kMaxLength;L=Rt.Buffer,Od=Rt.INSPECT_MAX_BYTES,Hd=Rt.kMaxLength});var E=He(()=>{Is()});function lt(){return Us||(Us=!0,typeof Object.create=="function"?In=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:In=function(e,n){if(n){e.super_=n;var s=function(){};s.prototype=n.prototype,e.prototype=new s,e.prototype.constructor=e}}),In}var In,Us,fr=He(()=>{_();E();I();In={},Us=!1});function ye(){ye.init.call(this)}function En(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function Vs(t){return t._maxListeners===void 0?ye.defaultMaxListeners:t._maxListeners}function $s(t,e,n,s){var c,l,r,i;if(En(n),(l=t._events)===void 0?(l=t._events=Object.create(null),t._eventsCount=0):(l.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),l=t._events),r=l[e]),r===void 0)r=l[e]=n,++t._eventsCount;else if(typeof r=="function"?r=l[e]=s?[n,r]:[r,n]:s?r.unshift(n):r.push(n),(c=Vs(t))>0&&r.length>c&&!r.warned){r.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=r.length,i=u,console&&console.warn&&console.warn(i)}return t}function tu(){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 Ls(t,e,n){var s={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},c=tu.bind(s);return c.listener=n,s.wrapFn=c,c}function Fs(t,e,n){var s=t._events;if(s===void 0)return[];var c=s[e];return c===void 0?[]:typeof c=="function"?n?[c.listener||c]:[c]:n?(function(l){for(var r=new Array(l.length),i=0;i<r.length;++i)r[i]=l[i].listener||l[i];return r})(c):Zs(c,c.length)}function Gs(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 Zs(t,e){for(var n=new Array(e),s=0;s<e;++s)n[s]=t[s];return n}var qs,zs,Lt,js,Ws,Ks,Ke,gr=He(()=>{_();E();I();Lt=typeof Reflect=="object"?Reflect:null,js=Lt&&typeof Lt.apply=="function"?Lt.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};zs=Lt&&typeof Lt.ownKeys=="function"?Lt.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Ws=Number.isNaN||function(t){return t!=t};qs=ye,ye.EventEmitter=ye,ye.prototype._events=void 0,ye.prototype._eventsCount=0,ye.prototype._maxListeners=void 0;Ks=10;Object.defineProperty(ye,"defaultMaxListeners",{enumerable:!0,get:function(){return Ks},set:function(t){if(typeof t!="number"||t<0||Ws(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ks=t}}),ye.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},ye.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Ws(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},ye.prototype.getMaxListeners=function(){return Vs(this)},ye.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var s=t==="error",c=this._events;if(c!==void 0)s=s&&c.error===void 0;else if(!s)return!1;if(s){var l;if(e.length>0&&(l=e[0]),l instanceof Error)throw l;var r=new Error("Unhandled error."+(l?" ("+l.message+")":""));throw r.context=l,r}var i=c[t];if(i===void 0)return!1;if(typeof i=="function")js(i,this,e);else{var u=i.length,g=Zs(i,u);for(n=0;n<u;++n)js(g[n],this,e)}return!0},ye.prototype.addListener=function(t,e){return $s(this,t,e,!1)},ye.prototype.on=ye.prototype.addListener,ye.prototype.prependListener=function(t,e){return $s(this,t,e,!0)},ye.prototype.once=function(t,e){return En(e),this.on(t,Ls(this,t,e)),this},ye.prototype.prependOnceListener=function(t,e){return En(e),this.prependListener(t,Ls(this,t,e)),this},ye.prototype.removeListener=function(t,e){var n,s,c,l,r;if(En(e),(s=this._events)===void 0)return this;if((n=s[t])===void 0)return this;if(n===e||n.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete s[t],s.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(c=-1,l=n.length-1;l>=0;l--)if(n[l]===e||n[l].listener===e){r=n[l].listener,c=l;break}if(c<0)return this;c===0?n.shift():(function(i,u){for(;u+1<i.length;u++)i[u]=i[u+1];i.pop()})(n,c),n.length===1&&(s[t]=n[0]),s.removeListener!==void 0&&this.emit("removeListener",t,r||e)}return this},ye.prototype.off=ye.prototype.removeListener,ye.prototype.removeAllListeners=function(t){var e,n,s;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 c,l=Object.keys(n);for(s=0;s<l.length;++s)(c=l[s])!=="removeListener"&&this.removeAllListeners(c);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(s=e.length-1;s>=0;s--)this.removeListener(t,e[s]);return this},ye.prototype.listeners=function(t){return Fs(this,t,!0)},ye.prototype.rawListeners=function(t){return Fs(this,t,!1)},ye.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Gs.call(t,e)},ye.prototype.listenerCount=Gs,ye.prototype.eventNames=function(){return this._eventsCount>0?zs(this._events):[]};Ke=qs;Ke.EventEmitter;Ke.defaultMaxListeners;Ke.init;Ke.listenerCount;Ke.EventEmitter;Ke.defaultMaxListeners;Ke.init;Ke.listenerCount});var Ys=He(()=>{_();E();I();gr();Ke.once=function(t,e){return new Promise((n,s)=>{function c(...r){l!==void 0&&t.removeListener("error",l),n(r)}let l;e!=="error"&&(l=r=>{t.removeListener(name,c),s(r)},t.once("error",l)),t.once(e,c)})};Ke.on=function(t,e){let n=[],s=[],c=null,l=!1,r={async next(){let g=n.shift();if(g)return createIterResult(g,!1);if(c){let d=Promise.reject(c);return c=null,d}return l?createIterResult(void 0,!0):new Promise((d,p)=>s.push({resolve:d,reject:p}))},async return(){t.removeListener(e,i),t.removeListener("error",u),l=!0;for(let g of s)g.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(g){c=g,t.removeListener(e,i),t.removeListener("error",u)},[Symbol.asyncIterator](){return this}};return t.on(e,i),t.on("error",u),r;function i(...g){let d=s.shift();d?d.resolve(createIterResult(g,!1)):n.push(g)}function u(g){l=!0;let d=s.shift();d?d.reject(g):c=g,r.return()}}});function hr(){throw new Error("setTimeout has not been defined")}function Tr(){throw new Error("clearTimeout has not been defined")}function ua(t){if(yt===setTimeout)return setTimeout(t,0);if((yt===hr||!yt)&&setTimeout)return yt=setTimeout,setTimeout(t,0);try{return yt(t,0)}catch{try{return yt.call(null,t,0)}catch{return yt.call(this||Gt,t,0)}}}function nu(){Ft&&Ht&&(Ft=!1,Ht.length?Tt=Ht.concat(Tt):On=-1,Tt.length&&fa())}function fa(){if(!Ft){var t=ua(nu);Ft=!0;for(var e=Tt.length;e;){for(Ht=Tt,Tt=[];++On<e;)Ht&&Ht[On].run();On=-1,e=Tt.length}Ht=null,Ft=!1,(function(n){if(ht===clearTimeout)return clearTimeout(n);if((ht===Tr||!ht)&&clearTimeout)return ht=clearTimeout,clearTimeout(n);try{ht(n)}catch{try{return ht.call(null,n)}catch{return ht.call(this||Gt,n)}}})(t)}}function Js(t,e){(this||Gt).fun=t,(this||Gt).array=e}function mt(){}function Dt(t){return t.call.bind(t)}function an(t,e){if(typeof t!="object")return!1;try{return e(t),!0}catch{return!1}}function Qs(t){return $e&&qe?Ze(t)!==void 0:ha(t)||Ta(t)||va(t)||ba(t)||wa(t)||Ba(t)||xa(t)||Pa(t)||_a(t)||Ia(t)||Ea(t)}function ha(t){return $e&&qe?Ze(t)==="Uint8Array":Pe(t)==="[object Uint8Array]"||gu(t)&&t.buffer!==void 0}function Ta(t){return $e&&qe?Ze(t)==="Uint8ClampedArray":Pe(t)==="[object Uint8ClampedArray]"}function va(t){return $e&&qe?Ze(t)==="Uint16Array":Pe(t)==="[object Uint16Array]"}function ba(t){return $e&&qe?Ze(t)==="Uint32Array":Pe(t)==="[object Uint32Array]"}function wa(t){return $e&&qe?Ze(t)==="Int8Array":Pe(t)==="[object Int8Array]"}function Ba(t){return $e&&qe?Ze(t)==="Int16Array":Pe(t)==="[object Int16Array]"}function xa(t){return $e&&qe?Ze(t)==="Int32Array":Pe(t)==="[object Int32Array]"}function Pa(t){return $e&&qe?Ze(t)==="Float32Array":Pe(t)==="[object Float32Array]"}function _a(t){return $e&&qe?Ze(t)==="Float64Array":Pe(t)==="[object Float64Array]"}function Ia(t){return $e&&qe?Ze(t)==="BigInt64Array":Pe(t)==="[object BigInt64Array]"}function Ea(t){return $e&&qe?Ze(t)==="BigUint64Array":Pe(t)==="[object BigUint64Array]"}function kn(t){return Pe(t)==="[object Map]"}function An(t){return Pe(t)==="[object Set]"}function Sn(t){return Pe(t)==="[object WeakMap]"}function pr(t){return Pe(t)==="[object WeakSet]"}function Mn(t){return Pe(t)==="[object ArrayBuffer]"}function ea(t){return typeof ArrayBuffer<"u"&&(Mn.working?Mn(t):t instanceof ArrayBuffer)}function Dn(t){return Pe(t)==="[object DataView]"}function ta(t){return typeof DataView<"u"&&(Dn.working?Dn(t):t instanceof DataView)}function Nn(t){return Pe(t)==="[object SharedArrayBuffer]"}function na(t){return typeof SharedArrayBuffer<"u"&&(Nn.working?Nn(t):t instanceof SharedArrayBuffer)}function ra(t){return an(t,hu)}function ia(t){return an(t,Tu)}function oa(t){return an(t,vu)}function sa(t){return ya&&an(t,bu)}function aa(t){return br&&an(t,wu)}function It(t,e){var n={seen:[],stylize:Pu};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),wr(e)?n.showHidden=e:e&&j._extend(n,e),Mt(n.showHidden)&&(n.showHidden=!1),Mt(n.depth)&&(n.depth=2),Mt(n.colors)&&(n.colors=!1),Mt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=xu),Un(n,t,n.depth)}function xu(t,e){var n=It.styles[e];return n?"\x1B["+It.colors[n][0]+"m"+t+"\x1B["+It.colors[n][1]+"m":t}function Pu(t,e){return t}function Un(t,e,n){if(t.customInspect&&e&&Hn(e.inspect)&&e.inspect!==j.inspect&&(!e.constructor||e.constructor.prototype!==e)){var s=e.inspect(n,t);return jn(s)||(s=Un(t,s,n)),s}var c=(function(f,y){if(Mt(y))return f.stylize("undefined","undefined");if(jn(y)){var b="'"+JSON.stringify(y).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return f.stylize(b,"string")}if(Sa(y))return f.stylize(""+y,"number");if(wr(y))return f.stylize(""+y,"boolean");if($n(y))return f.stylize("null","null")})(t,e);if(c)return c;var l=Object.keys(e),r=(function(f){var y={};return f.forEach((function(b,B){y[b]=!0})),y})(l);if(t.showHidden&&(l=Object.getOwnPropertyNames(e)),sn(e)&&(l.indexOf("message")>=0||l.indexOf("description")>=0))return dr(e);if(l.length===0){if(Hn(e)){var i=e.name?": "+e.name:"";return t.stylize("[Function"+i+"]","special")}if(on(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Wn(e))return t.stylize(Date.prototype.toString.call(e),"date");if(sn(e))return dr(e)}var u,g="",d=!1,p=["{","}"];return Aa(e)&&(d=!0,p=["[","]"]),Hn(e)&&(g=" [Function"+(e.name?": "+e.name:"")+"]"),on(e)&&(g=" "+RegExp.prototype.toString.call(e)),Wn(e)&&(g=" "+Date.prototype.toUTCString.call(e)),sn(e)&&(g=" "+dr(e)),l.length!==0||d&&e.length!=0?n<0?on(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),u=d?(function(f,y,b,B,x){for(var v=[],k=0,P=y.length;k<P;++k)Ca(y,String(k))?v.push(mr(f,y,b,B,String(k),!0)):v.push("");return x.forEach((function(D){D.match(/^\d+$/)||v.push(mr(f,y,b,B,D,!0))})),v})(t,e,n,r,l):l.map((function(f){return mr(t,e,n,r,f,d)})),t.seen.pop(),(function(f,y,b){var B=0;return f.reduce((function(x,v){return B++,v.indexOf(`
|
|
2
|
+
`)>=0&&B++,x+v.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?b[0]+(y===""?"":y+`
|
|
3
|
+
`)+" "+f.join(`,
|
|
4
|
+
`)+" "+b[1]:b[0]+y+" "+f.join(", ")+" "+b[1]})(u,g,p)):p[0]+g+p[1]}function dr(t){return"["+Error.prototype.toString.call(t)+"]"}function mr(t,e,n,s,c,l){var r,i,u;if((u=Object.getOwnPropertyDescriptor(e,c)||{value:e[c]}).get?i=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(i=t.stylize("[Setter]","special")),Ca(s,c)||(r="["+c+"]"),i||(t.seen.indexOf(u.value)<0?(i=$n(n)?Un(t,u.value,null):Un(t,u.value,n-1)).indexOf(`
|
|
5
|
+
`)>-1&&(i=l?i.split(`
|
|
6
|
+
`).map((function(g){return" "+g})).join(`
|
|
7
|
+
`).substr(2):`
|
|
8
|
+
`+i.split(`
|
|
9
|
+
`).map((function(g){return" "+g})).join(`
|
|
10
|
+
`)):i=t.stylize("[Circular]","special")),Mt(r)){if(l&&c.match(/^\d+$/))return i;(r=JSON.stringify(""+c)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(r=r.substr(1,r.length-2),r=t.stylize(r,"name")):(r=r.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),r=t.stylize(r,"string"))}return r+": "+i}function Aa(t){return Array.isArray(t)}function wr(t){return typeof t=="boolean"}function $n(t){return t===null}function Sa(t){return typeof t=="number"}function jn(t){return typeof t=="string"}function Mt(t){return t===void 0}function on(t){return qt(t)&&Br(t)==="[object RegExp]"}function qt(t){return typeof t=="object"&&t!==null}function Wn(t){return qt(t)&&Br(t)==="[object Date]"}function sn(t){return qt(t)&&(Br(t)==="[object Error]"||t instanceof Error)}function Hn(t){return typeof t=="function"}function Br(t){return Object.prototype.toString.call(t)}function yr(t){return t<10?"0"+t.toString(10):t.toString(10)}function Iu(){var t=new Date,e=[yr(t.getHours()),yr(t.getMinutes()),yr(t.getSeconds())].join(":");return[t.getDate(),_u[t.getMonth()],e].join(" ")}function Ca(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Eu(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var ca,yt,ht,Gt,Se,Ht,Tt,Ft,On,we,ru,vr,Kn,ga,iu,ou,su,au,lu,pa,da,Xs,cu,uu,fu,ma,ge,gu,pu,du,ya,br,qe,$e,mu,Pe,hu,Tu,vu,rn,j,ct,la,Bu,Cn,ka,Rn,_u,Ot,vm,Ln=He(()=>{_();E();I();Gt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Se=ca={};(function(){try{yt=typeof setTimeout=="function"?setTimeout:hr}catch{yt=hr}try{ht=typeof clearTimeout=="function"?clearTimeout:Tr}catch{ht=Tr}})();Tt=[],Ft=!1,On=-1;Se.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];Tt.push(new Js(t,e)),Tt.length!==1||Ft||ua(fa)},Js.prototype.run=function(){(this||Gt).fun.apply(null,(this||Gt).array)},Se.title="browser",Se.browser=!0,Se.env={},Se.argv=[],Se.version="",Se.versions={},Se.on=mt,Se.addListener=mt,Se.once=mt,Se.off=mt,Se.removeListener=mt,Se.removeAllListeners=mt,Se.emit=mt,Se.prependListener=mt,Se.prependOnceListener=mt,Se.listeners=function(t){return[]},Se.binding=function(t){throw new Error("process.binding is not supported")},Se.cwd=function(){return"/"},Se.chdir=function(t){throw new Error("process.chdir is not supported")},Se.umask=function(){return 0};we=ca;we.addListener;we.argv;we.binding;we.browser;we.chdir;we.cwd;we.emit;we.env;we.listeners;we.nextTick;we.off;we.on;we.once;we.prependListener;we.prependOnceListener;we.removeAllListeners;we.removeListener;we.title;we.umask;we.version;we.versions;ru=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",vr=Object.prototype.toString,Kn=function(t){return!(ru&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&vr.call(t)==="[object Arguments]"},ga=function(t){return!!Kn(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vr.call(t)!=="[object Array]"&&vr.call(t.callee)==="[object Function]"},iu=(function(){return Kn(arguments)})();Kn.isLegacyArguments=ga;ou=iu?Kn:ga,su=Object.prototype.toString,au=Function.prototype.toString,lu=/^\s*(?:function)?\*/,pa=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",da=Object.getPrototypeOf,Xs=(function(){if(!pa)return!1;try{return Function("return function*() {}")()}catch{}})(),cu=Xs?da(Xs):{},uu=function(t){return typeof t=="function"&&(!!lu.test(au.call(t))||(pa?da(t)===cu:su.call(t)==="[object GeneratorFunction]"))},fu=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}},ma=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},ge={},gu=ma,pu=ou,du=uu;ya=typeof BigInt<"u",br=typeof Symbol<"u",qe=br&&Symbol.toStringTag!==void 0,$e=typeof Uint8Array<"u",mu=typeof ArrayBuffer<"u";if($e&&qe)var yu=Object.getPrototypeOf(Uint8Array.prototype),Ze=Dt(Object.getOwnPropertyDescriptor(yu,Symbol.toStringTag).get);Pe=Dt(Object.prototype.toString),hu=Dt(Number.prototype.valueOf),Tu=Dt(String.prototype.valueOf),vu=Dt(Boolean.prototype.valueOf);if(ya)var bu=Dt(BigInt.prototype.valueOf);if(br)var wu=Dt(Symbol.prototype.valueOf);ge.isArgumentsObject=pu,ge.isGeneratorFunction=du,ge.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},ge.isArrayBufferView=function(t){return mu&&ArrayBuffer.isView?ArrayBuffer.isView(t):Qs(t)||ta(t)},ge.isTypedArray=Qs,ge.isUint8Array=ha,ge.isUint8ClampedArray=Ta,ge.isUint16Array=va,ge.isUint32Array=ba,ge.isInt8Array=wa,ge.isInt16Array=Ba,ge.isInt32Array=xa,ge.isFloat32Array=Pa,ge.isFloat64Array=_a,ge.isBigInt64Array=Ia,ge.isBigUint64Array=Ea,kn.working=typeof Map<"u"&&kn(new Map),ge.isMap=function(t){return typeof Map<"u"&&(kn.working?kn(t):t instanceof Map)},An.working=typeof Set<"u"&&An(new Set),ge.isSet=function(t){return typeof Set<"u"&&(An.working?An(t):t instanceof Set)},Sn.working=typeof WeakMap<"u"&&Sn(new WeakMap),ge.isWeakMap=function(t){return typeof WeakMap<"u"&&(Sn.working?Sn(t):t instanceof WeakMap)},pr.working=typeof WeakSet<"u"&&pr(new WeakSet),ge.isWeakSet=function(t){return pr(t)},Mn.working=typeof ArrayBuffer<"u"&&Mn(new ArrayBuffer),ge.isArrayBuffer=ea,Dn.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Dn(new DataView(new ArrayBuffer(1),0,1)),ge.isDataView=ta,Nn.working=typeof SharedArrayBuffer<"u"&&Nn(new SharedArrayBuffer),ge.isSharedArrayBuffer=na,ge.isAsyncFunction=function(t){return Pe(t)==="[object AsyncFunction]"},ge.isMapIterator=function(t){return Pe(t)==="[object Map Iterator]"},ge.isSetIterator=function(t){return Pe(t)==="[object Set Iterator]"},ge.isGeneratorObject=function(t){return Pe(t)==="[object Generator]"},ge.isWebAssemblyCompiledModule=function(t){return Pe(t)==="[object WebAssembly.Module]"},ge.isNumberObject=ra,ge.isStringObject=ia,ge.isBooleanObject=oa,ge.isBigIntObject=sa,ge.isSymbolObject=aa,ge.isBoxedPrimitive=function(t){return ra(t)||ia(t)||oa(t)||sa(t)||aa(t)},ge.isAnyArrayBuffer=function(t){return $e&&(ea(t)||na(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(ge,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}));rn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,j={},ct=we,la=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},s=0;s<e.length;s++)n[e[s]]=Object.getOwnPropertyDescriptor(t,e[s]);return n},Bu=/%[sdj%]/g;j.format=function(t){if(!jn(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(It(arguments[n]));return e.join(" ")}n=1;for(var s=arguments,c=s.length,l=String(t).replace(Bu,(function(i){if(i==="%%")return"%";if(n>=c)return i;switch(i){case"%s":return String(s[n++]);case"%d":return Number(s[n++]);case"%j":try{return JSON.stringify(s[n++])}catch{return"[Circular]"}default:return i}})),r=s[n];n<c;r=s[++n])$n(r)||!qt(r)?l+=" "+r:l+=" "+It(r);return l},j.deprecate=function(t,e){if(ct!==void 0&&ct.noDeprecation===!0)return t;if(ct===void 0)return function(){return j.deprecate(t,e).apply(this||rn,arguments)};var n=!1;return function(){if(!n){if(ct.throwDeprecation)throw new Error(e);ct.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||rn,arguments)}};Cn={},ka=/^$/;ct.env.NODE_DEBUG&&(Rn=ct.env.NODE_DEBUG,Rn=Rn.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),ka=new RegExp("^"+Rn+"$","i"));j.debuglog=function(t){if(t=t.toUpperCase(),!Cn[t])if(ka.test(t)){var e=ct.pid;Cn[t]=function(){var n=j.format.apply(j,arguments);console.error("%s %d: %s",t,e,n)}}else Cn[t]=function(){};return Cn[t]},j.inspect=It,It.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]},It.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},j.types=ge,j.isArray=Aa,j.isBoolean=wr,j.isNull=$n,j.isNullOrUndefined=function(t){return t==null},j.isNumber=Sa,j.isString=jn,j.isSymbol=function(t){return typeof t=="symbol"},j.isUndefined=Mt,j.isRegExp=on,j.types.isRegExp=on,j.isObject=qt,j.isDate=Wn,j.types.isDate=Wn,j.isError=sn,j.types.isNativeError=sn,j.isFunction=Hn,j.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},j.isBuffer=ma;_u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];j.log=function(){console.log("%s - %s",Iu(),j.format.apply(j,arguments))},j.inherits=fu,j._extend=function(t,e){if(!e||!qt(e))return t;for(var n=Object.keys(e),s=n.length;s--;)t[n[s]]=e[n[s]];return t};Ot=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;j.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Ot&&t[Ot]){var e;if(typeof(e=t[Ot])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Ot,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,s,c=new Promise((function(i,u){n=i,s=u})),l=[],r=0;r<arguments.length;r++)l.push(arguments[r]);l.push((function(i,u){i?s(i):n(u)}));try{t.apply(this||rn,l)}catch(i){s(i)}return c}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Ot&&Object.defineProperty(e,Ot,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,la(t))},j.promisify.custom=Ot,j.callbackify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],s=0;s<arguments.length;s++)n.push(arguments[s]);var c=n.pop();if(typeof c!="function")throw new TypeError("The last argument must be of type Function");var l=this||rn,r=function(){return c.apply(l,arguments)};t.apply(this||rn,n).then((function(i){ct.nextTick(r.bind(null,null,i))}),(function(i){ct.nextTick(Eu.bind(null,i,r))}))}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,la(t)),e};j._extend;j.callbackify;j.debuglog;j.deprecate;j.format;j.inherits;j.inspect;j.isArray;j.isBoolean;j.isBuffer;j.isDate;j.isError;j.isFunction;j.isNull;j.isNullOrUndefined;j.isNumber;j.isObject;j.isPrimitive;j.isRegExp;j.isString;j.isSymbol;j.isUndefined;j.log;j.promisify;j._extend;j.callbackify;j.debuglog;j.deprecate;j.format;j.inherits;j.inspect;j.isArray;j.isBoolean;j.isBuffer;j.isDate;j.isError;j.isFunction;j.isNull;j.isNullOrUndefined;j.isNumber;j.isObject;j.isPrimitive;j.isRegExp;j.isString;j.isSymbol;j.isUndefined;j.log;vm=j.promisify;j.types});var _m,Ra=He(()=>{_();E();I();Ln();j._extend;j.callbackify;j.debuglog;j.deprecate;j.format;j.inherits;j.inspect;j.isArray;j.isBoolean;j.isBuffer;j.isDate;j.isError;j.isFunction;j.isNull;j.isNullOrUndefined;j.isNumber;j.isObject;j.isPrimitive;j.isRegExp;j.isString;j.isSymbol;j.isUndefined;j.log;_m=j.promisify;j.types;j.TextEncoder=globalThis.TextEncoder;j.TextDecoder=globalThis.TextDecoder});function Ir(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function ku(){!zt||!Nt||(zt=!1,Nt.length?vt=Nt.concat(vt):Fn=-1,vt.length&&Oa())}function Oa(){if(!zt){var t=setTimeout(ku,0);zt=!0;for(var e=vt.length;e;){for(Nt=vt,vt=[];++Fn<e;)Nt&&Nt[Fn].run();Fn=-1,e=vt.length}Nt=null,zt=!1,clearTimeout(t)}}function Au(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 Ha(t,e)),vt.length===1&&!zt&&setTimeout(Oa,0)}function Ha(t,e){this.fun=t,this.array=e}function De(){}function qu(t){Ir("_linkedBinding")}function Yu(t){Ir("dlopen")}function Ju(){return[]}function Xu(){return[]}function lf(t,e){if(!t)throw new Error(e||"assertion error")}function gf(){return!1}function Af(){return Et.now()/1e3}function _r(t){var e=Math.floor((Date.now()-Et.now())*.001),n=Et.now()*.001,s=Math.floor(n)+e,c=Math.floor(n%1*1e9);return t&&(s=s-t[0],c=c-t[1],c<0&&(s--,c+=Pr)),[s,c]}function kt(){return tt}function Kf(t){return[]}var vt,zt,Nt,Fn,Su,Cu,Ru,Ou,Hu,Mu,Du,Nu,Uu,ju,Wu,Ku,$u,Lu,Fu,Gu,zu,Vu,Zu,Qu,ef,Er,tf,nf,rf,of,sf,af,cf,uf,ff,pf,df,mf,yf,hf,Tf,vf,bf,wf,Bf,xf,Pf,_f,If,Ef,kf,Et,xr,Pr,Sf,Cf,Rf,Of,Hf,Mf,Df,Nf,Uf,jf,Wf,tt,kr=He(()=>{_();E();I();vt=[],zt=!1,Fn=-1;Ha.prototype.run=function(){this.fun.apply(null,this.array)};Su="browser",Cu="x64",Ru="browser",Ou={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Hu=["/usr/bin/node"],Mu=[],Du="v16.8.0",Nu={},Uu=function(t,e){console.warn((e?e+": ":"")+t)},ju=function(t){Ir("binding")},Wu=function(t){return 0},Ku=function(){return"/"},$u=function(t){},Lu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Fu=De,Gu=[];zu={},Vu=!1,Zu={};Qu=De,ef=De,Er=function(){return{}},tf=Er,nf=Er,rf=De,of=De,sf=De,af={};cf={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},uf=De,ff=De;pf=De,df=De,mf=De,yf=De,hf=De,Tf=void 0,vf=void 0,bf=void 0,wf=De,Bf=2,xf=1,Pf="/bin/usr/node",_f=9229,If="node",Ef=[],kf=De,Et={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Et.now===void 0&&(xr=Date.now(),Et.timing&&Et.timing.navigationStart&&(xr=Et.timing.navigationStart),Et.now=()=>Date.now()-xr);Pr=1e9;_r.bigint=function(t){var e=_r(t);return typeof BigInt>"u"?e[0]*Pr+e[1]:BigInt(e[0]*Pr)+BigInt(e[1])};Sf=10,Cf={},Rf=0;Of=kt,Hf=kt,Mf=kt,Df=kt,Nf=kt,Uf=De,jf=kt,Wf=kt;tt={version:Du,versions:Nu,arch:Cu,platform:Ru,release:Lu,_rawDebug:Fu,moduleLoadList:Gu,binding:ju,_linkedBinding:qu,_events:Cf,_eventsCount:Rf,_maxListeners:Sf,on:kt,addListener:Of,once:Hf,off:Mf,removeListener:Df,removeAllListeners:Nf,emit:Uf,prependListener:jf,prependOnceListener:Wf,listeners:Kf,domain:zu,_exiting:Vu,config:Zu,dlopen:Yu,uptime:Af,_getActiveRequests:Ju,_getActiveHandles:Xu,reallyExit:Qu,_kill:ef,cpuUsage:Er,resourceUsage:tf,memoryUsage:nf,kill:rf,exit:of,openStdin:sf,allowedNodeEnvironmentFlags:af,assert:lf,features:cf,_fatalExceptions:uf,setUncaughtExceptionCaptureCallback:ff,hasUncaughtExceptionCaptureCallback:gf,emitWarning:Uu,nextTick:Au,_tickCallback:pf,_debugProcess:df,_debugEnd:mf,_startProfilerIdleNotifier:yf,_stopProfilerIdleNotifier:hf,stdout:Tf,stdin:bf,stderr:vf,abort:wf,umask:Wu,chdir:$u,cwd:Ku,env:Ou,title:Su,argv:Hu,execArgv:Mu,pid:Bf,ppid:xf,execPath:Pf,debugPort:_f,hrtime:_r,argv0:If,_preload_modules:Ef,setSourceMapsEnabled:kf}});function Da(){if(Ma)return Ar;Ma=!0,Ar=t;function t(n,s){if(e("noDeprecation"))return n;var c=!1;function l(){if(!c){if(e("throwDeprecation"))throw new Error(s);e("traceDeprecation")?console.trace(s):console.warn(s),c=!0}return n.apply(this||Sr,arguments)}return l}function e(n){try{if(!Sr.localStorage)return!1}catch{return!1}var s=Sr.localStorage[n];return s==null?!1:String(s).toLowerCase()==="true"}return Ar}var Ar,Ma,Sr,Na=He(()=>{_();E();I();Ar={},Ma=!1,Sr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function $f(){if(Ua)return ln;Ua=!0;var t=at(),e=t.Buffer;function n(c,l){for(var r in c)l[r]=c[r]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?ln=t:(n(t,ln),ln.Buffer=s);function s(c,l,r){return e(c,l,r)}return s.prototype=Object.create(e.prototype),n(e,s),s.from=function(c,l,r){if(typeof c=="number")throw new TypeError("Argument must not be a number");return e(c,l,r)},s.alloc=function(c,l,r){if(typeof c!="number")throw new TypeError("Argument must be a number");var i=e(c);return l!==void 0?typeof r=="string"?i.fill(l,r):i.fill(l):i.fill(0),i},s.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return e(c)},s.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(c)},ln}function Lf(){if(ja)return Cr;ja=!0;var t=$f().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 k;;)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(k)return;v=(""+v).toLowerCase(),k=!0}}function s(v){var k=n(v);if(typeof k!="string"&&(t.isEncoding===e||!e(v)))throw new Error("Unknown encoding: "+v);return k||v}Cr.StringDecoder=c;function c(v){this.encoding=s(v);var k;switch(this.encoding){case"utf16le":this.text=p,this.end=f,k=4;break;case"utf8":this.fillLast=u,k=4;break;case"base64":this.text=y,this.end=b,k=3;break;default:this.write=B,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(k)}c.prototype.write=function(v){if(v.length===0)return"";var k,P;if(this.lastNeed){if(k=this.fillLast(v),k===void 0)return"";P=this.lastNeed,this.lastNeed=0}else P=0;return P<v.length?k?k+this.text(v,P):this.text(v,P):k||""},c.prototype.end=d,c.prototype.text=g,c.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 l(v){return v<=127?0:v>>5===6?2:v>>4===14?3:v>>3===30?4:v>>6===2?-1:-2}function r(v,k,P){var D=k.length-1;if(D<P)return 0;var U=l(k[D]);return U>=0?(U>0&&(v.lastNeed=U-1),U):--D<P||U===-2?0:(U=l(k[D]),U>=0?(U>0&&(v.lastNeed=U-2),U):--D<P||U===-2?0:(U=l(k[D]),U>=0?(U>0&&(U===2?U=0:v.lastNeed=U-3),U):0))}function i(v,k,P){if((k[0]&192)!==128)return v.lastNeed=0,"\uFFFD";if(v.lastNeed>1&&k.length>1){if((k[1]&192)!==128)return v.lastNeed=1,"\uFFFD";if(v.lastNeed>2&&k.length>2&&(k[2]&192)!==128)return v.lastNeed=2,"\uFFFD"}}function u(v){var k=this.lastTotal-this.lastNeed,P=i(this,v);if(P!==void 0)return P;if(this.lastNeed<=v.length)return v.copy(this.lastChar,k,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);v.copy(this.lastChar,k,0,v.length),this.lastNeed-=v.length}function g(v,k){var P=r(this,v,k);if(!this.lastNeed)return v.toString("utf8",k);this.lastTotal=P;var D=v.length-(P-this.lastNeed);return v.copy(this.lastChar,0,D),v.toString("utf8",k,D)}function d(v){var k=v&&v.length?this.write(v):"";return this.lastNeed?k+"\uFFFD":k}function p(v,k){if((v.length-k)%2===0){var P=v.toString("utf16le",k);if(P){var D=P.charCodeAt(P.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=v[v.length-2],this.lastChar[1]=v[v.length-1],P.slice(0,-1)}return P}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=v[v.length-1],v.toString("utf16le",k,v.length-1)}function f(v){var k=v&&v.length?this.write(v):"";if(this.lastNeed){var P=this.lastTotal-this.lastNeed;return k+this.lastChar.toString("utf16le",0,P)}return k}function y(v,k){var P=(v.length-k)%3;return P===0?v.toString("base64",k):(this.lastNeed=3-P,this.lastTotal=3,P===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",k,v.length-P))}function b(v){var k=v&&v.length?this.write(v):"";return this.lastNeed?k+this.lastChar.toString("base64",0,3-this.lastNeed):k}function B(v){return v.toString(this.encoding)}function x(v){return v&&v.length?this.write(v):""}return Cr}var ln,Ua,Cr,ja,cn,jm,Wa=He(()=>{_();E();I();_n();ln={},Ua=!1;Cr={},ja=!1;cn=Lf();cn.StringDecoder;jm=cn.StringDecoder});function Ff(){if(Ka)return Rr;Ka=!0;var t=Rr={},e,n;function s(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=s}catch{e=s}try{typeof clearTimeout=="function"?n=clearTimeout:n=c}catch{n=c}})();function l(B){if(e===setTimeout)return setTimeout(B,0);if((e===s||!e)&&setTimeout)return e=setTimeout,setTimeout(B,0);try{return e(B,0)}catch{try{return e.call(null,B,0)}catch{return e.call(this||Vt,B,0)}}}function r(B){if(n===clearTimeout)return clearTimeout(B);if((n===c||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(B);try{return n(B)}catch{try{return n.call(null,B)}catch{return n.call(this||Vt,B)}}}var i=[],u=!1,g,d=-1;function p(){!u||!g||(u=!1,g.length?i=g.concat(i):d=-1,i.length&&f())}function f(){if(!u){var B=l(p);u=!0;for(var x=i.length;x;){for(g=i,i=[];++d<x;)g&&g[d].run();d=-1,x=i.length}g=null,u=!1,r(B)}}t.nextTick=function(B){var x=new Array(arguments.length-1);if(arguments.length>1)for(var v=1;v<arguments.length;v++)x[v-1]=arguments[v];i.push(new y(B,x)),i.length===1&&!u&&l(f)};function y(B,x){(this||Vt).fun=B,(this||Vt).array=x}y.prototype.run=function(){(this||Vt).fun.apply(null,(this||Vt).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function b(){}return t.on=b,t.addListener=b,t.once=b,t.off=b,t.removeListener=b,t.removeAllListeners=b,t.emit=b,t.prependListener=b,t.prependOnceListener=b,t.listeners=function(B){return[]},t.binding=function(B){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(B){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},Rr}var Rr,Ka,Vt,Be,Or=He(()=>{_();E();I();Rr={},Ka=!1,Vt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Be=Ff();Be.platform="browser";Be.addListener;Be.argv;Be.binding;Be.browser;Be.chdir;Be.cwd;Be.emit;Be.env;Be.listeners;Be.nextTick;Be.off;Be.on;Be.once;Be.prependListener;Be.prependOnceListener;Be.removeAllListeners;Be.removeListener;Be.title;Be.umask;Be.version;Be.versions});function Gf(){if($a)return Hr;$a=!0;var t=Be;function e(l){if(typeof l!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(l))}function n(l,r){for(var i="",u=0,g=-1,d=0,p,f=0;f<=l.length;++f){if(f<l.length)p=l.charCodeAt(f);else{if(p===47)break;p=47}if(p===47){if(!(g===f-1||d===1))if(g!==f-1&&d===2){if(i.length<2||u!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){var y=i.lastIndexOf("/");if(y!==i.length-1){y===-1?(i="",u=0):(i=i.slice(0,y),u=i.length-1-i.lastIndexOf("/")),g=f,d=0;continue}}else if(i.length===2||i.length===1){i="",u=0,g=f,d=0;continue}}r&&(i.length>0?i+="/..":i="..",u=2)}else i.length>0?i+="/"+l.slice(g+1,f):i=l.slice(g+1,f),u=f-g-1;g=f,d=0}else p===46&&d!==-1?++d:d=-1}return i}function s(l,r){var i=r.dir||r.root,u=r.base||(r.name||"")+(r.ext||"");return i?i===r.root?i+u:i+l+u:u}var c={resolve:function(){for(var r="",i=!1,u,g=arguments.length-1;g>=-1&&!i;g--){var d;g>=0?d=arguments[g]:(u===void 0&&(u=t.cwd()),d=u),e(d),d.length!==0&&(r=d+"/"+r,i=d.charCodeAt(0)===47)}return r=n(r,!i),i?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(r){if(e(r),r.length===0)return".";var i=r.charCodeAt(0)===47,u=r.charCodeAt(r.length-1)===47;return r=n(r,!i),r.length===0&&!i&&(r="."),r.length>0&&u&&(r+="/"),i?"/"+r:r},isAbsolute:function(r){return e(r),r.length>0&&r.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var r,i=0;i<arguments.length;++i){var u=arguments[i];e(u),u.length>0&&(r===void 0?r=u:r+="/"+u)}return r===void 0?".":c.normalize(r)},relative:function(r,i){if(e(r),e(i),r===i||(r=c.resolve(r),i=c.resolve(i),r===i))return"";for(var u=1;u<r.length&&r.charCodeAt(u)===47;++u);for(var g=r.length,d=g-u,p=1;p<i.length&&i.charCodeAt(p)===47;++p);for(var f=i.length,y=f-p,b=d<y?d:y,B=-1,x=0;x<=b;++x){if(x===b){if(y>b){if(i.charCodeAt(p+x)===47)return i.slice(p+x+1);if(x===0)return i.slice(p+x)}else d>b&&(r.charCodeAt(u+x)===47?B=x:x===0&&(B=0));break}var v=r.charCodeAt(u+x),k=i.charCodeAt(p+x);if(v!==k)break;v===47&&(B=x)}var P="";for(x=u+B+1;x<=g;++x)(x===g||r.charCodeAt(x)===47)&&(P.length===0?P+="..":P+="/..");return P.length>0?P+i.slice(p+B):(p+=B,i.charCodeAt(p)===47&&++p,i.slice(p))},_makeLong:function(r){return r},dirname:function(r){if(e(r),r.length===0)return".";for(var i=r.charCodeAt(0),u=i===47,g=-1,d=!0,p=r.length-1;p>=1;--p)if(i=r.charCodeAt(p),i===47){if(!d){g=p;break}}else d=!1;return g===-1?u?"/":".":u&&g===1?"//":r.slice(0,g)},basename:function(r,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');e(r);var u=0,g=-1,d=!0,p;if(i!==void 0&&i.length>0&&i.length<=r.length){if(i.length===r.length&&i===r)return"";var f=i.length-1,y=-1;for(p=r.length-1;p>=0;--p){var b=r.charCodeAt(p);if(b===47){if(!d){u=p+1;break}}else y===-1&&(d=!1,y=p+1),f>=0&&(b===i.charCodeAt(f)?--f===-1&&(g=p):(f=-1,g=y))}return u===g?g=y:g===-1&&(g=r.length),r.slice(u,g)}else{for(p=r.length-1;p>=0;--p)if(r.charCodeAt(p)===47){if(!d){u=p+1;break}}else g===-1&&(d=!1,g=p+1);return g===-1?"":r.slice(u,g)}},extname:function(r){e(r);for(var i=-1,u=0,g=-1,d=!0,p=0,f=r.length-1;f>=0;--f){var y=r.charCodeAt(f);if(y===47){if(!d){u=f+1;break}continue}g===-1&&(d=!1,g=f+1),y===46?i===-1?i=f:p!==1&&(p=1):i!==-1&&(p=-1)}return i===-1||g===-1||p===0||p===1&&i===g-1&&i===u+1?"":r.slice(i,g)},format:function(r){if(r===null||typeof r!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof r);return s("/",r)},parse:function(r){e(r);var i={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return i;var u=r.charCodeAt(0),g=u===47,d;g?(i.root="/",d=1):d=0;for(var p=-1,f=0,y=-1,b=!0,B=r.length-1,x=0;B>=d;--B){if(u=r.charCodeAt(B),u===47){if(!b){f=B+1;break}continue}y===-1&&(b=!1,y=B+1),u===46?p===-1?p=B:x!==1&&(x=1):p!==-1&&(x=-1)}return p===-1||y===-1||x===0||x===1&&p===y-1&&p===f+1?y!==-1&&(f===0&&g?i.base=i.name=r.slice(1,y):i.base=i.name=r.slice(f,y)):(f===0&&g?(i.name=r.slice(1,p),i.base=r.slice(1,y)):(i.name=r.slice(f,p),i.base=r.slice(f,y)),i.ext=r.slice(p,y)),f>0?i.dir=r.slice(0,f-1):g&&(i.dir="/"),i},sep:"/",delimiter:":",win32:null,posix:null};return c.posix=c,Hr=c,Hr}function Ut(t){throw new RangeError(Zf[t])}function Fa(t,e){let n=t.split("@"),s="";n.length>1&&(s=n[0]+"@",t=n[1]);let c=(function(l,r){let i=[],u=l.length;for(;u--;)i[u]=r(l[u]);return i})((t=t.replace(Vf,".")).split("."),e).join(".");return s+c}function Qa(t){let e=[],n=0,s=t.length;for(;n<s;){let c=t.charCodeAt(n++);if(c>=55296&&c<=56319&&n<s){let l=t.charCodeAt(n++);(64512&l)==56320?e.push(((1023&c)<<10)+(1023&l)+65536):(e.push(c),n--)}else e.push(c)}return e}function Jf(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Ye(){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 fn(t,e,n){if(t&&ut.isObject(t)&&t instanceof Ye)return t;var s=new Ye;return s.parse(t,e,n),s}function ag(){if(Ja)return Ur;Ja=!0;var t=we;function e(l){if(typeof l!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(l))}function n(l,r){for(var i="",u=0,g=-1,d=0,p,f=0;f<=l.length;++f){if(f<l.length)p=l.charCodeAt(f);else{if(p===47)break;p=47}if(p===47){if(!(g===f-1||d===1))if(g!==f-1&&d===2){if(i.length<2||u!==2||i.charCodeAt(i.length-1)!==46||i.charCodeAt(i.length-2)!==46){if(i.length>2){var y=i.lastIndexOf("/");if(y!==i.length-1){y===-1?(i="",u=0):(i=i.slice(0,y),u=i.length-1-i.lastIndexOf("/")),g=f,d=0;continue}}else if(i.length===2||i.length===1){i="",u=0,g=f,d=0;continue}}r&&(i.length>0?i+="/..":i="..",u=2)}else i.length>0?i+="/"+l.slice(g+1,f):i=l.slice(g+1,f),u=f-g-1;g=f,d=0}else p===46&&d!==-1?++d:d=-1}return i}function s(l,r){var i=r.dir||r.root,u=r.base||(r.name||"")+(r.ext||"");return i?i===r.root?i+u:i+l+u:u}var c={resolve:function(){for(var r="",i=!1,u,g=arguments.length-1;g>=-1&&!i;g--){var d;g>=0?d=arguments[g]:(u===void 0&&(u=t.cwd()),d=u),e(d),d.length!==0&&(r=d+"/"+r,i=d.charCodeAt(0)===47)}return r=n(r,!i),i?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(r){if(e(r),r.length===0)return".";var i=r.charCodeAt(0)===47,u=r.charCodeAt(r.length-1)===47;return r=n(r,!i),r.length===0&&!i&&(r="."),r.length>0&&u&&(r+="/"),i?"/"+r:r},isAbsolute:function(r){return e(r),r.length>0&&r.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var r,i=0;i<arguments.length;++i){var u=arguments[i];e(u),u.length>0&&(r===void 0?r=u:r+="/"+u)}return r===void 0?".":c.normalize(r)},relative:function(r,i){if(e(r),e(i),r===i||(r=c.resolve(r),i=c.resolve(i),r===i))return"";for(var u=1;u<r.length&&r.charCodeAt(u)===47;++u);for(var g=r.length,d=g-u,p=1;p<i.length&&i.charCodeAt(p)===47;++p);for(var f=i.length,y=f-p,b=d<y?d:y,B=-1,x=0;x<=b;++x){if(x===b){if(y>b){if(i.charCodeAt(p+x)===47)return i.slice(p+x+1);if(x===0)return i.slice(p+x)}else d>b&&(r.charCodeAt(u+x)===47?B=x:x===0&&(B=0));break}var v=r.charCodeAt(u+x),k=i.charCodeAt(p+x);if(v!==k)break;v===47&&(B=x)}var P="";for(x=u+B+1;x<=g;++x)(x===g||r.charCodeAt(x)===47)&&(P.length===0?P+="..":P+="/..");return P.length>0?P+i.slice(p+B):(p+=B,i.charCodeAt(p)===47&&++p,i.slice(p))},_makeLong:function(r){return r},dirname:function(r){if(e(r),r.length===0)return".";for(var i=r.charCodeAt(0),u=i===47,g=-1,d=!0,p=r.length-1;p>=1;--p)if(i=r.charCodeAt(p),i===47){if(!d){g=p;break}}else d=!1;return g===-1?u?"/":".":u&&g===1?"//":r.slice(0,g)},basename:function(r,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');e(r);var u=0,g=-1,d=!0,p;if(i!==void 0&&i.length>0&&i.length<=r.length){if(i.length===r.length&&i===r)return"";var f=i.length-1,y=-1;for(p=r.length-1;p>=0;--p){var b=r.charCodeAt(p);if(b===47){if(!d){u=p+1;break}}else y===-1&&(d=!1,y=p+1),f>=0&&(b===i.charCodeAt(f)?--f===-1&&(g=p):(f=-1,g=y))}return u===g?g=y:g===-1&&(g=r.length),r.slice(u,g)}else{for(p=r.length-1;p>=0;--p)if(r.charCodeAt(p)===47){if(!d){u=p+1;break}}else g===-1&&(d=!1,g=p+1);return g===-1?"":r.slice(u,g)}},extname:function(r){e(r);for(var i=-1,u=0,g=-1,d=!0,p=0,f=r.length-1;f>=0;--f){var y=r.charCodeAt(f);if(y===47){if(!d){u=f+1;break}continue}g===-1&&(d=!1,g=f+1),y===46?i===-1?i=f:p!==1&&(p=1):i!==-1&&(p=-1)}return i===-1||g===-1||p===0||p===1&&i===g-1&&i===u+1?"":r.slice(i,g)},format:function(r){if(r===null||typeof r!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof r);return s("/",r)},parse:function(r){e(r);var i={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return i;var u=r.charCodeAt(0),g=u===47,d;g?(i.root="/",d=1):d=0;for(var p=-1,f=0,y=-1,b=!0,B=r.length-1,x=0;B>=d;--B){if(u=r.charCodeAt(B),u===47){if(!b){f=B+1;break}continue}y===-1&&(b=!1,y=B+1),u===46?p===-1?p=B:x!==1&&(x=1):p!==-1&&(x=-1)}return p===-1||y===-1||x===0||x===1&&p===y-1&&p===f+1?y!==-1&&(f===0&&g?i.base=i.name=r.slice(1,y):i.base=i.name=r.slice(f,y)):(f===0&&g?(i.name=r.slice(1,p),i.base=r.slice(1,y)):(i.name=r.slice(f,p),i.base=r.slice(f,y)),i.ext=r.slice(p,y)),f>0?i.dir=r.slice(0,f-1):g&&(i.dir="/"),i},sep:"/",delimiter:":",win32:null,posix:null};return c.posix=c,Ur=c,Ur}function vg(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 Wr?bg(t):wg(t)}function bg(t){let e=t.hostname,n=t.pathname;for(let s=0;s<n.length;s++)if(n[s]==="%"){let c=n.codePointAt(s+2)||32;if(n[s+1]==="2"&&c===102||n[s+1]==="5"&&c===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(pg,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let s=n.codePointAt(1)|32,c=n[2];if(s<fg||s>gg||c!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function wg(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 s=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&s===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function Bg(t){let e=Xa.resolve(t),n=t.charCodeAt(t.length-1);(n===ug||Wr&&n===cg)&&e[e.length-1]!==Xa.sep&&(e+="/");let s=new URL("file://");return e.includes("%")&&(e=e.replace(dg,"%25")),!Wr&&e.includes("\\")&&(e=e.replace(mg,"%5C")),e.includes(`
|
|
11
|
+
`)&&(e=e.replace(yg,"%0A")),e.includes("\r")&&(e=e.replace(hg,"%0D")),e.includes(" ")&&(e=e.replace(Tg,"%09")),s.pathname=e,s}function Hg(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 Kr?Mg(t):Dg(t)}function Mg(t){let e=t.hostname,n=t.pathname;for(let s=0;s<n.length;s++)if(n[s]==="%"){let c=n.codePointAt(s+2)||32;if(n[s+1]==="2"&&c===102||n[s+1]==="5"&&c===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(kg,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let s=n.codePointAt(1)|32,c=n[2];if(s<Ig||s>Eg||c!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function Dg(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 s=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&s===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function Ng(t){let e=La.resolve(t),n=t.charCodeAt(t.length-1);(n===_g||Kr&&n===Pg)&&e[e.length-1]!==La.sep&&(e+="/");let s=new URL("file://");return e.includes("%")&&(e=e.replace(Ag,"%25")),!Kr&&e.includes("\\")&&(e=e.replace(Sg,"%5C")),e.includes(`
|
|
12
|
+
`)&&(e=e.replace(Cg,"%0A")),e.includes("\r")&&(e=e.replace(Rg,"%0D")),e.includes(" ")&&(e=e.replace(Og,"%09")),s.pathname=e,s}var Hr,$a,La,Yt,qf,zf,Vf,Zf,ft,Mr,Ga,el,qa,za,Yf,Xf,un,Qf,bt,he,eg,ut,tg,ng,rg,ig,jr,Va,Za,Ya,og,sg,Dr,Zt,Nr,Ur,Ja,Xa,lg,cg,ug,fg,gg,Wr,pg,dg,mg,yg,hg,Tg,xg,Pg,_g,Ig,Eg,Kr,kg,Ag,Sg,Cg,Rg,Og,tl=He(()=>{_();E();I();Ln();Or();Hr={},$a=!1;La=Gf(),Yt=2147483647,qf=/^xn--/,zf=/[^\0-\x7E]/,Vf=/[\x2E\u3002\uFF0E\uFF61]/g,Zf={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ft=Math.floor,Mr=String.fromCharCode;Ga=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},el=function(t,e,n){let s=0;for(t=n?ft(t/700):t>>1,t+=ft(t/e);t>455;s+=36)t=ft(t/35);return ft(s+36*t/(t+38))},qa=function(t){let e=[],n=t.length,s=0,c=128,l=72,r=t.lastIndexOf("-");r<0&&(r=0);for(let u=0;u<r;++u)t.charCodeAt(u)>=128&&Ut("not-basic"),e.push(t.charCodeAt(u));for(let u=r>0?r+1:0;u<n;){let g=s;for(let p=1,f=36;;f+=36){u>=n&&Ut("invalid-input");let y=(i=t.charCodeAt(u++))-48<10?i-22:i-65<26?i-65:i-97<26?i-97:36;(y>=36||y>ft((Yt-s)/p))&&Ut("overflow"),s+=y*p;let b=f<=l?1:f>=l+26?26:f-l;if(y<b)break;let B=36-b;p>ft(Yt/B)&&Ut("overflow"),p*=B}let d=e.length+1;l=el(s-g,d,g==0),ft(s/d)>Yt-c&&Ut("overflow"),c+=ft(s/d),s%=d,e.splice(s++,0,c)}var i;return String.fromCodePoint(...e)},za=function(t){let e=[],n=(t=Qa(t)).length,s=128,c=0,l=72;for(let u of t)u<128&&e.push(Mr(u));let r=e.length,i=r;for(r&&e.push("-");i<n;){let u=Yt;for(let d of t)d>=s&&d<u&&(u=d);let g=i+1;u-s>ft((Yt-c)/g)&&Ut("overflow"),c+=(u-s)*g,s=u;for(let d of t)if(d<s&&++c>Yt&&Ut("overflow"),d==s){let p=c;for(let f=36;;f+=36){let y=f<=l?1:f>=l+26?26:f-l;if(p<y)break;let b=p-y,B=36-y;e.push(Mr(Ga(y+b%B,0))),p=ft(b/B)}e.push(Mr(Ga(p,0))),l=el(c,g,i==r),c=0,++i}++c,++s}return e.join("")},Yf={version:"2.1.0",ucs2:{decode:Qa,encode:t=>String.fromCodePoint(...t)},decode:qa,encode:za,toASCII:function(t){return Fa(t,(function(e){return zf.test(e)?"xn--"+za(e):e}))},toUnicode:function(t){return Fa(t,(function(e){return qf.test(e)?qa(e.slice(4).toLowerCase()):e}))}};Xf=function(t,e,n,s){e=e||"&",n=n||"=";var c={};if(typeof t!="string"||t.length===0)return c;var l=/\+/g;t=t.split(e);var r=1e3;s&&typeof s.maxKeys=="number"&&(r=s.maxKeys);var i=t.length;r>0&&i>r&&(i=r);for(var u=0;u<i;++u){var g,d,p,f,y=t[u].replace(l,"%20"),b=y.indexOf(n);b>=0?(g=y.substr(0,b),d=y.substr(b+1)):(g=y,d=""),p=decodeURIComponent(g),f=decodeURIComponent(d),Jf(c,p)?Array.isArray(c[p])?c[p].push(f):c[p]=[c[p],f]:c[p]=f}return c},un=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},Qf=function(t,e,n,s){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map((function(c){var l=encodeURIComponent(un(c))+n;return Array.isArray(t[c])?t[c].map((function(r){return l+encodeURIComponent(un(r))})).join(e):l+encodeURIComponent(un(t[c]))})).join(e):s?encodeURIComponent(un(s))+n+encodeURIComponent(un(t)):""},bt={};bt.decode=bt.parse=Xf,bt.encode=bt.stringify=Qf;bt.decode;bt.encode;bt.parse;bt.stringify;he={},eg=Yf,ut={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}};he.parse=fn,he.resolve=function(t,e){return fn(t,!1,!0).resolve(e)},he.resolveObject=function(t,e){return t?fn(t,!1,!0).resolveObject(e):e},he.format=function(t){return ut.isString(t)&&(t=fn(t)),t instanceof Ye?t.format():Ye.prototype.format.call(t)},he.Url=Ye;tg=/^([a-z0-9.+-]+:)/i,ng=/:[0-9]*$/,rg=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ig=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
|
|
13
|
+
`," "]),jr=["'"].concat(ig),Va=["%","/","?",";","#"].concat(jr),Za=["/","?","#"],Ya=/^[+a-z0-9A-Z_-]{0,63}$/,og=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,sg={javascript:!0,"javascript:":!0},Dr={javascript:!0,"javascript:":!0},Zt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Nr=bt;Ye.prototype.parse=function(t,e,n){if(!ut.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),c=s!==-1&&s<t.indexOf("#")?"?":"#",l=t.split(c);l[0]=l[0].replace(/\\/g,"/");var r=t=l.join(c);if(r=r.trim(),!n&&t.split("#").length===1){var i=rg.exec(r);if(i)return this.path=r,this.href=r,this.pathname=i[1],i[2]?(this.search=i[2],this.query=e?Nr.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=tg.exec(r);if(u){var g=(u=u[0]).toLowerCase();this.protocol=g,r=r.substr(u.length)}if(n||u||r.match(/^\/\/[^@\/]+@[^@\/]+/)){var d=r.substr(0,2)==="//";!d||u&&Dr[u]||(r=r.substr(2),this.slashes=!0)}if(!Dr[u]&&(d||u&&!Zt[u])){for(var p,f,y=-1,b=0;b<Za.length;b++)(B=r.indexOf(Za[b]))!==-1&&(y===-1||B<y)&&(y=B);for((f=y===-1?r.lastIndexOf("@"):r.lastIndexOf("@",y))!==-1&&(p=r.slice(0,f),r=r.slice(f+1),this.auth=decodeURIComponent(p)),y=-1,b=0;b<Va.length;b++){var B;(B=r.indexOf(Va[b]))!==-1&&(y===-1||B<y)&&(y=B)}y===-1&&(y=r.length),this.host=r.slice(0,y),r=r.slice(y),this.parseHost(),this.hostname=this.hostname||"";var x=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!x)for(var v=this.hostname.split(/\./),k=(b=0,v.length);b<k;b++){var P=v[b];if(P&&!P.match(Ya)){for(var D="",U=0,Z=P.length;U<Z;U++)P.charCodeAt(U)>127?D+="x":D+=P[U];if(!D.match(Ya)){var V=v.slice(0,b),ie=v.slice(b+1),X=P.match(og);X&&(V.push(X[1]),ie.unshift(X[2])),ie.length&&(r="/"+ie.join(".")+r),this.hostname=V.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=eg.toASCII(this.hostname));var Y=this.port?":"+this.port:"",de=this.hostname||"";this.host=de+Y,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),r[0]!=="/"&&(r="/"+r))}if(!sg[g])for(b=0,k=jr.length;b<k;b++){var _e=jr[b];if(r.indexOf(_e)!==-1){var Ce=encodeURIComponent(_e);Ce===_e&&(Ce=escape(_e)),r=r.split(_e).join(Ce)}}var ke=r.indexOf("#");ke!==-1&&(this.hash=r.substr(ke),r=r.slice(0,ke));var Ae=r.indexOf("?");if(Ae!==-1?(this.search=r.substr(Ae),this.query=r.substr(Ae+1),e&&(this.query=Nr.parse(this.query)),r=r.slice(0,Ae)):e&&(this.search="",this.query={}),r&&(this.pathname=r),Zt[g]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){Y=this.pathname||"";var We=this.search||"";this.path=Y+We}return this.href=this.format(),this},Ye.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",s=this.hash||"",c=!1,l="";this.host?c=t+this.host:this.hostname&&(c=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(c+=":"+this.port)),this.query&&ut.isObject(this.query)&&Object.keys(this.query).length&&(l=Nr.stringify(this.query));var r=this.search||l&&"?"+l||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Zt[e])&&c!==!1?(c="//"+(c||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):c||(c=""),s&&s.charAt(0)!=="#"&&(s="#"+s),r&&r.charAt(0)!=="?"&&(r="?"+r),e+c+(n=n.replace(/[?#]/g,(function(i){return encodeURIComponent(i)})))+(r=r.replace("#","%23"))+s},Ye.prototype.resolve=function(t){return this.resolveObject(fn(t,!1,!0)).format()},Ye.prototype.resolveObject=function(t){if(ut.isString(t)){var e=new Ye;e.parse(t,!1,!0),t=e}for(var n=new Ye,s=Object.keys(this),c=0;c<s.length;c++){var l=s[c];n[l]=this[l]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var r=Object.keys(t),i=0;i<r.length;i++){var u=r[i];u!=="protocol"&&(n[u]=t[u])}return Zt[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!Zt[t.protocol]){for(var g=Object.keys(t),d=0;d<g.length;d++){var p=g[d];n[p]=t[p]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||Dr[t.protocol])n.pathname=t.pathname;else{for(var f=(t.pathname||"").split("/");f.length&&!(t.host=f.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),f[0]!==""&&f.unshift(""),f.length<2&&f.unshift(""),n.pathname=f.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 y=n.pathname||"",b=n.search||"";n.path=y+b}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var B=n.pathname&&n.pathname.charAt(0)==="/",x=t.host||t.pathname&&t.pathname.charAt(0)==="/",v=x||B||n.host&&t.pathname,k=v,P=n.pathname&&n.pathname.split("/")||[],D=(f=t.pathname&&t.pathname.split("/")||[],n.protocol&&!Zt[n.protocol]);if(D&&(n.hostname="",n.port=null,n.host&&(P[0]===""?P[0]=n.host:P.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(f[0]===""?f[0]=t.host:f.unshift(t.host)),t.host=null),v=v&&(f[0]===""||P[0]==="")),x)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,P=f;else if(f.length)P||(P=[]),P.pop(),P=P.concat(f),n.search=t.search,n.query=t.query;else if(!ut.isNullOrUndefined(t.search))return D&&(n.hostname=n.host=P.shift(),(X=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=X.shift(),n.host=n.hostname=X.shift())),n.search=t.search,n.query=t.query,ut.isNull(n.pathname)&&ut.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!P.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var U=P.slice(-1)[0],Z=(n.host||t.host||P.length>1)&&(U==="."||U==="..")||U==="",V=0,ie=P.length;ie>=0;ie--)(U=P[ie])==="."?P.splice(ie,1):U===".."?(P.splice(ie,1),V++):V&&(P.splice(ie,1),V--);if(!v&&!k)for(;V--;V)P.unshift("..");!v||P[0]===""||P[0]&&P[0].charAt(0)==="/"||P.unshift(""),Z&&P.join("/").substr(-1)!=="/"&&P.push("");var X,Y=P[0]===""||P[0]&&P[0].charAt(0)==="/";return D&&(n.hostname=n.host=Y?"":P.length?P.shift():"",(X=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=X.shift(),n.host=n.hostname=X.shift())),(v=v||n.host&&P.length)&&!Y&&P.unshift(""),P.length?n.pathname=P.join("/"):(n.pathname=null,n.path=null),ut.isNull(n.pathname)&&ut.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},Ye.prototype.parseHost=function(){var t=this.host,e=ng.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};he.Url;he.format;he.resolve;he.resolveObject;Ur={},Ja=!1;Xa=ag(),lg=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;he.URL=typeof URL<"u"?URL:null;he.pathToFileURL=Bg;he.fileURLToPath=vg;he.Url;he.format;he.resolve;he.resolveObject;he.URL;cg=92,ug=47,fg=97,gg=122,Wr=lg==="win32",pg=/\//g,dg=/%/g,mg=/\\/g,yg=/\n/g,hg=/\r/g,Tg=/\t/g;xg=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;he.URL=typeof URL<"u"?URL:null;he.pathToFileURL=Ng;he.fileURLToPath=Hg;he.Url;he.format;he.resolve;he.resolveObject;he.parse;he.URL;Pg=92,_g=47,Ig=97,Eg=122,Kr=xg==="win32",kg=/\//g,Ag=/%/g,Sg=/\\/g,Cg=/\n/g,Rg=/\r/g,Og=/\t/g});var Hl={};Pt(Hl,{Agent:()=>Vg,ClientRequest:()=>Zg,IncomingMessage:()=>Yg,METHODS:()=>Jg,STATUS_CODES:()=>Xg,default:()=>wt,get:()=>Qg,globalAgent:()=>ep,request:()=>tp});function _l(){if(nl)return ze;nl=!0,ze.fetch=s(jt.fetch)&&s(jt.ReadableStream),ze.writableStream=s(jt.WritableStream),ze.abortController=s(jt.AbortController);var t;function e(){if(t!==void 0)return t;if(jt.XMLHttpRequest){t=new jt.XMLHttpRequest;try{t.open("GET",jt.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(c){var l=e();if(!l)return!1;try{return l.responseType=c,l.responseType===c}catch{}return!1}ze.arraybuffer=ze.fetch||n("arraybuffer"),ze.msstream=!ze.fetch&&n("ms-stream"),ze.mozchunkedarraybuffer=!ze.fetch&&n("moz-chunked-arraybuffer"),ze.overrideMimeType=ze.fetch||(e()?s(e().overrideMimeType):!1);function s(c){return typeof c=="function"}return t=null,ze}function Il(){return rl||(rl=!0,$r=Ke.EventEmitter),$r}function Ug(){if(il)return Lr;il=!0;function t(b,B){var x=Object.keys(b);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(b);B&&(v=v.filter(function(k){return Object.getOwnPropertyDescriptor(b,k).enumerable})),x.push.apply(x,v)}return x}function e(b){for(var B=1;B<arguments.length;B++){var x=arguments[B]!=null?arguments[B]:{};B%2?t(Object(x),!0).forEach(function(v){n(b,v,x[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(x)):t(Object(x)).forEach(function(v){Object.defineProperty(b,v,Object.getOwnPropertyDescriptor(x,v))})}return b}function n(b,B,x){return B=r(B),B in b?Object.defineProperty(b,B,{value:x,enumerable:!0,configurable:!0,writable:!0}):b[B]=x,b}function s(b,B){if(!(b instanceof B))throw new TypeError("Cannot call a class as a function")}function c(b,B){for(var x=0;x<B.length;x++){var v=B[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(b,r(v.key),v)}}function l(b,B,x){return B&&c(b.prototype,B),Object.defineProperty(b,"prototype",{writable:!1}),b}function r(b){var B=i(b,"string");return typeof B=="symbol"?B:String(B)}function i(b,B){if(typeof b!="object"||b===null)return b;var x=b[Symbol.toPrimitive];if(x!==void 0){var v=x.call(b,B||"default");if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(B==="string"?String:Number)(b)}var u=at(),g=u.Buffer,d=j,p=d.inspect,f=p&&p.custom||"inspect";function y(b,B,x){g.prototype.copy.call(b,B,x)}return Lr=(function(){function b(){s(this,b),this.head=null,this.tail=null,this.length=0}return l(b,[{key:"push",value:function(x){var v={data:x,next:null};this.length>0?this.tail.next=v:this.head=v,this.tail=v,++this.length}},{key:"unshift",value:function(x){var v={data:x,next:this.head};this.length===0&&(this.tail=v),this.head=v,++this.length}},{key:"shift",value:function(){if(this.length!==0){var x=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,x}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(x){if(this.length===0)return"";for(var v=this.head,k=""+v.data;v=v.next;)k+=x+v.data;return k}},{key:"concat",value:function(x){if(this.length===0)return g.alloc(0);for(var v=g.allocUnsafe(x>>>0),k=this.head,P=0;k;)y(k.data,v,P),P+=k.data.length,k=k.next;return v}},{key:"consume",value:function(x,v){var k;return x<this.head.data.length?(k=this.head.data.slice(0,x),this.head.data=this.head.data.slice(x)):x===this.head.data.length?k=this.shift():k=v?this._getString(x):this._getBuffer(x),k}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(x){var v=this.head,k=1,P=v.data;for(x-=P.length;v=v.next;){var D=v.data,U=x>D.length?D.length:x;if(U===D.length?P+=D:P+=D.slice(0,x),x-=U,x===0){U===D.length?(++k,v.next?this.head=v.next:this.head=this.tail=null):(this.head=v,v.data=D.slice(U));break}++k}return this.length-=k,P}},{key:"_getBuffer",value:function(x){var v=g.allocUnsafe(x),k=this.head,P=1;for(k.data.copy(v),x-=k.data.length;k=k.next;){var D=k.data,U=x>D.length?D.length:x;if(D.copy(v,v.length-x,0,U),x-=U,x===0){U===D.length?(++P,k.next?this.head=k.next:this.head=this.tail=null):(this.head=k,k.data=D.slice(U));break}++P}return this.length-=P,v}},{key:f,value:function(x,v){return p(this,e(e({},v),{},{depth:0,customInspect:!1}))}}]),b})(),Lr}function El(){if(ol)return Fr;ol=!0;var t=tt;function e(i,u){var g=this,d=this._readableState&&this._readableState.destroyed,p=this._writableState&&this._writableState.destroyed;return d||p?(u?u(i):i&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(l,this,i)):t.nextTick(l,this,i)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(i||null,function(f){!u&&f?g._writableState?g._writableState.errorEmitted?t.nextTick(s,g):(g._writableState.errorEmitted=!0,t.nextTick(n,g,f)):t.nextTick(n,g,f):u?(t.nextTick(s,g),u(f)):t.nextTick(s,g)}),this)}function n(i,u){l(i,u),s(i)}function s(i){i._writableState&&!i._writableState.emitClose||i._readableState&&!i._readableState.emitClose||i.emit("close")}function c(){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 l(i,u){i.emit("error",u)}function r(i,u){var g=i._readableState,d=i._writableState;g&&g.autoDestroy||d&&d.autoDestroy?i.destroy(u):i.emit("error",u)}return Fr={destroy:e,undestroy:c,errorOrDestroy:r},Fr}function Xt(){if(sl)return Gr;sl=!0;let t={};function e(r,i,u){u||(u=Error);function g(p,f,y){return typeof i=="string"?i:i(p,f,y)}class d extends u{constructor(f,y,b){super(g(f,y,b))}}d.prototype.name=u.name,d.prototype.code=r,t[r]=d}function n(r,i){if(Array.isArray(r)){let u=r.length;return r=r.map(g=>String(g)),u>2?`one of ${i} ${r.slice(0,u-1).join(", ")}, or `+r[u-1]:u===2?`one of ${i} ${r[0]} or ${r[1]}`:`of ${i} ${r[0]}`}else return`of ${i} ${String(r)}`}function s(r,i,u){return r.substr(0,i.length)===i}function c(r,i,u){return(u===void 0||u>r.length)&&(u=r.length),r.substring(u-i.length,u)===i}function l(r,i,u){return typeof u!="number"&&(u=0),u+i.length>r.length?!1:r.indexOf(i,u)!==-1}return e("ERR_INVALID_OPT_VALUE",function(r,i){return'The value "'+i+'" is invalid for option "'+r+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(r,i,u){let g;typeof i=="string"&&s(i,"not ")?(g="must not be",i=i.replace(/^not /,"")):g="must be";let d;if(c(r," argument"))d=`The ${r} ${g} ${n(i,"type")}`;else{let p=l(r,".")?"property":"argument";d=`The "${r}" ${p} ${g} ${n(i,"type")}`}return d+=`. Received type ${typeof u}`,d},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(r){return"The "+r+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(r){return"Cannot call "+r+" 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(r){return"Unknown encoding: "+r},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Gr.codes=t,Gr}function kl(){if(al)return qr;al=!0;var t=Xt().codes.ERR_INVALID_OPT_VALUE;function e(s,c,l){return s.highWaterMark!=null?s.highWaterMark:c?s[l]:null}function n(s,c,l,r){var i=e(c,r,l);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var u=r?l:"highWaterMark";throw new t(u,i)}return Math.floor(i)}return s.objectMode?16:16*1024}return qr={getHighWaterMark:n},qr}function Al(){if(ll)return zr;ll=!0;var t=tt;zr=X;function e(C){var A=this;this.next=null,this.entry=null,this.finish=function(){se(A,C)}}var n;X.WritableState=V;var s={deprecate:Da()},c=Il(),l=at().Buffer,r=(typeof cl<"u"?cl:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(C){return l.from(C)}function u(C){return l.isBuffer(C)||C instanceof r}var g=El(),d=kl(),p=d.getHighWaterMark,f=Xt().codes,y=f.ERR_INVALID_ARG_TYPE,b=f.ERR_METHOD_NOT_IMPLEMENTED,B=f.ERR_MULTIPLE_CALLBACK,x=f.ERR_STREAM_CANNOT_PIPE,v=f.ERR_STREAM_DESTROYED,k=f.ERR_STREAM_NULL_VALUES,P=f.ERR_STREAM_WRITE_AFTER_END,D=f.ERR_UNKNOWN_ENCODING,U=g.errorOrDestroy;lt()(X,c);function Z(){}function V(C,A,M){n=n||Jt(),C=C||{},typeof M!="boolean"&&(M=A instanceof n),this.objectMode=!!C.objectMode,M&&(this.objectMode=this.objectMode||!!C.writableObjectMode),this.highWaterMark=p(this,C,"writableHighWaterMark",M),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var q=C.decodeStrings===!1;this.decodeStrings=!q,this.defaultEncoding=C.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(J){ve(A,J)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=C.emitClose!==!1,this.autoDestroy=!!C.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}V.prototype.getBuffer=function(){for(var A=this.bufferedRequest,M=[];A;)M.push(A),A=A.next;return M},(function(){try{Object.defineProperty(V.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var ie;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ie=Function.prototype[Symbol.hasInstance],Object.defineProperty(X,Symbol.hasInstance,{value:function(A){return ie.call(this,A)?!0:this!==X?!1:A&&A._writableState instanceof V}})):ie=function(A){return A instanceof this};function X(C){n=n||Jt();var A=this instanceof n;if(!A&&!ie.call(X,this))return new X(C);this._writableState=new V(C,this,A),this.writable=!0,C&&(typeof C.write=="function"&&(this._write=C.write),typeof C.writev=="function"&&(this._writev=C.writev),typeof C.destroy=="function"&&(this._destroy=C.destroy),typeof C.final=="function"&&(this._final=C.final)),c.call(this)}X.prototype.pipe=function(){U(this,new x)};function Y(C,A){var M=new P;U(C,M),t.nextTick(A,M)}function de(C,A,M,q){var J;return M===null?J=new k:typeof M!="string"&&!A.objectMode&&(J=new y("chunk",["string","Buffer"],M)),J?(U(C,J),t.nextTick(q,J),!1):!0}X.prototype.write=function(C,A,M){var q=this._writableState,J=!1,T=!q.objectMode&&u(C);return T&&!l.isBuffer(C)&&(C=i(C)),typeof A=="function"&&(M=A,A=null),T?A="buffer":A||(A=q.defaultEncoding),typeof M!="function"&&(M=Z),q.ending?Y(this,M):(T||de(this,q,C,M))&&(q.pendingcb++,J=Ce(this,q,T,C,A,M)),J},X.prototype.cork=function(){this._writableState.corked++},X.prototype.uncork=function(){var C=this._writableState;C.corked&&(C.corked--,!C.writing&&!C.corked&&!C.bufferProcessing&&C.bufferedRequest&&te(this,C))},X.prototype.setDefaultEncoding=function(A){if(typeof A=="string"&&(A=A.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((A+"").toLowerCase())>-1))throw new D(A);return this._writableState.defaultEncoding=A,this},Object.defineProperty(X.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function _e(C,A,M){return!C.objectMode&&C.decodeStrings!==!1&&typeof A=="string"&&(A=l.from(A,M)),A}Object.defineProperty(X.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Ce(C,A,M,q,J,T){if(!M){var w=_e(A,q,J);q!==w&&(M=!0,J="buffer",q=w)}var $=A.objectMode?1:q.length;A.length+=$;var z=A.length<A.highWaterMark;if(z||(A.needDrain=!0),A.writing||A.corked){var me=A.lastBufferedRequest;A.lastBufferedRequest={chunk:q,encoding:J,isBuf:M,callback:T,next:null},me?me.next=A.lastBufferedRequest:A.bufferedRequest=A.lastBufferedRequest,A.bufferedRequestCount+=1}else ke(C,A,!1,$,q,J,T);return z}function ke(C,A,M,q,J,T,w){A.writelen=q,A.writecb=w,A.writing=!0,A.sync=!0,A.destroyed?A.onwrite(new v("write")):M?C._writev(J,A.onwrite):C._write(J,T,A.onwrite),A.sync=!1}function Ae(C,A,M,q,J){--A.pendingcb,M?(t.nextTick(J,q),t.nextTick(W,C,A),C._writableState.errorEmitted=!0,U(C,q)):(J(q),C._writableState.errorEmitted=!0,U(C,q),W(C,A))}function We(C){C.writing=!1,C.writecb=null,C.length-=C.writelen,C.writelen=0}function ve(C,A){var M=C._writableState,q=M.sync,J=M.writecb;if(typeof J!="function")throw new B;if(We(M),A)Ae(C,M,q,A,J);else{var T=oe(M)||C.destroyed;!T&&!M.corked&&!M.bufferProcessing&&M.bufferedRequest&&te(C,M),q?t.nextTick(ue,C,M,T,J):ue(C,M,T,J)}}function ue(C,A,M,q){M||pe(C,A),A.pendingcb--,q(),W(C,A)}function pe(C,A){A.length===0&&A.needDrain&&(A.needDrain=!1,C.emit("drain"))}function te(C,A){A.bufferProcessing=!0;var M=A.bufferedRequest;if(C._writev&&M&&M.next){var q=A.bufferedRequestCount,J=new Array(q),T=A.corkedRequestsFree;T.entry=M;for(var w=0,$=!0;M;)J[w]=M,M.isBuf||($=!1),M=M.next,w+=1;J.allBuffers=$,ke(C,A,!0,A.length,J,"",T.finish),A.pendingcb++,A.lastBufferedRequest=null,T.next?(A.corkedRequestsFree=T.next,T.next=null):A.corkedRequestsFree=new e(A),A.bufferedRequestCount=0}else{for(;M;){var z=M.chunk,me=M.encoding,ae=M.callback,H=A.objectMode?1:z.length;if(ke(C,A,!1,H,z,me,ae),M=M.next,A.bufferedRequestCount--,A.writing)break}M===null&&(A.lastBufferedRequest=null)}A.bufferedRequest=M,A.bufferProcessing=!1}X.prototype._write=function(C,A,M){M(new b("_write()"))},X.prototype._writev=null,X.prototype.end=function(C,A,M){var q=this._writableState;return typeof C=="function"?(M=C,C=null,A=null):typeof A=="function"&&(M=A,A=null),C!=null&&this.write(C,A),q.corked&&(q.corked=1,this.uncork()),q.ending||ne(this,q,M),this},Object.defineProperty(X.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function oe(C){return C.ending&&C.length===0&&C.bufferedRequest===null&&!C.finished&&!C.writing}function R(C,A){C._final(function(M){A.pendingcb--,M&&U(C,M),A.prefinished=!0,C.emit("prefinish"),W(C,A)})}function N(C,A){!A.prefinished&&!A.finalCalled&&(typeof C._final=="function"&&!A.destroyed?(A.pendingcb++,A.finalCalled=!0,t.nextTick(R,C,A)):(A.prefinished=!0,C.emit("prefinish")))}function W(C,A){var M=oe(A);if(M&&(N(C,A),A.pendingcb===0&&(A.finished=!0,C.emit("finish"),A.autoDestroy))){var q=C._readableState;(!q||q.autoDestroy&&q.endEmitted)&&C.destroy()}return M}function ne(C,A,M){A.ending=!0,W(C,A),M&&(A.finished?t.nextTick(M):C.once("finish",M)),A.ended=!0,C.writable=!1}function se(C,A,M){var q=C.entry;for(C.entry=null;q;){var J=q.callback;A.pendingcb--,J(M),q=q.next}A.corkedRequestsFree.next=C}return Object.defineProperty(X.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(A){this._writableState&&(this._writableState.destroyed=A)}}),X.prototype.destroy=g.destroy,X.prototype._undestroy=g.undestroy,X.prototype._destroy=function(C,A){A(C)},zr}function Jt(){if(ul)return Vr;ul=!0;var t=tt,e=Object.keys||function(d){var p=[];for(var f in d)p.push(f);return p};Vr=i;var n=Sl(),s=Al();lt()(i,n);for(var c=e(s.prototype),l=0;l<c.length;l++){var r=c[l];i.prototype[r]||(i.prototype[r]=s.prototype[r])}function i(d){if(!(this instanceof i))return new i(d);n.call(this,d),s.call(this,d),this.allowHalfOpen=!0,d&&(d.readable===!1&&(this.readable=!1),d.writable===!1&&(this.writable=!1),d.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u)))}Object.defineProperty(i.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(i.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(i.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||t.nextTick(g,this)}function g(d){d.end()}return Object.defineProperty(i.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(p){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=p,this._writableState.destroyed=p)}}),Vr}function si(){if(fl)return Zr;fl=!0;var t=Xt().codes.ERR_STREAM_PREMATURE_CLOSE;function e(l){var r=!1;return function(){if(!r){r=!0;for(var i=arguments.length,u=new Array(i),g=0;g<i;g++)u[g]=arguments[g];l.apply(this,u)}}}function n(){}function s(l){return l.setHeader&&typeof l.abort=="function"}function c(l,r,i){if(typeof r=="function")return c(l,null,r);r||(r={}),i=e(i||n);var u=r.readable||r.readable!==!1&&l.readable,g=r.writable||r.writable!==!1&&l.writable,d=function(){l.writable||f()},p=l._writableState&&l._writableState.finished,f=function(){g=!1,p=!0,u||i.call(l)},y=l._readableState&&l._readableState.endEmitted,b=function(){u=!1,y=!0,g||i.call(l)},B=function(P){i.call(l,P)},x=function(){var P;if(u&&!y)return(!l._readableState||!l._readableState.ended)&&(P=new t),i.call(l,P);if(g&&!p)return(!l._writableState||!l._writableState.ended)&&(P=new t),i.call(l,P)},v=function(){l.req.on("finish",f)};return s(l)?(l.on("complete",f),l.on("abort",x),l.req?v():l.on("request",v)):g&&!l._writableState&&(l.on("end",d),l.on("close",d)),l.on("end",b),l.on("finish",f),r.error!==!1&&l.on("error",B),l.on("close",x),function(){l.removeListener("complete",f),l.removeListener("abort",x),l.removeListener("request",v),l.req&&l.req.removeListener("finish",f),l.removeListener("end",d),l.removeListener("close",d),l.removeListener("finish",f),l.removeListener("end",b),l.removeListener("error",B),l.removeListener("close",x)}}return Zr=c,Zr}function jg(){if(gl)return Yr;gl=!0;var t=tt,e;function n(D,U,Z){return U=s(U),U in D?Object.defineProperty(D,U,{value:Z,enumerable:!0,configurable:!0,writable:!0}):D[U]=Z,D}function s(D){var U=c(D,"string");return typeof U=="symbol"?U:String(U)}function c(D,U){if(typeof D!="object"||D===null)return D;var Z=D[Symbol.toPrimitive];if(Z!==void 0){var V=Z.call(D,U||"default");if(typeof V!="object")return V;throw new TypeError("@@toPrimitive must return a primitive value.")}return(U==="string"?String:Number)(D)}var l=si(),r=Symbol("lastResolve"),i=Symbol("lastReject"),u=Symbol("error"),g=Symbol("ended"),d=Symbol("lastPromise"),p=Symbol("handlePromise"),f=Symbol("stream");function y(D,U){return{value:D,done:U}}function b(D){var U=D[r];if(U!==null){var Z=D[f].read();Z!==null&&(D[d]=null,D[r]=null,D[i]=null,U(y(Z,!1)))}}function B(D){t.nextTick(b,D)}function x(D,U){return function(Z,V){D.then(function(){if(U[g]){Z(y(void 0,!0));return}U[p](Z,V)},V)}}var v=Object.getPrototypeOf(function(){}),k=Object.setPrototypeOf((e={get stream(){return this[f]},next:function(){var U=this,Z=this[u];if(Z!==null)return Promise.reject(Z);if(this[g])return Promise.resolve(y(void 0,!0));if(this[f].destroyed)return new Promise(function(Y,de){t.nextTick(function(){U[u]?de(U[u]):Y(y(void 0,!0))})});var V=this[d],ie;if(V)ie=new Promise(x(V,this));else{var X=this[f].read();if(X!==null)return Promise.resolve(y(X,!1));ie=new Promise(this[p])}return this[d]=ie,ie}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var U=this;return new Promise(function(Z,V){U[f].destroy(null,function(ie){if(ie){V(ie);return}Z(y(void 0,!0))})})}),e),v),P=function(U){var Z,V=Object.create(k,(Z={},n(Z,f,{value:U,writable:!0}),n(Z,r,{value:null,writable:!0}),n(Z,i,{value:null,writable:!0}),n(Z,u,{value:null,writable:!0}),n(Z,g,{value:U._readableState.endEmitted,writable:!0}),n(Z,p,{value:function(X,Y){var de=V[f].read();de?(V[d]=null,V[r]=null,V[i]=null,X(y(de,!1))):(V[r]=X,V[i]=Y)},writable:!0}),Z));return V[d]=null,l(U,function(ie){if(ie&&ie.code!=="ERR_STREAM_PREMATURE_CLOSE"){var X=V[i];X!==null&&(V[d]=null,V[r]=null,V[i]=null,X(ie)),V[u]=ie;return}var Y=V[r];Y!==null&&(V[d]=null,V[r]=null,V[i]=null,Y(y(void 0,!0))),V[g]=!0}),U.on("readable",B.bind(null,V)),V};return Yr=P,Yr}function Wg(){return pl||(pl=!0,Jr=function(){throw new Error("Readable.from is not available in the browser")}),Jr}function Sl(){if(dl)return Xr;dl=!0;var t=tt;Xr=Y;var e;Y.ReadableState=X,Ke.EventEmitter;var n=function(w,$){return w.listeners($).length},s=Il(),c=at().Buffer,l=(typeof ml<"u"?ml:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function r(T){return c.from(T)}function i(T){return c.isBuffer(T)||T instanceof l}var u=j,g;u&&u.debuglog?g=u.debuglog("stream"):g=function(){};var d=Ug(),p=El(),f=kl(),y=f.getHighWaterMark,b=Xt().codes,B=b.ERR_INVALID_ARG_TYPE,x=b.ERR_STREAM_PUSH_AFTER_EOF,v=b.ERR_METHOD_NOT_IMPLEMENTED,k=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,P,D,U;lt()(Y,s);var Z=p.errorOrDestroy,V=["error","close","destroy","pause","resume"];function ie(T,w,$){if(typeof T.prependListener=="function")return T.prependListener(w,$);!T._events||!T._events[w]?T.on(w,$):Array.isArray(T._events[w])?T._events[w].unshift($):T._events[w]=[$,T._events[w]]}function X(T,w,$){e=e||Jt(),T=T||{},typeof $!="boolean"&&($=w instanceof e),this.objectMode=!!T.objectMode,$&&(this.objectMode=this.objectMode||!!T.readableObjectMode),this.highWaterMark=y(this,T,"readableHighWaterMark",$),this.buffer=new d,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=T.emitClose!==!1,this.autoDestroy=!!T.autoDestroy,this.destroyed=!1,this.defaultEncoding=T.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,T.encoding&&(P||(P=cn.StringDecoder),this.decoder=new P(T.encoding),this.encoding=T.encoding)}function Y(T){if(e=e||Jt(),!(this instanceof Y))return new Y(T);var w=this instanceof e;this._readableState=new X(T,this,w),this.readable=!0,T&&(typeof T.read=="function"&&(this._read=T.read),typeof T.destroy=="function"&&(this._destroy=T.destroy)),s.call(this)}Object.defineProperty(Y.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(w){this._readableState&&(this._readableState.destroyed=w)}}),Y.prototype.destroy=p.destroy,Y.prototype._undestroy=p.undestroy,Y.prototype._destroy=function(T,w){w(T)},Y.prototype.push=function(T,w){var $=this._readableState,z;return $.objectMode?z=!0:typeof T=="string"&&(w=w||$.defaultEncoding,w!==$.encoding&&(T=c.from(T,w),w=""),z=!0),de(this,T,w,!1,z)},Y.prototype.unshift=function(T){return de(this,T,null,!0,!1)};function de(T,w,$,z,me){g("readableAddChunk",w);var ae=T._readableState;if(w===null)ae.reading=!1,ve(T,ae);else{var H;if(me||(H=Ce(ae,w)),H)Z(T,H);else if(ae.objectMode||w&&w.length>0)if(typeof w!="string"&&!ae.objectMode&&Object.getPrototypeOf(w)!==c.prototype&&(w=r(w)),z)ae.endEmitted?Z(T,new k):_e(T,ae,w,!0);else if(ae.ended)Z(T,new x);else{if(ae.destroyed)return!1;ae.reading=!1,ae.decoder&&!$?(w=ae.decoder.write(w),ae.objectMode||w.length!==0?_e(T,ae,w,!1):te(T,ae)):_e(T,ae,w,!1)}else z||(ae.reading=!1,te(T,ae))}return!ae.ended&&(ae.length<ae.highWaterMark||ae.length===0)}function _e(T,w,$,z){w.flowing&&w.length===0&&!w.sync?(w.awaitDrain=0,T.emit("data",$)):(w.length+=w.objectMode?1:$.length,z?w.buffer.unshift($):w.buffer.push($),w.needReadable&&ue(T)),te(T,w)}function Ce(T,w){var $;return!i(w)&&typeof w!="string"&&w!==void 0&&!T.objectMode&&($=new B("chunk",["string","Buffer","Uint8Array"],w)),$}Y.prototype.isPaused=function(){return this._readableState.flowing===!1},Y.prototype.setEncoding=function(T){P||(P=cn.StringDecoder);var w=new P(T);this._readableState.decoder=w,this._readableState.encoding=this._readableState.decoder.encoding;for(var $=this._readableState.buffer.head,z="";$!==null;)z+=w.write($.data),$=$.next;return this._readableState.buffer.clear(),z!==""&&this._readableState.buffer.push(z),this._readableState.length=z.length,this};var ke=1073741824;function Ae(T){return T>=ke?T=ke:(T--,T|=T>>>1,T|=T>>>2,T|=T>>>4,T|=T>>>8,T|=T>>>16,T++),T}function We(T,w){return T<=0||w.length===0&&w.ended?0:w.objectMode?1:T!==T?w.flowing&&w.length?w.buffer.head.data.length:w.length:(T>w.highWaterMark&&(w.highWaterMark=Ae(T)),T<=w.length?T:w.ended?w.length:(w.needReadable=!0,0))}Y.prototype.read=function(T){g("read",T),T=parseInt(T,10);var w=this._readableState,$=T;if(T!==0&&(w.emittedReadable=!1),T===0&&w.needReadable&&((w.highWaterMark!==0?w.length>=w.highWaterMark:w.length>0)||w.ended))return g("read: emitReadable",w.length,w.ended),w.length===0&&w.ended?M(this):ue(this),null;if(T=We(T,w),T===0&&w.ended)return w.length===0&&M(this),null;var z=w.needReadable;g("need readable",z),(w.length===0||w.length-T<w.highWaterMark)&&(z=!0,g("length less than watermark",z)),w.ended||w.reading?(z=!1,g("reading or ended",z)):z&&(g("do read"),w.reading=!0,w.sync=!0,w.length===0&&(w.needReadable=!0),this._read(w.highWaterMark),w.sync=!1,w.reading||(T=We($,w)));var me;return T>0?me=A(T,w):me=null,me===null?(w.needReadable=w.length<=w.highWaterMark,T=0):(w.length-=T,w.awaitDrain=0),w.length===0&&(w.ended||(w.needReadable=!0),$!==T&&w.ended&&M(this)),me!==null&&this.emit("data",me),me};function ve(T,w){if(g("onEofChunk"),!w.ended){if(w.decoder){var $=w.decoder.end();$&&$.length&&(w.buffer.push($),w.length+=w.objectMode?1:$.length)}w.ended=!0,w.sync?ue(T):(w.needReadable=!1,w.emittedReadable||(w.emittedReadable=!0,pe(T)))}}function ue(T){var w=T._readableState;g("emitReadable",w.needReadable,w.emittedReadable),w.needReadable=!1,w.emittedReadable||(g("emitReadable",w.flowing),w.emittedReadable=!0,t.nextTick(pe,T))}function pe(T){var w=T._readableState;g("emitReadable_",w.destroyed,w.length,w.ended),!w.destroyed&&(w.length||w.ended)&&(T.emit("readable"),w.emittedReadable=!1),w.needReadable=!w.flowing&&!w.ended&&w.length<=w.highWaterMark,C(T)}function te(T,w){w.readingMore||(w.readingMore=!0,t.nextTick(oe,T,w))}function oe(T,w){for(;!w.reading&&!w.ended&&(w.length<w.highWaterMark||w.flowing&&w.length===0);){var $=w.length;if(g("maybeReadMore read 0"),T.read(0),$===w.length)break}w.readingMore=!1}Y.prototype._read=function(T){Z(this,new v("_read()"))},Y.prototype.pipe=function(T,w){var $=this,z=this._readableState;switch(z.pipesCount){case 0:z.pipes=T;break;case 1:z.pipes=[z.pipes,T];break;default:z.pipes.push(T);break}z.pipesCount+=1,g("pipe count=%d opts=%j",z.pipesCount,w);var me=(!w||w.end!==!1)&&T!==t.stdout&&T!==t.stderr,ae=me?et:o;z.endEmitted?t.nextTick(ae):$.once("end",ae),T.on("unpipe",H);function H(a,h){g("onunpipe"),a===$&&h&&h.hasUnpiped===!1&&(h.hasUnpiped=!0,en())}function et(){g("onend"),T.end()}var st=R($);T.on("drain",st);var Ge=!1;function en(){g("cleanup"),T.removeListener("close",tn),T.removeListener("finish",m),T.removeListener("drain",st),T.removeListener("error",Ve),T.removeListener("unpipe",H),$.removeListener("end",et),$.removeListener("end",o),$.removeListener("data",bn),Ge=!0,z.awaitDrain&&(!T._writableState||T._writableState.needDrain)&&st()}$.on("data",bn);function bn(a){g("ondata");var h=T.write(a);g("dest.write",h),h===!1&&((z.pipesCount===1&&z.pipes===T||z.pipesCount>1&&J(z.pipes,T)!==-1)&&!Ge&&(g("false write response, pause",z.awaitDrain),z.awaitDrain++),$.pause())}function Ve(a){g("onerror",a),o(),T.removeListener("error",Ve),n(T,"error")===0&&Z(T,a)}ie(T,"error",Ve);function tn(){T.removeListener("finish",m),o()}T.once("close",tn);function m(){g("onfinish"),T.removeListener("close",tn),o()}T.once("finish",m);function o(){g("unpipe"),$.unpipe(T)}return T.emit("pipe",$),z.flowing||(g("pipe resume"),$.resume()),T};function R(T){return function(){var $=T._readableState;g("pipeOnDrain",$.awaitDrain),$.awaitDrain&&$.awaitDrain--,$.awaitDrain===0&&n(T,"data")&&($.flowing=!0,C(T))}}Y.prototype.unpipe=function(T){var w=this._readableState,$={hasUnpiped:!1};if(w.pipesCount===0)return this;if(w.pipesCount===1)return T&&T!==w.pipes?this:(T||(T=w.pipes),w.pipes=null,w.pipesCount=0,w.flowing=!1,T&&T.emit("unpipe",this,$),this);if(!T){var z=w.pipes,me=w.pipesCount;w.pipes=null,w.pipesCount=0,w.flowing=!1;for(var ae=0;ae<me;ae++)z[ae].emit("unpipe",this,{hasUnpiped:!1});return this}var H=J(w.pipes,T);return H===-1?this:(w.pipes.splice(H,1),w.pipesCount-=1,w.pipesCount===1&&(w.pipes=w.pipes[0]),T.emit("unpipe",this,$),this)},Y.prototype.on=function(T,w){var $=s.prototype.on.call(this,T,w),z=this._readableState;return T==="data"?(z.readableListening=this.listenerCount("readable")>0,z.flowing!==!1&&this.resume()):T==="readable"&&!z.endEmitted&&!z.readableListening&&(z.readableListening=z.needReadable=!0,z.flowing=!1,z.emittedReadable=!1,g("on readable",z.length,z.reading),z.length?ue(this):z.reading||t.nextTick(W,this)),$},Y.prototype.addListener=Y.prototype.on,Y.prototype.removeListener=function(T,w){var $=s.prototype.removeListener.call(this,T,w);return T==="readable"&&t.nextTick(N,this),$},Y.prototype.removeAllListeners=function(T){var w=s.prototype.removeAllListeners.apply(this,arguments);return(T==="readable"||T===void 0)&&t.nextTick(N,this),w};function N(T){var w=T._readableState;w.readableListening=T.listenerCount("readable")>0,w.resumeScheduled&&!w.paused?w.flowing=!0:T.listenerCount("data")>0&&T.resume()}function W(T){g("readable nexttick read 0"),T.read(0)}Y.prototype.resume=function(){var T=this._readableState;return T.flowing||(g("resume"),T.flowing=!T.readableListening,ne(this,T)),T.paused=!1,this};function ne(T,w){w.resumeScheduled||(w.resumeScheduled=!0,t.nextTick(se,T,w))}function se(T,w){g("resume",w.reading),w.reading||T.read(0),w.resumeScheduled=!1,T.emit("resume"),C(T),w.flowing&&!w.reading&&T.read(0)}Y.prototype.pause=function(){return g("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(g("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function C(T){var w=T._readableState;for(g("flow",w.flowing);w.flowing&&T.read()!==null;);}Y.prototype.wrap=function(T){var w=this,$=this._readableState,z=!1;T.on("end",function(){if(g("wrapped end"),$.decoder&&!$.ended){var H=$.decoder.end();H&&H.length&&w.push(H)}w.push(null)}),T.on("data",function(H){if(g("wrapped data"),$.decoder&&(H=$.decoder.write(H)),!($.objectMode&&H==null)&&!(!$.objectMode&&(!H||!H.length))){var et=w.push(H);et||(z=!0,T.pause())}});for(var me in T)this[me]===void 0&&typeof T[me]=="function"&&(this[me]=(function(et){return function(){return T[et].apply(T,arguments)}})(me));for(var ae=0;ae<V.length;ae++)T.on(V[ae],this.emit.bind(this,V[ae]));return this._read=function(H){g("wrapped _read",H),z&&(z=!1,T.resume())},this},typeof Symbol=="function"&&(Y.prototype[Symbol.asyncIterator]=function(){return D===void 0&&(D=jg()),D(this)}),Object.defineProperty(Y.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Y.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Y.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(w){this._readableState&&(this._readableState.flowing=w)}}),Y._fromList=A,Object.defineProperty(Y.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function A(T,w){if(w.length===0)return null;var $;return w.objectMode?$=w.buffer.shift():!T||T>=w.length?(w.decoder?$=w.buffer.join(""):w.buffer.length===1?$=w.buffer.first():$=w.buffer.concat(w.length),w.buffer.clear()):$=w.buffer.consume(T,w.decoder),$}function M(T){var w=T._readableState;g("endReadable",w.endEmitted),w.endEmitted||(w.ended=!0,t.nextTick(q,w,T))}function q(T,w){if(g("endReadableNT",T.endEmitted,T.length),!T.endEmitted&&T.length===0&&(T.endEmitted=!0,w.readable=!1,w.emit("end"),T.autoDestroy)){var $=w._writableState;(!$||$.autoDestroy&&$.finished)&&w.destroy()}}typeof Symbol=="function"&&(Y.from=function(T,w){return U===void 0&&(U=Wg()),U(Y,T,w)});function J(T,w){for(var $=0,z=T.length;$<z;$++)if(T[$]===w)return $;return-1}return Xr}function Cl(){if(yl)return Qr;yl=!0,Qr=i;var t=Xt().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,s=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=t.ERR_TRANSFORM_WITH_LENGTH_0,l=Jt();lt()(i,l);function r(d,p){var f=this._transformState;f.transforming=!1;var y=f.writecb;if(y===null)return this.emit("error",new n);f.writechunk=null,f.writecb=null,p!=null&&this.push(p),y(d);var b=this._readableState;b.reading=!1,(b.needReadable||b.length<b.highWaterMark)&&this._read(b.highWaterMark)}function i(d){if(!(this instanceof i))return new i(d);l.call(this,d),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",u)}function u(){var d=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(p,f){g(d,p,f)}):g(this,null,null)}i.prototype.push=function(d,p){return this._transformState.needTransform=!1,l.prototype.push.call(this,d,p)},i.prototype._transform=function(d,p,f){f(new e("_transform()"))},i.prototype._write=function(d,p,f){var y=this._transformState;if(y.writecb=f,y.writechunk=d,y.writeencoding=p,!y.transforming){var b=this._readableState;(y.needTransform||b.needReadable||b.length<b.highWaterMark)&&this._read(b.highWaterMark)}},i.prototype._read=function(d){var p=this._transformState;p.writechunk!==null&&!p.transforming?(p.transforming=!0,this._transform(p.writechunk,p.writeencoding,p.afterTransform)):p.needTransform=!0},i.prototype._destroy=function(d,p){l.prototype._destroy.call(this,d,function(f){p(f)})};function g(d,p,f){if(p)return d.emit("error",p);if(f!=null&&d.push(f),d._writableState.length)throw new c;if(d._transformState.transforming)throw new s;return d.push(null)}return Qr}function Kg(){if(hl)return ei;hl=!0,ei=e;var t=Cl();lt()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,s,c){c(null,n)},ei}function $g(){if(Tl)return ti;Tl=!0;var t;function e(f){var y=!1;return function(){y||(y=!0,f.apply(void 0,arguments))}}var n=Xt().codes,s=n.ERR_MISSING_ARGS,c=n.ERR_STREAM_DESTROYED;function l(f){if(f)throw f}function r(f){return f.setHeader&&typeof f.abort=="function"}function i(f,y,b,B){B=e(B);var x=!1;f.on("close",function(){x=!0}),t===void 0&&(t=si()),t(f,{readable:y,writable:b},function(k){if(k)return B(k);x=!0,B()});var v=!1;return function(k){if(!x&&!v){if(v=!0,r(f))return f.abort();if(typeof f.destroy=="function")return f.destroy();B(k||new c("pipe"))}}}function u(f){f()}function g(f,y){return f.pipe(y)}function d(f){return!f.length||typeof f[f.length-1]!="function"?l:f.pop()}function p(){for(var f=arguments.length,y=new Array(f),b=0;b<f;b++)y[b]=arguments[b];var B=d(y);if(Array.isArray(y[0])&&(y=y[0]),y.length<2)throw new s("streams");var x,v=y.map(function(k,P){var D=P<y.length-1,U=P>0;return i(k,D,U,function(Z){x||(x=Z),Z&&v.forEach(u),!D&&(v.forEach(u),B(x))})});return y.reduce(g)}return ti=p,ti}function Rl(){return vl||(vl=!0,Le=Le=Sl(),Le.Stream=Le,Le.Readable=Le,Le.Writable=Al(),Le.Duplex=Jt(),Le.Transform=Cl(),Le.PassThrough=Kg(),Le.finished=si(),Le.pipeline=$g()),Le}function Ol(){if(bl)return Gn;bl=!0;var t=at().Buffer,e=tt,n=_l(),s=lt(),c=Rl(),l=Gn.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},r=Gn.IncomingMessage=function(i,u,g,d){var p=this||qn;if(c.Readable.call(p),p._mode=g,p.headers={},p.rawHeaders=[],p.trailers={},p.rawTrailers=[],p.on("end",function(){e.nextTick(function(){p.emit("close")})}),g==="fetch"){let v=function(){y.read().then(function(k){if(!p._destroyed){if(d(k.done),k.done){p.push(null);return}p.push(t.from(k.value)),v()}}).catch(function(k){d(!0),p._destroyed||p.emit("error",k)})};if(p._fetchResponse=u,p.url=u.url,p.statusCode=u.status,p.statusMessage=u.statusText,u.headers.forEach(function(k,P){p.headers[P.toLowerCase()]=k,p.rawHeaders.push(P,k)}),n.writableStream){var f=new WritableStream({write:function(k){return d(!1),new Promise(function(P,D){p._destroyed?D():p.push(t.from(k))?P():p._resumeFetch=P})},close:function(){d(!0),p._destroyed||p.push(null)},abort:function(k){d(!0),p._destroyed||p.emit("error",k)}});try{u.body.pipeTo(f).catch(function(k){d(!0),p._destroyed||p.emit("error",k)});return}catch{}}var y=u.body.getReader();v()}else{p._xhr=i,p._pos=0,p.url=i.responseURL,p.statusCode=i.status,p.statusMessage=i.statusText;var b=i.getAllResponseHeaders().split(/\r?\n/);if(b.forEach(function(v){var k=v.match(/^([^:]+):\s*(.*)/);if(k){var P=k[1].toLowerCase();P==="set-cookie"?(p.headers[P]===void 0&&(p.headers[P]=[]),p.headers[P].push(k[2])):p.headers[P]!==void 0?p.headers[P]+=", "+k[2]:p.headers[P]=k[2],p.rawHeaders.push(k[1],k[2])}}),p._charset="x-user-defined",!n.overrideMimeType){var B=p.rawHeaders["mime-type"];if(B){var x=B.match(/;\s*charset=([^;])(;|$)/);x&&(p._charset=x[1].toLowerCase())}p._charset||(p._charset="utf-8")}}};return s(r,c.Readable),r.prototype._read=function(){var i=this||qn,u=i._resumeFetch;u&&(i._resumeFetch=null,u())},r.prototype._onXHRProgress=function(i){var u=this||qn,g=u._xhr,d=null;switch(u._mode){case"text":if(d=g.responseText,d.length>u._pos){var p=d.substr(u._pos);if(u._charset==="x-user-defined"){for(var f=t.alloc(p.length),y=0;y<p.length;y++)f[y]=p.charCodeAt(y)&255;u.push(f)}else u.push(p,u._charset);u._pos=d.length}break;case"arraybuffer":if(g.readyState!==l.DONE||!g.response)break;d=g.response,u.push(t.from(new Uint8Array(d)));break;case"moz-chunked-arraybuffer":if(d=g.response,g.readyState!==l.LOADING||!d)break;u.push(t.from(new Uint8Array(d)));break;case"ms-stream":if(d=g.response,g.readyState!==l.LOADING)break;var b=new qn.MSStreamReader;b.onprogress=function(){b.result.byteLength>u._pos&&(u.push(t.from(new Uint8Array(b.result.slice(u._pos)))),u._pos=b.result.byteLength)},b.onload=function(){i(!0),u.push(null)},b.readAsArrayBuffer(d);break}u._xhr.readyState===l.DONE&&u._mode!=="ms-stream"&&(i(!0),u.push(null))},Gn}function Lg(){if(wl)return ni;wl=!0;var t=at().Buffer,e=tt,n=_l(),s=lt(),c=Ol(),l=Rl(),r=c.IncomingMessage,i=c.readyStates;function u(f,y){return n.fetch&&y?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&f?"arraybuffer":"text"}var g=ni=function(f){var y=this||Oe;l.Writable.call(y),y._opts=f,y._body=[],y._headers={},f.auth&&y.setHeader("Authorization","Basic "+t.from(f.auth).toString("base64")),Object.keys(f.headers).forEach(function(x){y.setHeader(x,f.headers[x])});var b,B=!0;if(f.mode==="disable-fetch"||"requestTimeout"in f&&!n.abortController)B=!1,b=!0;else if(f.mode==="prefer-streaming")b=!1;else if(f.mode==="allow-wrong-content-type")b=!n.overrideMimeType;else if(!f.mode||f.mode==="default"||f.mode==="prefer-fast")b=!0;else throw new Error("Invalid value for opts.mode");y._mode=u(b,B),y._fetchTimer=null,y._socketTimeout=null,y._socketTimer=null,y.on("finish",function(){y._onFinish()})};s(g,l.Writable),g.prototype.setHeader=function(f,y){var b=this||Oe,B=f.toLowerCase();p.indexOf(B)===-1&&(b._headers[B]={name:f,value:y})},g.prototype.getHeader=function(f){var y=(this||Oe)._headers[f.toLowerCase()];return y?y.value:null},g.prototype.removeHeader=function(f){var y=this||Oe;delete y._headers[f.toLowerCase()]},g.prototype._onFinish=function(){var f=this||Oe;if(!f._destroyed){var y=f._opts;"timeout"in y&&y.timeout!==0&&f.setTimeout(y.timeout);var b=f._headers,B=null;y.method!=="GET"&&y.method!=="HEAD"&&(B=new Blob(f._body,{type:(b["content-type"]||{}).value||""}));var x=[];if(Object.keys(b).forEach(function(D){var U=b[D].name,Z=b[D].value;Array.isArray(Z)?Z.forEach(function(V){x.push([U,V])}):x.push([U,Z])}),f._mode==="fetch"){var v=null;if(n.abortController){var k=new AbortController;v=k.signal,f._fetchAbortController=k,"requestTimeout"in y&&y.requestTimeout!==0&&(f._fetchTimer=Oe.setTimeout(function(){f.emit("requestTimeout"),f._fetchAbortController&&f._fetchAbortController.abort()},y.requestTimeout))}Oe.fetch(f._opts.url,{method:f._opts.method,headers:x,body:B||void 0,mode:"cors",credentials:y.withCredentials?"include":"same-origin",signal:v}).then(function(D){f._fetchResponse=D,f._resetTimers(!1),f._connect()},function(D){f._resetTimers(!0),f._destroyed||f.emit("error",D)})}else{var P=f._xhr=new Oe.XMLHttpRequest;try{P.open(f._opts.method,f._opts.url,!0)}catch(D){e.nextTick(function(){f.emit("error",D)});return}"responseType"in P&&(P.responseType=f._mode),"withCredentials"in P&&(P.withCredentials=!!y.withCredentials),f._mode==="text"&&"overrideMimeType"in P&&P.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in y&&(P.timeout=y.requestTimeout,P.ontimeout=function(){f.emit("requestTimeout")}),x.forEach(function(D){P.setRequestHeader(D[0],D[1])}),f._response=null,P.onreadystatechange=function(){switch(P.readyState){case i.LOADING:case i.DONE:f._onXHRProgress();break}},f._mode==="moz-chunked-arraybuffer"&&(P.onprogress=function(){f._onXHRProgress()}),P.onerror=function(){f._destroyed||(f._resetTimers(!0),f.emit("error",new Error("XHR error")))};try{P.send(B)}catch(D){e.nextTick(function(){f.emit("error",D)});return}}}};function d(f){try{var y=f.status;return y!==null&&y!==0}catch{return!1}}g.prototype._onXHRProgress=function(){var f=this||Oe;f._resetTimers(!1),!(!d(f._xhr)||f._destroyed)&&(f._response||f._connect(),f._response._onXHRProgress(f._resetTimers.bind(f)))},g.prototype._connect=function(){var f=this||Oe;f._destroyed||(f._response=new r(f._xhr,f._fetchResponse,f._mode,f._resetTimers.bind(f)),f._response.on("error",function(y){f.emit("error",y)}),f.emit("response",f._response))},g.prototype._write=function(f,y,b){var B=this||Oe;B._body.push(f),b()},g.prototype._resetTimers=function(f){var y=this||Oe;Oe.clearTimeout(y._socketTimer),y._socketTimer=null,f?(Oe.clearTimeout(y._fetchTimer),y._fetchTimer=null):y._socketTimeout&&(y._socketTimer=Oe.setTimeout(function(){y.emit("timeout")},y._socketTimeout))},g.prototype.abort=g.prototype.destroy=function(f){var y=this||Oe;y._destroyed=!0,y._resetTimers(!0),y._response&&(y._response._destroyed=!0),y._xhr?y._xhr.abort():y._fetchAbortController&&y._fetchAbortController.abort(),f&&y.emit("error",f)},g.prototype.end=function(f,y,b){var B=this||Oe;typeof f=="function"&&(b=f,f=void 0),l.Writable.prototype.end.call(B,f,y,b)},g.prototype.setTimeout=function(f,y){var b=this||Oe;y&&b.once("timeout",y),b._socketTimeout=f,b._resetTimers(!1)},g.prototype.flushHeaders=function(){},g.prototype.setNoDelay=function(){},g.prototype.setSocketKeepAlive=function(){};var p=["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 ni}function Fg(){if(Bl)return ri;Bl=!0,ri=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},s=0;s<arguments.length;s++){var c=arguments[s];for(var l in c)t.call(c,l)&&(n[l]=c[l])}return n}return ri}function Gg(){return xl||(xl=!0,ii={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"}),ii}function zg(){if(Pl)return oi;Pl=!0;var t=Lg(),e=Ol(),n=Fg(),s=Gg(),c=he,l=oi;return l.request=function(r,i){typeof r=="string"?r=c.parse(r):r=n(r);var u=qg.location.protocol.search(/^https?:$/)===-1?"http:":"",g=r.protocol||u,d=r.hostname||r.host,p=r.port,f=r.path||"/";d&&d.indexOf(":")!==-1&&(d="["+d+"]"),r.url=(d?g+"//"+d:"")+(p?":"+p:"")+f,r.method=(r.method||"GET").toUpperCase(),r.headers=r.headers||{};var y=new t(r);return i&&y.on("response",i),y},l.get=function(i,u){var g=l.request(i,u);return g.end(),g},l.ClientRequest=t,l.IncomingMessage=e.IncomingMessage,l.Agent=function(){},l.Agent.defaultMaxSockets=4,l.globalAgent=new l.Agent,l.STATUS_CODES=s,l.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"],oi}var ze,nl,jt,$r,rl,Lr,il,Fr,ol,Gr,sl,qr,al,zr,ll,cl,Vr,ul,Zr,fl,Yr,gl,Jr,pl,Xr,dl,ml,Qr,yl,ei,hl,ti,Tl,Le,vl,Gn,bl,qn,ni,wl,Oe,ri,Bl,ii,xl,oi,Pl,qg,wt,Vg,Zg,Yg,Jg,Xg,Qg,ep,tp,Ml=He(()=>{_();E();I();fr();Ys();gr();_n();Ra();Ln();kr();Na();Wa();tl();Or();ze={},nl=!1,jt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;$r={},rl=!1;Lr={},il=!1;Fr={},ol=!1;Gr={},sl=!1;qr={},al=!1;zr={},ll=!1,cl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Vr={},ul=!1;Zr={},fl=!1;Yr={},gl=!1;Jr={},pl=!1;Xr={},dl=!1,ml=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Qr={},yl=!1;ei={},hl=!1;ti={},Tl=!1;Le={},vl=!1;Gn={},bl=!1,qn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ni={},wl=!1,Oe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ri={},Bl=!1;ii={},xl=!1;oi={},Pl=!1,qg=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;wt=zg(),Vg=wt.Agent,Zg=wt.ClientRequest,Yg=wt.IncomingMessage,Jg=wt.METHODS,Xg=wt.STATUS_CODES,Qg=wt.get,ep=wt.globalAgent,tp=wt.request});_();E();I();var Ns={};Pt(Ns,{defaults:()=>eu,markdown:()=>Xc,markdownBloc:()=>Qc});_();E();I();_();E();I();import"@holocronlab/botruntime-zui";import{z as ee}from"@holocronlab/botruntime-zui";var Re=ee.string().min(1),ks=ee.object({text:Re}),As=ee.object({markdown:Re}),Ss=ee.object({imageUrl:Re,title:Re.optional()}),Cs=ee.object({audioUrl:Re,title:Re.optional()}),Rs=ee.object({videoUrl:Re,title:Re.optional()}),Os=ee.object({fileUrl:Re,title:Re.optional()}),Hs=ee.object({latitude:ee.number(),longitude:ee.number(),address:ee.string().optional(),title:ee.string().optional()}),Ms=ee.object({title:Re,subtitle:Re.optional(),imageUrl:Re.optional(),actions:ee.array(ee.object({action:ee.enum(["postback","url","say"]),label:Re,value:Re}))}),Es=ee.object({text:Re,options:ee.array(ee.object({label:Re,value:Re}))}),Yc=ee.object({items:ee.array(Ms)}),Ds=ee.union([ee.object({type:ee.literal("text"),payload:ks}),ee.object({type:ee.literal("image"),payload:Ss}),ee.object({type:ee.literal("audio"),payload:Cs}),ee.object({type:ee.literal("video"),payload:Rs}),ee.object({type:ee.literal("file"),payload:Os}),ee.object({type:ee.literal("location"),payload:Hs})]),Jc=ee.object({items:ee.array(Ds)}),Xc={schema:As},Qc={schema:ee.object({items:ee.array(ee.union([...Ds.options,ee.object({type:ee.literal("markdown"),payload:As})]))})},eu={text:{schema:ks},image:{schema:Ss},audio:{schema:Cs},video:{schema:Rs},file:{schema:Os},location:{schema:Hs},carousel:{schema:Yc},card:{schema:Ms},dropdown:{schema:Es},choice:{schema:Es},bloc:{schema:Jc}};_();E();I();var Jd={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}},Xd="x-bp-integration-identifier";_();E();I();import{InvalidPayloadError as Dl,isApiError as Nl,RuntimeError as Ul}from"@holocronlab/botruntime-client";import{isNode as np}from"browser-or-node";_();E();I();var ur=console;function nt(t){if(!t.body)throw new Dl("Missing body");try{return JSON.parse(t.body)}catch(e){throw new Dl(e instanceof Error?e.message:String(e))}}var zn=({thrown:t,unexpectedErrorMessage:e})=>{let n=t instanceof Error?t:new Error(String(t));if(Nl(n)&&(n.type==="Runtime"||n.type==="InvalidPayload"))return{status:n.code,body:JSON.stringify(n.toJSON()),error:n};let s=Nl(n)?new Ul(n.message,n):new Ul(e,n);return{status:500,body:JSON.stringify(s.toJSON()),error:s}};async function Vn(t,e=8072,n=sp){if(!np)throw new Error("This function can only be called in Node.js");let c=(Ml(),qc(Hl)).createServer(async(l,r)=>{try{let i=await rp(l);if(i.path==="/health"){r.writeHead(200).end("ok");return}let u=await t(i);r.writeHead(u?.status??200,u?.headers??{}).end(u?.body??"{}")}catch(i){let u=i instanceof Error?i.message:String(i);ur.error("Error while handling request",{error:u??"Internal error occured"}),r.writeHead(500).end(JSON.stringify({error:u??"Internal error occured"}))}});return c.listen(e,()=>n(e)),c}async function rp(t){let e=await op(t),n={};for(let c=0;c<t.rawHeaders.length;c+=2){let l=t.rawHeaders[c].toLowerCase(),r=t.rawHeaders[c+1];n[l]=r}let s=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://localhost");return{body:e,path:s.pathname,query:ip(s.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function ip(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function op(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let s="";t.on("data",c=>s+=c.toString()),t.on("error",c=>n(c)),t.on("end",()=>e(s))})}function sp(t){ur.info(`Listening on port ${t}`)}import{isApiError as D_,RuntimeError as N_}from"@holocronlab/botruntime-client";_();E();I();_();E();I();var jl={};Pt(jl,{DefinitionError:()=>Fe,isDefinitionError:()=>ap});_();E();I();var Fe=class extends Error{__IS_SDK_ERROR__=!0;type="definition_error"},ap=t=>t instanceof Fe||typeof t=="object"&&t!==null&&"__IS_SDK_ERROR__"in t&&t.__IS_SDK_ERROR__===!0&&"type"in t&&t.type==="definition_error";_();E();I();_();E();I();var xe={};Pt(xe,{mapKeys:()=>up,mapValues:()=>cp,mergeRecords:()=>gp,pairs:()=>Zn,stripUndefinedProps:()=>fp,values:()=>lp});_();E();I();var Zn=t=>Object.entries(t),lp=t=>Object.values(t),cp=(t,e)=>Object.fromEntries(Zn(t).map(([n,s])=>[n,e(s,n)])),up=(t,e)=>Object.fromEntries(Zn(t).map(([n,s])=>[e(n),s])),fp=t=>Object.fromEntries(Zn(t).filter(([,e])=>e!==void 0)),gp=(t,e,n)=>{let s=[...Object.keys(t),...Object.keys(e)],c=[...new Set(s)],l={};for(let r of c){let i=t[r],u=e[r];i&&u?l[r]=n(i,u):i?l[r]=i:u&&(l[r]=u)}return l};var re={};Pt(re,{safePush:()=>pp,unique:()=>dp});_();E();I();var pp=(t,...e)=>t?[...t,...e]:[...e],dp=t=>Array.from(new Set(t));_();E();I();var Ne={};Pt(Ne,{setName:()=>mp});_();E();I();var mp=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Wl=t=>{let{name:e,version:n}=t,s={actions:{},events:{},channels:{}},c={name:e,version:n,entities:xe.mapValues(t.entities,r=>({name:r.name})),actions:{},events:{},channels:{}},l=xe.mapValues(t.entities,r=>r.schema);for(let[r,i]of Object.entries(t.definition.actions??{})){let u=i.input.schema.dereference(l),g=i.output.schema.dereference(l),d=t.actions?.[r]?.name??r;s.actions[d]={...i,...t.actions?.[r]??{},input:{schema:u},output:{schema:g}},c.actions[r]={name:d}}for(let[r,i]of Object.entries(t.definition.events??{})){let u=i.schema.dereference(l),g=t.events?.[r]?.name??r;s.events[g]={...i,...t.events?.[r]??{},schema:u},c.events[r]={name:g}}for(let[r,i]of Object.entries(t.definition.channels??{})){let u={};for(let[d,p]of Object.entries(i.messages)){let f=p.schema.dereference(l);u[d]={...p,schema:f}}let g=t.channels?.[r]?.name??r;s.channels[g]={...i,...t.channels?.[r]??{},message:{...i.message??{},tags:{...i.message?.tags??{},...t.channels?.[r]?.message?.tags??{}}},conversation:{...i.conversation??{},tags:{...i.conversation?.tags??{},...t.channels?.[r]?.conversation?.tags??{}}},messages:u},c.channels[r]={name:g}}return{resolved:s,statement:c}};_();E();I();var Kl="6.13.3";var At=Kl;_();E();I();var Yn=Symbol("schemaName"),$l=t=>t?xe.mapValues(t,(n,s)=>({...n,[Yn]:s})):{},Ll=t=>Yn in t&&t[Yn]!==void 0,Fl=t=>t[Yn];_();E();I();var ai=class t{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,this.network=e.network}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;attributes;network;get metadata(){return{sdkVersion:At}}clone=e=>new t({...this.props,actions:this.actions,events:this.events,channels:this.channels,interfaces:this.interfaces,...e});extend(e,n){let{entities:s,actions:c,events:l,channels:r}=this._callBuilder(e,n),i=this;i.interfaces??={};let u=Object.values(s).map(f=>f.name),g=u.length===0?e.name:`${e.name}<${u.join(",")}>`,{resolved:d,statement:p}=Wl({...e,entities:s,actions:xe.stripUndefinedProps(c),events:xe.stripUndefinedProps(l),channels:xe.stripUndefinedProps(r)});return i.actions=xe.mergeRecords(i.actions??{},d.actions,this._mergeActions),i.channels=xe.mergeRecords(i.channels??{},d.channels,this._mergeChannels),i.events=xe.mergeRecords(i.events??{},d.events,this._mergeEvents),i.interfaces[g]={id:e.id,...p},this}_callBuilder(e,n){let c={entities:$l(this.entities)},l=n(c),r=xe.pairs(l.entities).find(([u,g])=>!Ll(g));if(r)throw new Fe(`Cannot extend interface "${e.name}" with entity "${r[0]}"; the provided schema is not part of the integration's entities.`);return{entities:xe.mapValues(l.entities,u=>({name:Fl(u),schema:u.schema})),actions:l.actions??{},events:l.events??{},channels:l.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:this._mergeObjectSchemas(e.input.schema,n.input.schema)},output:{schema:this._mergeObjectSchemas(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeChannels=(e,n)=>{let s=xe.mergeRecords(e.messages,n.messages,this._mergeMessage),c;(e.conversation||n.conversation)&&(c={tags:{...e.conversation?.tags,...n.conversation?.tags}});let l;return(e.message||n.message)&&(l={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:s,conversation:c,message:l}};_mergeMessage=(e,n)=>({schema:this._mergeObjectSchemas(e.schema,n.schema)});_mergeObjectSchemas=(e,n)=>{let s=e._def,c=n._def;if(s.typeName==="ZodObject"&&c.typeName==="ZodObject"){let l=s.shape(),r=c.shape();return ee.object({...l,...r})}if(s.typeName==="ZodRecord"&&c.typeName==="ZodRecord")return ee.record(ee.intersection(s.valueType,c.valueType));throw new Error("Cannot merge object schemas with record schemas")}};_();E();I();_();E();I();import{Client as zp,InvalidPayloadError as hn}from"@holocronlab/botruntime-client";_();E();I();import*as Gl from"@holocronlab/botruntime-client";var Jn={retries:3,retryCondition:t=>Gl.axiosRetry.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:(t,e)=>(hp(e.response?.headers??{})??t)*1e3},hp=t=>{let e=["RateLimit-Reset","X-RateLimit-Reset","Retry-After","ratelimit-reset","x-ratelimit-reset","retry-after"];for(let n of e){let s=t[n];if(s!==void 0)return Tp(String(s))}},Tp=t=>{let e=vp(t)?bp(t):t.length>0?parseInt(t,10):void 0;return e===void 0||isNaN(e)?void 0:e},vp=t=>t.includes(" "),bp=t=>{let e=wp(t);if(!e)return;let n=new Date;return Math.max(0,Math.floor((e.getTime()-n.getTime())/1e3))},wp=t=>{let e=new Date(t);return isNaN(e.getTime())?void 0:e};_();E();I();_();E();I();var gn=class{constructor(e){this._client=e}get _inner(){return this._client}createConversation=(e=>this._client.createConversation(e));getConversation=(e=>this._client.getConversation(e));listConversations=(e=>this._client.listConversations(e));getOrCreateConversation=(e=>this._client.getOrCreateConversation(e));updateConversation=(e=>this._client.updateConversation(e));deleteConversation=(e=>this._client.deleteConversation(e));listParticipants=(e=>this._client.listParticipants(e));addParticipant=(e=>this._client.addParticipant(e));getParticipant=(e=>this._client.getParticipant(e));removeParticipant=(e=>this._client.removeParticipant(e));createEvent=(e=>this._client.createEvent(e));getEvent=(e=>this._client.getEvent(e));listEvents=(e=>this._client.listEvents(e));createMessage=(e=>this._client.createMessage(e));getOrCreateMessage=(e=>this._client.getOrCreateMessage(e));getMessage=(e=>this._client.getMessage(e).then(n=>n));updateMessage=(e=>this._client.updateMessage(e).then(n=>n));listMessages=(e=>this._client.listMessages(e));deleteMessage=(e=>this._client.deleteMessage(e));initializeIncomingMessage=(e=>this._client.initializeIncomingMessage(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)};_();E();I();var Xn=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};_();E();I();import{z as Bp}from"@holocronlab/botruntime-zui";_();E();I();var rt="#",Qn="x-bot-id",ql="x-bot-user-id",zl="x-integration-id",Vl="x-integration-alias",Zl="x-webhook-id",Yl="x-bp-configuration-type",er="x-bp-configuration",tr="x-bp-operation",Jl="x-bp-type";_();E();I();var Je=t=>{throw t instanceof Error?t:new Error(t)};var $h=Bp.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Xl=t=>({botId:t[Qn]||Je("Missing bot header"),botUserId:t[ql]||Je("Missing bot user header"),integrationId:t[zl]||Je("Missing integration header"),integrationAlias:t[Vl]||Je("Missing integration alias header"),webhookId:t[Zl]||Je("Missing webhook header"),operation:t[tr]||Je("Missing operation header"),configurationType:t[Yl]??null,configuration:JSON.parse(L.from(t[er]||Je("Missing configuration header"),"base64").toString("utf-8"))});_();E();I();_();E();I();_();E();I();_();E();I();var ci={},Ql=!1;function Ai(){return Ql||(Ql=!0,ci=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),s=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var c=42;e[n]=c;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 l=Object.getOwnPropertySymbols(e);if(l.length!==1||l[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var r=Object.getOwnPropertyDescriptor(e,n);if(r.value!==c||r.enumerable!==!0)return!1}return!0}),ci}var ui={},ec=!1;function xp(){return ec||(ec=!0,ui=Error),ui}var fi={},tc=!1;function Pp(){return tc||(tc=!0,fi=EvalError),fi}var gi={},nc=!1;function _p(){return nc||(nc=!0,gi=RangeError),gi}var pi={},rc=!1;function Ip(){return rc||(rc=!0,pi=ReferenceError),pi}var di={},ic=!1;function bc(){return ic||(ic=!0,di=SyntaxError),di}var mi={},oc=!1;function nr(){return oc||(oc=!0,mi=TypeError),mi}var yi={},sc=!1;function Ep(){return sc||(sc=!0,yi=URIError),yi}var hi={},ac=!1;function kp(){if(ac)return hi;ac=!0;var t=typeof Symbol<"u"&&Symbol,e=Ai();return hi=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},hi}var Ti={},lc=!1;function Ap(){if(lc)return Ti;lc=!0;var t={__proto__:null,foo:{}},e=Object;return Ti=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},Ti}var vi={},cc=!1;function Sp(){if(cc)return vi;cc=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,s="[object Function]",c=function(u,g){for(var d=[],p=0;p<u.length;p+=1)d[p]=u[p];for(var f=0;f<g.length;f+=1)d[f+u.length]=g[f];return d},l=function(u,g){for(var d=[],p=g,f=0;p<u.length;p+=1,f+=1)d[f]=u[p];return d},r=function(i,u){for(var g="",d=0;d<i.length;d+=1)g+=i[d],d+1<i.length&&(g+=u);return g};return vi=function(u){var g=this;if(typeof g!="function"||e.apply(g)!==s)throw new TypeError(t+g);for(var d=l(arguments,1),p,f=function(){if(this instanceof p){var v=g.apply(this,c(d,arguments));return Object(v)===v?v:this}return g.apply(u,c(d,arguments))},y=n(0,g.length-d.length),b=[],B=0;B<y;B++)b[B]="$"+B;if(p=Function("binder","return function ("+r(b,",")+"){ return binder.apply(this,arguments); }")(f),g.prototype){var x=function(){};x.prototype=g.prototype,p.prototype=new x,x.prototype=null}return p},vi}var bi={},uc=!1;function Si(){if(uc)return bi;uc=!0;var t=Sp();return bi=Function.prototype.bind||t,bi}var wi={},fc=!1;function Cp(){if(fc)return wi;fc=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=Si();return wi=n.call(t,e),wi}var Bi={},gc=!1;function dn(){if(gc)return Bi;gc=!0;var t,e=xp(),n=Pp(),s=_p(),c=Ip(),l=bc(),r=nr(),i=Ep(),u=Function,g=function(ve){try{return u('"use strict"; return ('+ve+").constructor;")()}catch{}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch{d=null}var p=function(){throw new r},f=d?(function(){try{return arguments.callee,p}catch{try{return d(arguments,"callee").get}catch{return p}}})():p,y=kp()(),b=Ap()(),B=Object.getPrototypeOf||(b?function(ve){return ve.__proto__}:null),x={},v=typeof Uint8Array>"u"||!B?t:B(Uint8Array),k={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":y&&B?B([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":x,"%AsyncGenerator%":x,"%AsyncGeneratorFunction%":x,"%AsyncIteratorPrototype%":x,"%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%":u,"%GeneratorFunction%":x,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":y&&B?B(B([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!y||!B?t:B(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%":s,"%ReferenceError%":c,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!y||!B?t:B(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":y&&B?B(""[Symbol.iterator]()):t,"%Symbol%":y?Symbol:t,"%SyntaxError%":l,"%ThrowTypeError%":f,"%TypedArray%":v,"%TypeError%":r,"%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%":i,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(B)try{null.error}catch(ve){var P=B(B(ve));k["%Error.prototype%"]=P}var D=function ve(ue){var pe;if(ue==="%AsyncFunction%")pe=g("async function () {}");else if(ue==="%GeneratorFunction%")pe=g("function* () {}");else if(ue==="%AsyncGeneratorFunction%")pe=g("async function* () {}");else if(ue==="%AsyncGenerator%"){var te=ve("%AsyncGeneratorFunction%");te&&(pe=te.prototype)}else if(ue==="%AsyncIteratorPrototype%"){var oe=ve("%AsyncGenerator%");oe&&B&&(pe=B(oe.prototype))}return k[ue]=pe,pe},U={__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"]},Z=Si(),V=Cp(),ie=Z.call(Function.call,Array.prototype.concat),X=Z.call(Function.apply,Array.prototype.splice),Y=Z.call(Function.call,String.prototype.replace),de=Z.call(Function.call,String.prototype.slice),_e=Z.call(Function.call,RegExp.prototype.exec),Ce=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ke=/\\(\\)?/g,Ae=function(ue){var pe=de(ue,0,1),te=de(ue,-1);if(pe==="%"&&te!=="%")throw new l("invalid intrinsic syntax, expected closing `%`");if(te==="%"&&pe!=="%")throw new l("invalid intrinsic syntax, expected opening `%`");var oe=[];return Y(ue,Ce,function(R,N,W,ne){oe[oe.length]=W?Y(ne,ke,"$1"):N||R}),oe},We=function(ue,pe){var te=ue,oe;if(V(U,te)&&(oe=U[te],te="%"+oe[0]+"%"),V(k,te)){var R=k[te];if(R===x&&(R=D(te)),typeof R>"u"&&!pe)throw new r("intrinsic "+ue+" exists, but is not available. Please file an issue!");return{alias:oe,name:te,value:R}}throw new l("intrinsic "+ue+" does not exist!")};return Bi=function(ue,pe){if(typeof ue!="string"||ue.length===0)throw new r("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof pe!="boolean")throw new r('"allowMissing" argument must be a boolean');if(_e(/^%?[^%]*%?$/,ue)===null)throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var te=Ae(ue),oe=te.length>0?te[0]:"",R=We("%"+oe+"%",pe),N=R.name,W=R.value,ne=!1,se=R.alias;se&&(oe=se[0],X(te,ie([0,1],se)));for(var C=1,A=!0;C<te.length;C+=1){var M=te[C],q=de(M,0,1),J=de(M,-1);if((q==='"'||q==="'"||q==="`"||J==='"'||J==="'"||J==="`")&&q!==J)throw new l("property names with quotes must have matching quotes");if((M==="constructor"||!A)&&(ne=!0),oe+="."+M,N="%"+oe+"%",V(k,N))W=k[N];else if(W!=null){if(!(M in W)){if(!pe)throw new r("base intrinsic for "+ue+" exists, but the property is not available.");return}if(d&&C+1>=te.length){var T=d(W,M);A=!!T,A&&"get"in T&&!("originalValue"in T.get)?W=T.get:W=W[M]}else A=V(W,M),W=W[M];A&&!ne&&(k[N]=W)}}return W},Bi}var xi={},pc=!1;function Ci(){if(pc)return xi;pc=!0;var t=dn(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return xi=e,xi}var Pi={},dc=!1;function rr(){if(dc)return Pi;dc=!0;var t=dn(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return Pi=e,Pi}var _i={},mc=!1;function Rp(){if(mc)return _i;mc=!0;var t=Ci(),e=bc(),n=nr(),s=rr();return _i=function(l,r,i){if(!l||typeof l!="object"&&typeof l!="function")throw new n("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="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 u=arguments.length>3?arguments[3]:null,g=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,f=!!s&&s(l,r);if(t)t(l,r,{configurable:d===null&&f?f.configurable:!d,enumerable:u===null&&f?f.enumerable:!u,value:i,writable:g===null&&f?f.writable:!g});else if(p||!u&&!g&&!d)l[r]=i;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_i}var Ii={},yc=!1;function Op(){if(yc)return Ii;yc=!0;var t=Ci(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},Ii=e,Ii}var Ei={},hc=!1;function Hp(){if(hc)return Ei;hc=!0;var t=dn(),e=Rp(),n=Op()(),s=rr(),c=nr(),l=t("%Math.floor%");return Ei=function(i,u){if(typeof i!="function")throw new c("`fn` is not a function");if(typeof u!="number"||u<0||u>4294967295||l(u)!==u)throw new c("`length` must be a positive 32-bit integer");var g=arguments.length>2&&!!arguments[2],d=!0,p=!0;if("length"in i&&s){var f=s(i,"length");f&&!f.configurable&&(d=!1),f&&!f.writable&&(p=!1)}return(d||p||!g)&&(n?e(i,"length",u,!0,!0):e(i,"length",u)),i},Ei}var pn={},Tc=!1;function Ri(){if(Tc)return pn;Tc=!0;var t=Si(),e=dn(),n=Hp(),s=nr(),c=e("%Function.prototype.apply%"),l=e("%Function.prototype.call%"),r=e("%Reflect.apply%",!0)||t.call(l,c),i=Ci(),u=e("%Math.max%");pn=function(p){if(typeof p!="function")throw new s("a function is required");var f=r(t,l,arguments);return n(f,1+u(0,p.length-(arguments.length-1)),!0)};var g=function(){return r(t,c,arguments)};return i?i(pn,"apply",{value:g}):pn.apply=g,pn}var ki={},vc=!1;function Oi(){if(vc)return ki;vc=!0;var t=dn(),e=Ri(),n=e(t("String.prototype.indexOf"));return ki=function(c,l){var r=t(c,!!l);return typeof r=="function"&&n(c,".prototype.")>-1?e(r):r},ki}fr();kr();var Hi={},wc=!1;function Fi(){if(wc)return Hi;wc=!0;var t=Ai();return Hi=function(){return t()&&!!Symbol.toStringTag},Hi}var Mi={},Bc=!1;function Mp(){if(Bc)return Mi;Bc=!0;var t=Fi()(),e=Oi(),n=e("Object.prototype.toString"),s=function(i){return t&&i&&typeof i=="object"&&Symbol.toStringTag in i?!1:n(i)==="[object Arguments]"},c=function(i){return s(i)?!0:i!==null&&typeof i=="object"&&typeof i.length=="number"&&i.length>=0&&n(i)!=="[object Array]"&&n(i.callee)==="[object Function]"},l=(function(){return s(arguments)})();return s.isLegacyArguments=c,Mi=l?s:c,Mi}var Di={},xc=!1;function Dp(){if(xc)return Di;xc=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,s=Fi()(),c=Object.getPrototypeOf,l=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch{}},r;return Di=function(u){if(typeof u!="function")return!1;if(n.test(e.call(u)))return!0;if(!s){var g=t.call(u);return g==="[object GeneratorFunction]"}if(!c)return!1;if(typeof r>"u"){var d=l();r=d?c(d):!1}return c(u)===r},Di}var Ni={},Pc=!1;function Np(){if(Pc)return Ni;Pc=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,s;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw s}}),s={},e(function(){throw 42},null,n)}catch(k){k!==s&&(e=null)}else e=null;var c=/^\s*class\b/,l=function(P){try{var D=t.call(P);return c.test(D)}catch{return!1}},r=function(P){try{return l(P)?!1:(t.call(P),!0)}catch{return!1}},i=Object.prototype.toString,u="[object Object]",g="[object Function]",d="[object GeneratorFunction]",p="[object HTMLAllCollection]",f="[object HTML document.all class]",y="[object HTMLCollection]",b=typeof Symbol=="function"&&!!Symbol.toStringTag,B=!(0 in[,]),x=function(){return!1};if(typeof document=="object"){var v=document.all;i.call(v)===i.call(document.all)&&(x=function(P){if((B||!P)&&(typeof P>"u"||typeof P=="object"))try{var D=i.call(P);return(D===p||D===f||D===y||D===u)&&P("")==null}catch{}return!1})}return Ni=e?function(P){if(x(P))return!0;if(!P||typeof P!="function"&&typeof P!="object")return!1;try{e(P,null,n)}catch(D){if(D!==s)return!1}return!l(P)&&r(P)}:function(P){if(x(P))return!0;if(!P||typeof P!="function"&&typeof P!="object")return!1;if(b)return r(P);if(l(P))return!1;var D=i.call(P);return D!==g&&D!==d&&!/^\[object HTML/.test(D)?!1:r(P)},Ni}var Ui={},_c=!1;function Up(){if(_c)return Ui;_c=!0;var t=Np(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,s=function(u,g,d){for(var p=0,f=u.length;p<f;p++)n.call(u,p)&&(d==null?g(u[p],p,u):g.call(d,u[p],p,u))},c=function(u,g,d){for(var p=0,f=u.length;p<f;p++)d==null?g(u.charAt(p),p,u):g.call(d,u.charAt(p),p,u)},l=function(u,g,d){for(var p in u)n.call(u,p)&&(d==null?g(u[p],p,u):g.call(d,u[p],p,u))},r=function(u,g,d){if(!t(g))throw new TypeError("iterator must be a function");var p;arguments.length>=3&&(p=d),e.call(u)==="[object Array]"?s(u,g,p):typeof u=="string"?c(u,g,p):l(u,g,p)};return Ui=r,Ui}var ji={},Ic=!1;function jp(){return Ic||(Ic=!0,ji=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),ji}var Wi={},Ec=!1,Wp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Kp(){if(Ec)return Wi;Ec=!0;var t=jp(),e=typeof globalThis>"u"?Wp:globalThis;return Wi=function(){for(var s=[],c=0;c<t.length;c++)typeof e[t[c]]=="function"&&(s[s.length]=t[c]);return s},Wi}var Ki={},kc=!1,$p=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Oc(){if(kc)return Ki;kc=!0;var t=Up(),e=Kp(),n=Ri(),s=Oi(),c=rr(),l=s("Object.prototype.toString"),r=Fi()(),i=typeof globalThis>"u"?$p:globalThis,u=e(),g=s("String.prototype.slice"),d=Object.getPrototypeOf,p=s("Array.prototype.indexOf",!0)||function(x,v){for(var k=0;k<x.length;k+=1)if(x[k]===v)return k;return-1},f={__proto__:null};r&&c&&d?t(u,function(B){var x=new i[B];if(Symbol.toStringTag in x){var v=d(x),k=c(v,Symbol.toStringTag);if(!k){var P=d(v);k=c(P,Symbol.toStringTag)}f["$"+B]=n(k.get)}}):t(u,function(B){var x=new i[B],v=x.slice||x.set;v&&(f["$"+B]=n(v))});var y=function(x){var v=!1;return t(f,function(k,P){if(!v)try{"$"+k(x)===P&&(v=g(P,1))}catch{}}),v},b=function(x){var v=!1;return t(f,function(k,P){if(!v)try{k(x),v=g(P,1)}catch{}}),v};return Ki=function(x){if(!x||typeof x!="object")return!1;if(!r){var v=g(l(x),8,-1);return p(u,v)>-1?v:v!=="Object"?!1:b(x)}return c?y(x):null},Ki}var $i={},Ac=!1;function Lp(){if(Ac)return $i;Ac=!0;var t=Oc();return $i=function(n){return!!t(n)},$i}var le={},Sc=!1;function Fp(){if(Sc)return le;Sc=!0;var t=Mp(),e=Dp(),n=Oc(),s=Lp();function c(H){return H.call.bind(H)}var l=typeof BigInt<"u",r=typeof Symbol<"u",i=c(Object.prototype.toString),u=c(Number.prototype.valueOf),g=c(String.prototype.valueOf),d=c(Boolean.prototype.valueOf);if(l)var p=c(BigInt.prototype.valueOf);if(r)var f=c(Symbol.prototype.valueOf);function y(H,et){if(typeof H!="object")return!1;try{return et(H),!0}catch{return!1}}le.isArgumentsObject=t,le.isGeneratorFunction=e,le.isTypedArray=s;function b(H){return typeof Promise<"u"&&H instanceof Promise||H!==null&&typeof H=="object"&&typeof H.then=="function"&&typeof H.catch=="function"}le.isPromise=b;function B(H){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(H):s(H)||R(H)}le.isArrayBufferView=B;function x(H){return n(H)==="Uint8Array"}le.isUint8Array=x;function v(H){return n(H)==="Uint8ClampedArray"}le.isUint8ClampedArray=v;function k(H){return n(H)==="Uint16Array"}le.isUint16Array=k;function P(H){return n(H)==="Uint32Array"}le.isUint32Array=P;function D(H){return n(H)==="Int8Array"}le.isInt8Array=D;function U(H){return n(H)==="Int16Array"}le.isInt16Array=U;function Z(H){return n(H)==="Int32Array"}le.isInt32Array=Z;function V(H){return n(H)==="Float32Array"}le.isFloat32Array=V;function ie(H){return n(H)==="Float64Array"}le.isFloat64Array=ie;function X(H){return n(H)==="BigInt64Array"}le.isBigInt64Array=X;function Y(H){return n(H)==="BigUint64Array"}le.isBigUint64Array=Y;function de(H){return i(H)==="[object Map]"}de.working=typeof Map<"u"&&de(new Map);function _e(H){return typeof Map>"u"?!1:de.working?de(H):H instanceof Map}le.isMap=_e;function Ce(H){return i(H)==="[object Set]"}Ce.working=typeof Set<"u"&&Ce(new Set);function ke(H){return typeof Set>"u"?!1:Ce.working?Ce(H):H instanceof Set}le.isSet=ke;function Ae(H){return i(H)==="[object WeakMap]"}Ae.working=typeof WeakMap<"u"&&Ae(new WeakMap);function We(H){return typeof WeakMap>"u"?!1:Ae.working?Ae(H):H instanceof WeakMap}le.isWeakMap=We;function ve(H){return i(H)==="[object WeakSet]"}ve.working=typeof WeakSet<"u"&&ve(new WeakSet);function ue(H){return ve(H)}le.isWeakSet=ue;function pe(H){return i(H)==="[object ArrayBuffer]"}pe.working=typeof ArrayBuffer<"u"&&pe(new ArrayBuffer);function te(H){return typeof ArrayBuffer>"u"?!1:pe.working?pe(H):H instanceof ArrayBuffer}le.isArrayBuffer=te;function oe(H){return i(H)==="[object DataView]"}oe.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&oe(new DataView(new ArrayBuffer(1),0,1));function R(H){return typeof DataView>"u"?!1:oe.working?oe(H):H instanceof DataView}le.isDataView=R;var N=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function W(H){return i(H)==="[object SharedArrayBuffer]"}function ne(H){return typeof N>"u"?!1:(typeof W.working>"u"&&(W.working=W(new N)),W.working?W(H):H instanceof N)}le.isSharedArrayBuffer=ne;function se(H){return i(H)==="[object AsyncFunction]"}le.isAsyncFunction=se;function C(H){return i(H)==="[object Map Iterator]"}le.isMapIterator=C;function A(H){return i(H)==="[object Set Iterator]"}le.isSetIterator=A;function M(H){return i(H)==="[object Generator]"}le.isGeneratorObject=M;function q(H){return i(H)==="[object WebAssembly.Module]"}le.isWebAssemblyCompiledModule=q;function J(H){return y(H,u)}le.isNumberObject=J;function T(H){return y(H,g)}le.isStringObject=T;function w(H){return y(H,d)}le.isBooleanObject=w;function $(H){return l&&y(H,p)}le.isBigIntObject=$;function z(H){return r&&y(H,f)}le.isSymbolObject=z;function me(H){return J(H)||T(H)||w(H)||$(H)||z(H)}le.isBoxedPrimitive=me;function ae(H){return typeof Uint8Array<"u"&&(te(H)||ne(H))}return le.isAnyArrayBuffer=ae,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(H){Object.defineProperty(le,H,{enumerable:!1,value:function(){throw new Error(H+" is not supported in userland")}})}),le}var Li={},Cc=!1;function Gp(){return Cc||(Cc=!0,Li=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Li}var ce={},Rc=!1,mn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function qp(){if(Rc)return ce;Rc=!0;var t=tt,e=Object.getOwnPropertyDescriptors||function(N){for(var W=Object.keys(N),ne={},se=0;se<W.length;se++)ne[W[se]]=Object.getOwnPropertyDescriptor(N,W[se]);return ne},n=/%[sdj%]/g;ce.format=function(R){if(!U(R)){for(var N=[],W=0;W<arguments.length;W++)N.push(r(arguments[W]));return N.join(" ")}for(var W=1,ne=arguments,se=ne.length,C=String(R).replace(n,function(M){if(M==="%%")return"%";if(W>=se)return M;switch(M){case"%s":return String(ne[W++]);case"%d":return Number(ne[W++]);case"%j":try{return JSON.stringify(ne[W++])}catch{return"[Circular]"}default:return M}}),A=ne[W];W<se;A=ne[++W])k(A)||!X(A)?C+=" "+A:C+=" "+r(A);return C},ce.deprecate=function(R,N){if(typeof t<"u"&&t.noDeprecation===!0)return R;if(typeof t>"u")return function(){return ce.deprecate(R,N).apply(this||mn,arguments)};var W=!1;function ne(){if(!W){if(t.throwDeprecation)throw new Error(N);t.traceDeprecation?console.trace(N):console.error(N),W=!0}return R.apply(this||mn,arguments)}return ne};var s={},c=/^$/;if(t.env.NODE_DEBUG){var l=t.env.NODE_DEBUG;l=l.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),c=new RegExp("^"+l+"$","i")}ce.debuglog=function(R){if(R=R.toUpperCase(),!s[R])if(c.test(R)){var N=t.pid;s[R]=function(){var W=ce.format.apply(ce,arguments);console.error("%s %d: %s",R,N,W)}}else s[R]=function(){};return s[R]};function r(R,N){var W={seen:[],stylize:u};return arguments.length>=3&&(W.depth=arguments[2]),arguments.length>=4&&(W.colors=arguments[3]),v(N)?W.showHidden=N:N&&ce._extend(W,N),V(W.showHidden)&&(W.showHidden=!1),V(W.depth)&&(W.depth=2),V(W.colors)&&(W.colors=!1),V(W.customInspect)&&(W.customInspect=!0),W.colors&&(W.stylize=i),d(W,R,W.depth)}ce.inspect=r,r.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]},r.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function i(R,N){var W=r.styles[N];return W?"\x1B["+r.colors[W][0]+"m"+R+"\x1B["+r.colors[W][1]+"m":R}function u(R,N){return R}function g(R){var N={};return R.forEach(function(W,ne){N[W]=!0}),N}function d(R,N,W){if(R.customInspect&&N&&_e(N.inspect)&&N.inspect!==ce.inspect&&!(N.constructor&&N.constructor.prototype===N)){var ne=N.inspect(W,R);return U(ne)||(ne=d(R,ne,W)),ne}var se=p(R,N);if(se)return se;var C=Object.keys(N),A=g(C);if(R.showHidden&&(C=Object.getOwnPropertyNames(N)),de(N)&&(C.indexOf("message")>=0||C.indexOf("description")>=0))return f(N);if(C.length===0){if(_e(N)){var M=N.name?": "+N.name:"";return R.stylize("[Function"+M+"]","special")}if(ie(N))return R.stylize(RegExp.prototype.toString.call(N),"regexp");if(Y(N))return R.stylize(Date.prototype.toString.call(N),"date");if(de(N))return f(N)}var q="",J=!1,T=["{","}"];if(x(N)&&(J=!0,T=["[","]"]),_e(N)){var w=N.name?": "+N.name:"";q=" [Function"+w+"]"}if(ie(N)&&(q=" "+RegExp.prototype.toString.call(N)),Y(N)&&(q=" "+Date.prototype.toUTCString.call(N)),de(N)&&(q=" "+f(N)),C.length===0&&(!J||N.length==0))return T[0]+q+T[1];if(W<0)return ie(N)?R.stylize(RegExp.prototype.toString.call(N),"regexp"):R.stylize("[Object]","special");R.seen.push(N);var $;return J?$=y(R,N,W,A,C):$=C.map(function(z){return b(R,N,W,A,z,J)}),R.seen.pop(),B($,q,T)}function p(R,N){if(V(N))return R.stylize("undefined","undefined");if(U(N)){var W="'"+JSON.stringify(N).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return R.stylize(W,"string")}if(D(N))return R.stylize(""+N,"number");if(v(N))return R.stylize(""+N,"boolean");if(k(N))return R.stylize("null","null")}function f(R){return"["+Error.prototype.toString.call(R)+"]"}function y(R,N,W,ne,se){for(var C=[],A=0,M=N.length;A<M;++A)ue(N,String(A))?C.push(b(R,N,W,ne,String(A),!0)):C.push("");return se.forEach(function(q){q.match(/^\d+$/)||C.push(b(R,N,W,ne,q,!0))}),C}function b(R,N,W,ne,se,C){var A,M,q;if(q=Object.getOwnPropertyDescriptor(N,se)||{value:N[se]},q.get?q.set?M=R.stylize("[Getter/Setter]","special"):M=R.stylize("[Getter]","special"):q.set&&(M=R.stylize("[Setter]","special")),ue(ne,se)||(A="["+se+"]"),M||(R.seen.indexOf(q.value)<0?(k(W)?M=d(R,q.value,null):M=d(R,q.value,W-1),M.indexOf(`
|
|
14
|
+
`)>-1&&(C?M=M.split(`
|
|
15
|
+
`).map(function(J){return" "+J}).join(`
|
|
16
|
+
`).slice(2):M=`
|
|
17
|
+
`+M.split(`
|
|
18
|
+
`).map(function(J){return" "+J}).join(`
|
|
19
|
+
`))):M=R.stylize("[Circular]","special")),V(A)){if(C&&se.match(/^\d+$/))return M;A=JSON.stringify(""+se),A.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(A=A.slice(1,-1),A=R.stylize(A,"name")):(A=A.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),A=R.stylize(A,"string"))}return A+": "+M}function B(R,N,W){var ne=R.reduce(function(se,C){return C.indexOf(`
|
|
20
|
+
`)>=0,se+C.replace(/\u001b\[\d\d?m/g,"").length+1},0);return ne>60?W[0]+(N===""?"":N+`
|
|
21
|
+
`)+" "+R.join(`,
|
|
22
|
+
`)+" "+W[1]:W[0]+N+" "+R.join(", ")+" "+W[1]}ce.types=Fp();function x(R){return Array.isArray(R)}ce.isArray=x;function v(R){return typeof R=="boolean"}ce.isBoolean=v;function k(R){return R===null}ce.isNull=k;function P(R){return R==null}ce.isNullOrUndefined=P;function D(R){return typeof R=="number"}ce.isNumber=D;function U(R){return typeof R=="string"}ce.isString=U;function Z(R){return typeof R=="symbol"}ce.isSymbol=Z;function V(R){return R===void 0}ce.isUndefined=V;function ie(R){return X(R)&&ke(R)==="[object RegExp]"}ce.isRegExp=ie,ce.types.isRegExp=ie;function X(R){return typeof R=="object"&&R!==null}ce.isObject=X;function Y(R){return X(R)&&ke(R)==="[object Date]"}ce.isDate=Y,ce.types.isDate=Y;function de(R){return X(R)&&(ke(R)==="[object Error]"||R instanceof Error)}ce.isError=de,ce.types.isNativeError=de;function _e(R){return typeof R=="function"}ce.isFunction=_e;function Ce(R){return R===null||typeof R=="boolean"||typeof R=="number"||typeof R=="string"||typeof R=="symbol"||typeof R>"u"}ce.isPrimitive=Ce,ce.isBuffer=Gp();function ke(R){return Object.prototype.toString.call(R)}function Ae(R){return R<10?"0"+R.toString(10):R.toString(10)}var We=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ve(){var R=new Date,N=[Ae(R.getHours()),Ae(R.getMinutes()),Ae(R.getSeconds())].join(":");return[R.getDate(),We[R.getMonth()],N].join(" ")}ce.log=function(){console.log("%s - %s",ve(),ce.format.apply(ce,arguments))},ce.inherits=lt(),ce._extend=function(R,N){if(!N||!X(N))return R;for(var W=Object.keys(N),ne=W.length;ne--;)R[W[ne]]=N[W[ne]];return R};function ue(R,N){return Object.prototype.hasOwnProperty.call(R,N)}var pe=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;ce.promisify=function(N){if(typeof N!="function")throw new TypeError('The "original" argument must be of type Function');if(pe&&N[pe]){if(W=N[pe],typeof W!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(W,pe,{value:W,enumerable:!1,writable:!1,configurable:!0}),W}function W(){for(var ne,se,C=new Promise(function(q,J){ne=q,se=J}),A=[],M=0;M<arguments.length;M++)A.push(arguments[M]);A.push(function(q,J){q?se(q):ne(J)});try{N.apply(this||mn,A)}catch(q){se(q)}return C}return Object.setPrototypeOf(W,Object.getPrototypeOf(N)),pe&&Object.defineProperty(W,pe,{value:W,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(W,e(N))},ce.promisify.custom=pe;function te(R,N){if(!R){var W=new Error("Promise was rejected with a falsy value");W.reason=R,R=W}return N(R)}function oe(R){if(typeof R!="function")throw new TypeError('The "original" argument must be of type Function');function N(){for(var W=[],ne=0;ne<arguments.length;ne++)W.push(arguments[ne]);var se=W.pop();if(typeof se!="function")throw new TypeError("The last argument must be of type Function");var C=this||mn,A=function(){return se.apply(C,arguments)};R.apply(this||mn,W).then(function(M){t.nextTick(A.bind(null,null,M))},function(M){t.nextTick(te.bind(null,M,A))})}return Object.setPrototypeOf(N,Object.getPrototypeOf(R)),Object.defineProperties(N,e(R)),N}return ce.callbackify=oe,ce}var Q=qp();Q.format;Q.deprecate;Q.debuglog;Q.inspect;Q.types;Q.isArray;Q.isBoolean;Q.isNull;Q.isNullOrUndefined;Q.isNumber;Q.isString;Q.isSymbol;Q.isUndefined;Q.isRegExp;Q.isObject;Q.isDate;Q.isError;Q.isFunction;Q.isPrimitive;Q.isBuffer;Q.log;Q.inherits;Q._extend;Q.promisify;Q.callbackify;var eT=Q._extend,tT=Q.callbackify,nT=Q.debuglog,rT=Q.deprecate,iT=Q.format,oT=Q.inherits,sT=Q.inspect,aT=Q.isArray,lT=Q.isBoolean,cT=Q.isBuffer,uT=Q.isDate,fT=Q.isError,gT=Q.isFunction,pT=Q.isNull,dT=Q.isNullOrUndefined,mT=Q.isNumber,yT=Q.isObject,hT=Q.isPrimitive,TT=Q.isRegExp,vT=Q.isString,bT=Q.isSymbol,wT=Q.isUndefined,BT=Q.log,xT=Q.promisify,PT=Q.types,_T=Q.TextEncoder=globalThis.TextEncoder,IT=Q.TextDecoder=globalThis.TextDecoder;var Qt=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)}issue(e){console.info(JSON.stringify({...e,...this.getIssueContext()}))}getIssueContext(){return{}}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(e,n))}_serializeMessage(e,n){let s=Q.format(...n);return G.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(e,s):s}getJsonMessage(e,n){return JSON.stringify({msg:n,level: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 yn=class t extends Qt{constructor(e){super({visibleToBotOwners:!1,hiddenToIntegrationOwners:!1,...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}withHiddenToIntegrationOwners(e){return this.with({hiddenToIntegrationOwners:e})}forBot(){return this.with({hiddenToIntegrationOwners:!1,visibleToBotOwners:!0})}forBotOnly(){return this.with({hiddenToIntegrationOwners:!0,visibleToBotOwners:!0})}getJsonMessage(e,n){return JSON.stringify({msg:n,level:e,botId:this.defaultOptions.botId,integrationId:this.defaultOptions.integrationId,integrationAlias:this.defaultOptions.integrationAlias,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,hidden_to_integration_owner:this.defaultOptions.hiddenToIntegrationOwners,options:this.defaultOptions})}getIssueContext(){let{botId:e,integrationId:n,integrationAlias:s}=this.defaultOptions;return{...e&&{botId:e},...n&&{integrationId:n},...s&&{integrationAlias:s}}}};_();E();I();var Vp=t=>["traceparent","tracestate"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),Zp=(t,e,n)=>{let[,s]=(e.headers.traceparent||"").split("-"),c=new zp({botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias,retry:Jn,headers:n.managesOwnTracePropagation?{}:Vp(e.headers)}),l=new gn(c),r=new yn({traceId:s,botId:t.botId,integrationId:t.integrationId,integrationAlias:t.integrationAlias});return{ctx:t,req:e,client:l,logger:r,instance:n}},Yp=async t=>{let{ctx:e}=t;switch(e.operation){case"webhook_received":return await Xp(t);case"register":return await Qp(t);case"unregister":return await ed(t);case"message_created":return await rd(t);case"action_triggered":return await id(t);case"ping":return await Jp(t);case"create_user":return await td(t);case"create_conversation":return await nd(t);default:throw new hn(`Unknown operation ${e.operation}`)}},Hc=t=>async e=>{let n=Xl(e.headers),s=Zp(n,e,t),{logger:c}=s;try{let l;return l=await od(s),l?{...l,status:l.status??200}:(l=await Yp(s),l?{...l,status:l.status??200}:{status:200})}catch(l){let{status:r,body:i,error:u}=zn({thrown:l,unexpectedErrorMessage:"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 r>=500&&console.error(l),c.forBot().error(u.message),{status:r,body:i}}},Jp=async t=>{},Xp=async({client:t,ctx:e,req:n,logger:s,instance:c})=>{let{req:l}=nt(n);return c.webhook({client:t,ctx:e,req:l,logger:s})},Qp=async({client:t,ctx:e,req:n,logger:s,instance:c})=>{if(!c.register)return;let{webhookUrl:l}=nt(n);await c.register({client:t,ctx:e,webhookUrl:l,logger:s})},ed=async({client:t,ctx:e,req:n,logger:s,instance:c})=>{if(!c.unregister)return;let{webhookUrl:l}=nt(n);await c.unregister({ctx:e,webhookUrl:l,client:t,logger:s})},td=async({client:t,ctx:e,req:n,logger:s,instance:c})=>{if(!c.createUser)return;let{tags:l}=nt(n);return await c.createUser({ctx:e,client:t,tags:l,logger:s})},nd=async({client:t,ctx:e,req:n,logger:s,instance:c})=>{if(!c.createConversation)return;let{channel:l,tags:r}=nt(n);return await c.createConversation({ctx:e,client:t,channel:l,tags:r,logger:s})},rd=async({ctx:t,req:e,client:n,logger:s,instance:c})=>{let{conversation:l,user:r,type:i,payload:u,message:g}=nt(e),d=c.channels[l.channel];if(!d)throw new hn(`Channel ${l.channel} not found`);let p=d.messages[i];if(!p)throw new hn(`Message of type ${i} not found in channel ${l.channel}`);await p({ctx:t,conversation:l,message:g,user:r,type:i,client:n,payload:u,ack:async({tags:y})=>{await n.updateMessage({id:g.id,tags:y})},logger:s})},id=async({req:t,ctx:e,client:n,logger:s,instance:c})=>{let{input:l,type:r}=nt(t);if(!r)throw new hn("Missing action type");let i=c.actions[r];if(!i)throw new hn(`Action ${r} not found`);let u=new Xn,d={output:await i({ctx:e,input:l,client:n,type:r,logger:s,metadata:u}),meta:u.toJSON()};return{body:JSON.stringify(d)}},od=async({instance:t,client:e,ctx:n,logger:s,req:c})=>{let l=t.unknownOperationHandler;if(l)return await l({client:e,ctx:n,logger:s,req:c})};var Gi=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler,this.unknownOperationHandler=e.__advanced?.unknownOperationHandler,this.managesOwnTracePropagation=e.__advanced?.managesOwnTracePropagation}actions;channels;register;unregister;createUser;createConversation;webhook;unknownOperationHandler;managesOwnTracePropagation;handler=Hc(this);start=e=>Vn(this.handler,e)};_();E();I();_();E();I();_();E();I();_();E();I();_();E();I();function ir(t){if(t)return Object.fromEntries(Object.entries(t).map(([e,{recurrence:n,...s}])=>[e,s]))}function or(t,e){let s={...Object.fromEntries(Object.entries(t??{}).map(([c,l])=>l.recurrence?[c,{type:c,payload:l.recurrence.payload,schedule:{cron:l.recurrence.cron}}]:null).filter(c=>c!==null)),...e};return Object.keys(s).length?s:void 0}var qi=class t{constructor(e){this.props=e;let n=ir(e.events),s=or(e.events,e.recurringEvents);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=n,this.recurringEvents=s,this.actions=e.actions,this.tables=e.tables,this.secrets=e.secrets,this.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced,this.withPlugins={user:e.user,conversation:e.conversation,message:e.message,states:e.states,events:n,recurringEvents:s,actions:e.actions,tables:e.tables,workflows:e.workflows}}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;secrets;workflows;attributes;__advanced;withPlugins;get metadata(){return{sdkVersion:At}}clone=e=>new t({...this.props,integrations:this.integrations,plugins:this.plugins,...e});addIntegration(e,n){let s=this;s.integrations||(s.integrations={});let c=n?.alias??e.name;if(s.integrations[c])throw new Fe(`Another integration with alias "${c}" is already installed in the bot`);let l=n&&"configurationType"in n?n.configurationType:void 0,r=n&&"configuration"in n?n.configuration??{}:{},i=l?e.definition.configurations?.[l]?.schema:e.definition.configuration?.schema,u=i?i.safeParse(r):null,g=u?.success?{...r,...u.data}:r;return s.integrations[c]={...e,alias:c,enabled:n?.enabled,configurationType:l,configuration:g,disabledChannels:n?.disabledChannels},this}addPlugin(e,n){let s=this;s.plugins||(s.plugins={});let c=n.alias??e.name;if(s.plugins[c])throw new Fe(`Another plugin with alias "${c}" is already installed in the bot`);let l=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([p,f])=>"integrationInterfaceAlias"in f).map(([p,f])=>{let y=this.integrations?.[f.integrationAlias];if(!y){let B=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Fe(`Interface with alias "${p}" of plugin with alias "${c}" references integration with alias "${f.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
|
|
23
|
+
Available integration aliases: ${B}`)}let b=y.definition.interfaces?.[f.integrationInterfaceAlias];if(!b){let B=Object.keys(y.definition.interfaces??{}).join(", ")||"(none)";throw new Fe(`Interface with alias "${f.integrationInterfaceAlias}" does not exist in integration "${y.name}" referenced by interface with alias "${p}" of plugin with alias "${c}".
|
|
24
|
+
Available interface aliases: ${B}`)}return[p,{...b,id:y.id,name:y.name,version:y.version,...f}]})),r=Object.fromEntries(Object.entries(n.dependencies??{}).filter(([p,f])=>!("integrationInterfaceAlias"in f)).map(([p,f])=>{let y=this.integrations?.[f.integrationAlias];if(!y){let b=Object.keys(this.integrations??{}).join(", ")||"(none)";throw new Error(`Integration with alias "${p}" of plugin with alias "${c}" references integration with alias "${f.integrationAlias}" which is not installed. Please make sure to add the integration via addIntegration() before calling addPlugin().
|
|
25
|
+
Available integration aliases: ${b}`)}return[p,{...y,...f}]})),i=n.configuration??{},u=e.definition.configuration?.schema,g=u?u.safeParse(i):null,d=g?.success?{...i,...g.data}:i;return s.plugins[c]={...e,alias:c,configuration:d,interfaces:l,integrations:r},s.withPlugins.user=this._mergeUser(s.withPlugins.user,e.definition.user),s.withPlugins.conversation=this._mergeConversation(s.withPlugins.conversation,e.definition.conversation),s.withPlugins.message=this._mergeMessage(s.withPlugins.message,e.definition.message),s.withPlugins.recurringEvents=this._mergeRecurringEvents(s.withPlugins.recurringEvents,e.definition.recurringEvents),s.withPlugins.tables=this._mergeTables(s.withPlugins.tables,e.definition.tables),s.withPlugins.workflows=this._mergeWorkflows(s.withPlugins.workflows,e.definition.workflows),s.withPlugins.states=this._mergeStates(s.withPlugins.states,this._prefixKeysWithPluginAlias(e.definition.states,c)),s.withPlugins.events=this._mergeEvents(s.withPlugins.events,this._prefixKeysWithPluginAlias(e.definition.events,c)),s.withPlugins.actions=this._mergeActions(s.withPlugins.actions,this._prefixKeysWithPluginAlias(e.definition.actions,c)),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)=>xe.mapKeys(e??{},s=>`${n}${rt}${s}`);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,s])=>[n,{...s,definition:{...s.definition,configuration:this._dereferenceDefinitionSchema(s.definition.configuration,e),events:this._dereferenceDefinitionSchemas(s.definition.events,e),states:this._dereferenceDefinitionSchemas(s.definition.states,e),tables:this._dereferenceDefinitionSchemas(s.definition.tables,e),actions:this._dereferenceActionDefinitionSchemas(s.definition.actions,e)}}]))}}_buildZuiReferenceMap(){let e={},n=Object.entries(this.plugins??{});for(let[s,c]of n){let l=Object.entries(c.interfaces??{});for(let[r,i]of l){let u=this.integrations?.[i.integrationAlias];if(!u)throw new Fe(`Interface with alias "${r}" of plugin with alias "${s}" references integration "${i.name}" which is not installed`);let g=Object.entries(i.entities??{});for(let[d,{name:p}]of g){let f=u.definition.entities?.[p]?.schema;if(!f)throw new Error(`Interface entity "${p}" does not exist in integration "${u.name}"`);e[`interface:${r}/entities/${d}`]=f}}}return e}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([s,c])=>[s,this._dereferenceDefinitionSchema(c,n)]))}_dereferenceDefinitionSchema(e,n){return e&&{...e,schema:this._dereferenceZuiSchema(e.schema,n)}}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([s,c])=>[s,{...c,input:{schema:this._dereferenceZuiSchema(c.input.schema,n)},output:{schema:this._dereferenceZuiSchema(c.output.schema,n)}}]))}};_();E();I();_();E();I();import{Client as gd,InvalidPayloadError as Vi}from"@holocronlab/botruntime-client";_();E();I();var Tn=class t extends Qt{constructor(e){super({...e})}with(e){return new t({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};_();E();I();_();E();I();var Bt=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}get _inner(){return this._client}getConversation=(e=>this._run("getConversation",e));listConversations=(e=>this._run("listConversations",e));updateConversation=(e=>this._run("updateConversation",e));deleteConversation=(e=>this._run("deleteConversation",e));listParticipants=(e=>this._run("listParticipants",e));addParticipant=(e=>this._run("addParticipant",e));getParticipant=(e=>this._run("getParticipant",e));removeParticipant=(e=>this._run("removeParticipant",e));createEvent=(e=>this._run("createEvent",e));getEvent=(e=>this._run("getEvent",e));listEvents=(e=>this._run("listEvents",e));createMessage=(e=>this._run("createMessage",e));getMessage=(e=>this._run("getMessage",e));updateMessage=(e=>this._run("updateMessage",e));listMessages=(e=>this._run("listMessages",e));deleteMessage=(e=>this._run("deleteMessage",e));getUser=(e=>this._run("getUser",e));listUsers=(e=>this._run("listUsers",e));updateUser=(e=>this._run("updateUser",e));deleteUser=(e=>this._run("deleteUser",e));getState=(e=>this._run("getState",e));setState=(e=>this._run("setState",e));getOrSetState=(e=>this._run("getOrSetState",e));patchState=(e=>this._run("patchState",e));callAction=(e=>this._run("callAction",e));uploadFile=(e=>this._run("uploadFile",e));upsertFile=(e=>this._run("upsertFile",e));deleteFile=(e=>this._run("deleteFile",e));listFiles=(e=>this._run("listFiles",e));getFile=(e=>this._run("getFile",e));updateFileMetadata=(e=>this._run("updateFileMetadata",e));searchFiles=(e=>this._run("searchFiles",e));trackAnalytics=(e=>this._run("trackAnalytics",e));getTableRow=(e=>this._run("getTableRow",e));createTableRows=(e=>this._run("createTableRows",e));findTableRows=(e=>this._run("findTableRows",e));deleteTableRows=(e=>this._run("deleteTableRows",e));updateTableRows=(e=>this._run("updateTableRows",e));upsertTableRows=(e=>this._run("upsertTableRows",e));createWorkflow=(e=>this._run("createWorkflow",e));getOrCreateWorkflow=(e=>this._run("getOrCreateWorkflow",e));getWorkflow=(e=>this._run("getWorkflow",e));updateWorkflow=(e=>this._run("updateWorkflow",e));deleteWorkflow=(e=>this._run("deleteWorkflow",e));listWorkflows=(e=>this._run("listWorkflows",e));createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let s=this._hooks.before[e];s&&(n=await s(n));let c=await this._client[e](n),l=this._hooks.after[e];return l&&(c=await l(c,n)),c}};_();E();I();import{z as sd}from"@holocronlab/botruntime-zui";var ad=sd.enum(["event_received","register","unregister","ping","action_triggered"]),Mc=t=>({botId:t[Qn]||Je("Missing bot id header"),operation:ad.parse(t[tr]),type:t[Jl]||Je("Missing type header"),configuration:JSON.parse(L.from(t[er]||Je("Missing configuration header"),"base64").toString("utf-8"))});_();E();I();var Ue={status:200};_();E();I();_();E();I();var zi=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 ld=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Dc=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!ld.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:cd(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),Ue;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 ud(n,e);default:e.payload.type}return Ue},cd=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),ud=async(t,e)=>{let n=zi(e.payload.type),s=t.self.workflowHandlers[n]?.[e.payload.workflow.name];if(!s||s.length===0)return t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),Ue;let{updatedWorkflow:c}=await fd(t,e);return c.status==="pending"&&t.logger.warn(`Workflow "${e.payload.workflow.name}" is still in pending status after processing "${n}" event. This may indicate that the workflow was not properly acknowledged or terminated by the handler. `),Ue},fd=async(t,e)=>{let n=zi(e.payload.type),s=t.self.workflowHandlers[n]?.[e.payload.workflow.name],c=structuredClone(e.payload.workflow);for(let l of s??[])c=await l({...t,event:e,conversation:e.payload.conversation,user:e.payload.user,workflow:c});return{updatedWorkflow:c}};_();E();I();var Nc=t=>async e=>{let n=Mc(e.headers),s=new Tn,c=new gd({botId:n.botId,retry:Jn}),l=new Bt(c,{before:{createMessage:async i=>{let u=t.hookHandlers.before_outgoing_message[i.type]??[];for(let g of u){let d=new Bt(c);i=(await g({client:d,ctx:n,logger:s.with({conversationId:i.conversationId,userId:i.userId}),data:i}))?.data??i}return i},callAction:async i=>{let u=t.hookHandlers.before_outgoing_call_action[i.type]??[];for(let g of u){let d=new Bt(c);i=(await g({client:d,ctx:n,logger:s,data:i}))?.data??i}return i}},after:{createMessage:async i=>{let u=t.hookHandlers.after_outgoing_message[i.message.type]??[];for(let g of u){let d=new Bt(c);i=(await g({client:d,ctx:n,logger:s.with({messageId:i.message.id,conversationId:i.message.conversationId,userId:i.message.userId}),data:i}))?.data??i}return i},callAction:async(i,u)=>{let{type:g}=u,d=t.hookHandlers.after_outgoing_call_action[g]??[];for(let p of d){let f=new Bt(c);i=(await p({client:f,ctx:n,logger:s,data:{type:g,...i}}))?.data??i}return i}}}),r={req:e,ctx:n,logger:s,client:l,self:t};try{switch(n.operation){case"action_triggered":return await hd(r);case"event_received":return await yd(r);case"register":return await dd(r);case"unregister":return await md(r);case"ping":return await pd(r);default:throw new Vi(`Unknown operation ${n.operation}`)}}catch(i){let{status:u,body:g,error:d}=zn({thrown:i,unexpectedErrorMessage:"An unexpected error occurred in the bot."});return u>=500?s.error(d.message,i):s.error(d.message),{status:u,body:g}}},pd=async t=>Ue,dd=async t=>(await t.self.registerHandler?.({client:t.client,ctx:t.ctx,logger:t.logger}),Ue),md=async t=>Ue,yd=async t=>{let{ctx:e,logger:n,req:s,client:c,self:l}=t,r={client:c,ctx:e,logger:n},i=nt(s);if(r.logger=r.logger.with({eventId:i.event.id,messageId:i.event.messageId,conversationId:i.event.conversationId,userId:i.event.userId}),e.type==="workflow_update")return await Dc(t,i.event);if(e.type==="message_created"){let y=i.event,b=y.payload.message,B=y.payload.user,x=y.payload.conversation;r.logger=r.logger.with({messageId:b.id,conversationId:b.conversationId,userId:b.userId});let v=l.hookHandlers.before_incoming_message[b.type]??[];for(let U of v){let Z=await U({...r,user:B,conversation:x,data:b});if(b=Z?.data??b,Z?.stop)return Ue}let k={...r,user:B,conversation:x,message:b,event:y},P=l.messageHandlers[b.type]??[];for(let U of P)await U(k);let D=l.hookHandlers.after_incoming_message[b.type]??[];for(let U of D){let Z=await U({...r,user:B,conversation:x,data:b});if(b=Z?.data??b,Z?.stop)return Ue}return Ue}if(e.type==="state_expired"){let b=i.event.payload.state,B={...r,state:b},x=l.stateExpiredHandlers[b.name]??[];for(let v of x)await v(B);return Ue}let u=i.event,g=l.hookHandlers.before_incoming_event[u.type]??[];for(let y of g){let b=await y({...r,data:u});if(u=b?.data??u,b?.stop)return Ue}let d={...r,event:u},p=l.eventHandlers[u.type]??[];for(let y of p)await y(d);let f=l.hookHandlers.after_incoming_event[u.type]??[];for(let y of f){let b=await y({...r,data:u});if(u=b?.data??u,b?.stop)return Ue}return Ue},hd=async({ctx:t,logger:e,req:n,client:s,self:c})=>{let{input:l,type:r}=nt(n);if(!r)throw new Vi("Missing action type");let i=c.hookHandlers.before_incoming_call_action[r]??[];for(let f of i){let y=await f({ctx:t,logger:e,client:s,data:{type:r,input:l}});l=y?.data?.input??l,r=y?.data?.type??r}let u=c.actionHandlers[r];if(!u)throw new Vi(`Action ${r} not found`);let g=await u({ctx:t,logger:e,input:l,client:s,type:r}),d=c.hookHandlers.after_incoming_call_action[r]??[];for(let f of d){let y=await f({ctx:t,logger:e,client:s,data:{type:r,output:g}});r=y?.data?.type??r,g=y?.data?.output??g}return{status:200,body:JSON.stringify({output:g})}};_();E();I();_();E();I();_();E();I();var gt=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${rt}`,s=Object.fromEntries(Object.entries(t.tags??{}).flatMap(([c,l])=>c.startsWith(n)?[[c.slice(n.length),l]]:[]));return{...t,tags:s}},je=(t,{alias:e})=>{if(!("tags"in t)||!e)return t;let n=`${e}${rt}`,s=Object.fromEntries(Object.entries(t.tags??{}).map(([c,l])=>[c.startsWith(n)?c:`${n}${c}`,l]));return{...t,tags:s}};_();E();I();var Zi=class{constructor(e){this._list=e}_nextToken;_elementsBuffer=[];_isExhausted=!1;[Symbol.asyncIterator](){return this}async next(){return this._bufferIsEmpty&&!this._isExhausted&&await this._fetchNextPageIntoBuffer(),this._bufferIsEmpty?{done:!0,value:void 0}:{done:!1,value:this._elementsBuffer.shift()}}async take(e){let n=[];for(let s=0;s<e;++s){let c=await this.next();if(c.done)break;n.push(c.value)}return n}async takePage(e){for(let s=0;s<e;++s)this._isExhausted||await this._fetchNextPageIntoBuffer();let n=[...this._elementsBuffer];return this._elementsBuffer.length=0,n}async takeAll(){return this.take(Number.POSITIVE_INFINITY)}get isExhausted(){return this._isExhausted}async _fetchNextPageIntoBuffer(){let{items:e,meta:n}=await this._list({nextToken:this._nextToken});this._elementsBuffer.push(...e),this._nextToken=n.nextToken,n.nextToken||(this._isExhausted=!0)}get _bufferIsEmpty(){return this._elementsBuffer.length===0}},Xe=t=>new Zi(t);var xt=t=>new Proxy({},{get:(e,n)=>({listInstances:s=>Xe(({nextToken:c})=>t.client.listWorkflows({...s,name:n,nextToken:c}).then(({meta:l,workflows:r})=>({meta:l,items:r.map(i=>Qe({...t,workflow:i}))}))),startNewInstance:async s=>{let{workflow:c}=await t.client.createWorkflow({name:n,status:"pending",...je(s,{alias:void 0})});return{workflow:Qe({...t,workflow:c})}}})}),Qe=t=>{let e=!1;return{...gt(t.workflow,{alias:void 0}),async update(n){let{workflow:s}=await t.client.updateWorkflow({id:t.workflow.id,...je(n,{alias:void 0})});return await t.onWorkflowUpdate?.(s),{workflow:Qe({...t,workflow:s})}},async acknowledgeStartOfProcessing(){if(!t.event||t.workflow.status!=="pending"||e)return{workflow:Qe(t)};let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"in_progress",eventId:t.event.id});return e=!0,await t.onWorkflowUpdate?.(n),{workflow:Qe({...t,workflow:n})}},async setFailed({failureReason:n}){let{workflow:s}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:n});return await t.onWorkflowUpdate?.(s),{workflow:Qe({...t,workflow:s})}},async setCompleted({output:n}={}){let{workflow:s}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:n});return await t.onWorkflowUpdate?.(s),{workflow:Qe({...t,workflow:s})}},async cancel(){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return await t.onWorkflowUpdate?.(n),{workflow:Qe({...t,workflow:n})}}}};_();E();I();var Yi=class{constructor(e){this.props=e;this._registerHandler=e.register,this._actionHandlers=e.actions,this._plugins=e.plugins}_registerHandler;_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 registerHandler(){return this._registerHandler}get actionHandlers(){return new Proxy({},{get:(e,n)=>{let s=this._actionHandlers[n];if(s)return Ne.setName(c=>s({...c,workflows:xt(c)}),s.name);for(let[c,l]of Object.entries(this._plugins)){let[r,i]=n.split(rt);if(!(r!==c||!i))return l.actionHandlers[i]}}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let s=Object.values(this._plugins).flatMap(i=>i.messageHandlers[n]??[]),c=n==="*"?[]:this._messageHandlers[n]??[],l=this._messageHandlers["*"]??[],r=[...c,...l].sort((i,u)=>i.order-u.order).map(({handler:i})=>Ne.setName(u=>i({...u,workflows:xt(u)}),i.name));return re.unique([...s,...r])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let s=Object.values(this._plugins).flatMap(i=>i.eventHandlers[n]??[]),c=n==="*"?[]:this._eventHandlers[n]??[],l=this._eventHandlers["*"]??[],r=[...c,...l].sort((i,u)=>i.order-u.order).map(({handler:i})=>Ne.setName(u=>i({...u,workflows:xt(u)}),i.name));return re.unique([...s,...r])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let s=Object.values(this._plugins).flatMap(i=>i.stateExpiredHandlers[n]??[]),c=n==="*"?[]:this._stateExpiredHandlers[n]??[],l=this._stateExpiredHandlers["*"]??[],r=[...c,...l].sort((i,u)=>i.order-u.order).map(({handler:i})=>Ne.setName(u=>i({...u,workflows:xt(u)}),i.name));return re.unique([...s,...r])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(c,l)=>{let r=Object.values(this._plugins).flatMap(p=>p.hookHandlers[n]?.[l]??[]),i=this._hookHandlers[n]??{},u=l==="*"?[]:i[l]??[],g=i["*"]??[],d=[...u,...g].sort((p,f)=>p.order-f.order).map(({handler:p})=>Ne.setName(f=>p({...f,workflows:xt(f)}),p.name));return re.unique([...r,...d])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let s=this._workflowHandlers[n];if(s)return new Proxy({},{get:(c,l)=>{let r=s[l]?.sort((u,g)=>u.order-g.order).map(({handler:u})=>Ne.setName(async g=>{let d=g.workflow;return await u({...g,workflow:Qe({...g,onWorkflowUpdate(p){d=p}}),workflows:xt(g)}),d},u.name))??[],i=Object.values(this._plugins).flatMap(u=>u.workflowHandlers[n]?.[l]??[]);return re.unique([...r,...i])}})}})}on={message:(e,n)=>{this._messageHandlers[e]=re.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=re.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=re.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=re.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=re.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=re.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=re.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=re.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=re.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=re.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=re.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=re.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=re.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=re.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=re.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=re.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=Nc(this);start=e=>Vn(this.handler,e)};_();E();I();_();E();I();_();E();I();_();E();I();_();E();I();var Ji=class t{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.title=e.title,this.description=e.description,this.readme=e.readme,this.entities=e.entities??{},this.attributes=e.attributes,this.__advanced=e.__advanced;let n=this._getEntityReference(this.entities),s=e.events===void 0?{}:xe.mapValues(e.events,r=>({...r,schema:r.schema(n)})),c=e.actions===void 0?{}:xe.mapValues(e.actions,r=>({...r,input:{...r.input,schema:r.input.schema(n)},output:{...r.output,schema:r.output.schema(n)}})),l=e.channels===void 0?{}:xe.mapValues(e.channels,r=>({...r,messages:xe.mapValues(r.messages,i=>({...i,schema:i.schema(n)}))}));this.events=s,this.actions=c,this.channels=l}name;version;title;description;icon;readme;attributes;entities;events;actions;channels;__advanced;get metadata(){return{sdkVersion:At}}clone=e=>new t({...this.props,...e});_getEntityReference=e=>{let n={};for(let[s,c]of Object.entries(e)){let l=c.schema._def["x-zui"]?.title,r=c.schema._def.description,i=ee.ref(s);l&&i.title(l),r&&i.describe(r),n[s]=i}return n}};_();E();I();_();E();I();_();E();I();_();E();I();var Xi=class t{constructor(e){this.props=e;let n=Object.fromEntries(Object.entries(e.interfaces??{}).map(([l,r])=>[l,Object.fromEntries(Object.entries(r.definition.entities??{}).map(([i])=>[i,ee.ref(`interface:${l}/entities/${i}`)]))]));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.workflows=e.workflows,this.attributes=e.attributes,this.__advanced=e.__advanced;let s=new Set;for(let l of[...Object.keys(e.integrations??{}),...Object.keys(e.interfaces??{})]){if(s.has(l))throw new Fe(`Duplicate interface or integration alias detected in plugin definition: '${l}'. Please use unique aliases for each interface and integration.`);s.add(l)}this.configuration=e.configuration?{...e.configuration,schema:typeof e.configuration.schema=="object"?e.configuration.schema:e.configuration.schema({entities:n})}:void 0,this.states=Object.fromEntries(Object.entries(e.states??{}).map(([l,r])=>[l,{...r,schema:typeof r.schema=="object"?r.schema:r.schema({entities:n})}]));let c=Object.fromEntries(Object.entries(e.events??{}).map(([l,r])=>[l,{...r,schema:typeof r.schema=="object"?r.schema:r.schema({entities:n})}]));this.events=ir(c),this.recurringEvents=or(c,e.recurringEvents),this.actions=Object.fromEntries(Object.entries(e.actions??{}).map(([l,r])=>[l,{...r,input:{...r.input,schema:typeof r.input.schema=="object"?r.input.schema:r.input.schema({entities:n})},output:{...r.output,schema:typeof r.output.schema=="object"?r.output.schema:r.output.schema({entities:n})}}])),this.tables=Object.fromEntries(Object.entries(e.tables??{}).map(([l,r])=>[l,{...r,schema:typeof r.schema=="object"?r.schema:r.schema({entities:n})}]))}name;version;title;description;icon;readme;attributes;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;__advanced;get metadata(){return{sdkVersion:At}}clone=e=>new t({...this.props,...e});dereferenceEntities({intersectWithUnknownRecord:e}={intersectWithUnknownRecord:!0}){let n=this._buildZuiReferenceMap(e);return{...this,configuration:this.configuration?{...this.configuration,schema:this._dereferenceZuiSchema(this.configuration.schema,n)}:void 0,events:this._dereferenceDefinitionSchemas(this.events,n),states:this._dereferenceDefinitionSchemas(this.states,n),tables:this._dereferenceDefinitionSchemas(this.tables,n),actions:this._dereferenceActionDefinitionSchemas(this.actions,n)}}_buildZuiReferenceMap(e){return Object.fromEntries(Object.entries(this.interfaces??{}).flatMap(([n,s])=>Object.entries(s.definition.entities??{}).map(([c,l])=>[`interface:${n}/entities/${c}`,e?l.schema.and(ee.record(ee.string(),ee.unknown())):l.schema])))}_dereferenceZuiSchema(e,n){return e.dereference(n)}_dereferenceDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([s,c])=>[s,{...c,schema:this._dereferenceZuiSchema(c.schema,n)}]))}_dereferenceActionDefinitionSchemas(e,n){return Object.fromEntries(Object.entries(e??{}).map(([s,c])=>[s,{...c,input:{schema:this._dereferenceZuiSchema(c.input.schema,n)},output:{schema:this._dereferenceZuiSchema(c.output.schema,n)}}]))}};_();E();I();_();E();I();_();E();I();var Uc=(t,e)=>new Proxy({},{get:(n,s)=>new Proxy({},{get:(c,l)=>r=>{let i=(e.integrations[s]??e.interfaces[s])?.integrationAlias,u=e.interfaces[s]?.actions?.[l]?.name??l;return t.callAction({type:`${i}:${u}`,input:r}).then(g=>g.output)}})});_();E();I();_();E();I();_();E();I();_();E();I();var Qi=t=>({async getById({id:e}){let n=await t.client.getMessage({id:e});return it({...t,message:n.message})},list(e){return Xe(({nextToken:n})=>t.client.listMessages({...je(e??{},{alias:t.plugin?.alias}),nextToken:n}).then(({meta:s,messages:c})=>({meta:s,items:c.map(l=>it({...t,message:l}))})))}}),it=t=>({...gt(t.message,{alias:t.plugin?.alias}),async delete(){await t.client.deleteMessage({id:t.message.id})},async update(e){let{message:n}=await t.client.updateMessage({...je(e,{alias:t.plugin?.alias}),id:t.message.id});return it({...t,message:n})}});_();E();I();_();E();I();var eo=t=>({list(e){return Xe(({nextToken:n})=>t.client.listUsers({...je(e??{},{alias:t.pluginAlias}),nextToken:n}).then(({meta:s,users:c})=>({meta:s,items:c.map(l=>ot({...t,conversationId:e?.conversationId,user:l}))})))},async getById({id:e}){let n=await t.client.getUser({id:e});return ot({...t,user:n.user,conversationId:void 0})}}),ot=t=>{let e={...gt(t.user,{alias:t.pluginAlias}),async update(n){let{user:s}=await t.client.updateUser({...je(n,{alias:t.pluginAlias}),id:t.user.id});return ot({...t,user:s})}};return t.conversationId?{...e,async removeFromConversation(){return await t.client.removeParticipant({id:t.conversationId,userId:t.user.id}),ot({...t,conversationId:void 0})}}:{...e,async addToConversation({conversationId:n}){let{participant:s}=await t.client.addParticipant({id:n,userId:t.user.id});return ot({...t,user:s,conversationId:n})}}};_();E();I();var to=t=>new Proxy({},{get:(e,n)=>new Proxy({},{get:(s,c)=>({list(l){let r=t.plugin?.interfaces[n]?.integrationAlias??t.plugin?.integrations[n]?.integrationAlias,i=t.plugin?.interfaces[n]?.channels?.[c]?.name??c;return Xe(({nextToken:u})=>t.client.listConversations({...je(l??{},{alias:t.plugin?.alias}),channel:i==="*"?void 0:i,integrationName:r==="*"?void 0:r,nextToken:u}).then(({meta:g,conversations:d})=>({meta:g,items:d.map(p=>Kt({...t,conversation:p}))})))},async getById({id:l}){let r=await t.client.getConversation({id:l});return Kt({...t,conversation:r.conversation})}})})}),Kt=t=>{let e=t.client;return{...gt(t.conversation,{alias:t.plugin?.alias}),async delete(){await e.deleteConversation({id:t.conversation.id})},async update(n){let{conversation:s}=await e.updateConversation({...je(n,{alias:t.plugin?.alias}),id:t.conversation.id});return Kt({...t,conversation:s})},async getMessage({id:n}){let s=await e.getMessage({id:n});return it({...t,message:s.message})},async getOrCreateMessage(n){let{message:s}=await e.getOrCreateMessage({...je(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return it({...t,message:s})},async createMessage(n){let{message:s}=await e.createMessage({...je(n,{alias:t.plugin?.alias}),conversationId:t.conversation.id});return it({...t,message:s})},listMessages(n){return Xe(({nextToken:s})=>e.listMessages({...je(n??{},{alias:t.plugin?.alias}),conversationId:t.conversation.id,nextToken:s}).then(({meta:c,messages:l})=>({meta:c,items:l.map(r=>it({...t,message:r}))})))},listParticipants(){return Xe(({nextToken:n})=>e.listParticipants({id:t.conversation.id,nextToken:n}).then(({meta:s,participants:c})=>({meta:s,items:c.map(l=>ot({...t,user:l,conversationId:t.conversation.id}))})))}}};_();E();I();_();E();I();_();E();I();var no=class t{constructor(e){this._props=e}async emit(e){let{conversationId:n,userId:s,messageId:c}=this._props,{event:l}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:n,userId:s,messageId:c});return l}async schedule(e,n){let{conversationId:s,userId:c,messageId:l}=this._props,{event:r}=await this._props.client.createEvent({type:this._props.eventName,payload:e,conversationId:s,userId:c,messageId:l,schedule:n});return r}withConversationId(e){return new t({...this._props,conversationId:e})}withUserId(e){return new t({...this._props,userId:e})}withMessageId(e){return new t({...this._props,messageId:e})}async getById(e){return(await this._props.client.getEvent({id:e.id})).event}list(e){return Xe(({nextToken:n})=>this._props.client.listEvents({...e,type:this._props.eventName,conversationId:this._props.conversationId,userId:this._props.userId,messageId:this._props.messageId,nextToken:n}).then(({meta:s,events:c})=>({meta:s,items:c})))}},jc=(t,e)=>new Proxy({},{get:(n,s)=>{let c=e.alias!==void 0?`${e.alias}${rt}${s}`:s;return new no({client:t,eventName:c})}});_();E();I();_();E();I();_();E();I();_();E();I();_();E();I();var ro=class{constructor(e,n,s){this._client=e;this._stateType=n;this._stateName=s}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,s){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:s?.expiryMs})}async getOrSet(e,n,s){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n,expiry:s?.expiryMs}).then(c=>c.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})}},Wc=(t,e)=>new Proxy({},{get:(n,s)=>new Proxy({},{get:(c,l)=>{let r=e.alias!==void 0?`${e.alias}${rt}${l}`:l;return new ro(t,s,r)}})});_();E();I();var Td=t=>"user"in t&&"conversation"in t,io=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:s,integrations:c,alias:l}=this._runtime,r=Uc(e,this._runtime),i=Wc(e,this._runtime),u=xt({client:e,pluginAlias:this._runtime.alias}),g=jc(e,this._runtime),d=eo({client:e,pluginAlias:this._runtime.alias}),p=to({client:e,plugin:this._runtime}),f=Qi({client:e,plugin:this._runtime});return{configuration:n,interfaces:s,integrations:c,actions:r,states:i,alias:l,workflows:u,events:g,users:d,conversations:p,messages:f}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let s=this._actionHandlers[n];if(s)return Ne.setName(c=>s({...c,...this._getTools(c.client)}),s.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let s=n==="*"?[]:this._messageHandlers[n]??[],c=this._messageHandlers["*"]??[];return re.unique([...s,...c]).sort((r,i)=>r.order-i.order).map(({handler:r})=>Ne.setName(i=>r({...i,user:ot({...i,conversationId:i.conversation.id,pluginAlias:this._runtime.alias}),message:it({...i,plugin:this._runtime,message:i.message}),conversation:Kt({...i,plugin:this._runtime,conversation:i.conversation}),...this._getTools(i.client)}),r.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let s=n==="*"?[]:this._eventHandlers[n]??[],c=Object.entries(this._eventHandlers).filter(([i])=>this._eventResolvesTo(i,n)).flatMap(([,i])=>i??[]),l=this._eventHandlers["*"]??[];return re.unique([...s,...c,...l]).sort((i,u)=>i.order-u.order).map(({handler:i})=>Ne.setName(u=>i({...u,...this._getTools(u.client)}),i.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let s=n==="*"?[]:this._stateExpiredHandlers[n]??[],c=this._stateExpiredHandlers["*"]??[];return re.unique([...s,...c]).sort((r,i)=>r.order-i.order).map(({handler:r})=>Ne.setName(i=>r({...i,...this._getTools(i.client)}),r.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let s=this._hookHandlers[n];if(s)return new Proxy({},{get:(c,l)=>{l=this._stripAliasPrefix(l);let r=l==="*"?[]:s[l]??[],i=Object.entries(s).filter(([d])=>this._eventResolvesTo(d,l)).flatMap(([,d])=>d??[]),u=s["*"]??[];return re.unique([...r,...i,...u]).sort((d,p)=>d.order-p.order).map(({handler:d})=>Ne.setName(p=>{let f=gt(p.data,{alias:this._runtime.alias}),y=this._getTools(p.client),b={};if(Td(p)){let B=ot({client:p.client,user:p.user,conversationId:p.conversation.id,pluginAlias:this._runtime.alias}),x=Kt({client:p.client,plugin:this._runtime,conversation:p.conversation});b={user:B,conversation:x}}return d({...p,data:f,...b,...y})},d.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let s=this._workflowHandlers[n];if(s)return new Proxy({},{get:(c,l)=>(s[l]?.sort((i,u)=>i.order-u.order)??[]).map(({handler:i})=>Ne.setName(async u=>{let g=u.workflow;return await i({...u,workflow:Qe({...u,workflow:g,onWorkflowUpdate(d){g=d},pluginAlias:this._runtime.alias}),...this._getTools(u.client)}),g},i.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=re.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=re.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=re.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=re.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=re.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=re.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=re.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},beforeIncomingCallAction:(e,n)=>{this._hookHandlers.before_incoming_call_action[e]=re.safePush(this._hookHandlers.before_incoming_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=re.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=re.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=re.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=re.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingCallAction:(e,n)=>{this._hookHandlers.after_incoming_call_action[e]=re.safePush(this._hookHandlers.after_incoming_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=re.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=re.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=re.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let[c,l]=e.split(":");if(!c||!l)return!1;let r=this._runtime.interfaces[c];if(r&&n===`${r.integrationAlias}:${r?.events?.[l]?.name}`)return!0;let i=this._runtime.integrations[c];return!!(i&&n===`${i.integrationAlias}:${l}`)};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let s=`${n}#`;return e.startsWith(s)?e.slice(s.length):e}};_();E();I();_();E();I();_();E();I();_();E();I();_();E();I();var Kc={};Pt(Kc,{allWithinMajorOf:()=>vd,allWithinMinorOf:()=>bd});_();E();I();import*as vn from"semver";function vd(t){let e=vn.major(t.version);return{...t,version:`>=${e}.0.0 <${e+1}.0.0`}}function bd(t){let e=vn.major(t.version),n=vn.minor(t.version);return{...t,version:`>=${e}.${n}.0 <${e}.${n+1}.0`}}_();E();I();export{Yi as Bot,qi as BotDefinition,Tn as BotLogger,Bt as BotSpecificClient,Gi as Integration,ai as IntegrationDefinition,yn as IntegrationLogger,gn as IntegrationSpecificClient,Ji as InterfaceDefinition,Xd as OAUTH_IDENTIFIER_HEADER,io as Plugin,Xi as PluginDefinition,N_ as RuntimeError,Jd as WELL_KNOWN_ATTRIBUTES,jl as errors,zn as handlerErrorToHttpResponse,D_ as isApiError,Ns as messages,nt as parseBody,Vn as serve,Kc as version,ee as z};
|
|
26
|
+
/*! Bundled license information:
|
|
27
|
+
|
|
28
|
+
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|
|
29
|
+
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
30
|
+
|
|
31
|
+
@jspm/core/nodelibs/browser/chunk-CcCWfKp1.js:
|
|
32
|
+
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
33
|
+
*/
|
|
34
|
+
//# sourceMappingURL=index.mjs.map
|