@botpress/sdk 4.0.7 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/dist/consts.d.ts +1 -0
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +4 -4
- package/dist/integration/definition/index.d.ts +1 -1
- package/dist/integration/definition/types.d.ts +1 -0
- package/dist/interface/definition.d.ts +9 -0
- package/dist/{const.d.ts → public-consts.d.ts} +8 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ var Mv=Object.create;var ei=Object.defineProperty;var Dv=Object.getOwnPropertyDe
|
|
|
7
7
|
`).substr(2):`
|
|
8
8
|
`+a.split(`
|
|
9
9
|
`).map(function(f){return" "+f}).join(`
|
|
10
|
-
`)):a=t.stylize("[Circular]","special")),An(i)){if(s&&o.match(/^\d+$/))return a;(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+a}function Sm(t){return Array.isArray(t)}function ys(t){return typeof t=="boolean"}function No(t){return t===null}function km(t){return typeof t=="number"}function Ro(t){return typeof t=="string"}function An(t){return t===void 0}function Lr(t){return lr(t)&&ms(t)==="[object RegExp]"}function lr(t){return typeof t=="object"&&t!==null}function Mo(t){return lr(t)&&ms(t)==="[object Date]"}function Fr(t){return lr(t)&&(ms(t)==="[object Error]"||t instanceof Error)}function ko(t){return typeof t=="function"}function ms(t){return Object.prototype.toString.call(t)}function cs(t){return t<10?"0"+t.toString(10):t.toString(10)}function RP(){var t=new Date,e=[cs(t.getHours()),cs(t.getMinutes()),cs(t.getSeconds())].join(":");return[t.getDate(),OP[t.getMonth()],e].join(" ")}function Im(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function MP(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var sm,qt,zt,sr,et,In,Gt,ar,So,Ke,cP,ps,Do,cm,fP,dP,pP,gP,yP,fm,dm,Jy,mP,hP,vP,pm,Ee,TP,_P,bP,gm,gs,_t,mt,wP,Ge,BP,PP,EP,Zr,L,Ot,am,IP,Po,Em,Eo,OP,kn,zA,Ho=it(()=>{C();R();O();sr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,et=sm={};(function(){try{qt=typeof setTimeout=="function"?setTimeout:fs}catch{qt=fs}try{zt=typeof clearTimeout=="function"?clearTimeout:ds}catch{zt=ds}})();Gt=[],ar=!1,So=-1;et.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];Gt.push(new Vy(t,e)),Gt.length!==1||ar||lm(um)},Vy.prototype.run=function(){(this||sr).fun.apply(null,(this||sr).array)},et.title="browser",et.browser=!0,et.env={},et.argv=[],et.version="",et.versions={},et.on=Wt,et.addListener=Wt,et.once=Wt,et.off=Wt,et.removeListener=Wt,et.removeAllListeners=Wt,et.emit=Wt,et.prependListener=Wt,et.prependOnceListener=Wt,et.listeners=function(t){return[]},et.binding=function(t){throw new Error("process.binding is not supported")},et.cwd=function(){return"/"},et.chdir=function(t){throw new Error("process.chdir is not supported")},et.umask=function(){return 0};Ke=sm;Ke.addListener;Ke.argv;Ke.binding;Ke.browser;Ke.chdir;Ke.cwd;Ke.emit;Ke.env;Ke.listeners;Ke.nextTick;Ke.off;Ke.on;Ke.once;Ke.prependListener;Ke.prependOnceListener;Ke.removeAllListeners;Ke.removeListener;Ke.title;Ke.umask;Ke.version;Ke.versions;cP=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ps=Object.prototype.toString,Do=function(t){return!(cP&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ps.call(t)==="[object Arguments]"},cm=function(t){return!!Do(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ps.call(t)!=="[object Array]"&&ps.call(t.callee)==="[object Function]"},fP=function(){return Do(arguments)}();Do.isLegacyArguments=cm;dP=fP?Do:cm,pP=Object.prototype.toString,gP=Function.prototype.toString,yP=/^\s*(?:function)?\*/,fm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",dm=Object.getPrototypeOf,Jy=function(){if(!fm)return!1;try{return Function("return function*() {}")()}catch{}}(),mP=Jy?dm(Jy):{},hP=function(t){return typeof t=="function"&&(!!yP.test(gP.call(t))||(fm?dm(t)===mP:pP.call(t)==="[object GeneratorFunction]"))},vP=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}},pm=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},TP=pm,_P=dP,bP=hP;gm=typeof BigInt<"u",gs=typeof Symbol<"u",_t=gs&&Symbol.toStringTag!==void 0,mt=typeof Uint8Array<"u",wP=typeof ArrayBuffer<"u";if(mt&&_t)var xP=Object.getPrototypeOf(Uint8Array.prototype),xt=Cn(Object.getOwnPropertyDescriptor(xP,Symbol.toStringTag).get);Ge=Cn(Object.prototype.toString),BP=Cn(Number.prototype.valueOf),PP=Cn(String.prototype.valueOf),EP=Cn(Boolean.prototype.valueOf);if(gm)var SP=Cn(BigInt.prototype.valueOf);if(gs)var kP=Cn(Symbol.prototype.valueOf);Ee.isArgumentsObject=_P,Ee.isGeneratorFunction=bP,Ee.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},Ee.isArrayBufferView=function(t){return wP&&ArrayBuffer.isView?ArrayBuffer.isView(t):Yy(t)||Qy(t)},Ee.isTypedArray=Yy,Ee.isUint8Array=ym,Ee.isUint8ClampedArray=mm,Ee.isUint16Array=hm,Ee.isUint32Array=vm,Ee.isInt8Array=Tm,Ee.isInt16Array=_m,Ee.isInt32Array=bm,Ee.isFloat32Array=wm,Ee.isFloat64Array=xm,Ee.isBigInt64Array=Bm,Ee.isBigUint64Array=Pm,wo.working=typeof Map<"u"&&wo(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(wo.working?wo(t):t instanceof Map)},xo.working=typeof Set<"u"&&xo(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(xo.working?xo(t):t instanceof Set)},Bo.working=typeof WeakMap<"u"&&Bo(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Bo.working?Bo(t):t instanceof WeakMap)},ss.working=typeof WeakSet<"u"&&ss(new WeakSet),Ee.isWeakSet=function(t){return ss(t)},Io.working=typeof ArrayBuffer<"u"&&Io(new ArrayBuffer),Ee.isArrayBuffer=Xy,Ao.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Ao(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=Qy,Co.working=typeof SharedArrayBuffer<"u"&&Co(new SharedArrayBuffer),Ee.isSharedArrayBuffer=em,Ee.isAsyncFunction=function(t){return Ge(t)==="[object AsyncFunction]"},Ee.isMapIterator=function(t){return Ge(t)==="[object Map Iterator]"},Ee.isSetIterator=function(t){return Ge(t)==="[object Set Iterator]"},Ee.isGeneratorObject=function(t){return Ge(t)==="[object Generator]"},Ee.isWebAssemblyCompiledModule=function(t){return Ge(t)==="[object WebAssembly.Module]"},Ee.isNumberObject=tm,Ee.isStringObject=nm,Ee.isBooleanObject=rm,Ee.isBigIntObject=im,Ee.isSymbolObject=om,Ee.isBoxedPrimitive=function(t){return tm(t)||nm(t)||rm(t)||im(t)||om(t)},Ee.isAnyArrayBuffer=function(t){return mt&&(Xy(t)||em(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})});Zr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Ot=Ke,am=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},IP=/%[sdj%]/g;L.format=function(t){if(!Ro(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(an(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(t).replace(IP,function(a){if(a==="%%")return"%";if(n>=o)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}}),i=r[n];n<o;i=r[++n])No(i)||!lr(i)?s+=" "+i:s+=" "+an(i);return s},L.deprecate=function(t,e){if(Ot!==void 0&&Ot.noDeprecation===!0)return t;if(Ot===void 0)return function(){return L.deprecate(t,e).apply(this||Zr,arguments)};var n=!1;return function(){if(!n){if(Ot.throwDeprecation)throw new Error(e);Ot.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Zr,arguments)}};Po={},Em=/^$/;Ot.env.NODE_DEBUG&&(Eo=Ot.env.NODE_DEBUG,Eo=Eo.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Em=new RegExp("^"+Eo+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Po[t])if(Em.test(t)){var e=Ot.pid;Po[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Po[t]=function(){};return Po[t]},L.inspect=an,an.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]},an.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=Sm,L.isBoolean=ys,L.isNull=No,L.isNullOrUndefined=function(t){return t==null},L.isNumber=km,L.isString=Ro,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=An,L.isRegExp=Lr,L.types.isRegExp=Lr,L.isObject=lr,L.isDate=Mo,L.types.isDate=Mo,L.isError=Fr,L.types.isNativeError=Fr,L.isFunction=ko,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=pm;OP=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",RP(),L.format.apply(L,arguments))},L.inherits=vP,L._extend=function(t,e){if(!e||!lr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};kn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;L.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(kn&&t[kn]){var e;if(typeof(e=t[kn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,kn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,o=new Promise(function(a,l){n=a,r=l}),s=[],i=0;i<arguments.length;i++)s.push(arguments[i]);s.push(function(a,l){a?r(a):n(l)});try{t.apply(this||Zr,s)}catch(a){r(a)}return o}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),kn&&Object.defineProperty(e,kn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,am(t))},L.promisify.custom=kn,L.callbackify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=n.pop();if(typeof o!="function")throw new TypeError("The last argument must be of type Function");var s=this||Zr,i=function(){return o.apply(s,arguments)};t.apply(this||Zr,n).then(function(a){Ot.nextTick(i.bind(null,null,a))},function(a){Ot.nextTick(MP.bind(null,a,i))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,am(t)),e};L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;L.promisify;L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;zA=L.promisify;L.types});var QA,Am=it(()=>{C();R();O();Ho();L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;QA=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function _s(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function DP(){!ur||!On||(ur=!1,On.length?Vt=On.concat(Vt):Uo=-1,Vt.length&&Cm())}function Cm(){if(!ur){var t=setTimeout(DP,0);ur=!0;for(var e=Vt.length;e;){for(On=Vt,Vt=[];++Uo<e;)On&&On[Uo].run();Uo=-1,e=Vt.length}On=null,ur=!1,clearTimeout(t)}}function NP(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 Om(t,e)),Vt.length===1&&!ur&&setTimeout(Cm,0)}function Om(t,e){this.fun=t,this.array=e}function st(){}function QP(t){_s("_linkedBinding")}function rE(t){_s("dlopen")}function iE(){return[]}function oE(){return[]}function gE(t,e){if(!t)throw new Error(e||"assertion error")}function vE(){return!1}function DE(){return sn.now()/1e3}function Ts(t){var e=Math.floor((Date.now()-sn.now())*.001),n=sn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=vs)),[r,o]}function ln(){return St}function zE(t){return[]}var Vt,ur,On,Uo,HP,UP,jP,$P,ZP,LP,FP,KP,WP,qP,zP,GP,VP,JP,YP,XP,eE,tE,nE,aE,sE,bs,lE,uE,cE,fE,dE,pE,yE,mE,hE,TE,_E,bE,wE,xE,BE,PE,EE,SE,kE,IE,AE,CE,OE,RE,ME,sn,hs,vs,NE,HE,UE,jE,$E,ZE,LE,FE,KE,WE,qE,St,ws=it(()=>{C();R();O();Vt=[],ur=!1,Uo=-1;Om.prototype.run=function(){this.fun.apply(null,this.array)};HP="browser",UP="x64",jP="browser",$P={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},ZP=["/usr/bin/node"],LP=[],FP="v16.8.0",KP={},WP=function(t,e){console.warn((e?e+": ":"")+t)},qP=function(t){_s("binding")},zP=function(t){return 0},GP=function(){return"/"},VP=function(t){},JP={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};YP=st,XP=[];eE={},tE=!1,nE={};aE=st,sE=st,bs=function(){return{}},lE=bs,uE=bs,cE=st,fE=st,dE=st,pE={};yE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},mE=st,hE=st;TE=st,_E=st,bE=st,wE=st,xE=st,BE=void 0,PE=void 0,EE=void 0,SE=st,kE=2,IE=1,AE="/bin/usr/node",CE=9229,OE="node",RE=[],ME=st,sn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};sn.now===void 0&&(hs=Date.now(),sn.timing&&sn.timing.navigationStart&&(hs=sn.timing.navigationStart),sn.now=()=>Date.now()-hs);vs=1e9;Ts.bigint=function(t){var e=Ts(t);return typeof BigInt>"u"?e[0]*vs+e[1]:BigInt(e[0]*vs)+BigInt(e[1])};NE=10,HE={},UE=0;jE=ln,$E=ln,ZE=ln,LE=ln,FE=ln,KE=st,WE=ln,qE=ln;St={version:FP,versions:KP,arch:UP,platform:jP,release:JP,_rawDebug:YP,moduleLoadList:XP,binding:qP,_linkedBinding:QP,_events:HE,_eventsCount:UE,_maxListeners:NE,on:ln,addListener:jE,once:$E,off:ZE,removeListener:LE,removeAllListeners:FE,emit:KE,prependListener:WE,prependOnceListener:qE,listeners:zE,domain:eE,_exiting:tE,config:nE,dlopen:rE,uptime:DE,_getActiveRequests:iE,_getActiveHandles:oE,reallyExit:aE,_kill:sE,cpuUsage:bs,resourceUsage:lE,memoryUsage:uE,kill:cE,exit:fE,openStdin:dE,allowedNodeEnvironmentFlags:pE,assert:gE,features:yE,_fatalExceptions:mE,setUncaughtExceptionCaptureCallback:hE,hasUncaughtExceptionCaptureCallback:vE,emitWarning:WP,nextTick:NP,_tickCallback:TE,_debugProcess:_E,_debugEnd:bE,_startProfilerIdleNotifier:wE,_stopProfilerIdleNotifier:xE,stdout:BE,stdin:EE,stderr:PE,abort:SE,umask:zP,chdir:VP,cwd:GP,env:$P,title:HP,argv:ZP,execArgv:LP,pid:kE,ppid:IE,execPath:AE,debugPort:CE,hrtime:Ts,argv0:OE,_preload_modules:RE,setSourceMapsEnabled:ME}});function Mm(){if(Rm)return xs;Rm=!0,xs=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function s(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this||Bs,arguments)}return s}function e(n){try{if(!Bs.localStorage)return!1}catch{return!1}var r=Bs.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return xs}var xs,Rm,Bs,Dm=it(()=>{C();R();O();xs={},Rm=!1,Bs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function GE(){if(Nm)return Wr;Nm=!0;var t=At(),e=t.Buffer;function n(o,s){for(var i in o)s[i]=o[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Wr=t:(n(t,Wr),Wr.Buffer=r);function r(o,s,i){return e(o,s,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(o,s,i){if(typeof o=="number")throw new TypeError("Argument must not be a number");return e(o,s,i)},r.alloc=function(o,s,i){if(typeof o!="number")throw new TypeError("Argument must be a number");var a=e(o);return s!==void 0?typeof i=="string"?a.fill(s,i):a.fill(s):a.fill(0),a},r.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e(o)},r.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)},Wr}function VE(){if(Hm)return Ps;Hm=!0;var t=GE().Buffer,e=t.isEncoding||function(T){switch(T=""+T,T&&T.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(T){if(!T)return"utf8";for(var S;;)switch(T){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return T;default:if(S)return;T=(""+T).toLowerCase(),S=!0}}function r(T){var S=n(T);if(typeof S!="string"&&(t.isEncoding===e||!e(T)))throw new Error("Unknown encoding: "+T);return S||T}Ps.StringDecoder=o;function o(T){this.encoding=r(T);var S;switch(this.encoding){case"utf16le":this.text=y,this.end=g,S=4;break;case"utf8":this.fillLast=l,S=4;break;case"base64":this.text=m,this.end=v,S=3;break;default:this.write=B,this.end=P;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}o.prototype.write=function(T){if(T.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(T),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<T.length?S?S+this.text(T,E):this.text(T,E):S||""},o.prototype.end=d,o.prototype.text=f,o.prototype.fillLast=function(T){if(this.lastNeed<=T.length)return T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,T.length),this.lastNeed-=T.length};function s(T){return T<=127?0:T>>5===6?2:T>>4===14?3:T>>3===30?4:T>>6===2?-1:-2}function i(T,S,E){var M=S.length-1;if(M<E)return 0;var $=s(S[M]);return $>=0?($>0&&(T.lastNeed=$-1),$):--M<E||$===-2?0:($=s(S[M]),$>=0?($>0&&(T.lastNeed=$-2),$):--M<E||$===-2?0:($=s(S[M]),$>=0?($>0&&($===2?$=0:T.lastNeed=$-3),$):0))}function a(T,S,E){if((S[0]&192)!==128)return T.lastNeed=0,"\uFFFD";if(T.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return T.lastNeed=1,"\uFFFD";if(T.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return T.lastNeed=2,"\uFFFD"}}function l(T){var S=this.lastTotal-this.lastNeed,E=a(this,T);if(E!==void 0)return E;if(this.lastNeed<=T.length)return T.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,S,0,T.length),this.lastNeed-=T.length}function f(T,S){var E=i(this,T,S);if(!this.lastNeed)return T.toString("utf8",S);this.lastTotal=E;var M=T.length-(E-this.lastNeed);return T.copy(this.lastChar,0,M),T.toString("utf8",S,M)}function d(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+"\uFFFD":S}function y(T,S){if((T.length-S)%2===0){var E=T.toString("utf16le",S);if(E){var M=E.charCodeAt(E.length-1);if(M>=55296&&M<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=T[T.length-1],T.toString("utf16le",S,T.length-1)}function g(T){var S=T&&T.length?this.write(T):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function m(T,S){var E=(T.length-S)%3;return E===0?T.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=T[T.length-1]:(this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1]),T.toString("base64",S,T.length-E))}function v(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function B(T){return T.toString(this.encoding)}function P(T){return T&&T.length?this.write(T):""}return Ps}var Wr,Nm,Ps,Hm,qr,pC,Um=it(()=>{C();R();O();oi();Wr={},Nm=!1;Ps={},Hm=!1;qr=VE();qr.StringDecoder;pC=qr.StringDecoder});function JE(){if(jm)return Es;jm=!0;var t=Es={},e,n;function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?n=clearTimeout:n=o}catch{n=o}})();function s(B){if(e===setTimeout)return setTimeout(B,0);if((e===r||!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||cr,B,0)}}}function i(B){if(n===clearTimeout)return clearTimeout(B);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(B);try{return n(B)}catch{try{return n.call(null,B)}catch{return n.call(this||cr,B)}}}var a=[],l=!1,f,d=-1;function y(){!l||!f||(l=!1,f.length?a=f.concat(a):d=-1,a.length&&g())}function g(){if(!l){var B=s(y);l=!0;for(var P=a.length;P;){for(f=a,a=[];++d<P;)f&&f[d].run();d=-1,P=a.length}f=null,l=!1,i(B)}}t.nextTick=function(B){var P=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)P[T-1]=arguments[T];a.push(new m(B,P)),a.length===1&&!l&&s(g)};function m(B,P){(this||cr).fun=B,(this||cr).array=P}m.prototype.run=function(){(this||cr).fun.apply(null,(this||cr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function v(){}return t.on=v,t.addListener=v,t.once=v,t.off=v,t.removeListener=v,t.removeAllListeners=v,t.emit=v,t.prependListener=v,t.prependOnceListener=v,t.listeners=function(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},Es}var Es,jm,cr,We,Ss=it(()=>{C();R();O();Es={},jm=!1,cr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;We=JE();We.platform="browser";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});function YE(){if($m)return ks;$m=!0;var t=We;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,f=-1,d=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||d===1))if(f!==g-1&&d===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var m=a.lastIndexOf("/");if(m!==a.length-1){m===-1?(a="",l=0):(a=a.slice(0,m),l=a.length-1-a.lastIndexOf("/")),f=g,d=0;continue}}else if(a.length===2||a.length===1){a="",l=0,f=g,d=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(f+1,g):a=s.slice(f+1,g),l=g-f-1;f=g,d=0}else y===46&&d!==-1?++d:d=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,f=arguments.length-1;f>=-1&&!a;f--){var d;f>=0?d=arguments[f]:(l===void 0&&(l=t.cwd()),d=l),e(d),d.length!==0&&(i=d+"/"+i,a=d.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,d=f-l,y=1;y<a.length&&a.charCodeAt(y)===47;++y);for(var g=a.length,m=g-y,v=d<m?d:m,B=-1,P=0;P<=v;++P){if(P===v){if(m>v){if(a.charCodeAt(y+P)===47)return a.slice(y+P+1);if(P===0)return a.slice(y+P)}else d>v&&(i.charCodeAt(l+P)===47?B=P:P===0&&(B=0));break}var T=i.charCodeAt(l+P),S=a.charCodeAt(y+P);if(T!==S)break;T===47&&(B=P)}var E="";for(P=l+B+1;P<=f;++P)(P===f||i.charCodeAt(P)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+a.slice(y+B):(y+=B,a.charCodeAt(y)===47&&++y,a.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,f=-1,d=!0,y=i.length-1;y>=1;--y)if(a=i.charCodeAt(y),a===47){if(!d){f=y;break}}else d=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,d=!0,y;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var g=a.length-1,m=-1;for(y=i.length-1;y>=0;--y){var v=i.charCodeAt(y);if(v===47){if(!d){l=y+1;break}}else m===-1&&(d=!1,m=y+1),g>=0&&(v===a.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=m))}return l===f?f=m:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!d){l=y+1;break}}else f===-1&&(d=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var a=-1,l=0,f=-1,d=!0,y=0,g=i.length-1;g>=0;--g){var m=i.charCodeAt(g);if(m===47){if(!d){l=g+1;break}continue}f===-1&&(d=!1,f=g+1),m===46?a===-1?a=g:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||f===-1||y===0||y===1&&a===f-1&&a===l+1?"":i.slice(a,f)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),f=l===47,d;f?(a.root="/",d=1):d=0;for(var y=-1,g=0,m=-1,v=!0,B=i.length-1,P=0;B>=d;--B){if(l=i.charCodeAt(B),l===47){if(!v){g=B+1;break}continue}m===-1&&(v=!1,m=B+1),l===46?y===-1?y=B:P!==1&&(P=1):y!==-1&&(P=-1)}return y===-1||m===-1||P===0||P===1&&y===m-1&&y===g+1?m!==-1&&(g===0&&f?a.base=a.name=i.slice(1,m):a.base=a.name=i.slice(g,m)):(g===0&&f?(a.name=i.slice(1,y),a.base=i.slice(1,m)):(a.name=i.slice(g,y),a.base=i.slice(g,m)),a.ext=i.slice(y,m)),g>0?a.dir=i.slice(0,g-1):f&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,ks=o,ks}function Rn(t){throw new RangeError(tS[t])}function Lm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let o=function(s,i){let a=[],l=s.length;for(;l--;)a[l]=i(s[l]);return a}((t=t.replace(eS,".")).split("."),e).join(".");return r+o}function Ym(t){let e=[],n=0,r=t.length;for(;n<r;){let o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&o)<<10)+(1023&s)+65536):(e.push(o),n--)}else e.push(o)}return e}function rS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Bt(){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 Gr(t,e,n){if(t&&Rt.isObject(t)&&t instanceof Bt)return t;var r=new Bt;return r.parse(t,e,n),r}function pS(){if(Vm)return Os;Vm=!0;var t=Ke;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,f=-1,d=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||d===1))if(f!==g-1&&d===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var m=a.lastIndexOf("/");if(m!==a.length-1){m===-1?(a="",l=0):(a=a.slice(0,m),l=a.length-1-a.lastIndexOf("/")),f=g,d=0;continue}}else if(a.length===2||a.length===1){a="",l=0,f=g,d=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(f+1,g):a=s.slice(f+1,g),l=g-f-1;f=g,d=0}else y===46&&d!==-1?++d:d=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,f=arguments.length-1;f>=-1&&!a;f--){var d;f>=0?d=arguments[f]:(l===void 0&&(l=t.cwd()),d=l),e(d),d.length!==0&&(i=d+"/"+i,a=d.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,d=f-l,y=1;y<a.length&&a.charCodeAt(y)===47;++y);for(var g=a.length,m=g-y,v=d<m?d:m,B=-1,P=0;P<=v;++P){if(P===v){if(m>v){if(a.charCodeAt(y+P)===47)return a.slice(y+P+1);if(P===0)return a.slice(y+P)}else d>v&&(i.charCodeAt(l+P)===47?B=P:P===0&&(B=0));break}var T=i.charCodeAt(l+P),S=a.charCodeAt(y+P);if(T!==S)break;T===47&&(B=P)}var E="";for(P=l+B+1;P<=f;++P)(P===f||i.charCodeAt(P)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+a.slice(y+B):(y+=B,a.charCodeAt(y)===47&&++y,a.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,f=-1,d=!0,y=i.length-1;y>=1;--y)if(a=i.charCodeAt(y),a===47){if(!d){f=y;break}}else d=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,d=!0,y;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var g=a.length-1,m=-1;for(y=i.length-1;y>=0;--y){var v=i.charCodeAt(y);if(v===47){if(!d){l=y+1;break}}else m===-1&&(d=!1,m=y+1),g>=0&&(v===a.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=m))}return l===f?f=m:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!d){l=y+1;break}}else f===-1&&(d=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var a=-1,l=0,f=-1,d=!0,y=0,g=i.length-1;g>=0;--g){var m=i.charCodeAt(g);if(m===47){if(!d){l=g+1;break}continue}f===-1&&(d=!1,f=g+1),m===46?a===-1?a=g:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||f===-1||y===0||y===1&&a===f-1&&a===l+1?"":i.slice(a,f)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),f=l===47,d;f?(a.root="/",d=1):d=0;for(var y=-1,g=0,m=-1,v=!0,B=i.length-1,P=0;B>=d;--B){if(l=i.charCodeAt(B),l===47){if(!v){g=B+1;break}continue}m===-1&&(v=!1,m=B+1),l===46?y===-1?y=B:P!==1&&(P=1):y!==-1&&(P=-1)}return y===-1||m===-1||P===0||P===1&&y===m-1&&y===g+1?m!==-1&&(g===0&&f?a.base=a.name=i.slice(1,m):a.base=a.name=i.slice(g,m)):(g===0&&f?(a.name=i.slice(1,y),a.base=i.slice(1,m)):(a.name=i.slice(g,y),a.base=i.slice(g,m)),a.ext=i.slice(y,m)),g>0?a.dir=i.slice(0,g-1):f&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Os=o,Os}function PS(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Ms?ES(t):SS(t)}function ES(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(TS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<hS||r>vS||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function SS(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function kS(t){let e=Jm.resolve(t),n=t.charCodeAt(t.length-1);(n===mS||Ms&&n===yS)&&e[e.length-1]!==Jm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(_S,"%25")),!Ms&&e.includes("\\")&&(e=e.replace(bS,"%5C")),e.includes(`
|
|
10
|
+
`)):a=t.stylize("[Circular]","special")),An(i)){if(s&&o.match(/^\d+$/))return a;(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=t.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=t.stylize(i,"string"))}return i+": "+a}function Sm(t){return Array.isArray(t)}function ys(t){return typeof t=="boolean"}function No(t){return t===null}function km(t){return typeof t=="number"}function Ro(t){return typeof t=="string"}function An(t){return t===void 0}function Lr(t){return lr(t)&&ms(t)==="[object RegExp]"}function lr(t){return typeof t=="object"&&t!==null}function Mo(t){return lr(t)&&ms(t)==="[object Date]"}function Fr(t){return lr(t)&&(ms(t)==="[object Error]"||t instanceof Error)}function ko(t){return typeof t=="function"}function ms(t){return Object.prototype.toString.call(t)}function cs(t){return t<10?"0"+t.toString(10):t.toString(10)}function RP(){var t=new Date,e=[cs(t.getHours()),cs(t.getMinutes()),cs(t.getSeconds())].join(":");return[t.getDate(),OP[t.getMonth()],e].join(" ")}function Im(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function MP(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}var sm,qt,zt,sr,et,In,Gt,ar,So,Ke,cP,ps,Do,cm,fP,dP,pP,gP,yP,fm,dm,Jy,mP,hP,vP,pm,Ee,TP,_P,bP,gm,gs,_t,mt,wP,Ge,BP,PP,EP,Zr,L,Ot,am,IP,Po,Em,Eo,OP,kn,GA,Ho=it(()=>{C();R();O();sr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,et=sm={};(function(){try{qt=typeof setTimeout=="function"?setTimeout:fs}catch{qt=fs}try{zt=typeof clearTimeout=="function"?clearTimeout:ds}catch{zt=ds}})();Gt=[],ar=!1,So=-1;et.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];Gt.push(new Vy(t,e)),Gt.length!==1||ar||lm(um)},Vy.prototype.run=function(){(this||sr).fun.apply(null,(this||sr).array)},et.title="browser",et.browser=!0,et.env={},et.argv=[],et.version="",et.versions={},et.on=Wt,et.addListener=Wt,et.once=Wt,et.off=Wt,et.removeListener=Wt,et.removeAllListeners=Wt,et.emit=Wt,et.prependListener=Wt,et.prependOnceListener=Wt,et.listeners=function(t){return[]},et.binding=function(t){throw new Error("process.binding is not supported")},et.cwd=function(){return"/"},et.chdir=function(t){throw new Error("process.chdir is not supported")},et.umask=function(){return 0};Ke=sm;Ke.addListener;Ke.argv;Ke.binding;Ke.browser;Ke.chdir;Ke.cwd;Ke.emit;Ke.env;Ke.listeners;Ke.nextTick;Ke.off;Ke.on;Ke.once;Ke.prependListener;Ke.prependOnceListener;Ke.removeAllListeners;Ke.removeListener;Ke.title;Ke.umask;Ke.version;Ke.versions;cP=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",ps=Object.prototype.toString,Do=function(t){return!(cP&&t&&typeof t=="object"&&Symbol.toStringTag in t)&&ps.call(t)==="[object Arguments]"},cm=function(t){return!!Do(t)||t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&ps.call(t)!=="[object Array]"&&ps.call(t.callee)==="[object Function]"},fP=function(){return Do(arguments)}();Do.isLegacyArguments=cm;dP=fP?Do:cm,pP=Object.prototype.toString,gP=Function.prototype.toString,yP=/^\s*(?:function)?\*/,fm=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",dm=Object.getPrototypeOf,Jy=function(){if(!fm)return!1;try{return Function("return function*() {}")()}catch{}}(),mP=Jy?dm(Jy):{},hP=function(t){return typeof t=="function"&&(!!yP.test(gP.call(t))||(fm?dm(t)===mP:pP.call(t)==="[object GeneratorFunction]"))},vP=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}},pm=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ee={},TP=pm,_P=dP,bP=hP;gm=typeof BigInt<"u",gs=typeof Symbol<"u",_t=gs&&Symbol.toStringTag!==void 0,mt=typeof Uint8Array<"u",wP=typeof ArrayBuffer<"u";if(mt&&_t)var xP=Object.getPrototypeOf(Uint8Array.prototype),xt=Cn(Object.getOwnPropertyDescriptor(xP,Symbol.toStringTag).get);Ge=Cn(Object.prototype.toString),BP=Cn(Number.prototype.valueOf),PP=Cn(String.prototype.valueOf),EP=Cn(Boolean.prototype.valueOf);if(gm)var SP=Cn(BigInt.prototype.valueOf);if(gs)var kP=Cn(Symbol.prototype.valueOf);Ee.isArgumentsObject=_P,Ee.isGeneratorFunction=bP,Ee.isPromise=function(t){return typeof Promise<"u"&&t instanceof Promise||t!==null&&typeof t=="object"&&typeof t.then=="function"&&typeof t.catch=="function"},Ee.isArrayBufferView=function(t){return wP&&ArrayBuffer.isView?ArrayBuffer.isView(t):Yy(t)||Qy(t)},Ee.isTypedArray=Yy,Ee.isUint8Array=ym,Ee.isUint8ClampedArray=mm,Ee.isUint16Array=hm,Ee.isUint32Array=vm,Ee.isInt8Array=Tm,Ee.isInt16Array=_m,Ee.isInt32Array=bm,Ee.isFloat32Array=wm,Ee.isFloat64Array=xm,Ee.isBigInt64Array=Bm,Ee.isBigUint64Array=Pm,wo.working=typeof Map<"u"&&wo(new Map),Ee.isMap=function(t){return typeof Map<"u"&&(wo.working?wo(t):t instanceof Map)},xo.working=typeof Set<"u"&&xo(new Set),Ee.isSet=function(t){return typeof Set<"u"&&(xo.working?xo(t):t instanceof Set)},Bo.working=typeof WeakMap<"u"&&Bo(new WeakMap),Ee.isWeakMap=function(t){return typeof WeakMap<"u"&&(Bo.working?Bo(t):t instanceof WeakMap)},ss.working=typeof WeakSet<"u"&&ss(new WeakSet),Ee.isWeakSet=function(t){return ss(t)},Io.working=typeof ArrayBuffer<"u"&&Io(new ArrayBuffer),Ee.isArrayBuffer=Xy,Ao.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Ao(new DataView(new ArrayBuffer(1),0,1)),Ee.isDataView=Qy,Co.working=typeof SharedArrayBuffer<"u"&&Co(new SharedArrayBuffer),Ee.isSharedArrayBuffer=em,Ee.isAsyncFunction=function(t){return Ge(t)==="[object AsyncFunction]"},Ee.isMapIterator=function(t){return Ge(t)==="[object Map Iterator]"},Ee.isSetIterator=function(t){return Ge(t)==="[object Set Iterator]"},Ee.isGeneratorObject=function(t){return Ge(t)==="[object Generator]"},Ee.isWebAssemblyCompiledModule=function(t){return Ge(t)==="[object WebAssembly.Module]"},Ee.isNumberObject=tm,Ee.isStringObject=nm,Ee.isBooleanObject=rm,Ee.isBigIntObject=im,Ee.isSymbolObject=om,Ee.isBoxedPrimitive=function(t){return tm(t)||nm(t)||rm(t)||im(t)||om(t)},Ee.isAnyArrayBuffer=function(t){return mt&&(Xy(t)||em(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(t){Object.defineProperty(Ee,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})});Zr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,L={},Ot=Ke,am=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},IP=/%[sdj%]/g;L.format=function(t){if(!Ro(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(an(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(t).replace(IP,function(a){if(a==="%%")return"%";if(n>=o)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}}),i=r[n];n<o;i=r[++n])No(i)||!lr(i)?s+=" "+i:s+=" "+an(i);return s},L.deprecate=function(t,e){if(Ot!==void 0&&Ot.noDeprecation===!0)return t;if(Ot===void 0)return function(){return L.deprecate(t,e).apply(this||Zr,arguments)};var n=!1;return function(){if(!n){if(Ot.throwDeprecation)throw new Error(e);Ot.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this||Zr,arguments)}};Po={},Em=/^$/;Ot.env.NODE_DEBUG&&(Eo=Ot.env.NODE_DEBUG,Eo=Eo.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),Em=new RegExp("^"+Eo+"$","i"));L.debuglog=function(t){if(t=t.toUpperCase(),!Po[t])if(Em.test(t)){var e=Ot.pid;Po[t]=function(){var n=L.format.apply(L,arguments);console.error("%s %d: %s",t,e,n)}}else Po[t]=function(){};return Po[t]},L.inspect=an,an.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]},an.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},L.types=Ee,L.isArray=Sm,L.isBoolean=ys,L.isNull=No,L.isNullOrUndefined=function(t){return t==null},L.isNumber=km,L.isString=Ro,L.isSymbol=function(t){return typeof t=="symbol"},L.isUndefined=An,L.isRegExp=Lr,L.types.isRegExp=Lr,L.isObject=lr,L.isDate=Mo,L.types.isDate=Mo,L.isError=Fr,L.types.isNativeError=Fr,L.isFunction=ko,L.isPrimitive=function(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0},L.isBuffer=pm;OP=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];L.log=function(){console.log("%s - %s",RP(),L.format.apply(L,arguments))},L.inherits=vP,L._extend=function(t,e){if(!e||!lr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};kn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;L.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(kn&&t[kn]){var e;if(typeof(e=t[kn])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,kn,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var n,r,o=new Promise(function(a,l){n=a,r=l}),s=[],i=0;i<arguments.length;i++)s.push(arguments[i]);s.push(function(a,l){a?r(a):n(l)});try{t.apply(this||Zr,s)}catch(a){r(a)}return o}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),kn&&Object.defineProperty(e,kn,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,am(t))},L.promisify.custom=kn,L.callbackify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=n.pop();if(typeof o!="function")throw new TypeError("The last argument must be of type Function");var s=this||Zr,i=function(){return o.apply(s,arguments)};t.apply(this||Zr,n).then(function(a){Ot.nextTick(i.bind(null,null,a))},function(a){Ot.nextTick(MP.bind(null,a,i))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,am(t)),e};L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;L.promisify;L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;GA=L.promisify;L.types});var eC,Am=it(()=>{C();R();O();Ho();L._extend;L.callbackify;L.debuglog;L.deprecate;L.format;L.inherits;L.inspect;L.isArray;L.isBoolean;L.isBuffer;L.isDate;L.isError;L.isFunction;L.isNull;L.isNullOrUndefined;L.isNumber;L.isObject;L.isPrimitive;L.isRegExp;L.isString;L.isSymbol;L.isUndefined;L.log;eC=L.promisify;L.types;L.TextEncoder=globalThis.TextEncoder;L.TextDecoder=globalThis.TextDecoder});function _s(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function DP(){!ur||!On||(ur=!1,On.length?Vt=On.concat(Vt):Uo=-1,Vt.length&&Cm())}function Cm(){if(!ur){var t=setTimeout(DP,0);ur=!0;for(var e=Vt.length;e;){for(On=Vt,Vt=[];++Uo<e;)On&&On[Uo].run();Uo=-1,e=Vt.length}On=null,ur=!1,clearTimeout(t)}}function NP(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 Om(t,e)),Vt.length===1&&!ur&&setTimeout(Cm,0)}function Om(t,e){this.fun=t,this.array=e}function st(){}function QP(t){_s("_linkedBinding")}function rE(t){_s("dlopen")}function iE(){return[]}function oE(){return[]}function gE(t,e){if(!t)throw new Error(e||"assertion error")}function vE(){return!1}function DE(){return sn.now()/1e3}function Ts(t){var e=Math.floor((Date.now()-sn.now())*.001),n=sn.now()*.001,r=Math.floor(n)+e,o=Math.floor(n%1*1e9);return t&&(r=r-t[0],o=o-t[1],o<0&&(r--,o+=vs)),[r,o]}function ln(){return St}function zE(t){return[]}var Vt,ur,On,Uo,HP,UP,jP,$P,ZP,LP,FP,KP,WP,qP,zP,GP,VP,JP,YP,XP,eE,tE,nE,aE,sE,bs,lE,uE,cE,fE,dE,pE,yE,mE,hE,TE,_E,bE,wE,xE,BE,PE,EE,SE,kE,IE,AE,CE,OE,RE,ME,sn,hs,vs,NE,HE,UE,jE,$E,ZE,LE,FE,KE,WE,qE,St,ws=it(()=>{C();R();O();Vt=[],ur=!1,Uo=-1;Om.prototype.run=function(){this.fun.apply(null,this.array)};HP="browser",UP="x64",jP="browser",$P={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},ZP=["/usr/bin/node"],LP=[],FP="v16.8.0",KP={},WP=function(t,e){console.warn((e?e+": ":"")+t)},qP=function(t){_s("binding")},zP=function(t){return 0},GP=function(){return"/"},VP=function(t){},JP={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};YP=st,XP=[];eE={},tE=!1,nE={};aE=st,sE=st,bs=function(){return{}},lE=bs,uE=bs,cE=st,fE=st,dE=st,pE={};yE={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},mE=st,hE=st;TE=st,_E=st,bE=st,wE=st,xE=st,BE=void 0,PE=void 0,EE=void 0,SE=st,kE=2,IE=1,AE="/bin/usr/node",CE=9229,OE="node",RE=[],ME=st,sn={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};sn.now===void 0&&(hs=Date.now(),sn.timing&&sn.timing.navigationStart&&(hs=sn.timing.navigationStart),sn.now=()=>Date.now()-hs);vs=1e9;Ts.bigint=function(t){var e=Ts(t);return typeof BigInt>"u"?e[0]*vs+e[1]:BigInt(e[0]*vs)+BigInt(e[1])};NE=10,HE={},UE=0;jE=ln,$E=ln,ZE=ln,LE=ln,FE=ln,KE=st,WE=ln,qE=ln;St={version:FP,versions:KP,arch:UP,platform:jP,release:JP,_rawDebug:YP,moduleLoadList:XP,binding:qP,_linkedBinding:QP,_events:HE,_eventsCount:UE,_maxListeners:NE,on:ln,addListener:jE,once:$E,off:ZE,removeListener:LE,removeAllListeners:FE,emit:KE,prependListener:WE,prependOnceListener:qE,listeners:zE,domain:eE,_exiting:tE,config:nE,dlopen:rE,uptime:DE,_getActiveRequests:iE,_getActiveHandles:oE,reallyExit:aE,_kill:sE,cpuUsage:bs,resourceUsage:lE,memoryUsage:uE,kill:cE,exit:fE,openStdin:dE,allowedNodeEnvironmentFlags:pE,assert:gE,features:yE,_fatalExceptions:mE,setUncaughtExceptionCaptureCallback:hE,hasUncaughtExceptionCaptureCallback:vE,emitWarning:WP,nextTick:NP,_tickCallback:TE,_debugProcess:_E,_debugEnd:bE,_startProfilerIdleNotifier:wE,_stopProfilerIdleNotifier:xE,stdout:BE,stdin:EE,stderr:PE,abort:SE,umask:zP,chdir:VP,cwd:GP,env:$P,title:HP,argv:ZP,execArgv:LP,pid:kE,ppid:IE,execPath:AE,debugPort:CE,hrtime:Ts,argv0:OE,_preload_modules:RE,setSourceMapsEnabled:ME}});function Mm(){if(Rm)return xs;Rm=!0,xs=t;function t(n,r){if(e("noDeprecation"))return n;var o=!1;function s(){if(!o){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),o=!0}return n.apply(this||Bs,arguments)}return s}function e(n){try{if(!Bs.localStorage)return!1}catch{return!1}var r=Bs.localStorage[n];return r==null?!1:String(r).toLowerCase()==="true"}return xs}var xs,Rm,Bs,Dm=it(()=>{C();R();O();xs={},Rm=!1,Bs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global});function GE(){if(Nm)return Wr;Nm=!0;var t=At(),e=t.Buffer;function n(o,s){for(var i in o)s[i]=o[i]}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?Wr=t:(n(t,Wr),Wr.Buffer=r);function r(o,s,i){return e(o,s,i)}return r.prototype=Object.create(e.prototype),n(e,r),r.from=function(o,s,i){if(typeof o=="number")throw new TypeError("Argument must not be a number");return e(o,s,i)},r.alloc=function(o,s,i){if(typeof o!="number")throw new TypeError("Argument must be a number");var a=e(o);return s!==void 0?typeof i=="string"?a.fill(s,i):a.fill(s):a.fill(0),a},r.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e(o)},r.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(o)},Wr}function VE(){if(Hm)return Ps;Hm=!0;var t=GE().Buffer,e=t.isEncoding||function(T){switch(T=""+T,T&&T.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(T){if(!T)return"utf8";for(var S;;)switch(T){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return T;default:if(S)return;T=(""+T).toLowerCase(),S=!0}}function r(T){var S=n(T);if(typeof S!="string"&&(t.isEncoding===e||!e(T)))throw new Error("Unknown encoding: "+T);return S||T}Ps.StringDecoder=o;function o(T){this.encoding=r(T);var S;switch(this.encoding){case"utf16le":this.text=y,this.end=g,S=4;break;case"utf8":this.fillLast=l,S=4;break;case"base64":this.text=m,this.end=v,S=3;break;default:this.write=B,this.end=P;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(S)}o.prototype.write=function(T){if(T.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(T),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<T.length?S?S+this.text(T,E):this.text(T,E):S||""},o.prototype.end=d,o.prototype.text=f,o.prototype.fillLast=function(T){if(this.lastNeed<=T.length)return T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,this.lastTotal-this.lastNeed,0,T.length),this.lastNeed-=T.length};function s(T){return T<=127?0:T>>5===6?2:T>>4===14?3:T>>3===30?4:T>>6===2?-1:-2}function i(T,S,E){var M=S.length-1;if(M<E)return 0;var $=s(S[M]);return $>=0?($>0&&(T.lastNeed=$-1),$):--M<E||$===-2?0:($=s(S[M]),$>=0?($>0&&(T.lastNeed=$-2),$):--M<E||$===-2?0:($=s(S[M]),$>=0?($>0&&($===2?$=0:T.lastNeed=$-3),$):0))}function a(T,S,E){if((S[0]&192)!==128)return T.lastNeed=0,"\uFFFD";if(T.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return T.lastNeed=1,"\uFFFD";if(T.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return T.lastNeed=2,"\uFFFD"}}function l(T){var S=this.lastTotal-this.lastNeed,E=a(this,T);if(E!==void 0)return E;if(this.lastNeed<=T.length)return T.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);T.copy(this.lastChar,S,0,T.length),this.lastNeed-=T.length}function f(T,S){var E=i(this,T,S);if(!this.lastNeed)return T.toString("utf8",S);this.lastTotal=E;var M=T.length-(E-this.lastNeed);return T.copy(this.lastChar,0,M),T.toString("utf8",S,M)}function d(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+"\uFFFD":S}function y(T,S){if((T.length-S)%2===0){var E=T.toString("utf16le",S);if(E){var M=E.charCodeAt(E.length-1);if(M>=55296&&M<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=T[T.length-1],T.toString("utf16le",S,T.length-1)}function g(T){var S=T&&T.length?this.write(T):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function m(T,S){var E=(T.length-S)%3;return E===0?T.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=T[T.length-1]:(this.lastChar[0]=T[T.length-2],this.lastChar[1]=T[T.length-1]),T.toString("base64",S,T.length-E))}function v(T){var S=T&&T.length?this.write(T):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function B(T){return T.toString(this.encoding)}function P(T){return T&&T.length?this.write(T):""}return Ps}var Wr,Nm,Ps,Hm,qr,gC,Um=it(()=>{C();R();O();oi();Wr={},Nm=!1;Ps={},Hm=!1;qr=VE();qr.StringDecoder;gC=qr.StringDecoder});function JE(){if(jm)return Es;jm=!0;var t=Es={},e,n;function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?n=clearTimeout:n=o}catch{n=o}})();function s(B){if(e===setTimeout)return setTimeout(B,0);if((e===r||!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||cr,B,0)}}}function i(B){if(n===clearTimeout)return clearTimeout(B);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(B);try{return n(B)}catch{try{return n.call(null,B)}catch{return n.call(this||cr,B)}}}var a=[],l=!1,f,d=-1;function y(){!l||!f||(l=!1,f.length?a=f.concat(a):d=-1,a.length&&g())}function g(){if(!l){var B=s(y);l=!0;for(var P=a.length;P;){for(f=a,a=[];++d<P;)f&&f[d].run();d=-1,P=a.length}f=null,l=!1,i(B)}}t.nextTick=function(B){var P=new Array(arguments.length-1);if(arguments.length>1)for(var T=1;T<arguments.length;T++)P[T-1]=arguments[T];a.push(new m(B,P)),a.length===1&&!l&&s(g)};function m(B,P){(this||cr).fun=B,(this||cr).array=P}m.prototype.run=function(){(this||cr).fun.apply(null,(this||cr).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function v(){}return t.on=v,t.addListener=v,t.once=v,t.off=v,t.removeListener=v,t.removeAllListeners=v,t.emit=v,t.prependListener=v,t.prependOnceListener=v,t.listeners=function(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},Es}var Es,jm,cr,We,Ss=it(()=>{C();R();O();Es={},jm=!1,cr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;We=JE();We.platform="browser";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});function YE(){if($m)return ks;$m=!0;var t=We;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,f=-1,d=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||d===1))if(f!==g-1&&d===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var m=a.lastIndexOf("/");if(m!==a.length-1){m===-1?(a="",l=0):(a=a.slice(0,m),l=a.length-1-a.lastIndexOf("/")),f=g,d=0;continue}}else if(a.length===2||a.length===1){a="",l=0,f=g,d=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(f+1,g):a=s.slice(f+1,g),l=g-f-1;f=g,d=0}else y===46&&d!==-1?++d:d=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,f=arguments.length-1;f>=-1&&!a;f--){var d;f>=0?d=arguments[f]:(l===void 0&&(l=t.cwd()),d=l),e(d),d.length!==0&&(i=d+"/"+i,a=d.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,d=f-l,y=1;y<a.length&&a.charCodeAt(y)===47;++y);for(var g=a.length,m=g-y,v=d<m?d:m,B=-1,P=0;P<=v;++P){if(P===v){if(m>v){if(a.charCodeAt(y+P)===47)return a.slice(y+P+1);if(P===0)return a.slice(y+P)}else d>v&&(i.charCodeAt(l+P)===47?B=P:P===0&&(B=0));break}var T=i.charCodeAt(l+P),S=a.charCodeAt(y+P);if(T!==S)break;T===47&&(B=P)}var E="";for(P=l+B+1;P<=f;++P)(P===f||i.charCodeAt(P)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+a.slice(y+B):(y+=B,a.charCodeAt(y)===47&&++y,a.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,f=-1,d=!0,y=i.length-1;y>=1;--y)if(a=i.charCodeAt(y),a===47){if(!d){f=y;break}}else d=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,d=!0,y;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var g=a.length-1,m=-1;for(y=i.length-1;y>=0;--y){var v=i.charCodeAt(y);if(v===47){if(!d){l=y+1;break}}else m===-1&&(d=!1,m=y+1),g>=0&&(v===a.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=m))}return l===f?f=m:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!d){l=y+1;break}}else f===-1&&(d=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var a=-1,l=0,f=-1,d=!0,y=0,g=i.length-1;g>=0;--g){var m=i.charCodeAt(g);if(m===47){if(!d){l=g+1;break}continue}f===-1&&(d=!1,f=g+1),m===46?a===-1?a=g:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||f===-1||y===0||y===1&&a===f-1&&a===l+1?"":i.slice(a,f)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),f=l===47,d;f?(a.root="/",d=1):d=0;for(var y=-1,g=0,m=-1,v=!0,B=i.length-1,P=0;B>=d;--B){if(l=i.charCodeAt(B),l===47){if(!v){g=B+1;break}continue}m===-1&&(v=!1,m=B+1),l===46?y===-1?y=B:P!==1&&(P=1):y!==-1&&(P=-1)}return y===-1||m===-1||P===0||P===1&&y===m-1&&y===g+1?m!==-1&&(g===0&&f?a.base=a.name=i.slice(1,m):a.base=a.name=i.slice(g,m)):(g===0&&f?(a.name=i.slice(1,y),a.base=i.slice(1,m)):(a.name=i.slice(g,y),a.base=i.slice(g,m)),a.ext=i.slice(y,m)),g>0?a.dir=i.slice(0,g-1):f&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,ks=o,ks}function Rn(t){throw new RangeError(tS[t])}function Lm(t,e){let n=t.split("@"),r="";n.length>1&&(r=n[0]+"@",t=n[1]);let o=function(s,i){let a=[],l=s.length;for(;l--;)a[l]=i(s[l]);return a}((t=t.replace(eS,".")).split("."),e).join(".");return r+o}function Ym(t){let e=[],n=0,r=t.length;for(;n<r;){let o=t.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){let s=t.charCodeAt(n++);(64512&s)==56320?e.push(((1023&o)<<10)+(1023&s)+65536):(e.push(o),n--)}else e.push(o)}return e}function rS(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Bt(){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 Gr(t,e,n){if(t&&Rt.isObject(t)&&t instanceof Bt)return t;var r=new Bt;return r.parse(t,e,n),r}function pS(){if(Vm)return Os;Vm=!0;var t=Ke;function e(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function n(s,i){for(var a="",l=0,f=-1,d=0,y,g=0;g<=s.length;++g){if(g<s.length)y=s.charCodeAt(g);else{if(y===47)break;y=47}if(y===47){if(!(f===g-1||d===1))if(f!==g-1&&d===2){if(a.length<2||l!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var m=a.lastIndexOf("/");if(m!==a.length-1){m===-1?(a="",l=0):(a=a.slice(0,m),l=a.length-1-a.lastIndexOf("/")),f=g,d=0;continue}}else if(a.length===2||a.length===1){a="",l=0,f=g,d=0;continue}}i&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+s.slice(f+1,g):a=s.slice(f+1,g),l=g-f-1;f=g,d=0}else y===46&&d!==-1?++d:d=-1}return a}function r(s,i){var a=i.dir||i.root,l=i.base||(i.name||"")+(i.ext||"");return a?a===i.root?a+l:a+s+l:l}var o={resolve:function(){for(var i="",a=!1,l,f=arguments.length-1;f>=-1&&!a;f--){var d;f>=0?d=arguments[f]:(l===void 0&&(l=t.cwd()),d=l),e(d),d.length!==0&&(i=d+"/"+i,a=d.charCodeAt(0)===47)}return i=n(i,!a),a?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(e(i),i.length===0)return".";var a=i.charCodeAt(0)===47,l=i.charCodeAt(i.length-1)===47;return i=n(i,!a),i.length===0&&!a&&(i="."),i.length>0&&l&&(i+="/"),a?"/"+i:i},isAbsolute:function(i){return e(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,a=0;a<arguments.length;++a){var l=arguments[a];e(l),l.length>0&&(i===void 0?i=l:i+="/"+l)}return i===void 0?".":o.normalize(i)},relative:function(i,a){if(e(i),e(a),i===a||(i=o.resolve(i),a=o.resolve(a),i===a))return"";for(var l=1;l<i.length&&i.charCodeAt(l)===47;++l);for(var f=i.length,d=f-l,y=1;y<a.length&&a.charCodeAt(y)===47;++y);for(var g=a.length,m=g-y,v=d<m?d:m,B=-1,P=0;P<=v;++P){if(P===v){if(m>v){if(a.charCodeAt(y+P)===47)return a.slice(y+P+1);if(P===0)return a.slice(y+P)}else d>v&&(i.charCodeAt(l+P)===47?B=P:P===0&&(B=0));break}var T=i.charCodeAt(l+P),S=a.charCodeAt(y+P);if(T!==S)break;T===47&&(B=P)}var E="";for(P=l+B+1;P<=f;++P)(P===f||i.charCodeAt(P)===47)&&(E.length===0?E+="..":E+="/..");return E.length>0?E+a.slice(y+B):(y+=B,a.charCodeAt(y)===47&&++y,a.slice(y))},_makeLong:function(i){return i},dirname:function(i){if(e(i),i.length===0)return".";for(var a=i.charCodeAt(0),l=a===47,f=-1,d=!0,y=i.length-1;y>=1;--y)if(a=i.charCodeAt(y),a===47){if(!d){f=y;break}}else d=!1;return f===-1?l?"/":".":l&&f===1?"//":i.slice(0,f)},basename:function(i,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(i);var l=0,f=-1,d=!0,y;if(a!==void 0&&a.length>0&&a.length<=i.length){if(a.length===i.length&&a===i)return"";var g=a.length-1,m=-1;for(y=i.length-1;y>=0;--y){var v=i.charCodeAt(y);if(v===47){if(!d){l=y+1;break}}else m===-1&&(d=!1,m=y+1),g>=0&&(v===a.charCodeAt(g)?--g===-1&&(f=y):(g=-1,f=m))}return l===f?f=m:f===-1&&(f=i.length),i.slice(l,f)}else{for(y=i.length-1;y>=0;--y)if(i.charCodeAt(y)===47){if(!d){l=y+1;break}}else f===-1&&(d=!1,f=y+1);return f===-1?"":i.slice(l,f)}},extname:function(i){e(i);for(var a=-1,l=0,f=-1,d=!0,y=0,g=i.length-1;g>=0;--g){var m=i.charCodeAt(g);if(m===47){if(!d){l=g+1;break}continue}f===-1&&(d=!1,f=g+1),m===46?a===-1?a=g:y!==1&&(y=1):a!==-1&&(y=-1)}return a===-1||f===-1||y===0||y===1&&a===f-1&&a===l+1?"":i.slice(a,f)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return r("/",i)},parse:function(i){e(i);var a={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return a;var l=i.charCodeAt(0),f=l===47,d;f?(a.root="/",d=1):d=0;for(var y=-1,g=0,m=-1,v=!0,B=i.length-1,P=0;B>=d;--B){if(l=i.charCodeAt(B),l===47){if(!v){g=B+1;break}continue}m===-1&&(v=!1,m=B+1),l===46?y===-1?y=B:P!==1&&(P=1):y!==-1&&(P=-1)}return y===-1||m===-1||P===0||P===1&&y===m-1&&y===g+1?m!==-1&&(g===0&&f?a.base=a.name=i.slice(1,m):a.base=a.name=i.slice(g,m)):(g===0&&f?(a.name=i.slice(1,y),a.base=i.slice(1,m)):(a.name=i.slice(g,y),a.base=i.slice(g,m)),a.ext=i.slice(y,m)),g>0?a.dir=i.slice(0,g-1):f&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return o.posix=o,Os=o,Os}function PS(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Ms?ES(t):SS(t)}function ES(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(TS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<hS||r>vS||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function SS(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function kS(t){let e=Jm.resolve(t),n=t.charCodeAt(t.length-1);(n===mS||Ms&&n===yS)&&e[e.length-1]!==Jm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(_S,"%25")),!Ms&&e.includes("\\")&&(e=e.replace(bS,"%5C")),e.includes(`
|
|
11
11
|
`)&&(e=e.replace(wS,"%0A")),e.includes("\r")&&(e=e.replace(xS,"%0D")),e.includes(" ")&&(e=e.replace(BS,"%09")),r.pathname=e,r}function $S(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Ds?ZS(t):LS(t)}function ZS(t){let e=t.hostname,n=t.pathname;for(let r=0;r<n.length;r++)if(n[r]==="%"){let o=n.codePointAt(r+2)||32;if(n[r+1]==="2"&&o===102||n[r+1]==="5"&&o===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(n=n.replace(MS,"\\"),n=decodeURIComponent(n),e!=="")return`\\\\${e}${n}`;{let r=n.codePointAt(1)|32,o=n[2];if(r<OS||r>RS||o!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return n.slice(1)}}function LS(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let n=0;n<e.length;n++)if(e[n]==="%"){let r=e.codePointAt(n+2)||32;if(e[n+1]==="2"&&r===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function FS(t){let e=Zm.resolve(t),n=t.charCodeAt(t.length-1);(n===CS||Ds&&n===AS)&&e[e.length-1]!==Zm.sep&&(e+="/");let r=new URL("file://");return e.includes("%")&&(e=e.replace(DS,"%25")),!Ds&&e.includes("\\")&&(e=e.replace(NS,"%5C")),e.includes(`
|
|
12
12
|
`)&&(e=e.replace(HS,"%0A")),e.includes("\r")&&(e=e.replace(US,"%0D")),e.includes(" ")&&(e=e.replace(jS,"%09")),r.pathname=e,r}var ks,$m,Zm,dr,XE,QE,eS,tS,Mt,Is,Fm,Xm,Km,Wm,nS,iS,zr,oS,Jt,je,aS,Rt,sS,lS,uS,cS,Rs,qm,zm,Gm,fS,dS,As,fr,Cs,Os,Vm,Jm,gS,yS,mS,hS,vS,Ms,TS,_S,bS,wS,xS,BS,IS,AS,CS,OS,RS,Ds,MS,DS,NS,HS,US,jS,Qm=it(()=>{C();R();O();Ho();Ss();ks={},$m=!1;Zm=YE(),dr=2147483647,XE=/^xn--/,QE=/[^\0-\x7E]/,eS=/[\x2E\u3002\uFF0E\uFF61]/g,tS={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Mt=Math.floor,Is=String.fromCharCode;Fm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Xm=function(t,e,n){let r=0;for(t=n?Mt(t/700):t>>1,t+=Mt(t/e);t>455;r+=36)t=Mt(t/35);return Mt(r+36*t/(t+38))},Km=function(t){let e=[],n=t.length,r=0,o=128,s=72,i=t.lastIndexOf("-");i<0&&(i=0);for(let l=0;l<i;++l)t.charCodeAt(l)>=128&&Rn("not-basic"),e.push(t.charCodeAt(l));for(let l=i>0?i+1:0;l<n;){let f=r;for(let y=1,g=36;;g+=36){l>=n&&Rn("invalid-input");let m=(a=t.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(m>=36||m>Mt((dr-r)/y))&&Rn("overflow"),r+=m*y;let v=g<=s?1:g>=s+26?26:g-s;if(m<v)break;let B=36-v;y>Mt(dr/B)&&Rn("overflow"),y*=B}let d=e.length+1;s=Xm(r-f,d,f==0),Mt(r/d)>dr-o&&Rn("overflow"),o+=Mt(r/d),r%=d,e.splice(r++,0,o)}var a;return String.fromCodePoint(...e)},Wm=function(t){let e=[],n=(t=Ym(t)).length,r=128,o=0,s=72;for(let l of t)l<128&&e.push(Is(l));let i=e.length,a=i;for(i&&e.push("-");a<n;){let l=dr;for(let d of t)d>=r&&d<l&&(l=d);let f=a+1;l-r>Mt((dr-o)/f)&&Rn("overflow"),o+=(l-r)*f,r=l;for(let d of t)if(d<r&&++o>dr&&Rn("overflow"),d==r){let y=o;for(let g=36;;g+=36){let m=g<=s?1:g>=s+26?26:g-s;if(y<m)break;let v=y-m,B=36-m;e.push(Is(Fm(m+v%B,0))),y=Mt(v/B)}e.push(Is(Fm(y,0))),s=Xm(o,f,a==i),o=0,++a}++o,++r}return e.join("")},nS={version:"2.1.0",ucs2:{decode:Ym,encode:t=>String.fromCodePoint(...t)},decode:Km,encode:Wm,toASCII:function(t){return Lm(t,function(e){return QE.test(e)?"xn--"+Wm(e):e})},toUnicode:function(t){return Lm(t,function(e){return XE.test(e)?Km(e.slice(4).toLowerCase()):e})}};iS=function(t,e,n,r){e=e||"&",n=n||"=";var o={};if(typeof t!="string"||t.length===0)return o;var s=/\+/g;t=t.split(e);var i=1e3;r&&typeof r.maxKeys=="number"&&(i=r.maxKeys);var a=t.length;i>0&&a>i&&(a=i);for(var l=0;l<a;++l){var f,d,y,g,m=t[l].replace(s,"%20"),v=m.indexOf(n);v>=0?(f=m.substr(0,v),d=m.substr(v+1)):(f=m,d=""),y=decodeURIComponent(f),g=decodeURIComponent(d),rS(o,y)?Array.isArray(o[y])?o[y].push(g):o[y]=[o[y],g]:o[y]=g}return o},zr=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},oS=function(t,e,n,r){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(o){var s=encodeURIComponent(zr(o))+n;return Array.isArray(t[o])?t[o].map(function(i){return s+encodeURIComponent(zr(i))}).join(e):s+encodeURIComponent(zr(t[o]))}).join(e):r?encodeURIComponent(zr(r))+n+encodeURIComponent(zr(t)):""},Jt={};Jt.decode=Jt.parse=iS,Jt.encode=Jt.stringify=oS;Jt.decode;Jt.encode;Jt.parse;Jt.stringify;je={},aS=nS,Rt={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}};je.parse=Gr,je.resolve=function(t,e){return Gr(t,!1,!0).resolve(e)},je.resolveObject=function(t,e){return t?Gr(t,!1,!0).resolveObject(e):e},je.format=function(t){return Rt.isString(t)&&(t=Gr(t)),t instanceof Bt?t.format():Bt.prototype.format.call(t)},je.Url=Bt;sS=/^([a-z0-9.+-]+:)/i,lS=/:[0-9]*$/,uS=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,cS=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
|
|
13
13
|
`," "]),Rs=["'"].concat(cS),qm=["%","/","?",";","#"].concat(Rs),zm=["/","?","#"],Gm=/^[+a-z0-9A-Z_-]{0,63}$/,fS=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,dS={javascript:!0,"javascript:":!0},As={javascript:!0,"javascript:":!0},fr={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Cs=Jt;Bt.prototype.parse=function(t,e,n){if(!Rt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=r!==-1&&r<t.indexOf("#")?"?":"#",s=t.split(o);s[0]=s[0].replace(/\\/g,"/");var i=t=s.join(o);if(i=i.trim(),!n&&t.split("#").length===1){var a=uS.exec(i);if(a)return this.path=i,this.href=i,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?Cs.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=sS.exec(i);if(l){var f=(l=l[0]).toLowerCase();this.protocol=f,i=i.substr(l.length)}if(n||l||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var d=i.substr(0,2)==="//";!d||l&&As[l]||(i=i.substr(2),this.slashes=!0)}if(!As[l]&&(d||l&&!fr[l])){for(var y,g,m=-1,v=0;v<zm.length;v++)(B=i.indexOf(zm[v]))!==-1&&(m===-1||B<m)&&(m=B);for((g=m===-1?i.lastIndexOf("@"):i.lastIndexOf("@",m))!==-1&&(y=i.slice(0,g),i=i.slice(g+1),this.auth=decodeURIComponent(y)),m=-1,v=0;v<qm.length;v++){var B;(B=i.indexOf(qm[v]))!==-1&&(m===-1||B<m)&&(m=B)}m===-1&&(m=i.length),this.host=i.slice(0,m),i=i.slice(m),this.parseHost(),this.hostname=this.hostname||"";var P=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!P)for(var T=this.hostname.split(/\./),S=(v=0,T.length);v<S;v++){var E=T[v];if(E&&!E.match(Gm)){for(var M="",$=0,oe=E.length;$<oe;$++)E.charCodeAt($)>127?M+="x":M+=E[$];if(!M.match(Gm)){var X=T.slice(0,v),ue=T.slice(v+1),ee=E.match(fS);ee&&(X.push(ee[1]),ue.unshift(ee[2])),ue.length&&(i="/"+ue.join(".")+i),this.hostname=X.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),P||(this.hostname=aS.toASCII(this.hostname));var ie=this.port?":"+this.port:"",Re=this.hostname||"";this.host=Re+ie,this.href+=this.host,P&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!dS[f])for(v=0,S=Rs.length;v<S;v++){var Ie=Rs[v];if(i.indexOf(Ie)!==-1){var $e=encodeURIComponent(Ie);$e===Ie&&($e=escape(Ie)),i=i.split(Ie).join($e)}}var Ne=i.indexOf("#");Ne!==-1&&(this.hash=i.substr(Ne),i=i.slice(0,Ne));var Me=i.indexOf("?");if(Me!==-1?(this.search=i.substr(Me),this.query=i.substr(Me+1),e&&(this.query=Cs.parse(this.query)),i=i.slice(0,Me)):e&&(this.search="",this.query={}),i&&(this.pathname=i),fr[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){ie=this.pathname||"";var Ve=this.search||"";this.path=ie+Ve}return this.href=this.format(),this},Bt.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&Rt.isObject(this.query)&&Object.keys(this.query).length&&(s=Cs.stringify(this.query));var i=this.search||s&&"?"+s||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||fr[e])&&o!==!1?(o="//"+(o||""),n&&n.charAt(0)!=="/"&&(n="/"+n)):o||(o=""),r&&r.charAt(0)!=="#"&&(r="#"+r),i&&i.charAt(0)!=="?"&&(i="?"+i),e+o+(n=n.replace(/[?#]/g,function(a){return encodeURIComponent(a)}))+(i=i.replace("#","%23"))+r},Bt.prototype.resolve=function(t){return this.resolveObject(Gr(t,!1,!0)).format()},Bt.prototype.resolveObject=function(t){if(Rt.isString(t)){var e=new Bt;e.parse(t,!1,!0),t=e}for(var n=new Bt,r=Object.keys(this),o=0;o<r.length;o++){var s=r[o];n[s]=this[s]}if(n.hash=t.hash,t.href==="")return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),a=0;a<i.length;a++){var l=i[a];l!=="protocol"&&(n[l]=t[l])}return fr[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!fr[t.protocol]){for(var f=Object.keys(t),d=0;d<f.length;d++){var y=f[d];n[y]=t[y]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||As[t.protocol])n.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),n.pathname=g.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var m=n.pathname||"",v=n.search||"";n.path=m+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var B=n.pathname&&n.pathname.charAt(0)==="/",P=t.host||t.pathname&&t.pathname.charAt(0)==="/",T=P||B||n.host&&t.pathname,S=T,E=n.pathname&&n.pathname.split("/")||[],M=(g=t.pathname&&t.pathname.split("/")||[],n.protocol&&!fr[n.protocol]);if(M&&(n.hostname="",n.port=null,n.host&&(E[0]===""?E[0]=n.host:E.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),T=T&&(g[0]===""||E[0]==="")),P)n.host=t.host||t.host===""?t.host:n.host,n.hostname=t.hostname||t.hostname===""?t.hostname:n.hostname,n.search=t.search,n.query=t.query,E=g;else if(g.length)E||(E=[]),E.pop(),E=E.concat(g),n.search=t.search,n.query=t.query;else if(!Rt.isNullOrUndefined(t.search))return M&&(n.hostname=n.host=E.shift(),(ee=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=ee.shift(),n.host=n.hostname=ee.shift())),n.search=t.search,n.query=t.query,Rt.isNull(n.pathname)&&Rt.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var $=E.slice(-1)[0],oe=(n.host||t.host||E.length>1)&&($==="."||$==="..")||$==="",X=0,ue=E.length;ue>=0;ue--)($=E[ue])==="."?E.splice(ue,1):$===".."?(E.splice(ue,1),X++):X&&(E.splice(ue,1),X--);if(!T&&!S)for(;X--;X)E.unshift("..");!T||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),oe&&E.join("/").substr(-1)!=="/"&&E.push("");var ee,ie=E[0]===""||E[0]&&E[0].charAt(0)==="/";return M&&(n.hostname=n.host=ie?"":E.length?E.shift():"",(ee=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=ee.shift(),n.host=n.hostname=ee.shift())),(T=T||n.host&&E.length)&&!ie&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),Rt.isNull(n.pathname)&&Rt.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},Bt.prototype.parseHost=function(){var t=this.host,e=lS.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};je.Url;je.format;je.resolve;je.resolveObject;Os={},Vm=!1;Jm=pS(),gS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;je.URL=typeof URL<"u"?URL:null;je.pathToFileURL=kS;je.fileURLToPath=PS;je.Url;je.format;je.resolve;je.resolveObject;je.URL;yS=92,mS=47,hS=97,vS=122,Ms=gS==="win32",TS=/\//g,_S=/%/g,bS=/\\/g,wS=/\n/g,xS=/\r/g,BS=/\t/g;IS=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;je.URL=typeof URL<"u"?URL:null;je.pathToFileURL=FS;je.fileURLToPath=$S;je.Url;je.format;je.resolve;je.resolveObject;je.parse;je.URL;AS=92,CS=47,OS=97,RS=122,Ds=IS==="win32",MS=/\//g,DS=/%/g,NS=/\\/g,HS=/\n/g,US=/\r/g,jS=/\t/g});var Oh={};Un(Oh,{Agent:()=>ek,ClientRequest:()=>tk,IncomingMessage:()=>nk,METHODS:()=>rk,STATUS_CODES:()=>ik,default:()=>Yt,get:()=>ok,globalAgent:()=>ak,request:()=>sk});function xh(){if(eh)return bt;eh=!0,bt.fetch=r(Mn.fetch)&&r(Mn.ReadableStream),bt.writableStream=r(Mn.WritableStream),bt.abortController=r(Mn.AbortController);var t;function e(){if(t!==void 0)return t;if(Mn.XMLHttpRequest){t=new Mn.XMLHttpRequest;try{t.open("GET",Mn.XDomainRequest?"/":"https://example.com")}catch{t=null}}else t=null;return t}function n(o){var s=e();if(!s)return!1;try{return s.responseType=o,s.responseType===o}catch{}return!1}bt.arraybuffer=bt.fetch||n("arraybuffer"),bt.msstream=!bt.fetch&&n("ms-stream"),bt.mozchunkedarraybuffer=!bt.fetch&&n("moz-chunked-arraybuffer"),bt.overrideMimeType=bt.fetch||(e()?r(e().overrideMimeType):!1);function r(o){return typeof o=="function"}return t=null,bt}function Bh(){return th||(th=!0,Ns=yt.EventEmitter),Ns}function KS(){if(nh)return Hs;nh=!0;function t(v,B){var P=Object.keys(v);if(Object.getOwnPropertySymbols){var T=Object.getOwnPropertySymbols(v);B&&(T=T.filter(function(S){return Object.getOwnPropertyDescriptor(v,S).enumerable})),P.push.apply(P,T)}return P}function e(v){for(var B=1;B<arguments.length;B++){var P=arguments[B]!=null?arguments[B]:{};B%2?t(Object(P),!0).forEach(function(T){n(v,T,P[T])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(P)):t(Object(P)).forEach(function(T){Object.defineProperty(v,T,Object.getOwnPropertyDescriptor(P,T))})}return v}function n(v,B,P){return B=i(B),B in v?Object.defineProperty(v,B,{value:P,enumerable:!0,configurable:!0,writable:!0}):v[B]=P,v}function r(v,B){if(!(v instanceof B))throw new TypeError("Cannot call a class as a function")}function o(v,B){for(var P=0;P<B.length;P++){var T=B[P];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,i(T.key),T)}}function s(v,B,P){return B&&o(v.prototype,B),Object.defineProperty(v,"prototype",{writable:!1}),v}function i(v){var B=a(v,"string");return typeof B=="symbol"?B:String(B)}function a(v,B){if(typeof v!="object"||v===null)return v;var P=v[Symbol.toPrimitive];if(P!==void 0){var T=P.call(v,B||"default");if(typeof T!="object")return T;throw new TypeError("@@toPrimitive must return a primitive value.")}return(B==="string"?String:Number)(v)}var l=At(),f=l.Buffer,d=L,y=d.inspect,g=y&&y.custom||"inspect";function m(v,B,P){f.prototype.copy.call(v,B,P)}return Hs=function(){function v(){r(this,v),this.head=null,this.tail=null,this.length=0}return s(v,[{key:"push",value:function(P){var T={data:P,next:null};this.length>0?this.tail.next=T:this.head=T,this.tail=T,++this.length}},{key:"unshift",value:function(P){var T={data:P,next:this.head};this.length===0&&(this.tail=T),this.head=T,++this.length}},{key:"shift",value:function(){if(this.length!==0){var P=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,P}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(P){if(this.length===0)return"";for(var T=this.head,S=""+T.data;T=T.next;)S+=P+T.data;return S}},{key:"concat",value:function(P){if(this.length===0)return f.alloc(0);for(var T=f.allocUnsafe(P>>>0),S=this.head,E=0;S;)m(S.data,T,E),E+=S.data.length,S=S.next;return T}},{key:"consume",value:function(P,T){var S;return P<this.head.data.length?(S=this.head.data.slice(0,P),this.head.data=this.head.data.slice(P)):P===this.head.data.length?S=this.shift():S=T?this._getString(P):this._getBuffer(P),S}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(P){var T=this.head,S=1,E=T.data;for(P-=E.length;T=T.next;){var M=T.data,$=P>M.length?M.length:P;if($===M.length?E+=M:E+=M.slice(0,P),P-=$,P===0){$===M.length?(++S,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=M.slice($));break}++S}return this.length-=S,E}},{key:"_getBuffer",value:function(P){var T=f.allocUnsafe(P),S=this.head,E=1;for(S.data.copy(T),P-=S.data.length;S=S.next;){var M=S.data,$=P>M.length?M.length:P;if(M.copy(T,T.length-P,0,$),P-=$,P===0){$===M.length?(++E,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=M.slice($));break}++E}return this.length-=E,T}},{key:g,value:function(P,T){return y(this,e(e({},T),{},{depth:0,customInspect:!1}))}}]),v}(),Hs}function Ph(){if(rh)return Us;rh=!0;var t=St;function e(a,l){var f=this,d=this._readableState&&this._readableState.destroyed,y=this._writableState&&this._writableState.destroyed;return d||y?(l?l(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,a)):t.nextTick(s,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(g){!l&&g?f._writableState?f._writableState.errorEmitted?t.nextTick(r,f):(f._writableState.errorEmitted=!0,t.nextTick(n,f,g)):t.nextTick(n,f,g):l?(t.nextTick(r,f),l(g)):t.nextTick(r,f)}),this)}function n(a,l){s(a,l),r(a)}function r(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(a,l){a.emit("error",l)}function i(a,l){var f=a._readableState,d=a._writableState;f&&f.autoDestroy||d&&d.autoDestroy?a.destroy(l):a.emit("error",l)}return Us={destroy:e,undestroy:o,errorOrDestroy:i},Us}function gr(){if(ih)return js;ih=!0;let t={};function e(i,a,l){l||(l=Error);function f(y,g,m){return typeof a=="string"?a:a(y,g,m)}class d extends l{constructor(g,m,v){super(f(g,m,v))}}d.prototype.name=l.name,d.prototype.code=i,t[i]=d}function n(i,a){if(Array.isArray(i)){let l=i.length;return i=i.map(f=>String(f)),l>2?`one of ${a} ${i.slice(0,l-1).join(", ")}, or `+i[l-1]:l===2?`one of ${a} ${i[0]} or ${i[1]}`:`of ${a} ${i[0]}`}else return`of ${a} ${String(i)}`}function r(i,a,l){return i.substr(0,a.length)===a}function o(i,a,l){return(l===void 0||l>i.length)&&(l=i.length),i.substring(l-a.length,l)===a}function s(i,a,l){return typeof l!="number"&&(l=0),l+a.length>i.length?!1:i.indexOf(a,l)!==-1}return e("ERR_INVALID_OPT_VALUE",function(i,a){return'The value "'+a+'" is invalid for option "'+i+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(i,a,l){let f;typeof a=="string"&&r(a,"not ")?(f="must not be",a=a.replace(/^not /,"")):f="must be";let d;if(o(i," argument"))d=`The ${i} ${f} ${n(a,"type")}`;else{let y=s(i,".")?"property":"argument";d=`The "${i}" ${y} ${f} ${n(a,"type")}`}return d+=`. Received type ${typeof l}`,d},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(i){return"The "+i+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(i){return"Cannot call "+i+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(i){return"Unknown encoding: "+i},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),js.codes=t,js}function Eh(){if(oh)return $s;oh=!0;var t=gr().codes.ERR_INVALID_OPT_VALUE;function e(r,o,s){return r.highWaterMark!=null?r.highWaterMark:o?r[s]:null}function n(r,o,s,i){var a=e(o,i,s);if(a!=null){if(!(isFinite(a)&&Math.floor(a)===a)||a<0){var l=i?s:"highWaterMark";throw new t(l,a)}return Math.floor(a)}return r.objectMode?16:16*1024}return $s={getHighWaterMark:n},$s}function Sh(){if(ah)return Zs;ah=!0;var t=St;Zs=ee;function e(A){var k=this;this.next=null,this.entry=null,this.finish=function(){ve(k,A)}}var n;ee.WritableState=X;var r={deprecate:Mm()},o=Bh(),s=At().Buffer,i=(typeof sh<"u"?sh:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(A){return s.from(A)}function l(A){return s.isBuffer(A)||A instanceof i}var f=Ph(),d=Eh(),y=d.getHighWaterMark,g=gr().codes,m=g.ERR_INVALID_ARG_TYPE,v=g.ERR_METHOD_NOT_IMPLEMENTED,B=g.ERR_MULTIPLE_CALLBACK,P=g.ERR_STREAM_CANNOT_PIPE,T=g.ERR_STREAM_DESTROYED,S=g.ERR_STREAM_NULL_VALUES,E=g.ERR_STREAM_WRITE_AFTER_END,M=g.ERR_UNKNOWN_ENCODING,$=f.errorOrDestroy;Ct()(ee,o);function oe(){}function X(A,k,j){n=n||pr(),A=A||{},typeof j!="boolean"&&(j=k instanceof n),this.objectMode=!!A.objectMode,j&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=y(this,A,"writableHighWaterMark",j),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Y=A.decodeStrings===!1;this.decodeStrings=!Y,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ae){Ae(k,ae)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}X.prototype.getBuffer=function(){for(var k=this.bufferedRequest,j=[];k;)j.push(k),k=k.next;return j},function(){try{Object.defineProperty(X.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var ue;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ue=Function.prototype[Symbol.hasInstance],Object.defineProperty(ee,Symbol.hasInstance,{value:function(k){return ue.call(this,k)?!0:this!==ee?!1:k&&k._writableState instanceof X}})):ue=function(k){return k instanceof this};function ee(A){n=n||pr();var k=this instanceof n;if(!k&&!ue.call(ee,this))return new ee(A);this._writableState=new X(A,this,k),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),o.call(this)}ee.prototype.pipe=function(){$(this,new P)};function ie(A,k){var j=new E;$(A,j),t.nextTick(k,j)}function Re(A,k,j,Y){var ae;return j===null?ae=new S:typeof j!="string"&&!k.objectMode&&(ae=new m("chunk",["string","Buffer"],j)),ae?($(A,ae),t.nextTick(Y,ae),!1):!0}ee.prototype.write=function(A,k,j){var Y=this._writableState,ae=!1,b=!Y.objectMode&&l(A);return b&&!s.isBuffer(A)&&(A=a(A)),typeof k=="function"&&(j=k,k=null),b?k="buffer":k||(k=Y.defaultEncoding),typeof j!="function"&&(j=oe),Y.ending?ie(this,j):(b||Re(this,Y,A,j))&&(Y.pendingcb++,ae=$e(this,Y,b,A,k,j)),ae},ee.prototype.cork=function(){this._writableState.corked++},ee.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&ce(this,A))},ee.prototype.setDefaultEncoding=function(k){if(typeof k=="string"&&(k=k.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((k+"").toLowerCase())>-1))throw new M(k);return this._writableState.defaultEncoding=k,this},Object.defineProperty(ee.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Ie(A,k,j){return!A.objectMode&&A.decodeStrings!==!1&&typeof k=="string"&&(k=s.from(k,j)),k}Object.defineProperty(ee.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function $e(A,k,j,Y,ae,b){if(!j){var w=Ie(k,Y,ae);Y!==w&&(j=!0,ae="buffer",Y=w)}var W=k.objectMode?1:Y.length;k.length+=W;var Q=k.length<k.highWaterMark;if(Q||(k.needDrain=!0),k.writing||k.corked){var He=k.lastBufferedRequest;k.lastBufferedRequest={chunk:Y,encoding:ae,isBuf:j,callback:b,next:null},He?He.next=k.lastBufferedRequest:k.bufferedRequest=k.lastBufferedRequest,k.bufferedRequestCount+=1}else Ne(A,k,!1,W,Y,ae,b);return Q}function Ne(A,k,j,Y,ae,b,w){k.writelen=Y,k.writecb=w,k.writing=!0,k.sync=!0,k.destroyed?k.onwrite(new T("write")):j?A._writev(ae,k.onwrite):A._write(ae,b,k.onwrite),k.sync=!1}function Me(A,k,j,Y,ae){--k.pendingcb,j?(t.nextTick(ae,Y),t.nextTick(F,A,k),A._writableState.errorEmitted=!0,$(A,Y)):(ae(Y),A._writableState.errorEmitted=!0,$(A,Y),F(A,k))}function Ve(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}function Ae(A,k){var j=A._writableState,Y=j.sync,ae=j.writecb;if(typeof ae!="function")throw new B;if(Ve(j),k)Me(A,j,Y,k,ae);else{var b=he(j)||A.destroyed;!b&&!j.corked&&!j.bufferProcessing&&j.bufferedRequest&&ce(A,j),Y?t.nextTick(me,A,j,b,ae):me(A,j,b,ae)}}function me(A,k,j,Y){j||Se(A,k),k.pendingcb--,Y(),F(A,k)}function Se(A,k){k.length===0&&k.needDrain&&(k.needDrain=!1,A.emit("drain"))}function ce(A,k){k.bufferProcessing=!0;var j=k.bufferedRequest;if(A._writev&&j&&j.next){var Y=k.bufferedRequestCount,ae=new Array(Y),b=k.corkedRequestsFree;b.entry=j;for(var w=0,W=!0;j;)ae[w]=j,j.isBuf||(W=!1),j=j.next,w+=1;ae.allBuffers=W,Ne(A,k,!0,k.length,ae,"",b.finish),k.pendingcb++,k.lastBufferedRequest=null,b.next?(k.corkedRequestsFree=b.next,b.next=null):k.corkedRequestsFree=new e(k),k.bufferedRequestCount=0}else{for(;j;){var Q=j.chunk,He=j.encoding,_e=j.callback,U=k.objectMode?1:Q.length;if(Ne(A,k,!1,U,Q,He,_e),j=j.next,k.bufferedRequestCount--,k.writing)break}j===null&&(k.lastBufferedRequest=null)}k.bufferedRequest=j,k.bufferProcessing=!1}ee.prototype._write=function(A,k,j){j(new v("_write()"))},ee.prototype._writev=null,ee.prototype.end=function(A,k,j){var Y=this._writableState;return typeof A=="function"?(j=A,A=null,k=null):typeof k=="function"&&(j=k,k=null),A!=null&&this.write(A,k),Y.corked&&(Y.corked=1,this.uncork()),Y.ending||fe(this,Y,j),this},Object.defineProperty(ee.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function he(A){return A.ending&&A.length===0&&A.bufferedRequest===null&&!A.finished&&!A.writing}function D(A,k){A._final(function(j){k.pendingcb--,j&&$(A,j),k.prefinished=!0,A.emit("prefinish"),F(A,k)})}function Z(A,k){!k.prefinished&&!k.finalCalled&&(typeof A._final=="function"&&!k.destroyed?(k.pendingcb++,k.finalCalled=!0,t.nextTick(D,A,k)):(k.prefinished=!0,A.emit("prefinish")))}function F(A,k){var j=he(k);if(j&&(Z(A,k),k.pendingcb===0&&(k.finished=!0,A.emit("finish"),k.autoDestroy))){var Y=A._readableState;(!Y||Y.autoDestroy&&Y.endEmitted)&&A.destroy()}return j}function fe(A,k,j){k.ending=!0,F(A,k),j&&(k.finished?t.nextTick(j):A.once("finish",j)),k.ended=!0,A.writable=!1}function ve(A,k,j){var Y=A.entry;for(A.entry=null;Y;){var ae=Y.callback;k.pendingcb--,ae(j),Y=Y.next}k.corkedRequestsFree.next=A}return Object.defineProperty(ee.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(k){this._writableState&&(this._writableState.destroyed=k)}}),ee.prototype.destroy=f.destroy,ee.prototype._undestroy=f.undestroy,ee.prototype._destroy=function(A,k){k(A)},Zs}function pr(){if(lh)return Ls;lh=!0;var t=St,e=Object.keys||function(d){var y=[];for(var g in d)y.push(g);return y};Ls=a;var n=kh(),r=Sh();Ct()(a,n);for(var o=e(r.prototype),s=0;s<o.length;s++){var i=o[s];a.prototype[i]||(a.prototype[i]=r.prototype[i])}function a(d){if(!(this instanceof a))return new a(d);n.call(this,d),r.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",l)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function l(){this._writableState.ended||t.nextTick(f,this)}function f(d){d.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(y){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=y,this._writableState.destroyed=y)}}),Ls}function el(){if(uh)return Fs;uh=!0;var t=gr().codes.ERR_STREAM_PREMATURE_CLOSE;function e(s){var i=!1;return function(){if(!i){i=!0;for(var a=arguments.length,l=new Array(a),f=0;f<a;f++)l[f]=arguments[f];s.apply(this,l)}}}function n(){}function r(s){return s.setHeader&&typeof s.abort=="function"}function o(s,i,a){if(typeof i=="function")return o(s,null,i);i||(i={}),a=e(a||n);var l=i.readable||i.readable!==!1&&s.readable,f=i.writable||i.writable!==!1&&s.writable,d=function(){s.writable||g()},y=s._writableState&&s._writableState.finished,g=function(){f=!1,y=!0,l||a.call(s)},m=s._readableState&&s._readableState.endEmitted,v=function(){l=!1,m=!0,f||a.call(s)},B=function(E){a.call(s,E)},P=function(){var E;if(l&&!m)return(!s._readableState||!s._readableState.ended)&&(E=new t),a.call(s,E);if(f&&!y)return(!s._writableState||!s._writableState.ended)&&(E=new t),a.call(s,E)},T=function(){s.req.on("finish",g)};return r(s)?(s.on("complete",g),s.on("abort",P),s.req?T():s.on("request",T)):f&&!s._writableState&&(s.on("end",d),s.on("close",d)),s.on("end",v),s.on("finish",g),i.error!==!1&&s.on("error",B),s.on("close",P),function(){s.removeListener("complete",g),s.removeListener("abort",P),s.removeListener("request",T),s.req&&s.req.removeListener("finish",g),s.removeListener("end",d),s.removeListener("close",d),s.removeListener("finish",g),s.removeListener("end",v),s.removeListener("error",B),s.removeListener("close",P)}}return Fs=o,Fs}function WS(){if(ch)return Ks;ch=!0;var t=St,e;function n(M,$,oe){return $=r($),$ in M?Object.defineProperty(M,$,{value:oe,enumerable:!0,configurable:!0,writable:!0}):M[$]=oe,M}function r(M){var $=o(M,"string");return typeof $=="symbol"?$:String($)}function o(M,$){if(typeof M!="object"||M===null)return M;var oe=M[Symbol.toPrimitive];if(oe!==void 0){var X=oe.call(M,$||"default");if(typeof X!="object")return X;throw new TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(M)}var s=el(),i=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),f=Symbol("ended"),d=Symbol("lastPromise"),y=Symbol("handlePromise"),g=Symbol("stream");function m(M,$){return{value:M,done:$}}function v(M){var $=M[i];if($!==null){var oe=M[g].read();oe!==null&&(M[d]=null,M[i]=null,M[a]=null,$(m(oe,!1)))}}function B(M){t.nextTick(v,M)}function P(M,$){return function(oe,X){M.then(function(){if($[f]){oe(m(void 0,!0));return}$[y](oe,X)},X)}}var T=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((e={get stream(){return this[g]},next:function(){var $=this,oe=this[l];if(oe!==null)return Promise.reject(oe);if(this[f])return Promise.resolve(m(void 0,!0));if(this[g].destroyed)return new Promise(function(ie,Re){t.nextTick(function(){$[l]?Re($[l]):ie(m(void 0,!0))})});var X=this[d],ue;if(X)ue=new Promise(P(X,this));else{var ee=this[g].read();if(ee!==null)return Promise.resolve(m(ee,!1));ue=new Promise(this[y])}return this[d]=ue,ue}},n(e,Symbol.asyncIterator,function(){return this}),n(e,"return",function(){var $=this;return new Promise(function(oe,X){$[g].destroy(null,function(ue){if(ue){X(ue);return}oe(m(void 0,!0))})})}),e),T),E=function($){var oe,X=Object.create(S,(oe={},n(oe,g,{value:$,writable:!0}),n(oe,i,{value:null,writable:!0}),n(oe,a,{value:null,writable:!0}),n(oe,l,{value:null,writable:!0}),n(oe,f,{value:$._readableState.endEmitted,writable:!0}),n(oe,y,{value:function(ee,ie){var Re=X[g].read();Re?(X[d]=null,X[i]=null,X[a]=null,ee(m(Re,!1))):(X[i]=ee,X[a]=ie)},writable:!0}),oe));return X[d]=null,s($,function(ue){if(ue&&ue.code!=="ERR_STREAM_PREMATURE_CLOSE"){var ee=X[a];ee!==null&&(X[d]=null,X[i]=null,X[a]=null,ee(ue)),X[l]=ue;return}var ie=X[i];ie!==null&&(X[d]=null,X[i]=null,X[a]=null,ie(m(void 0,!0))),X[f]=!0}),$.on("readable",B.bind(null,X)),X};return Ks=E,Ks}function qS(){return fh||(fh=!0,Ws=function(){throw new Error("Readable.from is not available in the browser")}),Ws}function kh(){if(dh)return qs;dh=!0;var t=St;qs=ie;var e;ie.ReadableState=ee,yt.EventEmitter;var n=function(w,W){return w.listeners(W).length},r=Bh(),o=At().Buffer,s=(typeof ph<"u"?ph:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(b){return o.from(b)}function a(b){return o.isBuffer(b)||b instanceof s}var l=L,f;l&&l.debuglog?f=l.debuglog("stream"):f=function(){};var d=KS(),y=Ph(),g=Eh(),m=g.getHighWaterMark,v=gr().codes,B=v.ERR_INVALID_ARG_TYPE,P=v.ERR_STREAM_PUSH_AFTER_EOF,T=v.ERR_METHOD_NOT_IMPLEMENTED,S=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,E,M,$;Ct()(ie,r);var oe=y.errorOrDestroy,X=["error","close","destroy","pause","resume"];function ue(b,w,W){if(typeof b.prependListener=="function")return b.prependListener(w,W);!b._events||!b._events[w]?b.on(w,W):Array.isArray(b._events[w])?b._events[w].unshift(W):b._events[w]=[W,b._events[w]]}function ee(b,w,W){e=e||pr(),b=b||{},typeof W!="boolean"&&(W=w instanceof e),this.objectMode=!!b.objectMode,W&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=m(this,b,"readableHighWaterMark",W),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=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(E||(E=qr.StringDecoder),this.decoder=new E(b.encoding),this.encoding=b.encoding)}function ie(b){if(e=e||pr(),!(this instanceof ie))return new ie(b);var w=this instanceof e;this._readableState=new ee(b,this,w),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),r.call(this)}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(w){this._readableState&&(this._readableState.destroyed=w)}}),ie.prototype.destroy=y.destroy,ie.prototype._undestroy=y.undestroy,ie.prototype._destroy=function(b,w){w(b)},ie.prototype.push=function(b,w){var W=this._readableState,Q;return W.objectMode?Q=!0:typeof b=="string"&&(w=w||W.defaultEncoding,w!==W.encoding&&(b=o.from(b,w),w=""),Q=!0),Re(this,b,w,!1,Q)},ie.prototype.unshift=function(b){return Re(this,b,null,!0,!1)};function Re(b,w,W,Q,He){f("readableAddChunk",w);var _e=b._readableState;if(w===null)_e.reading=!1,Ae(b,_e);else{var U;if(He||(U=$e(_e,w)),U)oe(b,U);else if(_e.objectMode||w&&w.length>0)if(typeof w!="string"&&!_e.objectMode&&Object.getPrototypeOf(w)!==o.prototype&&(w=i(w)),Q)_e.endEmitted?oe(b,new S):Ie(b,_e,w,!0);else if(_e.ended)oe(b,new P);else{if(_e.destroyed)return!1;_e.reading=!1,_e.decoder&&!W?(w=_e.decoder.write(w),_e.objectMode||w.length!==0?Ie(b,_e,w,!1):ce(b,_e)):Ie(b,_e,w,!1)}else Q||(_e.reading=!1,ce(b,_e))}return!_e.ended&&(_e.length<_e.highWaterMark||_e.length===0)}function Ie(b,w,W,Q){w.flowing&&w.length===0&&!w.sync?(w.awaitDrain=0,b.emit("data",W)):(w.length+=w.objectMode?1:W.length,Q?w.buffer.unshift(W):w.buffer.push(W),w.needReadable&&me(b)),ce(b,w)}function $e(b,w){var W;return!a(w)&&typeof w!="string"&&w!==void 0&&!b.objectMode&&(W=new B("chunk",["string","Buffer","Uint8Array"],w)),W}ie.prototype.isPaused=function(){return this._readableState.flowing===!1},ie.prototype.setEncoding=function(b){E||(E=qr.StringDecoder);var w=new E(b);this._readableState.decoder=w,this._readableState.encoding=this._readableState.decoder.encoding;for(var W=this._readableState.buffer.head,Q="";W!==null;)Q+=w.write(W.data),W=W.next;return this._readableState.buffer.clear(),Q!==""&&this._readableState.buffer.push(Q),this._readableState.length=Q.length,this};var Ne=1073741824;function Me(b){return b>=Ne?b=Ne:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function Ve(b,w){return b<=0||w.length===0&&w.ended?0:w.objectMode?1:b!==b?w.flowing&&w.length?w.buffer.head.data.length:w.length:(b>w.highWaterMark&&(w.highWaterMark=Me(b)),b<=w.length?b:w.ended?w.length:(w.needReadable=!0,0))}ie.prototype.read=function(b){f("read",b),b=parseInt(b,10);var w=this._readableState,W=b;if(b!==0&&(w.emittedReadable=!1),b===0&&w.needReadable&&((w.highWaterMark!==0?w.length>=w.highWaterMark:w.length>0)||w.ended))return f("read: emitReadable",w.length,w.ended),w.length===0&&w.ended?j(this):me(this),null;if(b=Ve(b,w),b===0&&w.ended)return w.length===0&&j(this),null;var Q=w.needReadable;f("need readable",Q),(w.length===0||w.length-b<w.highWaterMark)&&(Q=!0,f("length less than watermark",Q)),w.ended||w.reading?(Q=!1,f("reading or ended",Q)):Q&&(f("do read"),w.reading=!0,w.sync=!0,w.length===0&&(w.needReadable=!0),this._read(w.highWaterMark),w.sync=!1,w.reading||(b=Ve(W,w)));var He;return b>0?He=k(b,w):He=null,He===null?(w.needReadable=w.length<=w.highWaterMark,b=0):(w.length-=b,w.awaitDrain=0),w.length===0&&(w.ended||(w.needReadable=!0),W!==b&&w.ended&&j(this)),He!==null&&this.emit("data",He),He};function Ae(b,w){if(f("onEofChunk"),!w.ended){if(w.decoder){var W=w.decoder.end();W&&W.length&&(w.buffer.push(W),w.length+=w.objectMode?1:W.length)}w.ended=!0,w.sync?me(b):(w.needReadable=!1,w.emittedReadable||(w.emittedReadable=!0,Se(b)))}}function me(b){var w=b._readableState;f("emitReadable",w.needReadable,w.emittedReadable),w.needReadable=!1,w.emittedReadable||(f("emitReadable",w.flowing),w.emittedReadable=!0,t.nextTick(Se,b))}function Se(b){var w=b._readableState;f("emitReadable_",w.destroyed,w.length,w.ended),!w.destroyed&&(w.length||w.ended)&&(b.emit("readable"),w.emittedReadable=!1),w.needReadable=!w.flowing&&!w.ended&&w.length<=w.highWaterMark,A(b)}function ce(b,w){w.readingMore||(w.readingMore=!0,t.nextTick(he,b,w))}function he(b,w){for(;!w.reading&&!w.ended&&(w.length<w.highWaterMark||w.flowing&&w.length===0);){var W=w.length;if(f("maybeReadMore read 0"),b.read(0),W===w.length)break}w.readingMore=!1}ie.prototype._read=function(b){oe(this,new T("_read()"))},ie.prototype.pipe=function(b,w){var W=this,Q=this._readableState;switch(Q.pipesCount){case 0:Q.pipes=b;break;case 1:Q.pipes=[Q.pipes,b];break;default:Q.pipes.push(b);break}Q.pipesCount+=1,f("pipe count=%d opts=%j",Q.pipesCount,w);var He=(!w||w.end!==!1)&&b!==t.stdout&&b!==t.stderr,_e=He?Pt:u;Q.endEmitted?t.nextTick(_e):W.once("end",_e),b.on("unpipe",U);function U(c,_){f("onunpipe"),c===W&&_&&_.hasUnpiped===!1&&(_.hasUnpiped=!0,vr())}function Pt(){f("onend"),b.end()}var It=D(W);b.on("drain",It);var vt=!1;function vr(){f("cleanup"),b.removeListener("close",Tr),b.removeListener("finish",h),b.removeListener("drain",It),b.removeListener("error",wt),b.removeListener("unpipe",U),W.removeListener("end",Pt),W.removeListener("end",u),W.removeListener("data",Qr),vt=!0,Q.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&It()}W.on("data",Qr);function Qr(c){f("ondata");var _=b.write(c);f("dest.write",_),_===!1&&((Q.pipesCount===1&&Q.pipes===b||Q.pipesCount>1&&ae(Q.pipes,b)!==-1)&&!vt&&(f("false write response, pause",Q.awaitDrain),Q.awaitDrain++),W.pause())}function wt(c){f("onerror",c),u(),b.removeListener("error",wt),n(b,"error")===0&&oe(b,c)}ue(b,"error",wt);function Tr(){b.removeListener("finish",h),u()}b.once("close",Tr);function h(){f("onfinish"),b.removeListener("close",Tr),u()}b.once("finish",h);function u(){f("unpipe"),W.unpipe(b)}return b.emit("pipe",W),Q.flowing||(f("pipe resume"),W.resume()),b};function D(b){return function(){var W=b._readableState;f("pipeOnDrain",W.awaitDrain),W.awaitDrain&&W.awaitDrain--,W.awaitDrain===0&&n(b,"data")&&(W.flowing=!0,A(b))}}ie.prototype.unpipe=function(b){var w=this._readableState,W={hasUnpiped:!1};if(w.pipesCount===0)return this;if(w.pipesCount===1)return b&&b!==w.pipes?this:(b||(b=w.pipes),w.pipes=null,w.pipesCount=0,w.flowing=!1,b&&b.emit("unpipe",this,W),this);if(!b){var Q=w.pipes,He=w.pipesCount;w.pipes=null,w.pipesCount=0,w.flowing=!1;for(var _e=0;_e<He;_e++)Q[_e].emit("unpipe",this,{hasUnpiped:!1});return this}var U=ae(w.pipes,b);return U===-1?this:(w.pipes.splice(U,1),w.pipesCount-=1,w.pipesCount===1&&(w.pipes=w.pipes[0]),b.emit("unpipe",this,W),this)},ie.prototype.on=function(b,w){var W=r.prototype.on.call(this,b,w),Q=this._readableState;return b==="data"?(Q.readableListening=this.listenerCount("readable")>0,Q.flowing!==!1&&this.resume()):b==="readable"&&!Q.endEmitted&&!Q.readableListening&&(Q.readableListening=Q.needReadable=!0,Q.flowing=!1,Q.emittedReadable=!1,f("on readable",Q.length,Q.reading),Q.length?me(this):Q.reading||t.nextTick(F,this)),W},ie.prototype.addListener=ie.prototype.on,ie.prototype.removeListener=function(b,w){var W=r.prototype.removeListener.call(this,b,w);return b==="readable"&&t.nextTick(Z,this),W},ie.prototype.removeAllListeners=function(b){var w=r.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&t.nextTick(Z,this),w};function Z(b){var w=b._readableState;w.readableListening=b.listenerCount("readable")>0,w.resumeScheduled&&!w.paused?w.flowing=!0:b.listenerCount("data")>0&&b.resume()}function F(b){f("readable nexttick read 0"),b.read(0)}ie.prototype.resume=function(){var b=this._readableState;return b.flowing||(f("resume"),b.flowing=!b.readableListening,fe(this,b)),b.paused=!1,this};function fe(b,w){w.resumeScheduled||(w.resumeScheduled=!0,t.nextTick(ve,b,w))}function ve(b,w){f("resume",w.reading),w.reading||b.read(0),w.resumeScheduled=!1,b.emit("resume"),A(b),w.flowing&&!w.reading&&b.read(0)}ie.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function A(b){var w=b._readableState;for(f("flow",w.flowing);w.flowing&&b.read()!==null;);}ie.prototype.wrap=function(b){var w=this,W=this._readableState,Q=!1;b.on("end",function(){if(f("wrapped end"),W.decoder&&!W.ended){var U=W.decoder.end();U&&U.length&&w.push(U)}w.push(null)}),b.on("data",function(U){if(f("wrapped data"),W.decoder&&(U=W.decoder.write(U)),!(W.objectMode&&U==null)&&!(!W.objectMode&&(!U||!U.length))){var Pt=w.push(U);Pt||(Q=!0,b.pause())}});for(var He in b)this[He]===void 0&&typeof b[He]=="function"&&(this[He]=function(Pt){return function(){return b[Pt].apply(b,arguments)}}(He));for(var _e=0;_e<X.length;_e++)b.on(X[_e],this.emit.bind(this,X[_e]));return this._read=function(U){f("wrapped _read",U),Q&&(Q=!1,b.resume())},this},typeof Symbol=="function"&&(ie.prototype[Symbol.asyncIterator]=function(){return M===void 0&&(M=WS()),M(this)}),Object.defineProperty(ie.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(ie.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(ie.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(w){this._readableState&&(this._readableState.flowing=w)}}),ie._fromList=k,Object.defineProperty(ie.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function k(b,w){if(w.length===0)return null;var W;return w.objectMode?W=w.buffer.shift():!b||b>=w.length?(w.decoder?W=w.buffer.join(""):w.buffer.length===1?W=w.buffer.first():W=w.buffer.concat(w.length),w.buffer.clear()):W=w.buffer.consume(b,w.decoder),W}function j(b){var w=b._readableState;f("endReadable",w.endEmitted),w.endEmitted||(w.ended=!0,t.nextTick(Y,w,b))}function Y(b,w){if(f("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,w.readable=!1,w.emit("end"),b.autoDestroy)){var W=w._writableState;(!W||W.autoDestroy&&W.finished)&&w.destroy()}}typeof Symbol=="function"&&(ie.from=function(b,w){return $===void 0&&($=qS()),$(ie,b,w)});function ae(b,w){for(var W=0,Q=b.length;W<Q;W++)if(b[W]===w)return W;return-1}return qs}function Ih(){if(gh)return zs;gh=!0,zs=a;var t=gr().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,n=t.ERR_MULTIPLE_CALLBACK,r=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=t.ERR_TRANSFORM_WITH_LENGTH_0,s=pr();Ct()(a,s);function i(d,y){var g=this._transformState;g.transforming=!1;var m=g.writecb;if(m===null)return this.emit("error",new n);g.writechunk=null,g.writecb=null,y!=null&&this.push(y),m(d);var v=this._readableState;v.reading=!1,(v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}function a(d){if(!(this instanceof a))return new a(d);s.call(this,d),this._transformState={afterTransform:i.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",l)}function l(){var d=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(y,g){f(d,y,g)}):f(this,null,null)}a.prototype.push=function(d,y){return this._transformState.needTransform=!1,s.prototype.push.call(this,d,y)},a.prototype._transform=function(d,y,g){g(new e("_transform()"))},a.prototype._write=function(d,y,g){var m=this._transformState;if(m.writecb=g,m.writechunk=d,m.writeencoding=y,!m.transforming){var v=this._readableState;(m.needTransform||v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}},a.prototype._read=function(d){var y=this._transformState;y.writechunk!==null&&!y.transforming?(y.transforming=!0,this._transform(y.writechunk,y.writeencoding,y.afterTransform)):y.needTransform=!0},a.prototype._destroy=function(d,y){s.prototype._destroy.call(this,d,function(g){y(g)})};function f(d,y,g){if(y)return d.emit("error",y);if(g!=null&&d.push(g),d._writableState.length)throw new o;if(d._transformState.transforming)throw new r;return d.push(null)}return zs}function zS(){if(yh)return Gs;yh=!0,Gs=e;var t=Ih();Ct()(e,t);function e(n){if(!(this instanceof e))return new e(n);t.call(this,n)}return e.prototype._transform=function(n,r,o){o(null,n)},Gs}function GS(){if(mh)return Vs;mh=!0;var t;function e(g){var m=!1;return function(){m||(m=!0,g.apply(void 0,arguments))}}var n=gr().codes,r=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function s(g){if(g)throw g}function i(g){return g.setHeader&&typeof g.abort=="function"}function a(g,m,v,B){B=e(B);var P=!1;g.on("close",function(){P=!0}),t===void 0&&(t=el()),t(g,{readable:m,writable:v},function(S){if(S)return B(S);P=!0,B()});var T=!1;return function(S){if(!P&&!T){if(T=!0,i(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();B(S||new o("pipe"))}}}function l(g){g()}function f(g,m){return g.pipe(m)}function d(g){return!g.length||typeof g[g.length-1]!="function"?s:g.pop()}function y(){for(var g=arguments.length,m=new Array(g),v=0;v<g;v++)m[v]=arguments[v];var B=d(m);if(Array.isArray(m[0])&&(m=m[0]),m.length<2)throw new r("streams");var P,T=m.map(function(S,E){var M=E<m.length-1,$=E>0;return a(S,M,$,function(oe){P||(P=oe),oe&&T.forEach(l),!M&&(T.forEach(l),B(P))})});return m.reduce(f)}return Vs=y,Vs}function Ah(){return hh||(hh=!0,ht=ht=kh(),ht.Stream=ht,ht.Readable=ht,ht.Writable=Sh(),ht.Duplex=pr(),ht.Transform=Ih(),ht.PassThrough=zS(),ht.finished=el(),ht.pipeline=GS()),ht}function Ch(){if(vh)return jo;vh=!0;var t=At().Buffer,e=St,n=xh(),r=Ct(),o=Ah(),s=jo.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},i=jo.IncomingMessage=function(a,l,f,d){var y=this||$o;if(o.Readable.call(y),y._mode=f,y.headers={},y.rawHeaders=[],y.trailers={},y.rawTrailers=[],y.on("end",function(){e.nextTick(function(){y.emit("close")})}),f==="fetch"){let T=function(){m.read().then(function(S){if(!y._destroyed){if(d(S.done),S.done){y.push(null);return}y.push(t.from(S.value)),T()}}).catch(function(S){d(!0),y._destroyed||y.emit("error",S)})};if(y._fetchResponse=l,y.url=l.url,y.statusCode=l.status,y.statusMessage=l.statusText,l.headers.forEach(function(S,E){y.headers[E.toLowerCase()]=S,y.rawHeaders.push(E,S)}),n.writableStream){var g=new WritableStream({write:function(S){return d(!1),new Promise(function(E,M){y._destroyed?M():y.push(t.from(S))?E():y._resumeFetch=E})},close:function(){d(!0),y._destroyed||y.push(null)},abort:function(S){d(!0),y._destroyed||y.emit("error",S)}});try{l.body.pipeTo(g).catch(function(S){d(!0),y._destroyed||y.emit("error",S)});return}catch{}}var m=l.body.getReader();T()}else{y._xhr=a,y._pos=0,y.url=a.responseURL,y.statusCode=a.status,y.statusMessage=a.statusText;var v=a.getAllResponseHeaders().split(/\r?\n/);if(v.forEach(function(T){var S=T.match(/^([^:]+):\s*(.*)/);if(S){var E=S[1].toLowerCase();E==="set-cookie"?(y.headers[E]===void 0&&(y.headers[E]=[]),y.headers[E].push(S[2])):y.headers[E]!==void 0?y.headers[E]+=", "+S[2]:y.headers[E]=S[2],y.rawHeaders.push(S[1],S[2])}}),y._charset="x-user-defined",!n.overrideMimeType){var B=y.rawHeaders["mime-type"];if(B){var P=B.match(/;\s*charset=([^;])(;|$)/);P&&(y._charset=P[1].toLowerCase())}y._charset||(y._charset="utf-8")}}};return r(i,o.Readable),i.prototype._read=function(){var a=this||$o,l=a._resumeFetch;l&&(a._resumeFetch=null,l())},i.prototype._onXHRProgress=function(a){var l=this||$o,f=l._xhr,d=null;switch(l._mode){case"text":if(d=f.responseText,d.length>l._pos){var y=d.substr(l._pos);if(l._charset==="x-user-defined"){for(var g=t.alloc(y.length),m=0;m<y.length;m++)g[m]=y.charCodeAt(m)&255;l.push(g)}else l.push(y,l._charset);l._pos=d.length}break;case"arraybuffer":if(f.readyState!==s.DONE||!f.response)break;d=f.response,l.push(t.from(new Uint8Array(d)));break;case"moz-chunked-arraybuffer":if(d=f.response,f.readyState!==s.LOADING||!d)break;l.push(t.from(new Uint8Array(d)));break;case"ms-stream":if(d=f.response,f.readyState!==s.LOADING)break;var v=new $o.MSStreamReader;v.onprogress=function(){v.result.byteLength>l._pos&&(l.push(t.from(new Uint8Array(v.result.slice(l._pos)))),l._pos=v.result.byteLength)},v.onload=function(){a(!0),l.push(null)},v.readAsArrayBuffer(d);break}l._xhr.readyState===s.DONE&&l._mode!=="ms-stream"&&(a(!0),l.push(null))},jo}function VS(){if(Th)return Js;Th=!0;var t=At().Buffer,e=St,n=xh(),r=Ct(),o=Ch(),s=Ah(),i=o.IncomingMessage,a=o.readyStates;function l(g,m){return n.fetch&&m?"fetch":n.mozchunkedarraybuffer?"moz-chunked-arraybuffer":n.msstream?"ms-stream":n.arraybuffer&&g?"arraybuffer":"text"}var f=Js=function(g){var m=this||rt;s.Writable.call(m),m._opts=g,m._body=[],m._headers={},g.auth&&m.setHeader("Authorization","Basic "+t.from(g.auth).toString("base64")),Object.keys(g.headers).forEach(function(P){m.setHeader(P,g.headers[P])});var v,B=!0;if(g.mode==="disable-fetch"||"requestTimeout"in g&&!n.abortController)B=!1,v=!0;else if(g.mode==="prefer-streaming")v=!1;else if(g.mode==="allow-wrong-content-type")v=!n.overrideMimeType;else if(!g.mode||g.mode==="default"||g.mode==="prefer-fast")v=!0;else throw new Error("Invalid value for opts.mode");m._mode=l(v,B),m._fetchTimer=null,m._socketTimeout=null,m._socketTimer=null,m.on("finish",function(){m._onFinish()})};r(f,s.Writable),f.prototype.setHeader=function(g,m){var v=this||rt,B=g.toLowerCase();y.indexOf(B)===-1&&(v._headers[B]={name:g,value:m})},f.prototype.getHeader=function(g){var m=(this||rt)._headers[g.toLowerCase()];return m?m.value:null},f.prototype.removeHeader=function(g){var m=this||rt;delete m._headers[g.toLowerCase()]},f.prototype._onFinish=function(){var g=this||rt;if(!g._destroyed){var m=g._opts;"timeout"in m&&m.timeout!==0&&g.setTimeout(m.timeout);var v=g._headers,B=null;m.method!=="GET"&&m.method!=="HEAD"&&(B=new Blob(g._body,{type:(v["content-type"]||{}).value||""}));var P=[];if(Object.keys(v).forEach(function(M){var $=v[M].name,oe=v[M].value;Array.isArray(oe)?oe.forEach(function(X){P.push([$,X])}):P.push([$,oe])}),g._mode==="fetch"){var T=null;if(n.abortController){var S=new AbortController;T=S.signal,g._fetchAbortController=S,"requestTimeout"in m&&m.requestTimeout!==0&&(g._fetchTimer=rt.setTimeout(function(){g.emit("requestTimeout"),g._fetchAbortController&&g._fetchAbortController.abort()},m.requestTimeout))}rt.fetch(g._opts.url,{method:g._opts.method,headers:P,body:B||void 0,mode:"cors",credentials:m.withCredentials?"include":"same-origin",signal:T}).then(function(M){g._fetchResponse=M,g._resetTimers(!1),g._connect()},function(M){g._resetTimers(!0),g._destroyed||g.emit("error",M)})}else{var E=g._xhr=new rt.XMLHttpRequest;try{E.open(g._opts.method,g._opts.url,!0)}catch(M){e.nextTick(function(){g.emit("error",M)});return}"responseType"in E&&(E.responseType=g._mode),"withCredentials"in E&&(E.withCredentials=!!m.withCredentials),g._mode==="text"&&"overrideMimeType"in E&&E.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in m&&(E.timeout=m.requestTimeout,E.ontimeout=function(){g.emit("requestTimeout")}),P.forEach(function(M){E.setRequestHeader(M[0],M[1])}),g._response=null,E.onreadystatechange=function(){switch(E.readyState){case a.LOADING:case a.DONE:g._onXHRProgress();break}},g._mode==="moz-chunked-arraybuffer"&&(E.onprogress=function(){g._onXHRProgress()}),E.onerror=function(){g._destroyed||(g._resetTimers(!0),g.emit("error",new Error("XHR error")))};try{E.send(B)}catch(M){e.nextTick(function(){g.emit("error",M)});return}}}};function d(g){try{var m=g.status;return m!==null&&m!==0}catch{return!1}}f.prototype._onXHRProgress=function(){var g=this||rt;g._resetTimers(!1),!(!d(g._xhr)||g._destroyed)&&(g._response||g._connect(),g._response._onXHRProgress(g._resetTimers.bind(g)))},f.prototype._connect=function(){var g=this||rt;g._destroyed||(g._response=new i(g._xhr,g._fetchResponse,g._mode,g._resetTimers.bind(g)),g._response.on("error",function(m){g.emit("error",m)}),g.emit("response",g._response))},f.prototype._write=function(g,m,v){var B=this||rt;B._body.push(g),v()},f.prototype._resetTimers=function(g){var m=this||rt;rt.clearTimeout(m._socketTimer),m._socketTimer=null,g?(rt.clearTimeout(m._fetchTimer),m._fetchTimer=null):m._socketTimeout&&(m._socketTimer=rt.setTimeout(function(){m.emit("timeout")},m._socketTimeout))},f.prototype.abort=f.prototype.destroy=function(g){var m=this||rt;m._destroyed=!0,m._resetTimers(!0),m._response&&(m._response._destroyed=!0),m._xhr?m._xhr.abort():m._fetchAbortController&&m._fetchAbortController.abort(),g&&m.emit("error",g)},f.prototype.end=function(g,m,v){var B=this||rt;typeof g=="function"&&(v=g,g=void 0),s.Writable.prototype.end.call(B,g,m,v)},f.prototype.setTimeout=function(g,m){var v=this||rt;m&&v.once("timeout",m),v._socketTimeout=g,v._resetTimers(!1)},f.prototype.flushHeaders=function(){},f.prototype.setNoDelay=function(){},f.prototype.setSocketKeepAlive=function(){};var y=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"];return Js}function JS(){if(_h)return Ys;_h=!0,Ys=e;var t=Object.prototype.hasOwnProperty;function e(){for(var n={},r=0;r<arguments.length;r++){var o=arguments[r];for(var s in o)t.call(o,s)&&(n[s]=o[s])}return n}return Ys}function YS(){return bh||(bh=!0,Xs={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}),Xs}function QS(){if(wh)return Qs;wh=!0;var t=VS(),e=Ch(),n=JS(),r=YS(),o=je,s=Qs;return s.request=function(i,a){typeof i=="string"?i=o.parse(i):i=n(i);var l=XS.location.protocol.search(/^https?:$/)===-1?"http:":"",f=i.protocol||l,d=i.hostname||i.host,y=i.port,g=i.path||"/";d&&d.indexOf(":")!==-1&&(d="["+d+"]"),i.url=(d?f+"//"+d:"")+(y?":"+y:"")+g,i.method=(i.method||"GET").toUpperCase(),i.headers=i.headers||{};var m=new t(i);return a&&m.on("response",a),m},s.get=function(a,l){var f=s.request(a,l);return f.end(),f},s.ClientRequest=t,s.IncomingMessage=e.IncomingMessage,s.Agent=function(){},s.Agent.defaultMaxSockets=4,s.globalAgent=new s.Agent,s.STATUS_CODES=r,s.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Qs}var bt,eh,Mn,Ns,th,Hs,nh,Us,rh,js,ih,$s,oh,Zs,ah,sh,Ls,lh,Fs,uh,Ks,ch,Ws,fh,qs,dh,ph,zs,gh,Gs,yh,Vs,mh,ht,hh,jo,vh,$o,Js,Th,rt,Ys,_h,Xs,bh,Qs,wh,XS,Yt,ek,tk,nk,rk,ik,ok,ak,sk,Rh=it(()=>{C();R();O();os();Gy();as();oi();Am();Ho();ws();Dm();Um();Qm();Ss();bt={},eh=!1,Mn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ns={},th=!1;Hs={},nh=!1;Us={},rh=!1;js={},ih=!1;$s={},oh=!1;Zs={},ah=!1,sh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ls={},lh=!1;Fs={},uh=!1;Ks={},ch=!1;Ws={},fh=!1;qs={},dh=!1,ph=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;zs={},gh=!1;Gs={},yh=!1;Vs={},mh=!1;ht={},hh=!1;jo={},vh=!1,$o=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Js={},Th=!1,rt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Ys={},_h=!1;Xs={},bh=!1;Qs={},wh=!1,XS=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;Yt=QS(),ek=Yt.Agent,tk=Yt.ClientRequest,nk=Yt.IncomingMessage,rk=Yt.METHODS,ik=Yt.STATUS_CODES,ok=Yt.get,ak=Yt.globalAgent,sk=Yt.request});C();R();O();var Ay={};Un(Ay,{defaults:()=>sP,markdown:()=>aP});C();R();O();C();R();O();C();R();O();var ro=_r(Zn(),1),ze=_r(Zn(),1),Zt=_r(Zn(),1),er=_r(Zn(),1),pt=_r(Zn(),1),ka=Object.defineProperty,iT=Object.defineProperties,oT=Object.getOwnPropertyDescriptors,Ti=Object.getOwnPropertySymbols,ff=Object.prototype.hasOwnProperty,df=Object.prototype.propertyIsEnumerable,Ic=(t,e,n)=>e in t?ka(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,x=(t,e)=>{for(var n in e||(e={}))ff.call(e,n)&&Ic(t,n,e[n]);if(Ti)for(var n of Ti(e))df.call(e,n)&&Ic(t,n,e[n]);return t},H=(t,e)=>iT(t,oT(e)),p=(t,e)=>ka(t,"name",{value:e,configurable:!0}),pf=(t,e)=>{var n={};for(var r in t)ff.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ti)for(var r of Ti(t))e.indexOf(r)<0&&df.call(t,r)&&(n[r]=t[r]);return n},gf=(t,e)=>{for(var n in e)ka(t,n,{get:e[n],enumerable:!0})},re={};gf(re,{BRAND:()=>yx,DIRTY:()=>Gn,EMPTY_PATH:()=>px,INVALID:()=>de,NEVER:()=>OB,OK:()=>ct,ParseInputLazyPath:()=>Et,ParseStatus:()=>gt,Schema:()=>ye,ZodAny:()=>Ei,ZodArray:()=>Hr,ZodBigInt:()=>ja,ZodBoolean:()=>$a,ZodBranded:()=>Za,ZodCatch:()=>La,ZodDate:()=>Fa,ZodDefault:()=>fo,ZodDiscriminatedUnion:()=>ug,ZodEffects:()=>bn,ZodEnum:()=>rr,ZodError:()=>$t,ZodFirstPartyTypeKind:()=>Vp,ZodFunction:()=>fg,ZodIntersection:()=>Wa,ZodIssueCode:()=>G,ZodLazy:()=>qa,ZodLiteral:()=>za,ZodMap:()=>gg,ZodNaN:()=>mg,ZodNativeEnum:()=>Ga,ZodNever:()=>_n,ZodNull:()=>Va,ZodNullable:()=>Jn,ZodNumber:()=>Ja,ZodObject:()=>Yn,ZodOptional:()=>nn,ZodParsedType:()=>ne,ZodPipeline:()=>Ya,ZodPromise:()=>go,ZodReadonly:()=>yo,ZodRecord:()=>xg,ZodRef:()=>Pg,ZodSchema:()=>ye,ZodSet:()=>Eg,ZodString:()=>ft,ZodSymbol:()=>Ug,ZodTransformer:()=>bn,ZodTuple:()=>Qn,ZodType:()=>ye,ZodUndefined:()=>Xa,ZodUnion:()=>Qa,ZodUnknown:()=>Ar,ZodVoid:()=>Lg,addIssueToContext:()=>te,agent:()=>Hx,aimodel:()=>Lx,any:()=>Qx,array:()=>rB,bigint:()=>Gx,boolean:()=>my,coerce:()=>CB,conversation:()=>Mx,createZodEnum:()=>po,cuid2Regex:()=>kg,cuidRegex:()=>Sg,custom:()=>sg,datasource:()=>Fx,date:()=>Vx,datetimeRegex:()=>Dg,default:()=>xB,discriminatedUnion:()=>sB,effect:()=>cf,emailRegex:()=>Cg,enum:()=>vB,errorUtil:()=>se,event:()=>Ux,fromJsonSchema:()=>IB,fromObject:()=>AB,function:()=>yB,getErrorMap:()=>Dr,getParsedType:()=>tn,instanceof:()=>qx,intent:()=>Zx,intersection:()=>lB,ipv4Regex:()=>Rg,ipv6Regex:()=>Mg,isAborted:()=>ma,isAsync:()=>Bi,isDirty:()=>ha,isEmojiRegex:()=>mx,isValid:()=>Nr,jsonSchemaToZui:()=>mo,knowledgebase:()=>Kx,late:()=>Wx,lazy:()=>mB,literal:()=>hB,makeIssue:()=>xi,map:()=>pB,message:()=>Nx,nan:()=>zx,nativeEnum:()=>TB,never:()=>tB,null:()=>Xx,nullable:()=>wB,number:()=>yy,object:()=>iB,objectToZui:()=>Ur,objectUtil:()=>ya,oboolean:()=>kB,onumber:()=>SB,optional:()=>bB,ostring:()=>EB,pipeline:()=>PB,preprocess:()=>BB,processCreateParams:()=>ge,promise:()=>_B,quotelessJson:()=>dx,readonly:()=>dB,record:()=>cB,ref:()=>fB,set:()=>gB,setErrorMap:()=>Xp,strictObject:()=>oB,string:()=>gy,symbol:()=>Jx,table:()=>jx,tablerow:()=>$x,transformer:()=>cf,tuple:()=>uB,ulidRegex:()=>Ig,undefined:()=>Yx,union:()=>aB,unknown:()=>eB,user:()=>Dx,util:()=>be,uuidRegex:()=>Ag,variable:()=>Rx,void:()=>nB,zuiToJsonSchema:()=>rs});var ke="x-zui",yf=(0,ze.createContext)({formData:void 0,formSchema:void 0,setFormData:p(()=>{throw new Error("Must be within a FormDataProvider")},"setFormData"),setHiddenState:p(()=>{throw new Error("Must be within a FormDataProvider")},"setHiddenState"),setDisabledState:p(()=>{throw new Error("Must be within a FormDataProvider")},"setDisabledState"),hiddenState:{},disabledState:{},validation:{formValid:null,formErrors:null}}),Ac=p((t,e,n)=>{var r;let o=(r=e[ke])==null?void 0:r[t];if(typeof o>"u")return!1;if(typeof o=="boolean")return o;if(typeof o=="string"){if(typeof window>"u")return console.warn("Function evaluation is not supported in server side rendering"),!1;let i=new Function("return "+o)()(n);switch(typeof i){case"object":case"boolean":return i;default:return!1}}return!1},"parseMaskableField"),mf=p((t,e)=>{let n=(0,ze.useContext)(yf);if(n===void 0)throw new Error("useFormData must be used within a FormDataProvider");let r=(0,ze.useMemo)(()=>hn(n.formData,e),[n.formData,e]),o=(0,ze.useMemo)(()=>{var m;return n.validation.formValid===null?{formValid:null,formErrors:null}:n.validation.formValid===!1?{formValid:!1,formErrors:((m=n.validation.formErrors)==null?void 0:m.filter(v=>Tf(v.path,e)).map(v=>({message:v.message,code:v.code,path:e})))||null}:{formValid:!0,formErrors:[]}},[n.validation.formValid,n.validation.formErrors,e]),s=n.dataTransform?n.dataTransform(r):r,i=(0,ze.useMemo)(()=>Ac("hidden",t,s),[t,s]),a=(0,ze.useMemo)(()=>Ac("disabled",t,s),[t,s]);(0,ze.useEffect)(()=>{n.setHiddenState(m=>Ln(m,e,i||{})),n.setDisabledState(m=>Ln(m,e,a||{}))},[JSON.stringify({fieldSchema:t,data:r})]);let{disabled:l,hidden:f}=(0,ze.useMemo)(()=>{let m=i===!0||hn(n.hiddenState,e),v=a===!0||hn(n.disabledState,e);return{hidden:m===!0,disabled:v===!0}},[n.hiddenState,n.disabledState,i,a,e]),d=(0,ze.useCallback)((m,v)=>{n.setFormData(B=>Ln(B,m,v))},[n.setFormData]),y=(0,ze.useCallback)((m,v=void 0)=>{let B=zn(t.items);n.setFormData(P=>{let T=hn(P,m)||[];return v===void 0&&(v=B),Ln(P,m,Array.isArray(T)?[...T,v]:[v])})},[n.setFormData]),g=(0,ze.useCallback)((m,v)=>{n.setFormData(B=>{let P=hn(B,m)||[];return Array.isArray(P)?(P.splice(v,1),Ln(B,m,P)):B})},[n.setFormData]);return x(H(x({},n),{data:r,disabled:l,hidden:f,handlePropertyChange:d,addArrayItem:y,removeArrayItem:g}),o)},"useFormData");function Ln(t,e,n){if(e.length===0)return n;let r=e.length;return e.reduce((o,s,i)=>(i===r-1?o[s]=n:o[s]||(o[s]=isNaN(Number(s))?{}:[]),o[s]),t??{}),x({},t)}p(Ln,"setObjectPath");var zn=p((t,e)=>{var n,r,o,s;if(Array.isArray(t))return zn(t[0]);if(t.default)return t.default;if(t.nullable)return null;if(!e){if((n=t.anyOf)!=null&&n.length)return zn(t.anyOf[0]);if(t.type==="object"&&t.properties){let i={};return Object.entries(t.properties).map(([a,l])=>{var f;i[a]=zn(l,!((f=t.required)!=null&&f.includes(a))||hf(l)||!1)}),i}if(t.type==="array")return t.minItems&&t.minItems>0?[zn(t.items)]:[];if(t.type==="string")return(r=t.enum)!=null&&r.length?t.enum[0]:"";if(t.type==="number")return(o=t.enum)!=null&&o.length?t.enum[0]:0;if(t.type==="boolean")return(s=t.enum)!=null&&s.length?t.enum[0]:!1}},"getDefaultValues"),aT=p(({children:t,setFormData:e,formData:n,formSchema:r,disableValidation:o,onValidation:s,dataTransform:i})=>{let[a,l]=(0,ze.useState)({}),[f,d]=(0,ze.useState)({}),y=i?i(n):n,g=(0,ze.useMemo)(()=>{if(o)return{formValid:null,formErrors:null};if(!r)return{formValid:null,formErrors:null};let m=mo(r).safeParse(y);return m.success?{formValid:!0,formErrors:[]}:{formValid:!1,formErrors:m.error.issues}},[JSON.stringify({transformedData:y})]);return(0,ze.useEffect)(()=>{s&&s(g)},[g]),ze.default.createElement(yf.Provider,{value:{formData:n,setFormData:e,formSchema:r,validation:g,hiddenState:a,setHiddenState:l,disabledState:f,setDisabledState:d,dataTransform:i}},t)},"FormDataProvider");function hn(t,e){return e.reduce((n,r)=>n?n[r]:null,t)}p(hn,"getPathData");function hf(t){var e;return((e=t.anyOf)==null?void 0:e.some(n=>n.not&&Object.keys(n.not).length===0))||!1}p(hf,"isOptional");function _i(t,e){let n=x({},t);for(let r in e)e.hasOwnProperty(r)&&(typeof e[r]=="object"&&e[r]!==null&&!Array.isArray(e[r])?typeof n[r]=="object"&&n[r]!==null&&!Array.isArray(n[r])?n[r]=_i(n[r],e[r]):n[r]=_i({},e[r]):n[r]=e[r]);return n}p(_i,"deepMerge");var sT=p((t,e)=>{let{handlePropertyChange:n,data:r}=mf(t,e),{discriminator:o,value:s,discriminatedSchema:i}=(0,ro.useMemo)(()=>{let a=vf(t.anyOf),l=a?.key?r?.[a.key]:t.default||null,f=lT(a?.key||null,l,t.anyOf);return{discriminator:a,value:l,discriminatedSchema:f}},[t.anyOf,r]);return(0,ro.useEffect)(()=>{o?.key&&o?.values.length&&Object.keys(r||{}).length<1&&!t.default&&n(e,{[o.key]:o.values[0]})},[]),{discriminator:o,discriminatorValue:s,discriminatedSchema:i}},"useDiscriminator"),vf=p(t=>{let e=t?.map(n=>n.type!=="object"||!n.properties?null:Object.entries(n.properties).map(([r,o])=>{var s;return o.type==="string"&&((s=o.enum)!=null&&s.length)?{key:r,value:o.enum[0]}:null}).filter(r=>!!r)).flat().reduce((n,r)=>{if(!r)return n;let{key:o,value:s}=r;return n.key===null&&(n.key=o),n.key===o&&n.values.push(s),n},{key:null,values:[]});return e?.key===null||!e?.values.length?null:e},"resolveDiscriminator"),lT=p((t,e,n)=>{var r,o;if(!n?.length||!t||!e)return null;for(let s of n){if(s.type!=="object")continue;let i=(r=s.properties)==null?void 0:r[t];if(i?.type==="string"&&((o=i.enum)!=null&&o.length)&&i.enum[0]===e)return H(x({},s),{properties:H(x({},s.properties),{[t]:H(x({},i),{[ke]:{hidden:!0}})})})}return null},"resolveDiscriminatedSchema"),uT=p(t=>{var e;return(e=t.anyOf)!=null&&e.length?vf(t.anyOf)?"discriminatedUnion":"object":t.type==="integer"?"number":t.type},"getSchemaType"),cT=p((t,e)=>{var n,r,o;let s=uT(e),i=((n=e[ke])==null?void 0:n.displayAs)||null;if(!i||!Array.isArray(i)||i.length<2){let d=(r=t?.[s])==null?void 0:r.default;return d?{Component:d,type:s,id:"default",params:{}}:null}let a=i[0],l=((o=t?.[s])==null?void 0:o[a])||null;if(!l)return console.warn(`Component ${s}.${a} not found`),null;let f=i[1]||{};return{Component:l,type:s,id:a,params:f}},"resolveComponent");function Tf(t,e){return t.length!==e.length?!1:t.every((n,r)=>n===e[r])}p(Tf,"pathMatches");function sa(t,e){return e||(e=new RegExp("/s|-|_| ","g")),wf(t).split(e).map(_f).map(xf).reduce(bf)}p(sa,"formatTitle");function _f(t){return t.charAt(0).toUpperCase()+t.substring(1)}p(_f,"capitalize");function bf(t,e){return`${t} ${e}`}p(bf,"combine");function wf(t){return t.replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1_$2").toLowerCase()}p(wf,"decamelize");function xf(t,e,n){let r=t.toLowerCase(),o=t.toUpperCase();for(let s of yT)if(s.toLowerCase()===r)return s;return fT.includes(o)?o:e===0||e===n.length-1||t.length>=4?t:gT.includes(r)||pT.includes(r)||dT.includes(r)?r:t}p(xf,"handleSpecialWords");var fT=["2D","3D","4WD","A2O","API","BIOS","CCTV","CC","CCV","CD","CD-ROM","COBOL","CIA","CMS","CSS","CSV","CV","DIY","DVD","DB","DNA","E3","EIN","ESPN","FAQ","FAQs","FTP","FPS","FORTRAN","FBI","HTML","HTTP","ID","IP","ISO","JS","JSON","LASER","M2A","M2M","M2MM","M2O","MMORPG","NAFTA","NASA","NDA","O2M","PDF","PHP","POP","RAM","RNGR","ROM","RPG","RTFM","RTS","SCUBA","SITCOM","SKU","SMTP","SQL","SSN","SWAT","TBS","TTL","TV","TNA","UI","URL","USB","UWP","VIP","W3C","WYSIWYG","WWW","WWE","WWF"],dT=["a","an","the"],pT=["and","that","but","or","as","if","when","than","because","while","where","after","so","though","since","until","whether","before","although","nor","like","once","unless","now","except"],gT=["about","above","across","after","against","along","among","around","at","because of","before","behind","below","beneath","beside","besides","between","beyond","but","by","concerning","despite","down","during","except","excepting","for","from","in","in front of","inside","in spite of","instead of","into","like","near","of","off","on","onto","out","outside","over","past","regarding","since","through","throughout","to","toward","under","underneath","until","up","upon","up to","with","within","without","with regard to","with respect to"],yT=["2FA","3D","4K","5K","8K","AGI","BI","ChatGPT","CTA","DateTime","GitHub","GPT","HD","IBMid","ID","IDs","iMac","IMAX","iOS","IP","iPad","iPhone","iPod","LDAP","LinkedIn","LLM","M2M","M2O","macOS","McDonalds","ML","MySQL","NLG","NLP","NLU","O2M","OpenAI","PDFs","PEFT","pH","PostgreSQL","SEO","TTS","UHD","UUID","XSS","YouTube"];function Bf(t){return typeof t=="symbol"?"symbol":typeof t=="bigint"?`${t.toString()}n`:jt(t)}p(Bf,"primitiveToTypscriptLiteralType");function jt(t){return typeof t>"u"?"undefined":typeof t=="symbol"?t.description?`Symbol(${jt(t.description)})`:"Symbol()":typeof t=="bigint"?`BigInt(${t.toString()})`:JSON.stringify(t)}p(jt,"primitiveToTypescriptValue");function Pf(t){return typeof t>"u"?"undefined":JSON.stringify(t)}p(Pf,"unknownToTypescriptValue");var Cc=p(t=>/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t)?t:jt(t),"toPropertyKey"),mT=p(t=>t.charAt(0).toUpperCase()+t.slice(1),"capitalize"),Ef=p(t=>{let e=/[^a-zA-Z0-9_]/g;return t.split(e).map(mT).filter(r=>!!r).join("")},"toTypeArgumentName"),pe=p(t=>{let e=(t??"").split(`
|
|
@@ -76,7 +76,7 @@ ${T}`.trim();case q.ZodFirstPartyTypeKind.ZodEnum:return a.values.map(jt).join("
|
|
|
76
76
|
`,o+=`}
|
|
77
77
|
`,o+=`}
|
|
78
78
|
`),o+=`}
|
|
79
|
-
`,o+="})"}let s=n?o?n+o:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:o||(r?`z.record(${r})`:"z.record(z.any())");return Qe.an.anyOf(t)&&(s+=`.and(${hy(H(x({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?H(x({},i),{type:"object"}):i)}),e)})`),Qe.a.oneOf(t)&&(s+=`.and(${is(H(x({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?H(x({},i),{type:"object"}):i)}),e)})`),Qe.an.allOf(t)&&(s+=`.and(${jr(H(x({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?H(x({},i),{type:"object"}):i)}),e)})`),s}p(vy,"parseObject");var qB=p(t=>{var e;let n="z.string()";if((e=t[ke])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";n="z.coerce.string()"}return n+=at(t,"format",({value:r})=>{switch(r){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),n+=at(t,"pattern",({json:r})=>[`.regex(new RegExp(${r})`,", ",")"]),n+=at(t,"minLength",({json:r})=>[`.min(${r}`,", ",")"]),n+=at(t,"maxLength",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseString"),zB=p((t,e)=>`${nt(jB(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),GB=p(t=>`z.ref('${t.$ref}')`,"parseRef"),VB=p((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return is(t,e);let o=t.oneOf.map((s,i)=>nt(s,H(x({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${o.join(", ")}])`},"parseDiscriminator"),nt=p((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let o=XB(t,e);return n||(o=JB(t,o),e.withoutDefaults||(o=YB(t,o))),r.r=o,o},"parseSchema"),JB=p((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),YB=p((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),XB=p((t,e)=>Qe.a.nullable(t)?zB(t,e):Qe.an.object(t)?vy(t,e):Qe.an.array(t)?ZB(t,e):Qe.an.anyOf(t)?hy(t,e):Qe.an.allOf(t)?jr(t,e):Qe.a.discriminator(t)?VB(t,e):Qe.a.oneOf(t)?is(t,e):Qe.a.not(t)?NB(t,e):Qe.an.enum(t)?FB(t):Qe.a.const(t)?LB(t):Qe.a.multipleType(t)?DB(t,e):Qe.a.primitive(t,"string")?qB(t):Qe.a.primitive(t,"number")||Qe.a.primitive(t,"integer")?WB(t):Qe.a.primitive(t,"boolean")?RB(t):Qe.a.primitive(t,"null")?HB(t):Qe.a.conditional(t)?KB(t,e):Qe.a.ref(t)?GB(t):MB(t),"selectParser"),Qe={an:{object:p(t=>t.type==="object","object"),array:p(t=>t.type==="array","array"),anyOf:p(t=>t.anyOf!==void 0,"anyOf"),allOf:p(t=>t.allOf!==void 0,"allOf"),enum:p(t=>t.enum!==void 0,"enum")},a:{nullable:p(t=>t.nullable===!0,"nullable"),multipleType:p(t=>Array.isArray(t.type),"multipleType"),not:p(t=>t.not!==void 0,"not"),const:p(t=>t.const!==void 0,"const"),primitive:p((t,e)=>t.type===e,"primitive"),conditional:p(t=>Boolean("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:p(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:p(t=>t.oneOf!==void 0,"oneOf"),ref:p(t=>t.$ref!==void 0,"ref")}},QB=p(t=>{let e;try{e=new Function("z",`return ${t}`)(q)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof q.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),eP=p(t=>nt(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),tP=p(t=>{let e=eP(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=QB(e);if(!n.sucess)throw new Af(n.error);return n.value},"jsonSchemaToZod"),kr=p((t,e)=>{var n,r;if(e[ke]&&t._def&&(t._def[ke]=e[ke]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([o,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[o]&&kr(i[o],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&kr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let o=e.items;if(typeof o=="object"&&!Array.isArray(o)){let s=t._def.type;s&&kr(s,o)}else Array.isArray(o)&&o.forEach((s,i)=>{let a=t._def;a.typeName===re.ZodFirstPartyTypeKind.ZodTuple&&kr(a.items[i],s)})}},"applyZuiPropsRecursively"),mo=p(t=>{let e=tP(t);return kr(e,t),e},"jsonSchemaToZui"),Ty=class extends er.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("Uncaught error:",e,n)}render(){return this.state.hasError&&this.props.fallback?er.default.createElement(this.props.fallback,{error:this.state.error,schema:this.props.fieldSchema}):this.props.children}};p(Ty,"ErrorBoundary");var Cr=Ty;function nP(t,e){return n=>er.default.createElement(Cr,{fallback:e,fieldSchema:n.fieldSchema,path:n.path},er.default.createElement(t,x({},n)))}p(nP,"withErrorBoundary");var vi=p(t=>{var e=t,{components:n,fieldSchema:r,path:o,required:s,fallback:i}=e,a=pf(e,["components","fieldSchema","path","required","fallback"]),l,f;let{formData:d,disabled:y,hidden:g,handlePropertyChange:m,addArrayItem:v,removeArrayItem:B,formErrors:P,formValid:T}=mf(r,o),S=(0,pt.useMemo)(()=>hn(d,o),[d,o]),E=(0,pt.useMemo)(()=>cT(n,r),[r,n]),{discriminator:M,discriminatedSchema:$,discriminatorValue:oe}=sT(r,o);if(!E||g===!0)return null;let{Component:X,type:ue}=E,ee={type:ue,componentID:E.id,scope:o.join("."),context:{path:o,readonly:!1,formData:d,formErrors:P,formValid:T,updateForm:m,updateFormData:p(Ie=>m([],Ie),"updateFormData")},onChange:p(Ie=>m(o,Ie),"onChange"),disabled:y,errors:P?.filter(Ie=>Ie.path===o)||[],label:((l=r[ke])==null?void 0:l.title)||sa(((f=o[o.length-1])==null?void 0:f.toString())||""),params:E.params,schema:r,zuiProps:r[ke]};if(r.type==="array"&&ue==="array"){let Ie=X,$e=ee.schema,Ne=Array.isArray(S)||typeof S=="object"?S:[],Me=x(H(x({},ee),{type:ue,schema:$e,data:Ne,addItem:p(Ve=>v(o,Ve),"addItem"),removeItem:p(Ve=>B(o,Ve),"removeItem")}),a);return Array.isArray(r.items)?null:pt.default.createElement(Ie,H(x({key:ee.scope},Me),{isArrayChild:Me.isArrayChild}),Array.isArray(Me.data)?Me.data.map((Ve,Ae)=>{let me=[...o,Ae.toString()];return pt.default.createElement(Cr,{key:me.join("."),fallback:i,fieldSchema:r.items,path:me},pt.default.createElement(vi,{key:me.join("."),components:n,fieldSchema:r.items,path:me,required:s,isArrayChild:!0,index:Ae,removeSelf:()=>B(o,Ae),fallback:i}))}):[])}if(r.type==="object"&&ue==="object"&&r.properties){let Ie=X,$e=x(H(x({},ee),{type:ue,schema:ee.schema,data:S||{}}),a);return pt.default.createElement(Ie,H(x({key:ee.scope},$e),{isArrayChild:$e.isArrayChild}),Object.entries(r.properties).map(([Ne,Me])=>{var Ve;let Ae=[...o,Ne];return pt.default.createElement(Cr,{key:Ae.join("."),fallback:i,fieldSchema:Me,path:Ae},pt.default.createElement(vi,{key:Ae.join("."),components:n,fieldSchema:Me,path:Ae,required:((Ve=r.required)==null?void 0:Ve.includes(Ne))||!1,isArrayChild:!1,fallback:i}))}))}if(ue==="discriminatedUnion"){let Ie=X,$e=x(H(x({},ee),{type:ue,schema:ee.schema,data:S||{},discriminatorKey:M?.key||null,discriminatorLabel:sa(M?.key||"Unknown"),discriminatorOptions:M?.values||null,discriminatorValue:oe,setDiscriminator:p(Ne=>{if(!M?.key){console.warn("No discriminator key found, cannot set discriminator");return}m(o,{[M.key]:Ne})},"setDiscriminator")}),a);return pt.default.createElement(Ie,H(x({key:ee.scope},$e),{isArrayChild:$e.isArrayChild}),$&&pt.default.createElement(Cr,{key:o.join("."),fallback:i,fieldSchema:$,path:o},pt.default.createElement(vi,{components:n,fieldSchema:$,path:o,required:s,isArrayChild:!1,fallback:i})))}let ie=X,Re=x(H(x({},ee),{type:ue,schema:ee.schema,config:{},required:s,data:S,description:r.description}),a);return pt.default.createElement(ie,x({},Re))},"FormElementRenderer"),cA=p(({schema:t,components:e,onChange:n,value:r,disableValidation:o,fallback:s,dataTransform:i,onValidation:a})=>{let[l,f]=(0,Zt.useState)(r);return(0,Zt.useEffect)(()=>{n(l)},[l]),(0,Zt.useEffect)(()=>{let d=zn(t);f(y=>_i(d,y))},[JSON.stringify(t),f]),Zt.default.createElement(aT,{formData:l,setFormData:f,formSchema:t,disableValidation:o||!1,dataTransform:i,onValidation:a},Zt.default.createElement(Cr,{fallback:s,fieldSchema:t,path:[]},Zt.default.createElement(vi,{components:e,fieldSchema:t,path:[],fallback:s,required:!0,isArrayChild:!1})))},"ZuiForm"),fA={string:{},number:{slider:{id:"slider",params:q.object({})}},boolean:{switch:{id:"switch",params:q.object({})}},array:{},object:{},discriminatedUnion:{}},dA={errors:Sf,jsonSchemaToZui:mo,zuiToJsonSchema:rs,objectToZui:Ur,toTypescript:bi,toTypescriptSchema:Ha};var $r=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===re.ZodFirstPartyTypeKind.ZodObject&&r.typeName===re.ZodFirstPartyTypeKind.ZodObject){let o=n.shape(),s=r.shape();return re.object({...o,...s})}if(n.typeName===re.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===re.ZodFirstPartyTypeKind.ZodRecord)return re.record(re.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},_y=re;var dt=re.string().min(1),wy=re.object({text:dt}),xy=re.object({markdown:dt}),By=re.object({imageUrl:dt}),Py=re.object({audioUrl:dt}),Ey=re.object({videoUrl:dt}),Sy=re.object({fileUrl:dt,title:dt.optional()}),ky=re.object({latitude:re.number(),longitude:re.number(),address:re.string().optional(),title:re.string().optional()}),Iy=re.object({title:dt,subtitle:dt.optional(),imageUrl:dt.optional(),actions:re.array(re.object({action:re.enum(["postback","url","say"]),label:dt,value:dt}))}),by=re.object({text:dt,options:re.array(re.object({label:dt,value:dt}))}),rP=re.object({items:re.array(Iy)}),iP=re.union([re.object({type:re.literal("text"),payload:wy}),re.object({type:re.literal("markdown"),payload:xy}),re.object({type:re.literal("image"),payload:By}),re.object({type:re.literal("audio"),payload:Py}),re.object({type:re.literal("video"),payload:Ey}),re.object({type:re.literal("file"),payload:Sy}),re.object({type:re.literal("location"),payload:ky})]),oP=re.object({items:re.array(iP)}),aP={schema:xy},sP={text:{schema:wy},image:{schema:By},audio:{schema:Py},video:{schema:Ey},file:{schema:Sy},location:{schema:ky},carousel:{schema:rP},card:{schema:Iy},dropdown:{schema:by},choice:{schema:by},bloc:{schema:oP}};C();R();O();var ho="x-bot-id",Cy="x-bot-user-id",Oy="x-integration-id",Ry="x-webhook-id",My="x-bp-configuration-type",vo="x-bp-configuration",To="x-bp-operation",Dy="x-bp-type";C();R();O();import{isNode as lk}from"browser-or-node";C();R();O();var ir=console;function kt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Zo(t,e=8072,n=dk){if(!lk)throw new Error("This function can only be called in Node.js");let o=(Rh(),jv(Oh)).createServer(async(s,i)=>{try{let a=await uk(s);if(a.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(a);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){ir.error("Error while handling request",{error:a?.message??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:a?.message??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function uk(t){let e=await fk(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let s=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:ck(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function ck(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function fk(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function dk(t){ir.info(`Listening on port ${t}`)}import{isApiError as pH,RuntimeError as gH}from"@botpress/client";C();R();O();C();R();O();C();R();O();C();R();O();var qe={};Un(qe,{mapKeys:()=>yk,mapValues:()=>gk,mergeRecords:()=>hk,pairs:()=>Lo,stripUndefinedProps:()=>mk,values:()=>pk});C();R();O();var Lo=t=>Object.entries(t),pk=t=>Object.values(t),gk=(t,e)=>Object.fromEntries(Lo(t).map(([n,r])=>[n,e(r,n)])),yk=(t,e)=>Object.fromEntries(Lo(t).map(([n,r])=>[e(n),r])),mk=t=>Object.fromEntries(Lo(t).filter(([,e])=>e!==void 0)),hk=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],s={};for(let i of o){let a=t[i],l=e[i];a&&l?s[i]=n(a,l):a?s[i]=a:l&&(s[i]=l)}return s};var Te={};Un(Te,{safePush:()=>vk,unique:()=>Tk});C();R();O();var vk=(t,...e)=>t?[...t,...e]:[...e],Tk=t=>Array.from(new Set(t));C();R();O();var Xt={};Un(Xt,{setName:()=>_k});C();R();O();var _k=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Mh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:qe.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=qe.mapValues(t.entities,i=>i.schema);for(let[i,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),f=a.output.schema.dereference(s),d=t.actions?.[i]?.name??i;r.actions[d]={...a,...t.actions?.[i]??{},input:{schema:l},output:{schema:f}},o.actions[i]={name:d}}for(let[i,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),f=t.events?.[i]?.name??i;r.events[f]={...a,...t.events?.[i]??{},schema:l},o.events[i]={name:f}}for(let[i,a]of Object.entries(t.definition.channels??{})){let l={};for(let[d,y]of Object.entries(a.messages)){let g=y.schema.dereference(s);l[d]={...y,schema:g}}let f=t.channels?.[i]?.name??i;r.channels[f]={...a,...t.channels?.[i]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:f}}return{resolved:r,statement:o}};C();R();O();var Fo=Symbol("schemaName"),Dh=t=>t?qe.mapValues(t,(n,r)=>({...n,[Fo]:r})):{},Nh=t=>Fo in t&&t[Fo]!==void 0,Hh=t=>t[Fo];C();R();O();var tl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;extend(e,n){let{entities:r,actions:o,events:s,channels:i}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(g=>g.name),f=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:d,statement:y}=Mh({...e,entities:r,actions:qe.stripUndefinedProps(o),events:qe.stripUndefinedProps(s),channels:qe.stripUndefinedProps(i)});return a.actions=qe.mergeRecords(a.actions??{},d.actions,this._mergeActions),a.channels=qe.mergeRecords(a.channels??{},d.channels,this._mergeChannels),a.events=qe.mergeRecords(a.events??{},d.events,this._mergeEvents),a.interfaces[f]={id:e.id,...y},this}_callBuilder(e,n){let o={entities:Dh(this.entities)},s=n(o),i=qe.pairs(s.entities).find(([l,f])=>!Nh(f));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:qe.mapValues(s.entities,l=>({name:Hh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:$r(e.input.schema,n.input.schema)},output:{schema:$r(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:$r(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=qe.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:s}};_mergeMessage=(e,n)=>({schema:$r(e.schema,n.schema)})};C();R();O();C();R();O();import{isApiError as zk,Client as Gk,RuntimeError as _v}from"@botpress/client";C();R();O();import{axiosRetry as bk}from"@botpress/client";var Ko={retries:3,retryCondition:t=>bk.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:t=>t*1e3};C();R();O();C();R();O();var Vr=class{constructor(e){this._client=e}createConversation=e=>this._client.createConversation(e);getConversation=e=>this._client.getConversation(e);listConversations=e=>this._client.listConversations(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);updateConversation=e=>this._client.updateConversation(e);deleteConversation=e=>this._client.deleteConversation(e);listParticipants=e=>this._client.listParticipants(e);addParticipant=e=>this._client.addParticipant(e);getParticipant=e=>this._client.getParticipant(e);removeParticipant=e=>this._client.removeParticipant(e);createEvent=e=>this._client.createEvent(e);getEvent=e=>this._client.getEvent(e);listEvents=e=>this._client.listEvents(e);createMessage=e=>this._client.createMessage(e);getOrCreateMessage=e=>this._client.getOrCreateMessage(e);getMessage=e=>this._client.getMessage(e);updateMessage=e=>this._client.updateMessage(e);listMessages=e=>this._client.listMessages(e);deleteMessage=e=>this._client.deleteMessage(e);createUser=e=>this._client.createUser(e);getUser=e=>this._client.getUser(e);listUsers=e=>this._client.listUsers(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);updateUser=e=>this._client.updateUser(e);deleteUser=e=>this._client.deleteUser(e);getState=e=>this._client.getState(e);setState=e=>this._client.setState(e);getOrSetState=e=>this._client.getOrSetState(e);patchState=e=>this._client.patchState(e);configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e)};C();R();O();var Wo=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};C();R();O();var wk=re.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),Uh=t=>{let e=t[ho],n=t[Cy],r=t[Oy],o=t[Ry],s=t[My],i=t[vo],a=wk.parse(t[To]);if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing bot user headers");if(!r)throw new Error("Missing integration headers");if(!o)throw new Error("Missing webhook headers");if(!i)throw new Error("Missing configuration headers");if(!a)throw new Error("Missing operation headers");return{botId:e,botUserId:n,integrationId:r,webhookId:o,operation:a,configurationType:s??null,configuration:i?JSON.parse(z.from(i,"base64").toString("utf-8")):{}}};C();R();O();C();R();O();C();R();O();C();R();O();var nl={},jh=!1;function wl(){return jh||(jh=!0,nl=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),nl}var rl={},$h=!1;function xk(){return $h||($h=!0,rl=Error),rl}var il={},Zh=!1;function Bk(){return Zh||(Zh=!0,il=EvalError),il}var ol={},Lh=!1;function Pk(){return Lh||(Lh=!0,ol=RangeError),ol}var al={},Fh=!1;function Ek(){return Fh||(Fh=!0,al=ReferenceError),al}var sl={},Kh=!1;function av(){return Kh||(Kh=!0,sl=SyntaxError),sl}var ll={},Wh=!1;function qo(){return Wh||(Wh=!0,ll=TypeError),ll}var ul={},qh=!1;function Sk(){return qh||(qh=!0,ul=URIError),ul}var cl={},zh=!1;function kk(){if(zh)return cl;zh=!0;var t=typeof Symbol<"u"&&Symbol,e=wl();return cl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},cl}var fl={},Gh=!1;function Ik(){if(Gh)return fl;Gh=!0;var t={__proto__:null,foo:{}},e=Object;return fl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},fl}var dl={},Vh=!1;function Ak(){if(Vh)return dl;Vh=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,f){for(var d=[],y=0;y<l.length;y+=1)d[y]=l[y];for(var g=0;g<f.length;g+=1)d[g+l.length]=f[g];return d},s=function(l,f){for(var d=[],y=f,g=0;y<l.length;y+=1,g+=1)d[g]=l[y];return d},i=function(a,l){for(var f="",d=0;d<a.length;d+=1)f+=a[d],d+1<a.length&&(f+=l);return f};return dl=function(l){var f=this;if(typeof f!="function"||e.apply(f)!==r)throw new TypeError(t+f);for(var d=s(arguments,1),y,g=function(){if(this instanceof y){var T=f.apply(this,o(d,arguments));return Object(T)===T?T:this}return f.apply(l,o(d,arguments))},m=n(0,f.length-d.length),v=[],B=0;B<m;B++)v[B]="$"+B;if(y=Function("binder","return function ("+i(v,",")+"){ return binder.apply(this,arguments); }")(g),f.prototype){var P=function(){};P.prototype=f.prototype,y.prototype=new P,P.prototype=null}return y},dl}var pl={},Jh=!1;function xl(){if(Jh)return pl;Jh=!0;var t=Ak();return pl=Function.prototype.bind||t,pl}var gl={},Yh=!1;function Ck(){if(Yh)return gl;Yh=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=xl();return gl=n.call(t,e),gl}var yl={},Xh=!1;function Yr(){if(Xh)return yl;Xh=!0;var t,e=xk(),n=Bk(),r=Pk(),o=Ek(),s=av(),i=qo(),a=Sk(),l=Function,f=function(Ae){try{return l('"use strict"; return ('+Ae+").constructor;")()}catch{}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch{d=null}var y=function(){throw new i},g=d?function(){try{return arguments.callee,y}catch{try{return d(arguments,"callee").get}catch{return y}}}():y,m=kk()(),v=Ik()(),B=Object.getPrototypeOf||(v?function(Ae){return Ae.__proto__}:null),P={},T=typeof Uint8Array>"u"||!B?t:B(Uint8Array),S={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":m&&B?B([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":P,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&B?B(B([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!m||!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%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!m||!B?t:B(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&B?B(""[Symbol.iterator]()):t,"%Symbol%":m?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":g,"%TypedArray%":T,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(B)try{null.error}catch(Ae){var E=B(B(Ae));S["%Error.prototype%"]=E}var M=function Ae(me){var Se;if(me==="%AsyncFunction%")Se=f("async function () {}");else if(me==="%GeneratorFunction%")Se=f("function* () {}");else if(me==="%AsyncGeneratorFunction%")Se=f("async function* () {}");else if(me==="%AsyncGenerator%"){var ce=Ae("%AsyncGeneratorFunction%");ce&&(Se=ce.prototype)}else if(me==="%AsyncIteratorPrototype%"){var he=Ae("%AsyncGenerator%");he&&B&&(Se=B(he.prototype))}return S[me]=Se,Se},$={__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"]},oe=xl(),X=Ck(),ue=oe.call(Function.call,Array.prototype.concat),ee=oe.call(Function.apply,Array.prototype.splice),ie=oe.call(Function.call,String.prototype.replace),Re=oe.call(Function.call,String.prototype.slice),Ie=oe.call(Function.call,RegExp.prototype.exec),$e=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ne=/\\(\\)?/g,Me=function(me){var Se=Re(me,0,1),ce=Re(me,-1);if(Se==="%"&&ce!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(ce==="%"&&Se!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var he=[];return ie(me,$e,function(D,Z,F,fe){he[he.length]=F?ie(fe,Ne,"$1"):Z||D}),he},Ve=function(me,Se){var ce=me,he;if(X($,ce)&&(he=$[ce],ce="%"+he[0]+"%"),X(S,ce)){var D=S[ce];if(D===P&&(D=M(ce)),typeof D>"u"&&!Se)throw new i("intrinsic "+me+" exists, but is not available. Please file an issue!");return{alias:he,name:ce,value:D}}throw new s("intrinsic "+me+" does not exist!")};return yl=function(me,Se){if(typeof me!="string"||me.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Se!="boolean")throw new i('"allowMissing" argument must be a boolean');if(Ie(/^%?[^%]*%?$/,me)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ce=Me(me),he=ce.length>0?ce[0]:"",D=Ve("%"+he+"%",Se),Z=D.name,F=D.value,fe=!1,ve=D.alias;ve&&(he=ve[0],ee(ce,ue([0,1],ve)));for(var A=1,k=!0;A<ce.length;A+=1){var j=ce[A],Y=Re(j,0,1),ae=Re(j,-1);if((Y==='"'||Y==="'"||Y==="`"||ae==='"'||ae==="'"||ae==="`")&&Y!==ae)throw new s("property names with quotes must have matching quotes");if((j==="constructor"||!k)&&(fe=!0),he+="."+j,Z="%"+he+"%",X(S,Z))F=S[Z];else if(F!=null){if(!(j in F)){if(!Se)throw new i("base intrinsic for "+me+" exists, but the property is not available.");return}if(d&&A+1>=ce.length){var b=d(F,j);k=!!b,k&&"get"in b&&!("originalValue"in b.get)?F=b.get:F=F[j]}else k=X(F,j),F=F[j];k&&!fe&&(S[Z]=F)}}return F},yl}var ml={},Qh=!1;function Bl(){if(Qh)return ml;Qh=!0;var t=Yr(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ml=e,ml}var hl={},ev=!1;function zo(){if(ev)return hl;ev=!0;var t=Yr(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return hl=e,hl}var vl={},tv=!1;function Ok(){if(tv)return vl;tv=!0;var t=Bl(),e=av(),n=qo(),r=zo();return vl=function(s,i,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,f=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!r&&r(s,i);if(t)t(s,i,{configurable:d===null&&g?g.configurable:!d,enumerable:l===null&&g?g.enumerable:!l,value:a,writable:f===null&&g?g.writable:!f});else if(y||!l&&!f&&!d)s[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},vl}var Tl={},nv=!1;function Rk(){if(nv)return Tl;nv=!0;var t=Bl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},Tl=e,Tl}var _l={},rv=!1;function Mk(){if(rv)return _l;rv=!0;var t=Yr(),e=Ok(),n=Rk()(),r=zo(),o=qo(),s=t("%Math.floor%");return _l=function(a,l){if(typeof a!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new o("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],d=!0,y=!0;if("length"in a&&r){var g=r(a,"length");g&&!g.configurable&&(d=!1),g&&!g.writable&&(y=!1)}return(d||y||!f)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},_l}var Jr={},iv=!1;function Pl(){if(iv)return Jr;iv=!0;var t=xl(),e=Yr(),n=Mk(),r=qo(),o=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,o),a=Bl(),l=e("%Math.max%");Jr=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,s,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var f=function(){return i(t,o,arguments)};return a?a(Jr,"apply",{value:f}):Jr.apply=f,Jr}var bl={},ov=!1;function El(){if(ov)return bl;ov=!0;var t=Yr(),e=Pl(),n=e(t("String.prototype.indexOf"));return bl=function(o,s){var i=t(o,!!s);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},bl}os();ws();var Sl={},sv=!1;function Hl(){if(sv)return Sl;sv=!0;var t=wl();return Sl=function(){return t()&&!!Symbol.toStringTag},Sl}var kl={},lv=!1;function Dk(){if(lv)return kl;lv=!0;var t=Hl()(),e=El(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},o=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=function(){return r(arguments)}();return r.isLegacyArguments=o,kl=s?r:o,kl}var Il={},uv=!1;function Nk(){if(uv)return Il;uv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Hl()(),o=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Il=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var f=t.call(l);return f==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var d=s();i=d?o(d):!1}return o(l)===i},Il}var Al={},cv=!1;function Hk(){if(cv)return Al;cv=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(S){S!==r&&(e=null)}else e=null;var o=/^\s*class\b/,s=function(E){try{var M=t.call(E);return o.test(M)}catch{return!1}},i=function(E){try{return s(E)?!1:(t.call(E),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",f="[object Function]",d="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",m="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,B=!(0 in[,]),P=function(){return!1};if(typeof document=="object"){var T=document.all;a.call(T)===a.call(document.all)&&(P=function(E){if((B||!E)&&(typeof E>"u"||typeof E=="object"))try{var M=a.call(E);return(M===y||M===g||M===m||M===l)&&E("")==null}catch{}return!1})}return Al=e?function(E){if(P(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,n)}catch(M){if(M!==r)return!1}return!s(E)&&i(E)}:function(E){if(P(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(v)return i(E);if(s(E))return!1;var M=a.call(E);return M!==f&&M!==d&&!/^\[object HTML/.test(M)?!1:i(E)},Al}var Cl={},fv=!1;function Uk(){if(fv)return Cl;fv=!0;var t=Hk(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,f,d){for(var y=0,g=l.length;y<g;y++)n.call(l,y)&&(d==null?f(l[y],y,l):f.call(d,l[y],y,l))},o=function(l,f,d){for(var y=0,g=l.length;y<g;y++)d==null?f(l.charAt(y),y,l):f.call(d,l.charAt(y),y,l)},s=function(l,f,d){for(var y in l)n.call(l,y)&&(d==null?f(l[y],y,l):f.call(d,l[y],y,l))},i=function(l,f,d){if(!t(f))throw new TypeError("iterator must be a function");var y;arguments.length>=3&&(y=d),e.call(l)==="[object Array]"?r(l,f,y):typeof l=="string"?o(l,f,y):s(l,f,y)};return Cl=i,Cl}var Ol={},dv=!1;function jk(){return dv||(dv=!0,Ol=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ol}var Rl={},pv=!1,$k=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Zk(){if(pv)return Rl;pv=!0;var t=jk(),e=typeof globalThis>"u"?$k:globalThis;return Rl=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},Rl}var Ml={},gv=!1,Lk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Tv(){if(gv)return Ml;gv=!0;var t=Uk(),e=Zk(),n=Pl(),r=El(),o=zo(),s=r("Object.prototype.toString"),i=Hl()(),a=typeof globalThis>"u"?Lk:globalThis,l=e(),f=r("String.prototype.slice"),d=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(P,T){for(var S=0;S<P.length;S+=1)if(P[S]===T)return S;return-1},g={__proto__:null};i&&o&&d?t(l,function(B){var P=new a[B];if(Symbol.toStringTag in P){var T=d(P),S=o(T,Symbol.toStringTag);if(!S){var E=d(T);S=o(E,Symbol.toStringTag)}g["$"+B]=n(S.get)}}):t(l,function(B){var P=new a[B],T=P.slice||P.set;T&&(g["$"+B]=n(T))});var m=function(P){var T=!1;return t(g,function(S,E){if(!T)try{"$"+S(P)===E&&(T=f(E,1))}catch{}}),T},v=function(P){var T=!1;return t(g,function(S,E){if(!T)try{S(P),T=f(E,1)}catch{}}),T};return Ml=function(P){if(!P||typeof P!="object")return!1;if(!i){var T=f(s(P),8,-1);return y(l,T)>-1?T:T!=="Object"?!1:v(P)}return o?m(P):null},Ml}var Dl={},yv=!1;function Fk(){if(yv)return Dl;yv=!0;var t=Tv();return Dl=function(n){return!!t(n)},Dl}var we={},mv=!1;function Kk(){if(mv)return we;mv=!0;var t=Dk(),e=Nk(),n=Tv(),r=Fk();function o(U){return U.call.bind(U)}var s=typeof BigInt<"u",i=typeof Symbol<"u",a=o(Object.prototype.toString),l=o(Number.prototype.valueOf),f=o(String.prototype.valueOf),d=o(Boolean.prototype.valueOf);if(s)var y=o(BigInt.prototype.valueOf);if(i)var g=o(Symbol.prototype.valueOf);function m(U,Pt){if(typeof U!="object")return!1;try{return Pt(U),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function v(U){return typeof Promise<"u"&&U instanceof Promise||U!==null&&typeof U=="object"&&typeof U.then=="function"&&typeof U.catch=="function"}we.isPromise=v;function B(U){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(U):r(U)||D(U)}we.isArrayBufferView=B;function P(U){return n(U)==="Uint8Array"}we.isUint8Array=P;function T(U){return n(U)==="Uint8ClampedArray"}we.isUint8ClampedArray=T;function S(U){return n(U)==="Uint16Array"}we.isUint16Array=S;function E(U){return n(U)==="Uint32Array"}we.isUint32Array=E;function M(U){return n(U)==="Int8Array"}we.isInt8Array=M;function $(U){return n(U)==="Int16Array"}we.isInt16Array=$;function oe(U){return n(U)==="Int32Array"}we.isInt32Array=oe;function X(U){return n(U)==="Float32Array"}we.isFloat32Array=X;function ue(U){return n(U)==="Float64Array"}we.isFloat64Array=ue;function ee(U){return n(U)==="BigInt64Array"}we.isBigInt64Array=ee;function ie(U){return n(U)==="BigUint64Array"}we.isBigUint64Array=ie;function Re(U){return a(U)==="[object Map]"}Re.working=typeof Map<"u"&&Re(new Map);function Ie(U){return typeof Map>"u"?!1:Re.working?Re(U):U instanceof Map}we.isMap=Ie;function $e(U){return a(U)==="[object Set]"}$e.working=typeof Set<"u"&&$e(new Set);function Ne(U){return typeof Set>"u"?!1:$e.working?$e(U):U instanceof Set}we.isSet=Ne;function Me(U){return a(U)==="[object WeakMap]"}Me.working=typeof WeakMap<"u"&&Me(new WeakMap);function Ve(U){return typeof WeakMap>"u"?!1:Me.working?Me(U):U instanceof WeakMap}we.isWeakMap=Ve;function Ae(U){return a(U)==="[object WeakSet]"}Ae.working=typeof WeakSet<"u"&&Ae(new WeakSet);function me(U){return Ae(U)}we.isWeakSet=me;function Se(U){return a(U)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function ce(U){return typeof ArrayBuffer>"u"?!1:Se.working?Se(U):U instanceof ArrayBuffer}we.isArrayBuffer=ce;function he(U){return a(U)==="[object DataView]"}he.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&he(new DataView(new ArrayBuffer(1),0,1));function D(U){return typeof DataView>"u"?!1:he.working?he(U):U instanceof DataView}we.isDataView=D;var Z=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(U){return a(U)==="[object SharedArrayBuffer]"}function fe(U){return typeof Z>"u"?!1:(typeof F.working>"u"&&(F.working=F(new Z)),F.working?F(U):U instanceof Z)}we.isSharedArrayBuffer=fe;function ve(U){return a(U)==="[object AsyncFunction]"}we.isAsyncFunction=ve;function A(U){return a(U)==="[object Map Iterator]"}we.isMapIterator=A;function k(U){return a(U)==="[object Set Iterator]"}we.isSetIterator=k;function j(U){return a(U)==="[object Generator]"}we.isGeneratorObject=j;function Y(U){return a(U)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=Y;function ae(U){return m(U,l)}we.isNumberObject=ae;function b(U){return m(U,f)}we.isStringObject=b;function w(U){return m(U,d)}we.isBooleanObject=w;function W(U){return s&&m(U,y)}we.isBigIntObject=W;function Q(U){return i&&m(U,g)}we.isSymbolObject=Q;function He(U){return ae(U)||b(U)||w(U)||W(U)||Q(U)}we.isBoxedPrimitive=He;function _e(U){return typeof Uint8Array<"u"&&(ce(U)||fe(U))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(U){Object.defineProperty(we,U,{enumerable:!1,value:function(){throw new Error(U+" is not supported in userland")}})}),we}var Nl={},hv=!1;function Wk(){return hv||(hv=!0,Nl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Nl}var xe={},vv=!1,Xr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function qk(){if(vv)return xe;vv=!0;var t=St,e=Object.getOwnPropertyDescriptors||function(Z){for(var F=Object.keys(Z),fe={},ve=0;ve<F.length;ve++)fe[F[ve]]=Object.getOwnPropertyDescriptor(Z,F[ve]);return fe},n=/%[sdj%]/g;xe.format=function(D){if(!$(D)){for(var Z=[],F=0;F<arguments.length;F++)Z.push(i(arguments[F]));return Z.join(" ")}for(var F=1,fe=arguments,ve=fe.length,A=String(D).replace(n,function(j){if(j==="%%")return"%";if(F>=ve)return j;switch(j){case"%s":return String(fe[F++]);case"%d":return Number(fe[F++]);case"%j":try{return JSON.stringify(fe[F++])}catch{return"[Circular]"}default:return j}}),k=fe[F];F<ve;k=fe[++F])S(k)||!ee(k)?A+=" "+k:A+=" "+i(k);return A},xe.deprecate=function(D,Z){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,Z).apply(this||Xr,arguments)};var F=!1;function fe(){if(!F){if(t.throwDeprecation)throw new Error(Z);t.traceDeprecation?console.trace(Z):console.error(Z),F=!0}return D.apply(this||Xr,arguments)}return fe};var r={},o=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}xe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(o.test(D)){var Z=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,Z,F)}}else r[D]=function(){};return r[D]};function i(D,Z){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),T(Z)?F.showHidden=Z:Z&&xe._extend(F,Z),X(F.showHidden)&&(F.showHidden=!1),X(F.depth)&&(F.depth=2),X(F.colors)&&(F.colors=!1),X(F.customInspect)&&(F.customInspect=!0),F.colors&&(F.stylize=a),d(F,D,F.depth)}xe.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(D,Z){var F=i.styles[Z];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,Z){return D}function f(D){var Z={};return D.forEach(function(F,fe){Z[F]=!0}),Z}function d(D,Z,F){if(D.customInspect&&Z&&Ie(Z.inspect)&&Z.inspect!==xe.inspect&&!(Z.constructor&&Z.constructor.prototype===Z)){var fe=Z.inspect(F,D);return $(fe)||(fe=d(D,fe,F)),fe}var ve=y(D,Z);if(ve)return ve;var A=Object.keys(Z),k=f(A);if(D.showHidden&&(A=Object.getOwnPropertyNames(Z)),Re(Z)&&(A.indexOf("message")>=0||A.indexOf("description")>=0))return g(Z);if(A.length===0){if(Ie(Z)){var j=Z.name?": "+Z.name:"";return D.stylize("[Function"+j+"]","special")}if(ue(Z))return D.stylize(RegExp.prototype.toString.call(Z),"regexp");if(ie(Z))return D.stylize(Date.prototype.toString.call(Z),"date");if(Re(Z))return g(Z)}var Y="",ae=!1,b=["{","}"];if(P(Z)&&(ae=!0,b=["[","]"]),Ie(Z)){var w=Z.name?": "+Z.name:"";Y=" [Function"+w+"]"}if(ue(Z)&&(Y=" "+RegExp.prototype.toString.call(Z)),ie(Z)&&(Y=" "+Date.prototype.toUTCString.call(Z)),Re(Z)&&(Y=" "+g(Z)),A.length===0&&(!ae||Z.length==0))return b[0]+Y+b[1];if(F<0)return ue(Z)?D.stylize(RegExp.prototype.toString.call(Z),"regexp"):D.stylize("[Object]","special");D.seen.push(Z);var W;return ae?W=m(D,Z,F,k,A):W=A.map(function(Q){return v(D,Z,F,k,Q,ae)}),D.seen.pop(),B(W,Y,b)}function y(D,Z){if(X(Z))return D.stylize("undefined","undefined");if($(Z)){var F="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(M(Z))return D.stylize(""+Z,"number");if(T(Z))return D.stylize(""+Z,"boolean");if(S(Z))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function m(D,Z,F,fe,ve){for(var A=[],k=0,j=Z.length;k<j;++k)me(Z,String(k))?A.push(v(D,Z,F,fe,String(k),!0)):A.push("");return ve.forEach(function(Y){Y.match(/^\d+$/)||A.push(v(D,Z,F,fe,Y,!0))}),A}function v(D,Z,F,fe,ve,A){var k,j,Y;if(Y=Object.getOwnPropertyDescriptor(Z,ve)||{value:Z[ve]},Y.get?Y.set?j=D.stylize("[Getter/Setter]","special"):j=D.stylize("[Getter]","special"):Y.set&&(j=D.stylize("[Setter]","special")),me(fe,ve)||(k="["+ve+"]"),j||(D.seen.indexOf(Y.value)<0?(S(F)?j=d(D,Y.value,null):j=d(D,Y.value,F-1),j.indexOf(`
|
|
79
|
+
`,o+="})"}let s=n?o?n+o:r?r==="z.never()"?n+".strict()":n+`.catchall(${r})`:n:o||(r?`z.record(${r})`:"z.record(z.any())");return Qe.an.anyOf(t)&&(s+=`.and(${hy(H(x({},t),{anyOf:t.anyOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?H(x({},i),{type:"object"}):i)}),e)})`),Qe.a.oneOf(t)&&(s+=`.and(${is(H(x({},t),{oneOf:t.oneOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?H(x({},i),{type:"object"}):i)}),e)})`),Qe.an.allOf(t)&&(s+=`.and(${jr(H(x({},t),{allOf:t.allOf.map(i=>typeof i=="object"&&!i.type&&(i.properties||i.additionalProperties||i.patternProperties)?H(x({},i),{type:"object"}):i)}),e)})`),s}p(vy,"parseObject");var qB=p(t=>{var e;let n="z.string()";if((e=t[ke])!=null&&e.coerce){if(t.format==="date-time")return"z.coerce.date()";n="z.coerce.string()"}return n+=at(t,"format",({value:r})=>{switch(r){case"email":return[".email(",")"];case"ip":return[".ip(",")"];case"ipv4":return['.ip({ version: "v4"',", message: "," })"];case"ipv6":return['.ip({ version: "v6"',", message: "," })"];case"uri":return[".url(",")"];case"uuid":return[".uuid(",")"];case"date-time":return[".datetime(",")"]}}),n+=at(t,"pattern",({json:r})=>[`.regex(new RegExp(${r})`,", ",")"]),n+=at(t,"minLength",({json:r})=>[`.min(${r}`,", ",")"]),n+=at(t,"maxLength",({json:r})=>[`.max(${r}`,", ",")"]),n},"parseString"),zB=p((t,e)=>`${nt(jB(t,"nullable"),e,!0)}.nullable()`,"parseNullable"),GB=p(t=>`z.ref('${t.$ref}')`,"parseRef"),VB=p((t,e)=>{var n,r;if(t.oneOf.length<=1||!((n=t.discriminator)!=null&&n.propertyName))return is(t,e);let o=t.oneOf.map((s,i)=>nt(s,H(x({},e),{path:[...e.path,"oneOf",i]})));return`z.discriminatedUnion("${(r=t.discriminator)==null?void 0:r.propertyName}", [${o.join(", ")}])`},"parseDiscriminator"),nt=p((t,e={seen:new Map,path:[]},n)=>{if(typeof t!="object")return t?"z.any()":"z.never()";if(e.parserOverride){let s=e.parserOverride(t,e);if(typeof s=="string")return s}let r=e.seen.get(t);if(r){if(r.r!==void 0)return r.r;if(e.depth===void 0||r.n>=e.depth)return"z.any()";r.n+=1}else r={r:void 0,n:0},e.seen.set(t,r);let o=XB(t,e);return n||(o=JB(t,o),e.withoutDefaults||(o=YB(t,o))),r.r=o,o},"parseSchema"),JB=p((t,e)=>(t.description&&(e+=`.describe(${JSON.stringify(t.description)})`),e),"addMeta"),YB=p((t,e)=>(t.default!==void 0&&(e+=`.default(${JSON.stringify(t.default)})`),e),"addDefaults"),XB=p((t,e)=>Qe.a.nullable(t)?zB(t,e):Qe.an.object(t)?vy(t,e):Qe.an.array(t)?ZB(t,e):Qe.an.anyOf(t)?hy(t,e):Qe.an.allOf(t)?jr(t,e):Qe.a.discriminator(t)?VB(t,e):Qe.a.oneOf(t)?is(t,e):Qe.a.not(t)?NB(t,e):Qe.an.enum(t)?FB(t):Qe.a.const(t)?LB(t):Qe.a.multipleType(t)?DB(t,e):Qe.a.primitive(t,"string")?qB(t):Qe.a.primitive(t,"number")||Qe.a.primitive(t,"integer")?WB(t):Qe.a.primitive(t,"boolean")?RB(t):Qe.a.primitive(t,"null")?HB(t):Qe.a.conditional(t)?KB(t,e):Qe.a.ref(t)?GB(t):MB(t),"selectParser"),Qe={an:{object:p(t=>t.type==="object","object"),array:p(t=>t.type==="array","array"),anyOf:p(t=>t.anyOf!==void 0,"anyOf"),allOf:p(t=>t.allOf!==void 0,"allOf"),enum:p(t=>t.enum!==void 0,"enum")},a:{nullable:p(t=>t.nullable===!0,"nullable"),multipleType:p(t=>Array.isArray(t.type),"multipleType"),not:p(t=>t.not!==void 0,"not"),const:p(t=>t.const!==void 0,"const"),primitive:p((t,e)=>t.type===e,"primitive"),conditional:p(t=>Boolean("if"in t&&t.if&&"then"in t&&"else"in t&&t.then&&t.else),"conditional"),discriminator:p(t=>{var e;return t.oneOf!==void 0&&((e=t.discriminator)==null?void 0:e.propertyName)!==void 0},"discriminator"),oneOf:p(t=>t.oneOf!==void 0,"oneOf"),ref:p(t=>t.$ref!==void 0,"ref")}},QB=p(t=>{let e;try{e=new Function("z",`return ${t}`)(q)}catch(n){return{sucess:!1,error:`Failed to evaluate schema: ${(n instanceof Error?n:new Error(String(n))).message}`}}return e instanceof q.ZodType?{sucess:!0,value:e}:{sucess:!1,error:`String "${t}" does not evaluate to a Zod schema`}},"evalZuiString"),eP=p(t=>nt(t,{seen:new Map,path:[]}),"jsonSchemaToZodStr"),tP=p(t=>{let e=eP(t);e=e.replaceAll("errors: z.ZodError[]","errors");let n=QB(e);if(!n.sucess)throw new Af(n.error);return n.value},"jsonSchemaToZod"),kr=p((t,e)=>{var n,r;if(e[ke]&&t._def&&(t._def[ke]=e[ke]),((n=t._def)==null?void 0:n.typeName)==="ZodObject"&&e.type==="object"&&e.properties&&Object.entries(e.properties).forEach(([o,s])=>{let i=typeof t._def.shape=="function"?t._def.shape():t._def.shape;i[o]&&kr(i[o],s)}),((r=t._def)==null?void 0:r.typeName)==="ZodRecord"&&e.type==="object"&&e.additionalProperties&&kr(t._def.valueType,e.additionalProperties),e.type==="array"&&e.items){let o=e.items;if(typeof o=="object"&&!Array.isArray(o)){let s=t._def.type;s&&kr(s,o)}else Array.isArray(o)&&o.forEach((s,i)=>{let a=t._def;a.typeName===re.ZodFirstPartyTypeKind.ZodTuple&&kr(a.items[i],s)})}},"applyZuiPropsRecursively"),mo=p(t=>{let e=tP(t);return kr(e,t),e},"jsonSchemaToZui"),Ty=class extends er.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("Uncaught error:",e,n)}render(){return this.state.hasError&&this.props.fallback?er.default.createElement(this.props.fallback,{error:this.state.error,schema:this.props.fieldSchema}):this.props.children}};p(Ty,"ErrorBoundary");var Cr=Ty;function nP(t,e){return n=>er.default.createElement(Cr,{fallback:e,fieldSchema:n.fieldSchema,path:n.path},er.default.createElement(t,x({},n)))}p(nP,"withErrorBoundary");var vi=p(t=>{var e=t,{components:n,fieldSchema:r,path:o,required:s,fallback:i}=e,a=pf(e,["components","fieldSchema","path","required","fallback"]),l,f;let{formData:d,disabled:y,hidden:g,handlePropertyChange:m,addArrayItem:v,removeArrayItem:B,formErrors:P,formValid:T}=mf(r,o),S=(0,pt.useMemo)(()=>hn(d,o),[d,o]),E=(0,pt.useMemo)(()=>cT(n,r),[r,n]),{discriminator:M,discriminatedSchema:$,discriminatorValue:oe}=sT(r,o);if(!E||g===!0)return null;let{Component:X,type:ue}=E,ee={type:ue,componentID:E.id,scope:o.join("."),context:{path:o,readonly:!1,formData:d,formErrors:P,formValid:T,updateForm:m,updateFormData:p(Ie=>m([],Ie),"updateFormData")},onChange:p(Ie=>m(o,Ie),"onChange"),disabled:y,errors:P?.filter(Ie=>Ie.path===o)||[],label:((l=r[ke])==null?void 0:l.title)||sa(((f=o[o.length-1])==null?void 0:f.toString())||""),params:E.params,schema:r,zuiProps:r[ke]};if(r.type==="array"&&ue==="array"){let Ie=X,$e=ee.schema,Ne=Array.isArray(S)||typeof S=="object"?S:[],Me=x(H(x({},ee),{type:ue,schema:$e,data:Ne,addItem:p(Ve=>v(o,Ve),"addItem"),removeItem:p(Ve=>B(o,Ve),"removeItem")}),a);return Array.isArray(r.items)?null:pt.default.createElement(Ie,H(x({key:ee.scope},Me),{isArrayChild:Me.isArrayChild}),Array.isArray(Me.data)?Me.data.map((Ve,Ae)=>{let me=[...o,Ae.toString()];return pt.default.createElement(Cr,{key:me.join("."),fallback:i,fieldSchema:r.items,path:me},pt.default.createElement(vi,{key:me.join("."),components:n,fieldSchema:r.items,path:me,required:s,isArrayChild:!0,index:Ae,removeSelf:()=>B(o,Ae),fallback:i}))}):[])}if(r.type==="object"&&ue==="object"&&r.properties){let Ie=X,$e=x(H(x({},ee),{type:ue,schema:ee.schema,data:S||{}}),a);return pt.default.createElement(Ie,H(x({key:ee.scope},$e),{isArrayChild:$e.isArrayChild}),Object.entries(r.properties).map(([Ne,Me])=>{var Ve;let Ae=[...o,Ne];return pt.default.createElement(Cr,{key:Ae.join("."),fallback:i,fieldSchema:Me,path:Ae},pt.default.createElement(vi,{key:Ae.join("."),components:n,fieldSchema:Me,path:Ae,required:((Ve=r.required)==null?void 0:Ve.includes(Ne))||!1,isArrayChild:!1,fallback:i}))}))}if(ue==="discriminatedUnion"){let Ie=X,$e=x(H(x({},ee),{type:ue,schema:ee.schema,data:S||{},discriminatorKey:M?.key||null,discriminatorLabel:sa(M?.key||"Unknown"),discriminatorOptions:M?.values||null,discriminatorValue:oe,setDiscriminator:p(Ne=>{if(!M?.key){console.warn("No discriminator key found, cannot set discriminator");return}m(o,{[M.key]:Ne})},"setDiscriminator")}),a);return pt.default.createElement(Ie,H(x({key:ee.scope},$e),{isArrayChild:$e.isArrayChild}),$&&pt.default.createElement(Cr,{key:o.join("."),fallback:i,fieldSchema:$,path:o},pt.default.createElement(vi,{components:n,fieldSchema:$,path:o,required:s,isArrayChild:!1,fallback:i})))}let ie=X,Re=x(H(x({},ee),{type:ue,schema:ee.schema,config:{},required:s,data:S,description:r.description}),a);return pt.default.createElement(ie,x({},Re))},"FormElementRenderer"),cA=p(({schema:t,components:e,onChange:n,value:r,disableValidation:o,fallback:s,dataTransform:i,onValidation:a})=>{let[l,f]=(0,Zt.useState)(r);return(0,Zt.useEffect)(()=>{n(l)},[l]),(0,Zt.useEffect)(()=>{let d=zn(t);f(y=>_i(d,y))},[JSON.stringify(t),f]),Zt.default.createElement(aT,{formData:l,setFormData:f,formSchema:t,disableValidation:o||!1,dataTransform:i,onValidation:a},Zt.default.createElement(Cr,{fallback:s,fieldSchema:t,path:[]},Zt.default.createElement(vi,{components:e,fieldSchema:t,path:[],fallback:s,required:!0,isArrayChild:!1})))},"ZuiForm"),fA={string:{},number:{slider:{id:"slider",params:q.object({})}},boolean:{switch:{id:"switch",params:q.object({})}},array:{},object:{},discriminatedUnion:{}},dA={errors:Sf,jsonSchemaToZui:mo,zuiToJsonSchema:rs,objectToZui:Ur,toTypescript:bi,toTypescriptSchema:Ha};var $r=(t,e)=>{let n=t._def,r=e._def;if(n.typeName===re.ZodFirstPartyTypeKind.ZodObject&&r.typeName===re.ZodFirstPartyTypeKind.ZodObject){let o=n.shape(),s=r.shape();return re.object({...o,...s})}if(n.typeName===re.ZodFirstPartyTypeKind.ZodRecord&&r.typeName===re.ZodFirstPartyTypeKind.ZodRecord)return re.record(re.intersection(n.valueType,r.valueType));throw new Error("Cannot merge object schemas with record schemas")},_y=re;var dt=re.string().min(1),wy=re.object({text:dt}),xy=re.object({markdown:dt}),By=re.object({imageUrl:dt}),Py=re.object({audioUrl:dt}),Ey=re.object({videoUrl:dt}),Sy=re.object({fileUrl:dt,title:dt.optional()}),ky=re.object({latitude:re.number(),longitude:re.number(),address:re.string().optional(),title:re.string().optional()}),Iy=re.object({title:dt,subtitle:dt.optional(),imageUrl:dt.optional(),actions:re.array(re.object({action:re.enum(["postback","url","say"]),label:dt,value:dt}))}),by=re.object({text:dt,options:re.array(re.object({label:dt,value:dt}))}),rP=re.object({items:re.array(Iy)}),iP=re.union([re.object({type:re.literal("text"),payload:wy}),re.object({type:re.literal("markdown"),payload:xy}),re.object({type:re.literal("image"),payload:By}),re.object({type:re.literal("audio"),payload:Py}),re.object({type:re.literal("video"),payload:Ey}),re.object({type:re.literal("file"),payload:Sy}),re.object({type:re.literal("location"),payload:ky})]),oP=re.object({items:re.array(iP)}),aP={schema:xy},sP={text:{schema:wy},image:{schema:By},audio:{schema:Py},video:{schema:Ey},file:{schema:Sy},location:{schema:ky},carousel:{schema:rP},card:{schema:Iy},dropdown:{schema:by},choice:{schema:by},bloc:{schema:oP}};C();R();O();var ho="x-bot-id",Cy="x-bot-user-id",Oy="x-integration-id",Ry="x-webhook-id",My="x-bp-configuration-type",vo="x-bp-configuration",To="x-bp-operation",Dy="x-bp-type",SA={HIDDEN_IN_STUDIO:{bpActionHiddenInStudio:"true"},AWAIT_RETURN:{bpActionAwaitReturn:"true"}};C();R();O();import{isNode as lk}from"browser-or-node";C();R();O();var ir=console;function kt(t){if(!t.body)throw new Error("Missing body");return JSON.parse(t.body)}async function Zo(t,e=8072,n=dk){if(!lk)throw new Error("This function can only be called in Node.js");let o=(Rh(),jv(Oh)).createServer(async(s,i)=>{try{let a=await uk(s);if(a.path==="/health"){i.writeHead(200).end("ok");return}let l=await t(a);i.writeHead(l?.status??200,l?.headers??{}).end(l?.body??"{}")}catch(a){ir.error("Error while handling request",{error:a?.message??"Internal error occured"}),i.writeHead(500).end(JSON.stringify({error:a?.message??"Internal error occured"}))}});return o.listen(e,()=>n(e)),o}async function uk(t){let e=await fk(t),n={};for(let o=0;o<t.rawHeaders.length;o+=2){let s=t.rawHeaders[o].toLowerCase(),i=t.rawHeaders[o+1];n[s]=i}let r=new URL(t.url??"",t.headers.host?`http://${t.headers.host}`:"http://botpress.cloud");return{body:e,path:r.pathname,query:ck(r.search,"?"),headers:n,method:t.method?.toUpperCase()??"GET"}}function ck(t,e){return t.indexOf(e)===0?t.slice(e.length):t}async function fk(t){return new Promise((e,n)=>{if(t.method!=="POST"&&t.method!=="PUT"&&t.method!=="PATCH")return e(void 0);let r="";t.on("data",o=>r+=o.toString()),t.on("error",o=>n(o)),t.on("end",()=>e(r))})}function dk(t){ir.info(`Listening on port ${t}`)}import{isApiError as yH,RuntimeError as mH}from"@botpress/client";C();R();O();C();R();O();C();R();O();C();R();O();var qe={};Un(qe,{mapKeys:()=>yk,mapValues:()=>gk,mergeRecords:()=>hk,pairs:()=>Lo,stripUndefinedProps:()=>mk,values:()=>pk});C();R();O();var Lo=t=>Object.entries(t),pk=t=>Object.values(t),gk=(t,e)=>Object.fromEntries(Lo(t).map(([n,r])=>[n,e(r,n)])),yk=(t,e)=>Object.fromEntries(Lo(t).map(([n,r])=>[e(n),r])),mk=t=>Object.fromEntries(Lo(t).filter(([,e])=>e!==void 0)),hk=(t,e,n)=>{let r=[...Object.keys(t),...Object.keys(e)],o=[...new Set(r)],s={};for(let i of o){let a=t[i],l=e[i];a&&l?s[i]=n(a,l):a?s[i]=a:l&&(s[i]=l)}return s};var Te={};Un(Te,{safePush:()=>vk,unique:()=>Tk});C();R();O();var vk=(t,...e)=>t?[...t,...e]:[...e],Tk=t=>Array.from(new Set(t));C();R();O();var Xt={};Un(Xt,{setName:()=>_k});C();R();O();var _k=(t,e)=>(Object.defineProperty(t,"name",{value:e}),t);var Mh=t=>{let{name:e,version:n}=t,r={actions:{},events:{},channels:{}},o={name:e,version:n,entities:qe.mapValues(t.entities,i=>({name:i.name})),actions:{},events:{},channels:{}},s=qe.mapValues(t.entities,i=>i.schema);for(let[i,a]of Object.entries(t.definition.actions??{})){let l=a.input.schema.dereference(s),f=a.output.schema.dereference(s),d=t.actions?.[i]?.name??i;r.actions[d]={...a,...t.actions?.[i]??{},input:{schema:l},output:{schema:f}},o.actions[i]={name:d}}for(let[i,a]of Object.entries(t.definition.events??{})){let l=a.schema.dereference(s),f=t.events?.[i]?.name??i;r.events[f]={...a,...t.events?.[i]??{},schema:l},o.events[i]={name:f}}for(let[i,a]of Object.entries(t.definition.channels??{})){let l={};for(let[d,y]of Object.entries(a.messages)){let g=y.schema.dereference(s);l[d]={...y,schema:g}}let f=t.channels?.[i]?.name??i;r.channels[f]={...a,...t.channels?.[i]??{},message:{...a.message??{},tags:{...a.message?.tags??{},...t.channels?.[i]?.message?.tags??{}}},conversation:{...a.conversation??{},tags:{...a.conversation?.tags??{},...t.channels?.[i]?.conversation?.tags??{}}},messages:l},o.channels[i]={name:f}}return{resolved:r,statement:o}};C();R();O();var Fo=Symbol("schemaName"),Dh=t=>t?qe.mapValues(t,(n,r)=>({...n,[Fo]:r})):{},Nh=t=>Fo in t&&t[Fo]!==void 0,Hh=t=>t[Fo];C();R();O();var tl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.identifier=e.identifier,this.description=e.description,this.configuration=e.configuration,this.configurations=e.configurations,this.events=e.events,this.actions=e.actions,this.channels=e.channels,this.states=e.states,this.user=e.user,this.secrets=e.secrets,this.entities=e.entities,this.interfaces=e.interfaces,this.__advanced=e.__advanced}name;version;title;description;icon;readme;configuration;configurations;events;actions;channels;states;user;secrets;identifier;entities;interfaces;__advanced;extend(e,n){let{entities:r,actions:o,events:s,channels:i}=this._callBuilder(e,n),a=this;a.interfaces??={};let l=Object.values(r).map(g=>g.name),f=l.length===0?e.name:`${e.name}<${l.join(",")}>`,{resolved:d,statement:y}=Mh({...e,entities:r,actions:qe.stripUndefinedProps(o),events:qe.stripUndefinedProps(s),channels:qe.stripUndefinedProps(i)});return a.actions=qe.mergeRecords(a.actions??{},d.actions,this._mergeActions),a.channels=qe.mergeRecords(a.channels??{},d.channels,this._mergeChannels),a.events=qe.mergeRecords(a.events??{},d.events,this._mergeEvents),a.interfaces[f]={id:e.id,...y},this}_callBuilder(e,n){let o={entities:Dh(this.entities)},s=n(o),i=qe.pairs(s.entities).find(([l,f])=>!Nh(f));if(i)throw new Error(`Cannot extend interface "${e.name}" with entity "${i[0]}"; the provided schema is not part of the integration's entities.`);return{entities:qe.mapValues(s.entities,l=>({name:Hh(l),schema:l.schema})),actions:s.actions??{},events:s.events??{},channels:s.channels??{}}}_mergeActions=(e,n)=>({...e,...n,input:{schema:$r(e.input.schema,n.input.schema)},output:{schema:$r(e.output.schema,n.output.schema)}});_mergeEvents=(e,n)=>({...e,...n,schema:$r(e.schema,n.schema)});_mergeChannels=(e,n)=>{let r=qe.mergeRecords(e.messages,n.messages,this._mergeMessage),o;(e.conversation||n.conversation)&&(o={tags:{...e.conversation?.tags,...n.conversation?.tags}});let s;return(e.message||n.message)&&(s={tags:{...e.message?.tags,...n.message?.tags}}),{...e,...n,messages:r,conversation:o,message:s}};_mergeMessage=(e,n)=>({schema:$r(e.schema,n.schema)})};C();R();O();C();R();O();import{isApiError as zk,Client as Gk,RuntimeError as bv}from"@botpress/client";C();R();O();import{axiosRetry as bk}from"@botpress/client";var Ko={retries:3,retryCondition:t=>bk.isNetworkOrIdempotentRequestError(t)||[429,502].includes(t.response?.status??0),retryDelay:t=>t*1e3};C();R();O();C();R();O();var Vr=class{constructor(e){this._client=e}createConversation=e=>this._client.createConversation(e);getConversation=e=>this._client.getConversation(e);listConversations=e=>this._client.listConversations(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);updateConversation=e=>this._client.updateConversation(e);deleteConversation=e=>this._client.deleteConversation(e);listParticipants=e=>this._client.listParticipants(e);addParticipant=e=>this._client.addParticipant(e);getParticipant=e=>this._client.getParticipant(e);removeParticipant=e=>this._client.removeParticipant(e);createEvent=e=>this._client.createEvent(e);getEvent=e=>this._client.getEvent(e);listEvents=e=>this._client.listEvents(e);createMessage=e=>this._client.createMessage(e);getOrCreateMessage=e=>this._client.getOrCreateMessage(e);getMessage=e=>this._client.getMessage(e);updateMessage=e=>this._client.updateMessage(e);listMessages=e=>this._client.listMessages(e);deleteMessage=e=>this._client.deleteMessage(e);createUser=e=>this._client.createUser(e);getUser=e=>this._client.getUser(e);listUsers=e=>this._client.listUsers(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);updateUser=e=>this._client.updateUser(e);deleteUser=e=>this._client.deleteUser(e);getState=e=>this._client.getState(e);setState=e=>this._client.setState(e);getOrSetState=e=>this._client.getOrSetState(e);patchState=e=>this._client.patchState(e);configureIntegration=e=>this._client.configureIntegration(e);uploadFile=e=>this._client.uploadFile(e);upsertFile=e=>this._client.upsertFile(e);deleteFile=e=>this._client.deleteFile(e);listFiles=e=>this._client.listFiles(e);getFile=e=>this._client.getFile(e);updateFileMetadata=e=>this._client.updateFileMetadata(e)};C();R();O();var Wo=class{_cost=0;get cost(){return this._cost}setCost(e){this._cost=e}toJSON(){return{cost:this.cost}}};C();R();O();C();R();O();var qo="#";var wk=re.enum(["webhook_received","message_created","action_triggered","register","unregister","ping","create_user","create_conversation"]),jh=t=>{let e=t[ho],n=t[Cy],r=t[Oy],o=t[Ry],s=t[My],i=t[vo],a=wk.parse(t[To]);if(!e)throw new Error("Missing bot headers");if(!n)throw new Error("Missing bot user headers");if(!r)throw new Error("Missing integration headers");if(!o)throw new Error("Missing webhook headers");if(!i)throw new Error("Missing configuration headers");if(!a)throw new Error("Missing operation headers");return{botId:e,botUserId:n,integrationId:r,webhookId:o,operation:a,configurationType:s??null,configuration:i?JSON.parse(z.from(i,"base64").toString("utf-8")):{}}};C();R();O();C();R();O();C();R();O();C();R();O();var nl={},$h=!1;function wl(){return $h||($h=!0,nl=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[n]=o;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,n);if(i.value!==o||i.enumerable!==!0)return!1}return!0}),nl}var rl={},Zh=!1;function xk(){return Zh||(Zh=!0,rl=Error),rl}var il={},Lh=!1;function Bk(){return Lh||(Lh=!0,il=EvalError),il}var ol={},Fh=!1;function Pk(){return Fh||(Fh=!0,ol=RangeError),ol}var al={},Kh=!1;function Ek(){return Kh||(Kh=!0,al=ReferenceError),al}var sl={},Wh=!1;function sv(){return Wh||(Wh=!0,sl=SyntaxError),sl}var ll={},qh=!1;function zo(){return qh||(qh=!0,ll=TypeError),ll}var ul={},zh=!1;function Sk(){return zh||(zh=!0,ul=URIError),ul}var cl={},Gh=!1;function kk(){if(Gh)return cl;Gh=!0;var t=typeof Symbol<"u"&&Symbol,e=wl();return cl=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},cl}var fl={},Vh=!1;function Ik(){if(Vh)return fl;Vh=!0;var t={__proto__:null,foo:{}},e=Object;return fl=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof e)},fl}var dl={},Jh=!1;function Ak(){if(Jh)return dl;Jh=!0;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,n=Math.max,r="[object Function]",o=function(l,f){for(var d=[],y=0;y<l.length;y+=1)d[y]=l[y];for(var g=0;g<f.length;g+=1)d[g+l.length]=f[g];return d},s=function(l,f){for(var d=[],y=f,g=0;y<l.length;y+=1,g+=1)d[g]=l[y];return d},i=function(a,l){for(var f="",d=0;d<a.length;d+=1)f+=a[d],d+1<a.length&&(f+=l);return f};return dl=function(l){var f=this;if(typeof f!="function"||e.apply(f)!==r)throw new TypeError(t+f);for(var d=s(arguments,1),y,g=function(){if(this instanceof y){var T=f.apply(this,o(d,arguments));return Object(T)===T?T:this}return f.apply(l,o(d,arguments))},m=n(0,f.length-d.length),v=[],B=0;B<m;B++)v[B]="$"+B;if(y=Function("binder","return function ("+i(v,",")+"){ return binder.apply(this,arguments); }")(g),f.prototype){var P=function(){};P.prototype=f.prototype,y.prototype=new P,P.prototype=null}return y},dl}var pl={},Yh=!1;function xl(){if(Yh)return pl;Yh=!0;var t=Ak();return pl=Function.prototype.bind||t,pl}var gl={},Xh=!1;function Ck(){if(Xh)return gl;Xh=!0;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,n=xl();return gl=n.call(t,e),gl}var yl={},Qh=!1;function Yr(){if(Qh)return yl;Qh=!0;var t,e=xk(),n=Bk(),r=Pk(),o=Ek(),s=sv(),i=zo(),a=Sk(),l=Function,f=function(Ae){try{return l('"use strict"; return ('+Ae+").constructor;")()}catch{}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch{d=null}var y=function(){throw new i},g=d?function(){try{return arguments.callee,y}catch{try{return d(arguments,"callee").get}catch{return y}}}():y,m=kk()(),v=Ik()(),B=Object.getPrototypeOf||(v?function(Ae){return Ae.__proto__}:null),P={},T=typeof Uint8Array>"u"||!B?t:B(Uint8Array),S={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":m&&B?B([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":n,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":P,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&B?B(B([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!m||!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%":r,"%ReferenceError%":o,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!m||!B?t:B(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&B?B(""[Symbol.iterator]()):t,"%Symbol%":m?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":g,"%TypedArray%":T,"%TypeError%":i,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet};if(B)try{null.error}catch(Ae){var E=B(B(Ae));S["%Error.prototype%"]=E}var M=function Ae(me){var Se;if(me==="%AsyncFunction%")Se=f("async function () {}");else if(me==="%GeneratorFunction%")Se=f("function* () {}");else if(me==="%AsyncGeneratorFunction%")Se=f("async function* () {}");else if(me==="%AsyncGenerator%"){var ce=Ae("%AsyncGeneratorFunction%");ce&&(Se=ce.prototype)}else if(me==="%AsyncIteratorPrototype%"){var he=Ae("%AsyncGenerator%");he&&B&&(Se=B(he.prototype))}return S[me]=Se,Se},$={__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"]},oe=xl(),X=Ck(),ue=oe.call(Function.call,Array.prototype.concat),ee=oe.call(Function.apply,Array.prototype.splice),ie=oe.call(Function.call,String.prototype.replace),Re=oe.call(Function.call,String.prototype.slice),Ie=oe.call(Function.call,RegExp.prototype.exec),$e=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ne=/\\(\\)?/g,Me=function(me){var Se=Re(me,0,1),ce=Re(me,-1);if(Se==="%"&&ce!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(ce==="%"&&Se!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var he=[];return ie(me,$e,function(D,Z,F,fe){he[he.length]=F?ie(fe,Ne,"$1"):Z||D}),he},Ve=function(me,Se){var ce=me,he;if(X($,ce)&&(he=$[ce],ce="%"+he[0]+"%"),X(S,ce)){var D=S[ce];if(D===P&&(D=M(ce)),typeof D>"u"&&!Se)throw new i("intrinsic "+me+" exists, but is not available. Please file an issue!");return{alias:he,name:ce,value:D}}throw new s("intrinsic "+me+" does not exist!")};return yl=function(me,Se){if(typeof me!="string"||me.length===0)throw new i("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Se!="boolean")throw new i('"allowMissing" argument must be a boolean');if(Ie(/^%?[^%]*%?$/,me)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ce=Me(me),he=ce.length>0?ce[0]:"",D=Ve("%"+he+"%",Se),Z=D.name,F=D.value,fe=!1,ve=D.alias;ve&&(he=ve[0],ee(ce,ue([0,1],ve)));for(var A=1,k=!0;A<ce.length;A+=1){var j=ce[A],Y=Re(j,0,1),ae=Re(j,-1);if((Y==='"'||Y==="'"||Y==="`"||ae==='"'||ae==="'"||ae==="`")&&Y!==ae)throw new s("property names with quotes must have matching quotes");if((j==="constructor"||!k)&&(fe=!0),he+="."+j,Z="%"+he+"%",X(S,Z))F=S[Z];else if(F!=null){if(!(j in F)){if(!Se)throw new i("base intrinsic for "+me+" exists, but the property is not available.");return}if(d&&A+1>=ce.length){var b=d(F,j);k=!!b,k&&"get"in b&&!("originalValue"in b.get)?F=b.get:F=F[j]}else k=X(F,j),F=F[j];k&&!fe&&(S[Z]=F)}}return F},yl}var ml={},ev=!1;function Bl(){if(ev)return ml;ev=!0;var t=Yr(),e=t("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return ml=e,ml}var hl={},tv=!1;function Go(){if(tv)return hl;tv=!0;var t=Yr(),e=t("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return hl=e,hl}var vl={},nv=!1;function Ok(){if(nv)return vl;nv=!0;var t=Bl(),e=sv(),n=zo(),r=Go();return vl=function(s,i,a){if(!s||typeof s!="object"&&typeof s!="function")throw new n("`obj` must be an object or a function`");if(typeof i!="string"&&typeof i!="symbol")throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new n("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,f=arguments.length>4?arguments[4]:null,d=arguments.length>5?arguments[5]:null,y=arguments.length>6?arguments[6]:!1,g=!!r&&r(s,i);if(t)t(s,i,{configurable:d===null&&g?g.configurable:!d,enumerable:l===null&&g?g.enumerable:!l,value:a,writable:f===null&&g?g.writable:!f});else if(y||!l&&!f&&!d)s[i]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},vl}var Tl={},rv=!1;function Rk(){if(rv)return Tl;rv=!0;var t=Bl(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},Tl=e,Tl}var _l={},iv=!1;function Mk(){if(iv)return _l;iv=!0;var t=Yr(),e=Ok(),n=Rk()(),r=Go(),o=zo(),s=t("%Math.floor%");return _l=function(a,l){if(typeof a!="function")throw new o("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||s(l)!==l)throw new o("`length` must be a positive 32-bit integer");var f=arguments.length>2&&!!arguments[2],d=!0,y=!0;if("length"in a&&r){var g=r(a,"length");g&&!g.configurable&&(d=!1),g&&!g.writable&&(y=!1)}return(d||y||!f)&&(n?e(a,"length",l,!0,!0):e(a,"length",l)),a},_l}var Jr={},ov=!1;function Pl(){if(ov)return Jr;ov=!0;var t=xl(),e=Yr(),n=Mk(),r=zo(),o=e("%Function.prototype.apply%"),s=e("%Function.prototype.call%"),i=e("%Reflect.apply%",!0)||t.call(s,o),a=Bl(),l=e("%Math.max%");Jr=function(y){if(typeof y!="function")throw new r("a function is required");var g=i(t,s,arguments);return n(g,1+l(0,y.length-(arguments.length-1)),!0)};var f=function(){return i(t,o,arguments)};return a?a(Jr,"apply",{value:f}):Jr.apply=f,Jr}var bl={},av=!1;function El(){if(av)return bl;av=!0;var t=Yr(),e=Pl(),n=e(t("String.prototype.indexOf"));return bl=function(o,s){var i=t(o,!!s);return typeof i=="function"&&n(o,".prototype.")>-1?e(i):i},bl}os();ws();var Sl={},lv=!1;function Hl(){if(lv)return Sl;lv=!0;var t=wl();return Sl=function(){return t()&&!!Symbol.toStringTag},Sl}var kl={},uv=!1;function Dk(){if(uv)return kl;uv=!0;var t=Hl()(),e=El(),n=e("Object.prototype.toString"),r=function(a){return t&&a&&typeof a=="object"&&Symbol.toStringTag in a?!1:n(a)==="[object Arguments]"},o=function(a){return r(a)?!0:a!==null&&typeof a=="object"&&typeof a.length=="number"&&a.length>=0&&n(a)!=="[object Array]"&&n(a.callee)==="[object Function]"},s=function(){return r(arguments)}();return r.isLegacyArguments=o,kl=s?r:o,kl}var Il={},cv=!1;function Nk(){if(cv)return Il;cv=!0;var t=Object.prototype.toString,e=Function.prototype.toString,n=/^\s*(?:function)?\*/,r=Hl()(),o=Object.getPrototypeOf,s=function(){if(!r)return!1;try{return Function("return function*() {}")()}catch{}},i;return Il=function(l){if(typeof l!="function")return!1;if(n.test(e.call(l)))return!0;if(!r){var f=t.call(l);return f==="[object GeneratorFunction]"}if(!o)return!1;if(typeof i>"u"){var d=s();i=d?o(d):!1}return o(l)===i},Il}var Al={},fv=!1;function Hk(){if(fv)return Al;fv=!0;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,n,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{n=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,n)}catch(S){S!==r&&(e=null)}else e=null;var o=/^\s*class\b/,s=function(E){try{var M=t.call(E);return o.test(M)}catch{return!1}},i=function(E){try{return s(E)?!1:(t.call(E),!0)}catch{return!1}},a=Object.prototype.toString,l="[object Object]",f="[object Function]",d="[object GeneratorFunction]",y="[object HTMLAllCollection]",g="[object HTML document.all class]",m="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,B=!(0 in[,]),P=function(){return!1};if(typeof document=="object"){var T=document.all;a.call(T)===a.call(document.all)&&(P=function(E){if((B||!E)&&(typeof E>"u"||typeof E=="object"))try{var M=a.call(E);return(M===y||M===g||M===m||M===l)&&E("")==null}catch{}return!1})}return Al=e?function(E){if(P(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;try{e(E,null,n)}catch(M){if(M!==r)return!1}return!s(E)&&i(E)}:function(E){if(P(E))return!0;if(!E||typeof E!="function"&&typeof E!="object")return!1;if(v)return i(E);if(s(E))return!1;var M=a.call(E);return M!==f&&M!==d&&!/^\[object HTML/.test(M)?!1:i(E)},Al}var Cl={},dv=!1;function Uk(){if(dv)return Cl;dv=!0;var t=Hk(),e=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=function(l,f,d){for(var y=0,g=l.length;y<g;y++)n.call(l,y)&&(d==null?f(l[y],y,l):f.call(d,l[y],y,l))},o=function(l,f,d){for(var y=0,g=l.length;y<g;y++)d==null?f(l.charAt(y),y,l):f.call(d,l.charAt(y),y,l)},s=function(l,f,d){for(var y in l)n.call(l,y)&&(d==null?f(l[y],y,l):f.call(d,l[y],y,l))},i=function(l,f,d){if(!t(f))throw new TypeError("iterator must be a function");var y;arguments.length>=3&&(y=d),e.call(l)==="[object Array]"?r(l,f,y):typeof l=="string"?o(l,f,y):s(l,f,y)};return Cl=i,Cl}var Ol={},pv=!1;function jk(){return pv||(pv=!0,Ol=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ol}var Rl={},gv=!1,$k=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function Zk(){if(gv)return Rl;gv=!0;var t=jk(),e=typeof globalThis>"u"?$k:globalThis;return Rl=function(){for(var r=[],o=0;o<t.length;o++)typeof e[t[o]]=="function"&&(r[r.length]=t[o]);return r},Rl}var Ml={},yv=!1,Lk=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function _v(){if(yv)return Ml;yv=!0;var t=Uk(),e=Zk(),n=Pl(),r=El(),o=Go(),s=r("Object.prototype.toString"),i=Hl()(),a=typeof globalThis>"u"?Lk:globalThis,l=e(),f=r("String.prototype.slice"),d=Object.getPrototypeOf,y=r("Array.prototype.indexOf",!0)||function(P,T){for(var S=0;S<P.length;S+=1)if(P[S]===T)return S;return-1},g={__proto__:null};i&&o&&d?t(l,function(B){var P=new a[B];if(Symbol.toStringTag in P){var T=d(P),S=o(T,Symbol.toStringTag);if(!S){var E=d(T);S=o(E,Symbol.toStringTag)}g["$"+B]=n(S.get)}}):t(l,function(B){var P=new a[B],T=P.slice||P.set;T&&(g["$"+B]=n(T))});var m=function(P){var T=!1;return t(g,function(S,E){if(!T)try{"$"+S(P)===E&&(T=f(E,1))}catch{}}),T},v=function(P){var T=!1;return t(g,function(S,E){if(!T)try{S(P),T=f(E,1)}catch{}}),T};return Ml=function(P){if(!P||typeof P!="object")return!1;if(!i){var T=f(s(P),8,-1);return y(l,T)>-1?T:T!=="Object"?!1:v(P)}return o?m(P):null},Ml}var Dl={},mv=!1;function Fk(){if(mv)return Dl;mv=!0;var t=_v();return Dl=function(n){return!!t(n)},Dl}var we={},hv=!1;function Kk(){if(hv)return we;hv=!0;var t=Dk(),e=Nk(),n=_v(),r=Fk();function o(U){return U.call.bind(U)}var s=typeof BigInt<"u",i=typeof Symbol<"u",a=o(Object.prototype.toString),l=o(Number.prototype.valueOf),f=o(String.prototype.valueOf),d=o(Boolean.prototype.valueOf);if(s)var y=o(BigInt.prototype.valueOf);if(i)var g=o(Symbol.prototype.valueOf);function m(U,Pt){if(typeof U!="object")return!1;try{return Pt(U),!0}catch{return!1}}we.isArgumentsObject=t,we.isGeneratorFunction=e,we.isTypedArray=r;function v(U){return typeof Promise<"u"&&U instanceof Promise||U!==null&&typeof U=="object"&&typeof U.then=="function"&&typeof U.catch=="function"}we.isPromise=v;function B(U){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(U):r(U)||D(U)}we.isArrayBufferView=B;function P(U){return n(U)==="Uint8Array"}we.isUint8Array=P;function T(U){return n(U)==="Uint8ClampedArray"}we.isUint8ClampedArray=T;function S(U){return n(U)==="Uint16Array"}we.isUint16Array=S;function E(U){return n(U)==="Uint32Array"}we.isUint32Array=E;function M(U){return n(U)==="Int8Array"}we.isInt8Array=M;function $(U){return n(U)==="Int16Array"}we.isInt16Array=$;function oe(U){return n(U)==="Int32Array"}we.isInt32Array=oe;function X(U){return n(U)==="Float32Array"}we.isFloat32Array=X;function ue(U){return n(U)==="Float64Array"}we.isFloat64Array=ue;function ee(U){return n(U)==="BigInt64Array"}we.isBigInt64Array=ee;function ie(U){return n(U)==="BigUint64Array"}we.isBigUint64Array=ie;function Re(U){return a(U)==="[object Map]"}Re.working=typeof Map<"u"&&Re(new Map);function Ie(U){return typeof Map>"u"?!1:Re.working?Re(U):U instanceof Map}we.isMap=Ie;function $e(U){return a(U)==="[object Set]"}$e.working=typeof Set<"u"&&$e(new Set);function Ne(U){return typeof Set>"u"?!1:$e.working?$e(U):U instanceof Set}we.isSet=Ne;function Me(U){return a(U)==="[object WeakMap]"}Me.working=typeof WeakMap<"u"&&Me(new WeakMap);function Ve(U){return typeof WeakMap>"u"?!1:Me.working?Me(U):U instanceof WeakMap}we.isWeakMap=Ve;function Ae(U){return a(U)==="[object WeakSet]"}Ae.working=typeof WeakSet<"u"&&Ae(new WeakSet);function me(U){return Ae(U)}we.isWeakSet=me;function Se(U){return a(U)==="[object ArrayBuffer]"}Se.working=typeof ArrayBuffer<"u"&&Se(new ArrayBuffer);function ce(U){return typeof ArrayBuffer>"u"?!1:Se.working?Se(U):U instanceof ArrayBuffer}we.isArrayBuffer=ce;function he(U){return a(U)==="[object DataView]"}he.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&he(new DataView(new ArrayBuffer(1),0,1));function D(U){return typeof DataView>"u"?!1:he.working?he(U):U instanceof DataView}we.isDataView=D;var Z=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(U){return a(U)==="[object SharedArrayBuffer]"}function fe(U){return typeof Z>"u"?!1:(typeof F.working>"u"&&(F.working=F(new Z)),F.working?F(U):U instanceof Z)}we.isSharedArrayBuffer=fe;function ve(U){return a(U)==="[object AsyncFunction]"}we.isAsyncFunction=ve;function A(U){return a(U)==="[object Map Iterator]"}we.isMapIterator=A;function k(U){return a(U)==="[object Set Iterator]"}we.isSetIterator=k;function j(U){return a(U)==="[object Generator]"}we.isGeneratorObject=j;function Y(U){return a(U)==="[object WebAssembly.Module]"}we.isWebAssemblyCompiledModule=Y;function ae(U){return m(U,l)}we.isNumberObject=ae;function b(U){return m(U,f)}we.isStringObject=b;function w(U){return m(U,d)}we.isBooleanObject=w;function W(U){return s&&m(U,y)}we.isBigIntObject=W;function Q(U){return i&&m(U,g)}we.isSymbolObject=Q;function He(U){return ae(U)||b(U)||w(U)||W(U)||Q(U)}we.isBoxedPrimitive=He;function _e(U){return typeof Uint8Array<"u"&&(ce(U)||fe(U))}return we.isAnyArrayBuffer=_e,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(U){Object.defineProperty(we,U,{enumerable:!1,value:function(){throw new Error(U+" is not supported in userland")}})}),we}var Nl={},vv=!1;function Wk(){return vv||(vv=!0,Nl=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Nl}var xe={},Tv=!1,Xr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;function qk(){if(Tv)return xe;Tv=!0;var t=St,e=Object.getOwnPropertyDescriptors||function(Z){for(var F=Object.keys(Z),fe={},ve=0;ve<F.length;ve++)fe[F[ve]]=Object.getOwnPropertyDescriptor(Z,F[ve]);return fe},n=/%[sdj%]/g;xe.format=function(D){if(!$(D)){for(var Z=[],F=0;F<arguments.length;F++)Z.push(i(arguments[F]));return Z.join(" ")}for(var F=1,fe=arguments,ve=fe.length,A=String(D).replace(n,function(j){if(j==="%%")return"%";if(F>=ve)return j;switch(j){case"%s":return String(fe[F++]);case"%d":return Number(fe[F++]);case"%j":try{return JSON.stringify(fe[F++])}catch{return"[Circular]"}default:return j}}),k=fe[F];F<ve;k=fe[++F])S(k)||!ee(k)?A+=" "+k:A+=" "+i(k);return A},xe.deprecate=function(D,Z){if(typeof t<"u"&&t.noDeprecation===!0)return D;if(typeof t>"u")return function(){return xe.deprecate(D,Z).apply(this||Xr,arguments)};var F=!1;function fe(){if(!F){if(t.throwDeprecation)throw new Error(Z);t.traceDeprecation?console.trace(Z):console.error(Z),F=!0}return D.apply(this||Xr,arguments)}return fe};var r={},o=/^$/;if(t.env.NODE_DEBUG){var s=t.env.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),o=new RegExp("^"+s+"$","i")}xe.debuglog=function(D){if(D=D.toUpperCase(),!r[D])if(o.test(D)){var Z=t.pid;r[D]=function(){var F=xe.format.apply(xe,arguments);console.error("%s %d: %s",D,Z,F)}}else r[D]=function(){};return r[D]};function i(D,Z){var F={seen:[],stylize:l};return arguments.length>=3&&(F.depth=arguments[2]),arguments.length>=4&&(F.colors=arguments[3]),T(Z)?F.showHidden=Z:Z&&xe._extend(F,Z),X(F.showHidden)&&(F.showHidden=!1),X(F.depth)&&(F.depth=2),X(F.colors)&&(F.colors=!1),X(F.customInspect)&&(F.customInspect=!0),F.colors&&(F.stylize=a),d(F,D,F.depth)}xe.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(D,Z){var F=i.styles[Z];return F?"\x1B["+i.colors[F][0]+"m"+D+"\x1B["+i.colors[F][1]+"m":D}function l(D,Z){return D}function f(D){var Z={};return D.forEach(function(F,fe){Z[F]=!0}),Z}function d(D,Z,F){if(D.customInspect&&Z&&Ie(Z.inspect)&&Z.inspect!==xe.inspect&&!(Z.constructor&&Z.constructor.prototype===Z)){var fe=Z.inspect(F,D);return $(fe)||(fe=d(D,fe,F)),fe}var ve=y(D,Z);if(ve)return ve;var A=Object.keys(Z),k=f(A);if(D.showHidden&&(A=Object.getOwnPropertyNames(Z)),Re(Z)&&(A.indexOf("message")>=0||A.indexOf("description")>=0))return g(Z);if(A.length===0){if(Ie(Z)){var j=Z.name?": "+Z.name:"";return D.stylize("[Function"+j+"]","special")}if(ue(Z))return D.stylize(RegExp.prototype.toString.call(Z),"regexp");if(ie(Z))return D.stylize(Date.prototype.toString.call(Z),"date");if(Re(Z))return g(Z)}var Y="",ae=!1,b=["{","}"];if(P(Z)&&(ae=!0,b=["[","]"]),Ie(Z)){var w=Z.name?": "+Z.name:"";Y=" [Function"+w+"]"}if(ue(Z)&&(Y=" "+RegExp.prototype.toString.call(Z)),ie(Z)&&(Y=" "+Date.prototype.toUTCString.call(Z)),Re(Z)&&(Y=" "+g(Z)),A.length===0&&(!ae||Z.length==0))return b[0]+Y+b[1];if(F<0)return ue(Z)?D.stylize(RegExp.prototype.toString.call(Z),"regexp"):D.stylize("[Object]","special");D.seen.push(Z);var W;return ae?W=m(D,Z,F,k,A):W=A.map(function(Q){return v(D,Z,F,k,Q,ae)}),D.seen.pop(),B(W,Y,b)}function y(D,Z){if(X(Z))return D.stylize("undefined","undefined");if($(Z)){var F="'"+JSON.stringify(Z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return D.stylize(F,"string")}if(M(Z))return D.stylize(""+Z,"number");if(T(Z))return D.stylize(""+Z,"boolean");if(S(Z))return D.stylize("null","null")}function g(D){return"["+Error.prototype.toString.call(D)+"]"}function m(D,Z,F,fe,ve){for(var A=[],k=0,j=Z.length;k<j;++k)me(Z,String(k))?A.push(v(D,Z,F,fe,String(k),!0)):A.push("");return ve.forEach(function(Y){Y.match(/^\d+$/)||A.push(v(D,Z,F,fe,Y,!0))}),A}function v(D,Z,F,fe,ve,A){var k,j,Y;if(Y=Object.getOwnPropertyDescriptor(Z,ve)||{value:Z[ve]},Y.get?Y.set?j=D.stylize("[Getter/Setter]","special"):j=D.stylize("[Getter]","special"):Y.set&&(j=D.stylize("[Setter]","special")),me(fe,ve)||(k="["+ve+"]"),j||(D.seen.indexOf(Y.value)<0?(S(F)?j=d(D,Y.value,null):j=d(D,Y.value,F-1),j.indexOf(`
|
|
80
80
|
`)>-1&&(A?j=j.split(`
|
|
81
81
|
`).map(function(ae){return" "+ae}).join(`
|
|
82
82
|
`).slice(2):j=`
|
|
@@ -85,7 +85,7 @@ ${T}`.trim();case q.ZodFirstPartyTypeKind.ZodEnum:return a.values.map(jt).join("
|
|
|
85
85
|
`))):j=D.stylize("[Circular]","special")),X(k)){if(A&&ve.match(/^\d+$/))return j;k=JSON.stringify(""+ve),k.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(k=k.slice(1,-1),k=D.stylize(k,"name")):(k=k.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),k=D.stylize(k,"string"))}return k+": "+j}function B(D,Z,F){var fe=D.reduce(function(ve,A){return A.indexOf(`
|
|
86
86
|
`)>=0,ve+A.replace(/\u001b\[\d\d?m/g,"").length+1},0);return fe>60?F[0]+(Z===""?"":Z+`
|
|
87
87
|
`)+" "+D.join(`,
|
|
88
|
-
`)+" "+F[1]:F[0]+Z+" "+D.join(", ")+" "+F[1]}xe.types=Kk();function P(D){return Array.isArray(D)}xe.isArray=P;function T(D){return typeof D=="boolean"}xe.isBoolean=T;function S(D){return D===null}xe.isNull=S;function E(D){return D==null}xe.isNullOrUndefined=E;function M(D){return typeof D=="number"}xe.isNumber=M;function $(D){return typeof D=="string"}xe.isString=$;function oe(D){return typeof D=="symbol"}xe.isSymbol=oe;function X(D){return D===void 0}xe.isUndefined=X;function ue(D){return ee(D)&&Ne(D)==="[object RegExp]"}xe.isRegExp=ue,xe.types.isRegExp=ue;function ee(D){return typeof D=="object"&&D!==null}xe.isObject=ee;function ie(D){return ee(D)&&Ne(D)==="[object Date]"}xe.isDate=ie,xe.types.isDate=ie;function Re(D){return ee(D)&&(Ne(D)==="[object Error]"||D instanceof Error)}xe.isError=Re,xe.types.isNativeError=Re;function Ie(D){return typeof D=="function"}xe.isFunction=Ie;function $e(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}xe.isPrimitive=$e,xe.isBuffer=Wk();function Ne(D){return Object.prototype.toString.call(D)}function Me(D){return D<10?"0"+D.toString(10):D.toString(10)}var Ve=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ae(){var D=new Date,Z=[Me(D.getHours()),Me(D.getMinutes()),Me(D.getSeconds())].join(":");return[D.getDate(),Ve[D.getMonth()],Z].join(" ")}xe.log=function(){console.log("%s - %s",Ae(),xe.format.apply(xe,arguments))},xe.inherits=Ct(),xe._extend=function(D,Z){if(!Z||!ee(Z))return D;for(var F=Object.keys(Z),fe=F.length;fe--;)D[F[fe]]=Z[F[fe]];return D};function me(D,Z){return Object.prototype.hasOwnProperty.call(D,Z)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(Z){if(typeof Z!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&Z[Se]){if(F=Z[Se],typeof F!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),F}function F(){for(var fe,ve,A=new Promise(function(Y,ae){fe=Y,ve=ae}),k=[],j=0;j<arguments.length;j++)k.push(arguments[j]);k.push(function(Y,ae){Y?ve(Y):fe(ae)});try{Z.apply(this||Xr,k)}catch(Y){ve(Y)}return A}return Object.setPrototypeOf(F,Object.getPrototypeOf(Z)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(Z))},xe.promisify.custom=Se;function ce(D,Z){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return Z(D)}function he(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function Z(){for(var F=[],fe=0;fe<arguments.length;fe++)F.push(arguments[fe]);var ve=F.pop();if(typeof ve!="function")throw new TypeError("The last argument must be of type Function");var A=this||Xr,k=function(){return ve.apply(A,arguments)};D.apply(this||Xr,F).then(function(j){t.nextTick(k.bind(null,null,j))},function(j){t.nextTick(ce.bind(null,j,k))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(D)),Object.defineProperties(Z,e(D)),Z}return xe.callbackify=he,xe}var le=qk();le.format;le.deprecate;le.debuglog;le.inspect;le.types;le.isArray;le.isBoolean;le.isNull;le.isNullOrUndefined;le.isNumber;le.isString;le.isSymbol;le.isUndefined;le.isRegExp;le.isObject;le.isDate;le.isError;le.isFunction;le.isPrimitive;le.isBuffer;le.log;le.inherits;le._extend;le.promisify;le.callbackify;var uO=le._extend,cO=le.callbackify,fO=le.debuglog,dO=le.deprecate,pO=le.format,gO=le.inherits,yO=le.inspect,mO=le.isArray,hO=le.isBoolean,vO=le.isBuffer,TO=le.isDate,_O=le.isError,bO=le.isFunction,wO=le.isNull,xO=le.isNullOrUndefined,BO=le.isNumber,PO=le.isObject,EO=le.isPrimitive,SO=le.isRegExp,kO=le.isString,IO=le.isSymbol,AO=le.isUndefined,CO=le.log,OO=le.promisify,RO=le.types,MO=le.TextEncoder=globalThis.TextEncoder,DO=le.TextDecoder=globalThis.TextDecoder;var yr=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(n))}_serializeMessage(e){let n=le.format(...e);return J.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(n):n}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var Nn=class extends yr{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new Nn({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};C();R();O();var Vk=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),bv=t=>async e=>{let n=Uh(e.headers),[,r]=(e.headers.traceparent||"").split("-"),o=new Gk({botId:n.botId,integrationId:n.integrationId,retry:Ko,headers:Vk(e.headers)}),s=new Vr(o),i=new Nn({traceId:r}),a={ctx:n,req:e,client:s,logger:i,instance:t};try{let l;switch(n.operation){case"webhook_received":l=await Yk(a);break;case"register":l=await Xk(a);break;case"unregister":l=await Qk(a);break;case"message_created":l=await nI(a);break;case"action_triggered":l=await rI(a);break;case"ping":l=await Jk(a);break;case"create_user":l=await eI(a);break;case"create_conversation":l=await tI(a);break;default:throw new Error(`Unknown operation ${n.operation}`)}return l?{...l,status:l.status??200}:{status:200}}catch(l){if(zk(l)){let d=l.type==="Runtime"?l:new _v(l.message,l);return i.forBot().error(d.message),{status:d.code,body:JSON.stringify(d.toJSON())}}console.error(l);let f=new _v("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return i.forBot().error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}},Jk=async t=>{},Yk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{let{req:s}=kt(n);return o.webhook({client:t,ctx:e,req:s,logger:r})},Xk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.register)return;let{webhookUrl:s}=kt(n);await o.register({client:t,ctx:e,webhookUrl:s,logger:r})},Qk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.unregister)return;let{webhookUrl:s}=kt(n);await o.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},eI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createUser)return;let{tags:s}=kt(n);return await o.createUser({ctx:e,client:t,tags:s,logger:r})},tI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createConversation)return;let{channel:s,tags:i}=kt(n);return await o.createConversation({ctx:e,client:t,channel:s,tags:i,logger:r})},nI=async({ctx:t,req:e,client:n,logger:r,instance:o})=>{let{conversation:s,user:i,type:a,payload:l,message:f}=kt(e),d=o.channels[s.channel];if(!d)throw new Error(`Channel ${s.channel} not found`);let y=d.messages[a];if(!y)throw new Error(`Message of type ${a} not found in channel ${s.channel}`);await y({ctx:t,conversation:s,message:f,user:i,type:a,client:n,payload:l,ack:async({tags:m})=>{await n.updateMessage({id:f.id,tags:m})},logger:r})},rI=async({req:t,ctx:e,client:n,logger:r,instance:o})=>{let{input:s,type:i}=kt(t);if(!i)throw new Error("Missing action type");let a=o.actions[i];if(!a)throw new Error(`Action ${i} not found`);let l=new Wo,d={output:await a({ctx:e,input:s,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(d)}};var Ul=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler}actions;channels;register;unregister;createUser;createConversation;webhook;handler=bv(this);start=e=>Zo(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var Go="#";var jl=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;addIntegration(e,n){let r=this;return r.integrations||(r.integrations={}),r.integrations[e.name]={enabled:n.enabled,...e,configurationType:n.configurationType,configuration:n.configuration},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let o=n.alias??e.name;return r.plugins[o]={...e,alias:n.alias,configuration:n.configuration,interfaces:n.interfaces},r.user=this._mergeUser(r.user,e.definition.user),r.conversation=this._mergeConversation(r.conversation,e.definition.conversation),r.message=this._mergeMessage(r.message,e.definition.message),r.recurringEvents=this._mergeRecurringEvents(r.recurringEvents,e.definition.recurringEvents),r.tables=this._mergeTables(r.tables,e.definition.tables),r.workflows=this._mergeWorkflows(r.workflows,e.definition.workflows),r.states=this._mergeStates(r.states,this._prefixKeys(e.definition.states,n.alias)),r.events=this._mergeEvents(r.events,this._prefixKeys(e.definition.events,n.alias)),r.actions=this._mergeActions(r.actions,this._prefixKeys(e.definition.actions,n.alias)),this}_mergeUser=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeConversation=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeMessage=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeStates=(e,n)=>({...e,...n});_mergeEvents=(e,n)=>({...e,...n});_mergeRecurringEvents=(e,n)=>({...e,...n});_mergeActions=(e,n)=>({...e,...n});_mergeTables=(e,n)=>({...e,...n});_mergeWorkflows=(e,n)=>({...e,...n});_prefixKeys=(e,n)=>!e||!n?e:qe.mapKeys(e,r=>`${n}${Go}${r}`)};C();R();O();C();R();O();import*as Pv from"@botpress/client";C();R();O();var Hn=class extends yr{constructor(e){super({...e})}with(e){return new Hn({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};C();R();O();C();R();O();var Qt=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}getConversation=e=>this._run("getConversation",e);listConversations=e=>this._run("listConversations",e);updateConversation=e=>this._run("updateConversation",e);deleteConversation=e=>this._run("deleteConversation",e);listParticipants=e=>this._run("listParticipants",e);addParticipant=e=>this._run("addParticipant",e);getParticipant=e=>this._run("getParticipant",e);removeParticipant=e=>this._run("removeParticipant",e);createEvent=e=>this._run("createEvent",e);getEvent=e=>this._run("getEvent",e);listEvents=e=>this._run("listEvents",e);createMessage=e=>this._run("createMessage",e);getOrCreateMessage=e=>this._run("getOrCreateMessage",e);getMessage=e=>this._run("getMessage",e);updateMessage=e=>this._run("updateMessage",e);listMessages=e=>this._run("listMessages",e);deleteMessage=e=>this._run("deleteMessage",e);getUser=e=>this._run("getUser",e);listUsers=e=>this._run("listUsers",e);updateUser=e=>this._run("updateUser",e);deleteUser=e=>this._run("deleteUser",e);getState=e=>this._run("getState",e);setState=e=>this._run("setState",e);getOrSetState=e=>this._run("getOrSetState",e);patchState=e=>this._run("patchState",e);callAction=e=>this._run("callAction",e);uploadFile=e=>this._run("uploadFile",e);upsertFile=e=>this._run("upsertFile",e);deleteFile=e=>this._run("deleteFile",e);listFiles=e=>this._run("listFiles",e);getFile=e=>this._run("getFile",e);updateFileMetadata=e=>this._run("updateFileMetadata",e);searchFiles=e=>this._run("searchFiles",e);trackAnalytics=e=>this._run("trackAnalytics",e);getTableRow=e=>this._run("getTableRow",e);createTableRows=e=>this._run("createTableRows",e);findTableRows=e=>this._run("findTableRows",e);deleteTableRows=e=>this._run("deleteTableRows",e);updateTableRows=e=>this._run("updateTableRows",e);upsertTableRows=e=>this._run("upsertTableRows",e);createWorkflow=e=>this._run("createWorkflow",e);getWorkflow=e=>this._run("getWorkflow",e);updateWorkflow=e=>this._run("updateWorkflow",e);deleteWorkflow=e=>this._run("deleteWorkflow",e);listWorkflows=e=>this._run("listWorkflows",e);createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let o=await this._client[e](n),s=this._hooks.after[e];return s&&(o=await s(o)),o}};C();R();O();C();R();O();var mr=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>un({workflowName:n,client:t,input:r}),running:r=>un({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>un({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>un({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>un({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>un({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>un({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>un({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:o}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:cn({client:t,workflow:o})}}})}),un=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>cn({client:t.client,workflow:n}))}},cn=t=>({...t.workflow,async update(e){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:cn({client:t.client,workflow:n})}},async setFailed({failureReason:e}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:cn({client:t.client,workflow:n})}},async setCompleted({output:e}={}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:cn({client:t.client,workflow:n})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:cn({client:t.client,workflow:e})}}});C();R();O();C();R();O();var iI=re.enum(["event_received","register","unregister","ping","action_triggered"]),xv=t=>{let e=t[ho],n=t[vo],r=t[Dy],o=iI.parse(t[To]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing type headers");if(!n)throw new Error("Missing configuration headers");if(!o)throw new Error("Missing operation headers");return{botId:e,operation:o,type:r,configuration:n?JSON.parse(z.from(n,"base64").toString("utf-8")):{}}};C();R();O();var lt={status:200};C();R();O();C();R();O();var $l=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var oI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Bv=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!oI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:aI(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),lt;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 sI(n,e);default:e.payload.type}return lt},aI=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),sI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];return!r||r.length===0?(t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),lt):(await lI(t,e),await uI(t,e),lt)},lI=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},uI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];for(let o of r)await o({...t,conversation:e.payload.conversation,user:e.payload.user,workflow:cn({...t,workflow:e.payload.workflow}),workflows:mr(t.client)})};C();R();O();var Ev=t=>async e=>{let n=xv(e.headers),r=new Hn,o=new Pv.Client({botId:n.botId,retry:Ko}),s=new Qt(o,{before:{createMessage:async a=>{let l=t.hookHandlers.before_outgoing_message[a.type]??[];for(let f of l){let d=new Qt(o);a=(await f({client:d,ctx:n,logger:r.with({conversationId:a.conversationId,userId:a.userId}),data:a,...hr({client:d})}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.before_outgoing_call_action[a.type]??[];for(let f of l){let d=new Qt(o);a=(await f({client:d,ctx:n,logger:r,data:a,...hr({client:d})}))?.data??a}return a}},after:{createMessage:async a=>{let l=t.hookHandlers.after_outgoing_message[a.message.type]??[];for(let f of l){let d=new Qt(o);a=(await f({client:d,ctx:n,logger:r.with({messageId:a.message.id,conversationId:a.message.conversationId,userId:a.message.userId}),data:a,...hr({client:d})}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.after_outgoing_call_action[a.output.type]??[];for(let f of l){let d=new Qt(o);a=(await f({client:d,ctx:n,logger:r,data:a,...hr({client:d})}))?.data??a}return a}}}),i={req:e,ctx:n,logger:r,client:s,self:t};switch(n.operation){case"action_triggered":return await gI(i);case"event_received":return await pI(i);case"register":return await fI(i);case"unregister":return await dI(i);case"ping":return await cI(i);default:throw new Error(`Unknown operation ${n.operation}`)}},cI=async({ctx:t})=>(ir.info(`Received ${t.operation} operation for bot ${t.botId} of type ${t.type}`),lt),fI=async t=>lt,dI=async t=>lt,pI=async t=>{let{ctx:e,logger:n,req:r,client:o,self:s}=t,i={client:o,ctx:e,logger:n,...hr({client:o})};ir.debug(`Received event ${e.type}`);let a=kt(r);if(i.logger=i.logger.with({eventId:a.event.id,messageId:a.event.messageId,conversationId:a.event.conversationId,userId:a.event.userId}),e.type==="workflow_update")return await Bv(t,a.event);if(e.type==="message_created"){let m=a.event,v=m.payload.message;i.logger=i.logger.with({messageId:v.id,conversationId:v.conversationId,userId:v.userId});let B=s.hookHandlers.before_incoming_message[v.type]??[];for(let E of B){let M=await E({...i,data:v});if(v=M?.data??v,M?.stop)return lt}let P={...i,user:m.payload.user,conversation:m.payload.conversation,message:v,event:m},T=s.messageHandlers[v.type]??[];for(let E of T)await E(P);let S=s.hookHandlers.after_incoming_message[v.type]??[];for(let E of S){let M=await E({...i,data:v});if(v=M?.data??v,M?.stop)return lt}return lt}if(e.type==="state_expired"){let v=a.event.payload.state,B={...i,state:v},P=s.stateExpiredHandlers["*"]??[];for(let T of P)await T(B);return lt}let l=a.event,f=s.hookHandlers.before_incoming_event[l.type]??[];for(let m of f){let v=await m({...i,data:l});if(l=v?.data??l,v?.stop)return lt}let d={...i,event:l},y=s.eventHandlers[l.type]??[];for(let m of y)await m(d);let g=s.hookHandlers.after_incoming_event[l.type]??[];for(let m of g){let v=await m({...i,data:l});if(l=v?.data??l,v?.stop)return lt}return lt},gI=async({ctx:t,logger:e,req:n,client:r,self:o})=>{let{input:s,type:i}=kt(n);if(!i)throw new Error("Missing action type");let a=o.actionHandlers[i];if(!a)throw new Error(`Action ${i} not found`);let f={output:await a({ctx:t,logger:e,input:s,client:r,type:i,...hr({client:r})})};return{status:200,body:JSON.stringify(f)}},hr=t=>({workflows:mr(t.client)});var Zl=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get actionHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._actionHandlers[n];if(r)return r;for(let o of Object.values(this._plugins))if(r=o.actionHandlers[n],r)return r}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.messageHandlers[n]??[]),o=this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>a);return Te.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.eventHandlers[n]??[]),o=this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>a);return Te.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.stateExpiredHandlers[n]??[]),o=this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>a);return Te.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(o,s)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[s]??[]),a=this._hookHandlers[n]??{},l=a[s]??[],f=a["*"]??[],d=[...l,...f].sort((y,g)=>y.order-g.order).map(({handler:y})=>y);return Te.unique([...i,...d])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{let i=r[s]?.sort((l,f)=>l.order-f.order).map(({handler:l})=>l)??[],a=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return Te.unique([...i,...a])}})}})}on={message:(e,n)=>{this._messageHandlers[e]=Te.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=Te.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=Te.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=Te.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=Te.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=Te.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=Te.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=Te.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=Te.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=Te.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=Te.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=Te.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=Te.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=Te.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=Ev(this);start=e=>Zo(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var Ll=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.entities=e.entities??{};let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:qe.mapValues(e.events,i=>({...i,schema:i.schema(n)})),o=e.actions===void 0?{}:qe.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(n)},output:{...i.output,schema:i.output.schema(n)}})),s=e.channels===void 0?{}:qe.mapValues(e.channels,i=>({...i,messages:qe.mapValues(i.messages,a=>({...a,schema:a.schema(n)}))}));this.events=r,this.actions=o,this.channels=s}name;version;entities;events;actions;channels;_getEntityReference=e=>{let n={};for(let[r,o]of Object.entries(e)){let s=o.schema._def["x-zui"]?.title,i=o.schema._def.description,a=_y.ref(r);s&&a.title(s),i&&a.describe(i),n[r]=a}return n}};C();R();O();C();R();O();C();R();O();C();R();O();var Fl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows}name;version;title;description;icon;readme;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows};C();R();O();C();R();O();C();R();O();C();R();O();var Kl=":";var Sv=t=>{let[e,n]=t.split(Kl);return!e||!n?null:{namespace:e,eventName:n}},kv=t=>`${t.namespace}${Kl}${t.actionName}`,Iv=t=>`${t.namespace}${Kl}${t.eventName}`,Av=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.actions[t.actionName]?.name??t.actionName;return{namespace:r,actionName:o}},Cv=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.events[t.eventName]?.name??t.eventName;return{namespace:r,eventName:o}};var Ov=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>i=>yI({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:s,input:i})})}),yI=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:o})=>{let s=Av({namespace:n,actionName:r},e),i=kv(s);return(await t.callAction({type:i,input:o})).output};C();R();O();C();R();O();C();R();O();var Wl=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n})}async getOrSet(e,n){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n}).then(r=>r.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,n){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:n})}},Rv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>{let i=e.alias!==void 0?`${e.alias}${Go}${s}`:s;return new Wl(t,r,i)}})});C();R();O();var ql=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:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:n,interfaces:r,alias:o}=this._runtime,s=Ov(e,this._runtime),i=Rv(e,this._runtime),a=mr(e);return{configuration:n,interfaces:r,actions:s,states:i,alias:o,workflows:a}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return Xt.setName(o=>r({...o,...this._getTools(o.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[];return Te.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>Xt.setName(a=>i({...a,...this._getTools(a.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._eventHandlers[n]??[],o=Object.entries(this._eventHandlers).filter(([a])=>this._eventResolvesTo(a,n)).flatMap(([,a])=>a??[]),s=this._eventHandlers["*"]??[];return Te.unique([...r,...o,...s]).sort((a,l)=>a.order-l.order).map(({handler:a})=>Xt.setName(l=>a({...l,...this._getTools(l.client)}),a.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[];return Te.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>Xt.setName(a=>i({...a,...this._getTools(a.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{s=this._stripAliasPrefix(s);let i=r[s]??[],a=Object.entries(r).filter(([d])=>this._eventResolvesTo(d,s)).flatMap(([,d])=>d??[]),l=r["*"]??[];return Te.unique([...i,...a,...l]).sort((d,y)=>d.order-y.order).map(({handler:d})=>Xt.setName(y=>d({...y,...this._getTools(y.client)}),d.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>(r[s]?.sort((a,l)=>a.order-l.order)??[]).map(({handler:a})=>Xt.setName(l=>a({...l,...this._getTools(l.client)}),a.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=Te.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=Te.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=Te.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=Te.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=Te.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=Te.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=Te.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=Te.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=Te.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=Te.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=Te.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=Te.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=Te.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=Te.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let r=Sv(e);if(!r)return!1;let o=Cv(r,this._runtime.interfaces);return Iv(o)===n};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}:`;return e.startsWith(r)?e.slice(r.length):e}};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();export{yx as BRAND,Zl as Bot,jl as BotDefinition,Hn as BotLogger,Qt as BotSpecificClient,Gn as DIRTY,px as EMPTY_PATH,Cr as ErrorBoundary,de as INVALID,Ul as Integration,tl as IntegrationDefinition,Nn as IntegrationLogger,Vr as IntegrationSpecificClient,Ll as InterfaceDefinition,OB as NEVER,ct as OK,Et as ParseInputLazyPath,gt as ParseStatus,ql as Plugin,Fl as PluginDefinition,gH as RuntimeError,ye as Schema,Ei as ZodAny,Hr as ZodArray,ja as ZodBigInt,$a as ZodBoolean,Za as ZodBranded,La as ZodCatch,Fa as ZodDate,fo as ZodDefault,ug as ZodDiscriminatedUnion,bn as ZodEffects,rr as ZodEnum,$t as ZodError,Vp as ZodFirstPartyTypeKind,fg as ZodFunction,Wa as ZodIntersection,G as ZodIssueCode,qa as ZodLazy,za as ZodLiteral,gg as ZodMap,mg as ZodNaN,Ga as ZodNativeEnum,_n as ZodNever,Va as ZodNull,Jn as ZodNullable,Ja as ZodNumber,Yn as ZodObject,nn as ZodOptional,ne as ZodParsedType,Ya as ZodPipeline,go as ZodPromise,yo as ZodReadonly,xg as ZodRecord,Pg as ZodRef,ye as ZodSchema,Eg as ZodSet,ft as ZodString,Ug as ZodSymbol,bn as ZodTransformer,Qn as ZodTuple,ye as ZodType,Xa as ZodUndefined,Qa as ZodUnion,Ar as ZodUnknown,Lg as ZodVoid,cA as ZuiForm,te as addIssueToContext,Hx as agent,Lx as aimodel,Qx as any,rB as array,Gx as bigint,my as boolean,ho as botIdHeader,Cy as botUserIdHeader,CB as coerce,vo as configurationHeader,My as configurationTypeHeader,Mx as conversation,po as createZodEnum,kg as cuid2Regex,Sg as cuidRegex,sg as custom,Fx as datasource,Vx as date,Dg as datetimeRegex,fA as defaultComponentDefinitions,sB as discriminatedUnion,cf as effect,Cg as emailRegex,vB as enum,se as errorUtil,Ux as event,IB as fromJsonSchema,AB as fromObject,yB as function,Dr as getErrorMap,tn as getParsedType,qx as instanceof,Oy as integrationIdHeader,Zx as intent,lB as intersection,Rg as ipv4Regex,Mg as ipv6Regex,ma as isAborted,pH as isApiError,Bi as isAsync,ha as isDirty,mx as isEmojiRegex,Nr as isValid,mo as jsonSchemaToZui,Kx as knowledgebase,Wx as late,mB as lazy,hB as literal,xi as makeIssue,pB as map,$r as mergeObjectSchemas,Nx as message,Ay as messages,zx as nan,TB as nativeEnum,tB as never,Xx as null,wB as nullable,yy as number,iB as object,Ur as objectToZui,ya as objectUtil,kB as oboolean,SB as onumber,To as operationHeader,bB as optional,EB as ostring,kt as parseBody,PB as pipeline,BB as preprocess,ge as processCreateParams,_B as promise,dx as quotelessJson,dB as readonly,cB as record,fB as ref,Zo as serve,gB as set,Xp as setErrorMap,oB as strictObject,gy as string,Jx as symbol,jx as table,$x as tablerow,cf as transformer,dA as transforms,uB as tuple,Dy as typeHeader,Ig as ulidRegex,Yx as undefined,aB as union,eB as unknown,Dx as user,be as util,Ag as uuidRegex,Rx as variable,nB as void,Ry as webhookIdHeader,nP as withErrorBoundary,re as z,rs as zuiToJsonSchema};
|
|
88
|
+
`)+" "+F[1]:F[0]+Z+" "+D.join(", ")+" "+F[1]}xe.types=Kk();function P(D){return Array.isArray(D)}xe.isArray=P;function T(D){return typeof D=="boolean"}xe.isBoolean=T;function S(D){return D===null}xe.isNull=S;function E(D){return D==null}xe.isNullOrUndefined=E;function M(D){return typeof D=="number"}xe.isNumber=M;function $(D){return typeof D=="string"}xe.isString=$;function oe(D){return typeof D=="symbol"}xe.isSymbol=oe;function X(D){return D===void 0}xe.isUndefined=X;function ue(D){return ee(D)&&Ne(D)==="[object RegExp]"}xe.isRegExp=ue,xe.types.isRegExp=ue;function ee(D){return typeof D=="object"&&D!==null}xe.isObject=ee;function ie(D){return ee(D)&&Ne(D)==="[object Date]"}xe.isDate=ie,xe.types.isDate=ie;function Re(D){return ee(D)&&(Ne(D)==="[object Error]"||D instanceof Error)}xe.isError=Re,xe.types.isNativeError=Re;function Ie(D){return typeof D=="function"}xe.isFunction=Ie;function $e(D){return D===null||typeof D=="boolean"||typeof D=="number"||typeof D=="string"||typeof D=="symbol"||typeof D>"u"}xe.isPrimitive=$e,xe.isBuffer=Wk();function Ne(D){return Object.prototype.toString.call(D)}function Me(D){return D<10?"0"+D.toString(10):D.toString(10)}var Ve=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ae(){var D=new Date,Z=[Me(D.getHours()),Me(D.getMinutes()),Me(D.getSeconds())].join(":");return[D.getDate(),Ve[D.getMonth()],Z].join(" ")}xe.log=function(){console.log("%s - %s",Ae(),xe.format.apply(xe,arguments))},xe.inherits=Ct(),xe._extend=function(D,Z){if(!Z||!ee(Z))return D;for(var F=Object.keys(Z),fe=F.length;fe--;)D[F[fe]]=Z[F[fe]];return D};function me(D,Z){return Object.prototype.hasOwnProperty.call(D,Z)}var Se=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;xe.promisify=function(Z){if(typeof Z!="function")throw new TypeError('The "original" argument must be of type Function');if(Se&&Z[Se]){if(F=Z[Se],typeof F!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),F}function F(){for(var fe,ve,A=new Promise(function(Y,ae){fe=Y,ve=ae}),k=[],j=0;j<arguments.length;j++)k.push(arguments[j]);k.push(function(Y,ae){Y?ve(Y):fe(ae)});try{Z.apply(this||Xr,k)}catch(Y){ve(Y)}return A}return Object.setPrototypeOf(F,Object.getPrototypeOf(Z)),Se&&Object.defineProperty(F,Se,{value:F,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(F,e(Z))},xe.promisify.custom=Se;function ce(D,Z){if(!D){var F=new Error("Promise was rejected with a falsy value");F.reason=D,D=F}return Z(D)}function he(D){if(typeof D!="function")throw new TypeError('The "original" argument must be of type Function');function Z(){for(var F=[],fe=0;fe<arguments.length;fe++)F.push(arguments[fe]);var ve=F.pop();if(typeof ve!="function")throw new TypeError("The last argument must be of type Function");var A=this||Xr,k=function(){return ve.apply(A,arguments)};D.apply(this||Xr,F).then(function(j){t.nextTick(k.bind(null,null,j))},function(j){t.nextTick(ce.bind(null,j,k))})}return Object.setPrototypeOf(Z,Object.getPrototypeOf(D)),Object.defineProperties(Z,e(D)),Z}return xe.callbackify=he,xe}var le=qk();le.format;le.deprecate;le.debuglog;le.inspect;le.types;le.isArray;le.isBoolean;le.isNull;le.isNullOrUndefined;le.isNumber;le.isString;le.isSymbol;le.isUndefined;le.isRegExp;le.isObject;le.isDate;le.isError;le.isFunction;le.isPrimitive;le.isBuffer;le.log;le.inherits;le._extend;le.promisify;le.callbackify;var gO=le._extend,yO=le.callbackify,mO=le.debuglog,hO=le.deprecate,vO=le.format,TO=le.inherits,_O=le.inspect,bO=le.isArray,wO=le.isBoolean,xO=le.isBuffer,BO=le.isDate,PO=le.isError,EO=le.isFunction,SO=le.isNull,kO=le.isNullOrUndefined,IO=le.isNumber,AO=le.isObject,CO=le.isPrimitive,OO=le.isRegExp,RO=le.isString,MO=le.isSymbol,DO=le.isUndefined,NO=le.log,HO=le.promisify,UO=le.types,jO=le.TextEncoder=globalThis.TextEncoder,$O=le.TextDecoder=globalThis.TextDecoder;var yr=class{defaultOptions;constructor(e){this.defaultOptions=e}info(...e){this._log("info",e)}debug(...e){this._log("debug",e)}warn(...e){this._log("warn",e)}error(...e){this._log("error",e)}_log(e,n){this._getConsoleMethod(e)(this._serializeMessage(n))}_serializeMessage(e){let n=le.format(...e);return J.env.BP_LOG_FORMAT==="json"?this.getJsonMessage(n):n}getJsonMessage(e){return JSON.stringify({msg:e,options:this.defaultOptions})}_getConsoleMethod(e){switch(e){case"debug":return console.debug;case"warn":return console.warn;case"error":return console.error;default:return console.info}}};var Nn=class extends yr{constructor(e){super({visibleToBotOwners:!0,...e})}with(e){return new Nn({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withVisibleToBotOwners(e){return this.with({visibleToBotOwners:e})}forBot(){return this.withVisibleToBotOwners(!0)}getJsonMessage(e){return JSON.stringify({msg:e,visible_to_bot_owner:this.defaultOptions.visibleToBotOwners,options:this.defaultOptions})}};C();R();O();var Vk=t=>["traceparent","tracestate","sentry-trace"].reduce((e,n)=>(t[n]&&(e[n]=t[n]),e),{}),wv=t=>async e=>{let n=jh(e.headers),[,r]=(e.headers.traceparent||"").split("-"),o=new Gk({botId:n.botId,integrationId:n.integrationId,retry:Ko,headers:Vk(e.headers)}),s=new Vr(o),i=new Nn({traceId:r}),a={ctx:n,req:e,client:s,logger:i,instance:t};try{let l;switch(n.operation){case"webhook_received":l=await Yk(a);break;case"register":l=await Xk(a);break;case"unregister":l=await Qk(a);break;case"message_created":l=await nI(a);break;case"action_triggered":l=await rI(a);break;case"ping":l=await Jk(a);break;case"create_user":l=await eI(a);break;case"create_conversation":l=await tI(a);break;default:throw new Error(`Unknown operation ${n.operation}`)}return l?{...l,status:l.status??200}:{status:200}}catch(l){if(zk(l)){let d=l.type==="Runtime"?l:new bv(l.message,l);return i.forBot().error(d.message),{status:d.code,body:JSON.stringify(d.toJSON())}}console.error(l);let f=new bv("An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.");return i.forBot().error(f.message),{status:f.code,body:JSON.stringify(f.toJSON())}}},Jk=async t=>{},Yk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{let{req:s}=kt(n);return o.webhook({client:t,ctx:e,req:s,logger:r})},Xk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.register)return;let{webhookUrl:s}=kt(n);await o.register({client:t,ctx:e,webhookUrl:s,logger:r})},Qk=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.unregister)return;let{webhookUrl:s}=kt(n);await o.unregister({ctx:e,webhookUrl:s,client:t,logger:r})},eI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createUser)return;let{tags:s}=kt(n);return await o.createUser({ctx:e,client:t,tags:s,logger:r})},tI=async({client:t,ctx:e,req:n,logger:r,instance:o})=>{if(!o.createConversation)return;let{channel:s,tags:i}=kt(n);return await o.createConversation({ctx:e,client:t,channel:s,tags:i,logger:r})},nI=async({ctx:t,req:e,client:n,logger:r,instance:o})=>{let{conversation:s,user:i,type:a,payload:l,message:f}=kt(e),d=o.channels[s.channel];if(!d)throw new Error(`Channel ${s.channel} not found`);let y=d.messages[a];if(!y)throw new Error(`Message of type ${a} not found in channel ${s.channel}`);await y({ctx:t,conversation:s,message:f,user:i,type:a,client:n,payload:l,ack:async({tags:m})=>{await n.updateMessage({id:f.id,tags:m})},logger:r})},rI=async({req:t,ctx:e,client:n,logger:r,instance:o})=>{let{input:s,type:i}=kt(t);if(!i)throw new Error("Missing action type");let a=o.actions[i];if(!a)throw new Error(`Action ${i} not found`);let l=new Wo,d={output:await a({ctx:e,input:s,client:n,type:i,logger:r,metadata:l}),meta:l.toJSON()};return{body:JSON.stringify(d)}};var Ul=class{constructor(e){this.props=e;this.actions=e.actions,this.channels=e.channels,this.register=e.register,this.unregister=e.unregister,this.createUser=e.createUser,this.createConversation=e.createConversation,this.webhook=e.handler}actions;channels;register;unregister;createUser;createConversation;webhook;handler=wv(this);start=e=>Zo(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var jl=class{constructor(e){this.props=e;this.integrations=e.integrations,this.plugins=e.plugins,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows}integrations;plugins;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows;addIntegration(e,n){let r=this;return r.integrations||(r.integrations={}),r.integrations[e.name]={enabled:n.enabled,...e,configurationType:n.configurationType,configuration:n.configuration},this}addPlugin(e,n){let r=this;r.plugins||(r.plugins={});let o=n.alias??e.name;return r.plugins[o]={...e,alias:n.alias,configuration:n.configuration,interfaces:n.interfaces},r.user=this._mergeUser(r.user,e.definition.user),r.conversation=this._mergeConversation(r.conversation,e.definition.conversation),r.message=this._mergeMessage(r.message,e.definition.message),r.recurringEvents=this._mergeRecurringEvents(r.recurringEvents,e.definition.recurringEvents),r.tables=this._mergeTables(r.tables,e.definition.tables),r.workflows=this._mergeWorkflows(r.workflows,e.definition.workflows),r.states=this._mergeStates(r.states,this._prefixKeys(e.definition.states,n.alias)),r.events=this._mergeEvents(r.events,this._prefixKeys(e.definition.events,n.alias)),r.actions=this._mergeActions(r.actions,this._prefixKeys(e.definition.actions,n.alias)),this}_mergeUser=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeConversation=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeMessage=(e,n)=>({tags:{...e?.tags,...n?.tags}});_mergeStates=(e,n)=>({...e,...n});_mergeEvents=(e,n)=>({...e,...n});_mergeRecurringEvents=(e,n)=>({...e,...n});_mergeActions=(e,n)=>({...e,...n});_mergeTables=(e,n)=>({...e,...n});_mergeWorkflows=(e,n)=>({...e,...n});_prefixKeys=(e,n)=>!e||!n?e:qe.mapKeys(e,r=>`${n}${qo}${r}`)};C();R();O();C();R();O();import*as Pv from"@botpress/client";C();R();O();var Hn=class extends yr{constructor(e){super({...e})}with(e){return new Hn({...this.defaultOptions,...e})}withUserId(e){return this.with({userId:e})}withConversationId(e){return this.with({conversationId:e})}withWorkflowId(e){return this.with({workflowId:e})}withEventId(e){return this.with({eventId:e})}withMessageId(e){return this.with({messageId:e})}};C();R();O();C();R();O();var Qt=class{constructor(e,n={before:{},after:{}}){this._client=e;this._hooks=n}getConversation=e=>this._run("getConversation",e);listConversations=e=>this._run("listConversations",e);updateConversation=e=>this._run("updateConversation",e);deleteConversation=e=>this._run("deleteConversation",e);listParticipants=e=>this._run("listParticipants",e);addParticipant=e=>this._run("addParticipant",e);getParticipant=e=>this._run("getParticipant",e);removeParticipant=e=>this._run("removeParticipant",e);createEvent=e=>this._run("createEvent",e);getEvent=e=>this._run("getEvent",e);listEvents=e=>this._run("listEvents",e);createMessage=e=>this._run("createMessage",e);getOrCreateMessage=e=>this._run("getOrCreateMessage",e);getMessage=e=>this._run("getMessage",e);updateMessage=e=>this._run("updateMessage",e);listMessages=e=>this._run("listMessages",e);deleteMessage=e=>this._run("deleteMessage",e);getUser=e=>this._run("getUser",e);listUsers=e=>this._run("listUsers",e);updateUser=e=>this._run("updateUser",e);deleteUser=e=>this._run("deleteUser",e);getState=e=>this._run("getState",e);setState=e=>this._run("setState",e);getOrSetState=e=>this._run("getOrSetState",e);patchState=e=>this._run("patchState",e);callAction=e=>this._run("callAction",e);uploadFile=e=>this._run("uploadFile",e);upsertFile=e=>this._run("upsertFile",e);deleteFile=e=>this._run("deleteFile",e);listFiles=e=>this._run("listFiles",e);getFile=e=>this._run("getFile",e);updateFileMetadata=e=>this._run("updateFileMetadata",e);searchFiles=e=>this._run("searchFiles",e);trackAnalytics=e=>this._run("trackAnalytics",e);getTableRow=e=>this._run("getTableRow",e);createTableRows=e=>this._run("createTableRows",e);findTableRows=e=>this._run("findTableRows",e);deleteTableRows=e=>this._run("deleteTableRows",e);updateTableRows=e=>this._run("updateTableRows",e);upsertTableRows=e=>this._run("upsertTableRows",e);createWorkflow=e=>this._run("createWorkflow",e);getWorkflow=e=>this._run("getWorkflow",e);updateWorkflow=e=>this._run("updateWorkflow",e);deleteWorkflow=e=>this._run("deleteWorkflow",e);listWorkflows=e=>this._run("listWorkflows",e);createConversation=e=>this._client.createConversation(e);getOrCreateConversation=e=>this._client.getOrCreateConversation(e);createUser=e=>this._client.createUser(e);getOrCreateUser=e=>this._client.getOrCreateUser(e);_run=async(e,n)=>{let r=this._hooks.before[e];r&&(n=await r(n));let o=await this._client[e](n),s=this._hooks.after[e];return s&&(o=await s(o)),o}};C();R();O();C();R();O();var mr=t=>new Proxy({},{get:(e,n)=>({listInstances:{all:r=>un({workflowName:n,client:t,input:r}),running:r=>un({workflowName:n,client:t,input:r,statuses:["in_progress"]}),scheduled:r=>un({workflowName:n,client:t,input:r,statuses:["pending","listening"]}),allFinished:r=>un({workflowName:n,client:t,input:r,statuses:["completed","cancelled","failed","timedout"]}),cancelled:r=>un({workflowName:n,client:t,input:r,statuses:["cancelled"]}),failed:r=>un({workflowName:n,client:t,input:r,statuses:["failed"]}),succeeded:r=>un({workflowName:n,client:t,input:r,statuses:["completed"]}),timedOut:r=>un({workflowName:n,client:t,input:r,statuses:["timedout"]})},startNewInstance:async r=>{let{workflow:o}=await t.createWorkflow({name:n,status:"pending",...r});return{workflow:cn({client:t,workflow:o})}}})}),un=async t=>{let e=await t.client.listWorkflows({name:t.workflowName,statuses:t.statuses,...t.input});return{...e,workflows:e.workflows.map(n=>cn({client:t.client,workflow:n}))}},cn=t=>({...t.workflow,async update(e){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,...e});return{workflow:cn({client:t.client,workflow:n})}},async setFailed({failureReason:e}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"failed",failureReason:e});return{workflow:cn({client:t.client,workflow:n})}},async setCompleted({output:e}={}){let{workflow:n}=await t.client.updateWorkflow({id:t.workflow.id,status:"completed",output:e});return{workflow:cn({client:t.client,workflow:n})}},async cancel(){let{workflow:e}=await t.client.updateWorkflow({id:t.workflow.id,status:"cancelled"});return{workflow:cn({client:t.client,workflow:e})}}});C();R();O();C();R();O();var iI=re.enum(["event_received","register","unregister","ping","action_triggered"]),xv=t=>{let e=t[ho],n=t[vo],r=t[Dy],o=iI.parse(t[To]);if(!e)throw new Error("Missing bot headers");if(!r)throw new Error("Missing type headers");if(!n)throw new Error("Missing configuration headers");if(!o)throw new Error("Missing operation headers");return{botId:e,operation:o,type:r,configuration:n?JSON.parse(z.from(n,"base64").toString("utf-8")):{}}};C();R();O();var lt={status:200};C();R();O();C();R();O();var $l=t=>{switch(t){case"workflow_continued":return"continued";case"workflow_started":return"started";case"workflow_timedout":return"timed_out";default:throw new Error(`Unsupported workflow update type: ${t}`)}};var oI=["child_workflow_deleted","child_workflow_finished","workflow_timedout","workflow_started","workflow_continued"],Bv=async(t,e)=>{if(t.ctx.type!=="workflow_update"||!oI.includes(e.payload.type))throw new Error("Unexpected event type");let n={...t,logger:aI(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),lt;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 sI(n,e);default:e.payload.type}return lt},aI=(t,e)=>t.logger.with({eventId:e.id,workflowId:e.payload.workflow.id,conversationId:e.payload.conversation?.id,userId:e.payload.user?.id}),sI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];return!r||r.length===0?(t.logger.warn(`No ${n} handler found for workflow "${e.payload.workflow.name}"`),lt):(await lI(t,e),await uI(t,e),lt)},lI=async(t,e)=>{e.payload.workflow.status==="pending"&&await t.client.updateWorkflow({id:e.payload.workflow.id,status:"in_progress",eventId:e.id})},uI=async(t,e)=>{let n=$l(e.payload.type),r=t.self.workflowHandlers[n]?.[e.payload.workflow.name];for(let o of r)await o({...t,conversation:e.payload.conversation,user:e.payload.user,workflow:cn({...t,workflow:e.payload.workflow}),workflows:mr(t.client)})};C();R();O();var Ev=t=>async e=>{let n=xv(e.headers),r=new Hn,o=new Pv.Client({botId:n.botId,retry:Ko}),s=new Qt(o,{before:{createMessage:async a=>{let l=t.hookHandlers.before_outgoing_message[a.type]??[];for(let f of l){let d=new Qt(o);a=(await f({client:d,ctx:n,logger:r.with({conversationId:a.conversationId,userId:a.userId}),data:a,...hr({client:d})}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.before_outgoing_call_action[a.type]??[];for(let f of l){let d=new Qt(o);a=(await f({client:d,ctx:n,logger:r,data:a,...hr({client:d})}))?.data??a}return a}},after:{createMessage:async a=>{let l=t.hookHandlers.after_outgoing_message[a.message.type]??[];for(let f of l){let d=new Qt(o);a=(await f({client:d,ctx:n,logger:r.with({messageId:a.message.id,conversationId:a.message.conversationId,userId:a.message.userId}),data:a,...hr({client:d})}))?.data??a}return a},callAction:async a=>{let l=t.hookHandlers.after_outgoing_call_action[a.output.type]??[];for(let f of l){let d=new Qt(o);a=(await f({client:d,ctx:n,logger:r,data:a,...hr({client:d})}))?.data??a}return a}}}),i={req:e,ctx:n,logger:r,client:s,self:t};switch(n.operation){case"action_triggered":return await gI(i);case"event_received":return await pI(i);case"register":return await fI(i);case"unregister":return await dI(i);case"ping":return await cI(i);default:throw new Error(`Unknown operation ${n.operation}`)}},cI=async({ctx:t})=>(ir.info(`Received ${t.operation} operation for bot ${t.botId} of type ${t.type}`),lt),fI=async t=>lt,dI=async t=>lt,pI=async t=>{let{ctx:e,logger:n,req:r,client:o,self:s}=t,i={client:o,ctx:e,logger:n,...hr({client:o})};ir.debug(`Received event ${e.type}`);let a=kt(r);if(i.logger=i.logger.with({eventId:a.event.id,messageId:a.event.messageId,conversationId:a.event.conversationId,userId:a.event.userId}),e.type==="workflow_update")return await Bv(t,a.event);if(e.type==="message_created"){let m=a.event,v=m.payload.message;i.logger=i.logger.with({messageId:v.id,conversationId:v.conversationId,userId:v.userId});let B=s.hookHandlers.before_incoming_message[v.type]??[];for(let E of B){let M=await E({...i,data:v});if(v=M?.data??v,M?.stop)return lt}let P={...i,user:m.payload.user,conversation:m.payload.conversation,message:v,event:m},T=s.messageHandlers[v.type]??[];for(let E of T)await E(P);let S=s.hookHandlers.after_incoming_message[v.type]??[];for(let E of S){let M=await E({...i,data:v});if(v=M?.data??v,M?.stop)return lt}return lt}if(e.type==="state_expired"){let v=a.event.payload.state,B={...i,state:v},P=s.stateExpiredHandlers["*"]??[];for(let T of P)await T(B);return lt}let l=a.event,f=s.hookHandlers.before_incoming_event[l.type]??[];for(let m of f){let v=await m({...i,data:l});if(l=v?.data??l,v?.stop)return lt}let d={...i,event:l},y=s.eventHandlers[l.type]??[];for(let m of y)await m(d);let g=s.hookHandlers.after_incoming_event[l.type]??[];for(let m of g){let v=await m({...i,data:l});if(l=v?.data??l,v?.stop)return lt}return lt},gI=async({ctx:t,logger:e,req:n,client:r,self:o})=>{let{input:s,type:i}=kt(n);if(!i)throw new Error("Missing action type");let a=o.actionHandlers[i];if(!a)throw new Error(`Action ${i} not found`);let f={output:await a({ctx:t,logger:e,input:s,client:r,type:i,...hr({client:r})})};return{status:200,body:JSON.stringify(f)}},hr=t=>({workflows:mr(t.client)});var Zl=class{constructor(e){this.props=e;this._actionHandlers=e.actions,this._plugins=e.plugins}_actionHandlers;_messageHandlers={};_eventHandlers={};_stateExpiredHandlers={};_hookHandlers={before_incoming_event:{},before_incoming_message:{},before_outgoing_message:{},before_outgoing_call_action:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_plugins={};_registerOrder=0;get actionHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._actionHandlers[n];if(r)return r;for(let o of Object.values(this._plugins))if(r=o.actionHandlers[n],r)return r}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.messageHandlers[n]??[]),o=this._messageHandlers[n]??[],s=this._messageHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>a);return Te.unique([...r,...i])}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.eventHandlers[n]??[]),o=this._eventHandlers[n]??[],s=this._eventHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>a);return Te.unique([...r,...i])}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{let r=Object.values(this._plugins).flatMap(a=>a.stateExpiredHandlers[n]??[]),o=this._stateExpiredHandlers[n]??[],s=this._stateExpiredHandlers["*"]??[],i=[...o,...s].sort((a,l)=>a.order-l.order).map(({handler:a})=>a);return Te.unique([...r,...i])}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{if(this._hookHandlers[n])return new Proxy({},{get:(o,s)=>{let i=Object.values(this._plugins).flatMap(y=>y.hookHandlers[n]?.[s]??[]),a=this._hookHandlers[n]??{},l=a[s]??[],f=a["*"]??[],d=[...l,...f].sort((y,g)=>y.order-g.order).map(({handler:y})=>y);return Te.unique([...i,...d])}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{let i=r[s]?.sort((l,f)=>l.order-f.order).map(({handler:l})=>l)??[],a=Object.values(this._plugins).flatMap(l=>l.workflowHandlers[n]?.[s]??[]);return Te.unique([...i,...a])}})}})}on={message:(e,n)=>{this._messageHandlers[e]=Te.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=Te.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=Te.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=Te.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=Te.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=Te.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=Te.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=Te.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=Te.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=Te.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=Te.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=Te.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=Te.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=Te.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};handler=Ev(this);start=e=>Zo(this.handler,e)};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();var Ll=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.title=e.title,this.description=e.description,this.readme=e.readme,this.entities=e.entities??{};let n=this._getEntityReference(this.entities),r=e.events===void 0?{}:qe.mapValues(e.events,i=>({...i,schema:i.schema(n)})),o=e.actions===void 0?{}:qe.mapValues(e.actions,i=>({...i,input:{...i.input,schema:i.input.schema(n)},output:{...i.output,schema:i.output.schema(n)}})),s=e.channels===void 0?{}:qe.mapValues(e.channels,i=>({...i,messages:qe.mapValues(i.messages,a=>({...a,schema:a.schema(n)}))}));this.events=r,this.actions=o,this.channels=s}name;version;title;description;icon;readme;entities;events;actions;channels;_getEntityReference=e=>{let n={};for(let[r,o]of Object.entries(e)){let s=o.schema._def["x-zui"]?.title,i=o.schema._def.description,a=_y.ref(r);s&&a.title(s),i&&a.describe(i),n[r]=a}return n}};C();R();O();C();R();O();C();R();O();C();R();O();var Fl=class{constructor(e){this.props=e;this.name=e.name,this.version=e.version,this.icon=e.icon,this.readme=e.readme,this.title=e.title,this.description=e.description,this.integrations=e.integrations,this.interfaces=e.interfaces,this.user=e.user,this.conversation=e.conversation,this.message=e.message,this.states=e.states,this.configuration=e.configuration,this.events=e.events,this.recurringEvents=e.recurringEvents,this.actions=e.actions,this.tables=e.tables,this.workflows=e.workflows}name;version;title;description;icon;readme;integrations;interfaces;user;conversation;message;states;configuration;events;recurringEvents;actions;tables;workflows};C();R();O();C();R();O();C();R();O();C();R();O();var Kl=":";var Sv=t=>{let[e,n]=t.split(Kl);return!e||!n?null:{namespace:e,eventName:n}},kv=t=>`${t.namespace}${Kl}${t.actionName}`,Iv=t=>`${t.namespace}${Kl}${t.eventName}`,Av=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.actions[t.actionName]?.name??t.actionName;return{namespace:r,actionName:o}},Cv=(t,e)=>{let n=e[t.namespace]??{name:t.namespace,version:"0.0.0",entities:{},actions:{},events:{},channels:{}},r=n.name,o=n.events[t.eventName]?.name??t.eventName;return{namespace:r,eventName:o}};var Ov=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>i=>yI({client:t,interfaces:e.interfaces,integrationOrInterfaceName:r,methodName:s,input:i})})}),yI=async({client:t,interfaces:e,integrationOrInterfaceName:n,methodName:r,input:o})=>{let s=Av({namespace:n,actionName:r},e),i=kv(s);return(await t.callAction({type:i,input:o})).output};C();R();O();C();R();O();C();R();O();var Wl=class{constructor(e,n,r){this._client=e;this._stateType=n;this._stateName=r}async get(e){return await this._client.getState({type:this._stateType,name:this._stateName,id:e}).then(n=>n.state.payload)}async set(e,n){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:n})}async getOrSet(e,n){return await this._client.getOrSetState({type:this._stateType,name:this._stateName,id:e,payload:n}).then(r=>r.state.payload)}async delete(e){await this._client.setState({type:this._stateType,name:this._stateName,id:e,payload:null})}async patch(e,n){await this._client.patchState({type:this._stateType,name:this._stateName,id:e,payload:n})}},Rv=(t,e)=>new Proxy({},{get:(n,r)=>new Proxy({},{get:(o,s)=>{let i=e.alias!==void 0?`${e.alias}${qo}${s}`:s;return new Wl(t,r,i)}})});C();R();O();var ql=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:{},after_incoming_event:{},after_incoming_message:{},after_outgoing_message:{},after_outgoing_call_action:{}};_workflowHandlers={started:{},continued:{},timed_out:{}};_registerOrder=0;initialize(e){return this._runtimeProps=e,this}get _runtime(){if(!this._runtimeProps)throw new Error("Plugin not correctly initialized. This is likely because you access your plugin config outside of an handler.");return this._runtimeProps}_getTools(e){let{configuration:n,interfaces:r,alias:o}=this._runtime,s=Ov(e,this._runtime),i=Rv(e,this._runtime),a=mr(e);return{configuration:n,interfaces:r,actions:s,states:i,alias:o,workflows:a}}get actionHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._actionHandlers[n];if(r)return Xt.setName(o=>r({...o,...this._getTools(o.client)}),r.name)}})}get messageHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._messageHandlers[n]??[],o=this._messageHandlers["*"]??[];return Te.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>Xt.setName(a=>i({...a,...this._getTools(a.client)}),i.name))}})}get eventHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._eventHandlers[n]??[],o=Object.entries(this._eventHandlers).filter(([a])=>this._eventResolvesTo(a,n)).flatMap(([,a])=>a??[]),s=this._eventHandlers["*"]??[];return Te.unique([...r,...o,...s]).sort((a,l)=>a.order-l.order).map(({handler:a})=>Xt.setName(l=>a({...l,...this._getTools(l.client)}),a.name))}})}get stateExpiredHandlers(){return new Proxy({},{get:(e,n)=>{n=this._stripAliasPrefix(n);let r=this._stateExpiredHandlers[n]??[],o=this._stateExpiredHandlers["*"]??[];return Te.unique([...r,...o]).sort((i,a)=>i.order-a.order).map(({handler:i})=>Xt.setName(a=>i({...a,...this._getTools(a.client)}),i.name))}})}get hookHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._hookHandlers[n];if(r)return new Proxy({},{get:(o,s)=>{s=this._stripAliasPrefix(s);let i=r[s]??[],a=Object.entries(r).filter(([d])=>this._eventResolvesTo(d,s)).flatMap(([,d])=>d??[]),l=r["*"]??[];return Te.unique([...i,...a,...l]).sort((d,y)=>d.order-y.order).map(({handler:d})=>Xt.setName(y=>d({...y,...this._getTools(y.client)}),d.name))}})}})}get workflowHandlers(){return new Proxy({},{get:(e,n)=>{let r=this._workflowHandlers[n];if(r)return new Proxy({},{get:(o,s)=>(r[s]?.sort((a,l)=>a.order-l.order)??[]).map(({handler:a})=>Xt.setName(l=>a({...l,...this._getTools(l.client)}),a.name))})}})}on={message:(e,n)=>{this._messageHandlers[e]=Te.safePush(this._messageHandlers[e],{handler:n,order:this._registerOrder++})},event:(e,n)=>{this._eventHandlers[e]=Te.safePush(this._eventHandlers[e],{handler:n,order:this._registerOrder++})},stateExpired:(e,n)=>{this._stateExpiredHandlers[e]=Te.safePush(this._stateExpiredHandlers[e],{handler:n,order:this._registerOrder++})},beforeIncomingEvent:(e,n)=>{this._hookHandlers.before_incoming_event[e]=Te.safePush(this._hookHandlers.before_incoming_event[e],{handler:n,order:this._registerOrder++})},beforeIncomingMessage:(e,n)=>{this._hookHandlers.before_incoming_message[e]=Te.safePush(this._hookHandlers.before_incoming_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingMessage:(e,n)=>{this._hookHandlers.before_outgoing_message[e]=Te.safePush(this._hookHandlers.before_outgoing_message[e],{handler:n,order:this._registerOrder++})},beforeOutgoingCallAction:(e,n)=>{this._hookHandlers.before_outgoing_call_action[e]=Te.safePush(this._hookHandlers.before_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},afterIncomingEvent:(e,n)=>{this._hookHandlers.after_incoming_event[e]=Te.safePush(this._hookHandlers.after_incoming_event[e],{handler:n,order:this._registerOrder++})},afterIncomingMessage:(e,n)=>{this._hookHandlers.after_incoming_message[e]=Te.safePush(this._hookHandlers.after_incoming_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingMessage:(e,n)=>{this._hookHandlers.after_outgoing_message[e]=Te.safePush(this._hookHandlers.after_outgoing_message[e],{handler:n,order:this._registerOrder++})},afterOutgoingCallAction:(e,n)=>{this._hookHandlers.after_outgoing_call_action[e]=Te.safePush(this._hookHandlers.after_outgoing_call_action[e],{handler:n,order:this._registerOrder++})},workflowStart:(e,n)=>{this._workflowHandlers.started[e]=Te.safePush(this._workflowHandlers.started[e],{handler:n,order:this._registerOrder++})},workflowContinue:(e,n)=>{this._workflowHandlers.continued[e]=Te.safePush(this._workflowHandlers.continued[e],{handler:n,order:this._registerOrder++})},workflowTimeout:(e,n)=>{this._workflowHandlers.timed_out[e]=Te.safePush(this._workflowHandlers.timed_out[e],{handler:n,order:this._registerOrder++})}};_eventResolvesTo=(e,n)=>{let r=Sv(e);if(!r)return!1;let o=Cv(r,this._runtime.interfaces);return Iv(o)===n};_stripAliasPrefix=e=>{let{alias:n}=this._runtime;if(!n)return e;let r=`${n}:`;return e.startsWith(r)?e.slice(r.length):e}};C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();C();R();O();export{yx as BRAND,Zl as Bot,jl as BotDefinition,Hn as BotLogger,Qt as BotSpecificClient,Gn as DIRTY,px as EMPTY_PATH,Cr as ErrorBoundary,de as INVALID,Ul as Integration,tl as IntegrationDefinition,Nn as IntegrationLogger,Vr as IntegrationSpecificClient,Ll as InterfaceDefinition,OB as NEVER,ct as OK,Et as ParseInputLazyPath,gt as ParseStatus,ql as Plugin,Fl as PluginDefinition,mH as RuntimeError,ye as Schema,SA as WELL_KNOWN_ATTRIBUTES,Ei as ZodAny,Hr as ZodArray,ja as ZodBigInt,$a as ZodBoolean,Za as ZodBranded,La as ZodCatch,Fa as ZodDate,fo as ZodDefault,ug as ZodDiscriminatedUnion,bn as ZodEffects,rr as ZodEnum,$t as ZodError,Vp as ZodFirstPartyTypeKind,fg as ZodFunction,Wa as ZodIntersection,G as ZodIssueCode,qa as ZodLazy,za as ZodLiteral,gg as ZodMap,mg as ZodNaN,Ga as ZodNativeEnum,_n as ZodNever,Va as ZodNull,Jn as ZodNullable,Ja as ZodNumber,Yn as ZodObject,nn as ZodOptional,ne as ZodParsedType,Ya as ZodPipeline,go as ZodPromise,yo as ZodReadonly,xg as ZodRecord,Pg as ZodRef,ye as ZodSchema,Eg as ZodSet,ft as ZodString,Ug as ZodSymbol,bn as ZodTransformer,Qn as ZodTuple,ye as ZodType,Xa as ZodUndefined,Qa as ZodUnion,Ar as ZodUnknown,Lg as ZodVoid,cA as ZuiForm,te as addIssueToContext,Hx as agent,Lx as aimodel,Qx as any,rB as array,Gx as bigint,my as boolean,ho as botIdHeader,Cy as botUserIdHeader,CB as coerce,vo as configurationHeader,My as configurationTypeHeader,Mx as conversation,po as createZodEnum,kg as cuid2Regex,Sg as cuidRegex,sg as custom,Fx as datasource,Vx as date,Dg as datetimeRegex,fA as defaultComponentDefinitions,sB as discriminatedUnion,cf as effect,Cg as emailRegex,vB as enum,se as errorUtil,Ux as event,IB as fromJsonSchema,AB as fromObject,yB as function,Dr as getErrorMap,tn as getParsedType,qx as instanceof,Oy as integrationIdHeader,Zx as intent,lB as intersection,Rg as ipv4Regex,Mg as ipv6Regex,ma as isAborted,yH as isApiError,Bi as isAsync,ha as isDirty,mx as isEmojiRegex,Nr as isValid,mo as jsonSchemaToZui,Kx as knowledgebase,Wx as late,mB as lazy,hB as literal,xi as makeIssue,pB as map,$r as mergeObjectSchemas,Nx as message,Ay as messages,zx as nan,TB as nativeEnum,tB as never,Xx as null,wB as nullable,yy as number,iB as object,Ur as objectToZui,ya as objectUtil,kB as oboolean,SB as onumber,To as operationHeader,bB as optional,EB as ostring,kt as parseBody,PB as pipeline,BB as preprocess,ge as processCreateParams,_B as promise,dx as quotelessJson,dB as readonly,cB as record,fB as ref,Zo as serve,gB as set,Xp as setErrorMap,oB as strictObject,gy as string,Jx as symbol,jx as table,$x as tablerow,cf as transformer,dA as transforms,uB as tuple,Dy as typeHeader,Ig as ulidRegex,Yx as undefined,aB as union,eB as unknown,Dx as user,be as util,Ag as uuidRegex,Rx as variable,nB as void,Ry as webhookIdHeader,nP as withErrorBoundary,re as z,rs as zuiToJsonSchema};
|
|
89
89
|
/*! Bundled license information:
|
|
90
90
|
|
|
91
91
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|