@zeainc/zea-collab
Version:
The Zea Collab library provides Client and Server side tools for connecting and synchronizing users.
1 lines • 78.4 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@zeainc/zea-engine"),t=require("socket.io-client"),r=require("@zeainc/zea-ux");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=o(e),s=n(t),a={name:"@zeainc/zea-collab",version:"6.3.4",description:"The Zea Collab library provides Client and Server side tools for connecting and synchronizing users.",main:"dist/index.cjs.js",module:"dist/index.esm.js",browser:"dist/index.umd.js",files:["dist/"],keywords:["Zea"],scripts:{build:"rollup -c","build:watch":"rollup -w -c",dev:"npm-run-all --parallel build:watch start:watch",dist:"yarn publish --access=public",docs:"cp CHANGELOG.md docs/ && adg --config adg.config.json","docs-w":"cp CHANGELOG.md docs/ && adg -w --config=adg.config.json","docs:serve":"docsify serve docs/",prepare:"yarn run build",release:"standard-version",start:"es-dev-server --cors","start:watch":"es-dev-server --cors --app-index testing-e2e/index.html --open --watch","to-cleanup":"rm -Rf dist/ node_modules/ yarn.lock"},repository:{type:"git",url:"git+ssh://git@github.com/ZeaInc/zea-collab.git"},bugs:{url:"https://github.com/ZeaInc/zea-collab/issues"},homepage:"https://github.com/ZeaInc/zea-collab#readme",author:"Zea Inc.",license:"MIT",dependencies:{debug:"^4.1.1","socket.io-client":"^2.3.0","socketio-wildcard":"^2.0.0"},devDependencies:{"@rollup/plugin-commonjs":"^15.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^9.0.0","@zeainc/jsdocs2md":"^0.0.8","@zeainc/zea-engine":"^4.13.0","@zeainc/zea-ux":"4.6.0",bufferutil:"^4.0.1","builtin-modules":"^3.1.0",crypto:"^1.0.1","docsify-cli":"^4.4.1","es-dev-server":"^1.57.4",eslint:"^7.9.0","eslint-config-airbnb-base":"^14.1.0","eslint-plugin-import":"^2.20.2","npm-run-all":"^4.1.5",path:"^0.12.7",prettier:"2.1.2",rollup:"^2.27.0","rollup-plugin-node-polyfills":"^0.2.1","rollup-plugin-terser":"^7.0.2","standard-version":"^9.0.0",stream:"^0.0.2",tls:"^0.0.1","utf-8-validate":"^5.0.2"}};function u(){}function l(){l.init.call(this)}function c(e){return void 0===e._maxListeners?l.defaultMaxListeners:e._maxListeners}function h(e,t,r){if(t)e.call(r);else for(var n=e.length,o=y(e,n),i=0;i<n;++i)o[i].call(r)}function f(e,t,r,n){if(t)e.call(r,n);else for(var o=e.length,i=y(e,o),s=0;s<o;++s)i[s].call(r,n)}function d(e,t,r,n,o){if(t)e.call(r,n,o);else for(var i=e.length,s=y(e,i),a=0;a<i;++a)s[a].call(r,n,o)}function m(e,t,r,n,o,i){if(t)e.call(r,n,o,i);else for(var s=e.length,a=y(e,s),u=0;u<s;++u)a[u].call(r,n,o,i)}function p(e,t,r,n){if(t)e.apply(r,n);else for(var o=e.length,i=y(e,o),s=0;s<o;++s)i[s].apply(r,n)}function g(e,t,r,n){var o,i,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((i=e._events)?(i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),s=i[t]):(i=e._events=new u,e._eventsCount=0),s){if("function"==typeof s?s=i[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(o=c(e))&&o>0&&s.length>o){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a=l,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=i[t]=r,++e._eventsCount;return e}function v(e,t,r){var n=!1;function o(){e.removeListener(t,o),n||(n=!0,r.apply(e,arguments))}return o.listener=r,o}function w(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function y(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}function b(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}function C(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}u.prototype=Object.create(null),l.EventEmitter=l,l.usingDomains=!1,l.prototype.domain=void 0,l.prototype._events=void 0,l.prototype._maxListeners=void 0,l.defaultMaxListeners=10,l.init=function(){this.domain=null,l.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new u,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},l.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},l.prototype.getMaxListeners=function(){return c(this)},l.prototype.emit=function(e){var t,r,n,o,i,s,a,u="error"===e;if(s=this._events)u=u&&null==s.error;else if(!u)return!1;if(a=this.domain,u){if(t=arguments[1],!a){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=s[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:h(r,c,this);break;case 2:f(r,c,this,arguments[1]);break;case 3:d(r,c,this,arguments[1],arguments[2]);break;case 4:m(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=new Array(n-1),i=1;i<n;i++)o[i-1]=arguments[i];p(r,c,this,o)}return!0},l.prototype.addListener=function(e,t){return g(this,e,t,!1)},l.prototype.on=l.prototype.addListener,l.prototype.prependListener=function(e,t){return g(this,e,t,!0)},l.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,v(this,e,t)),this},l.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,v(this,e,t)),this},l.prototype.removeListener=function(e,t){var r,n,o,i,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new u:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length;i-- >0;)if(r[i]===t||r[i].listener&&r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new u,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,o=e.length;n<o;r+=1,n+=1)e[r]=e[n];e.pop()}(r,o);n.removeListener&&this.emit("removeListener",e,s||t)}return this},l.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new u,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new u:delete r[e]),this;if(0===arguments.length){for(var n,o=Object.keys(r),i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new u,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},l.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[]},l.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):w.call(e,t)},l.prototype.listenerCount=w,l.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var I=C(Object.freeze({__proto__:null,default:l,EventEmitter:l})).EventEmitter,P="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function E(){throw new Error("setTimeout has not been defined")}function _(){throw new Error("clearTimeout has not been defined")}var R=E,A=_;function O(e){if(R===setTimeout)return setTimeout(e,0);if((R===E||!R)&&setTimeout)return R=setTimeout,setTimeout(e,0);try{return R(e,0)}catch(t){try{return R.call(null,e,0)}catch(t){return R.call(this,e,0)}}}"function"==typeof P.setTimeout&&(R=setTimeout),"function"==typeof P.clearTimeout&&(A=clearTimeout);var S,D=[],T=!1,M=-1;function U(){T&&S&&(T=!1,S.length?D=S.concat(D):M=-1,D.length&&N())}function N(){if(!T){var e=O(U);T=!0;for(var t=D.length;t;){for(S=D,D=[];++M<t;)S&&S[M].run();M=-1,t=D.length}S=null,T=!1,function(e){if(A===clearTimeout)return clearTimeout(e);if((A===_||!A)&&clearTimeout)return A=clearTimeout,clearTimeout(e);try{A(e)}catch(t){try{return A.call(null,e)}catch(t){return A.call(this,e)}}}(e)}}function x(e,t){this.fun=e,this.array=t}x.prototype.run=function(){this.fun.apply(null,this.array)};function F(){}var L=F,V=F,k=F,B=F,G=F,X=F,j=F;var z=P.performance||{},Y=z.now||z.mozNow||z.msNow||z.oNow||z.webkitNow||function(){return(new Date).getTime()};var J=new Date;var $={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];D.push(new x(e,t)),1!==D.length||T||O(N)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:L,addListener:V,once:k,off:B,removeListener:G,removeAllListeners:X,emit:j,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Y.call(z),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-J)/1e3}},H=1e3,Z=60*H,W=60*Z,q=24*W,Q=7*q,K=365.25*q,ee=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*K;case"weeks":case"week":case"w":return r*Q;case"days":case"day":case"d":return r*q;case"hours":case"hour":case"hrs":case"hr":case"h":return r*W;case"minutes":case"minute":case"mins":case"min":case"m":return r*Z;case"seconds":case"second":case"secs":case"sec":case"s":return r*H;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=q)return te(e,t,q,"day");if(t>=W)return te(e,t,W,"hour");if(t>=Z)return te(e,t,Z,"minute");if(t>=H)return te(e,t,H,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=q)return Math.round(e/q)+"d";if(t>=W)return Math.round(e/W)+"h";if(t>=Z)return Math.round(e/Z)+"m";if(t>=H)return Math.round(e/H)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function te(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}var re=function(e){function t(e){let n,o,i,s=null;function a(...e){if(!a.enabled)return;const r=a,o=Number(new Date),i=o-(n||o);r.diff=i,r.prev=n,r.curr=o,n=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,o)=>{if("%%"===n)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];n=i.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=ee,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t},ne=b((function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),t.splice(o,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==$&&"env"in $&&(e=$.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=re(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}));function oe(){return!1}function ie(){throw new Error("tty.ReadStream is not implemented")}function se(){throw new Error("tty.ReadStream is not implemented")}var ae={isatty:oe,ReadStream:ie,WriteStream:se},ue=Object.freeze({__proto__:null,isatty:oe,ReadStream:ie,WriteStream:se,default:ae}),le=[],ce=[],he="undefined"!=typeof Uint8Array?Uint8Array:Array,fe=!1;function de(){fe=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)le[t]=e[t],ce[e.charCodeAt(t)]=t;ce["-".charCodeAt(0)]=62,ce["_".charCodeAt(0)]=63}function me(e,t,r){for(var n,o,i=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],i.push(le[(o=n)>>18&63]+le[o>>12&63]+le[o>>6&63]+le[63&o]);return i.join("")}function pe(e){var t;fe||de();for(var r=e.length,n=r%3,o="",i=[],s=16383,a=0,u=r-n;a<u;a+=s)i.push(me(e,a,a+s>u?u:a+s));return 1===n?(t=e[r-1],o+=le[t>>2],o+=le[t<<4&63],o+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],o+=le[t>>10],o+=le[t>>4&63],o+=le[t<<2&63],o+="="),i.push(o),i.join("")}function ge(e,t,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,l=u>>1,c=-7,h=r?o-1:0,f=r?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-c)-1,d>>=-c,c+=a;c>0;i=256*i+e[t+h],h+=f,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+e[t+h],h+=f,c-=8);if(0===i)i=1-l;else{if(i===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),i-=l}return(d?-1:1)*s*Math.pow(2,i-n)}function ve(e,t,r,n,o,i){var s,a,u,l=8*i-o-1,c=(1<<l)-1,h=c>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,m=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(t*u-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[r+d]=255&a,d+=m,a/=256,o-=8);for(s=s<<o|a,l+=o;l>0;e[r+d]=255&s,d+=m,s/=256,l-=8);e[r+d-m]|=128*p}var we={}.toString,ye=Array.isArray||function(e){return"[object Array]"==we.call(e)};function be(){return Ie.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ce(e,t){if(be()<t)throw new RangeError("Invalid typed array length");return Ie.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Ie.prototype:(null===e&&(e=new Ie(t)),e.length=t),e}function Ie(e,t,r){if(!(Ie.TYPED_ARRAY_SUPPORT||this instanceof Ie))return new Ie(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return _e(this,e)}return Pe(this,e,t,r)}function Pe(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);Ie.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Ie.prototype:e=Re(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!Ie.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Se(t,r),o=(e=Ce(e,n)).write(t,r);o!==n&&(e=e.slice(0,o));return e}(e,t,r):function(e,t){if(Oe(t)){var r=0|Ae(t.length);return 0===(e=Ce(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?Ce(e,0):Re(e,t);if("Buffer"===t.type&&ye(t.data))return Re(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Ee(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function _e(e,t){if(Ee(t),e=Ce(e,t<0?0:0|Ae(t)),!Ie.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function Re(e,t){var r=t.length<0?0:0|Ae(t.length);e=Ce(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function Ae(e){if(e>=be())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+be().toString(16)+" bytes");return 0|e}function Oe(e){return!(null==e||!e._isBuffer)}function Se(e,t){if(Oe(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return tt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return rt(e).length;default:if(n)return tt(e).length;t=(""+t).toLowerCase(),n=!0}}function De(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return ze(this,t,r);case"utf8":case"utf-8":return Ge(this,t,r);case"ascii":return Xe(this,t,r);case"latin1":case"binary":return je(this,t,r);case"base64":return Be(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ye(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Te(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Me(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=Ie.from(t,n)),Oe(t))return 0===t.length?-1:Ue(e,t,r,n,o);if("number"==typeof t)return t&=255,Ie.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Ue(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Ue(e,t,r,n,o){var i,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var c=-1;for(i=r;i<a;i++)if(l(e,i)===l(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===u)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){for(var h=!0,f=0;f<u;f++)if(l(e,i+f)!==l(t,f)){h=!1;break}if(h)return i}return-1}function Ne(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function xe(e,t,r,n){return nt(tt(t,e.length-r),e,r,n)}function Fe(e,t,r,n){return nt(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function Le(e,t,r,n){return Fe(e,t,r,n)}function Ve(e,t,r,n){return nt(rt(t),e,r,n)}function ke(e,t,r,n){return nt(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function Be(e,t,r){return 0===t&&r===e.length?pe(e):pe(e.slice(t,r))}function Ge(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,u,l=e[o],c=null,h=l>239?4:l>223?3:l>191?2:1;if(o+h<=r)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&l)<<6|63&i)>127&&(c=u);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(u=(15&l)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&l)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}Ie.TYPED_ARRAY_SUPPORT=void 0===P.TYPED_ARRAY_SUPPORT||P.TYPED_ARRAY_SUPPORT,Ie.poolSize=8192,Ie._augment=function(e){return e.__proto__=Ie.prototype,e},Ie.from=function(e,t,r){return Pe(null,e,t,r)},Ie.TYPED_ARRAY_SUPPORT&&(Ie.prototype.__proto__=Uint8Array.prototype,Ie.__proto__=Uint8Array),Ie.alloc=function(e,t,r){return function(e,t,r,n){return Ee(t),t<=0?Ce(e,t):void 0!==r?"string"==typeof n?Ce(e,t).fill(r,n):Ce(e,t).fill(r):Ce(e,t)}(null,e,t,r)},Ie.allocUnsafe=function(e){return _e(null,e)},Ie.allocUnsafeSlow=function(e){return _e(null,e)},Ie.isBuffer=function(e){return null!=e&&(!!e._isBuffer||ot(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ot(e.slice(0,0))}(e))},Ie.compare=function(e,t){if(!Oe(e)||!Oe(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},Ie.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Ie.concat=function(e,t){if(!ye(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Ie.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Ie.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(!Oe(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},Ie.byteLength=Se,Ie.prototype._isBuffer=!0,Ie.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Te(this,t,t+1);return this},Ie.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Te(this,t,t+3),Te(this,t+1,t+2);return this},Ie.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Te(this,t,t+7),Te(this,t+1,t+6),Te(this,t+2,t+5),Te(this,t+3,t+4);return this},Ie.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Ge(this,0,e):De.apply(this,arguments)},Ie.prototype.equals=function(e){if(!Oe(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Ie.compare(this,e)},Ie.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Ie.prototype.compare=function(e,t,r,n,o){if(!Oe(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(n,o),l=e.slice(t,r),c=0;c<a;++c)if(u[c]!==l[c]){i=u[c],s=l[c];break}return i<s?-1:s<i?1:0},Ie.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Ie.prototype.indexOf=function(e,t,r){return Me(this,e,t,r,!0)},Ie.prototype.lastIndexOf=function(e,t,r){return Me(this,e,t,r,!1)},Ie.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return Ne(this,e,t,r);case"utf8":case"utf-8":return xe(this,e,t,r);case"ascii":return Fe(this,e,t,r);case"latin1":case"binary":return Le(this,e,t,r);case"base64":return Ve(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ke(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Ie.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Xe(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function je(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function ze(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=et(e[i]);return o}function Ye(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function Je(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function $e(e,t,r,n,o,i){if(!Oe(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function He(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o<i;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function Ze(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o<i;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function We(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function qe(e,t,r,n,o){return o||We(e,0,r,4),ve(e,t,r,n,23,4),r+4}function Qe(e,t,r,n,o){return o||We(e,0,r,8),ve(e,t,r,n,52,8),r+8}Ie.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Ie.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Ie.prototype;else{var o=t-e;r=new Ie(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+e]}return r},Ie.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Je(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},Ie.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Je(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},Ie.prototype.readUInt8=function(e,t){return t||Je(e,1,this.length),this[e]},Ie.prototype.readUInt16LE=function(e,t){return t||Je(e,2,this.length),this[e]|this[e+1]<<8},Ie.prototype.readUInt16BE=function(e,t){return t||Je(e,2,this.length),this[e]<<8|this[e+1]},Ie.prototype.readUInt32LE=function(e,t){return t||Je(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Ie.prototype.readUInt32BE=function(e,t){return t||Je(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Ie.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Je(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},Ie.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Je(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},Ie.prototype.readInt8=function(e,t){return t||Je(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Ie.prototype.readInt16LE=function(e,t){t||Je(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Ie.prototype.readInt16BE=function(e,t){t||Je(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Ie.prototype.readInt32LE=function(e,t){return t||Je(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Ie.prototype.readInt32BE=function(e,t){return t||Je(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Ie.prototype.readFloatLE=function(e,t){return t||Je(e,4,this.length),ge(this,e,!0,23,4)},Ie.prototype.readFloatBE=function(e,t){return t||Je(e,4,this.length),ge(this,e,!1,23,4)},Ie.prototype.readDoubleLE=function(e,t){return t||Je(e,8,this.length),ge(this,e,!0,52,8)},Ie.prototype.readDoubleBE=function(e,t){return t||Je(e,8,this.length),ge(this,e,!1,52,8)},Ie.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||$e(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},Ie.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||$e(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},Ie.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,1,255,0),Ie.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Ie.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,2,65535,0),Ie.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):He(this,e,t,!0),t+2},Ie.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,2,65535,0),Ie.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):He(this,e,t,!1),t+2},Ie.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,4,4294967295,0),Ie.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Ze(this,e,t,!0),t+4},Ie.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,4,4294967295,0),Ie.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ze(this,e,t,!1),t+4},Ie.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);$e(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},Ie.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);$e(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},Ie.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,1,127,-128),Ie.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Ie.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,2,32767,-32768),Ie.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):He(this,e,t,!0),t+2},Ie.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,2,32767,-32768),Ie.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):He(this,e,t,!1),t+2},Ie.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,4,2147483647,-2147483648),Ie.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Ze(this,e,t,!0),t+4},Ie.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||$e(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Ie.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ze(this,e,t,!1),t+4},Ie.prototype.writeFloatLE=function(e,t,r){return qe(this,e,t,!0,r)},Ie.prototype.writeFloatBE=function(e,t,r){return qe(this,e,t,!1,r)},Ie.prototype.writeDoubleLE=function(e,t,r){return Qe(this,e,t,!0,r)},Ie.prototype.writeDoubleBE=function(e,t,r){return Qe(this,e,t,!1,r)},Ie.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o,i=n-r;if(this===e&&r<t&&t<n)for(o=i-1;o>=0;--o)e[o+t]=this[o+r];else if(i<1e3||!Ie.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},Ie.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Ie.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=Oe(e)?e:tt(new Ie(e,n).toString()),a=s.length;for(i=0;i<r-t;++i)this[i+t]=s[i%a]}return this};var Ke=/[^+\/0-9A-Za-z-_]/g;function et(e){return e<16?"0"+e.toString(16):e.toString(16)}function tt(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function rt(e){return function(e){var t,r,n,o,i,s;fe||de();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===e[a-2]?2:"="===e[a-1]?1:0,s=new he(3*a/4-i),n=i>0?a-4:a;var u=0;for(t=0,r=0;t<n;t+=4,r+=3)o=ce[e.charCodeAt(t)]<<18|ce[e.charCodeAt(t+1)]<<12|ce[e.charCodeAt(t+2)]<<6|ce[e.charCodeAt(t+3)],s[u++]=o>>16&255,s[u++]=o>>8&255,s[u++]=255&o;return 2===i?(o=ce[e.charCodeAt(t)]<<2|ce[e.charCodeAt(t+1)]>>4,s[u++]=255&o):1===i&&(o=ce[e.charCodeAt(t)]<<10|ce[e.charCodeAt(t+1)]<<4|ce[e.charCodeAt(t+2)]>>2,s[u++]=o>>8&255,s[u++]=255&o),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Ke,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function nt(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function ot(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var it="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},st=/%[sdj%]/g;function at(e){if(!Pt(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(ft(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,o=n.length,i=String(e).replace(st,(function(e){if("%%"===e)return"%";if(r>=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r<o;s=n[++r])bt(s)||!At(s)?i+=" "+s:i+=" "+ft(s);return i}function ut(e,t){if(_t(P.process))return function(){return ut(e,t).apply(this,arguments)};if(!0===$.noDeprecation)return e;var r=!1;return function(){if(!r){if($.throwDeprecation)throw new Error(t);$.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)}}var lt,ct={};function ht(e){if(_t(lt)&&(lt=$.env.NODE_DEBUG||""),e=e.toUpperCase(),!ct[e])if(new RegExp("\\b"+e+"\\b","i").test(lt)){ct[e]=function(){var t=at.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else ct[e]=function(){};return ct[e]}function ft(e,t){var r={seen:[],stylize:mt};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),yt(t)?r.showHidden=t:t&&Vt(r,t),_t(r.showHidden)&&(r.showHidden=!1),_t(r.depth)&&(r.depth=2),_t(r.colors)&&(r.colors=!1),_t(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=dt),pt(r,e,r.depth)}function dt(e,t){var r=ft.styles[t];return r?"["+ft.colors[r][0]+"m"+e+"["+ft.colors[r][1]+"m":e}function mt(e,t){return e}function pt(e,t,r){if(e.customInspect&&t&&Dt(t.inspect)&&t.inspect!==ft&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return Pt(n)||(n=pt(e,n,r)),n}var o=function(e,t){if(_t(t))return e.stylize("undefined","undefined");if(Pt(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(It(t))return e.stylize(""+t,"number");if(yt(t))return e.stylize(""+t,"boolean");if(bt(t))return e.stylize("null","null")}(e,t);if(o)return o;var i=Object.keys(t),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(i);if(e.showHidden&&(i=Object.getOwnPropertyNames(t)),St(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return gt(t);if(0===i.length){if(Dt(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(Rt(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Ot(t))return e.stylize(Date.prototype.toString.call(t),"date");if(St(t))return gt(t)}var u,l="",c=!1,h=["{","}"];(wt(t)&&(c=!0,h=["[","]"]),Dt(t))&&(l=" [Function"+(t.name?": "+t.name:"")+"]");return Rt(t)&&(l=" "+RegExp.prototype.toString.call(t)),Ot(t)&&(l=" "+Date.prototype.toUTCString.call(t)),St(t)&&(l=" "+gt(t)),0!==i.length||c&&0!=t.length?r<0?Rt(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=c?function(e,t,r,n,o){for(var i=[],s=0,a=t.length;s<a;++s)kt(t,String(s))?i.push(vt(e,t,r,n,String(s),!0)):i.push("");return o.forEach((function(o){o.match(/^\d+$/)||i.push(vt(e,t,r,n,o,!0))})),i}(e,t,r,s,i):i.map((function(n){return vt(e,t,r,s,n,c)})),e.seen.pop(),function(e,t,r){if(e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,l,h)):h[0]+l+h[1]}function gt(e){return"["+Error.prototype.toString.call(e)+"]"}function vt(e,t,r,n,o,i){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),kt(n,o)||(s="["+o+"]"),a||(e.seen.indexOf(u.value)<0?(a=bt(r)?pt(e,u.value,null):pt(e,u.value,r-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),_t(s)){if(i&&o.match(/^\d+$/))return a;(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function wt(e){return Array.isArray(e)}function yt(e){return"boolean"==typeof e}function bt(e){return null===e}function Ct(e){return null==e}function It(e){return"number"==typeof e}function Pt(e){return"string"==typeof e}function Et(e){return"symbol"==typeof e}function _t(e){return void 0===e}function Rt(e){return At(e)&&"[object RegExp]"===Ut(e)}function At(e){return"object"==typeof e&&null!==e}function Ot(e){return At(e)&&"[object Date]"===Ut(e)}function St(e){return At(e)&&("[object Error]"===Ut(e)||e instanceof Error)}function Dt(e){return"function"==typeof e}function Tt(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Mt(e){return Ie.isBuffer(e)}function Ut(e){return Object.prototype.toString.call(e)}function Nt(e){return e<10?"0"+e.toString(10):e.toString(10)}ft.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},ft.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var xt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ft(){var e=new Date,t=[Nt(e.getHours()),Nt(e.getMinutes()),Nt(e.getSeconds())].join(":");return[e.getDate(),xt[e.getMonth()],t].join(" ")}function Lt(){console.log("%s - %s",Ft(),at.apply(null,arguments))}function Vt(e,t){if(!t||!At(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function kt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Bt,Gt={inherits:it,_extend:Vt,log:Lt,isBuffer:Mt,isPrimitive:Tt,isFunction:Dt,isError:St,isDate:Ot,isObject:At,isRegExp:Rt,isUndefined:_t,isSymbol:Et,isString:Pt,isNumber:It,isNullOrUndefined:Ct,isNull:bt,isBoolean:yt,isArray:wt,inspect:ft,deprecate:ut,format:at,debuglog:ht},Xt=Object.freeze({__proto__:null,format:at,deprecate:ut,debuglog:ht,inspect:ft,isArray:wt,isBoolean:yt,isNull:bt,isNullOrUndefined:Ct,isNumber:It,isString:Pt,isSymbol:Et,isUndefined:_t,isRegExp:Rt,isObject:At,isDate:Ot,isError:St,isFunction:Dt,isPrimitive:Tt,isBuffer:Mt,log:Lt,inherits:it,_extend:Vt,default:Gt});function jt(){if(void 0===Bt){var e=new ArrayBuffer(2),t=new Uint8Array(e),r=new Uint16Array(e);if(t[0]=1,t[1]=2,258===r[0])Bt="BE";else{if(513!==r[0])throw new Error("unable to figure out endianess");Bt="LE"}}return Bt}function zt(){return void 0!==P.location?P.location.hostname:""}function Yt(){return[]}function Jt(){return 0}function $t(){return Number.MAX_VALUE}function Ht(){return Number.MAX_VALUE}function Zt(){return[]}function Wt(){return"Browser"}function qt(){return void 0!==P.navigator?P.navigator.appVersion:""}function Qt(){}function Kt(){}function er(){return"/tmp"}var tr=er,rr={EOL:"\n",tmpdir:tr,tmpDir:er,networkInterfaces:Qt,getNetworkInterfaces:Kt,release:qt,type:Wt,cpus:Zt,totalmem:Ht,freemem:$t,uptime:Jt,loadavg:Yt,hostname:zt,endianness:jt},nr=(e,t=$.argv)=>{const r=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return-1!==n&&(-1===o||n<o)},or=C(Object.freeze({__proto__:null,endianness:jt,hostname:zt,loadavg:Yt,uptime:Jt,freemem:$t,totalmem:Ht,cpus:Zt,type:Wt,release:qt,networkInterfaces:Qt,getNetworkInterfaces:Kt,arch:function(){return"javascript"},platform:function(){return"browser"},tmpDir:er,tmpdir:tr,EOL:"\n",default:rr})),ir=C(ue);const{env:sr}=$;let ar;function ur(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function lr(e,t){if(0===ar)return 0;if(nr("color=16m")||nr("color=full")||nr("color=truecolor"))return 3;if(nr("color=256"))return 2;if(e&&!t&&void 0===ar)return 0;const r=ar||0;if("dumb"===sr.TERM)return r;if("win32"===$.platform){const e=or.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in sr)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in sr))||"codeship"===sr.CI_NAME?1:r;if("TEAMCITY_VERSION"in sr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(sr.TEAMCITY_VERSION)?1:0;if("truecolor"===sr.COLORTERM)return 3;if("TERM_PROGRAM"in sr){const e=parseInt((sr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(sr.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(sr.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(sr.TERM)||"COLORTERM"in sr?1:r}nr("no-color")||nr("no-colors")||nr("color=false")||nr("color=never")?ar=0:(nr("color")||nr("colors")||nr("color=true")||nr("color=always"))&&(ar=1),"FORCE_COLOR"in sr&&(ar="true"===sr.FORCE_COLOR?1:"false"===sr.FORCE_COLOR?0:0===sr.FORCE_COLOR.length?1:Math.min(parseInt(sr.FORCE_COLOR,10),3));var cr={supportsColor:function(e){return ur(lr(e,e&&e.isTTY))},stdout:ur(lr(!0,ir.isatty(1))),stderr:ur(lr(!0,ir.isatty(2)))},hr=C(Xt),fr=b((function(e,t){t.init=function(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++)e.inspectOpts[r[n]]=t.inspectOpts[r[n]]},t.log=function(...e){return $.stderr.write(hr.format(...e)+"\n")},t.formatArgs=function(r){const{namespace:n,useColors:o}=this;if(o){const t=this.color,o="[3"+(t<8?t:"8;5;"+t),i=` ${o};1m${n} [0m`;r[0]=i+r[0].split("\n").join("\n"+i),r.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else r[0]=function(){if(t.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+n+" "+r[0]},t.save=function(e){e?$.env.DEBUG=e:delete $.env.DEBUG},t.load=function(){return $.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):ir.isatty($.stderr.fd)},t.destroy=hr.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=cr;e&&(e.stderr||e).level>=2&&(t.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(e){}t.inspectOpts=Object.keys($.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=$.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e}),{}),e.exports=re(t);const{formatters:r}=e.exports;r.o=function(e){return this.inspectOpts.colors=this.useColors,hr.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},r.O=function(e){return this.inspectOpts.colors=this.useColors,hr.inspect(e,this.inspectOpts)}}));const dr=b((function(e){void 0===$||"renderer"===$.type||!0===$.browser||$.__nwjs?e.exports=ne:e.exports=fr}))("zea:collab"),mr=()=>{let t=e.MathFunctions.randomInt(0,360);const[r,n,o]=function(e,t,r){let n=t*Math.min(r,1-r),o=(t,o=(t+e/30)%12)=>r-n*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}(t,.9,.5);return new e.Color(r,n,o)};const pr={JOIN_ROOM:"join-room",PING_ROOM:"ping-room",LEAVE_ROOM:"leave-room"};class gr{#e;constructor(e,t,r={}){this.roomId=null,this.userData=e,this.socketUrl=t,this.userTimeout=r.userTimeout??120,this.enableAudioStreams=r.enableAudioStreams,this.enableVideoStreams=r.enab