@novu/js 2.5.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chunk-RK2WRT5F.js → chunk-R7DABK4G.js} +118 -67
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +14 -14
- package/dist/{esm/novu-iUKr-1Nj.d.mts → cjs/novu-C3OVXS9Q.d.ts} +31 -29
- package/dist/cjs/themes/index.d.ts +2 -2
- package/dist/cjs/{types-G05b9m65.d.ts → types-Bg3djGZK.d.ts} +1 -1
- package/dist/cjs/ui/index.d.ts +4 -4
- package/dist/cjs/ui/index.js +8 -8
- package/dist/esm/{chunk-YGB4AV4G.mjs → chunk-BGMSCE2S.mjs} +118 -67
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/{cjs/novu-iUKr-1Nj.d.ts → esm/novu-C3OVXS9Q.d.mts} +31 -29
- package/dist/esm/themes/index.d.mts +2 -2
- package/dist/esm/{types-fTgZAefu.d.mts → types-Cuys78dx.d.mts} +1 -1
- package/dist/esm/ui/index.d.mts +4 -4
- package/dist/esm/ui/index.mjs +5 -5
- package/dist/index.css +1 -1
- package/dist/novu.min.js +10 -10
- package/dist/novu.min.js.gz +0 -0
- package/package.json +29 -27
package/dist/novu.min.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";(()=>{var ho=Object.create;var Qt=Object.defineProperty,uo=Object.defineProperties,po=Object.getOwnPropertyDescriptor,mo=Object.getOwnPropertyDescriptors,go=Object.getOwnPropertyNames,Xt=Object.getOwnPropertySymbols,yo=Object.getPrototypeOf,$i=Object.prototype.hasOwnProperty,Vr=Object.prototype.propertyIsEnumerable;var jr=i=>{throw TypeError(i)};var Wr=(i,e,t)=>e in i?Qt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,b=(i,e)=>{for(var t in e||(e={}))$i.call(e,t)&&Wr(i,t,e[t]);if(Xt)for(var t of Xt(e))Vr.call(e,t)&&Wr(i,t,e[t]);return i},I=(i,e)=>uo(i,mo(e));var S=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Hr=(i,e)=>{var t={};for(var r in i)$i.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&Xt)for(var r of Xt(i))e.indexOf(r)<0&&Vr.call(i,r)&&(t[r]=i[r]);return t};var k=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),vo=(i,e)=>{for(var t in e)Qt(i,t,{get:e[t],enumerable:!0})},_o=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of go(e))!$i.call(i,s)&&s!==t&&Qt(i,s,{get:()=>e[s],enumerable:!(r=po(e,s))||r.enumerable});return i};var K=(i,e,t)=>(t=i!=null?ho(yo(i)):{},_o(e||!i||!i.__esModule?Qt(t,"default",{value:i,enumerable:!0}):t,i));var Wi=(i,e,t)=>e.has(i)||jr("Cannot "+t);var f=(i,e,t)=>(Wi(i,e,"read from private field"),t?t.call(i):e.get(i)),_=(i,e,t)=>e.has(i)?jr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),E=(i,e,t,r)=>(Wi(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Vi=(i,e,t)=>(Wi(i,e,"access private method"),t);var g=(i,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},o=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,o);a((t=t.apply(i,e)).next())});var Xi=k((Ef,as)=>{"use strict";var rt=1e3,st=rt*60,nt=st*60,Ue=nt*24,Oo=Ue*7,To=Ue*365.25;as.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Io(i);if(t==="number"&&isFinite(i))return e.long?Lo(i):Po(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Io(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*To;case"weeks":case"week":case"w":return t*Oo;case"days":case"day":case"d":return t*Ue;case"hours":case"hour":case"hrs":case"hr":case"h":return t*nt;case"minutes":case"minute":case"mins":case"min":case"m":return t*st;case"seconds":case"second":case"secs":case"sec":case"s":return t*rt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Po(i){var e=Math.abs(i);return e>=Ue?Math.round(i/Ue)+"d":e>=nt?Math.round(i/nt)+"h":e>=st?Math.round(i/st)+"m":e>=rt?Math.round(i/rt)+"s":i+"ms"}function Lo(i){var e=Math.abs(i);return e>=Ue?ui(i,e,Ue,"day"):e>=nt?ui(i,e,nt,"hour"):e>=st?ui(i,e,st,"minute"):e>=rt?ui(i,e,rt,"second"):i+" ms"}function ui(i,e,t,r){var s=e>=t*1.5;return Math.round(i/t)+" "+r+(s?"s":"")}});var Qi=k((bf,cs)=>{"use strict";function Fo(i){t.debug=t,t.default=t,t.coerce=c,t.disable=n,t.enable=s,t.enabled=o,t.humanize=Xi(),t.destroy=u,Object.keys(i).forEach(l=>{t[l]=i[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(l){let h,d=null,x,w;function p(...v){if(!p.enabled)return;let N=p,A=Number(new Date),m=A-(h||A);N.diff=m,N.prev=h,N.curr=A,h=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(R,j)=>{if(R==="%%")return"%";y++;let z=t.formatters[j];if(typeof z=="function"){let pe=v[y];R=z.call(N,pe),v.splice(y,1),y--}return R}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return p.namespace=l,p.useColors=t.useColors(),p.color=t.selectColor(l),p.extend=r,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(x!==t.namespaces&&(x=t.namespaces,w=t.enabled(l)),w),set:v=>{d=v}}),typeof t.init=="function"&&t.init(p),p}function r(l,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+l);return d.log=this.log,d}function s(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let h,d=(typeof l=="string"?l:"").split(/[\s,]+/),x=d.length;for(h=0;h<x;h++)d[h]&&(l=d[h].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function n(){let l=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(l))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}cs.exports=Fo});var ls=k((Q,di)=>{"use strict";Q.formatArgs=Uo;Q.save=Do;Q.load=Mo;Q.useColors=Bo;Q.storage=qo();Q.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Q.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Bo(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Uo(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+di.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}Q.log=console.debug||console.log||(()=>{});function Do(i){try{i?Q.storage.setItem("debug",i):Q.storage.removeItem("debug")}catch(e){}}function Mo(){let i;try{i=Q.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function qo(){try{return localStorage}catch(i){}}di.exports=Qi()(Q);var{formatters:$o}=di.exports;$o.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Zi=k((Cf,fs)=>{"use strict";fs.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),s=e.indexOf("--");return r!==-1&&(s===-1||r<s)}});var ds=k((xf,us)=>{"use strict";var Wo=S("os"),hs=S("tty"),oe=Zi(),{env:M}=process,pi;oe("no-color")||oe("no-colors")||oe("color=false")||oe("color=never")?pi=0:(oe("color")||oe("colors")||oe("color=true")||oe("color=always"))&&(pi=1);function Vo(){if("FORCE_COLOR"in M)return M.FORCE_COLOR==="true"?1:M.FORCE_COLOR==="false"?0:M.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(M.FORCE_COLOR,10),3)}function jo(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Ho(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=Vo();r!==void 0&&(pi=r);let s=t?pi:r;if(s===0)return 0;if(t){if(oe("color=16m")||oe("color=full")||oe("color=truecolor"))return 3;if(oe("color=256"))return 2}if(i&&!e&&s===void 0)return 0;let n=s||0;if(M.TERM==="dumb")return n;if(process.platform==="win32"){let o=Wo.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in M)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in M)||M.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in M){let o=Number.parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(M.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM)||"COLORTERM"in M?1:n}function er(i,e={}){let t=Ho(i,b({streamIsTTY:i&&i.isTTY},e));return jo(t)}us.exports={supportsColor:er,stdout:er({isTTY:hs.isatty(1)}),stderr:er({isTTY:hs.isatty(2)})}});var ms=k((q,gi)=>{"use strict";var Go=S("tty"),mi=S("util");q.init=Zo;q.log=Jo;q.formatArgs=Ko;q.save=Xo;q.load=Qo;q.useColors=zo;q.destroy=mi.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");q.colors=[6,2,3,4,5,1];try{let i=ds();i&&(i.stderr||i).level>=2&&(q.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}q.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function zo(){return"colors"in q.inspectOpts?!!q.inspectOpts.colors:Go.isatty(process.stderr.fd)}function Ko(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
1
|
+
"use strict";(()=>{var po=Object.create;var ei=Object.defineProperty,mo=Object.defineProperties,go=Object.getOwnPropertyDescriptor,yo=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertyNames,Zt=Object.getOwnPropertySymbols,_o=Object.getPrototypeOf,Wi=Object.prototype.hasOwnProperty,jr=Object.prototype.propertyIsEnumerable;var Hr=i=>{throw TypeError(i)};var Vr=(i,e,t)=>e in i?ei(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,C=(i,e)=>{for(var t in e||(e={}))Wi.call(e,t)&&Vr(i,t,e[t]);if(Zt)for(var t of Zt(e))jr.call(e,t)&&Vr(i,t,e[t]);return i},T=(i,e)=>mo(i,yo(e));var w=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Gr=(i,e)=>{var t={};for(var r in i)Wi.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&Zt)for(var r of Zt(i))e.indexOf(r)<0&&jr.call(i,r)&&(t[r]=i[r]);return t};var k=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),Eo=(i,e)=>{for(var t in e)ei(i,t,{get:e[t],enumerable:!0})},bo=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of vo(e))!Wi.call(i,s)&&s!==t&&ei(i,s,{get:()=>e[s],enumerable:!(r=go(e,s))||r.enumerable});return i};var K=(i,e,t)=>(t=i!=null?po(_o(i)):{},bo(e||!i||!i.__esModule?ei(t,"default",{value:i,enumerable:!0}):t,i));var Vi=(i,e,t)=>e.has(i)||Hr("Cannot "+t);var f=(i,e,t)=>(Vi(i,e,"read from private field"),t?t.call(i):e.get(i)),_=(i,e,t)=>e.has(i)?Hr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),E=(i,e,t,r)=>(Vi(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),ji=(i,e,t)=>(Vi(i,e,"access private method"),t);var y=(i,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},o=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,o);a((t=t.apply(i,e)).next())});var Qi=k((Cf,ls)=>{"use strict";var it=1e3,rt=it*60,st=rt*60,De=st*24,Po=De*7,Lo=De*365.25;ls.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Fo(i);if(t==="number"&&isFinite(i))return e.long?Uo(i):Bo(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Fo(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Lo;case"weeks":case"week":case"w":return t*Po;case"days":case"day":case"d":return t*De;case"hours":case"hour":case"hrs":case"hr":case"h":return t*st;case"minutes":case"minute":case"mins":case"min":case"m":return t*rt;case"seconds":case"second":case"secs":case"sec":case"s":return t*it;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Bo(i){var e=Math.abs(i);return e>=De?Math.round(i/De)+"d":e>=st?Math.round(i/st)+"h":e>=rt?Math.round(i/rt)+"m":e>=it?Math.round(i/it)+"s":i+"ms"}function Uo(i){var e=Math.abs(i);return e>=De?di(i,e,De,"day"):e>=st?di(i,e,st,"hour"):e>=rt?di(i,e,rt,"minute"):e>=it?di(i,e,it,"second"):i+" ms"}function di(i,e,t,r){var s=e>=t*1.5;return Math.round(i/t)+" "+r+(s?"s":"")}});var Zi=k((xf,fs)=>{"use strict";function Do(i){t.debug=t,t.default=t,t.coerce=c,t.disable=n,t.enable=s,t.enabled=o,t.humanize=Qi(),t.destroy=u,Object.keys(i).forEach(l=>{t[l]=i[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(l){let h,d=null,b,S;function p(...v){if(!p.enabled)return;let N=p,A=Number(new Date),m=A-(h||A);N.diff=m,N.prev=h,N.curr=A,h=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let g=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(R,j)=>{if(R==="%%")return"%";g++;let z=t.formatters[j];if(typeof z=="function"){let pe=v[g];R=z.call(N,pe),v.splice(g,1),g--}return R}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return p.namespace=l,p.useColors=t.useColors(),p.color=t.selectColor(l),p.extend=r,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(b!==t.namespaces&&(b=t.namespaces,S=t.enabled(l)),S),set:v=>{d=v}}),typeof t.init=="function"&&t.init(p),p}function r(l,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+l);return d.log=this.log,d}function s(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let h,d=(typeof l=="string"?l:"").split(/[\s,]+/),b=d.length;for(h=0;h<b;h++)d[h]&&(l=d[h].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function n(){let l=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(l))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}fs.exports=Do});var hs=k((Q,pi)=>{"use strict";Q.formatArgs=qo;Q.save=$o;Q.load=Wo;Q.useColors=Mo;Q.storage=Vo();Q.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Q.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Mo(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function qo(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+pi.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}Q.log=console.debug||console.log||(()=>{});function $o(i){try{i?Q.storage.setItem("debug",i):Q.storage.removeItem("debug")}catch(e){}}function Wo(){let i;try{i=Q.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Vo(){try{return localStorage}catch(i){}}pi.exports=Zi()(Q);var{formatters:jo}=pi.exports;jo.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var er=k((Sf,us)=>{"use strict";us.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),s=e.indexOf("--");return r!==-1&&(s===-1||r<s)}});var ms=k((wf,ps)=>{"use strict";var Ho=w("os"),ds=w("tty"),oe=er(),{env:M}=process,mi;oe("no-color")||oe("no-colors")||oe("color=false")||oe("color=never")?mi=0:(oe("color")||oe("colors")||oe("color=true")||oe("color=always"))&&(mi=1);function Go(){if("FORCE_COLOR"in M)return M.FORCE_COLOR==="true"?1:M.FORCE_COLOR==="false"?0:M.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(M.FORCE_COLOR,10),3)}function zo(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Ko(i,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=Go();r!==void 0&&(mi=r);let s=t?mi:r;if(s===0)return 0;if(t){if(oe("color=16m")||oe("color=full")||oe("color=truecolor"))return 3;if(oe("color=256"))return 2}if(i&&!e&&s===void 0)return 0;let n=s||0;if(M.TERM==="dumb")return n;if(process.platform==="win32"){let o=Ho.release().split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if("CI"in M)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in M)||M.CI_NAME==="codeship"?1:n;if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in M){let o=Number.parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(M.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM)||"COLORTERM"in M?1:n}function tr(i,e={}){let t=Ko(i,C({streamIsTTY:i&&i.isTTY},e));return zo(t)}ps.exports={supportsColor:tr,stdout:tr({isTTY:ds.isatty(1)}),stderr:tr({isTTY:ds.isatty(2)})}});var ys=k((q,yi)=>{"use strict";var Yo=w("tty"),gi=w("util");q.init=ia;q.log=Zo;q.formatArgs=Xo;q.save=ea;q.load=ta;q.useColors=Jo;q.destroy=gi.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");q.colors=[6,2,3,4,5,1];try{let i=ms();i&&(i.stderr||i).level>=2&&(q.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}q.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function Jo(){return"colors"in q.inspectOpts?!!q.inspectOpts.colors:Yo.isatty(process.stderr.fd)}function Xo(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
2
2
|
`).join(`
|
|
3
|
-
`+n),i.push(s+"m+"+
|
|
4
|
-
`)}function
|
|
5
|
-
`).map(e=>e.trim()).join(" ")};
|
|
6
|
-
`);return m.substr(0,m.length-2)},this.getRequestHeader=function(m){return typeof m=="string"&&u[m]?u[m]:""},this.send=function(m){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(d)throw new Error("INVALID_STATE_ERR: send has already been called");var y=!1,V=!1,R=xs.parse(o.url),j;switch(R.protocol){case"https:":y=!0;case"http:":j=R.hostname;break;case"file:":V=!0;break;case void 0:case"":j="localhost";break;default:throw new Error("Protocol not supported.")}if(V){if(o.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)ot.readFile(unescape(R.pathname),"utf8",function(re,ze){re?e.handleError(re,re.errno||-1):(e.status=200,e.responseText=ze,A(e.DONE))});else try{this.responseText=ot.readFileSync(unescape(R.pathname),"utf8"),this.status=200,A(e.DONE)}catch(re){this.handleError(re,re.errno||-1)}return}var z=R.port||(y?443:80),pe=R.pathname+(R.search?R.search:"");if(u.Host=j,y&&z===443||z===80||(u.Host+=":"+R.port),o.user){typeof o.password=="undefined"&&(o.password="");var Kt=new Buffer(o.user+":"+o.password);u.Authorization="Basic "+Kt.toString("base64")}o.method==="GET"||o.method==="HEAD"?m=null:m?(u["Content-Length"]=Buffer.isBuffer(m)?m.length:Buffer.byteLength(m),u["Content-Type"]||(u["Content-Type"]="text/plain;charset=UTF-8")):o.method==="POST"&&(u["Content-Length"]=0);var Yt=i.agent||!1,ie={host:j,port:z,path:pe,method:o.method,headers:u,agent:Yt};if(y&&(ie.pfx=i.pfx,ie.key=i.key,ie.passphrase=i.passphrase,ie.cert=i.cert,ie.ca=i.ca,ie.ciphers=i.ciphers,ie.rejectUnauthorized=i.rejectUnauthorized!==!1),x=!1,o.async){var Ge=y?r.request:t.request;d=!0,e.dispatchEvent("readystatechange");var qr=function(re){if(n=re,n.statusCode===302||n.statusCode===303||n.statusCode===307){o.url=n.headers.location;var ze=xs.parse(o.url);j=ze.hostname;var xe={hostname:ze.hostname,port:ze.port,path:ze.path,method:n.statusCode===303?"GET":o.method,headers:u};y&&(xe.pfx=i.pfx,xe.key=i.key,xe.passphrase=i.passphrase,xe.cert=i.cert,xe.ca=i.ca,xe.ciphers=i.ciphers,xe.rejectUnauthorized=i.rejectUnauthorized!==!1),s=Ge(xe,qr).on("error",$r),s.end();return}n&&n.setEncoding&&n.setEncoding("utf8"),A(e.HEADERS_RECEIVED),e.status=n.statusCode,n.on("data",function(Jt){Jt&&(e.responseText+=Jt),d&&A(e.LOADING)}),n.on("end",function(){d&&(d=!1,A(e.DONE))}),n.on("error",function(Jt){e.handleError(Jt)})},$r=function(re){e.handleError(re)};s=Ge(ie,qr).on("error",$r),i.autoUnref&&s.on("socket",re=>{re.unref()}),m&&s.write(m),s.end(),e.dispatchEvent("loadstart")}else{var yt=".node-xmlhttprequest-content-"+process.pid,vt=".node-xmlhttprequest-sync-"+process.pid;ot.writeFileSync(vt,"","utf8");for(var co="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(y?"s":"")+".request;var options = "+JSON.stringify(ie)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+vt+"');});response.on('error', function(error) {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+vt+"');});}).on('error', function(error) {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+vt+"');});"+(m?"req.write('"+JSON.stringify(m).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",lo=ia(process.argv[0],["-e",co]),sl;ot.existsSync(vt););if(e.responseText=ot.readFileSync(yt,"utf8"),lo.stdin.end(),ot.unlinkSync(yt),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var fo=e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");e.handleError(fo,503)}else e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),e.responseText=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),A(e.DONE)}},this.handleError=function(m,y){this.status=y||0,this.statusText=m,this.responseText=m.stack,x=!0,A(this.DONE)},this.abort=function(){s&&(s.abort(),s=null),u=Object.assign({},c),this.responseText="",this.responseXML="",x=w=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||d)&&this.readyState!==this.DONE&&(d=!1,A(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(m,y){m in p||(p[m]=[]),p[m].push(y)},this.removeEventListener=function(m,y){m in p&&(p[m]=p[m].filter(function(V){return V!==y}))},this.dispatchEvent=function(m){if(typeof e["on"+m]=="function"&&(this.readyState===this.DONE?setImmediate(function(){e["on"+m]()}):e["on"+m]()),m in p)for(let y=0,V=p[m].length;y<V;y++)this.readyState===this.DONE?setImmediate(function(){p[m][y].call(e)}):p[m][y].call(e)};var A=function(m){if(!(e.readyState===m||e.readyState===e.UNSENT&&w)&&(e.readyState=m,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let y;w?y="abort":x?y="error":y="load",e.dispatchEvent(y),e.dispatchEvent("loadend")}}}});var Is=k((Vf,Ts)=>{"use strict";var{Duplex:oa}=S("stream");function ks(i){i.emit("close")}function aa(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Os(i){this.removeListener("error",Os),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function ca(i,e){let t=!0,r=new oa(I(b({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(n,o){let a=!o&&r._readableState.objectMode?n.toString():n;r.push(a)||i.pause()}),i.once("error",function(n){r.destroyed||(t=!1,r.destroy(n))}),i.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(s,n){if(i.readyState===i.CLOSED){n(s),process.nextTick(ks,r);return}let o=!1;i.once("error",function(c){o=!0,n(c)}),i.once("close",function(){o||n(s),process.nextTick(ks,r)}),t&&i.terminate()},r._final=function(s){if(i.readyState===i.CONNECTING){i.once("open",function(){r._final(s)});return}i._socket!==null&&(i._socket._writableState.finished?(s(),r._readableState.endEmitted&&r.destroy()):(i._socket.once("finish",function(){s()}),i.close()))},r._read=function(){i.isPaused&&i.resume()},r._write=function(s,n,o){if(i.readyState===i.CONNECTING){i.once("open",function(){r._write(s,n,o)});return}i.send(s,o)},r.on("end",aa),r.on("error",Os),r}Ts.exports=ca});var ke=k((Hf,Ps)=>{"use strict";Ps.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var At=k((Gf,Ei)=>{"use strict";var{EMPTY_BUFFER:la}=ke();function fa(i,e){if(i.length===0)return la;if(i.length===1)return i[0];let t=Buffer.allocUnsafe(e),r=0;for(let s=0;s<i.length;s++){let n=i[s];t.set(n,r),r+=n.length}return r<e?t.slice(0,r):t}function Ls(i,e,t,r,s){for(let n=0;n<s;n++)t[r+n]=i[n]^e[n&3]}function Fs(i,e){for(let t=0;t<i.length;t++)i[t]^=e[t&3]}function ha(i){return i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}function cr(i){if(cr.readOnly=!0,Buffer.isBuffer(i))return i;let e;return i instanceof ArrayBuffer?e=Buffer.from(i):ArrayBuffer.isView(i)?e=Buffer.from(i.buffer,i.byteOffset,i.byteLength):(e=Buffer.from(i),cr.readOnly=!1),e}Ei.exports={concat:fa,mask:Ls,toArrayBuffer:ha,toBuffer:cr,unmask:Fs};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=S("bufferutil");Ei.exports.mask=function(e,t,r,s,n){n<48?Ls(e,t,r,s,n):i.mask(e,t,r,s,n)},Ei.exports.unmask=function(e,t){e.length<32?Fs(e,t):i.unmask(e,t)}}catch(i){}});var Ds=k((zf,Us)=>{"use strict";var Bs=Symbol("kDone"),lr=Symbol("kRun"),fr=class{constructor(e){this[Bs]=()=>{this.pending--,this[lr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[lr]()}[lr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Bs])}}};Us.exports=fr});var Ot=k((Kf,Ws)=>{"use strict";var Rt=S("zlib"),Ms=At(),ua=Ds(),{kStatusCode:qs}=ke(),da=Buffer.from([0,0,255,255]),xi=Symbol("permessage-deflate"),Ee=Symbol("total-length"),kt=Symbol("callback"),Oe=Symbol("buffers"),Ci=Symbol("error"),bi,hr=class{constructor(e,t,r){if(this._maxPayload=r|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!bi){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;bi=new ua(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[kt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,r=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(r.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?r.client_max_window_bits=t.clientMaxWindowBits:(r.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(r=>{let s=t[r];if(s.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(s=s[0],r==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else if(r==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=s})}),e}decompress(e,t,r){bi.add(s=>{this._decompress(e,t,(n,o)=>{s(),r(n,o)})})}compress(e,t,r){bi.add(s=>{this._compress(e,t,(n,o)=>{s(),r(n,o)})})}_decompress(e,t,r){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=Rt.createInflateRaw(I(b({},this._options.zlibInflateOptions),{windowBits:o})),this._inflate[xi]=this,this._inflate[Ee]=0,this._inflate[Oe]=[],this._inflate.on("error",ma),this._inflate.on("data",$s)}this._inflate[kt]=r,this._inflate.write(e),t&&this._inflate.write(da),this._inflate.flush(()=>{let n=this._inflate[Ci];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=Ms.concat(this._inflate[Oe],this._inflate[Ee]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ee]=0,this._inflate[Oe]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=Rt.createDeflateRaw(I(b({},this._options.zlibDeflateOptions),{windowBits:o})),this._deflate[Ee]=0,this._deflate[Oe]=[],this._deflate.on("data",pa)}this._deflate[kt]=r,this._deflate.write(e),this._deflate.flush(Rt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Ms.concat(this._deflate[Oe],this._deflate[Ee]);t&&(n=n.slice(0,n.length-4)),this._deflate[kt]=null,this._deflate[Ee]=0,this._deflate[Oe]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};Ws.exports=hr;function pa(i){this[Oe].push(i),this[Ee]+=i.length}function $s(i){if(this[Ee]+=i.length,this[xi]._maxPayload<1||this[Ee]<=this[xi]._maxPayload){this[Oe].push(i);return}this[Ci]=new RangeError("Max payload size exceeded"),this[Ci].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ci][qs]=1009,this.removeListener("data",$s),this.reset()}function ma(i){this[xi]._inflate=null,i[qs]=1007,this[kt](i)}});var Tt=k((Jf,ur)=>{"use strict";var ga=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function ya(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function Vs(i){let e=i.length,t=0;for(;t<e;)if(!(i[t]&128))t++;else if((i[t]&224)===192){if(t+1===e||(i[t+1]&192)!==128||(i[t]&254)===192)return!1;t+=2}else if((i[t]&240)===224){if(t+2>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||i[t]===224&&(i[t+1]&224)===128||i[t]===237&&(i[t+1]&224)===160)return!1;t+=3}else if((i[t]&248)===240){if(t+3>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||(i[t+3]&192)!==128||i[t]===240&&(i[t+1]&240)===128||i[t]===244&&i[t+1]>143||i[t]>244)return!1;t+=4}else return!1;return!0}ur.exports={isValidStatusCode:ya,isValidUTF8:Vs,tokenChars:ga};if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=S("utf-8-validate");ur.exports.isValidUTF8=function(e){return e.length<150?Vs(e):i(e)}}catch(i){}});var gr=k((Xf,Js)=>{"use strict";var{Writable:va}=S("stream"),js=Ot(),{BINARY_TYPES:_a,EMPTY_BUFFER:Hs,kStatusCode:Ea,kWebSocket:ba}=ke(),{concat:dr,toArrayBuffer:Ca,unmask:xa}=At(),{isValidStatusCode:Sa,isValidUTF8:Gs}=Tt(),It=0,zs=1,Ks=2,Ys=3,pr=4,wa=5,mr=class extends va{constructor(e={}){super(),this._binaryType=e.binaryType||_a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[ba]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=It,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==It)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=r.slice(e),r.slice(0,e)}let t=Buffer.allocUnsafe(e);do{let r=this._buffers[0],s=t.length-e;e>=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do switch(this._state){case It:t=this.getInfo();break;case zs:t=this.getPayloadLength16();break;case Ks:t=this.getPayloadLength64();break;case Ys:this.getMask();break;case pr:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48)return this._loop=!1,B(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");let t=(e[0]&64)===64;if(t&&!this._extensions[js.extensionName])return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,B(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,B(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,B(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,B(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,B(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=zs;else if(this._payloadLength===127)this._state=Ks;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,B(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=Ys:this._state=pr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=pr}getData(e){let t=Hs;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&xa(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=wa,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[js.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}let o=this.dataMessage();if(o)return t(o);this.startLoop(t)})}dataMessage(){if(this._fin){let e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=dr(t,e):this._binaryType==="arraybuffer"?r=Ca(dr(t,e)):r=t,this.emit("message",r,!0)}else{let r=dr(t,e);if(!this._skipUTF8Validation&&!Gs(r))return this._loop=!1,B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=It}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,Hs),this.end();else{if(e.length===1)return B(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{let t=e.readUInt16BE(0);if(!Sa(t))return B(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=e.slice(2);if(!this._skipUTF8Validation&&!Gs(r))return B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=It}};Js.exports=mr;function B(i,e,t,r,s){let n=new i(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,B),n.code=s,n[Ea]=r,n}});var vr=k((eh,Zs)=>{"use strict";var Qf=S("net"),Zf=S("tls"),{randomFillSync:Na}=S("crypto"),Xs=Ot(),{EMPTY_BUFFER:Aa}=ke(),{isValidStatusCode:Ra}=Tt(),{mask:Qs,toBuffer:at}=At(),he=Symbol("kByteLength"),ka=Buffer.alloc(4),yr=class i{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,s=!1,n=2,o=!1;t.mask&&(r=t.maskBuffer||ka,t.generateMask?t.generateMask(r):Na(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let a;typeof e=="string"?(!t.mask||o)&&t[he]!==void 0?a=t[he]:(e=Buffer.from(e),a=e.length):(a=e.length,s=t.mask&&t.readOnly&&!o);let c=a;a>=65536?(n+=8,c=127):a>125&&(n+=2,c=126);let u=Buffer.allocUnsafe(s?a+n:n);return u[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),t.mask?(u[1]|=128,u[n-4]=r[0],u[n-3]=r[1],u[n-2]=r[2],u[n-1]=r[3],o?[u,e]:s?(Qs(e,r,u,n,a),[u]):(Qs(e,r,e,0,a),[u,e])):[u,e]}close(e,t,r,s){let n;if(e===void 0)n=Aa;else{if(typeof e!="number"||!Ra(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let a=Buffer.byteLength(t);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+a),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[he]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(i.frame(n,o),s)}ping(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=at(e),s=e.length,n=at.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}pong(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=at(e),s=e.length,n=at.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}send(e,t,r){let s=this._extensions[Xs.extensionName],n=t.binary?2:1,o=t.compress,a,c;if(typeof e=="string"?(a=Buffer.byteLength(e),c=!1):(e=at(e),a=e.length,c=at.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=a>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let u={[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,u,r]):this.dispatch(e,this._compress,u,r)}else this.sendFrame(i.frame(e,{[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:!1}),r)}dispatch(e,t,r,s){if(!t){this.sendFrame(i.frame(e,r),s);return}let n=this._extensions[Xs.extensionName];this._bufferedBytes+=r[he],this._deflating=!0,n.compress(e,r.fin,(o,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(c);for(let u=0;u<this._queue.length;u++){let l=this._queue[u],h=l[l.length-1];typeof h=="function"&&h(c)}return}this._bufferedBytes-=r[he],this._deflating=!1,r.readOnly=!1,this.sendFrame(i.frame(a,r),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};Zs.exports=yr});var ln=k((th,cn)=>{"use strict";var{kForOnEventAttribute:Pt,kListener:_r}=ke(),en=Symbol("kCode"),tn=Symbol("kData"),rn=Symbol("kError"),sn=Symbol("kMessage"),nn=Symbol("kReason"),ct=Symbol("kTarget"),on=Symbol("kType"),an=Symbol("kWasClean"),be=class{constructor(e){this[ct]=null,this[on]=e}get target(){return this[ct]}get type(){return this[on]}};Object.defineProperty(be.prototype,"target",{enumerable:!0});Object.defineProperty(be.prototype,"type",{enumerable:!0});var Me=class extends be{constructor(e,t={}){super(e),this[en]=t.code===void 0?0:t.code,this[nn]=t.reason===void 0?"":t.reason,this[an]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[en]}get reason(){return this[nn]}get wasClean(){return this[an]}};Object.defineProperty(Me.prototype,"code",{enumerable:!0});Object.defineProperty(Me.prototype,"reason",{enumerable:!0});Object.defineProperty(Me.prototype,"wasClean",{enumerable:!0});var lt=class extends be{constructor(e,t={}){super(e),this[rn]=t.error===void 0?null:t.error,this[sn]=t.message===void 0?"":t.message}get error(){return this[rn]}get message(){return this[sn]}};Object.defineProperty(lt.prototype,"error",{enumerable:!0});Object.defineProperty(lt.prototype,"message",{enumerable:!0});var Lt=class extends be{constructor(e,t={}){super(e),this[tn]=t.data===void 0?null:t.data}get data(){return this[tn]}};Object.defineProperty(Lt.prototype,"data",{enumerable:!0});var Oa={addEventListener(i,e,t={}){for(let s of this.listeners(i))if(!t[Pt]&&s[_r]===e&&!s[Pt])return;let r;if(i==="message")r=function(n,o){let a=new Lt("message",{data:o?n:n.toString()});a[ct]=this,Si(e,this,a)};else if(i==="close")r=function(n,o){let a=new Me("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[ct]=this,Si(e,this,a)};else if(i==="error")r=function(n){let o=new lt("error",{error:n,message:n.message});o[ct]=this,Si(e,this,o)};else if(i==="open")r=function(){let n=new be("open");n[ct]=this,Si(e,this,n)};else return;r[Pt]=!!t[Pt],r[_r]=e,t.once?this.once(i,r):this.on(i,r)},removeEventListener(i,e){for(let t of this.listeners(i))if(t[_r]===e&&!t[Pt]){this.removeListener(i,t);break}}};cn.exports={CloseEvent:Me,ErrorEvent:lt,Event:be,EventTarget:Oa,MessageEvent:Lt};function Si(i,e,t){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,t):i.call(e,t)}});var Er=k((ih,fn)=>{"use strict";var{tokenChars:Ft}=Tt();function me(i,e,t){i[e]===void 0?i[e]=[t]:i[e].push(t)}function Ta(i){let e=Object.create(null),t=Object.create(null),r=!1,s=!1,n=!1,o,a,c=-1,u=-1,l=-1,h=0;for(;h<i.length;h++)if(u=i.charCodeAt(h),o===void 0)if(l===-1&&Ft[u]===1)c===-1&&(c=h);else if(h!==0&&(u===32||u===9))l===-1&&c!==-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h);let x=i.slice(c,l);u===44?(me(e,x,t),t=Object.create(null)):o=x,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===void 0)if(l===-1&&Ft[u]===1)c===-1&&(c=h);else if(u===32||u===9)l===-1&&c!==-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h),me(t,i.slice(c,l),!0),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),c=l=-1}else if(u===61&&c!==-1&&l===-1)a=i.slice(c,h),c=l=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(s){if(Ft[u]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1?c=h:r||(r=!0),s=!1}else if(n)if(Ft[u]===1)c===-1&&(c=h);else if(u===34&&c!==-1)n=!1,l=h;else if(u===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(u===34&&i.charCodeAt(h-1)===61)n=!0;else if(l===-1&&Ft[u]===1)c===-1&&(c=h);else if(c!==-1&&(u===32||u===9))l===-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h);let x=i.slice(c,l);r&&(x=x.replace(/\\/g,""),r=!1),me(t,a,x),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),a=void 0,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(c===-1||n||u===32||u===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=h);let d=i.slice(c,l);return o===void 0?me(e,d,t):(a===void 0?me(t,d,!0):r?me(t,a,d.replace(/\\/g,"")):me(t,a,d),me(e,o,t)),e}function Ia(i){return Object.keys(i).map(e=>{let t=i[e];return Array.isArray(t)||(t=[t]),t.map(r=>[e].concat(Object.keys(r).map(s=>{let n=r[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}fn.exports={format:Ia,parse:Ta}});var wr=k((sh,bn)=>{"use strict";var Pa=S("events"),La=S("https"),Fa=S("http"),dn=S("net"),Ba=S("tls"),{randomBytes:Ua,createHash:Da}=S("crypto"),{Readable:rh}=S("stream"),{URL:br}=S("url"),Te=Ot(),Ma=gr(),qa=vr(),{BINARY_TYPES:hn,EMPTY_BUFFER:wi,GUID:$a,kForOnEventAttribute:Cr,kListener:Wa,kStatusCode:Va,kWebSocket:Y,NOOP:pn}=ke(),{EventTarget:{addEventListener:ja,removeEventListener:Ha}}=ln(),{format:Ga,parse:za}=Er(),{toBuffer:Ka}=At(),Ya=30*1e3,mn=Symbol("kAborted"),xr=[8,13],Ce=["CONNECTING","OPEN","CLOSING","CLOSED"],Ja=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,P=class i extends Pa{constructor(e,t,r){super(),this._binaryType=hn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=wi,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=i.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(r=t,t=[]):t=[t]),gn(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){hn.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){let s=new Ma({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new qa(e,this._extensions,r.generateMask),this._receiver=s,this._socket=e,s[Y]=this,e[Y]=this,s.on("conclude",Za),s.on("drain",ec),s.on("error",tc),s.on("message",ic),s.on("ping",rc),s.on("pong",sc),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",vn),e.on("data",Ai),e.on("end",_n),e.on("error",En),this._readyState=i.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Te.extensionName]&&this._extensions[Te.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Z(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===i.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=i.CLOSING,this._sender.close(e,t,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Ya)}}pause(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Sr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||wi,t,r)}pong(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Sr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||wi,t,r)}resume(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(r=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Sr(this,e,r);return}let s=b({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[Te.extensionName]||(s.compress=!1),this._sender.send(e||wi,s,r)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Z(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(P,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(P.prototype,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(P,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(P.prototype,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(P,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(P.prototype,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(P,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});Object.defineProperty(P.prototype,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(P.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(P.prototype,`on${i}`,{enumerable:!0,get(){for(let e of this.listeners(i))if(e[Cr])return e[Wa];return null},set(e){for(let t of this.listeners(i))if(t[Cr]){this.removeListener(i,t);break}typeof e=="function"&&this.addEventListener(i,e,{[Cr]:!0})}})});P.prototype.addEventListener=ja;P.prototype.removeEventListener=Ha;bn.exports=P;function gn(i,e,t,r){let s=I(b({protocolVersion:xr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},r),{createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0});if(!xr.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${xr.join(", ")})`);let n;if(e instanceof br)n=e,i._url=e.href;else{try{n=new br(e)}catch(p){throw new SyntaxError(`Invalid URL: ${e}`)}i._url=e}let o=n.protocol==="wss:",a=n.protocol==="ws+unix:",c;if(n.protocol!=="ws:"&&!o&&!a?c=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:a&&!n.pathname?c="The URL's pathname is empty":n.hash&&(c="The URL contains a fragment identifier"),c){let p=new SyntaxError(c);if(i._redirects===0)throw p;Ni(i,p);return}let u=o?443:80,l=Ua(16).toString("base64"),h=o?La.request:Fa.request,d=new Set,x;if(s.createConnection=o?Qa:Xa,s.defaultPort=s.defaultPort||u,s.port=n.port||u,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers=I(b({},s.headers),{"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"}),s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(x=new Te(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Ga({[Te.extensionName]:x.offer()})),t.length){for(let p of t){if(typeof p!="string"||!Ja.test(p)||d.has(p))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(p)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),a){let p=s.path.split(":");s.socketPath=p[0],s.path=p[1]}let w;if(s.followRedirects){if(i._redirects===0){i._originalIpc=a,i._originalSecure=o,i._originalHostOrSocketPath=a?s.socketPath:n.host;let p=r&&r.headers;if(r=I(b({},r),{headers:{}}),p)for(let[v,N]of Object.entries(p))r.headers[v.toLowerCase()]=N}else if(i.listenerCount("redirect")===0){let p=a?i._originalIpc?s.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:n.host===i._originalHostOrSocketPath;(!p||i._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,p||delete s.headers.host,s.auth=void 0)}s.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),w=i._req=h(s),i._redirects&&i.emit("redirect",i.url,w)}else w=i._req=h(s);s.timeout&&w.on("timeout",()=>{Z(i,w,"Opening handshake has timed out")}),w.on("error",p=>{w===null||w[mn]||(w=i._req=null,Ni(i,p))}),w.on("response",p=>{let v=p.headers.location,N=p.statusCode;if(v&&s.followRedirects&&N>=300&&N<400){if(++i._redirects>s.maxRedirects){Z(i,w,"Maximum redirects exceeded");return}w.abort();let A;try{A=new br(v,e)}catch(m){let y=new SyntaxError(`Invalid URL: ${v}`);Ni(i,y);return}gn(i,A,t,r)}else i.emit("unexpected-response",w,p)||Z(i,w,`Unexpected server response: ${p.statusCode}`)}),w.on("upgrade",(p,v,N)=>{if(i.emit("upgrade",p),i.readyState!==P.CONNECTING)return;if(w=i._req=null,p.headers.upgrade.toLowerCase()!=="websocket"){Z(i,v,"Invalid Upgrade header");return}let A=Da("sha1").update(l+$a).digest("base64");if(p.headers["sec-websocket-accept"]!==A){Z(i,v,"Invalid Sec-WebSocket-Accept header");return}let m=p.headers["sec-websocket-protocol"],y;if(m!==void 0?d.size?d.has(m)||(y="Server sent an invalid subprotocol"):y="Server sent a subprotocol but none was requested":d.size&&(y="Server sent no subprotocol"),y){Z(i,v,y);return}m&&(i._protocol=m);let V=p.headers["sec-websocket-extensions"];if(V!==void 0){if(!x){Z(i,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let R;try{R=za(V)}catch(z){Z(i,v,"Invalid Sec-WebSocket-Extensions header");return}let j=Object.keys(R);if(j.length!==1||j[0]!==Te.extensionName){Z(i,v,"Server indicated an extension that was not requested");return}try{x.accept(R[Te.extensionName])}catch(z){Z(i,v,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[Te.extensionName]=x}i.setSocket(v,N,{generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),w.end()}function Ni(i,e){i._readyState=P.CLOSING,i.emit("error",e),i.emitClose()}function Xa(i){return i.path=i.socketPath,dn.connect(i)}function Qa(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=dn.isIP(i.host)?"":i.host),Ba.connect(i)}function Z(i,e,t){i._readyState=P.CLOSING;let r=new Error(t);Error.captureStackTrace(r,Z),e.setHeader?(e[mn]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ni,i,r)):(e.destroy(r),e.once("error",i.emit.bind(i,"error")),e.once("close",i.emitClose.bind(i)))}function Sr(i,e,t){if(e){let r=Ka(e).length;i._socket?i._sender._bufferedBytes+=r:i._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${i.readyState} (${Ce[i.readyState]})`);t(r)}}function Za(i,e){let t=this[Y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=i,t._socket[Y]!==void 0&&(t._socket.removeListener("data",Ai),process.nextTick(yn,t._socket),i===1005?t.close():t.close(i,e))}function ec(){let i=this[Y];i.isPaused||i._socket.resume()}function tc(i){let e=this[Y];e._socket[Y]!==void 0&&(e._socket.removeListener("data",Ai),process.nextTick(yn,e._socket),e.close(i[Va])),e.emit("error",i)}function un(){this[Y].emitClose()}function ic(i,e){this[Y].emit("message",i,e)}function rc(i){let e=this[Y];e.pong(i,!e._isServer,pn),e.emit("ping",i)}function sc(i){this[Y].emit("pong",i)}function yn(i){i.resume()}function vn(){let i=this[Y];this.removeListener("close",vn),this.removeListener("data",Ai),this.removeListener("end",_n),i._readyState=P.CLOSING;let e;!this._readableState.endEmitted&&!i._closeFrameReceived&&!i._receiver._writableState.errorEmitted&&(e=i._socket.read())!==null&&i._receiver.write(e),i._receiver.end(),this[Y]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",un),i._receiver.on("finish",un))}function Ai(i){this[Y]._receiver.write(i)||this.pause()}function _n(){let i=this[Y];i._readyState=P.CLOSING,i._receiver.end(),this.end()}function En(){let i=this[Y];this.removeListener("error",En),this.on("error",pn),i&&(i._readyState=P.CLOSING,this.destroy())}});var xn=k((oh,Cn)=>{"use strict";var{tokenChars:nc}=Tt();function oc(i){let e=new Set,t=-1,r=-1,s=0;for(s;s<i.length;s++){let o=i.charCodeAt(s);if(r===-1&&nc[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);r===-1&&(r=s);let a=i.slice(t,r);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=i.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Cn.exports={parse:oc}});var On=k((fh,kn)=>{"use strict";var ac=S("events"),Ri=S("http"),ah=S("https"),ch=S("net"),lh=S("tls"),{createHash:cc}=S("crypto"),Sn=Er(),qe=Ot(),lc=xn(),fc=wr(),{GUID:hc,kWebSocket:uc}=ke(),dc=/^[+/0-9A-Za-z]{22}==$/,wn=0,Nn=1,Rn=2,Nr=class extends ac{constructor(e,t){if(super(),e=b({maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:fc},e),e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Ri.createServer((r,s)=>{let n=Ri.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=pc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=wn}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Rn){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Bt,this);return}if(e&&this.once("close",e),this._state!==Nn)if(this._state=Nn,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Bt,this):process.nextTick(Bt,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Bt(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",An);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){$e(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){$e(this,e,t,400,"Invalid Upgrade header");return}if(!n||!dc.test(n)){$e(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){$e(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){Ut(t,400);return}let a=e.headers["sec-websocket-protocol"],c=new Set;if(a!==void 0)try{c=lc.parse(a)}catch(h){$e(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],l={};if(this.options.perMessageDeflate&&u!==void 0){let h=new qe(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let d=Sn.parse(u);d[qe.extensionName]&&(h.accept(d[qe.extensionName]),l[qe.extensionName]=h)}catch(d){$e(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(d,x,w,p)=>{if(!d)return Ut(t,x||401,w,p);this.completeUpgrade(l,n,c,e,t,r,s)});return}if(!this.options.verifyClient(h))return Ut(t,401)}this.completeUpgrade(l,n,c,e,t,r,s)}completeUpgrade(e,t,r,s,n,o,a){if(!n.readable||!n.writable)return n.destroy();if(n[uc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>wn)return Ut(n,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${cc("sha1").update(t+hc).digest("base64")}`],l=new this.options.WebSocket(null);if(r.size){let h=this.options.handleProtocols?this.options.handleProtocols(r,s):r.values().next().value;h&&(u.push(`Sec-WebSocket-Protocol: ${h}`),l._protocol=h)}if(e[qe.extensionName]){let h=e[qe.extensionName].params,d=Sn.format({[qe.extensionName]:[h]});u.push(`Sec-WebSocket-Extensions: ${d}`),l._extensions=e}this.emit("headers",u,s),n.write(u.concat(`\r
|
|
3
|
+
`+n),i.push(s+"m+"+yi.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Qo()+e+" "+i[0]}function Qo(){return q.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Zo(...i){return process.stderr.write(gi.formatWithOptions(q.inspectOpts,...i)+`
|
|
4
|
+
`)}function ea(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function ta(){return process.env.DEBUG}function ia(i){i.inspectOpts={};let e=Object.keys(q.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=q.inspectOpts[e[t]]}yi.exports=Zi()(q);var{formatters:gs}=yi.exports;gs.o=function(i){return this.inspectOpts.colors=this.useColors,gi.inspect(i,this.inspectOpts).split(`
|
|
5
|
+
`).map(e=>e.trim()).join(" ")};gs.O=function(i){return this.inspectOpts.colors=this.useColors,gi.inspect(i,this.inspectOpts)}});var Me=k((Af,ir)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?ir.exports=hs():ir.exports=ys()});var As=k((Ff,Ns)=>{"use strict";var nt=w("fs"),ws=w("url"),na=w("child_process").spawn;Ns.exports=nr;nr.XMLHttpRequest=nr;function nr(i){"use strict";i=i||{};var e=this,t=w("http"),r=w("https"),s,n,o={},a=!1,c={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},u=Object.assign({},c),l=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],h=["TRACE","TRACK","CONNECT"],d=!1,b=!1,S=!1,p={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null;var v=function(m){return a||m&&l.indexOf(m.toLowerCase())===-1},N=function(m){return m&&h.indexOf(m)===-1};this.open=function(m,g,V,R,j){if(this.abort(),b=!1,S=!1,!N(m))throw new Error("SecurityError: Request method not allowed");o={method:m,url:g.toString(),async:typeof V!="boolean"?!0:V,user:R||null,password:j||null},A(this.OPENED)},this.setDisableHeaderCheck=function(m){a=m},this.setRequestHeader=function(m,g){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!v(m))return console.warn('Refused to set unsafe header "'+m+'"'),!1;if(d)throw new Error("INVALID_STATE_ERR: send flag is true");return u[m]=g,!0},this.getResponseHeader=function(m){return typeof m=="string"&&this.readyState>this.OPENED&&n.headers[m.toLowerCase()]&&!b?n.headers[m.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||b)return"";var m="";for(var g in n.headers)g!=="set-cookie"&&g!=="set-cookie2"&&(m+=g+": "+n.headers[g]+`\r
|
|
6
|
+
`);return m.substr(0,m.length-2)},this.getRequestHeader=function(m){return typeof m=="string"&&u[m]?u[m]:""},this.send=function(m){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(d)throw new Error("INVALID_STATE_ERR: send has already been called");var g=!1,V=!1,R=ws.parse(o.url),j;switch(R.protocol){case"https:":g=!0;case"http:":j=R.hostname;break;case"file:":V=!0;break;case void 0:case"":j="localhost";break;default:throw new Error("Protocol not supported.")}if(V){if(o.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)nt.readFile(unescape(R.pathname),"utf8",function(re,Ke){re?e.handleError(re,re.errno||-1):(e.status=200,e.responseText=Ke,A(e.DONE))});else try{this.responseText=nt.readFileSync(unescape(R.pathname),"utf8"),this.status=200,A(e.DONE)}catch(re){this.handleError(re,re.errno||-1)}return}var z=R.port||(g?443:80),pe=R.pathname+(R.search?R.search:"");if(u.Host=j,g&&z===443||z===80||(u.Host+=":"+R.port),o.user){typeof o.password=="undefined"&&(o.password="");var Jt=new Buffer(o.user+":"+o.password);u.Authorization="Basic "+Jt.toString("base64")}o.method==="GET"||o.method==="HEAD"?m=null:m?(u["Content-Length"]=Buffer.isBuffer(m)?m.length:Buffer.byteLength(m),u["Content-Type"]||(u["Content-Type"]="text/plain;charset=UTF-8")):o.method==="POST"&&(u["Content-Length"]=0);var Xt=i.agent||!1,ie={host:j,port:z,path:pe,method:o.method,headers:u,agent:Xt};if(g&&(ie.pfx=i.pfx,ie.key=i.key,ie.passphrase=i.passphrase,ie.cert=i.cert,ie.ca=i.ca,ie.ciphers=i.ciphers,ie.rejectUnauthorized=i.rejectUnauthorized!==!1),b=!1,o.async){var ze=g?r.request:t.request;d=!0,e.dispatchEvent("readystatechange");var $r=function(re){if(n=re,n.statusCode===302||n.statusCode===303||n.statusCode===307){o.url=n.headers.location;var Ke=ws.parse(o.url);j=Ke.hostname;var xe={hostname:Ke.hostname,port:Ke.port,path:Ke.path,method:n.statusCode===303?"GET":o.method,headers:u};g&&(xe.pfx=i.pfx,xe.key=i.key,xe.passphrase=i.passphrase,xe.cert=i.cert,xe.ca=i.ca,xe.ciphers=i.ciphers,xe.rejectUnauthorized=i.rejectUnauthorized!==!1),s=ze(xe,$r).on("error",Wr),s.end();return}n&&n.setEncoding&&n.setEncoding("utf8"),A(e.HEADERS_RECEIVED),e.status=n.statusCode,n.on("data",function(Qt){Qt&&(e.responseText+=Qt),d&&A(e.LOADING)}),n.on("end",function(){d&&(d=!1,A(e.DONE))}),n.on("error",function(Qt){e.handleError(Qt)})},Wr=function(re){e.handleError(re)};s=ze(ie,$r).on("error",Wr),i.autoUnref&&s.on("socket",re=>{re.unref()}),m&&s.write(m),s.end(),e.dispatchEvent("loadstart")}else{var gt=".node-xmlhttprequest-content-"+process.pid,yt=".node-xmlhttprequest-sync-"+process.pid;nt.writeFileSync(yt,"","utf8");for(var fo="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(g?"s":"")+".request;var options = "+JSON.stringify(ie)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+gt+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+yt+"');});response.on('error', function(error) {fs.writeFileSync('"+gt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+yt+"');});}).on('error', function(error) {fs.writeFileSync('"+gt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+yt+"');});"+(m?"req.write('"+JSON.stringify(m).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",ho=na(process.argv[0],["-e",fo]),al;nt.existsSync(yt););if(e.responseText=nt.readFileSync(gt,"utf8"),ho.stdin.end(),nt.unlinkSync(gt),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var uo=e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");e.handleError(uo,503)}else e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),e.responseText=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),A(e.DONE)}},this.handleError=function(m,g){this.status=g||0,this.statusText=m,this.responseText=m.stack,b=!0,A(this.DONE)},this.abort=function(){s&&(s.abort(),s=null),u=Object.assign({},c),this.responseText="",this.responseXML="",b=S=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||d)&&this.readyState!==this.DONE&&(d=!1,A(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(m,g){m in p||(p[m]=[]),p[m].push(g)},this.removeEventListener=function(m,g){m in p&&(p[m]=p[m].filter(function(V){return V!==g}))},this.dispatchEvent=function(m){if(typeof e["on"+m]=="function"&&(this.readyState===this.DONE?setImmediate(function(){e["on"+m]()}):e["on"+m]()),m in p)for(let g=0,V=p[m].length;g<V;g++)this.readyState===this.DONE?setImmediate(function(){p[m][g].call(e)}):p[m][g].call(e)};var A=function(m){if(!(e.readyState===m||e.readyState===e.UNSENT&&S)&&(e.readyState=m,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let g;S?g="abort":b?g="error":g="load",e.dispatchEvent(g),e.dispatchEvent("loadend")}}}});var Ls=k((Hf,Ps)=>{"use strict";var{Duplex:la}=w("stream");function Ts(i){i.emit("close")}function fa(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Is(i){this.removeListener("error",Is),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function ha(i,e){let t=!0,r=new la(T(C({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(n,o){let a=!o&&r._readableState.objectMode?n.toString():n;r.push(a)||i.pause()}),i.once("error",function(n){r.destroyed||(t=!1,r.destroy(n))}),i.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(s,n){if(i.readyState===i.CLOSED){n(s),process.nextTick(Ts,r);return}let o=!1;i.once("error",function(c){o=!0,n(c)}),i.once("close",function(){o||n(s),process.nextTick(Ts,r)}),t&&i.terminate()},r._final=function(s){if(i.readyState===i.CONNECTING){i.once("open",function(){r._final(s)});return}i._socket!==null&&(i._socket._writableState.finished?(s(),r._readableState.endEmitted&&r.destroy()):(i._socket.once("finish",function(){s()}),i.close()))},r._read=function(){i.isPaused&&i.resume()},r._write=function(s,n,o){if(i.readyState===i.CONNECTING){i.once("open",function(){r._write(s,n,o)});return}i.send(s,o)},r.on("end",fa),r.on("error",Is),r}Ps.exports=ha});var Oe=k((zf,Fs)=>{"use strict";Fs.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var kt=k((Kf,bi)=>{"use strict";var{EMPTY_BUFFER:ua}=Oe();function da(i,e){if(i.length===0)return ua;if(i.length===1)return i[0];let t=Buffer.allocUnsafe(e),r=0;for(let s=0;s<i.length;s++){let n=i[s];t.set(n,r),r+=n.length}return r<e?t.slice(0,r):t}function Bs(i,e,t,r,s){for(let n=0;n<s;n++)t[r+n]=i[n]^e[n&3]}function Us(i,e){for(let t=0;t<i.length;t++)i[t]^=e[t&3]}function pa(i){return i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}function lr(i){if(lr.readOnly=!0,Buffer.isBuffer(i))return i;let e;return i instanceof ArrayBuffer?e=Buffer.from(i):ArrayBuffer.isView(i)?e=Buffer.from(i.buffer,i.byteOffset,i.byteLength):(e=Buffer.from(i),lr.readOnly=!1),e}bi.exports={concat:da,mask:Bs,toArrayBuffer:pa,toBuffer:lr,unmask:Us};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=w("bufferutil");bi.exports.mask=function(e,t,r,s,n){n<48?Bs(e,t,r,s,n):i.mask(e,t,r,s,n)},bi.exports.unmask=function(e,t){e.length<32?Us(e,t):i.unmask(e,t)}}catch(i){}});var qs=k((Yf,Ms)=>{"use strict";var Ds=Symbol("kDone"),fr=Symbol("kRun"),hr=class{constructor(e){this[Ds]=()=>{this.pending--,this[fr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[fr]()}[fr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ds])}}};Ms.exports=hr});var It=k((Jf,js)=>{"use strict";var Ot=w("zlib"),$s=kt(),ma=qs(),{kStatusCode:Ws}=Oe(),ga=Buffer.from([0,0,255,255]),Si=Symbol("permessage-deflate"),Ee=Symbol("total-length"),Tt=Symbol("callback"),Te=Symbol("buffers"),xi=Symbol("error"),Ci,ur=class{constructor(e,t,r){if(this._maxPayload=r|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!Ci){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Ci=new ma(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Tt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,r=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(r.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?r.client_max_window_bits=t.clientMaxWindowBits:(r.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(r=>{let s=t[r];if(s.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(s=s[0],r==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else if(r==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=s})}),e}decompress(e,t,r){Ci.add(s=>{this._decompress(e,t,(n,o)=>{s(),r(n,o)})})}compress(e,t,r){Ci.add(s=>{this._compress(e,t,(n,o)=>{s(),r(n,o)})})}_decompress(e,t,r){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Ot.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=Ot.createInflateRaw(T(C({},this._options.zlibInflateOptions),{windowBits:o})),this._inflate[Si]=this,this._inflate[Ee]=0,this._inflate[Te]=[],this._inflate.on("error",va),this._inflate.on("data",Vs)}this._inflate[Tt]=r,this._inflate.write(e),t&&this._inflate.write(ga),this._inflate.flush(()=>{let n=this._inflate[xi];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=$s.concat(this._inflate[Te],this._inflate[Ee]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ee]=0,this._inflate[Te]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Ot.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=Ot.createDeflateRaw(T(C({},this._options.zlibDeflateOptions),{windowBits:o})),this._deflate[Ee]=0,this._deflate[Te]=[],this._deflate.on("data",ya)}this._deflate[Tt]=r,this._deflate.write(e),this._deflate.flush(Ot.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=$s.concat(this._deflate[Te],this._deflate[Ee]);t&&(n=n.slice(0,n.length-4)),this._deflate[Tt]=null,this._deflate[Ee]=0,this._deflate[Te]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};js.exports=ur;function ya(i){this[Te].push(i),this[Ee]+=i.length}function Vs(i){if(this[Ee]+=i.length,this[Si]._maxPayload<1||this[Ee]<=this[Si]._maxPayload){this[Te].push(i);return}this[xi]=new RangeError("Max payload size exceeded"),this[xi].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[xi][Ws]=1009,this.removeListener("data",Vs),this.reset()}function va(i){this[Si]._inflate=null,i[Ws]=1007,this[Tt](i)}});var Pt=k((Qf,dr)=>{"use strict";var _a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Ea(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function Hs(i){let e=i.length,t=0;for(;t<e;)if(!(i[t]&128))t++;else if((i[t]&224)===192){if(t+1===e||(i[t+1]&192)!==128||(i[t]&254)===192)return!1;t+=2}else if((i[t]&240)===224){if(t+2>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||i[t]===224&&(i[t+1]&224)===128||i[t]===237&&(i[t+1]&224)===160)return!1;t+=3}else if((i[t]&248)===240){if(t+3>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||(i[t+3]&192)!==128||i[t]===240&&(i[t+1]&240)===128||i[t]===244&&i[t+1]>143||i[t]>244)return!1;t+=4}else return!1;return!0}dr.exports={isValidStatusCode:Ea,isValidUTF8:Hs,tokenChars:_a};if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=w("utf-8-validate");dr.exports.isValidUTF8=function(e){return e.length<150?Hs(e):i(e)}}catch(i){}});var yr=k((Zf,Qs)=>{"use strict";var{Writable:ba}=w("stream"),Gs=It(),{BINARY_TYPES:Ca,EMPTY_BUFFER:zs,kStatusCode:xa,kWebSocket:Sa}=Oe(),{concat:pr,toArrayBuffer:wa,unmask:Na}=kt(),{isValidStatusCode:Aa,isValidUTF8:Ks}=Pt(),Lt=0,Ys=1,Js=2,Xs=3,mr=4,Ra=5,gr=class extends ba{constructor(e={}){super(),this._binaryType=e.binaryType||Ca[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Sa]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=Lt,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==Lt)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=r.slice(e),r.slice(0,e)}let t=Buffer.allocUnsafe(e);do{let r=this._buffers[0],s=t.length-e;e>=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do switch(this._state){case Lt:t=this.getInfo();break;case Ys:t=this.getPayloadLength16();break;case Js:t=this.getPayloadLength64();break;case Xs:this.getMask();break;case mr:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48)return this._loop=!1,B(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");let t=(e[0]&64)===64;if(t&&!this._extensions[Gs.extensionName])return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,B(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,B(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,B(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,B(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,B(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=Ys;else if(this._payloadLength===127)this._state=Js;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,B(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=Xs:this._state=mr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=mr}getData(e){let t=zs;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&Na(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=Ra,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[Gs.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}let o=this.dataMessage();if(o)return t(o);this.startLoop(t)})}dataMessage(){if(this._fin){let e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=pr(t,e):this._binaryType==="arraybuffer"?r=wa(pr(t,e)):r=t,this.emit("message",r,!0)}else{let r=pr(t,e);if(!this._skipUTF8Validation&&!Ks(r))return this._loop=!1,B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=Lt}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,zs),this.end();else{if(e.length===1)return B(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{let t=e.readUInt16BE(0);if(!Aa(t))return B(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=e.slice(2);if(!this._skipUTF8Validation&&!Ks(r))return B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=Lt}};Qs.exports=gr;function B(i,e,t,r,s){let n=new i(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,B),n.code=s,n[xa]=r,n}});var _r=k((ih,tn)=>{"use strict";var eh=w("net"),th=w("tls"),{randomFillSync:ka}=w("crypto"),Zs=It(),{EMPTY_BUFFER:Oa}=Oe(),{isValidStatusCode:Ta}=Pt(),{mask:en,toBuffer:ot}=kt(),he=Symbol("kByteLength"),Ia=Buffer.alloc(4),vr=class i{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,s=!1,n=2,o=!1;t.mask&&(r=t.maskBuffer||Ia,t.generateMask?t.generateMask(r):ka(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let a;typeof e=="string"?(!t.mask||o)&&t[he]!==void 0?a=t[he]:(e=Buffer.from(e),a=e.length):(a=e.length,s=t.mask&&t.readOnly&&!o);let c=a;a>=65536?(n+=8,c=127):a>125&&(n+=2,c=126);let u=Buffer.allocUnsafe(s?a+n:n);return u[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),t.mask?(u[1]|=128,u[n-4]=r[0],u[n-3]=r[1],u[n-2]=r[2],u[n-1]=r[3],o?[u,e]:s?(en(e,r,u,n,a),[u]):(en(e,r,e,0,a),[u,e])):[u,e]}close(e,t,r,s){let n;if(e===void 0)n=Oa;else{if(typeof e!="number"||!Ta(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let a=Buffer.byteLength(t);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+a),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[he]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(i.frame(n,o),s)}ping(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=ot(e),s=e.length,n=ot.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}pong(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=ot(e),s=e.length,n=ot.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}send(e,t,r){let s=this._extensions[Zs.extensionName],n=t.binary?2:1,o=t.compress,a,c;if(typeof e=="string"?(a=Buffer.byteLength(e),c=!1):(e=ot(e),a=e.length,c=ot.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=a>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let u={[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,u,r]):this.dispatch(e,this._compress,u,r)}else this.sendFrame(i.frame(e,{[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:!1}),r)}dispatch(e,t,r,s){if(!t){this.sendFrame(i.frame(e,r),s);return}let n=this._extensions[Zs.extensionName];this._bufferedBytes+=r[he],this._deflating=!0,n.compress(e,r.fin,(o,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(c);for(let u=0;u<this._queue.length;u++){let l=this._queue[u],h=l[l.length-1];typeof h=="function"&&h(c)}return}this._bufferedBytes-=r[he],this._deflating=!1,r.readOnly=!1,this.sendFrame(i.frame(a,r),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};tn.exports=vr});var hn=k((rh,fn)=>{"use strict";var{kForOnEventAttribute:Ft,kListener:Er}=Oe(),rn=Symbol("kCode"),sn=Symbol("kData"),nn=Symbol("kError"),on=Symbol("kMessage"),an=Symbol("kReason"),at=Symbol("kTarget"),cn=Symbol("kType"),ln=Symbol("kWasClean"),be=class{constructor(e){this[at]=null,this[cn]=e}get target(){return this[at]}get type(){return this[cn]}};Object.defineProperty(be.prototype,"target",{enumerable:!0});Object.defineProperty(be.prototype,"type",{enumerable:!0});var qe=class extends be{constructor(e,t={}){super(e),this[rn]=t.code===void 0?0:t.code,this[an]=t.reason===void 0?"":t.reason,this[ln]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[rn]}get reason(){return this[an]}get wasClean(){return this[ln]}};Object.defineProperty(qe.prototype,"code",{enumerable:!0});Object.defineProperty(qe.prototype,"reason",{enumerable:!0});Object.defineProperty(qe.prototype,"wasClean",{enumerable:!0});var ct=class extends be{constructor(e,t={}){super(e),this[nn]=t.error===void 0?null:t.error,this[on]=t.message===void 0?"":t.message}get error(){return this[nn]}get message(){return this[on]}};Object.defineProperty(ct.prototype,"error",{enumerable:!0});Object.defineProperty(ct.prototype,"message",{enumerable:!0});var Bt=class extends be{constructor(e,t={}){super(e),this[sn]=t.data===void 0?null:t.data}get data(){return this[sn]}};Object.defineProperty(Bt.prototype,"data",{enumerable:!0});var Pa={addEventListener(i,e,t={}){for(let s of this.listeners(i))if(!t[Ft]&&s[Er]===e&&!s[Ft])return;let r;if(i==="message")r=function(n,o){let a=new Bt("message",{data:o?n:n.toString()});a[at]=this,wi(e,this,a)};else if(i==="close")r=function(n,o){let a=new qe("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[at]=this,wi(e,this,a)};else if(i==="error")r=function(n){let o=new ct("error",{error:n,message:n.message});o[at]=this,wi(e,this,o)};else if(i==="open")r=function(){let n=new be("open");n[at]=this,wi(e,this,n)};else return;r[Ft]=!!t[Ft],r[Er]=e,t.once?this.once(i,r):this.on(i,r)},removeEventListener(i,e){for(let t of this.listeners(i))if(t[Er]===e&&!t[Ft]){this.removeListener(i,t);break}}};fn.exports={CloseEvent:qe,ErrorEvent:ct,Event:be,EventTarget:Pa,MessageEvent:Bt};function wi(i,e,t){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,t):i.call(e,t)}});var br=k((sh,un)=>{"use strict";var{tokenChars:Ut}=Pt();function me(i,e,t){i[e]===void 0?i[e]=[t]:i[e].push(t)}function La(i){let e=Object.create(null),t=Object.create(null),r=!1,s=!1,n=!1,o,a,c=-1,u=-1,l=-1,h=0;for(;h<i.length;h++)if(u=i.charCodeAt(h),o===void 0)if(l===-1&&Ut[u]===1)c===-1&&(c=h);else if(h!==0&&(u===32||u===9))l===-1&&c!==-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h);let b=i.slice(c,l);u===44?(me(e,b,t),t=Object.create(null)):o=b,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===void 0)if(l===-1&&Ut[u]===1)c===-1&&(c=h);else if(u===32||u===9)l===-1&&c!==-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h),me(t,i.slice(c,l),!0),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),c=l=-1}else if(u===61&&c!==-1&&l===-1)a=i.slice(c,h),c=l=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(s){if(Ut[u]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1?c=h:r||(r=!0),s=!1}else if(n)if(Ut[u]===1)c===-1&&(c=h);else if(u===34&&c!==-1)n=!1,l=h;else if(u===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(u===34&&i.charCodeAt(h-1)===61)n=!0;else if(l===-1&&Ut[u]===1)c===-1&&(c=h);else if(c!==-1&&(u===32||u===9))l===-1&&(l=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1&&(l=h);let b=i.slice(c,l);r&&(b=b.replace(/\\/g,""),r=!1),me(t,a,b),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),a=void 0,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(c===-1||n||u===32||u===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=h);let d=i.slice(c,l);return o===void 0?me(e,d,t):(a===void 0?me(t,d,!0):r?me(t,a,d.replace(/\\/g,"")):me(t,a,d),me(e,o,t)),e}function Fa(i){return Object.keys(i).map(e=>{let t=i[e];return Array.isArray(t)||(t=[t]),t.map(r=>[e].concat(Object.keys(r).map(s=>{let n=r[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}un.exports={format:Fa,parse:La}});var Nr=k((oh,xn)=>{"use strict";var Ba=w("events"),Ua=w("https"),Da=w("http"),mn=w("net"),Ma=w("tls"),{randomBytes:qa,createHash:$a}=w("crypto"),{Readable:nh}=w("stream"),{URL:Cr}=w("url"),Ie=It(),Wa=yr(),Va=_r(),{BINARY_TYPES:dn,EMPTY_BUFFER:Ni,GUID:ja,kForOnEventAttribute:xr,kListener:Ha,kStatusCode:Ga,kWebSocket:Y,NOOP:gn}=Oe(),{EventTarget:{addEventListener:za,removeEventListener:Ka}}=hn(),{format:Ya,parse:Ja}=br(),{toBuffer:Xa}=kt(),Qa=30*1e3,yn=Symbol("kAborted"),Sr=[8,13],Ce=["CONNECTING","OPEN","CLOSING","CLOSED"],Za=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,P=class i extends Ba{constructor(e,t,r){super(),this._binaryType=dn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ni,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=i.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(r=t,t=[]):t=[t]),vn(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){dn.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){let s=new Wa({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new Va(e,this._extensions,r.generateMask),this._receiver=s,this._socket=e,s[Y]=this,e[Y]=this,s.on("conclude",ic),s.on("drain",rc),s.on("error",sc),s.on("message",nc),s.on("ping",oc),s.on("pong",ac),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",En),e.on("data",Ri),e.on("end",bn),e.on("error",Cn),this._readyState=i.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ie.extensionName]&&this._extensions[Ie.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Z(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===i.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=i.CLOSING,this._sender.close(e,t,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Qa)}}pause(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){wr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||Ni,t,r)}pong(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){wr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||Ni,t,r)}resume(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(r=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){wr(this,e,r);return}let s=C({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[Ie.extensionName]||(s.compress=!1),this._sender.send(e||Ni,s,r)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Z(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(P,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(P.prototype,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(P,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(P.prototype,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(P,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(P.prototype,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(P,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});Object.defineProperty(P.prototype,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(P.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(P.prototype,`on${i}`,{enumerable:!0,get(){for(let e of this.listeners(i))if(e[xr])return e[Ha];return null},set(e){for(let t of this.listeners(i))if(t[xr]){this.removeListener(i,t);break}typeof e=="function"&&this.addEventListener(i,e,{[xr]:!0})}})});P.prototype.addEventListener=za;P.prototype.removeEventListener=Ka;xn.exports=P;function vn(i,e,t,r){let s=T(C({protocolVersion:Sr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},r),{createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0});if(!Sr.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${Sr.join(", ")})`);let n;if(e instanceof Cr)n=e,i._url=e.href;else{try{n=new Cr(e)}catch(p){throw new SyntaxError(`Invalid URL: ${e}`)}i._url=e}let o=n.protocol==="wss:",a=n.protocol==="ws+unix:",c;if(n.protocol!=="ws:"&&!o&&!a?c=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:a&&!n.pathname?c="The URL's pathname is empty":n.hash&&(c="The URL contains a fragment identifier"),c){let p=new SyntaxError(c);if(i._redirects===0)throw p;Ai(i,p);return}let u=o?443:80,l=qa(16).toString("base64"),h=o?Ua.request:Da.request,d=new Set,b;if(s.createConnection=o?tc:ec,s.defaultPort=s.defaultPort||u,s.port=n.port||u,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers=T(C({},s.headers),{"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"}),s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(b=new Ie(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Ya({[Ie.extensionName]:b.offer()})),t.length){for(let p of t){if(typeof p!="string"||!Za.test(p)||d.has(p))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(p)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),a){let p=s.path.split(":");s.socketPath=p[0],s.path=p[1]}let S;if(s.followRedirects){if(i._redirects===0){i._originalIpc=a,i._originalSecure=o,i._originalHostOrSocketPath=a?s.socketPath:n.host;let p=r&&r.headers;if(r=T(C({},r),{headers:{}}),p)for(let[v,N]of Object.entries(p))r.headers[v.toLowerCase()]=N}else if(i.listenerCount("redirect")===0){let p=a?i._originalIpc?s.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:n.host===i._originalHostOrSocketPath;(!p||i._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,p||delete s.headers.host,s.auth=void 0)}s.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),S=i._req=h(s),i._redirects&&i.emit("redirect",i.url,S)}else S=i._req=h(s);s.timeout&&S.on("timeout",()=>{Z(i,S,"Opening handshake has timed out")}),S.on("error",p=>{S===null||S[yn]||(S=i._req=null,Ai(i,p))}),S.on("response",p=>{let v=p.headers.location,N=p.statusCode;if(v&&s.followRedirects&&N>=300&&N<400){if(++i._redirects>s.maxRedirects){Z(i,S,"Maximum redirects exceeded");return}S.abort();let A;try{A=new Cr(v,e)}catch(m){let g=new SyntaxError(`Invalid URL: ${v}`);Ai(i,g);return}vn(i,A,t,r)}else i.emit("unexpected-response",S,p)||Z(i,S,`Unexpected server response: ${p.statusCode}`)}),S.on("upgrade",(p,v,N)=>{if(i.emit("upgrade",p),i.readyState!==P.CONNECTING)return;if(S=i._req=null,p.headers.upgrade.toLowerCase()!=="websocket"){Z(i,v,"Invalid Upgrade header");return}let A=$a("sha1").update(l+ja).digest("base64");if(p.headers["sec-websocket-accept"]!==A){Z(i,v,"Invalid Sec-WebSocket-Accept header");return}let m=p.headers["sec-websocket-protocol"],g;if(m!==void 0?d.size?d.has(m)||(g="Server sent an invalid subprotocol"):g="Server sent a subprotocol but none was requested":d.size&&(g="Server sent no subprotocol"),g){Z(i,v,g);return}m&&(i._protocol=m);let V=p.headers["sec-websocket-extensions"];if(V!==void 0){if(!b){Z(i,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let R;try{R=Ja(V)}catch(z){Z(i,v,"Invalid Sec-WebSocket-Extensions header");return}let j=Object.keys(R);if(j.length!==1||j[0]!==Ie.extensionName){Z(i,v,"Server indicated an extension that was not requested");return}try{b.accept(R[Ie.extensionName])}catch(z){Z(i,v,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[Ie.extensionName]=b}i.setSocket(v,N,{generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),S.end()}function Ai(i,e){i._readyState=P.CLOSING,i.emit("error",e),i.emitClose()}function ec(i){return i.path=i.socketPath,mn.connect(i)}function tc(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=mn.isIP(i.host)?"":i.host),Ma.connect(i)}function Z(i,e,t){i._readyState=P.CLOSING;let r=new Error(t);Error.captureStackTrace(r,Z),e.setHeader?(e[yn]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ai,i,r)):(e.destroy(r),e.once("error",i.emit.bind(i,"error")),e.once("close",i.emitClose.bind(i)))}function wr(i,e,t){if(e){let r=Xa(e).length;i._socket?i._sender._bufferedBytes+=r:i._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${i.readyState} (${Ce[i.readyState]})`);t(r)}}function ic(i,e){let t=this[Y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=i,t._socket[Y]!==void 0&&(t._socket.removeListener("data",Ri),process.nextTick(_n,t._socket),i===1005?t.close():t.close(i,e))}function rc(){let i=this[Y];i.isPaused||i._socket.resume()}function sc(i){let e=this[Y];e._socket[Y]!==void 0&&(e._socket.removeListener("data",Ri),process.nextTick(_n,e._socket),e.close(i[Ga])),e.emit("error",i)}function pn(){this[Y].emitClose()}function nc(i,e){this[Y].emit("message",i,e)}function oc(i){let e=this[Y];e.pong(i,!e._isServer,gn),e.emit("ping",i)}function ac(i){this[Y].emit("pong",i)}function _n(i){i.resume()}function En(){let i=this[Y];this.removeListener("close",En),this.removeListener("data",Ri),this.removeListener("end",bn),i._readyState=P.CLOSING;let e;!this._readableState.endEmitted&&!i._closeFrameReceived&&!i._receiver._writableState.errorEmitted&&(e=i._socket.read())!==null&&i._receiver.write(e),i._receiver.end(),this[Y]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",pn),i._receiver.on("finish",pn))}function Ri(i){this[Y]._receiver.write(i)||this.pause()}function bn(){let i=this[Y];i._readyState=P.CLOSING,i._receiver.end(),this.end()}function Cn(){let i=this[Y];this.removeListener("error",Cn),this.on("error",gn),i&&(i._readyState=P.CLOSING,this.destroy())}});var wn=k((ch,Sn)=>{"use strict";var{tokenChars:cc}=Pt();function lc(i){let e=new Set,t=-1,r=-1,s=0;for(s;s<i.length;s++){let o=i.charCodeAt(s);if(r===-1&&cc[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);r===-1&&(r=s);let a=i.slice(t,r);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=i.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Sn.exports={parse:lc}});var In=k((uh,Tn)=>{"use strict";var fc=w("events"),ki=w("http"),lh=w("https"),fh=w("net"),hh=w("tls"),{createHash:hc}=w("crypto"),Nn=br(),$e=It(),uc=wn(),dc=Nr(),{GUID:pc,kWebSocket:mc}=Oe(),gc=/^[+/0-9A-Za-z]{22}==$/,An=0,Rn=1,On=2,Ar=class extends fc{constructor(e,t){if(super(),e=C({maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:dc},e),e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=ki.createServer((r,s)=>{let n=ki.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=yc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=An}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===On){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Dt,this);return}if(e&&this.once("close",e),this._state!==Rn)if(this._state=Rn,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Dt,this):process.nextTick(Dt,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Dt(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",kn);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){We(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){We(this,e,t,400,"Invalid Upgrade header");return}if(!n||!gc.test(n)){We(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){We(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){Mt(t,400);return}let a=e.headers["sec-websocket-protocol"],c=new Set;if(a!==void 0)try{c=uc.parse(a)}catch(h){We(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],l={};if(this.options.perMessageDeflate&&u!==void 0){let h=new $e(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let d=Nn.parse(u);d[$e.extensionName]&&(h.accept(d[$e.extensionName]),l[$e.extensionName]=h)}catch(d){We(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(d,b,S,p)=>{if(!d)return Mt(t,b||401,S,p);this.completeUpgrade(l,n,c,e,t,r,s)});return}if(!this.options.verifyClient(h))return Mt(t,401)}this.completeUpgrade(l,n,c,e,t,r,s)}completeUpgrade(e,t,r,s,n,o,a){if(!n.readable||!n.writable)return n.destroy();if(n[mc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>An)return Mt(n,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${hc("sha1").update(t+pc).digest("base64")}`],l=new this.options.WebSocket(null);if(r.size){let h=this.options.handleProtocols?this.options.handleProtocols(r,s):r.values().next().value;h&&(u.push(`Sec-WebSocket-Protocol: ${h}`),l._protocol=h)}if(e[$e.extensionName]){let h=e[$e.extensionName].params,d=Nn.format({[$e.extensionName]:[h]});u.push(`Sec-WebSocket-Extensions: ${d}`),l._extensions=e}this.emit("headers",u,s),n.write(u.concat(`\r
|
|
7
7
|
`).join(`\r
|
|
8
|
-
`)),n.removeListener("error",
|
|
8
|
+
`)),n.removeListener("error",kn),l.setSocket(n,o,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(l),l.on("close",()=>{this.clients.delete(l),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Dt,this)})),a(l,s)}};Tn.exports=Ar;function yc(i,e){for(let t of Object.keys(e))i.on(t,e[t]);return function(){for(let r of Object.keys(e))i.removeListener(r,e[r])}}function Dt(i){i._state=On,i.emit("close")}function kn(){this.destroy()}function Mt(i,e,t,r){t=t||ki.STATUS_CODES[e],r=C({Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t)},r),i.once("finish",i.destroy),i.end(`HTTP/1.1 ${e} ${ki.STATUS_CODES[e]}\r
|
|
9
9
|
`+Object.keys(r).map(s=>`${s}: ${r[s]}`).join(`\r
|
|
10
10
|
`)+`\r
|
|
11
11
|
\r
|
|
12
|
-
`+t)}function
|
|
12
|
+
`+t)}function We(i,e,t,r,s){if(i.listenerCount("wsClientError")){let n=new Error(s);Error.captureStackTrace(n,We),i.emit("wsClientError",n,t,e)}else Mt(t,r,s)}});var kr=k((Kh,qn)=>{"use strict";function Ac(i){t.debug=t,t.default=t,t.coerce=c,t.disable=n,t.enable=s,t.enabled=o,t.humanize=Qi(),t.destroy=u,Object.keys(i).forEach(l=>{t[l]=i[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(l){let h,d=null,b,S;function p(...v){if(!p.enabled)return;let N=p,A=Number(new Date),m=A-(h||A);N.diff=m,N.prev=h,N.curr=A,h=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let g=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(R,j)=>{if(R==="%%")return"%";g++;let z=t.formatters[j];if(typeof z=="function"){let pe=v[g];R=z.call(N,pe),v.splice(g,1),g--}return R}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return p.namespace=l,p.useColors=t.useColors(),p.color=t.selectColor(l),p.extend=r,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(b!==t.namespaces&&(b=t.namespaces,S=t.enabled(l)),S),set:v=>{d=v}}),typeof t.init=="function"&&t.init(p),p}function r(l,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+l);return d.log=this.log,d}function s(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let h,d=(typeof l=="string"?l:"").split(/[\s,]+/),b=d.length;for(h=0;h<b;h++)d[h]&&(l=d[h].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function n(){let l=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(l))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}qn.exports=Ac});var $n=k((ee,Pi)=>{"use strict";ee.formatArgs=kc;ee.save=Oc;ee.load=Tc;ee.useColors=Rc;ee.storage=Ic();ee.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();ee.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Rc(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function kc(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+Pi.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}ee.log=console.debug||console.log||(()=>{});function Oc(i){try{i?ee.storage.setItem("debug",i):ee.storage.removeItem("debug")}catch(e){}}function Tc(){let i;try{i=ee.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Ic(){try{return localStorage}catch(i){}}Pi.exports=kr()(ee);var{formatters:Pc}=Pi.exports;Pc.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var jn=k((Yh,Vn)=>{"use strict";var Lc=w("os"),Wn=w("tty"),ae=er(),{env:$}=process,Pe;ae("no-color")||ae("no-colors")||ae("color=false")||ae("color=never")?Pe=0:(ae("color")||ae("colors")||ae("color=true")||ae("color=always"))&&(Pe=1);"FORCE_COLOR"in $&&($.FORCE_COLOR==="true"?Pe=1:$.FORCE_COLOR==="false"?Pe=0:Pe=$.FORCE_COLOR.length===0?1:Math.min(parseInt($.FORCE_COLOR,10),3));function Or(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Tr(i,e){if(Pe===0)return 0;if(ae("color=16m")||ae("color=full")||ae("color=truecolor"))return 3;if(ae("color=256"))return 2;if(i&&!e&&Pe===void 0)return 0;let t=Pe||0;if($.TERM==="dumb")return t;if(process.platform==="win32"){let r=Lc.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in $)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in $)||$.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in $)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($.TEAMCITY_VERSION)?1:0;if($.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in $){let r=parseInt(($.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test($.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test($.TERM)||"COLORTERM"in $?1:t}function Fc(i){let e=Tr(i,i&&i.isTTY);return Or(e)}Vn.exports={supportsColor:Fc,stdout:Or(Tr(!0,Wn.isatty(1))),stderr:Or(Tr(!0,Wn.isatty(2)))}});var Gn=k((W,Fi)=>{"use strict";var Bc=w("tty"),Li=w("util");W.init=Vc;W.log=qc;W.formatArgs=Dc;W.save=$c;W.load=Wc;W.useColors=Uc;W.destroy=Li.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");W.colors=[6,2,3,4,5,1];try{let i=jn();i&&(i.stderr||i).level>=2&&(W.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}W.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function Uc(){return"colors"in W.inspectOpts?!!W.inspectOpts.colors:Bc.isatty(process.stderr.fd)}function Dc(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
13
13
|
`).join(`
|
|
14
|
-
`+n),i.push(s+"m+"+
|
|
15
|
-
`)}function
|
|
16
|
-
`).map(e=>e.trim()).join(" ")};Vn.O=function(i){return this.inspectOpts.colors=this.useColors,Pi.inspect(i,this.inspectOpts)}});var qt=k((Kh,Tr)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Tr.exports=Mn():Tr.exports=jn()});function Gr(i){return{all:i=i||new Map,on:function(e,t){var r=i.get(e);r?r.push(t):i.set(e,[t])},off:function(e,t){var r=i.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):i.set(e,[]))},emit:function(e,t){var r=i.get(e);r&&r.slice().map(function(s){s(t)}),(r=i.get("*"))&&r.slice().map(function(s){s(e,t)})}}}var Le,Zt=class{constructor(){_(this,Le);E(this,Le,Gr())}on(e,t){return f(this,Le).on(e,t),()=>{this.off(e,t)}}off(e,t){f(this,Le).off(e,t)}emit(e,t){f(this,Le).emit(e,t)}};Le=new WeakMap;var F=class extends Error{constructor(e,t){super(e),this.originalError=t}};var Se,Ke,we=class{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){_(this,Se,[]);_(this,Ke);this._emitter=t,this._inboxService=e,this._emitter.on("session.initialize.resolved",({error:r,data:s})=>{s?(this.onSessionSuccess(s),f(this,Se).forEach(a=>g(this,[a],function*({fn:n,resolve:o}){o(yield n())})),E(this,Se,[])):r&&(this.onSessionError(r),E(this,Ke,r),f(this,Se).forEach(({resolve:n})=>{n({error:new F("Failed to initialize session, please contact the support",r)})}),E(this,Se,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return g(this,null,function*(){return this._inboxService.isSessionInitialized?e():f(this,Ke)?Promise.resolve({error:new F("Failed to initialize session, please contact the support",f(this,Ke))}):new Promise((t,r)=>{f(this,Se).push({fn:e,resolve:t,reject:r})})})}};Se=new WeakMap,Ke=new WeakMap;var J,se,H=class{constructor(e,t,r){_(this,J);_(this,se);E(this,J,t),E(this,se,r),this.id=e.id,this.subject=e.subject,this.body=e.body,this.to=e.to,this.isRead=e.isRead,this.isArchived=e.isArchived,this.createdAt=e.createdAt,this.readAt=e.readAt,this.archivedAt=e.archivedAt,this.avatar=e.avatar,this.primaryAction=e.primaryAction,this.secondaryAction=e.secondaryAction,this.channelType=e.channelType,this.tags=e.tags,this.redirect=e.redirect,this.data=e.data}read(){return ei({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}unread(){return ti({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}archive(){return ii({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}unarchive(){return ri({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Ye({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Ye({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Je({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Je({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"secondary"})}on(e,t){let r=f(this,J).on(e,t);return()=>{r()}}off(e,t){f(this,J).off(e,t)}};J=new WeakMap,se=new WeakMap;var ei=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Xe(t,{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.read.pending",{args:t,data:n});let o=yield e.read(s),a=new H(o,i,e);return i.emit("notification.read.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.read.resolved",{args:t,error:o}),{error:new F("Failed to read notification",o)}}}),ti=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Xe(t,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.unread.pending",{args:t,data:n});let o=yield e.unread(s),a=new H(o,i,e);return i.emit("notification.unread.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unread.resolved",{args:t,error:o}),{error:new F("Failed to unread notification",o)}}}),ii=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Xe(t,{isArchived:!0,archivedAt:new Date().toISOString(),isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.archive.pending",{args:t,data:n});let o=yield e.archive(s),a=new H(o,i,e);return i.emit("notification.archive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.archive.resolved",{args:t,error:o}),{error:new F("Failed to archive notification",o)}}}),ri=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Xe(t,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.unarchive.pending",{args:t,data:n});let o=yield e.unarchive(s),a=new H(o,i,e);return i.emit("notification.unarchive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unarchive.resolved",{args:t,error:o}),{error:new F("Failed to unarchive notification",o)}}}),Ye=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:I(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:I(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:o,optimisticValue:a}=Xe(t,n,{emitter:i,apiService:e});try{i.emit("notification.complete_action.pending",{args:t,data:a});let c=yield e.completeAction({actionType:r,notificationId:o}),u=new H(c,i,e);return i.emit("notification.complete_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.complete_action.resolved",{args:t,error:c}),{error:new F(`Failed to complete ${r} action on the notification`,c)}}}),Je=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:I(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:I(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:o,optimisticValue:a}=Xe(t,n,{emitter:i,apiService:e});try{i.emit("notification.revert_action.pending",{args:t,data:a});let c=yield e.revertAction({actionType:r,notificationId:o}),u=new H(c,i,e);return i.emit("notification.revert_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.revert_action.resolved",{args:t,error:c}),{error:new F("Failed to fetch notifications",c)}}}),Xe=(i,e,t)=>"notification"in i?{notificationId:i.notification.id,optimisticValue:new H(b(b({},i.notification),e),t.emitter,t.apiService)}:{notificationId:i.notificationId},zr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new H(I(b({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0}),i,e));return i.emit("notifications.read_all.pending",{args:{tags:r},data:o}),yield e.readAll({tags:r}),i.emit("notifications.read_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.read_all.resolved",{args:{tags:r},error:n}),{error:new F("Failed to read all notifications",n)}}}),Kr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new H(I(b({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all.pending",{args:{tags:r},data:o}),yield e.archiveAll({tags:r}),i.emit("notifications.archive_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all.resolved",{args:{tags:r},error:n}),{error:new F("Failed to archive all notifications",n)}}}),Yr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r,read:!0}).map(a=>new H(I(b({},a),{isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all_read.pending",{args:{tags:r},data:o}),yield e.archiveAllRead({tags:r}),i.emit("notifications.archive_all_read.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all_read.resolved",{args:{tags:r},error:n}),{error:new F("Failed to archive all read notifications",n)}}});var Jr=(i,e)=>i===e?!0:!i||!e||i.length!==e.length?!1:i.every((t,r)=>t===e[r]);var Sl=["seen","unseen"],wl=["read","unread"],ji=(i,e)=>Jr(i,e)||!i&&(e==null?void 0:e.length)===0||(i==null?void 0:i.length)===0&&!e,Hi=(i,e)=>ji(i.tags,e.tags)&&i.read===e.read&&i.archived===e.archived;var ce,Qe=class{constructor(){_(this,ce);E(this,ce,new Map)}get(e){return f(this,ce).get(e)}getValues(){return Array.from(f(this,ce).values())}entries(){return Array.from(f(this,ce).entries())}keys(){return Array.from(f(this,ce).keys())}set(e,t){f(this,ce).set(e,t)}remove(e){f(this,ce).delete(e)}clear(){f(this,ce).clear()}};ce=new WeakMap;var Xr=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>Object.entries({tags:i,read:e,archived:t,limit:r,offset:s,after:n}).filter(([o,a])=>a!=null&&!(Array.isArray(a)&&a.length===0)).reduce((o,[a,c])=>(o[a]=c,o),{}),Gi=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>JSON.stringify(Xr({tags:i,read:e,archived:t,limit:r,offset:s,after:n})),Eo=({tags:i,read:e,archived:t})=>JSON.stringify(Xr({tags:i,read:e,archived:t})),Ze=i=>JSON.parse(i),bo=["notification.read.pending","notification.read.resolved","notification.unread.pending","notification.unread.resolved","notification.complete_action.pending","notification.complete_action.resolved","notification.revert_action.pending","notification.revert_action.resolved","notifications.read_all.pending","notifications.read_all.resolved"],Co=["notification.archive.pending","notification.unarchive.pending","notifications.archive_all.pending","notifications.archive_all_read.pending"],Ne,D,_t=class{constructor({emitter:e}){_(this,Ne);_(this,D);this.updateNotification=(e,t)=>{let r=f(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n[s]=t,f(this,D).set(e,I(b({},r),{notifications:n})),!0};this.removeNotification=(e,t)=>{let r=f(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n.splice(s,1),f(this,D).set(e,I(b({},r),{notifications:n})),!0};this.handleNotificationEvent=({remove:e}={remove:!1})=>({data:t})=>{if(!t)return;let r=Array.isArray(t)?t:[t],s=new Set;f(this,D).keys().forEach(n=>{r.forEach(o=>{let a=!1;e?a=this.removeNotification(n,o):a=this.updateNotification(n,o),a&&s.add(Eo(Ze(n)))})}),s.forEach(n=>{let o=this.getAggregated(Ze(n));f(this,Ne).emit("notifications.list.updated",{data:o})})};E(this,Ne,e),bo.forEach(t=>{f(this,Ne).on(t,this.handleNotificationEvent())}),Co.forEach(t=>{f(this,Ne).on(t,this.handleNotificationEvent({remove:!0}))}),E(this,D,new Qe)}getAggregated(e){return f(this,D).keys().filter(r=>{let s=Ze(r);return Hi(s,e)}).map(r=>f(this,D).get(r)).reduce((r,s)=>s?{hasMore:s.hasMore,filter:s.filter,notifications:[...r.notifications,...s.notifications]}:r,{hasMore:!1,filter:{},notifications:[]})}has(e){return f(this,D).get(Gi(e))!==void 0}set(e,t){f(this,D).set(Gi(e),t)}update(e,t){this.set(e,t);let r=this.getAggregated(Ze(Gi(e)));f(this,Ne).emit("notifications.list.updated",{data:r})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,read:e.read,archived:e.archived})}getUniqueNotifications({tags:e,read:t}){let r=f(this,D).keys(),s=new Map;return r.forEach(n=>{let o=Ze(n);if(ji(e,o.tags)){let a=f(this,D).get(n);if(!a)return;a.notifications.filter(c=>typeof t=="undefined"||t===c.isRead).forEach(c=>s.set(c.id,c))}}),Array.from(s.values())}clear(e){f(this,D).keys().forEach(r=>{Hi(Ze(r),e)&&f(this,D).remove(r)})}clearAll(){f(this,D).clear()}};Ne=new WeakMap,D=new WeakMap;var et,si=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,et);this.cache=new _t({emitter:s}),E(this,et,t)}list(){return g(this,arguments,function*(s={}){var n=s,{limit:t=10}=n,r=Hr(n,["limit"]);return this.callWithSession(()=>g(this,null,function*(){let o=b({limit:t},r);try{let a=f(this,et)?this.cache.getAll(o):void 0;if(this._emitter.emit("notifications.list.pending",{args:o,data:a}),!a){let c=yield this._inboxService.fetchNotifications(b({limit:t},r));a={hasMore:c.hasMore,filter:c.filter,notifications:c.data.map(u=>new H(u,this._emitter,this._inboxService))},f(this,et)&&(this.cache.set(o,a),a=this.cache.getAll(o))}return this._emitter.emit("notifications.list.resolved",{args:o,data:a}),{data:a}}catch(a){return this._emitter.emit("notifications.list.resolved",{args:o,error:a}),{error:new F("Failed to fetch notifications",a)}}}))})}count(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){let r=t&&"filters"in t?t.filters:[b({},t)];try{this._emitter.emit("notifications.count.pending",{args:t});let s=yield this._inboxService.count({filters:r}),n=t&&"filters"in t?{counts:s.data}:s.data[0];return this._emitter.emit("notifications.count.resolved",{args:t,data:n}),{data:n}}catch(s){return this._emitter.emit("notifications.count.resolved",{args:t,error:s}),{error:new F("Failed to count notifications",s)}}}))})}read(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ei({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unread(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ti({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}archive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ii({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unarchive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ri({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}completePrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Ye({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}completeSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Ye({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}revertPrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Je({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}revertSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Je({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}readAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return zr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Kr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAllRead(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Yr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}clearCache({filter:t}={}){return t?this.cache.clear(t!=null?t:{}):this.cache.clearAll()}};et=new WeakMap;var Fe,Et,Ae,ni=class{constructor(e,t,r){_(this,Fe);_(this,Et);_(this,Ae);E(this,Fe,r),E(this,Et,t),E(this,Ae,e)}initialize(){return g(this,null,function*(){try{let{applicationIdentifier:e,subscriberId:t,subscriberHash:r}=f(this,Ae);f(this,Fe).emit("session.initialize.pending",{args:f(this,Ae)});let s=yield f(this,Et).initializeSession({applicationIdentifier:e,subscriberId:t,subscriberHash:r});f(this,Fe).emit("session.initialize.resolved",{args:f(this,Ae),data:s})}catch(e){f(this,Fe).emit("session.initialize.resolved",{args:f(this,Ae),error:e})}})}};Fe=new WeakMap,Et=new WeakMap,Ae=new WeakMap;var bt,Ct,Be=class{constructor(e,{emitterInstance:t,inboxServiceInstance:r}){_(this,bt);_(this,Ct);E(this,bt,t),E(this,Ct,r),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow}update({channelPreferences:e}){var t;return oi({emitter:f(this,bt),apiService:f(this,Ct),args:{workflowId:(t=this.workflow)==null?void 0:t.id,channelPreferences:e,preference:{level:this.level,enabled:this.enabled,channels:this.channels,workflow:this.workflow}}})}};bt=new WeakMap,Ct=new WeakMap;var oi=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{workflowId:s,channelPreferences:n}=t;try{i.emit("preference.update.pending",{args:t,data:t.preference?new Be(I(b({},t.preference),{channels:b(b({},t.preference.channels),n)}),{emitterInstance:i,inboxServiceInstance:e}):void 0});let o;s?o=yield e.updateWorkflowPreferences({workflowId:s,channelPreferences:n}):o=yield e.updateGlobalPreferences(n);let a=new Be(o,{emitterInstance:i,inboxServiceInstance:e});return i.emit("preference.update.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("preference.update.resolved",{args:t,error:o}),{error:new F("Failed to fetch notifications",o)}}});var xo=["preference.update.pending","preference.update.resolved"],So=({tags:i})=>Object.entries({tags:i}).reduce((e,[t,r])=>(r==null||Array.isArray(r)&&r.length===0||(e[t]=r),e),{}),zi=({tags:i})=>JSON.stringify(So({tags:i})),tt,ne,ai=class{constructor({emitterInstance:e}){_(this,tt);_(this,ne);this.updatePreference=(e,t)=>{let r=f(this,ne).get(e);if(!r)return!1;let s=r.findIndex(o=>{var a,c;return((a=o.workflow)==null?void 0:a.id)===((c=t.workflow)==null?void 0:c.id)||o.level===t.level&&t.level==="global"});if(s===-1)return!1;let n=[...r];return n[s]=t,f(this,ne).set(e,n),!0};this.handlePreferenceEvent=({data:e})=>{e&&f(this,ne).keys().forEach(t=>{let r=this.updatePreference(t,e),s=f(this,ne).get(t);!r||!s||f(this,tt).emit("preferences.list.updated",{data:s})})};E(this,tt,e),xo.forEach(t=>{f(this,tt).on(t,this.handlePreferenceEvent)}),E(this,ne,new Qe)}has(e){return f(this,ne).get(zi(e))!==void 0}set(e,t){f(this,ne).set(zi(e),t)}getAll(e){if(this.has(e))return f(this,ne).get(zi(e))}clearAll(){f(this,ne).clear()}};tt=new WeakMap,ne=new WeakMap;var it,ci=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,it);this.cache=new ai({emitterInstance:this._emitter}),E(this,it,t)}list(){return g(this,arguments,function*(t={}){return this.callWithSession(()=>g(this,null,function*(){try{let r=f(this,it)?this.cache.getAll(t):void 0;return this._emitter.emit("preferences.list.pending",{args:t,data:r}),r||(r=(yield this._inboxService.fetchPreferences(t.tags)).map(n=>new Be(n,{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService})),f(this,it)&&(this.cache.set(t,r),r=this.cache.getAll(t))),this._emitter.emit("preferences.list.resolved",{args:t,data:r}),{data:r}}catch(r){throw this._emitter.emit("preferences.list.resolved",{args:t,error:r}),r}}))})}update(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return oi({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}};it=new WeakMap;var le=Object.create(null);le.open="0";le.close="1";le.ping="2";le.pong="3";le.message="4";le.upgrade="5";le.noop="6";var xt=Object.create(null);Object.keys(le).forEach(i=>{xt[le[i]]=i});var St={type:"error",data:"parser error"};var wt=({type:i,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+Qr(e,!0).toString("base64")):r(le[i]+(e||"")),Qr=(i,e)=>Buffer.isBuffer(i)||i instanceof Uint8Array&&!e?i:i instanceof ArrayBuffer?Buffer.from(i):Buffer.from(i.buffer,i.byteOffset,i.byteLength),Ki;function Zr(i,e){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return e(Qr(i.data,!1));wt(i,!0,t=>{Ki||(Ki=new TextEncoder),e(Ki.encode(t))})}var Nt=(i,e)=>{if(typeof i!="string")return{type:"message",data:es(i,e)};let t=i.charAt(0);if(t==="b"){let r=Buffer.from(i.substring(1),"base64");return{type:"message",data:es(r,e)}}return xt[t]?i.length>1?{type:xt[t],data:i.substring(1)}:{type:xt[t]}:St},es=(i,e)=>{switch(e){case"arraybuffer":return i instanceof ArrayBuffer?i:Buffer.isBuffer(i)?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer;case"nodebuffer":default:return Buffer.isBuffer(i)?i:Buffer.from(i)}};var ts="",is=(i,e)=>{let t=i.length,r=new Array(t),s=0;i.forEach((n,o)=>{wt(n,!1,a=>{r[o]=a,++s===t&&e(r.join(ts))})})},rs=(i,e)=>{let t=i.split(ts),r=[];for(let s=0;s<t.length;s++){let n=Nt(t[s],e);if(r.push(n),n.type==="error")break}return r};function ss(){return new TransformStream({transform(i,e){Zr(i,t=>{let r=t.length,s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,r)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}var Yi;function li(i){return i.reduce((e,t)=>e+t.length,0)}function fi(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let s=0;s<e;s++)t[s]=i[0][r++],r===i[0].length&&(i.shift(),r=0);return i.length&&r<i[0].length&&(i[0]=i[0].slice(r)),t}function ns(i,e){Yi||(Yi=new TextDecoder);let t=[],r=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(r===0){if(li(t)<1)break;let c=fi(t,1);n=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(li(t)<2)break;let c=fi(t,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(li(t)<8)break;let c=fi(t,8),u=new DataView(c.buffer,c.byteOffset,c.length),l=u.getUint32(0);if(l>Math.pow(2,21)-1){a.enqueue(St);break}s=l*Math.pow(2,32)+u.getUint32(4),r=3}else{if(li(t)<s)break;let c=fi(t,s);a.enqueue(Nt(n?c:Yi.decode(c),e)),r=0}if(s===0||s>i){a.enqueue(St);break}}}})}var Ji=4;function O(i){if(i)return wo(i)}function wo(i){for(var e in O.prototype)i[e]=O.prototype[e];return i}O.prototype.on=O.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};O.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};O.prototype.off=O.prototype.removeListener=O.prototype.removeAllListeners=O.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+i],this};O.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this};O.prototype.emitReserved=O.prototype.emit;O.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};O.prototype.hasListeners=function(i){return!!this.listeners(i).length};var fe=global;function hi(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}var No=fe.setTimeout,Ao=fe.clearTimeout;function ve(i,e){e.useNativeTimers?(i.setTimeoutFn=No.bind(fe),i.clearTimeoutFn=Ao.bind(fe)):(i.setTimeoutFn=fe.setTimeout.bind(fe),i.clearTimeoutFn=fe.clearTimeout.bind(fe))}var Ro=1.33;function os(i){return typeof i=="string"?ko(i):Math.ceil((i.byteLength||i.size)*Ro)}function ko(i){let e=0,t=0;for(let r=0,s=i.length;r<s;r++)e=i.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}var vs=K(De(),1);function gs(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function ys(i){let e={},t=i.split("&");for(let r=0,s=t.length;r<s;r++){let n=t[r].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var ea=(0,vs.default)("engine.io-client:transport"),ir=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},_e=class extends O{constructor(e){super(),this.writable=!1,ve(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new ir(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):ea("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=Nt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=gs(e);return t.length?"?"+t:""}};var Rs=K(De(),1);var Cs="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),rr=64,ta={},_s=0,yi=0,Es;function bs(i){let e="";do e=Cs[i%rr]+e,i=Math.floor(i/rr);while(i>0);return e}function vi(){let i=bs(+new Date);return i!==Es?(_s=0,Es=i):i+"."+bs(_s++)}for(;yi<rr;yi++)ta[Cs[yi]]=yi;var or=K(ws(),1),ar=or.default||or;function Ns(){return new nr}function ra(i){let e=i.split("; "),t=e[0].indexOf("=");if(t===-1)return;let r=e[0].substring(0,t).trim();if(!r.length)return;let s=e[0].substring(t+1).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));let n={name:r,value:s};for(let o=1;o<e.length;o++){let a=e[o].split("=");if(a.length!==2)continue;let c=a[0].trim(),u=a[1].trim();switch(c){case"Expires":n.expires=new Date(u);break;case"Max-Age":let l=new Date;l.setUTCSeconds(l.getUTCSeconds()+parseInt(u,10)),n.expires=l;break;default:}}return n}var nr=class{constructor(){this.cookies=new Map}parseCookies(e){let t=e.getResponseHeader("set-cookie");t&&t.forEach(r=>{let s=ra(r);s&&this.cookies.set(s.name,s)})}addCookies(e){let t=[];this.cookies.forEach((r,s)=>{var n;((n=r.expires)===null||n===void 0?void 0:n.getTime())<Date.now()?this.cookies.delete(s):t.push(`${s}=${r.value}`)}),t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}};var X=(0,Rs.default)("engine.io-client:polling");function sa(){}var na=function(){return new ar({xdomain:!1}).responseType!=null}(),_i=class extends _e{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){let r=location.protocol==="https:",s=location.port;s||(s=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||s!==e.port}let t=e&&e.forceBase64;this.supportsBinary=na&&!t,this.opts.withCredentials&&(this.cookieJar=Ns())}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{X("paused"),this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(X("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){X("pre-pause polling complete"),--r||t()})),this.writable||(X("we are currently writing - waiting to pause"),r++,this.once("drain",function(){X("pre-pause writing complete"),--r||t()}))}else t()}poll(){X("polling"),this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){X("polling got data %s",e);let t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};rs(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this.poll():X('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{X("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(X("transport open - closing"),e()):(X("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,is(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=vi()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Re(this.uri(),e)}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){X("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},Re=class i extends O{constructor(e,t){super(),ve(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;let t=hi(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let r=this.xhr=new ar(t);try{X("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.opts.extraHeaders[s])}}catch(s){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{r.setRequestHeader("Accept","*/*")}catch(s){}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},X("xhr data %s",this.data),r.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document!="undefined"&&(this.index=i.requestsCount++,i.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.xhr.onreadystatechange=sa,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete i.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Re.requestsCount=0;Re.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",As);else if(typeof addEventListener=="function"){let i="onpagehide"in fe?"pagehide":"unload";addEventListener(i,As,!1)}}function As(){for(let i in Re.requests)Re.requests.hasOwnProperty(i)&&Re.requests[i].abort()}var mc=K(Is(),1),gc=K(gr(),1),yc=K(vr(),1),Tn=K(wr(),1),vc=K(On(),1);var In=Tn.default;var Dt=In,ki=!1,Pn="nodebuffer",We=process.nextTick;var Fn=K(De(),1);var _c=(0,Fn.default)("engine.io-client:websocket"),Ln=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Oi=class extends _e{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,r=Ln?{}:hi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=ki&&!Ln?t?new Dt(e,t):new Dt(e):new Dt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;wt(r,this.supportsBinary,n=>{let o={};ki||(r.options&&(o.compress=r.options.compress),this.opts.perMessageDeflate&&(typeof n=="string"?Buffer.byteLength(n):n.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{ki?this.ws.send(n):this.ws.send(n,o)}catch(a){_c("websocket closed before onclose event")}s&&We(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=vi()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Dt}};var Bn=K(De(),1),Mt=(0,Bn.default)("engine.io-client:webtransport"),Ti=class extends _e{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{Mt("transport closed gracefully"),this.onClose()}).catch(e=>{Mt("transport closed due to %s",e),this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t=ns(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=ss();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();let n=()=>{r.read().then(({done:a,value:c})=>{if(a){Mt("session is closed");return}Mt("received chunk: %o",c),this.onPacket(c),n()}).catch(a=>{Mt("an error occurred while reading: %s",a)})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;this.writer.write(r).then(()=>{s&&We(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}};var Ar={websocket:Oi,webtransport:Ti,polling:_i};var Ec=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,bc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ft(i){let e=i,t=i.indexOf("["),r=i.indexOf("]");t!=-1&&r!=-1&&(i=i.substring(0,t)+i.substring(t,r).replace(/:/g,";")+i.substring(r,i.length));let s=Ec.exec(i||""),n={},o=14;for(;o--;)n[bc[o]]=s[o]||"";return t!=-1&&r!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Cc(n,n.path),n.queryKey=xc(n,n.query),n}function Cc(i,e){let t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function xc(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,n){s&&(t[s]=n)}),t}var Un=K(De(),1);var T=(0,Un.default)("engine.io-client:socket"),Ve=class i extends O{constructor(e,t={}){super(),this.binaryType=Pn,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=ft(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ft(t.host).host),ve(this,t),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ys(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){T('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=Ji,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return T("options: %j",r),new Ar[e](r)}open(){let e;if(this.opts.rememberUpgrade&&i.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(t){T("error while creating transport: %s",t),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){T("setting transport %s",e.name),this.transport&&(T("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){T('probing transport "%s"',e);let t=this.createTransport(e),r=!1;i.priorWebsocketSuccess=!1;let s=()=>{r||(T('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(T('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;i.priorWebsocketSuccess=t.name==="websocket",T('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(T("changing transport and sending upgrade packet"),l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{T('probe transport "%s" failed',e);let d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function n(){r||(r=!0,l(),t.close(),t=null)}let o=h=>{let d=new Error("probe error: "+h);d.transport=t.name,n(),T('probe transport "%s" failed because of error: %s',e,h),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function c(){o("socket closed")}function u(h){t&&h.name!==t.name&&(T('"%s" works - aborting "%s"',h.name,t.name),n())}let l=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(T("socket open"),this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){T("starting upgrade probes");let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(T('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else T('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();T("flushing %d packets in socket",e.length),this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){let s=this.writeBuffer[r].data;if(s&&(t+=os(s)),r>0&&t>this.maxPayload)return T("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return T("payload size is %d (max: %d)",t,this.maxPayload),this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this.onClose("forced close"),T("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){T("socket error %j",e),i.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(T('socket close with reason: "%s"',e),this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],r=0,s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}};Ve.protocol=Ji;var Mh=Ve.protocol;var Gn=K(qt(),1),Hn=(0,Gn.default)("socket.io-client:url");function zn(i,e="",t){let r=i;t=t||typeof location!="undefined"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(Hn("protocol-less url %s",i),typeof t!="undefined"?i=t.protocol+"//"+i:i="https://"+i),Hn("parse %s",i),r=ft(i)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let n=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port+e,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r}var Dr={};vo(Dr,{Decoder:()=>Br,Encoder:()=>Fr,PacketType:()=>C,protocol:()=>Zn});var $c=typeof ArrayBuffer=="function",Wc=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Kn=Object.prototype.toString,Vc=typeof Blob=="function"||typeof Blob!="undefined"&&Kn.call(Blob)==="[object BlobConstructor]",jc=typeof File=="function"||typeof File!="undefined"&&Kn.call(File)==="[object FileConstructor]";function Wt(i){return $c&&(i instanceof ArrayBuffer||Wc(i))||Vc&&i instanceof Blob||jc&&i instanceof File}function $t(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,r=i.length;t<r;t++)if($t(i[t]))return!0;return!1}if(Wt(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return $t(i.toJSON(),!0);for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&$t(i[t]))return!0;return!1}function Yn(i){let e=[],t=i.data,r=i;return r.data=Ir(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Ir(i,e){if(!i)return i;if(Wt(i)){let t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){let t=new Array(i.length);for(let r=0;r<i.length;r++)t[r]=Ir(i[r],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){let t={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=Ir(i[r],e));return t}return i}function Jn(i,e){return i.data=Pr(i.data,e),delete i.attachments,i}function Pr(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Pr(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Pr(i[t],e));return i}var Qn=K(De(),1),Lr=(0,Qn.default)("socket.io-parser"),Hc=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Zn=5,C;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(C||(C={}));var Fr=class{constructor(e){this.replacer=e}encode(e){return Lr("encoding packet %j",e),(e.type===C.EVENT||e.type===C.ACK)&&$t(e)?this.encodeAsBinary({type:e.type===C.EVENT?C.BINARY_EVENT:C.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===C.BINARY_EVENT||e.type===C.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),Lr("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=Yn(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}};function Xn(i){return Object.prototype.toString.call(i)==="[object Object]"}var Br=class i extends O{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let r=t.type===C.BINARY_EVENT;r||t.type===C.BINARY_ACK?(t.type=r?C.EVENT:C.ACK,this.reconstructor=new Ur(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Wt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(C[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===C.BINARY_EVENT||r.type===C.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(n,t)}else r.nsp="/";let s=e.charAt(t+1);if(s!==""&&Number(s)==s){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,n))r.data=n;else throw new Error("invalid payload")}return Lr("decoded %s as %j",e,r),r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case C.CONNECT:return Xn(t);case C.DISCONNECT:return t===void 0;case C.CONNECT_ERROR:return typeof t=="string"||Xn(t);case C.EVENT:case C.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Hc.indexOf(t[0])===-1);case C.ACK:case C.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Ur=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Jn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function te(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var eo=K(qt(),1),U=(0,eo.default)("socket.io-client:socket"),Gc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ht=class extends O{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[te(e,"open",this.onopen.bind(this)),te(e,"packet",this.onpacket.bind(this)),te(e,"error",this.onerror.bind(this)),te(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Gc.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let r={type:C.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++;U("emitting packet with ack id %d",o);let a=t.pop();this._registerAckCallback(o,a),r.id=o}let s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)?U("discard packet as the transport is not currently writable"):this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,t){var r;let s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(U("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));U("event with ack id %d has timed out after %d ms",e,s),t.call(this,new Error("operation has timed out"))},s);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,[null,...o])}}emitWithAck(e,...t){let r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,n)=>{t.push((o,a)=>r?o?n(o):s(a):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...n)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(U("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(s)):(U("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(U("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){U("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,U("sending packet [%d] (try n\xB0%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){U("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:C.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){U("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case C.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case C.EVENT:case C.BINARY_EVENT:this.onevent(e);break;case C.ACK:case C.BINARY_ACK:this.onack(e);break;case C.DISCONNECT:this.ondisconnect();break;case C.CONNECT_ERROR:this.destroy();let r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){let t=e.data||[];U("emitting event %j",t),e.id!=null&&(U("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...s){r||(r=!0,U("sending ack %j",s),t.packet({type:C.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];typeof t=="function"?(U("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):U("bad ack %s",e.id)}onconnect(e,t){U("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){U("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(U("performing disconnect (%s)",this.nsp),this.packet({type:C.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let r of t)r.apply(this,e.data)}}};function je(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}je.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=Math.floor(e*10)&1?i+t:i-t}return Math.min(i,this.max)|0};je.prototype.reset=function(){this.attempts=0};je.prototype.setMin=function(i){this.ms=i};je.prototype.setMax=function(i){this.max=i};je.prototype.setJitter=function(i){this.jitter=i};var to=K(qt(),1),G=(0,to.default)("socket.io-client:manager"),ut=class extends O{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,ve(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new je({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let s=t.parser||Dr;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(G("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;G("opening %s",this.uri),this.engine=new Ve(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let s=te(t,"open",function(){r.onopen(),e&&e()}),n=a=>{G("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=te(t,"error",n);if(this._timeout!==!1){let a=this._timeout;G("connect attempt will timeout after %d",a);let c=this.setTimeoutFn(()=>{G("connect attempt timed out after %d",a),s(),n(new Error("timeout")),t.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){G("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(te(e,"ping",this.onping.bind(this)),te(e,"data",this.ondata.bind(this)),te(e,"error",this.onerror.bind(this)),te(e,"close",this.onclose.bind(this)),te(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){We(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){G("error",e),this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ht(this,e,t),this.nsps[e]=r),r}_destroy(e){let t=Object.keys(this.nsps);for(let r of t)if(this.nsps[r].active){G("socket %s is still active, skipping close",r);return}this._close()}_packet(e){G("writing packet %j",e);let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){G("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){G("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){G("closed due to %s",e),this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)G("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();G("will wait %dms before reconnect attempt",t),this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(G("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(G("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):(G("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var ro=K(qt(),1),io=(0,ro.default)("socket.io-client"),Vt={};function jt(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=zn(i,e.path||"/socket.io"),r=t.source,s=t.id,n=t.path,o=Vt[s]&&n in Vt[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,c;return a?(io("ignoring socket cache for %s",r),c=new ut(r,e)):(Vt[s]||(io("new io instance for %s",r),Vt[s]=new ut(r,e)),c=Vt[s]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(jt,{Manager:ut,Socket:ht,io:jt,connect:jt});var zc="https://ws.novu.co",so="notifications.notification_received",no="notifications.unseen_count_changed",oo="notifications.unread_count_changed",Kc=({_id:i,content:e,read:t,archived:r,createdAt:s,lastReadDate:n,archivedAt:o,channel:a,subscriber:c,subject:u,avatar:l,cta:h,tags:d,data:x})=>{var m,y,V,R,j,z,pe,Kt,Yt,ie;let w={id:(m=c==null?void 0:c._id)!=null?m:"",firstName:c==null?void 0:c.firstName,lastName:c==null?void 0:c.lastName,avatar:c==null?void 0:c.avatar,subscriberId:(y=c==null?void 0:c.subscriberId)!=null?y:""},p=(R=(V=h.action)==null?void 0:V.buttons)==null?void 0:R.find(Ge=>Ge.type==="primary"),v=(z=(j=h.action)==null?void 0:j.buttons)==null?void 0:z.find(Ge=>Ge.type==="secondary"),N=(Kt=(pe=h.action)==null?void 0:pe.result)==null?void 0:Kt.type,A=(Yt=h.action)==null?void 0:Yt.status;return{id:i,subject:u,body:e,to:w,isRead:t,isArchived:r,createdAt:s,readAt:n,archivedAt:o,avatar:l,primaryAction:p&&{label:p.content,isCompleted:N==="primary"&&A==="done",redirect:p.url?{target:p.target,url:p.url}:void 0},secondaryAction:v&&{label:v.content,isCompleted:N==="secondary"&&A==="done",redirect:v.url?{target:v.target,url:v.url}:void 0},channelType:a,tags:d,redirect:(ie=h.data)!=null&&ie.url?{url:h.data.url,target:h.data.target}:void 0,data:x}},dt,ue,ge,pt,Bi,Ui,Di,Ht,Mr,Fi=class extends we{constructor({socketUrl:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,Ht);_(this,dt);_(this,ue);_(this,ge);_(this,pt);_(this,Bi,({message:t})=>{f(this,ue).emit(so,{result:new H(Kc(t),f(this,ue),this._inboxService)})});_(this,Ui,({unseenCount:t})=>{f(this,ue).emit(no,{result:t})});_(this,Di,({unreadCount:t})=>{f(this,ue).emit(oo,{result:t})});E(this,ue,s),E(this,pt,t!=null?t:zc)}onSessionSuccess({token:t}){E(this,dt,t)}isSocketEvent(t){return t===so||t===no||t===oo}initialize(){if(f(this,dt)){Vi(this,Ht,Mr).call(this).catch(t=>{console.error(t)});return}this.callWithSession(()=>g(this,null,function*(){return Vi(this,Ht,Mr).call(this).catch(t=>{console.error(t)}),{}}))}};dt=new WeakMap,ue=new WeakMap,ge=new WeakMap,pt=new WeakMap,Bi=new WeakMap,Ui=new WeakMap,Di=new WeakMap,Ht=new WeakSet,Mr=function(){return g(this,null,function*(){var r,s,n;if(f(this,ge))return;let t={socketUrl:f(this,pt)};f(this,ue).emit("socket.connect.pending",{args:t}),E(this,ge,jt(f(this,pt),{reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${f(this,dt)}`}})),f(this,ge).on("connect",()=>{f(this,ue).emit("socket.connect.resolved",{args:t})}),f(this,ge).on("connect_error",o=>{f(this,ue).emit("socket.connect.resolved",{args:t,error:o})}),(r=f(this,ge))==null||r.on("notification_received",f(this,Bi)),(s=f(this,ge))==null||s.on("unseen_count_changed",f(this,Ui)),(n=f(this,ge))==null||n.on("unread_count_changed",f(this,Di))})};var ao="https://api.novu.co";var He=function(i,e,t,r){function s(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function a(l){try{u(r.next(l))}catch(h){o(h)}}function c(l){try{u(r.throw(l))}catch(h){o(h)}}function u(l){l.done?n(l.value):s(l.value).then(a,c)}u((r=r.apply(i,e||[])).next())})},Yc="v1",Jc="https://api.novu.co",Xc="@novu/client",Qc="2.0.0-canary.0",Zc=`${Xc}-${Qc}`,mt=class{constructor({apiVersion:e=Yc,backendUrl:t=Jc,userAgent:r=Zc}={}){this.apiVersion=e,this.backendUrl=`${t}/${this.apiVersion}`,this.headers={"Content-Type":"application/json","User-Agent":r}}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}disposeAuthorizationToken(){delete this.headers.Authorization}updateHeaders(e){this.headers=Object.assign(Object.assign({},this.headers),e)}getFullResponse(e,t){return He(this,void 0,void 0,function*(){return yield(yield this.doFetch(e+this.getQueryString(t))).json()})}get(e,t){return He(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e+this.getQueryString(t))).json()).data})}post(e){return He(this,arguments,void 0,function*(t,r={}){let s=yield this.doFetch(t,{method:"POST",body:JSON.stringify(r)});return this.checkEmptyResponse(s)?void 0:(yield s.json()).data})}patch(e){return He(this,arguments,void 0,function*(t,r={}){let s=yield this.doFetch(t,{method:"PATCH",body:JSON.stringify(r)});return this.checkEmptyResponse(s)?void 0:(yield s.json()).data})}delete(e){return He(this,arguments,void 0,function*(t,r={}){let s=yield this.doFetch(t,{method:"DELETE",body:JSON.stringify(r)});return this.checkEmptyResponse(s)?void 0:(yield s.json()).data})}getQueryString(e){return e?`?${new URLSearchParams(e).toString()}`:""}doFetch(e){return He(this,arguments,void 0,function*(t,r={}){let s=yield fetch(this.backendUrl+t,Object.assign(Object.assign({},r),{headers:this.headers}));return yield this.checkResponseStatus(s),s})}checkResponseStatus(e){return He(this,void 0,void 0,function*(){if(!e.ok){let t=yield e.json();throw new Error(`HTTP error! Status: ${e.status}, Message: ${t.message}`)}})}checkEmptyResponse(e){return e.status===204}};var el="2024-06-26",Gt="/inbox",de=`${Gt}/notifications`,L,Mi=class{constructor(e={}){this.isSessionInitialized=!1;_(this,L);E(this,L,new mt(e)),f(this,L).updateHeaders({"Novu-API-Version":el,"Novu-User-Agent":e.userAgent||"@novu/js"})}initializeSession(s){return g(this,arguments,function*({applicationIdentifier:e,subscriberId:t,subscriberHash:r}){let n=yield f(this,L).post(`${Gt}/session`,{applicationIdentifier:e,subscriberId:t,subscriberHash:r});return f(this,L).setAuthorizationToken(n.token),this.isSessionInitialized=!0,n})}fetchNotifications({after:e,archived:t,limit:r=10,offset:s,read:n,tags:o}){let a=new URLSearchParams(`limit=${r}`);return e&&a.append("after",e),s&&a.append("offset",`${s}`),o&&o.forEach(c=>a.append("tags[]",c)),n!==void 0&&a.append("read",`${n}`),t!==void 0&&a.append("archived",`${t}`),f(this,L).getFullResponse(`${de}?${a.toString()}`)}count({filters:e}){return f(this,L).getFullResponse(`${de}/count?filters=${JSON.stringify(e)}`)}read(e){return f(this,L).patch(`${de}/${e}/read`)}unread(e){return f(this,L).patch(`${de}/${e}/unread`)}archive(e){return f(this,L).patch(`${de}/${e}/archive`)}unarchive(e){return f(this,L).patch(`${de}/${e}/unarchive`)}readAll({tags:e}){return f(this,L).post(`${de}/read`,{tags:e})}archiveAll({tags:e}){return f(this,L).post(`${de}/archive`,{tags:e})}archiveAllRead({tags:e}){return f(this,L).post(`${de}/read-archive`,{tags:e})}completeAction({actionType:e,notificationId:t}){return f(this,L).patch(`${de}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return f(this,L).patch(`${de}/${t}/revert`,{actionType:e})}fetchPreferences(e){let t=new URLSearchParams;e&&e.forEach(s=>t.append("tags[]",s));let r=t.size?`?${t.toString()}`:"";return f(this,L).get(`${Gt}/preferences${r}`)}updateGlobalPreferences(e){return f(this,L).patch(`${Gt}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channelPreferences:t}){return f(this,L).patch(`${Gt}/preferences/${e}`,t)}};L=new WeakMap;var tl="2.5.0",il="@novu/js",rl=`${il}@${tl}`,ye,zt,gt,Pe,qi=class{constructor(e){_(this,ye);_(this,zt);_(this,gt);_(this,Pe);var t,r,s,n;E(this,Pe,new Mi({backendUrl:(t=e.backendUrl)!=null?t:ao,userAgent:(r=e.__userAgent)!=null?r:rl})),E(this,ye,new Zt),E(this,zt,new ni({applicationIdentifier:e.applicationIdentifier,subscriberId:e.subscriberId,subscriberHash:e.subscriberHash},f(this,Pe),f(this,ye))),f(this,zt).initialize(),this.notifications=new si({useCache:(s=e.useCache)!=null?s:!0,inboxServiceInstance:f(this,Pe),eventEmitterInstance:f(this,ye)}),this.preferences=new ci({useCache:(n=e.useCache)!=null?n:!0,inboxServiceInstance:f(this,Pe),eventEmitterInstance:f(this,ye)}),E(this,gt,new Fi({socketUrl:e.socketUrl,eventEmitterInstance:f(this,ye),inboxServiceInstance:f(this,Pe)})),this.on=(o,a)=>{f(this,gt).isSocketEvent(o)&&f(this,gt).initialize();let c=f(this,ye).on(o,a);return()=>{c()}},this.off=(o,a)=>{f(this,ye).off(o,a)}}};ye=new WeakMap,zt=new WeakMap,gt=new WeakMap,Pe=new WeakMap;window.Novu=qi;})();
|
|
14
|
+
`+n),i.push(s+"m+"+Fi.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Mc()+e+" "+i[0]}function Mc(){return W.inspectOpts.hideDate?"":new Date().toISOString()+" "}function qc(...i){return process.stderr.write(Li.formatWithOptions(W.inspectOpts,...i)+`
|
|
15
|
+
`)}function $c(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Wc(){return process.env.DEBUG}function Vc(i){i.inspectOpts={};let e=Object.keys(W.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=W.inspectOpts[e[t]]}Fi.exports=kr()(W);var{formatters:Hn}=Fi.exports;Hn.o=function(i){return this.inspectOpts.colors=this.useColors,Li.inspect(i,this.inspectOpts).split(`
|
|
16
|
+
`).map(e=>e.trim()).join(" ")};Hn.O=function(i){return this.inspectOpts.colors=this.useColors,Li.inspect(i,this.inspectOpts)}});var Wt=k((Jh,Ir)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ir.exports=$n():Ir.exports=Gn()});function zr(i){return{all:i=i||new Map,on:function(e,t){var r=i.get(e);r?r.push(t):i.set(e,[t])},off:function(e,t){var r=i.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):i.set(e,[]))},emit:function(e,t){var r=i.get(e);r&&r.slice().map(function(s){s(t)}),(r=i.get("*"))&&r.slice().map(function(s){s(e,t)})}}}var Fe,ti=class{constructor(){_(this,Fe);E(this,Fe,zr())}on(e,t){return f(this,Fe).on(e,t),()=>{this.off(e,t)}}off(e,t){f(this,Fe).off(e,t)}emit(e,t){f(this,Fe).emit(e,t)}};Fe=new WeakMap;var F=class extends Error{constructor(e,t){super(e),this.originalError=t}};var Se,Ye,we=class{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){_(this,Se,[]);_(this,Ye);this._emitter=t,this._inboxService=e,this._emitter.on("session.initialize.resolved",({error:r,data:s})=>{s?(this.onSessionSuccess(s),f(this,Se).forEach(a=>y(this,[a],function*({fn:n,resolve:o}){o(yield n())})),E(this,Se,[])):r&&(this.onSessionError(r),E(this,Ye,r),f(this,Se).forEach(({resolve:n})=>{n({error:new F("Failed to initialize session, please contact the support",r)})}),E(this,Se,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return y(this,null,function*(){return this._inboxService.isSessionInitialized?e():f(this,Ye)?Promise.resolve({error:new F("Failed to initialize session, please contact the support",f(this,Ye))}):new Promise((t,r)=>{f(this,Se).push({fn:e,resolve:t,reject:r})})})}};Se=new WeakMap,Ye=new WeakMap;var J,se,H=class{constructor(e,t,r){_(this,J);_(this,se);E(this,J,t),E(this,se,r),this.id=e.id,this.subject=e.subject,this.body=e.body,this.to=e.to,this.isRead=e.isRead,this.isArchived=e.isArchived,this.createdAt=e.createdAt,this.readAt=e.readAt,this.archivedAt=e.archivedAt,this.avatar=e.avatar,this.primaryAction=e.primaryAction,this.secondaryAction=e.secondaryAction,this.channelType=e.channelType,this.tags=e.tags,this.redirect=e.redirect,this.data=e.data}read(){return ii({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}unread(){return ri({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}archive(){return si({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}unarchive(){return ni({emitter:f(this,J),apiService:f(this,se),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Je({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Je({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Xe({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Xe({emitter:f(this,J),apiService:f(this,se),args:{notification:this},actionType:"secondary"})}on(e,t){let r=f(this,J).on(e,t);return()=>{r()}}off(e,t){f(this,J).off(e,t)}};J=new WeakMap,se=new WeakMap;var ii=r=>y(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Qe(t,{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.read.pending",{args:t,data:n});let o=yield e.read(s),a=new H(o,i,e);return i.emit("notification.read.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.read.resolved",{args:t,error:o}),{error:new F("Failed to read notification",o)}}}),ri=r=>y(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Qe(t,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.unread.pending",{args:t,data:n});let o=yield e.unread(s),a=new H(o,i,e);return i.emit("notification.unread.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unread.resolved",{args:t,error:o}),{error:new F("Failed to unread notification",o)}}}),si=r=>y(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Qe(t,{isArchived:!0,archivedAt:new Date().toISOString(),isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.archive.pending",{args:t,data:n});let o=yield e.archive(s),a=new H(o,i,e);return i.emit("notification.archive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.archive.resolved",{args:t,error:o}),{error:new F("Failed to archive notification",o)}}}),ni=r=>y(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Qe(t,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.unarchive.pending",{args:t,data:n});let o=yield e.unarchive(s),a=new H(o,i,e);return i.emit("notification.unarchive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unarchive.resolved",{args:t,error:o}),{error:new F("Failed to unarchive notification",o)}}}),Je=s=>y(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:T(C({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:T(C({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:o,optimisticValue:a}=Qe(t,n,{emitter:i,apiService:e});try{i.emit("notification.complete_action.pending",{args:t,data:a});let c=yield e.completeAction({actionType:r,notificationId:o}),u=new H(c,i,e);return i.emit("notification.complete_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.complete_action.resolved",{args:t,error:c}),{error:new F(`Failed to complete ${r} action on the notification`,c)}}}),Xe=s=>y(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:T(C({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:T(C({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:o,optimisticValue:a}=Qe(t,n,{emitter:i,apiService:e});try{i.emit("notification.revert_action.pending",{args:t,data:a});let c=yield e.revertAction({actionType:r,notificationId:o}),u=new H(c,i,e);return i.emit("notification.revert_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.revert_action.resolved",{args:t,error:c}),{error:new F("Failed to fetch notifications",c)}}}),Qe=(i,e,t)=>"notification"in i?{notificationId:i.notification.id,optimisticValue:new H(C(C({},i.notification),e),t.emitter,t.apiService)}:{notificationId:i.notificationId},Kr=s=>y(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new H(T(C({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0}),i,e));return i.emit("notifications.read_all.pending",{args:{tags:r},data:o}),yield e.readAll({tags:r}),i.emit("notifications.read_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.read_all.resolved",{args:{tags:r},error:n}),{error:new F("Failed to read all notifications",n)}}}),Yr=s=>y(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new H(T(C({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all.pending",{args:{tags:r},data:o}),yield e.archiveAll({tags:r}),i.emit("notifications.archive_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all.resolved",{args:{tags:r},error:n}),{error:new F("Failed to archive all notifications",n)}}}),Jr=s=>y(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r,read:!0}).map(a=>new H(T(C({},a),{isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all_read.pending",{args:{tags:r},data:o}),yield e.archiveAllRead({tags:r}),i.emit("notifications.archive_all_read.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all_read.resolved",{args:{tags:r},error:n}),{error:new F("Failed to archive all read notifications",n)}}});var Xr=(i,e)=>i===e?!0:!i||!e||i.length!==e.length?!1:i.every((t,r)=>t===e[r]);var Al=["seen","unseen"],Rl=["read","unread"],Hi=(i,e)=>Xr(i,e)||!i&&(e==null?void 0:e.length)===0||(i==null?void 0:i.length)===0&&!e,Gi=(i,e)=>Hi(i.tags,e.tags)&&i.read===e.read&&i.archived===e.archived;var ce,Ze=class{constructor(){_(this,ce);E(this,ce,new Map)}get(e){return f(this,ce).get(e)}getValues(){return Array.from(f(this,ce).values())}entries(){return Array.from(f(this,ce).entries())}keys(){return Array.from(f(this,ce).keys())}set(e,t){f(this,ce).set(e,t)}remove(e){f(this,ce).delete(e)}clear(){f(this,ce).clear()}};ce=new WeakMap;var Qr=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>Object.entries({tags:i,read:e,archived:t,limit:r,offset:s,after:n}).filter(([o,a])=>a!=null&&!(Array.isArray(a)&&a.length===0)).reduce((o,[a,c])=>(o[a]=c,o),{}),zi=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>JSON.stringify(Qr({tags:i,read:e,archived:t,limit:r,offset:s,after:n})),Co=({tags:i,read:e,archived:t})=>JSON.stringify(Qr({tags:i,read:e,archived:t})),et=i=>JSON.parse(i),xo=["notification.read.pending","notification.read.resolved","notification.unread.pending","notification.unread.resolved","notification.complete_action.pending","notification.complete_action.resolved","notification.revert_action.pending","notification.revert_action.resolved","notifications.read_all.pending","notifications.read_all.resolved"],So=["notification.archive.pending","notification.unarchive.pending","notifications.archive_all.pending","notifications.archive_all_read.pending"],Ne,D,vt=class{constructor({emitter:e}){_(this,Ne);_(this,D);this.updateNotification=(e,t)=>{let r=f(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n[s]=t,f(this,D).set(e,T(C({},r),{notifications:n})),!0};this.removeNotification=(e,t)=>{let r=f(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n.splice(s,1),f(this,D).set(e,T(C({},r),{notifications:n})),!0};this.handleNotificationEvent=({remove:e}={remove:!1})=>({data:t})=>{if(!t)return;let r=Array.isArray(t)?t:[t],s=new Set;f(this,D).keys().forEach(n=>{r.forEach(o=>{let a=!1;e?a=this.removeNotification(n,o):a=this.updateNotification(n,o),a&&s.add(Co(et(n)))})}),s.forEach(n=>{let o=this.getAggregated(et(n));f(this,Ne).emit("notifications.list.updated",{data:o})})};E(this,Ne,e),xo.forEach(t=>{f(this,Ne).on(t,this.handleNotificationEvent())}),So.forEach(t=>{f(this,Ne).on(t,this.handleNotificationEvent({remove:!0}))}),E(this,D,new Ze)}getAggregated(e){return f(this,D).keys().filter(r=>{let s=et(r);return Gi(s,e)}).map(r=>f(this,D).get(r)).reduce((r,s)=>s?{hasMore:s.hasMore,filter:s.filter,notifications:[...r.notifications,...s.notifications]}:r,{hasMore:!1,filter:{},notifications:[]})}has(e){return f(this,D).get(zi(e))!==void 0}set(e,t){f(this,D).set(zi(e),t)}update(e,t){this.set(e,t);let r=this.getAggregated(et(zi(e)));f(this,Ne).emit("notifications.list.updated",{data:r})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,read:e.read,archived:e.archived})}getUniqueNotifications({tags:e,read:t}){let r=f(this,D).keys(),s=new Map;return r.forEach(n=>{let o=et(n);if(Hi(e,o.tags)){let a=f(this,D).get(n);if(!a)return;a.notifications.filter(c=>typeof t=="undefined"||t===c.isRead).forEach(c=>s.set(c.id,c))}}),Array.from(s.values())}clear(e){f(this,D).keys().forEach(r=>{Gi(et(r),e)&&f(this,D).remove(r)})}clearAll(){f(this,D).clear()}};Ne=new WeakMap,D=new WeakMap;var _t,oi=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,_t);this.cache=new vt({emitter:s}),E(this,_t,t)}list(){return y(this,arguments,function*(s={}){var n=s,{limit:t=10}=n,r=Gr(n,["limit"]);return this.callWithSession(()=>y(this,null,function*(){let o=C({limit:t},r);try{let a="useCache"in o?o.useCache:f(this,_t),c=a?this.cache.getAll(o):void 0;if(this._emitter.emit("notifications.list.pending",{args:o,data:c}),!c){let u=yield this._inboxService.fetchNotifications(C({limit:t},r));c={hasMore:u.hasMore,filter:u.filter,notifications:u.data.map(l=>new H(l,this._emitter,this._inboxService))},a&&(this.cache.set(o,c),c=this.cache.getAll(o))}return this._emitter.emit("notifications.list.resolved",{args:o,data:c}),{data:c}}catch(a){return this._emitter.emit("notifications.list.resolved",{args:o,error:a}),{error:new F("Failed to fetch notifications",a)}}}))})}count(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){let r=t&&"filters"in t?t.filters:[C({},t)];try{this._emitter.emit("notifications.count.pending",{args:t});let s=yield this._inboxService.count({filters:r}),n=t&&"filters"in t?{counts:s.data}:s.data[0];return this._emitter.emit("notifications.count.resolved",{args:t,data:n}),{data:n}}catch(s){return this._emitter.emit("notifications.count.resolved",{args:t,error:s}),{error:new F("Failed to count notifications",s)}}}))})}read(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){return ii({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unread(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){return ri({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}archive(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){return si({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unarchive(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){return ni({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}completePrimary(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){return Je({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}completeSecondary(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){return Je({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}revertPrimary(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){return Xe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}revertSecondary(t){return y(this,null,function*(){return this.callWithSession(()=>y(this,null,function*(){return Xe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}readAll(){return y(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>y(this,null,function*(){return Kr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAll(){return y(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>y(this,null,function*(){return Yr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAllRead(){return y(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>y(this,null,function*(){return Jr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}clearCache({filter:t}={}){return t?this.cache.clear(t!=null?t:{}):this.cache.clearAll()}};_t=new WeakMap;var Be,Et,Ae,ai=class{constructor(e,t,r){_(this,Be);_(this,Et);_(this,Ae);E(this,Be,r),E(this,Et,t),E(this,Ae,e)}initialize(){return y(this,null,function*(){try{let{applicationIdentifier:e,subscriberId:t,subscriberHash:r}=f(this,Ae);f(this,Be).emit("session.initialize.pending",{args:f(this,Ae)});let s=yield f(this,Et).initializeSession({applicationIdentifier:e,subscriberId:t,subscriberHash:r});f(this,Be).emit("session.initialize.resolved",{args:f(this,Ae),data:s})}catch(e){f(this,Be).emit("session.initialize.resolved",{args:f(this,Ae),error:e})}})}};Be=new WeakMap,Et=new WeakMap,Ae=new WeakMap;var Zr=n=>y(void 0,[n],function*({emitter:i,apiService:e,cache:t,useCache:r,args:s}){let{workflowId:o,channelPreferences:a}=s;try{i.emit("preference.update.pending",{args:s,data:s.preference?new Re(T(C({},s.preference),{channels:C(C({},s.preference.channels),a)}),{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0});let c;o?c=yield e.updateWorkflowPreferences({workflowId:o,channelPreferences:a}):(wo({emitter:i,apiService:e,cache:t,useCache:r,args:s}),c=yield e.updateGlobalPreferences(a));let u=new Re(c,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r});return i.emit("preference.update.resolved",{args:s,data:u}),{data:u}}catch(c){return i.emit("preference.update.resolved",{args:s,error:c}),{error:new F("Failed to fetch notifications",c)}}}),wo=({emitter:i,apiService:e,cache:t,useCache:r,args:s})=>{let n=r?t==null?void 0:t.getAll({}):void 0;n==null||n.forEach(o=>{var a;if(o.level==="template"){let c=T(C({},o),{channels:Object.entries(o.channels).reduce((l,[h,d])=>{var S;let b=h;return l[b]=(S=s.channelPreferences[b])!=null?S:d,l},{})}),u=s.preference?new Re(c,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0;u&&i.emit("preference.update.pending",{args:{workflowId:(a=o.workflow)==null?void 0:a.id,channelPreferences:u.channels},data:u})}})};var bt,Ct,xt,St,Re=class{constructor(e,{emitterInstance:t,inboxServiceInstance:r,cache:s,useCache:n}){_(this,bt);_(this,Ct);_(this,xt);_(this,St);E(this,bt,t),E(this,Ct,r),E(this,xt,s),E(this,St,n),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow}update({channelPreferences:e}){var t;return Zr({emitter:f(this,bt),apiService:f(this,Ct),cache:f(this,xt),useCache:f(this,St),args:{workflowId:(t=this.workflow)==null?void 0:t.id,channelPreferences:e,preference:{level:this.level,enabled:this.enabled,channels:this.channels,workflow:this.workflow}}})}};bt=new WeakMap,Ct=new WeakMap,xt=new WeakMap,St=new WeakMap;var No=["preference.update.pending","preference.update.resolved"],Ao=({tags:i})=>Object.entries({tags:i}).reduce((e,[t,r])=>(r==null||Array.isArray(r)&&r.length===0||(e[t]=r),e),{}),Ki=({tags:i})=>JSON.stringify(Ao({tags:i})),tt,ne,ci=class{constructor({emitterInstance:e}){_(this,tt);_(this,ne);this.updatePreference=(e,t)=>{let r=f(this,ne).get(e);if(!r)return!1;let s=r.findIndex(o=>{var a,c;return((a=o.workflow)==null?void 0:a.id)===((c=t.workflow)==null?void 0:c.id)||o.level===t.level&&t.level==="global"});if(s===-1)return!1;let n=[...r];return n[s]=t,f(this,ne).set(e,n),!0};this.handlePreferenceEvent=({data:e})=>{e&&f(this,ne).keys().forEach(t=>{let r=this.updatePreference(t,e),s=f(this,ne).get(t);!r||!s||f(this,tt).emit("preferences.list.updated",{data:s})})};E(this,tt,e),No.forEach(t=>{f(this,tt).on(t,this.handlePreferenceEvent)}),E(this,ne,new Ze)}has(e){return f(this,ne).get(Ki(e))!==void 0}set(e,t){f(this,ne).set(Ki(e),t)}getAll(e){if(this.has(e))return f(this,ne).get(Ki(e))}clearAll(){f(this,ne).clear()}};tt=new WeakMap,ne=new WeakMap;var Ue,li=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,Ue);this.cache=new ci({emitterInstance:this._emitter}),E(this,Ue,t)}list(){return y(this,arguments,function*(t={}){return this.callWithSession(()=>y(this,null,function*(){try{let r=f(this,Ue)?this.cache.getAll(t):void 0;return this._emitter.emit("preferences.list.pending",{args:t,data:r}),r||(r=(yield this._inboxService.fetchPreferences(t.tags)).map(n=>new Re(n,{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService,cache:this.cache,useCache:f(this,Ue)})),f(this,Ue)&&(this.cache.set(t,r),r=this.cache.getAll(t))),this._emitter.emit("preferences.list.resolved",{args:t,data:r}),{data:r}}catch(r){throw this._emitter.emit("preferences.list.resolved",{args:t,error:r}),r}}))})}};Ue=new WeakMap;var le=Object.create(null);le.open="0";le.close="1";le.ping="2";le.pong="3";le.message="4";le.upgrade="5";le.noop="6";var wt=Object.create(null);Object.keys(le).forEach(i=>{wt[le[i]]=i});var Nt={type:"error",data:"parser error"};var At=({type:i,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+es(e,!0).toString("base64")):r(le[i]+(e||"")),es=(i,e)=>Buffer.isBuffer(i)||i instanceof Uint8Array&&!e?i:i instanceof ArrayBuffer?Buffer.from(i):Buffer.from(i.buffer,i.byteOffset,i.byteLength),Yi;function ts(i,e){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return e(es(i.data,!1));At(i,!0,t=>{Yi||(Yi=new TextEncoder),e(Yi.encode(t))})}var Rt=(i,e)=>{if(typeof i!="string")return{type:"message",data:is(i,e)};let t=i.charAt(0);if(t==="b"){let r=Buffer.from(i.substring(1),"base64");return{type:"message",data:is(r,e)}}return wt[t]?i.length>1?{type:wt[t],data:i.substring(1)}:{type:wt[t]}:Nt},is=(i,e)=>{switch(e){case"arraybuffer":return i instanceof ArrayBuffer?i:Buffer.isBuffer(i)?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer;case"nodebuffer":default:return Buffer.isBuffer(i)?i:Buffer.from(i)}};var rs="",ss=(i,e)=>{let t=i.length,r=new Array(t),s=0;i.forEach((n,o)=>{At(n,!1,a=>{r[o]=a,++s===t&&e(r.join(rs))})})},ns=(i,e)=>{let t=i.split(rs),r=[];for(let s=0;s<t.length;s++){let n=Rt(t[s],e);if(r.push(n),n.type==="error")break}return r};function os(){return new TransformStream({transform(i,e){ts(i,t=>{let r=t.length,s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,r)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}var Ji;function fi(i){return i.reduce((e,t)=>e+t.length,0)}function hi(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let s=0;s<e;s++)t[s]=i[0][r++],r===i[0].length&&(i.shift(),r=0);return i.length&&r<i[0].length&&(i[0]=i[0].slice(r)),t}function as(i,e){Ji||(Ji=new TextDecoder);let t=[],r=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(r===0){if(fi(t)<1)break;let c=hi(t,1);n=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(fi(t)<2)break;let c=hi(t,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(fi(t)<8)break;let c=hi(t,8),u=new DataView(c.buffer,c.byteOffset,c.length),l=u.getUint32(0);if(l>Math.pow(2,21)-1){a.enqueue(Nt);break}s=l*Math.pow(2,32)+u.getUint32(4),r=3}else{if(fi(t)<s)break;let c=hi(t,s);a.enqueue(Rt(n?c:Ji.decode(c),e)),r=0}if(s===0||s>i){a.enqueue(Nt);break}}}})}var Xi=4;function O(i){if(i)return Ro(i)}function Ro(i){for(var e in O.prototype)i[e]=O.prototype[e];return i}O.prototype.on=O.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};O.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};O.prototype.off=O.prototype.removeListener=O.prototype.removeAllListeners=O.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+i],this};O.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this};O.prototype.emitReserved=O.prototype.emit;O.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};O.prototype.hasListeners=function(i){return!!this.listeners(i).length};var fe=global;function ui(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}var ko=fe.setTimeout,Oo=fe.clearTimeout;function ve(i,e){e.useNativeTimers?(i.setTimeoutFn=ko.bind(fe),i.clearTimeoutFn=Oo.bind(fe)):(i.setTimeoutFn=fe.setTimeout.bind(fe),i.clearTimeoutFn=fe.clearTimeout.bind(fe))}var To=1.33;function cs(i){return typeof i=="string"?Io(i):Math.ceil((i.byteLength||i.size)*To)}function Io(i){let e=0,t=0;for(let r=0,s=i.length;r<s;r++)e=i.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}var Es=K(Me(),1);function vs(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function _s(i){let e={},t=i.split("&");for(let r=0,s=t.length;r<s;r++){let n=t[r].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var ra=(0,Es.default)("engine.io-client:transport"),rr=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},_e=class extends O{constructor(e){super(),this.writable=!1,ve(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new rr(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):ra("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=Rt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=vs(e);return t.length?"?"+t:""}};var Os=K(Me(),1);var Ss="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),sr=64,sa={},bs=0,vi=0,Cs;function xs(i){let e="";do e=Ss[i%sr]+e,i=Math.floor(i/sr);while(i>0);return e}function _i(){let i=xs(+new Date);return i!==Cs?(bs=0,Cs=i):i+"."+xs(bs++)}for(;vi<sr;vi++)sa[Ss[vi]]=vi;var ar=K(As(),1),cr=ar.default||ar;function Rs(){return new or}function oa(i){let e=i.split("; "),t=e[0].indexOf("=");if(t===-1)return;let r=e[0].substring(0,t).trim();if(!r.length)return;let s=e[0].substring(t+1).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));let n={name:r,value:s};for(let o=1;o<e.length;o++){let a=e[o].split("=");if(a.length!==2)continue;let c=a[0].trim(),u=a[1].trim();switch(c){case"Expires":n.expires=new Date(u);break;case"Max-Age":let l=new Date;l.setUTCSeconds(l.getUTCSeconds()+parseInt(u,10)),n.expires=l;break;default:}}return n}var or=class{constructor(){this.cookies=new Map}parseCookies(e){let t=e.getResponseHeader("set-cookie");t&&t.forEach(r=>{let s=oa(r);s&&this.cookies.set(s.name,s)})}addCookies(e){let t=[];this.cookies.forEach((r,s)=>{var n;((n=r.expires)===null||n===void 0?void 0:n.getTime())<Date.now()?this.cookies.delete(s):t.push(`${s}=${r.value}`)}),t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}};var X=(0,Os.default)("engine.io-client:polling");function aa(){}var ca=function(){return new cr({xdomain:!1}).responseType!=null}(),Ei=class extends _e{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){let r=location.protocol==="https:",s=location.port;s||(s=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||s!==e.port}let t=e&&e.forceBase64;this.supportsBinary=ca&&!t,this.opts.withCredentials&&(this.cookieJar=Rs())}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{X("paused"),this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(X("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){X("pre-pause polling complete"),--r||t()})),this.writable||(X("we are currently writing - waiting to pause"),r++,this.once("drain",function(){X("pre-pause writing complete"),--r||t()}))}else t()}poll(){X("polling"),this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){X("polling got data %s",e);let t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};ns(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this.poll():X('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{X("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(X("transport open - closing"),e()):(X("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,ss(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=_i()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ke(this.uri(),e)}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){X("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},ke=class i extends O{constructor(e,t){super(),ve(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;let t=ui(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let r=this.xhr=new cr(t);try{X("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.opts.extraHeaders[s])}}catch(s){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{r.setRequestHeader("Accept","*/*")}catch(s){}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},X("xhr data %s",this.data),r.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document!="undefined"&&(this.index=i.requestsCount++,i.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.xhr.onreadystatechange=aa,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete i.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};ke.requestsCount=0;ke.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",ks);else if(typeof addEventListener=="function"){let i="onpagehide"in fe?"pagehide":"unload";addEventListener(i,ks,!1)}}function ks(){for(let i in ke.requests)ke.requests.hasOwnProperty(i)&&ke.requests[i].abort()}var vc=K(Ls(),1),_c=K(yr(),1),Ec=K(_r(),1),Pn=K(Nr(),1),bc=K(In(),1);var Ln=Pn.default;var qt=Ln,Oi=!1,Fn="nodebuffer",Ve=process.nextTick;var Un=K(Me(),1);var Cc=(0,Un.default)("engine.io-client:websocket"),Bn=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ti=class extends _e{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,r=Bn?{}:ui(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Oi&&!Bn?t?new qt(e,t):new qt(e):new qt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;At(r,this.supportsBinary,n=>{let o={};Oi||(r.options&&(o.compress=r.options.compress),this.opts.perMessageDeflate&&(typeof n=="string"?Buffer.byteLength(n):n.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{Oi?this.ws.send(n):this.ws.send(n,o)}catch(a){Cc("websocket closed before onclose event")}s&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=_i()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!qt}};var Dn=K(Me(),1),$t=(0,Dn.default)("engine.io-client:webtransport"),Ii=class extends _e{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{$t("transport closed gracefully"),this.onClose()}).catch(e=>{$t("transport closed due to %s",e),this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t=as(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=os();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();let n=()=>{r.read().then(({done:a,value:c})=>{if(a){$t("session is closed");return}$t("received chunk: %o",c),this.onPacket(c),n()}).catch(a=>{$t("an error occurred while reading: %s",a)})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;this.writer.write(r).then(()=>{s&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}};var Rr={websocket:Ti,webtransport:Ii,polling:Ei};var xc=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Sc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function lt(i){let e=i,t=i.indexOf("["),r=i.indexOf("]");t!=-1&&r!=-1&&(i=i.substring(0,t)+i.substring(t,r).replace(/:/g,";")+i.substring(r,i.length));let s=xc.exec(i||""),n={},o=14;for(;o--;)n[Sc[o]]=s[o]||"";return t!=-1&&r!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=wc(n,n.path),n.queryKey=Nc(n,n.query),n}function wc(i,e){let t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Nc(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,n){s&&(t[s]=n)}),t}var Mn=K(Me(),1);var I=(0,Mn.default)("engine.io-client:socket"),je=class i extends O{constructor(e,t={}){super(),this.binaryType=Fn,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=lt(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=lt(t.host).host),ve(this,t),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=_s(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){I('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=Xi,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return I("options: %j",r),new Rr[e](r)}open(){let e;if(this.opts.rememberUpgrade&&i.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(t){I("error while creating transport: %s",t),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){I("setting transport %s",e.name),this.transport&&(I("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){I('probing transport "%s"',e);let t=this.createTransport(e),r=!1;i.priorWebsocketSuccess=!1;let s=()=>{r||(I('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(I('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;i.priorWebsocketSuccess=t.name==="websocket",I('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(I("changing transport and sending upgrade packet"),l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{I('probe transport "%s" failed',e);let d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function n(){r||(r=!0,l(),t.close(),t=null)}let o=h=>{let d=new Error("probe error: "+h);d.transport=t.name,n(),I('probe transport "%s" failed because of error: %s',e,h),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function c(){o("socket closed")}function u(h){t&&h.name!==t.name&&(I('"%s" works - aborting "%s"',h.name,t.name),n())}let l=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(I("socket open"),this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){I("starting upgrade probes");let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(I('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else I('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();I("flushing %d packets in socket",e.length),this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){let s=this.writeBuffer[r].data;if(s&&(t+=cs(s)),r>0&&t>this.maxPayload)return I("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return I("payload size is %d (max: %d)",t,this.maxPayload),this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this.onClose("forced close"),I("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){I("socket error %j",e),i.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(I('socket close with reason: "%s"',e),this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],r=0,s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}};je.protocol=Xi;var $h=je.protocol;var Kn=K(Wt(),1),zn=(0,Kn.default)("socket.io-client:url");function Yn(i,e="",t){let r=i;t=t||typeof location!="undefined"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(zn("protocol-less url %s",i),typeof t!="undefined"?i=t.protocol+"//"+i:i="https://"+i),zn("parse %s",i),r=lt(i)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let n=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port+e,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r}var Mr={};Eo(Mr,{Decoder:()=>Ur,Encoder:()=>Br,PacketType:()=>x,protocol:()=>to});var jc=typeof ArrayBuffer=="function",Hc=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Jn=Object.prototype.toString,Gc=typeof Blob=="function"||typeof Blob!="undefined"&&Jn.call(Blob)==="[object BlobConstructor]",zc=typeof File=="function"||typeof File!="undefined"&&Jn.call(File)==="[object FileConstructor]";function jt(i){return jc&&(i instanceof ArrayBuffer||Hc(i))||Gc&&i instanceof Blob||zc&&i instanceof File}function Vt(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,r=i.length;t<r;t++)if(Vt(i[t]))return!0;return!1}if(jt(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Vt(i.toJSON(),!0);for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&Vt(i[t]))return!0;return!1}function Xn(i){let e=[],t=i.data,r=i;return r.data=Pr(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Pr(i,e){if(!i)return i;if(jt(i)){let t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){let t=new Array(i.length);for(let r=0;r<i.length;r++)t[r]=Pr(i[r],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){let t={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=Pr(i[r],e));return t}return i}function Qn(i,e){return i.data=Lr(i.data,e),delete i.attachments,i}function Lr(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Lr(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Lr(i[t],e));return i}var eo=K(Me(),1),Fr=(0,eo.default)("socket.io-parser"),Kc=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],to=5,x;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(x||(x={}));var Br=class{constructor(e){this.replacer=e}encode(e){return Fr("encoding packet %j",e),(e.type===x.EVENT||e.type===x.ACK)&&Vt(e)?this.encodeAsBinary({type:e.type===x.EVENT?x.BINARY_EVENT:x.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===x.BINARY_EVENT||e.type===x.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),Fr("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=Xn(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}};function Zn(i){return Object.prototype.toString.call(i)==="[object Object]"}var Ur=class i extends O{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let r=t.type===x.BINARY_EVENT;r||t.type===x.BINARY_ACK?(t.type=r?x.EVENT:x.ACK,this.reconstructor=new Dr(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(jt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(x[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===x.BINARY_EVENT||r.type===x.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(n,t)}else r.nsp="/";let s=e.charAt(t+1);if(s!==""&&Number(s)==s){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,n))r.data=n;else throw new Error("invalid payload")}return Fr("decoded %s as %j",e,r),r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case x.CONNECT:return Zn(t);case x.DISCONNECT:return t===void 0;case x.CONNECT_ERROR:return typeof t=="string"||Zn(t);case x.EVENT:case x.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Kc.indexOf(t[0])===-1);case x.ACK:case x.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Dr=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Qn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function te(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var io=K(Wt(),1),U=(0,io.default)("socket.io-client:socket"),Yc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ft=class extends O{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[te(e,"open",this.onopen.bind(this)),te(e,"packet",this.onpacket.bind(this)),te(e,"error",this.onerror.bind(this)),te(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Yc.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let r={type:x.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++;U("emitting packet with ack id %d",o);let a=t.pop();this._registerAckCallback(o,a),r.id=o}let s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)?U("discard packet as the transport is not currently writable"):this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,t){var r;let s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(U("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));U("event with ack id %d has timed out after %d ms",e,s),t.call(this,new Error("operation has timed out"))},s);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,[null,...o])}}emitWithAck(e,...t){let r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,n)=>{t.push((o,a)=>r?o?n(o):s(a):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...n)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(U("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(s)):(U("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(U("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){U("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,U("sending packet [%d] (try n\xB0%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){U("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:x.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){U("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case x.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case x.EVENT:case x.BINARY_EVENT:this.onevent(e);break;case x.ACK:case x.BINARY_ACK:this.onack(e);break;case x.DISCONNECT:this.ondisconnect();break;case x.CONNECT_ERROR:this.destroy();let r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){let t=e.data||[];U("emitting event %j",t),e.id!=null&&(U("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...s){r||(r=!0,U("sending ack %j",s),t.packet({type:x.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];typeof t=="function"?(U("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):U("bad ack %s",e.id)}onconnect(e,t){U("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){U("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(U("performing disconnect (%s)",this.nsp),this.packet({type:x.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let r of t)r.apply(this,e.data)}}};function He(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}He.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=Math.floor(e*10)&1?i+t:i-t}return Math.min(i,this.max)|0};He.prototype.reset=function(){this.attempts=0};He.prototype.setMin=function(i){this.ms=i};He.prototype.setMax=function(i){this.max=i};He.prototype.setJitter=function(i){this.jitter=i};var ro=K(Wt(),1),G=(0,ro.default)("socket.io-client:manager"),ht=class extends O{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,ve(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new He({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let s=t.parser||Mr;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(G("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;G("opening %s",this.uri),this.engine=new je(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let s=te(t,"open",function(){r.onopen(),e&&e()}),n=a=>{G("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=te(t,"error",n);if(this._timeout!==!1){let a=this._timeout;G("connect attempt will timeout after %d",a);let c=this.setTimeoutFn(()=>{G("connect attempt timed out after %d",a),s(),n(new Error("timeout")),t.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){G("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(te(e,"ping",this.onping.bind(this)),te(e,"data",this.ondata.bind(this)),te(e,"error",this.onerror.bind(this)),te(e,"close",this.onclose.bind(this)),te(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Ve(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){G("error",e),this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ft(this,e,t),this.nsps[e]=r),r}_destroy(e){let t=Object.keys(this.nsps);for(let r of t)if(this.nsps[r].active){G("socket %s is still active, skipping close",r);return}this._close()}_packet(e){G("writing packet %j",e);let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){G("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){G("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){G("closed due to %s",e),this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)G("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();G("will wait %dms before reconnect attempt",t),this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(G("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(G("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):(G("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var no=K(Wt(),1),so=(0,no.default)("socket.io-client"),Ht={};function Gt(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=Yn(i,e.path||"/socket.io"),r=t.source,s=t.id,n=t.path,o=Ht[s]&&n in Ht[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,c;return a?(so("ignoring socket cache for %s",r),c=new ht(r,e)):(Ht[s]||(so("new io instance for %s",r),Ht[s]=new ht(r,e)),c=Ht[s]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(Gt,{Manager:ht,Socket:ft,io:Gt,connect:Gt});var Jc="https://ws.novu.co",oo="notifications.notification_received",ao="notifications.unseen_count_changed",co="notifications.unread_count_changed",Xc=({_id:i,content:e,read:t,archived:r,createdAt:s,lastReadDate:n,archivedAt:o,channel:a,subscriber:c,subject:u,avatar:l,cta:h,tags:d,data:b})=>{var m,g,V,R,j,z,pe,Jt,Xt,ie;let S={id:(m=c==null?void 0:c._id)!=null?m:"",firstName:c==null?void 0:c.firstName,lastName:c==null?void 0:c.lastName,avatar:c==null?void 0:c.avatar,subscriberId:(g=c==null?void 0:c.subscriberId)!=null?g:""},p=(R=(V=h.action)==null?void 0:V.buttons)==null?void 0:R.find(ze=>ze.type==="primary"),v=(z=(j=h.action)==null?void 0:j.buttons)==null?void 0:z.find(ze=>ze.type==="secondary"),N=(Jt=(pe=h.action)==null?void 0:pe.result)==null?void 0:Jt.type,A=(Xt=h.action)==null?void 0:Xt.status;return{id:i,subject:u,body:e,to:S,isRead:t,isArchived:r,createdAt:s,readAt:n,archivedAt:o,avatar:l,primaryAction:p&&{label:p.content,isCompleted:N==="primary"&&A==="done",redirect:p.url?{target:p.target,url:p.url}:void 0},secondaryAction:v&&{label:v.content,isCompleted:N==="secondary"&&A==="done",redirect:v.url?{target:v.target,url:v.url}:void 0},channelType:a,tags:d,redirect:(ie=h.data)!=null&&ie.url?{url:h.data.url,target:h.data.target}:void 0,data:b}},ut,ue,ge,dt,Ui,Di,Mi,zt,qr,Bi=class extends we{constructor({socketUrl:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,zt);_(this,ut);_(this,ue);_(this,ge);_(this,dt);_(this,Ui,({message:t})=>{f(this,ue).emit(oo,{result:new H(Xc(t),f(this,ue),this._inboxService)})});_(this,Di,({unseenCount:t})=>{f(this,ue).emit(ao,{result:t})});_(this,Mi,({unreadCount:t})=>{f(this,ue).emit(co,{result:t})});E(this,ue,s),E(this,dt,t!=null?t:Jc)}onSessionSuccess({token:t}){E(this,ut,t)}isSocketEvent(t){return t===oo||t===ao||t===co}initialize(){if(f(this,ut)){ji(this,zt,qr).call(this).catch(t=>{console.error(t)});return}this.callWithSession(()=>y(this,null,function*(){return ji(this,zt,qr).call(this).catch(t=>{console.error(t)}),{}}))}};ut=new WeakMap,ue=new WeakMap,ge=new WeakMap,dt=new WeakMap,Ui=new WeakMap,Di=new WeakMap,Mi=new WeakMap,zt=new WeakSet,qr=function(){return y(this,null,function*(){var r,s,n;if(f(this,ge))return;let t={socketUrl:f(this,dt)};f(this,ue).emit("socket.connect.pending",{args:t}),E(this,ge,Gt(f(this,dt),{reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${f(this,ut)}`}})),f(this,ge).on("connect",()=>{f(this,ue).emit("socket.connect.resolved",{args:t})}),f(this,ge).on("connect_error",o=>{f(this,ue).emit("socket.connect.resolved",{args:t,error:o})}),(r=f(this,ge))==null||r.on("notification_received",f(this,Ui)),(s=f(this,ge))==null||s.on("unseen_count_changed",f(this,Di)),(n=f(this,ge))==null||n.on("unread_count_changed",f(this,Mi))})};var lo="https://api.novu.co";var Ge=function(i,e,t,r){function s(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function a(l){try{u(r.next(l))}catch(h){o(h)}}function c(l){try{u(r.throw(l))}catch(h){o(h)}}function u(l){l.done?n(l.value):s(l.value).then(a,c)}u((r=r.apply(i,e||[])).next())})},Qc="v1",Zc="https://api.novu.co",el="@novu/client",tl="2.0.0-canary.0",il=`${el}-${tl}`,pt=class{constructor({apiVersion:e=Qc,backendUrl:t=Zc,userAgent:r=il}={}){this.apiVersion=e,this.backendUrl=`${t}/${this.apiVersion}`,this.headers={"Content-Type":"application/json","User-Agent":r}}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}disposeAuthorizationToken(){delete this.headers.Authorization}updateHeaders(e){this.headers=Object.assign(Object.assign({},this.headers),e)}getFullResponse(e,t){return Ge(this,void 0,void 0,function*(){return yield(yield this.doFetch(e+this.getQueryString(t))).json()})}get(e,t){return Ge(this,void 0,void 0,function*(){return(yield(yield this.doFetch(e+this.getQueryString(t))).json()).data})}post(e){return Ge(this,arguments,void 0,function*(t,r={}){let s=yield this.doFetch(t,{method:"POST",body:JSON.stringify(r)});return this.checkEmptyResponse(s)?void 0:(yield s.json()).data})}patch(e){return Ge(this,arguments,void 0,function*(t,r={}){let s=yield this.doFetch(t,{method:"PATCH",body:JSON.stringify(r)});return this.checkEmptyResponse(s)?void 0:(yield s.json()).data})}delete(e){return Ge(this,arguments,void 0,function*(t,r={}){let s=yield this.doFetch(t,{method:"DELETE",body:JSON.stringify(r)});return this.checkEmptyResponse(s)?void 0:(yield s.json()).data})}getQueryString(e){return e?`?${new URLSearchParams(e).toString()}`:""}doFetch(e){return Ge(this,arguments,void 0,function*(t,r={}){let s=yield fetch(this.backendUrl+t,Object.assign(Object.assign({},r),{headers:this.headers}));return yield this.checkResponseStatus(s),s})}checkResponseStatus(e){return Ge(this,void 0,void 0,function*(){if(!e.ok){let t=yield e.json();throw new Error(`HTTP error! Status: ${e.status}, Message: ${t.message}`)}})}checkEmptyResponse(e){return e.status===204}};var rl="2024-06-26",Kt="/inbox",de=`${Kt}/notifications`,L,qi=class{constructor(e={}){this.isSessionInitialized=!1;_(this,L);E(this,L,new pt(e)),f(this,L).updateHeaders({"Novu-API-Version":rl,"Novu-User-Agent":e.userAgent||"@novu/js"})}initializeSession(s){return y(this,arguments,function*({applicationIdentifier:e,subscriberId:t,subscriberHash:r}){let n=yield f(this,L).post(`${Kt}/session`,{applicationIdentifier:e,subscriberId:t,subscriberHash:r});return f(this,L).setAuthorizationToken(n.token),this.isSessionInitialized=!0,n})}fetchNotifications({after:e,archived:t,limit:r=10,offset:s,read:n,tags:o}){let a=new URLSearchParams(`limit=${r}`);return e&&a.append("after",e),s&&a.append("offset",`${s}`),o&&o.forEach(c=>a.append("tags[]",c)),n!==void 0&&a.append("read",`${n}`),t!==void 0&&a.append("archived",`${t}`),f(this,L).getFullResponse(`${de}?${a.toString()}`)}count({filters:e}){return f(this,L).getFullResponse(`${de}/count?filters=${JSON.stringify(e)}`)}read(e){return f(this,L).patch(`${de}/${e}/read`)}unread(e){return f(this,L).patch(`${de}/${e}/unread`)}archive(e){return f(this,L).patch(`${de}/${e}/archive`)}unarchive(e){return f(this,L).patch(`${de}/${e}/unarchive`)}readAll({tags:e}){return f(this,L).post(`${de}/read`,{tags:e})}archiveAll({tags:e}){return f(this,L).post(`${de}/archive`,{tags:e})}archiveAllRead({tags:e}){return f(this,L).post(`${de}/read-archive`,{tags:e})}completeAction({actionType:e,notificationId:t}){return f(this,L).patch(`${de}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return f(this,L).patch(`${de}/${t}/revert`,{actionType:e})}fetchPreferences(e){let t=new URLSearchParams;e&&e.forEach(s=>t.append("tags[]",s));let r=t.size?`?${t.toString()}`:"";return f(this,L).get(`${Kt}/preferences${r}`)}updateGlobalPreferences(e){return f(this,L).patch(`${Kt}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channelPreferences:t}){return f(this,L).patch(`${Kt}/preferences/${e}`,t)}};L=new WeakMap;var sl="2.6.0",nl="@novu/js",ol=`${nl}@${sl}`,ye,Yt,mt,Le,$i=class{constructor(e){_(this,ye);_(this,Yt);_(this,mt);_(this,Le);var t,r,s,n;E(this,Le,new qi({backendUrl:(t=e.backendUrl)!=null?t:lo,userAgent:(r=e.__userAgent)!=null?r:ol})),E(this,ye,new ti),E(this,Yt,new ai({applicationIdentifier:e.applicationIdentifier,subscriberId:e.subscriberId,subscriberHash:e.subscriberHash},f(this,Le),f(this,ye))),f(this,Yt).initialize(),this.notifications=new oi({useCache:(s=e.useCache)!=null?s:!0,inboxServiceInstance:f(this,Le),eventEmitterInstance:f(this,ye)}),this.preferences=new li({useCache:(n=e.useCache)!=null?n:!0,inboxServiceInstance:f(this,Le),eventEmitterInstance:f(this,ye)}),E(this,mt,new Bi({socketUrl:e.socketUrl,eventEmitterInstance:f(this,ye),inboxServiceInstance:f(this,Le)})),this.on=(o,a)=>{f(this,mt).isSocketEvent(o)&&f(this,mt).initialize();let c=f(this,ye).on(o,a);return()=>{c()}},this.off=(o,a)=>{f(this,ye).off(o,a)}}};ye=new WeakMap,Yt=new WeakMap,mt=new WeakMap,Le=new WeakMap;window.Novu=$i;})();
|
|
17
17
|
/*! Bundled license information:
|
|
18
18
|
|
|
19
19
|
xmlhttprequest-ssl/lib/XMLHttpRequest.js:
|