ocoge/lib/skyway.min.js

16 lines
183 KiB
JavaScript
Raw Blame History

/*!
* SkyWay Copyright(c) 2021 NTT Communications Corporation
* peerjs Copyright(c) 2013 Michelle Bu <michelle@michellebu.com>
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Peer=t():e.Peer=t()}(globalThis,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=75)}([function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return a}));var r=n(7),i=n(3),o=n(18);const s=(()=>{const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]?"LE":"BE"})();class a{constructor(e,t){if(this.size=4,this.indirection=1,t&&Object(i.c)(t)&&(t={name:t}),this._options=t||{},this._options.separator=this._options.separator||" | ",this._options.endianness=this._options.endianness||s,this._options.ignoreCase=this._options.ignoreCase||!1,this._options.freez=this._options.freez||!1,this._options.freeze=this._options.freeze||this._options.freez||!1,this.enums=[],e.length){this._enumLastIndex=e.length;var n=e;e={};for(var o=0;o<n.length;o++)e[n[o]]=Math.pow(2,o)}for(var a in e)u(this._options.name,a),this[a]=new r.a(a,e[a],{ignoreCase:this._options.ignoreCase}),this.enums.push(this[a]);this._enumMap=e,this._options.ignoreCase&&(this.getLowerCaseEnums=function(){for(var e={},t=0,n=this.enums.length;t<n;t++)e[this.enums[t].key.toLowerCase()]=this.enums[t];return e}),this._options.name&&(this.name=this._options.name);this.isFlaggable=(()=>{for(var e=0,t=this.enums.length;e<t;e++){var n=this.enums[e];if(0===n.value||n.value&n.value-1)return!1}return!0})(),this._options.freeze&&this.freezeEnums()}getKey(e){var t=this.get(e);if(t)return t.key}getValue(e){var t=this.get(e);if(t)return t.value}get(e,t){if(null!=e){var n;if(null!=(n=e)&&null!=n.constructor&&"function"==typeof n.constructor.isBuffer&&n.constructor.isBuffer(n)&&(e=e["readUInt32"+this._options.endianness](t||0)),r.a.isEnumItem(e)){if(o.a.call(this.enums,e)>=0)return e;if(!this.isFlaggable||this.isFlaggable&&e.key.indexOf(this._options.separator)<0)return;return this.get(e.key)}if(Object(i.c)(e)){var s=this;if(this._options.ignoreCase&&(s=this.getLowerCaseEnums(),e=e.toLowerCase()),e.indexOf(this._options.separator)>0){for(var a=e.split(this._options.separator),c=0,u=0;u<a.length;u++){c|=s[a[u]].value}return new r.a(e,c)}return s[e]}for(var h in this)if(this.hasOwnProperty(h)&&this[h].value===e)return this[h];var p=null;if(this.isFlaggable)for(var d in this)this.hasOwnProperty(d)&&0!=(e&this[d].value)&&(p?p+=this._options.separator:p="",p+=d);return this.get(p||null)}}set(e,t,n){var r=this.get(n);if(r)return e["writeUInt32"+this._options.endianness](r.value,t||0)}freezeEnums(){function e(e){return e}return Object.isFrozen&&Object.isSealed&&Object.getOwnPropertyNames&&Object.getOwnPropertyDescriptor&&Object.defineProperties&&Object.__defineGetter__&&Object.__defineSetter__&&function t(n){if("object"==typeof n&&null!==n&&!Object.isFrozen(n)&&!Object.isSealed(n)){for(var r in n)n.hasOwnProperty(r)&&(n.__defineGetter__(r,e.bind(null,n[r])),n.__defineSetter__(r,(function(e){throw TypeError("Cannot redefine property; Enum Type is not extensible.")})),t(n[r]));Object.freeze?Object.freeze(n):function(e){Object.getOwnPropertyNames(e).forEach((function(t){Object.getOwnPropertyDescriptor(e,t).configurable&&Object.defineProperties(e,t,{writable:!1,configurable:!1})}))}(n)}}(this),this}isDefined(e){let t=t=>t===e;return(Object(i.c)(e)||Object(i.a)(e))&&(t=t=>t.is(e)),this.enums.some(t)}toJSON(){return this._enumMap}extend(e){if(e.length){var t=e;e={};for(var n=0;n<t.length;n++){var i=this._enumLastIndex+n;e[t[n]]=Math.pow(2,i)}for(var o in e)u(this._options.name,o),this[o]=new r.a(o,e[o],{ignoreCase:this._options.ignoreCase}),this.enums.push(this[o]);for(var s in this._enumMap)e[s]=this._enumMap[s];this._enumLastIndex+=e.length,this._enumMap=e,this._options.freeze&&this.freezeEnums()}}static register(t="Enum"){void 0===e||e[t]?"undefined"==typeof window||window[t]||(window[t]=a):e[t]=a}[Symbol.iterator](){let e=0;return{next:()=>e<this.enums.length?{done:!1,value:this.enums[e++]}:{done:!0}}}}var c=["_options","get","getKey","getValue","enums","isFlaggable","_enumMap","toJSON","_enumLastIndex"];function u(e,t){if(e&&"name"===t||o.a.call(c,t)>=0)throw new Error(`Enum key ${t} is a reserved word!`)}}).call(this,n(21))},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&g(e,"error",t,n)}(e,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function p(e,t,n,r){var i,o,s,a;if(u(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=h(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function l(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):y(i,i.length)}function m(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function y(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return h(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var u=c.length,h=y(c,u);for(n=0;n<u;++n)o(h[n],this,t)}return!0},a.prototype.addListener=function(e,t){return p(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return p(this,e,t,!0)},a.prototype.once=function(e,t){return u(t),this.on(e,f(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,f(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,o,s;if(u(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return l(this,e,!0)},a.prototype.rawListeners=function(e){return l(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){(function(r){function i(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}(t=e.exports=n(41)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))})),e.splice(o,0,r)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)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="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),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.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(i())}).call(this,n(23))},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return s}));const r=(e,t)=>typeof t===e,i=e=>r("object",e),o=e=>r("string",e),s=e=>r("number",e)},function(e,t,n){var r=n(2)("socket.io-parser"),i=n(5),o=n(43),s=n(14),a=n(24);function c(){}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=c,t.Decoder=p;var u=t.ERROR+'"encode error"';function h(e){var n=""+e.type;if(t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(n+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(n+=e.nsp+","),null!=e.id&&(n+=e.id),null!=e.data){var i=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(e.data);if(!1===i)return u;n+=i}return r("encoded %j as %s",e,n),n}function p(){this.reconstructor=null}function d(e){this.reconPack=e,this.buffers=[]}function f(e){return{type:t.ERROR,data:"parser error: "+e}}c.prototype.encode=function(e,n){(r("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type)?function(e,t){o.removeBlobs(e,(function(e){var n=o.deconstructPacket(e),r=h(n.packet),i=n.buffers;i.unshift(r),t(i)}))}(e,n):n([h(e)])},i(p.prototype),p.prototype.add=function(e){var n;if("string"==typeof e)n=function(e){var n=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return f("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){for(var o=n+1;"-"!==e.charAt(++n)&&n!=e.length;);var a=e.substring(o,n);if(a!=Number(a)||"-"!==e.charAt(n))throw new Error("Illegal attachments");i.attachments=Number(a)}if("/"===e.charAt(n+1)){for(o=n+1;++n;){if(","===(u=e.charAt(n)))break;if(n===e.length)break}i.nsp=e.substring(o,n)}else i.nsp="/";var c=e.charAt(n+1);if(""!==c&&Number(c)==c){for(o=n+1;++n;){var u;if(null==(u=e.charAt(n))||Number(u)!=u){--n;break}if(n===e.length)break}i.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){var h=function(e){try{return JSON.parse(e)}catch(e){return!1}}(e.substr(n));if(!(!1!==h&&(i.type===t.ERROR||s(h))))return f("invalid payload");i.data=h}return r("decoded %s as %j",e,i),i}(e),t.BINARY_EVENT===n.type||t.BINARY_ACK===n.type?(this.reconstructor=new d(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!a(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,this.emit("decoded",n))}},p.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},d.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=o.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},d.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,n){function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},r.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},r.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},r.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t,n){var r,i=n(51),o=n(13),s=n(52),a=n(53),c=n(54);"undefined"!=typeof ArrayBuffer&&(r=n(55));var u="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),h="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),p=u||h;t.protocol=3;var d=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},f=i(d),l={type:"error",data:"parser error"},m=n(56);function y(e,t,n){for(var r=new Array(e.length),i=a(e.length,n),o=function(e,n,i){t(n,(function(t,n){r[e]=n,i(t,r)}))},s=0;s<e.length;s++)o(s,e[s],i)}t.encodePacket=function(e,n,r,i){"function"==typeof n&&(i=n,n=!1),"function"==typeof r&&(i=r,r=null);var o=void 0===e.data?void 0:e.data.buffer||e.data;if("undefined"!=typeof ArrayBuffer&&o instanceof ArrayBuffer)return function(e,n,r){if(!n)return t.encodeBase64Packet(e,r);var i=e.data,o=new Uint8Array(i),s=new Uint8Array(1+i.byteLength);s[0]=d[e.type];for(var a=0;a<o.length;a++)s[a+1]=o[a];return r(s.buffer)}(e,n,i);if(void 0!==m&&o instanceof m)return function(e,n,r){if(!n)return t.encodeBase64Packet(e,r);if(p)return function(e,n,r){if(!n)return t.encodeBase64Packet(e,r);var i=new FileReader;return i.onload=function(){t.encodePacket({type:e.type,data:i.result},n,!0,r)},i.readAsArrayBuffer(e.data)}(e,n,r);var i=new Uint8Array(1);i[0]=d[e.type];var o=new m([i.buffer,e.data]);return r(o)}(e,n,i);if(o&&o.base64)return function(e,n){var r="b"+t.packets[e.type]+e.data.data;return n(r)}(e,i);var s=d[e.type];return void 0!==e.data&&(s+=r?c.encode(String(e.data),{strict:!1}):String(e.data)),i(""+s)},t.encodeBase64Packet=function(e,n){var r,i="b"+t.packets[e.type];if(void 0!==m&&e.data instanceof m){var o=new FileReader;return o.onload=function(){var e=o.result.split(",")[1];n(i+e)},o.readAsDataURL(e.data)}try{r=String.fromCharCode.apply(null,new Uint8Array(e.data))}catch(t){for(var s=new Uint8Array(e.data),a=new Array(s.length),c=0;c<s.length;c++)a[c]=s[c];r=String.fromCharCode.apply(null,a)}return i+=btoa(r),n(i)},t.decodePacket=function(e,n,r){if(void 0===e)return l;if("string"==typeof e){if("b"===e.charAt(0))return t.decodeBase64Packet(e.substr(1),n);if(r&&!1===(e=function(e){try{e=c.decode(e,{strict:!1})}catch(e){return!1}return e}(e)))return l;var i=e.charAt(0);return Number(i)==i&&f[i]?e.length>1?{type:f[i],data:e.substring(1)}:{type:f[i]}:l}i=new Uint8Array(e)[0];var o=s(e,1);return m&&"blob"===n&&(o=new m([o])),{type:f[i],data:o}},t.decodeBase64Packet=function(e,t){var n=f[e.charAt(0)];if(!r)return{type:n,data:{base64:!0,data:e.substr(1)}};var i=r.decode(e.substr(1));return"blob"===t&&m&&(i=new m([i])),{type:n,data:i}},t.encodePayload=function(e,n,r){"function"==typeof n&&(r=n,n=null);var i=o(e);if(n&&i)return m&&!p?t.encodePayloadAsBlob(e,r):t.encodePayloadAsArrayBuffer(e,r);if(!e.length)return r("0:");y(e,(function(e,r){t.encodePacket(e,!!i&&n,!1,(function(e){r(null,function(e){return e.length+":"+e}(e))}))}),(function(e,t){return r(t.join(""))}))},t.decodePayload=function(e,n,r){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,r);var i;if("function"==typeof n&&(r=n,n=null),""===e)return r(l,0,1);for(var o,s,a="",c=0,u=e.length;c<u;c++){var h=e.charAt(c);if(":"===h){if(""===a||a!=(o=Number(a)))return r(l,0,1);if(a!=(s=e.substr(c+1,o)).length)return r(l,0,1);if(s.length){if(i=t.decodePacket(s,n,!1),l.type===i.type&&l.data===i.data)return r(l,0,1);if(!1===r(i,c+o,u))return}c+=o,a=""}else a+=h}return""!==a?r(l,0,1):void 0},t.encodePayloadAsArrayBuffer=function(e,n){if(!e.length)return n(new ArrayBuffer(0));y(e,(function(e,n){t.encodePacket(e,!0,!0,(function(e){return n(null,e)}))}),(function(e,t){var r=t.reduce((function(e,t){var n;return e+(n="string"==typeof t?t.length:t.byteLength).toString().length+n+2}),0),i=new Uint8Array(r),o=0;return t.forEach((function(e){var t="string"==typeof e,n=e;if(t){for(var r=new Uint8Array(e.length),s=0;s<e.length;s++)r[s]=e.charCodeAt(s);n=r.buffer}i[o++]=t?0:1;var a=n.byteLength.toString();for(s=0;s<a.length;s++)i[o++]=parseInt(a[s]);i[o++]=255;for(r=new Uint8Array(n),s=0;s<r.length;s++)i[o++]=r[s]})),n(i.buffer)}))},t.encodePayloadAsBlob=function(e,n){y(e,(function(e,n){t.encodePacket(e,!0,!0,(function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var r=new Uint8Array(e.length),i=0;i<e.length;i++)r[i]=e.charCodeAt(i);e=r.buffer,t[0]=0}var o=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),s=new Uint8Array(o.length+1);for(i=0;i<o.length;i++)s[i]=parseInt(o[i]);if(s[o.length]=255,m){var a=new m([t.buffer,s.buffer,e]);n(null,a)}}))}),(function(e,t){return n(new m(t))}))},t.decodePayloadAsBinary=function(e,n,r){"function"==typeof n&&(r=n,n=null);for(var i=e,o=[];i.byteLength>0;){for(var a=new Uint8Array(i),c=0===a[0],u="",h=1;255!==a[h];h++){if(u.length>310)return r(l,0,1);u+=a[h]}i=s(i,2+u.length),u=parseInt(u);var p=s(i,0,u);if(c)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(e){var d=new Uint8Array(p);p="";for(h=0;h<d.length;h++)p+=String.fromCharCode(d[h])}o.push(p),i=s(i,u)}var f=o.length;o.forEach((function(e,i){r(t.decodePacket(e,n,!0),i,f)}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(3);class i{constructor(e,t,n={}){this.key=e,this.value=t,this._options=n,this._options.ignoreCase=this._options.ignoreCase||!1}has(e){return i.isEnumItem(e)?0!=(this.value&e.value):Object(r.c)(e)?this._options.ignoreCase?this.key.toLowerCase().indexOf(e.toLowerCase())>=0:this.key.indexOf(e)>=0:0!=(this.value&e)}is(e){return i.isEnumItem(e)?this.key===e.key:Object(r.c)(e)?this._options.ignoreCase?this.key.toLowerCase()===e.toLowerCase():this.key===e:this.value===e}toString(){return this.key}toJSON(){return this.key}valueOf(){return this.value}static isEnumItem(e){return e instanceof i||Object(r.b)(e)&&void 0!==e.key&&void 0!==e.value}}},function(e,t,n){var r=n(66),i=n(67);t.write=i,t.parse=r.parse,t.parseParams=r.parseParams,t.parseFmtpConfig=r.parseFmtpConfig,t.parsePayloads=r.parsePayloads,t.parseRemoteCandidates=r.parseRemoteCandidates,t.parseImageAttributes=r.parseImageAttributes,t.parseSimulcastStreamList=r.parseSimulcastStreamList},function(e,t,n){var r=n(35).BufferBuilder,i=n(35).binaryFeatures,o={unpack:function(e){return new s(e).unpack()},pack:function(e){var t=new a;return t.pack(e),t.getBuffer()}};function s(e){this.index=0,this.dataBuffer=e,this.dataView=new Uint8Array(this.dataBuffer),this.length=this.dataBuffer.byteLength}function a(){this.bufferBuilder=new r}function c(e){var t=e.charCodeAt(0);return t<=2047?"00":t<=65535?"000":t<=2097151?"0000":t<=67108863?"00000":"000000"}e.exports=o,s.prototype.unpack=function(){var e,t=this.unpack_uint8();if(t<128)return t;if((224^t)<32)return(224^t)-32;if((e=160^t)<=15)return this.unpack_raw(e);if((e=176^t)<=15)return this.unpack_string(e);if((e=144^t)<=15)return this.unpack_array(e);if((e=128^t)<=15)return this.unpack_map(e);switch(t){case 192:return null;case 193:return;case 194:return!1;case 195:return!0;case 202:return this.unpack_float();case 203:return this.unpack_double();case 204:return this.unpack_uint8();case 205:return this.unpack_uint16();case 206:return this.unpack_uint32();case 207:return this.unpack_uint64();case 208:return this.unpack_int8();case 209:return this.unpack_int16();case 210:return this.unpack_int32();case 211:return this.unpack_int64();case 212:case 213:case 214:case 215:return;case 216:return e=this.unpack_uint16(),this.unpack_string(e);case 217:return e=this.unpack_uint32(),this.unpack_string(e);case 218:return e=this.unpack_uint16(),this.unpack_raw(e);case 219:return e=this.unpack_uint32(),this.unpack_raw(e);case 220:return e=this.unpack_uint16(),this.unpack_array(e);case 221:return e=this.unpack_uint32(),this.unpack_array(e);case 222:return e=this.unpack_uint16(),this.unpack_map(e);case 223:return e=this.unpack_uint32(),this.unpack_map(e)}},s.prototype.unpack_uint8=function(){var e=255&this.dataView[this.index];return this.index++,e},s.prototype.unpack_uint16=function(){var e=this.read(2),t=256*(255&e[0])+(255&e[1]);return this.index+=2,t},s.prototype.unpack_uint32=function(){var e=this.read(4),t=256*(256*(256*e[0]+e[1])+e[2])+e[3];return this.index+=4,t},s.prototype.unpack_uint64=function(){var e=this.read(8),t=256*(256*(256*(256*(256*(256*(256*e[0]+e[1])+e[2])+e[3])+e[4])+e[5])+e[6])+e[7];return this.index+=8,t},s.prototype.unpack_int8=function(){var e=this.unpack_uint8();return e<128?e:e-256},s.prototype.unpack_int16=function(){var e=this.unpack_uint16();return e<32768?e:e-65536},s.prototype.unpack_int32=function(){var e=this.unpack_uint32();return e<Math.pow(2,31)?e:e-Math.pow(2,32)},s.prototype.unpack_int64=function(){var e=this.unpack_uint64();return e<Math.pow(2,63)?e:e-Math.pow(2,64)},s.prototype.unpack_raw=function(e){if(this.length<this.index+e)throw new Error("BinaryPackFailure: index is out of range "+this.index+" "+e+" "+this.length);var t=this.dataBuffer.slice(this.index,this.index+e);return this.index+=e,t},s.prototype.unpack_string=function(e){for(var t,n,r=this.read(e),i=0,o="";i<e;)(t=r[i])<128?(o+=String.fromCharCode(t),i++):(192^t)<32?(n=(192^t)<<6|63&r[i+1],o+=String.fromCharCode(n),i+=2):(n=(15&t)<<12|(63&r[i+1])<<6|63&r[i+2],o+=String.fromCharCode(n),i+=3);return this.index+=e,o},s.prototype.unpack_array=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=this.unpack();return t},s.prototype.unpack_map=function(e){for(var t={},n=0;n<e;n++){var r=this.unpack(),i=this.unpack();t[r]=i}return t},s.prototype.unpack_float=function(){var e=this.unpack_uint32(),t=(e>>23&255)-127;return(0==e>>31?1:-1)*(8388607&e|8388608)*Math.pow(2,t-23)},s.prototype.unpack_double=function(){var e=this.unpack_uint32(),t=this.unpack_uint32(),n=(e>>20&2047)-1023;return(0==e>>31?1:-1)*((1048575&e|1048576)*Math.pow(2,n-20)+t*Math.pow(2,n-52))},s.prototype.read=function(e){var t=this.index;if(t+e<=this.length)return this.dataView.subarray(t,t+e);throw new Error("BinaryPackFailure: read index out of range")},a.prototype.getBuffer=function(){return this.bufferBuilder.getBuffer()},a.prototype.pack=function(e){var t=typeof e;if("string"==t)this.pack_string(e);else if("number"==t)Math.floor(e)===e?this.pack_integer(e):this.pack_double(e);else if("boolean"==t)!0===e?this.bufferBuilder.append(195):!1===e&&this.bufferBuilder.append(194);else if("undefined"==t)this.bufferBuilder.append(192);else{if("object"!=t)throw new Error('Type "'+t+'" not yet supported');if(null===e)this.bufferBuilder.append(192);else{var n=e.constructor;if(n==Array)this.pack_array(e);else if(n==Blob||n==File)this.pack_bin(e);else if(n==ArrayBuffer)i.useArrayBufferView?this.pack_bin(new Uint8Array(e)):this.pack_bin(e);else if("BYTES_PER_ELEMENT"in e)i.useArrayBufferView?this.pack_bin(new Uint8Array(e.buffer)):this.pack_bin(e.buffer);else if(n==Object)this.pack_object(e);else if(n==Date)this.pack_string(e.toString());else{if("function"!=typeof e.toBinaryPack)throw new Error('Type "'+n.toString()+'" not yet supported');this.bufferBuilder.append(e.toBinaryPack())}}}this.bufferBuilder.flush()},a.prototype.pack_bin=function(e){var t=e.length||e.byteLength||e.size;if(t<=15)this.pack_uint8(160+t);else if(t<=65535)this.bufferBuilder.append(218),this.pack_uint16(t);else{if(!(t<=4294967295))throw new Error("Invalid length");this.bufferBuilder.append(219),this.pack_uint32(t)}this.bufferBuilder.append(e)},a.prototype.pack_string=function(e){var t=function(e){return e.length>600?new Blob([e]).size:e.replace(/[^\u0000-\u007F]/g,c).length}(e);if(t<=15)this.pack_uint8(176+t);else if(t<=65535)this.bufferBuilder.append(216),this.pack_uint16(t);else{if(!(t<=4294967295))throw new Error("Invalid length");this.bufferBuilder.append(217),this.pack_uint32(t)}this.bufferBuilder.append(e)},a.prototype.pack_array=function(e){var t=e.length;if(t<=15)this.pack_uint8(144+t);else if(t<=65535)this.bufferBuilder.append(220),this.pack_uint16(t);else{if(!(t<=4294967295))throw new Error("Invalid length");this.bufferBuilder.append(221),this.pack_uint32(t)}for(var n=0;n<t;n++)this.pack(e[n])},a.prototype.pack_integer=function(e){if(-32<=e&&e<=127)this.bufferBuilder.append(255&e);else if(0<=e&&e<=255)this.bufferBuilder.append(204),this.pack_uint8(e);else if(-128<=e&&e<=127)this.bufferBuilder.append(208),this.pack_int8(e);else if(0<=e&&e<=65535)this.bufferBuilder.append(205),this.pack_uint16(e);else if(-32768<=e&&e<=32767)this.bufferBuilder.append(209),this.pack_int16(e);else if(0<=e&&e<=4294967295)this.bufferBuilder.append(206),this.pack_uint32(e);else if(-2147483648<=e&&e<=2147483647)this.bufferBuilder.append(210),this.pack_int32(e);else if(-0x8000000000000000<=e&&e<=0x8000000000000000)this.bufferBuilder.append(211),this.pack_int64(e);else{if(!(0<=e&&e<=0x10000000000000000))throw new Error("Invalid integer");this.bufferBuilder.append(207),this.pack_uint64(e)}},a.prototype.pack_double=function(e){var t=0;e<0&&(t=1,e=-e);var n=Math.floor(Math.log(e)/Math.LN2),r=e/Math.pow(2,n)-1,i=Math.floor(r*Math.pow(2,52)),o=Math.pow(2,32),s=t<<31|n+1023<<20|i/o&1048575,a=i%o;this.bufferBuilder.append(203),this.pack_int32(s),this.pack_int32(a)},a.prototype.pack_object=function(e){var t=Object.keys(e).length;if(t<=15)this.pack_uint8(128+t);else if(t<=65535)this.bufferBuilder.append(222),this.pack_uint16(t);else{if(!(t<=4294967295))throw new Error("Invalid length");this.bufferBuilder.append(223),this.pack_uint32(t)}for(var n in e)e.hasOwnProperty(n)&&(this.pack(n),this.pack(e[n]))},a.prototype.pack_uint8=function(e){this.bufferBuilder.append(e)},a.prototype.pack_uint16=function(e){this.bufferBuilder.append(e>>8),this.bufferBuilder.append(255&e)},a.prototype.pack_uint32=function(e){var t=4294967295&e;this.bufferBuilder.append((4278190080&t)>>>24),this.bufferBuilder.append((16711680&t)>>>16),this.bufferBuilder.append((65280&t)>>>8),this.bufferBuilder.append(255&t)},a.prototype.pack_uint64=function(e){var t=e/Math.pow(2,32),n=e%Math.pow(2,32);this.bufferBuilder.append((4278190080&t)>>>24),this.bufferBuilder.append((16711680&t)>>>16),this.bufferBuilder.append((65280&t)>>>8),this.bufferBuilder.append(255&t),this.bufferBuilder.append((4278190080&n)>>>24),this.bufferBuilder.append((16711680&n)>>>16),this.bufferBuilder.append((65280&n)>>>8),this.bufferBuilder.append(255&n)},a.prototype.pack_int8=function(e){this.bufferBuilder.append(255&e)},a.prototype.pack_int16=function(e){this.bufferBuilder.append((65280&e)>>8),this.bufferBuilder.append(255&e)},a.prototype.pack_int32=function(e){this.bufferBuilder.append(e>>>24&255),this.bufferBuilder.append((16711680&e)>>>16),this.bufferBuilder.append((65280&e)>>>8),this.bufferBuilder.append(255&e)},a.prototype.pack_int64=function(e){var t=Math.floor(e/Math.pow(2,32)),n=e%Math.pow(2,32);this.bufferBuilder.append((4278190080&t)>>>24),this.bufferBuilder.append((16711680&t)>>>16),this.bufferBuilder.append((65280&t)>>>8),this.bufferBuilder.append(255&t),this.bufferBuilder.append((4278190080&n)>>>24),this.bufferBuilder.append((16711680&n)>>>16),this.bufferBuilder.append((65280&n)>>>8),this.bufferBuilder.append(255&n)}},function(e,t,n){"use strict";(function(e){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var r=n(44),i=n(45),o=n(46);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return p(this,e)}return u(this,e,t,n)}function u(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=d(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|l(t,n),i=(e=a(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|f(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function h(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 p(e,t){if(h(t),e=a(e,t<0?0:0|f(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|f(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function f(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function l(e,t){if(c.isBuffer(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 n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(r)return j(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var h=-1;for(o=n;o<a;o++)if(u(e,o)===u(t,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===c)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var p=!0,d=0;d<c;d++)if(u(e,o+d)!==u(t,d)){p=!1;break}if(p)return o}return-1}function E(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function _(e,t,n,r){return q(j(t,e.length-n),e,n,r)}function w(e,t,n,r){return q(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return w(e,t,n,r)}function b(e,t,n,r){return q(V(t),e,n,r)}function k(e,t,n,r){return q(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,c,u=e[i],h=null,p=u>239?4:u>223?3:u>191?2:1;if(i+p<=n)switch(p){case 1:u<128&&(h=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(h=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(h=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(h=c)}null===h?(h=65533,p=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=p}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return u(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return h(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return p(null,e)},c.allocUnsafeSlow=function(e){return p(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},c.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}},c.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i),i+=s.length}return r},c.byteLength=l,c.prototype._isBuffer=!0,c.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)y(this,t,t+1);return this},c.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)y(this,t,t+3),y(this,t+1,t+2);return this},c.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)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):m.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(r,i),h=e.slice(t,n),p=0;p<a;++p)if(u[p]!==h[p]){o=u[p],s=h[p];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function R(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function O(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=U(e[o]);return i}function N(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function B(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function x(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function I(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function P(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function M(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,o){return o||M(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,o){return o||M(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;n=new c(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||B(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||B(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||B(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||B(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||B(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||B(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||B(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||B(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||B(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||B(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||B(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||B(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||B(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||x(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||x(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):P(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);x(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);x(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):P(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=c.isBuffer(e)?e:j(new c(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(21))},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),r=0,i=n.length;r<i;r++){var o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}},function(e,t){e.exports=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){(function(t){var r=n(14),i=Object.prototype.toString,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===i.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===i.call(File);e.exports=function e(n){if(!n||"object"!=typeof n)return!1;if(r(n)){for(var i=0,a=n.length;i<a;i++)if(e(n[i]))return!0;return!1}if("function"==typeof t&&t.isBuffer&&t.isBuffer(n)||"function"==typeof ArrayBuffer&&n instanceof ArrayBuffer||o&&n instanceof Blob||s&&n instanceof File)return!0;if(n.toJSON&&"function"==typeof n.toJSON&&1===arguments.length)return e(n.toJSON(),!0);for(var c in n)if(Object.prototype.hasOwnProperty.call(n,c)&&e(n[c]))return!0;return!1}}).call(this,n(10).Buffer)},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){var r=n(49),i=n(16);e.exports=function(e){var t=e.xdomain,n=e.xscheme,o=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||r))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!n&&o)return new XDomainRequest}catch(e){}if(!t)try{return new(i[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},function(e,t){e.exports="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")()},function(e,t,n){var r=n(6),i=n(5);function o(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.withCredentials=e.withCredentials,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=o,i(o.prototype),o.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},o.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},o.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},o.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},o.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},o.prototype.onData=function(e){var t=r.decodePacket(e,this.socket.binaryType);this.onPacket(t)},o.prototype.onPacket=function(e){this.emit("packet",e)},o.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=Array.prototype.indexOf||function(e,t){void 0===t&&(t=0),t<0&&(t+=this.length),t<0&&(t=0);for(var n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1}},function(e,t,n){"use strict";const r=n(62),i=n(63),o=n(64),s=n(65);function a(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function c(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function u(e,t){return t.decode?i(e):e}function h(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function p(e){const t=(e=h(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function d(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function f(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!i&&u(n,e).includes(e.arrayFormatSeparator);n=o?u(n,e):n;const s=i||o?n.split(e.arrayFormatSeparator).map(t=>u(t,e)):null===n?n:u(n,e);r[t]=s};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){if(""===i)continue;let[e,s]=o(t.decode?i.replace(/\+/g," "):i,"=");s=void 0===s?null:["comma","separator"].includes(t.arrayFormat)?s:u(s,t),n(u(e,t),s,r)}for(const e of Object.keys(r)){const n=r[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=d(n[e],t);else r[e]=d(n,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=p,t.parse=f,t.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[c(t,e),"[",i,"]"].join("")]:[...n,[c(t,e),"[",c(i,e),"]=",c(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[c(t,e),"[]"].join("")]:[...n,[c(t,e),"[]=",c(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null==r||0===r.length?n:0===n.length?[[c(t,e),"=",c(r,e)].join("")]:[[n,c(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,c(t,e)]:[...n,[c(t,e),"=",c(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map(n=>{const i=e[n];return void 0===i?"":null===i?c(n,t):Array.isArray(i)?i.reduce(r(n),[]).join("&"):c(n,t)+"="+c(i,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=o(e,"#");return Object.assign({url:n.split("?")[0]||"",query:f(p(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:u(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=h(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),s=Object.assign(o,e.query);let a=t.stringify(s,n);a&&(a="?"+a);let u=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(u="#"+c(e.fragmentIdentifier,n)),`${r}${a}${u}`},t.pick=(e,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0},r);const{url:i,query:o,fragmentIdentifier:a}=t.parseUrl(e,r);return t.stringifyUrl({url:i,query:s(o,n),fragmentIdentifier:a},r)},t.exclude=(e,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return t.pick(e,i,r)}},function(e,t,n){"use strict";(function(e){var n=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t,n){this.name=e,this.version=t,this.os=n};t.BrowserInfo=r;var i=function(t){this.version=t,this.name="node",this.os=e.platform};t.NodeInfo=i;var o=function(){this.bot=!0,this.name="bot",this.version=null,this.os=null};t.BotInfo=o;var s=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/Edg\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],a=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/],["Search Bot",/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/]];function c(e){var t=""!==e&&s.reduce((function(t,n){var r=n[0],i=n[1];if(t)return t;var o=i.exec(e);return!!o&&[r,o]}),!1);if(!t)return null;var i=t[0],a=t[1];if("searchbot"===i)return new o;var c=a[1]&&a[1].split(/[._]/).slice(0,3);return c?c.length<3&&(c=n(c,function(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}(3-c.length))):c=[],new r(i,c.join("."),u(e))}function u(e){for(var t=0,n=a.length;t<n;t++){var r=a[t],i=r[0];if(r[1].test(e))return i}return null}function h(){return void 0!==e&&e.version?new i(e.version.slice(1)):null}t.detect=function(e){return e?c(e):"undefined"!=typeof navigator?c(navigator.userAgent):h()},t.parseUserAgent=c,t.detectOS=u,t.getNodeVersion=h}).call(this,n(23))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(e){var t=e,i=e.indexOf("["),o=e.indexOf("]");-1!=i&&-1!=o&&(e=e.substring(0,i)+e.substring(i,o).replace(/:/g,";")+e.substring(o,e.length));for(var s,a,c=n.exec(e||""),u={},h=14;h--;)u[r[h]]=c[h]||"";return-1!=i&&-1!=o&&(u.source=t,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=function(e,t){var n=t.replace(/\/{2,9}/g,"/").split("/");"/"!=t.substr(0,1)&&0!==t.length||n.splice(0,1);"/"==t.substr(t.length-1,1)&&n.splice(n.length-1,1);return n}(0,u.path),u.queryKey=(s=u.query,a={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,n){t&&(a[t]=n)})),a),u}},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,u=[],h=!1,p=-1;function d(){h&&c&&(h=!1,c.length?u=c.concat(u):p=-1,u.length&&f())}function f(){if(!h){var e=a(d);h=!0;for(var t=u.length;t;){for(c=u,u=[];++p<t;)c&&c[p].run();p=-1,t=u.length}c=null,h=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function l(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new l(e,t)),1!==u.length||h||a(f)},l.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){(function(t){e.exports=function(e){return n&&t.isBuffer(e)||r&&(e instanceof ArrayBuffer||function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}(e))};var n="function"==typeof t&&"function"==typeof t.isBuffer,r="function"==typeof ArrayBuffer}).call(this,n(10).Buffer)},function(e,t,n){var r=n(47),i=n(30),o=n(5),s=n(4),a=n(31),c=n(32),u=n(2)("socket.io-client:manager"),h=n(29),p=n(61),d=Object.prototype.hasOwnProperty;function f(e,t){if(!(this instanceof f))return new f(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new p({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||s;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=f,f.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)d.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},f.prototype.updateSocketIds=function(){for(var e in this.nsps)d.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},f.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},o(f.prototype),f.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},f.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},f.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},f.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},f.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},f.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},f.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},f.prototype.open=f.prototype.connect=function(e,t){if(u("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=r(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var o=a(n,"open",(function(){i.onopen(),e&&e()})),s=a(n,"error",(function(t){if(u("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else i.maybeReconnectOnOpen()}));if(!1!==this._timeout){var c=this._timeout;u("connect attempt will timeout after %d",c),0===c&&o.destroy();var h=setTimeout((function(){u("connect attempt timed out after %d",c),o.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",c)}),c);this.subs.push({destroy:function(){clearTimeout(h)}})}return this.subs.push(o),this.subs.push(s),this},f.prototype.onopen=function(){u("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(a(e,"data",c(this,"ondata"))),this.subs.push(a(e,"ping",c(this,"onping"))),this.subs.push(a(e,"pong",c(this,"onpong"))),this.subs.push(a(e,"error",c(this,"onerror"))),this.subs.push(a(e,"close",c(this,"onclose"))),this.subs.push(a(this.decoder,"decoded",c(this,"ondecoded")))},f.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},f.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},f.prototype.ondata=function(e){this.decoder.add(e)},f.prototype.ondecoded=function(e){this.emit("packet",e)},f.prototype.onerror=function(e){u("error",e),this.emitAll("error",e)},f.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new i(this,e,t),this.nsps[e]=n;var r=this;n.on("connecting",o),n.on("connect",(function(){n.id=r.generateId(e)})),this.autoConnect&&o()}function o(){~h(r.connecting,n)||r.connecting.push(n)}return n},f.prototype.destroy=function(e){var t=h(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},f.prototype.packet=function(e){u("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var r=0;r<n.length;r++)t.engine.write(n[r],e.options);t.encoding=!1,t.processPacketQueue()})))},f.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},f.prototype.cleanup=function(){u("cleanup");for(var e=this.subs.length,t=0;t<e;t++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},f.prototype.close=f.prototype.disconnect=function(){u("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},f.prototype.onclose=function(e){u("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},f.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();u("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout((function(){e.skipReconnect||(u("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(u("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(u("reconnect success"),e.onreconnect())})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},f.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){var r=n(15),i=n(50),o=n(57),s=n(58);t.polling=function(e){var t=!1,n=!1,s=!1!==e.jsonp;if("undefined"!=typeof location){var a="https:"===location.protocol,c=location.port;c||(c=a?443:80),t=e.hostname!==location.hostname||c!==e.port,n=e.secure!==a}if(e.xdomain=t,e.xscheme=n,"open"in new r(e)&&!e.forceJSONP)return new i(e);if(!s)throw new Error("JSONP disabled");return new o(e)},t.websocket=s},function(e,t,n){var r=n(17),i=n(11),o=n(6),s=n(12),a=n(28),c=n(2)("engine.io-client:polling");e.exports=h;var u=null!=new(n(15))({xdomain:!1}).responseType;function h(e){var t=e&&e.forceBase64;u&&!t||(this.supportsBinary=!1),r.call(this,e)}s(h,r),h.prototype.name="polling",h.prototype.doOpen=function(){this.poll()},h.prototype.pause=function(e){var t=this;function n(){c("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(c("we are currently polling - waiting to pause"),r++,this.once("pollComplete",(function(){c("pre-pause polling complete"),--r||n()}))),this.writable||(c("we are currently writing - waiting to pause"),r++,this.once("drain",(function(){c("pre-pause writing complete"),--r||n()})))}else n()},h.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},h.prototype.onData=function(e){var t=this;c("polling got data %s",e);o.decodePayload(e,this.socket.binaryType,(function(e,n,r){if("opening"===t.readyState&&"open"===e.type&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},h.prototype.doClose=function(){var e=this;function t(){c("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(c("transport open - closing"),t()):(c("transport not open - deferring close"),this.once("open",t))},h.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};o.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,n)}))},h.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){"use strict";var r,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),o={},s=0,a=0;function c(e){var t="";do{t=i[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function u(){var e=c(+new Date);return e!==r?(s=0,r=e):e+"."+c(s++)}for(;a<64;a++)o[i[a]]=a;u.encode=c,u.decode=function(e){var t=0;for(a=0;a<e.length;a++)t=64*t+o[e.charAt(a)];return t},e.exports=u},function(e,t){var n=[].indexOf;e.exports=function(e,t){if(n)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}},function(e,t,n){var r=n(4),i=n(5),o=n(60),s=n(31),a=n(32),c=n(2)("socket.io-client:socket"),u=n(11),h=n(13);e.exports=f;var p={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},d=i.prototype.emit;function f(e,t,n){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}i(f.prototype),f.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[s(e,"open",a(this,"onopen")),s(e,"packet",a(this,"onpacket")),s(e,"close",a(this,"onclose"))]}},f.prototype.open=f.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.reconnecting||this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},f.prototype.send=function(){var e=o(arguments);return e.unshift("message"),this.emit.apply(this,e),this},f.prototype.emit=function(e){if(p.hasOwnProperty(e))return d.apply(this,arguments),this;var t=o(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:h(t))?r.BINARY_EVENT:r.EVENT,data:t,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},f.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},f.prototype.onopen=function(){if(c("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"==typeof this.query?u.encode(this.query):this.query;c("sending connect packet with query %s",e),this.packet({type:r.CONNECT,query:e})}else this.packet({type:r.CONNECT})},f.prototype.onclose=function(e){c("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},f.prototype.onpacket=function(e){var t=e.nsp===this.nsp,n=e.type===r.ERROR&&"/"===e.nsp;if(t||n)switch(e.type){case r.CONNECT:this.onconnect();break;case r.EVENT:case r.BINARY_EVENT:this.onevent(e);break;case r.ACK:case r.BINARY_ACK:this.onack(e);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",e.data)}},f.prototype.onevent=function(e){var t=e.data||[];c("emitting event %j",t),null!=e.id&&(c("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?d.apply(this,t):this.receiveBuffer.push(t)},f.prototype.ack=function(e){var t=this,n=!1;return function(){if(!n){n=!0;var i=o(arguments);c("sending ack %j",i),t.packet({type:h(i)?r.BINARY_ACK:r.ACK,id:e,data:i})}}},f.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(c("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):c("bad ack %s",e.id)},f.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},f.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)d.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},f.prototype.ondisconnect=function(){c("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},f.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},f.prototype.close=f.prototype.disconnect=function(){return this.connected&&(c("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},f.prototype.compress=function(e){return this.flags.compress=e,this},f.prototype.binary=function(e){return this.flags.binary=e,this}},function(e,t){e.exports=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}}},function(e,t){var n=[].slice;e.exports=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return t.apply(e,r.concat(n.call(arguments)))}}},function(e,t){var n=e.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(n).forEach((function(e){n[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))},function(e,t){var n=e.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w\/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-\.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%d trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))? (\S*)(?: (\S*))?/,names:["value","direction","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+" %s"+(e.config?" %s":"")}},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_\/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{push:"invalid",names:["value"]}]};Object.keys(n).forEach((function(e){n[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))},function(e,t){var n={};n.useBlobBuilder=function(){try{return new Blob([]),!1}catch(e){return!0}}(),n.useArrayBufferView=!n.useBlobBuilder&&function(){try{return 0===new Blob([new Uint8Array([])]).size}catch(e){return!0}}(),e.exports.binaryFeatures=n;var r=e.exports.BlobBuilder;function i(){this._pieces=[],this._parts=[]}"undefined"!=typeof window&&(r=e.exports.BlobBuilder=window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder||window.BlobBuilder),i.prototype.append=function(e){"number"==typeof e?this._pieces.push(e):(this.flush(),this._parts.push(e))},i.prototype.flush=function(){if(this._pieces.length>0){var e=new Uint8Array(this._pieces);n.useArrayBufferView||(e=e.buffer),this._parts.push(e),this._pieces=[]}},i.prototype.getBuffer=function(){if(this.flush(),n.useBlobBuilder){for(var e=new r,t=0,i=this._parts.length;t<i;t++)e.append(this._parts[t]);return e.getBlob()}return new Blob(this._parts)},e.exports.BufferBuilder=i},function(e,t,n){var r=n(40),i=n(4),o=n(25),s=n(2)("socket.io-client");e.exports=t=c;var a=t.managers={};function c(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,i=r(e),c=i.source,u=i.id,h=i.path,p=a[u]&&h in a[u].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||p?(s("ignoring socket cache for %s",c),n=o(c,t)):(a[u]||(s("new io instance for %s",c),a[u]=o(c,t)),n=a[u]),i.query&&!t.query&&(t.query=i.query),n.socket(i.path,t)}t.protocol=i.protocol,t.connect=c,t.Manager=n(25),t.Socket=n(30)},function(e){e.exports=JSON.parse('{"a":"4.4.3"}')},function(e,t,n){t.Interop=n(68)},function(e,t,n){"use strict";var r=n(74),i=n(10).Buffer;function o(e,t){if(null==t)return 0;for(var n=0,r=function(e){const t=[];for(var n in e)t.push(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);Array.prototype.push.apply(t,r)}return t}(t),i=0;i<r.length;i++){var o=r[i];if("object"==typeof t[o]&&null!==t[o]){if(e.has(t[o]))continue;e.add(t[o])}n+=s(e)(o);try{n+=s(e)(t[o])}catch(e){e instanceof RangeError&&(n=0)}}return n}function s(e){return function(t){if(i.isBuffer(t))return t.length;switch(typeof t){case"string":return t.length*r.STRING;case"boolean":return r.BOOLEAN;case"number":return r.NUMBER;case"symbol":return Symbol.keyFor&&Symbol.keyFor(t)?Symbol.keyFor(t).length*r.STRING:(t.toString().length-8)*r.STRING;case"object":return Array.isArray(t)?t.map(s(e)).reduce((function(e,t){return e+t}),0):o(e,t);default:return 0}}}e.exports=function(e){return s(new WeakSet)(e)}},function(e,t,n){var r=n(22),i=n(2)("socket.io-client:url");e.exports=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),n=r(e));n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443"));n.path=n.path||"/";var o=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port,n.href=n.protocol+"://"+o+(t&&t.port===n.port?"":":"+n.port),n}},function(e,t,n){function r(e){var n;function r(){if(r.enabled){var e=r,i=+new Date,o=i-(n||i);e.diff=o,e.prev=n,e.curr=i,n=i;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return n;c++;var i=t.formatters[r];if("function"==typeof i){var o=s[c];n=i.call(e,o),s.splice(c,1),c--}return n})),t.formatArgs.call(e,s);var u=r.log||t.log||console.log.bind(console);u.apply(e,s)}}return r.namespace=e,r.enabled=t.enabled(e),r.useColors=t.useColors(),r.color=function(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}(e),r.destroy=i,"function"==typeof t.init&&t.init(r),t.instances.push(r),r}function i(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var o=t.instances[n];o.enabled=t.enabled(o.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(42),t.instances=[],t.names=[],t.skips=[],t.formatters={}},function(e,t){var n=1e3,r=6e4,i=60*r,o=24*i;function s(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}e.exports=function(e,t){t=t||{};var a,c=typeof e;if("string"===c&&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|years?|yrs?|y)?$/i.exec(e);if(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===c&&!1===isNaN(e))return t.long?s(a=e,o,"day")||s(a,i,"hour")||s(a,r,"minute")||s(a,n,"second")||a+" ms":function(e){if(e>=o)return Math.round(e/o)+"d";if(e>=i)return Math.round(e/i)+"h";if(e>=r)return Math.round(e/r)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){var r=n(14),i=n(24),o=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);t.deconstructPacket=function(e){var t=[],n=e.data,o=e;return o.data=function e(t,n){if(!t)return t;if(i(t)){var o={_placeholder:!0,num:n.length};return n.push(t),o}if(r(t)){for(var s=new Array(t.length),a=0;a<t.length;a++)s[a]=e(t[a],n);return s}if("object"==typeof t&&!(t instanceof Date)){s={};for(var c in t)s[c]=e(t[c],n);return s}return t}(n,t),o.attachments=t.length,{packet:o,buffers:t}},t.reconstructPacket=function(e,t){return e.data=function e(t,n){if(!t)return t;if(t&&t._placeholder)return n[t.num];if(r(t))for(var i=0;i<t.length;i++)t[i]=e(t[i],n);else if("object"==typeof t)for(var o in t)t[o]=e(t[o],n);return t}(e.data,t),e.attachments=void 0,e},t.removeBlobs=function(e,t){var n=0,o=e;!function e(c,u,h){if(!c)return c;if(s&&c instanceof Blob||a&&c instanceof File){n++;var p=new FileReader;p.onload=function(){h?h[u]=this.result:o=this.result,--n||t(o)},p.readAsArrayBuffer(c)}else if(r(c))for(var d=0;d<c.length;d++)e(c[d],d,c);else if("object"==typeof c&&!i(c))for(var f in c)e(c[f],f,c)}(o),n||t(o)}},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),s=r[0],a=r[1],c=new o(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),h=0,p=a>0?s-4:s;for(n=0;n<p;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[h++]=t>>16&255,c[h++]=t>>8&255,c[h++]=255&t;2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[h++]=255&t);1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[h++]=t>>8&255,c[h++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=0,a=n-i;s<a;s+=16383)o.push(h(e,s,s+16383>a?a:s+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function h(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,h=-7,p=n?i-1:0,d=n?-1:1,f=e[t+p];for(p+=d,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+e[t+p],p+=d,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+e[t+p],p+=d,h-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,h=(1<<u)-1,p=h>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,l=r?1:-1,m=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=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(t*c-1)*Math.pow(2,i),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=l,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+f]=255&s,f+=l,s/=256,u-=8);e[n+f-l]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){e.exports=n(48),e.exports.parser=n(6)},function(e,t,n){var r=n(26),i=n(5),o=n(2)("engine.io-client:socket"),s=n(29),a=n(6),c=n(22),u=n(11);function h(e,t){if(!(this instanceof h))return new h(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=c(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=c(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=u.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.withCredentials=!1!==t.withCredentials,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||void 0,this.key=t.key||void 0,this.passphrase=t.passphrase||void 0,this.cert=t.cert||void 0,this.ca=t.ca||void 0,this.ciphers=t.ciphers||void 0,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e.exports=h,h.priorWebsocketSuccess=!1,i(h.prototype),h.protocol=a.protocol,h.Socket=h,h.Transport=n(17),h.transports=n(26),h.parser=n(6),h.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=a.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new r[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,withCredentials:n.withCredentials||this.withCredentials,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},h.prototype.open=function(){var e;if(this.rememberUpgrade&&h.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},h.prototype.setTransport=function(e){o("setting transport %s",e.name);var t=this;this.transport&&(o("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},h.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,r=this;function i(){if(r.onlyBinaryUpgrades){var i=!this.supportsBinary&&r.transport.supportsBinary;n=n||i}n||(o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(o('probe transport "%s" pong',e),r.upgrading=!0,r.emit("upgrading",t),!t)return;h.priorWebsocketSuccess="websocket"===t.name,o('pausing current transport "%s"',r.transport.name),r.transport.pause((function(){n||"closed"!==r.readyState&&(o("changing transport and sending upgrade packet"),d(),r.setTransport(t),t.send([{type:"upgrade"}]),r.emit("upgrade",t),t=null,r.upgrading=!1,r.flush())}))}else{o('probe transport "%s" failed',e);var s=new Error("probe error");s.transport=t.name,r.emit("upgradeError",s)}})))}function s(){n||(n=!0,d(),t.close(),t=null)}function a(n){var i=new Error("probe error: "+n);i.transport=t.name,s(),o('probe transport "%s" failed because of error: %s',e,n),r.emit("upgradeError",i)}function c(){a("transport closed")}function u(){a("socket closed")}function p(e){t&&e.name!==t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),s())}function d(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",c),r.removeListener("close",u),r.removeListener("upgrading",p)}h.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",c),this.once("close",u),this.once("upgrading",p),t.open()},h.prototype.onOpen=function(){if(o("socket open"),this.readyState="open",h.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},h.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(o('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else o('packet received with socket readyState "%s"',this.readyState)},h.prototype.onHandshake=function(e){this.emit("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.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},h.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout((function(){"closed"!==t.readyState&&t.onClose("ping timeout")}),e||t.pingInterval+t.pingTimeout)},h.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout((function(){o("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)}),e.pingInterval)},h.prototype.ping=function(){var e=this;this.sendPacket("ping",(function(){e.emit("ping")}))},h.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},h.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(o("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},h.prototype.write=h.prototype.send=function(e,t,n){return this.sendPacket("message",e,t,n),this},h.prototype.sendPacket=function(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var i={type:e,data:t,options:n};this.emit("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}},h.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?r():t()})):this.upgrading?r():t()}function t(){e.onClose("forced close"),o("socket closing - telling transport to close"),e.transport.close()}function n(){e.removeListener("upgrade",n),e.removeListener("upgradeError",n),t()}function r(){e.once("upgrade",n),e.once("upgradeError",n)}return this},h.prototype.onError=function(e){o("socket error %j",e),h.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},h.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){o('socket close with reason: "%s"',e);clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),this.writeBuffer=[],this.prevBufferLen=0}},h.prototype.filterUpgrades=function(e){for(var t=[],n=0,r=e.length;n<r;n++)~s(this.transports,e[n])&&t.push(e[n]);return t}},function(e,t){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){e.exports=!1}},function(e,t,n){var r=n(15),i=n(27),o=n(5),s=n(12),a=n(2)("engine.io-client:polling-xhr"),c=n(16);function u(){}function h(e){if(i.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,"undefined"!=typeof location){var t="https:"===location.protocol,n=location.port;n||(n=t?443:80),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t}}function p(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.withCredentials=e.withCredentials,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}if(e.exports=h,e.exports.Request=p,s(h,i),h.prototype.supportsBinary=!0,h.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.withCredentials=this.withCredentials,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new p(e)},h.prototype.doWrite=function(e,t){var n="string"!=typeof e&&void 0!==e,r=this.request({method:"POST",data:e,isBinary:n}),i=this;r.on("success",t),r.on("error",(function(e){i.onError("xhr post error",e)})),this.sendXhr=r},h.prototype.doPoll=function(){a("xhr poll");var e=this.request(),t=this;e.on("data",(function(e){t.onData(e)})),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e},o(p.prototype),p.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new r(e),n=this;try{a("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var i in t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(i)&&t.setRequestHeader(i,this.extraHeaders[i])}catch(e){}if("POST"===this.method)try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=this.withCredentials),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){n.onLoad()},t.onerror=function(){n.onError(t.responseText)}):t.onreadystatechange=function(){if(2===t.readyState)try{var e=t.getResponseHeader("Content-Type");(n.supportsBinary&&"application/octet-stream"===e||"application/octet-stream; charset=UTF-8"===e)&&(t.responseType="arraybuffer")}catch(e){}4===t.readyState&&(200===t.status||1223===t.status?n.onLoad():setTimeout((function(){n.onError("number"==typeof t.status?t.status:0)}),0))},a("xhr data %s",this.data),t.send(this.data)}catch(e){return void setTimeout((function(){n.onError(e)}),0)}"undefined"!=typeof document&&(this.index=p.requestsCount++,p.requests[this.index]=this)},p.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},p.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},p.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},p.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=u:this.xhr.onreadystatechange=u,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete p.requests[this.index],this.xhr=null}},p.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e=("application/octet-stream"===t||"application/octet-stream; charset=UTF-8"===t)&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},p.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},p.prototype.abort=function(){this.cleanup()},p.requestsCount=0,p.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",d);else if("function"==typeof addEventListener){addEventListener("onpagehide"in c?"pagehide":"unload",d,!1)}function d(){for(var e in p.requests)p.requests.hasOwnProperty(e)&&p.requests[e].abort()}},function(e,t){e.exports=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t}},function(e,t){e.exports=function(e,t,n){var r=e.byteLength;if(t=t||0,n=n||r,e.slice)return e.slice(t,n);if(t<0&&(t+=r),n<0&&(n+=r),n>r&&(n=r),t>=r||t>=n||0===r)return new ArrayBuffer(0);for(var i=new Uint8Array(e),o=new Uint8Array(n-t),s=t,a=0;s<n;s++,a++)o[a]=i[s];return o.buffer}},function(e,t){function n(){}e.exports=function(e,t,r){var i=!1;return r=r||n,o.count=e,0===e?t():o;function o(e,n){if(o.count<=0)throw new Error("after called too many times");--o.count,e?(i=!0,t(e),t=r):0!==o.count||i||t(null,n)}}},function(e,t){
/*! https://mths.be/utf8js v2.1.2 by @mathias */
var n,r,i,o=String.fromCharCode;function s(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function a(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(e,t){return o(e>>t&63|128)}function u(e,t){if(0==(4294967168&e))return o(e);var n="";return 0==(4294965248&e)?n=o(e>>6&31|192):0==(4294901760&e)?(a(e,t)||(e=65533),n=o(e>>12&15|224),n+=c(e,6)):0==(4292870144&e)&&(n=o(e>>18&7|240),n+=c(e,12),n+=c(e,6)),n+=o(63&e|128)}function h(){if(i>=r)throw Error("Invalid byte index");var e=255&n[i];if(i++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function p(e){var t,o;if(i>r)throw Error("Invalid byte index");if(i==r)return!1;if(t=255&n[i],i++,0==(128&t))return t;if(192==(224&t)){if((o=(31&t)<<6|h())>=128)return o;throw Error("Invalid continuation byte")}if(224==(240&t)){if((o=(15&t)<<12|h()<<6|h())>=2048)return a(o,e)?o:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(o=(7&t)<<18|h()<<12|h()<<6|h())>=65536&&o<=1114111)return o;throw Error("Invalid UTF-8 detected")}e.exports={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,r=s(e),i=r.length,o=-1,a="";++o<i;)a+=u(r[o],n);return a},decode:function(e,t){var a=!1!==(t=t||{}).strict;n=s(e),r=n.length,i=0;for(var c,u=[];!1!==(c=p(a));)u.push(c);return function(e){for(var t,n=e.length,r=-1,i="";++r<n;)(t=e[r])>65535&&(i+=o((t-=65536)>>>10&1023|55296),t=56320|1023&t),i+=o(t);return i}(u)}}},function(e,t){!function(e){"use strict";t.encode=function(t){var n,r=new Uint8Array(t),i=r.length,o="";for(n=0;n<i;n+=3)o+=e[r[n]>>2],o+=e[(3&r[n])<<4|r[n+1]>>4],o+=e[(15&r[n+1])<<2|r[n+2]>>6],o+=e[63&r[n+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o},t.decode=function(t){var n,r,i,o,s,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var h=new ArrayBuffer(a),p=new Uint8Array(h);for(n=0;n<c;n+=4)r=e.indexOf(t[n]),i=e.indexOf(t[n+1]),o=e.indexOf(t[n+2]),s=e.indexOf(t[n+3]),p[u++]=r<<2|i>>4,p[u++]=(15&i)<<4|o>>2,p[u++]=(3&o)<<6|63&s;return h}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},function(e,t){var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,r=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),i=r&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),o=n&&n.prototype.append&&n.prototype.getBlob;function s(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function a(e,t){t=t||{};var r=new n;return s(e).forEach((function(e){r.append(e)})),t.type?r.getBlob(t.type):r.getBlob()}function c(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,c.prototype=Blob.prototype),e.exports=r?i?Blob:c:o?a:void 0},function(e,t,n){var r=n(27),i=n(12),o=n(16);e.exports=h;var s,a=/\n/g,c=/\\n/g;function u(){}function h(e){r.call(this,e),this.query=this.query||{},s||(s=o.___eio=o.___eio||[]),this.index=s.length;var t=this;s.push((function(e){t.onData(e)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){t.script&&(t.script.onerror=u)}),!1)}i(h,r),h.prototype.supportsBinary=!1,h.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),r.prototype.doClose.call(this)},h.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},h.prototype.doWrite=function(e,t){var n=this;if(!this.form){var r,i=document.createElement("form"),o=document.createElement("textarea"),s=this.iframeId="eio_iframe_"+this.index;i.className="socketio",i.style.position="absolute",i.style.top="-1000px",i.style.left="-1000px",i.target=s,i.method="POST",i.setAttribute("accept-charset","utf-8"),o.name="d",i.appendChild(o),document.body.appendChild(i),this.form=i,this.area=o}function u(){h(),t()}function h(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+n.iframeId+'">';r=document.createElement(e)}catch(e){(r=document.createElement("iframe")).name=n.iframeId,r.src="javascript:0"}r.id=n.iframeId,n.form.appendChild(r),n.iframe=r}this.form.action=this.uri(),h(),e=e.replace(c,"\\\n"),this.area.value=e.replace(a,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&u()}:this.iframe.onload=u}},function(e,t,n){(function(t){var r,i,o=n(17),s=n(6),a=n(11),c=n(12),u=n(28),h=n(2)("engine.io-client:websocket");if("undefined"!=typeof WebSocket?r=WebSocket:"undefined"!=typeof self&&(r=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{i=n(59)}catch(e){}var p=r||i;function d(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=r&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(p=i),o.call(this,e)}e.exports=d,c(d,o),d.prototype.name="websocket",d.prototype.supportsBinary=!0,d.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,n={};this.isReactNative||(n.agent=this.agent,n.perMessageDeflate=this.perMessageDeflate,n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new p(e,t):new p(e):new p(e,t,n)}catch(e){return this.emit("error",e)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},d.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},d.prototype.write=function(e){var n=this;this.writable=!1;for(var r=e.length,i=0,o=r;i<o;i++)!function(e){s.encodePacket(e,n.supportsBinary,(function(i){if(!n.usingBrowserWebSocket){var o={};if(e.options&&(o.compress=e.options.compress),n.perMessageDeflate)("string"==typeof i?t.byteLength(i):i.length)<n.perMessageDeflate.threshold&&(o.compress=!1)}try{n.usingBrowserWebSocket?n.ws.send(i):n.ws.send(i,o)}catch(e){h("websocket closed before onclose event")}--r||a()}))}(e[i]);function a(){n.emit("flush"),setTimeout((function(){n.writable=!0,n.emit("drain")}),0)}},d.prototype.onClose=function(){o.prototype.onClose.call(this)},d.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},d.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=u()),this.supportsBinary||(e.b64=1),(e=a.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e},d.prototype.check=function(){return!(!p||"__initialize"in p&&this.name===d.prototype.name)}}).call(this,n(10).Buffer)},function(e,t){},function(e,t){e.exports=function(e,t){for(var n=[],r=(t=t||0)||0;r<e.length;r++)n[r-t]=e[r];return n}},function(e,t){function n(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t,n){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),i=new RegExp("(%[a-f0-9]{2})+","gi");function o(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],o(n),o(r))}function s(e){try{return decodeURIComponent(e)}catch(i){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=o(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"<22><>","%FF%FE":"<22><>"},n=i.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=s(n[0]);r!==n[0]&&(t[n[0]]=r)}n=i.exec(e)}t["%C2"]="<22>";for(var o=Object.keys(t),a=0;a<o.length;a++){var c=o[a];e=e.replace(new RegExp(c,"g"),t[c])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},function(e,t,n){"use strict";e.exports=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o<r.length;o++){var s=r[o],a=e[s];(i?-1!==t.indexOf(s):t(s,a,e))&&(n[s]=a)}return n}},function(e,t,n){var r=function(e){return String(Number(e))===e?Number(e):e},i=function(e,t,n){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:i?t[e.name]:t;!function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},o=n(33),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},n=[],r=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),r=n[n.length-1]);for(var a=0;a<(o[t]||[]).length;a+=1){var c=o[t][a];if(c.reg.test(s))return i(c,r,s)}})),t.media=n,t};var a=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length?e[n[0]]=r(n[1]):1===n.length&&t.length>1&&(e[n[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}}))}))}},function(e,t,n){var r=n(33),i=/%[sdv%]/g,o=function(e){var t=1,n=arguments,r=n.length;return e.replace(i,(function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},s=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var s=t.names[i];t.name?r.push(n[t.name][s]):r.push(n[t.names[i]])}else r.push(n[t.name]);return o.apply(null,r)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],c=["i","c","b","a"];e.exports=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var n=t.outerOrder||a,i=t.innerOrder||c,o=[];return n.forEach((function(t){r[t].forEach((function(n){n.name in e&&null!=e[n.name]?o.push(s(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){o.push(s(t,n,e))}))}))})),e.media.forEach((function(e){o.push(s("m",r.m[0],e)),i.forEach((function(t){r[t].forEach((function(n){n.name in e&&null!=e[n.name]?o.push(s(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){o.push(s(t,n,e))}))}))}))})),o.join("\r\n")+"\r\n"}},function(e,t,n){"use strict";var r=n(69),i=n(73);function o(e){"number"==typeof e.mid&&(e.mid=e.mid.toString())}function s(){this.cache={mlB2UMap:{},mlU2BMap:{}}}e.exports=s,s.prototype.candidateToUnifiedPlan=function(e){var t=new RTCIceCandidate(e);return t.sdpMLineIndex=this.cache.mlB2UMap[t.sdpMLineIndex],t},s.prototype.candidateToPlanB=function(e){var t=new RTCIceCandidate(e);if(0===t.sdpMid.indexOf("audio"))t.sdpMid="audio";else{if(0!==t.sdpMid.indexOf("video"))throw new Error("candidate with "+t.sdpMid+" not allowed");t.sdpMid="video"}return t.sdpMLineIndex=this.cache.mlU2BMap[t.sdpMLineIndex],t},s.prototype.getFirstSendingIndexFromAnswer=function(e){if(!this.cache.answer)return null;var t=r.parse(this.cache.answer);if(t&&t.media&&Array.isArray(t.media))for(var n=0;n<t.media.length;n++)if(t.media[n].type==e&&(!t.media[n].direction||"sendrecv"===t.media[n].direction||"sendonly"===t.media[n].direction))return n;return null},s.prototype.toPlanB=function(e){var t=this;if("object"!=typeof e||null===e||"string"!=typeof e.sdp)return console.warn("An empty description was passed as an argument."),e;var n=r.parse(e.sdp);if(void 0===n.media||!Array.isArray(n.media)||0===n.media.length)return console.warn("The description has no media."),e;if(n.media.length<=3&&n.media.every((function(e){return-1!==["video","audio","data"].indexOf(e.mid)})))return console.warn("This description does not look like Unified Plan."),e;for(var s=e.sdp,c=!1,u=0;u<n.media.length;u++){n.media[u].rtp.forEach((function(e){if("NULL"===e.codec){c=!0;var n=r.parse(t.cache.offer);e.codec=n.media[u].rtp[0].codec}}))}c&&(s=r.write(n)),this.cache[e.type]=s;var h=n.media;n.media=[];var p={},d=[],f={};h.forEach((function(e){if(o(e),("string"!=typeof e.rtcpMux||"rtcp-mux"!==e.rtcpMux)&&"inactive"!==e.direction&&"application"!==e.type)throw new Error("Cannot convert to Plan B because m-lines without the rtcp-mux attribute were found.");void 0!==p[e.type]&&"inactive"!==p[e.type].direction||(p[e.type]=e)})),h.forEach((function(e){var t=e.type;if("application"===t)return e.mid="data",n.media.push(e),void d.push(e.mid);"object"==typeof e.sources&&Object.keys(e.sources).forEach((function(n){"object"!=typeof p[t].sources&&(p[t].sources={}),p[t].sources[n]=e.sources[n],void 0!==e.msid&&(p[t].sources[n].msid=e.msid)})),void 0!==e.ssrcGroups&&Array.isArray(e.ssrcGroups)&&(void 0!==p[t].ssrcGroups&&Array.isArray(p[t].ssrcGroups)||(p[t].ssrcGroups=[]),i.apply(p[t].ssrcGroups,[e.ssrcGroups])||(p[t].ssrcGroups=p[t].ssrcGroups.concat(e.ssrcGroups)));var r=e.direction;f[t]=(f[t]||0)|a[r||"inactive"],p[t]===e&&(e.mid=t,delete e.bundleOnly,delete e.msid,"inactive"!==r&&d.push(t),n.media.push(e))})),n.groups.some((function(e){if("BUNDLE"===e.type)return e.mids=d.join(" "),!0})),n.msidSemantic={semantic:"WMS",token:"*"};var l=r.write(n);return new RTCSessionDescription({type:e.type,sdp:l})},s.prototype.toUnifiedPlan=function(e){var t=this;if("object"!=typeof e||null===e||"string"!=typeof e.sdp)return console.warn("An empty description was passed as an argument."),e;var n=r.parse(e.sdp);if(void 0===n.media||!Array.isArray(n.media)||0===n.media.length)return console.warn("The description has no media."),e;if(n.media.length>3||!n.media.every((function(e){return-1!==["video","audio","data"].indexOf(e.mid)})))return console.warn("This description does not look like Plan B."),e;var s=[];n.media.forEach((function(e){s.push(e.mid)}));var a,c=!1;if(void 0!==n.groups&&Array.isArray(n.groups)&&(c=n.groups.every((function(e){return"BUNDLE"!==e.type||i.apply(e.mids.sort(),[s.sort()])}))),!c)throw new Error("Cannot convert to Unified Plan because m-lines that are not bundled were found.");void 0!==this.cache[e.type]&&(a=r.parse(this.cache[e.type]));var u={audio:{},video:{}},h={},p=0,d=0;if(n.media.forEach((function(n){if(("string"!=typeof n.rtcpMux||"rtcp-mux"!==n.rtcpMux)&&"inactive"!==n.direction&&"application"!==n.type)throw new Error("Cannot convert to Unified Plan because m-lines without the rtcp-mux attribute were found.");if("application"===n.type){var r=null;return a&&a.media&&(r=a.media.find((function(e){return"application"===e.type}))),void(r?h[r.mid]=r:h[n.mid]=n)}var i=n.sources,s=n.ssrcGroups,c=n.candidates,f=n.iceUfrag,l=n.icePwd,m=n.fingerprint,y=n.port;delete n.sources,delete n.ssrcGroups,delete n.candidates,delete n.iceUfrag,delete n.icePwd,delete n.fingerprint,delete n.port,delete n.mid;var g={};void 0!==s&&Array.isArray(s)&&s.forEach((function(e){"SIM"!==e.semantics&&void 0!==e.ssrcs&&Array.isArray(e.ssrcs)&&e.ssrcs.forEach((function(t){void 0===g[t]&&(g[t]=[]),g[t].push(e)}))}));var v={};"object"==typeof i&&Object.keys(i).forEach((function(r){var s;if("offer"!==e.type||i[r].msid)if(void 0!==g[r]&&Array.isArray(g[r])&&g[r].some((function(e){return e.ssrcs.some((function(e){if("object"==typeof v[e])return s=v[e],!0}))})),"object"==typeof s)s.sources[r]=i[r],delete i[r].msid;else{if(s=Object.create(n),v[r]=s,void 0!==i[r].msid&&(s.msid=i[r].msid,delete i[r].msid),s.sources={},s.sources[r]=i[r],s.ssrcGroups=g[r],void 0!==a&&void 0!==a.media&&Array.isArray(a.media)&&a.media.forEach((function(e){"object"==typeof e.sources&&Object.keys(e.sources).forEach((function(t){t===r&&(s.mid=e.mid)}))})),o(s),void 0===s.mid){if("answer"===e.type)throw new Error("An unmapped SSRC was found.");s.mid=[n.type,"-",r].join("")}s.candidates=c,s.iceUfrag=f,s.icePwd=l,s.fingerprint=m,s.port=y,h[s.mid]=s,t.cache.mlU2BMap[d]=p,void 0===t.cache.mlB2UMap[p]&&(t.cache.mlB2UMap[p]=d),d++}else u[n.type][r]=i[r]})),p++})),n.media=[],s=[],"answer"===e.type)for(var f=0;f<a.media.length;f++){var l=a.media[f];o(l),void 0===h[l.mid]&&(delete l.msid,delete l.sources,delete l.ssrcGroups,l.direction&&"sendrecv"!==l.direction?"sendonly"===l.direction&&(l.direction="inactive"):l.direction="recvonly"),n.media.push(l),"string"==typeof l.mid&&s.push(l.mid)}else void 0!==a&&void 0!==a.media&&Array.isArray(a.media)&&a.media.forEach((function(e){o(e),s.push(e.mid),void 0!==h[e.mid]?n.media.push(h[e.mid]):(delete e.msid,delete e.sources,delete e.ssrcGroups,e.direction&&"sendrecv"!==e.direction||(e.direction="recvonly"),e.direction&&"sendonly"!==e.direction||(e.direction="inactive"),n.media.push(e))})),Object.keys(h).forEach((function(e){-1===s.indexOf(e)&&(s.push(e),"recvonly"===h[e].direction?n.media.some((function(t){if(("sendrecv"===t.direction||"sendonly"===t.direction)&&t.type===h[e].type)return Object.keys(h[e].sources).forEach((function(n){t.sources[n]=h[e].sources[n]})),!0})):n.media.push(h[e]))}));["audio","video"].forEach((function(e){if(n&&n.media&&Array.isArray(n.media)){var r=null;if(Object.keys(u[e]).length>0&&null===(r=t.getFirstSendingIndexFromAnswer(e)))for(var i=0;i<n.media.length;i++)if(n.media[i].type===e){r=i;break}if(r&&n.media.length>r){var o=n.media[r];Object.keys(u[e]).forEach((function(t){o.sources&&o.sources[t]&&console.warn("Replacing an existing SSRC."),o.sources||(o.sources={}),o.sources[t]=u[e][t]}))}}})),n.groups.some((function(e){if("BUNDLE"===e.type)return e.mids=s.join(" "),!0})),n.msidSemantic={semantic:"WMS",token:"*"};var m=r.write(n);return this.cache[e.type]=m,new RTCSessionDescription({type:e.type,sdp:m})};var a={inactive:0,recvonly:1,sendonly:2,sendrecv:3}},function(e,t,n){var r=n(70);t.write=function(e,t){return void 0!==e&&void 0!==e.media&&Array.isArray(e.media)&&e.media.forEach((function(e){void 0!==e.sources&&0!==Object.keys(e.sources).length&&(e.ssrcs=[],Object.keys(e.sources).forEach((function(t){var n=e.sources[t];Object.keys(n).forEach((function(r){e.ssrcs.push({id:t,attribute:r,value:n[r]})}))})),delete e.sources),void 0!==e.ssrcGroups&&Array.isArray(e.ssrcGroups)&&e.ssrcGroups.forEach((function(e){void 0!==e.ssrcs&&Array.isArray(e.ssrcs)&&(e.ssrcs=e.ssrcs.join(" "))}))})),void 0!==e&&void 0!==e.groups&&Array.isArray(e.groups)&&e.groups.forEach((function(e){void 0!==e.mids&&Array.isArray(e.mids)&&(e.mids=e.mids.join(" "))})),r.write(e,t)},t.parse=function(e){var t=r.parse(e);return void 0!==t&&void 0!==t.media&&Array.isArray(t.media)&&t.media.forEach((function(e){void 0!==e.ssrcs&&Array.isArray(e.ssrcs)&&(e.sources={},e.ssrcs.forEach((function(t){e.sources[t.id]||(e.sources[t.id]={}),e.sources[t.id][t.attribute]=t.value})),delete e.ssrcs),void 0!==e.ssrcGroups&&Array.isArray(e.ssrcGroups)&&e.ssrcGroups.forEach((function(e){"string"==typeof e.ssrcs&&(e.ssrcs=e.ssrcs.split(" "))}))})),void 0!==t&&void 0!==t.groups&&Array.isArray(t.groups)&&t.groups.forEach((function(e){"string"==typeof e.mids&&(e.mids=e.mids.split(" "))})),t}},function(e,t,n){var r=n(71),i=n(72);t.write=i,t.parse=r.parse,t.parseFmtpConfig=r.parseFmtpConfig,t.parseParams=r.parseParams,t.parsePayloads=r.parsePayloads,t.parseRemoteCandidates=r.parseRemoteCandidates,t.parseImageAttributes=r.parseImageAttributes,t.parseSimulcastStreamList=r.parseSimulcastStreamList},function(e,t,n){var r=function(e){return String(Number(e))===e?Number(e):e},i=function(e,t,n){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:i?t[e.name]:t;!function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},o=n(34),s=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},n=[],r=t;return e.split(/(\r\n|\r|\n)/).filter(s).forEach((function(e){var t=e[0],s=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),r=n[n.length-1]);for(var a=0;a<(o[t]||[]).length;a+=1){var c=o[t][a];if(c.reg.test(s))return i(c,r,s)}})),t.media=n,t};var a=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length&&(e[n[0]]=r(n[1])),e};t.parseParams=function(e){return e.split(/\;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}}))}))}},function(e,t,n){var r=n(34),i=/%[sdv%]/g,o=function(e){var t=1,n=arguments,r=n.length;return e.replace(i,(function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},s=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var s=t.names[i];t.name?r.push(n[t.name][s]):r.push(n[t.names[i]])}else r.push(n[t.name]);return o.apply(null,r)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],c=["i","c","b","a"];e.exports=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var n=t.outerOrder||a,i=t.innerOrder||c,o=[];return n.forEach((function(t){r[t].forEach((function(n){n.name in e&&null!=e[n.name]?o.push(s(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){o.push(s(t,n,e))}))}))})),e.media.forEach((function(e){o.push(s("m",r.m[0],e)),i.forEach((function(t){r[t].forEach((function(n){n.name in e&&null!=e[n.name]?o.push(s(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){o.push(s(t,n,e))}))}))}))})),o.join("\r\n")+"\r\n"}},function(e,t){e.exports=function e(t){if(!t)return!1;if(this.length!=t.length)return!1;for(var n=0,r=this.length;n<r;n++)if(this[n]instanceof Array&&t[n]instanceof Array){if(!e.apply(this[n],[t[n]]))return!1}else if(this[n]!=t[n])return!1;return!0}},function(e,t){e.exports={STRING:2,BOOLEAN:4,NUMBER:8}},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n.n(r),o=n(0),s=n(36),a=n.n(s),c=n(19),u=n.n(c);var h={DISPATCHER_HOST:"dispatcher.webrtc.ecl.ntt.com",DISPATCHER_PORT:443,DISPATCHER_SECURE:!0,DISPATCHER_TIMEOUT:1e4,TURN_HOST:"turn.webrtc.ecl.ntt.com",TURN_PORT:443,MESSAGE_TYPES:{CLIENT:new o.a(["SEND_OFFER","SEND_ANSWER","SEND_CANDIDATE","SEND_LEAVE","ROOM_JOIN","ROOM_LEAVE","ROOM_GET_LOGS","ROOM_GET_USERS","ROOM_SEND_DATA","SFU_GET_OFFER","SFU_ANSWER","SFU_CANDIDATE","PING","UPDATE_CREDENTIAL","SEND_FORCE_CLOSE"]),SERVER:new o.a(["OPEN","ERROR","OFFER","ANSWER","CANDIDATE","LEAVE","AUTH_EXPIRES_IN","ROOM_LOGS","ROOM_USERS","ROOM_DATA","ROOM_USER_JOIN","ROOM_USER_LEAVE","SFU_OFFER","FORCE_CLOSE"])},maxChunkSize:16300,maxDataSize:20971520,minBroadcastIntervalMs:100,maxNumberOfAttempts:10,reconnectionAttempts:2,numberServersToTry:3,sendInterval:1,pingInterval:25e3,defaultConfig:{iceServers:[{urls:"stun:stun.webrtc.ecl.ntt.com:3478",url:"stun:stun.webrtc.ecl.ntt.com:3478"}],iceTransportPolicy:"all"}};const p=new o.a({NONE:0,ERROR:1,WARN:2,FULL:3});var d=new class{constructor(){this._logLevel=p.NONE.value,this.LOG_LEVELS=p}setLogLevel(e){e.value&&(e=e.value);switch(parseInt(e,10)){case 0:this._logLevel=p.NONE.value;break;case 1:this._logLevel=p.ERROR.value;break;case 2:this._logLevel=p.WARN.value;break;case 3:this._logLevel=p.FULL.value;break;default:this._logLevel=p.NONE.value}}warn(...e){this._logLevel>=p.WARN.value&&console.warn("SkyWay: ",...e)}error(...e){this._logLevel>=p.ERROR.value&&console.error("SkyWay: ",...e)}log(...e){this._logLevel>=p.FULL.value&&console.log("SkyWay: ",...e)}},f=n(20);var l={validateId:function(e){return!e||/^[A-Za-z0-9_-]+(?:[ _-][A-Za-z0-9]+)*$/.exec(e)},validateKey:function(e){return!e||/^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}$/.exec(e)},randomId:function(){return(Math.random().toString(36)+"0000000000000000000").substr(2,16)},randomToken:function(){return Math.random().toString(36).substr(2)},joinArrayBuffers:function(e){const t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(new Uint8Array(t),r),r+=t.byteLength;return n.buffer},blobToArrayBuffer:function(e,t){const n=new FileReader;n.onload=e=>{t(e.target.result)},n.readAsArrayBuffer(e)},isSecure:function(){return"https:"===location.protocol},detectBrowser:function(){const{name:e,version:t}=Object(f.detect)(),[n,r,i]=t.split(".").map(e=>parseInt(e));return{name:e,major:n,minor:r,patch:i}},isPlanBSafari:function(){const{name:e}=Object(f.detect)();return("safari"===e||"ios"===e)&&!RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")}},m=n(37);class y extends i.a{constructor(e,t){if(super(),this._isOpen=!1,this._isPeerIdSet=!1,this._queue=[],this._io=null,this._key=e,this._reconnectAttempts=0,t.host&&t.port){const e=t.secure?"https://":"http://";this.signalingServerUrl=`${e}${t.host}:${t.port}`}else{const e=t.dispatcherHost||h.DISPATCHER_HOST,n=t.dispatcherPort||h.DISPATCHER_PORT,r=t.dispatcherSecure||h.DISPATCHER_SECURE?"https://":"http://";this._dispatcherUrl=`${r}${e}:${n}/signaling`}}get isOpen(){return Boolean(this._io&&this._io.connected&&this._isOpen)}async start(e,t,n){let r=`apiKey=${this._key}&token=${t}&platform=javascript&sdk_version=`+m.a;if(e&&(r+="&peerId="+e,this._isPeerIdSet=!0),n){r+="&credential="+encodeURIComponent(JSON.stringify(n))}if(this._dispatcherUrl)try{this.signalingServerUrl=await this._fetchSignalingServerUrlWithRetry()}catch(e){return void this.emit("error",e)}const i=l.detectBrowser(),o=("ios"===i.name||"safari"===i.name)&&i.major>=15?["polling"]:["polling","websocket"];this._io=a()(this.signalingServerUrl,{"force new connection":!0,query:r,reconnectionAttempts:h.reconnectionAttempts,transports:o}),this._io.on("reconnect_failed",()=>{this._stopPings(),this._connectToNewServer()}),this._io.on("error",e=>{d.error(e)}),this._setupMessageHandlers()}async _connectToNewServer(){if(this._reconnectAttempts>=h.numberServersToTry)this.emit("error","Could not connect to server.");else{try{this.signalingServerUrl=await this._fetchSignalingServerUrlWithRetry()}catch(e){return void this.emit("error",e)}this._io.io.uri=this.signalingServerUrl,this._io.connect(),this._reconnectAttempts++}}async _fetchSignalingServerUrlWithRetry(){for(let e=0;e<h.maxNumberOfAttempts;e++){const e=await this._fetchSignalingServer().catch(e=>{d.warn(e)});if(e&&e.port&&e.host&&(!this.signalingServerUrl||-1===this.signalingServerUrl.indexOf(e.host))){return`${e.secure?"https://":"http://"}${e.host}:${e.port}`}}throw new Error("Could not get signaling server url.")}_fetchSignalingServer(){return new Promise((e,t)=>{const n=new XMLHttpRequest;n.timeout=h.DISPATCHER_TIMEOUT,n.open("GET",this._dispatcherUrl,!0),n.onerror=()=>{t(new Error("There was a problem with the request for the dispatcher. Check your peer options and network connections."))},n.onabort=()=>{t(new Error("The request for the dispatcher was aborted."))},n.ontimeout=()=>{t(new Error("The request for the dispatcher timed out. Check your firewall, network speed, SkyWay failure information"))},n.onload=()=>{if(200===n.status)try{const r=JSON.parse(n.responseText);if(r&&r.domain)return void e({host:r.domain,port:443,secure:!0});t(new Error("The dispatcher server returned an invalid JSON response. have no signaling server domain in JSON."))}catch(e){t(new Error("The dispatcher server returned an invalid JSON response."))}else t(new Error("Connection failed. Unexpected response: "+n.status))},n.send(null)})}send(e,t){e?this.isOpen?!0===this._io.connected&&this._io.emit(e,t):this._queue.push({type:e,message:t}):this._io.emit("error","Invalid message")}close(){this.isOpen&&(this._stopPings(),this._io.disconnect(),this._isOpen=!1)}reconnect(){this._io.connect()}updateCredential(e){const t=u.a.parse(this._io.io.opts.query);t.credential?t.credential=encodeURIComponent(JSON.stringify(e)):d.warn("Adding a credential when one wasn't specified before."),this._io.io.opts.query=u.a.stringify(t),this.send(h.MESSAGE_TYPES.CLIENT.UPDATE_CREDENTIAL.key,e)}_setupMessageHandlers(){h.MESSAGE_TYPES.SERVER.enums.forEach(e=>{e.key===h.MESSAGE_TYPES.SERVER.OPEN.key?this._io.on(e.key,t=>{t&&t.peerId&&(this._isPeerIdSet||(this._io.io.opts.query+="&peerId="+t.peerId,this._isPeerIdSet=!0),this._reconnectAttempts=0,this._startPings(),this._sendQueuedMessages(),this._isOpen||(this._isOpen=!0,this.emit(e.key,t)))}):this._io.on(e.key,t=>{this.emit(e.key,t)})})}_sendQueuedMessages(){for(const e of this._queue)this.send(e.type,e.message);this._queue=[]}_startPings(){this._pingIntervalId||(this._pingIntervalId=setInterval(()=>{this.send(h.MESSAGE_TYPES.CLIENT.PING.key)},h.pingInterval))}_stopPings(){clearInterval(this._pingIntervalId),this._pingIntervalId=void 0}}var g=y,v=n(8),E=n.n(v),_=n(38);var w=new class{unifiedToPlanB(e){const t=(new _.Interop).toPlanB(e).sdp,n=new Set,r=/a=ssrc:\d+ msid:(\w+)/g;let i;for(;i=r.exec(t);)n.add(i[1]);const o=t.replace("a=msid-semantic:WMS *","a=msid-semantic:WMS "+Array.from(n).join(" "));return new RTCSessionDescription({type:"offer",sdp:o})}addVideoBandwidth(e,t){return this._validateBandwidth(t),this._addBandwidth(e,t,"video")}addAudioBandwidth(e,t){return this._validateBandwidth(t),this._addBandwidth(e,t,"audio")}filterVideoCodec(e,t){return this._filterCodec(e,t,"video")}filterAudioCodec(e,t){return this._filterCodec(e,t,"audio")}ensureUnifiedPlan(e){return e.split("\r\n").map(e=>e.startsWith("a=msid-semantic")?"a=msid-semantic:WMS *":e).join("\r\n")}_filterCodec(e,t,n){if(void 0===t)throw new Error("codec is not passed");const r=E.a.parse(e);return r.media=r.media.map(e=>{if(e.type===n){e.rtp=e.rtp.filter(e=>e.codec===t);const n=e.rtp.reduce((e,t)=>[...e,t.payload],[]);if(0===e.rtp.length)throw new Error(t+" does not exist");e.fmtp&&(e.fmtp=e.fmtp.filter(e=>n.includes(e.payload))),e.rtcpFb&&(e.rtcpFb=e.rtcpFb.filter(e=>n.includes(e.payload))),e.payloads=n.join(" ")}return e}),E.a.write(r)}_addBandwidth(e,t,n){const r=E.a.parse(e);return r.media=r.media.map(e=>(e.type===n&&(e.bandwidth=[{type:"AS",limit:t.toString()},{type:"TIAS",limit:(1e3*t).toString()}]),e)),E.a.write(r)}_validateBandwidth(e){if(void 0===e)throw new Error("bandwidth is not passed");if(!/^\d+$/.test(e))throw new Error(e+" is not a number")}};const S=new o.a(["addStream","dcCreated","offerCreated","answerCreated","iceCandidate","iceConnectionFailed","negotiationNeeded","error"]);class b extends i.a{constructor(){super(),this._offerQueue=[],this._isExpectingAnswer=!1,this._isNegotiationAllowed=!0,this._isExecutingHandleOffer=!1,this.hasRemoteDescription=!1}async startConnection(e={}){if(this._pc=this._createPeerConnection(e.pcConfig),this._setupPCListeners(),this.originator=e.originator,this._audioBandwidth=e.audioBandwidth,this._videoBandwidth=e.videoBandwidth,this._audioCodec=e.audioCodec,this._videoCodec=e.videoCodec,this._type=e.type,"media"===this._type)if(e.stream){const t=e.stream.getVideoTracks(),n=e.stream.getAudioTracks(),r=this._getReceiveOnlyState(e);t.length>0?t.forEach(t=>this._pc.addTrack(t,e.stream)):r.video&&this._pc.addTransceiver("video",{direction:"recvonly"}),n.length>0?n.forEach(t=>this._pc.addTrack(t,e.stream)):r.audio&&this._pc.addTransceiver("audio",{direction:"recvonly"})}else this.originator&&(this._pc.addTransceiver("audio",{direction:"recvonly"}),this._pc.addTransceiver("video",{direction:"recvonly"}));if(this.originator){if("data"===this._type){const t=e.label||"",n=e.dcInit||{},r=this._pc.createDataChannel(t,n);this.emit(b.EVENTS.dcCreated.key,r)}}else await this.handleOffer(e.offer)}replaceStream(e){if(!this._pc)return;this._isNegotiationAllowed=!0;const t=this,n=e.getVideoTracks(),r=e.getAudioTracks(),i=this._pc.getSenders(),o=i.find(e=>e.track&&"video"===e.track.kind),s=i.find(e=>e.track&&"audio"===e.track.kind);function a(e,n,r){void 0===n&&void 0===e||(void 0!==n?void 0!==e?e.track.id!==n.id&&e.replaceTrack(n):t._pc.addTrack(n,r):t._pc.removeTrack(e))}a(o,n[0],e),a(s,r[0],e)}async handleOffer(e){if(this._lastOffer&&e&&this._lastOffer.sdp===e.sdp)return;if(this._isNegotiationAllowed=!0,"have-remote-offer"===this._pc.signalingState||this._isExecutingHandleOffer)return void this._offerQueue.push(e);let t;this._lastOffer=e,this._isExecutingHandleOffer=!0;try{await this._setRemoteDescription(e),t=await this._makeAnswerSdp().catch(e=>d.error(e))}finally{this._isExecutingHandleOffer=!1}if("stable"===this._pc.signalingState){const e=this._offerQueue.shift();e&&this.handleOffer(e)}this.emit(b.EVENTS.answerCreated.key,t)}async handleAnswer(e){this._isNegotiationAllowed=!0,this._isExpectingAnswer?(await this._setRemoteDescription(e),this._isExpectingAnswer=!1):this._pc.onnegotiationneeded&&this._pc.onnegotiationneeded()}async handleCandidate(e){await this._pc.addIceCandidate(new RTCIceCandidate(e)).then(()=>d.log("Successfully added ICE candidate")).catch(e=>d.error("Failed to add ICE candidate",e))}cleanup(){d.log("Cleaning up PeerConnection"),!this._pc||"closed"===this._pc.readyState&&"closed"===this._pc.signalingState||this._pc.close(),this._pc=null}_createPeerConnection(e={}){return d.log("Creating RTCPeerConnection"),e.sdpSemantics="unified-plan",new RTCPeerConnection(e)}_setupPCListeners(){const e=this._pc;e.ontrack=e=>{d.log("Received remote media stream track"),e.streams.forEach(e=>{this.emit(b.EVENTS.addStream.key,e)})},e.ondatachannel=e=>{d.log("Received data channel");const t=e.channel;this.emit(b.EVENTS.dcCreated.key,t)},e.onicecandidate=e=>{e.candidate&&""!==e.candidate.candidate?(d.log("Generated ICE candidate for:",e.candidate),this.emit(b.EVENTS.iceCandidate.key,e.candidate)):d.log("ICE candidates gathering complete")},e.oniceconnectionstatechange=()=>{switch(e.iceConnectionState){case"completed":d.log("iceConnectionState is completed"),e.onicecandidate=()=>{};break;case"disconnected":d.log("iceConnectionState is disconnected, trying reconnect by browser");break;case"failed":d.log("iceConnectionState is failed, closing connection"),this.emit(b.EVENTS.iceConnectionFailed.key);break;default:d.log("iceConnectionState is "+e.iceConnectionState)}},e.onconnectionstatechange=()=>{d.log("connectionState is "+e.connectionState),"failed"===e.connectionState&&"disconnected"===e.iceConnectionState&&(d.log("connectionState is failed, closing connection"),this.emit(b.EVENTS.iceConnectionFailed.key))},e.onnegotiationneeded=async()=>{if(d.log("`negotiationneeded` triggered"),"stable"===e.signalingState&&this._isNegotiationAllowed&&(this._isNegotiationAllowed=!1,this.originator)){const e=await this._makeOfferSdp();this._setLocalDescription(e),this.emit(b.EVENTS.negotiationNeeded.key)}},e.onsignalingstatechange=()=>{if(d.log("signalingState is "+e.signalingState),"stable"===e.signalingState&&!this._isExecutingHandleOffer){const e=this._offerQueue.shift();e&&this.handleOffer(e)}}}async _makeOfferSdp(){let e;try{e=await this._pc.createOffer()}catch(e){throw e.type="webrtc",d.error(e),this.emit(b.EVENTS.error.key,e),d.log("Failed to createOffer, ",e),e}return d.log("Created offer."),this._audioBandwidth&&(e.sdp=w.addAudioBandwidth(e.sdp,this._audioBandwidth)),this._videoBandwidth&&(e.sdp=w.addVideoBandwidth(e.sdp,this._videoBandwidth)),this._audioCodec&&(e.sdp=w.filterAudioCodec(e.sdp,this._audioCodec)),this._videoCodec&&(e.sdp=w.filterVideoCodec(e.sdp,this._videoCodec)),e}async _makeAnswerSdp(){let e;try{e=await this._pc.createAnswer()}catch(e){throw e.type="webrtc",d.error(e),this.emit(b.EVENTS.error.key,e),d.log("Failed to createAnswer, ",e),e}d.log("Created answer."),this._audioBandwidth&&(e.sdp=w.addAudioBandwidth(e.sdp,this._audioBandwidth)),this._videoBandwidth&&(e.sdp=w.addVideoBandwidth(e.sdp,this._videoBandwidth)),this._audioCodec&&(e.sdp=w.filterAudioCodec(e.sdp,this._audioCodec)),this._videoCodec&&(e.sdp=w.filterVideoCodec(e.sdp,this._videoCodec));try{await this._pc.setLocalDescription(e)}catch(e){throw e.type="webrtc",d.error(e),this.emit(b.EVENTS.error.key,e),d.log("Failed to setLocalDescription, ",e),e}return d.log("Set localDescription: answer"),d.log("Setting local description "+JSON.stringify(e.sdp)),e}async _setLocalDescription(e){d.log("Setting local description "+JSON.stringify(e.sdp));try{await this._pc.setLocalDescription(e)}catch(e){throw e.type="webrtc",d.error(e),this.emit(b.EVENTS.error.key,e),d.log("Failed to setLocalDescription, ",e),e}d.log("Set localDescription: offer"),this._isExpectingAnswer=!0,this.emit(b.EVENTS.offerCreated.key,e)}async _setRemoteDescription(e){d.log("Setting remote description "+JSON.stringify(e));try{await this._pc.setRemoteDescription(new RTCSessionDescription(e)),this.hasRemoteDescription=!0}catch(e){throw e.type="webrtc",d.error(e),this.emit(b.EVENTS.error.key,e),d.log("Failed to setRemoteDescription: ",e),e}d.log("Set remoteDescription:",e.type)}_getReceiveOnlyState(e={}){const t={audio:!1,video:!1},n=e.stream instanceof MediaStream,r=!!n&&0!==e.stream.getAudioTracks().length,i=!!n&&0!==e.stream.getVideoTracks().length;return!1===n&&void 0===e.audioReceiveEnabled&&void 0===e.videoReceiveEnabled?(t.audio=!0,t.video=!0,t):(e.audioReceiveEnabled&&!1===r&&(t.audio=!0),e.videoReceiveEnabled&&!1===i&&(t.video=!0),!1===e.audioReceiveEnabled&&r&&d.warn("Option audioReceiveEnabled will be treated as true, because passed stream has MediaStreamTrack(kind = audio)"),!1===e.videoReceiveEnabled&&i&&d.warn("Option videoReceiveEnabled will be treated as true, because passed stream has MediaStreamTrack(kind = video)"),t)}static get EVENTS(){return S}}var k=b;const C=new o.a(["candidate","offer","answer","close","forceClose"]);class A extends i.a{constructor(e,t){if(super(),t=t||{},this.constructor===A)throw new TypeError("Cannot construct Connection instances directly");this._options=t,this.open=!1,this.type=void 0,this.metadata=this._options.metadata,this.remoteId=e,this._negotiator=new k,this._idPrefix="c_",this._randomIdSuffix=l.randomToken(),this._setupNegotiatorMessageHandlers()}get id(){return this._options.connectionId||this._idPrefix+this._randomIdSuffix}async handleAnswer(e){this._pcAvailable?(await this._negotiator.handleAnswer(e.answer),this.open=!0,this._handleQueuedMessages()):(d.log(`Queuing ANSWER message in ${this.id} from ${this.remoteId}`),this._queuedMessages.push({type:h.MESSAGE_TYPES.SERVER.ANSWER.key,payload:e}))}handleCandidate(e){!this._negotiator.originator||this._negotiator.hasRemoteDescription?this._pcAvailable?this._negotiator.handleCandidate(e.candidate):(d.log(`Queuing CANDIDATE message in ${this.id} from ${this.remoteId}`),this._queuedMessages.push({type:h.MESSAGE_TYPES.SERVER.CANDIDATE.key,payload:e})):this._queuedMessages.push({type:h.MESSAGE_TYPES.SERVER.CANDIDATE.key,payload:e})}updateOffer(e){this.open?this._negotiator.handleOffer(e.offer):this._options.payload=e}getPeerConnection(){return this.open?this._negotiator._pc:null}_handleQueuedMessages(){for(const e of this._queuedMessages)switch(e.type){case h.MESSAGE_TYPES.SERVER.ANSWER.key:this.handleAnswer(e.payload);break;case h.MESSAGE_TYPES.SERVER.CANDIDATE.key:this.handleCandidate(e.payload);break;default:d.warn("Unrecognized message type:",e.type,"from peer:",this.remoteId)}this._queuedMessages=[]}close(e){this.open&&(this.open=!1,this._negotiator.cleanup(),this.emit(A.EVENTS.close.key),e?this.emit(A.EVENTS.forceClose.key):void 0===e&&d.warn("Default value of the forceClose parameter will change false to true from future versions."))}_setupNegotiatorMessageHandlers(){this._negotiator.on(k.EVENTS.answerCreated.key,e=>{const t={answer:e,dst:this.remoteId,connectionId:this.id,connectionType:this.type};this.emit(A.EVENTS.answer.key,t)}),this._negotiator.on(k.EVENTS.offerCreated.key,e=>{const t={offer:e,dst:this.remoteId,connectionId:this.id,connectionType:this.type,metadata:this.metadata};this.serialization&&(t.serialization=this.serialization),this.label&&(t.label=this.label),this.dcInit&&(t.dcInit=this.dcInit),this.emit(A.EVENTS.offer.key,t)}),this._negotiator.on(k.EVENTS.iceCandidate.key,e=>{const t={candidate:e,dst:this.remoteId,connectionId:this.id,connectionType:this.type};this.emit(A.EVENTS.candidate.key,t)}),this._negotiator.on(k.EVENTS.iceConnectionFailed.key,()=>{this.close(!1)})}get peer(){return d.warn(this.constructor.name+".peer is deprecated and may be removed from a future version."+` Please use ${this.constructor.name}.remoteId instead.`),this.remoteId}static get EVENTS(){return C}}var T=A,R=n(9),O=n.n(R),N=n(39),B=n.n(N);const x=new o.a(["open","data","error"]);x.extend(T.EVENTS.enums);const I=new o.a(["binary","binary-utf8","json","none"]);class P extends T{constructor(e,t){if(super(e,t),this._idPrefix="dc_",this.type="data",this._isOnOpenCalled=!1,this.label=this._options.label||this.id,this.dcInit=this._options.dcInit||{},this.serialization=P.SERIALIZATIONS.binary.key,this._options.serialization){if(!P.SERIALIZATIONS.get(this._options.serialization))throw new Error("Invalid serialization");this.serialization=this._options.serialization,this._isUnreliableDCInit(this.dcInit)&&(d.warn("You can not specify serialization with unreliable mode enabled."),this.serialization=P.SERIALIZATIONS.binary.key)}this._sendBuffer=[],this._receivedData={},this._queuedMessages=this._options.queuedMessages||[],this._negotiator.on(k.EVENTS.dcCreated.key,e=>{this._dc=e,this._dc.binaryType="arraybuffer",this._setupMessageHandlers(),this._isOnOpenCalled||"open"!==this._dc.readyState||this._dc.onopen()}),this._options.payload&&(this._options.payload.pcConfig=this._options.pcConfig)}async startConnection(){await this._negotiator.startConnection(this._options.payload||{originator:!0,type:"data",label:this.label,dcInit:this.dcInit,pcConfig:this._options.pcConfig}),this._pcAvailable=!0,this._handleQueuedMessages()}_setupMessageHandlers(){this._dc.onopen=()=>{this._isOnOpenCalled||(d.log("Data channel connection success"),this.open=!0,this._isOnOpenCalled=!0,this.emit(P.EVENTS.open.key))},this._dc.onmessage=e=>{this._handleDataMessage(e)},this._dc.onclose=()=>{d.log("DataChannel closed for:",this.id),this.close(!1)},this._dc.onerror=e=>{d.error(e)}}_handleDataMessage(e){if(this.serialization===P.SERIALIZATIONS.none.key)return void this.emit(P.EVENTS.data.key,e.data);if(this.serialization===P.SERIALIZATIONS.json.key)return void this.emit(P.EVENTS.data.key,JSON.parse(e.data));const t=O.a.unpack(e.data);let n=this._receivedData[t.id];if(n||(n=this._receivedData[t.id]={size:t.size,type:t.type,name:t.name,mimeType:t.mimeType,totalParts:t.totalParts,parts:new Array(t.totalParts),receivedParts:0}),n.receivedParts++,n.parts[t.index]=t.data,n.receivedParts===n.totalParts){delete this._receivedData[t.id];const e=l.joinArrayBuffers(n.parts),r=O.a.unpack(e);let i;switch(n.type){case"Blob":i=new Blob([new Uint8Array(r)],{type:n.mimeType});break;case"File":i=new File([new Uint8Array(r)],n.name,{type:n.mimeType});break;default:i=r}this.emit(P.EVENTS.data.key,i)}}send(e){if(!this.open)return void this.emit(P.EVENTS.error.key,new Error("Connection is not open. You should listen for the `open` event before sending messages."));if(null==e)return;if(this.serialization===P.SERIALIZATIONS.none.key)return this._sendBuffer.push(e),void this._startSendLoop();if(this.serialization===P.SERIALIZATIONS.json.key)return this._sendBuffer.push(JSON.stringify(e)),void this._startSendLoop();const t=O.a.pack(e),n=t.size,r=e.constructor.name,i={id:l.randomId(),type:r,size:n,totalParts:0};"File"===r&&(i.name=e.name),e instanceof Blob&&(i.mimeType=e.type);const o=h.maxChunkSize-B()(i),s=Math.ceil(n/o);i.totalParts=s;for(let e=0;e<s;e++){const n=t.slice(e*o,(e+1)*o);i.index=e,i.data=n,l.blobToArrayBuffer(O.a.pack(i),e=>{this._sendBuffer.push(e),this._startSendLoop()})}}close(e){const t=e=>{super.close(e),this._isOnOpenCalled=!1};this._dc?(this._dc.onclose=()=>{d.log("DataChannel closed for:",this.id),t(e)},"closing"!==this._dc.readyState&&("closed"===this._dc.readyState?t(e):this._dc.close())):t(e)}_startSendLoop(){this.sendInterval||(this.sendInterval=setInterval(()=>{const e=this._sendBuffer.shift();try{this._dc.send(e)}catch(t){this._sendBuffer.push(e)}0===this._sendBuffer.length&&(clearInterval(this.sendInterval),this.sendInterval=void 0)},h.sendInterval))}_isUnreliableDCInit(e){return!!e&&("maxRetransmits"in e||"maxPacketLifeTime"in e)}static get SERIALIZATIONS(){return I}static get EVENTS(){return x}}var M=P;const L=new o.a(["stream"]);L.extend(T.EVENTS.enums);class F extends T{constructor(e,t){super(e,t),this._idPrefix="mc_",this.type="media",this.localStream=this._options.stream,this._queuedMessages=this._options.queuedMessages||[],this._pcAvailable=!1}async startConnection(){this._options.originator&&(await this._negotiator.startConnection({type:"media",stream:this.localStream,originator:this._options.originator,pcConfig:this._options.pcConfig,videoBandwidth:this._options.videoBandwidth,audioBandwidth:this._options.audioBandwidth,videoCodec:this._options.videoCodec,audioCodec:this._options.audioCodec,videoReceiveEnabled:this._options.videoReceiveEnabled,audioReceiveEnabled:this._options.audioReceiveEnabled}),this._pcAvailable=!0,this._handleQueuedMessages())}answer(e,t={}){this.localStream?d.warn("localStream already exists on this MediaConnection. Are you answering a call twice?"):(this._options.payload.stream=e,this.localStream=e,this._negotiator.startConnection({type:"media",stream:this.localStream,originator:!1,offer:this._options.payload.offer,pcConfig:this._options.pcConfig,audioBandwidth:t.audioBandwidth,videoBandwidth:t.videoBandwidth,videoCodec:t.videoCodec,audioCodec:t.audioCodec}),this._pcAvailable=!0,this._handleQueuedMessages(),this.open=!0)}replaceStream(e){this._negotiator.replaceStream(e),this.localStream=e}_setupNegotiatorMessageHandlers(){super._setupNegotiatorMessageHandlers(),this._negotiator.on(k.EVENTS.addStream.key,e=>{d.log("Receiving stream",e),this.remoteStream&&this.remoteStream.id===e.id||(this.remoteStream=e,this.emit(F.EVENTS.stream.key,e))})}static get EVENTS(){return L}}var D=F,U=n(4),j=n.n(U),V=n(13),q=n.n(V);const z=new o.a(["stream","open","close","peerJoin","peerLeave","error","data","log"]),G=new o.a(["offer","answer","candidate","leave","close","getLog","broadcast"]);class Y extends i.a{constructor(e,t,n={}){if(super(),this.constructor===Y)throw new TypeError("Cannot construct Room instances directly");this.name=e,this._options=n,this._peerId=t,this._localStream=this._options.stream,this._pcConfig=this._options.pcConfig,this.lastSent=0,this.messageQueue=[],this.sendIntervalID=null}validateSendDataSize(e){const t=q()([e]),n={type:t?j.a.BINARY_EVENT:j.a.EVENT,data:[e]};let r;(new j.a.Encoder).encode(n,e=>{r=t?e[1].byteLength:e[0].length});const i=h.maxDataSize;if(r>i)throw new Error("The size of data to send must be less than 20 MB");return!0}_sendData(e,t){const n=h.minBroadcastIntervalMs,r=Date.now(),i=r-this.lastsend;if(0==this.messageQueue.length&&i>=n)return this.lastsend=r,void this.emit(t,e);this.messageQueue.push({msg:e,key:t}),null===this.sendIntervalID&&(this.sendIntervalID=setInterval(()=>{if(0===this.messageQueue.length)return clearInterval(this.sendIntervalID),void(this.sendIntervalID=null);const e=this.messageQueue.shift();this.lastsend=Date.now(),this.emit(e.key,e.msg)},n))}handleData(e){const t={data:e.data,src:e.src};this.emit(Y.EVENTS.data.key,t)}handleLog(e){this.emit(Y.EVENTS.log.key,e)}getLog(){const e={roomName:this.name};this.emit(Y.MESSAGE_EVENTS.getLog.key,e)}static get EVENTS(){return z}static get MESSAGE_EVENTS(){return G}}var H=Y;const W=new o.a([]);W.extend(H.EVENTS.enums);const $=new o.a(["offerRequest","candidate"]);$.extend(H.MESSAGE_EVENTS.enums);class J extends H{constructor(e,t,n){super(e,t,n),this.remoteStreams={},this.members=[],this._open=!1,this._msidMap={},this._unknownStreams={},this._negotiator=new k}call(e){e&&(this._localStream=e);const t={roomName:this.name};this.emit(J.MESSAGE_EVENTS.offerRequest.key,t)}handleOffer(e){let t=e.offer;l.isPlanBSafari()&&(t=w.unifiedToPlanB(t)),this._connectionStarted?this._negotiator.handleOffer(t):(this._negotiator.startConnection({type:"media",stream:this._localStream,pcConfig:this._options.pcConfig,offer:t}),this._setupNegotiatorMessageHandlers(),this._connectionStarted=!0)}_setupNegotiatorMessageHandlers(){this._negotiator.on(k.EVENTS.addStream.key,e=>{const t=e;if(this._msidMap[t.id]){if(t.peerId=this._msidMap[t.id],t.peerId===this._peerId)return;const e=this.remoteStreams[t.id];if(e&&e.id===t.id)return;this.remoteStreams[t.id]=t,this.emit(J.EVENTS.stream.key,t),d.log(`Received remote media stream for ${t.peerId} in ${this.name}`)}else this._unknownStreams[t.id]=t}),this._negotiator.on(k.EVENTS.negotiationNeeded.key,()=>{const e={roomName:this.name};this.emit(J.MESSAGE_EVENTS.offerRequest.key,e)}),this._negotiator.on(k.EVENTS.answerCreated.key,e=>{l.isPlanBSafari()||(e.sdp=w.ensureUnifiedPlan(e.sdp));const t={roomName:this.name,answer:e};this.emit(J.MESSAGE_EVENTS.answer.key,t)}),this._negotiator.on(k.EVENTS.iceConnectionFailed.key,()=>{this.close()}),this._negotiator.on(k.EVENTS.iceCandidate.key,e=>{const t={roomName:this.name,candidate:e};this.emit(J.MESSAGE_EVENTS.candidate.key,t)})}handleJoin(e){const{src:t,roomMembers:n}=e;if(t===this._peerId)return this._open=!0,this.members=n.filter(e=>e!==t),this.call(this._localStream),void this.emit(J.EVENTS.open.key);this.members.push(t),this.emit(J.EVENTS.peerJoin.key,t)}handleLeave(e){if(!this._open)return;const t=e.src,n=this.members.indexOf(t);n>=0&&this.members.splice(n,1);for(const e in this.remoteStreams)this.remoteStreams[e].peerId===t&&(delete this.remoteStreams[e],delete this._msidMap[e],delete this._unknownStreams[e]);this.emit(J.EVENTS.peerLeave.key,t)}send(e){if(!this._open)return;if(!this.validateSendDataSize(e))return;const t={roomName:this.name,data:e};this._sendData(t,J.MESSAGE_EVENTS.broadcast.key)}close(){if(!this._open)return;this._negotiator&&this._negotiator.cleanup(),this._open=!1;const e={roomName:this.name};this.emit(J.MESSAGE_EVENTS.leave.key,e),this.emit(J.EVENTS.close.key)}replaceStream(e){this._localStream=e,this._negotiator.replaceStream(e)}updateMsidMap(e={}){this._msidMap=e;for(const e of Object.keys(this._unknownStreams))if(this._msidMap[e]){const t=this._unknownStreams[e];if(t.peerId=this._msidMap[t.id],delete this._unknownStreams[e],t.peerId===this._peerId)return;this.remoteStreams[t.id]=t,this.emit(J.EVENTS.stream.key,t)}}getPeerConnection(){return this._connectionStarted?this._negotiator._pc:null}static get EVENTS(){return W}static get MESSAGE_EVENTS(){return $}}var X=J;const K=new o.a([]);K.extend(H.EVENTS.enums);const Q=new o.a(["broadcastByDC","getPeers"]);Q.extend(H.MESSAGE_EVENTS.enums);class Z extends H{constructor(e,t,n){super(e,t,n),this.connections={},this._queuedMessages={}}call(e){e&&(this._localStream=e);const t={roomName:this.name,type:"media"};this.emit(Z.MESSAGE_EVENTS.getPeers.key,t)}connect(){const e={roomName:this.name,type:"data"};this.emit(Z.MESSAGE_EVENTS.getPeers.key,e)}makeMediaConnections(e){const t={stream:this._localStream,pcConfig:this._pcConfig,originator:!0,videoBandwidth:this._options.videoBandwidth,audioBandwidth:this._options.audioBandwidth,videoCodec:this._options.videoCodec,audioCodec:this._options.audioCodec,videoReceiveEnabled:this._options.videoReceiveEnabled,audioReceiveEnabled:this._options.audioReceiveEnabled};this._makeConnections(e,"media",t)}makeDataConnections(e){const t={pcConfig:this._pcConfig};this._makeConnections(e,"data",t)}handleJoin(e){const t=e.src;if(t===this._peerId)return this.call(this._localStream),void this.emit(Z.EVENTS.open.key);this.emit(Z.EVENTS.peerJoin.key,t)}handleLeave(e){const t=e.src;this._deleteConnections(t),this.emit(Z.EVENTS.peerLeave.key,t)}handleOffer(e){const t=e.connectionId;let n=this._getConnection(e.src,t);if(n)n.updateOffer(e);else if("media"===e.connectionType){if(this._hasConnection(e.src)&&this._peerId>e.src)return;n=new D(e.src,{connectionId:t,payload:e,metadata:e.metadata,queuedMessages:this._queuedMessages[t],pcConfig:this._pcConfig}),n.startConnection(),d.log("MediaConnection created in OFFER"),this._addConnection(e.src,n),this._setupMessageHandlers(n),n.answer(this._localStream,{videoBandwidth:this._options.videoBandwidth,audioBandwidth:this._options.audioBandwidth,videoCodec:this._options.videoCodec,audioCodec:this._options.audioCodec,videoReceiveEnabled:this._options.videoReceiveEnabled,audioReceiveEnabled:this._options.audioReceiveEnabled})}else d.warn("Received malformed connection type: "+e.connectionType)}handleAnswer(e){const t=this._getConnection(e.src,e.connectionId);t&&t.handleAnswer(e)}handleCandidate(e){const t=this._getConnection(e.src,e.connectionId);t?t.handleCandidate(e):(void 0===this._queuedMessages[e.connectionId]&&(this._queuedMessages[e.connectionId]=[]),this._queuedMessages[e.connectionId].push({type:h.MESSAGE_TYPES.SERVER.CANDIDATE.key,payload:e}))}send(e){if(!this.validateSendDataSize(e))return;const t={roomName:this.name,data:e};this._sendData(t,Z.MESSAGE_EVENTS.broadcast.key)}close(){for(const e in this.connections)this.connections.hasOwnProperty(e)&&this.connections[e].forEach(e=>{e.close(!1)});const e={roomName:this.name};this.emit(Z.MESSAGE_EVENTS.leave.key,e),this.emit(Z.EVENTS.close.key)}replaceStream(e){this._localStream=e;for(const t in this.connections)this.connections.hasOwnProperty(t)&&this.connections[t].forEach(t=>{"media"===t.type&&t.replaceStream(e)})}getPeerConnections(){const e={};for(const[t,[n]]of Object.entries(this.connections)){const r=n.getPeerConnection();r&&(e[t]=r)}return e}_addConnection(e,t){this.connections[e]||(this.connections[e]=[]),this.connections[e].push(t)}_makeConnections(e,t,n){e.filter(e=>e!==this._peerId).filter(e=>!this._hasConnection(e)).forEach(e=>{let r;switch(t){case"data":r=new M(e,n);break;case"media":r=new D(e,n);break;default:return}r.startConnection(),this._addConnection(e,r),this._setupMessageHandlers(r),d.log(`${t} connection to ${e} created in ${this.name}`)})}_deleteConnections(e){this.connections[e]&&delete this.connections[e]}_getConnection(e,t){if(this.connections&&this.connections[e]){return this.connections[e].filter(e=>e.id===t)[0]}return null}_hasConnection(e){return this.connections[e]&&this.connections[e].length>0}_setupMessageHandlers(e){e.on(T.EVENTS.offer.key,e=>{e.roomName=this.name,this.emit(Z.MESSAGE_EVENTS.offer.key,e)}),e.on(T.EVENTS.answer.key,e=>{e.roomName=this.name,this.emit(Z.MESSAGE_EVENTS.answer.key,e)}),e.on(T.EVENTS.candidate.key,e=>{e.roomName=this.name,this.emit(Z.MESSAGE_EVENTS.candidate.key,e)}),"media"===e.type&&e.on(D.EVENTS.stream.key,t=>{t.peerId=e.remoteId,this.emit(Z.EVENTS.stream.key,t)})}static get EVENTS(){return K}static get MESSAGE_EVENTS(){return Q}}var ee=Z;const te=new o.a(["open","error","call","connection","expiresin","close","disconnected"]);class ne extends i.a{constructor(e,t){super(),this.connections={},this.rooms={},this._queuedMessages={},e&&e.constructor===Object?(t=e,e=void 0):e&&(e=e.toString());const n={debug:d.LOG_LEVELS.NONE,secure:!0,config:h.defaultConfig,turn:!0,dispatcherSecure:h.DISPATCHER_SECURE,dispatcherHost:h.DISPATCHER_HOST,dispatcherPort:h.DISPATCHER_PORT};this.options=Object.assign({},n,t),this.options.token=l.randomToken(),d.setLogLevel(this.options.debug),l.validateId(e)?l.validateKey(t.key)?("/"===this.options.host&&(this.options.host=window.location.hostname),void 0===t.secure&&443!==this.options.port&&(this.options.secure=void 0),this._initializeServerConnection(e)):this._abort("invalid-key",`API KEY "${this.options.key}" is invalid`):this._abort("invalid-id",`ID "${e}" is invalid`)}call(e,t,n={}){if(!this._checkOpenStatus())return;n.originator=!0,n.stream=t,n.pcConfig=this._pcConfig;const r=new D(e,n);return r.startConnection(),d.log("MediaConnection created in call method"),this._addConnection(e,r),r}connect(e,t={}){if(!this._checkOpenStatus())return;t.pcConfig=this._pcConfig;const n=new M(e,t);return n.startConnection(),d.log("DataConnection created in connect method"),this._addConnection(e,n),n}joinRoom(e,t={}){if(this._checkOpenStatus()){if(!e){const e=new Error("Room name must be defined.");return e.type="room-error",d.error(e),this.emit(ne.EVENTS.error.key,e),null}return t.pcConfig=this._pcConfig,t.peerId=this.id,"sfu"===t.mode?this._initializeSfuRoom(e,t):this._initializeFullMeshRoom(e,t)}}getConnection(e,t){if(this._checkOpenStatus()){if(this.connections[e])for(const n of this.connections[e])if(n.id===t)return n;return null}}get open(){return this.socket&&this.socket.isOpen}destroy(){this._cleanup(),this.disconnect(!0)}disconnect(e=!1){e||d.warn("Use peer's destroy method instead. This method may be removed in future versions."),this.open&&(this.socket.close(),this.emit(ne.EVENTS.disconnected.key,this.id))}reconnect(){d.warn("Recreate peer instance instead. This method may be removed in future versions."),this.open||this.socket.reconnect()}updateCredential(e){this.socket.updateCredential(e)}listAllPeers(e){if(!this._checkOpenStatus())return;e=e||function(){};const t=this,n=new XMLHttpRequest,r=`${this.socket.signalingServerUrl}/api/apikeys/${this.options.key}/clients/`;n.open("get",r,!0),n.onerror=function(){t._abort("server-error","Could not get peers from the server."),e([])},n.onreadystatechange=function(){if(4===n.readyState)if(401===n.status){e([]);const n=new Error("It doesn't look like you have permission to list peers IDs. Please enable the SkyWay REST API on dashboard");n.type="list-error",d.error(n),t.emit(ne.EVENTS.error.key,n)}else 200===n.status?e(JSON.parse(n.responseText)):e([])},n.send(null)}async fetchPeerExists(e){if(!this.open)throw new Error("Peer is not yet connected to signaling server");const t=(new Date).getTime();if(void 0!==this._lastFetchPeerExistsTime&&t-this._lastFetchPeerExistsTime<1e3)throw new Error("fetchPeerExists can only be called once per second");this._lastFetchPeerExistsTime=t;const n=`${this.socket.signalingServerUrl}/api/apikeys/${this.options.key}/peers/${e}/exists`,r=await fetch(n);if(200===r.status){return(await r.json()).exists}{const e=await r.text();throw new Error(e)}}_checkOpenStatus(){return this.open||this._emitNotConnectedError(),this.open}_emitNotConnectedError(){d.warn("You cannot connect to a new Peer because you are not connecting to SkyWay server now.You can create a new Peer to reconnect, or call reconnect() on this peer if you believe its ID to still be available.");const e=new Error("Cannot connect to new Peer before connecting to SkyWay server or after disconnecting from the server.");e.type="disconnected",d.error(e),this.emit(ne.EVENTS.error.key,e)}_initializeServerConnection(e){this.socket=new g(this.options.key,{secure:this.options.secure,host:this.options.host,port:this.options.port,dispatcherSecure:this.options.dispatcherSecure,dispatcherHost:this.options.dispatcherHost,dispatcherPort:this.options.dispatcherPort}),this._setupMessageHandlers(),this.socket.on("error",e=>{this._abort("socket-error",e)}),this.socket.on("disconnect",()=>{this.disconnect(!0);const e=new Error("Lost connection to server.");e.type="socket-error",d.error(e),this.emit(ne.EVENTS.error.key,e)}),this.socket.start(e,this.options.token,this.options.credential)}_initializeSfuRoom(e,t={}){if(this.rooms[e])return this.rooms[e];const n=new X(e,this.id,t);this.rooms[e]=n,this._setupSFURoomMessageHandlers(n);const r={roomName:e,roomType:"sfu"};return this.socket.send(h.MESSAGE_TYPES.CLIENT.ROOM_JOIN.key,r),n}_initializeFullMeshRoom(e,t={}){if(this.rooms[e])return this.rooms[e];const n=new ee(e,this.id,t);this.rooms[e]=n,this._setupMeshRoomMessageHandlers(n);const r={roomName:e,roomType:"mesh"};return this.socket.send(h.MESSAGE_TYPES.CLIENT.ROOM_JOIN.key,r),n}_setupMessageHandlers(){this.socket.on(h.MESSAGE_TYPES.SERVER.OPEN.key,e=>{this.id=e.peerId,this._pcConfig=Object.assign({},this.options.config);const t=this._pcConfig.iceServers;this._pcConfig.iceServers=t?t.slice():[];const n=e.turnCredential;let r,i;if("object"==typeof n?(r=n.username,i=n.credential):"string"==typeof n&&(r=`${this.options.key}$${this.id}`,i=n),!0===this.options.turn&&r&&i){const e=[{protocol:"turn",transport:"tcp"},{protocol:"turn",transport:"udp"}];"edge"!==l.detectBrowser().name&&e.push({protocol:"turns",transport:"tcp"});for(const t of e){const e=t.protocol,n=t.transport,o={urls:`${e}:${h.TURN_HOST}:${h.TURN_PORT}?transport=${n}`,url:`${e}:${h.TURN_HOST}:${h.TURN_PORT}?transport=${n}`,username:r,credential:i};this._pcConfig.iceServers.push(o)}d.log("SkyWay TURN Server is available")}else d.log("SkyWay TURN Server is unavailable");this.emit(ne.EVENTS.open.key,this.id)}),this.socket.on(h.MESSAGE_TYPES.SERVER.ERROR.key,e=>{const t=new Error(e.message);t.type=e.type,d.error(t),this.emit(ne.EVENTS.error.key,t)}),this.socket.on(h.MESSAGE_TYPES.SERVER.LEAVE.key,e=>{d.log("Received leave message from "+e),this._cleanupPeer(e)}),this.socket.on(h.MESSAGE_TYPES.SERVER.FORCE_CLOSE.key,({src:e,connectionId:t})=>{const n=this.getConnection(e,t);n&&n.close(!1)}),this.socket.on(h.MESSAGE_TYPES.SERVER.AUTH_EXPIRES_IN.key,e=>{d.log("Credential expires in "+e),this.emit(ne.EVENTS.expiresin.key,e)}),this.socket.on(h.MESSAGE_TYPES.SERVER.OFFER.key,e=>{const t=e.roomName;if(t){const n=this.rooms[t];return void(n&&n.handleOffer(e))}const n=e.connectionId;let r=this.getConnection(e.src,n);r?r.updateOffer(e):("media"===e.connectionType?(r=new D(e.src,{connectionId:n,payload:e,metadata:e.metadata,originator:!1,queuedMessages:this._queuedMessages[n],pcConfig:this._pcConfig}),r.startConnection(),d.log("MediaConnection created in OFFER"),this._addConnection(e.src,r),this.emit(ne.EVENTS.call.key,r)):"data"===e.connectionType?(r=new M(e.src,{connectionId:n,payload:e,metadata:e.metadata,label:e.label,dcInit:e.dcInit,serialization:e.serialization,queuedMessages:this._queuedMessages[n],pcConfig:this._pcConfig}),r.startConnection(),d.log("DataConnection created in OFFER"),this._addConnection(e.src,r),this.emit(ne.EVENTS.connection.key,r)):d.warn("Received malformed connection type: ",e.connectionType),delete this._queuedMessages[n])}),this.socket.on(h.MESSAGE_TYPES.SERVER.ANSWER.key,e=>{const t=e.roomName;if(t){const n=this.rooms[t];return void(n&&n.handleAnswer(e))}const n=this.getConnection(e.src,e.connectionId);n?n.handleAnswer(e):this._storeMessage(h.MESSAGE_TYPES.SERVER.ANSWER.key,e)}),this.socket.on(h.MESSAGE_TYPES.SERVER.CANDIDATE.key,e=>{const t=e.roomName;if(t){const n=this.rooms[t];return void(n&&n.handleCandidate(e))}const n=this.getConnection(e.src,e.connectionId);n?n.handleCandidate(e):this._storeMessage(h.MESSAGE_TYPES.SERVER.CANDIDATE.key,e)}),this.socket.on(h.MESSAGE_TYPES.SERVER.ROOM_USER_JOIN.key,e=>{const t=this.rooms[e.roomName];t&&t.handleJoin(e)}),this.socket.on(h.MESSAGE_TYPES.SERVER.ROOM_USER_LEAVE.key,e=>{const t=this.rooms[e.roomName];t&&t.handleLeave(e)}),this.socket.on(h.MESSAGE_TYPES.SERVER.ROOM_DATA.key,e=>{const t=this.rooms[e.roomName];t&&t.handleData(e)}),this.socket.on(h.MESSAGE_TYPES.SERVER.ROOM_LOGS.key,e=>{const t=this.rooms[e.roomName];t&&t.handleLog(e.log)}),this.socket.on(h.MESSAGE_TYPES.SERVER.ROOM_USERS.key,e=>{const t=this.rooms[e.roomName];t&&("media"===e.type?t.makeMediaConnections(e.userList):t.makeDataConnections(e.userList))}),this.socket.on(h.MESSAGE_TYPES.SERVER.SFU_OFFER.key,e=>{const t=this.rooms[e.roomName];t&&(t.updateMsidMap(e.msids),t.handleOffer(e))})}_setupConnectionMessageHandlers(e){e.on(T.EVENTS.candidate.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SEND_CANDIDATE.key,e)}),e.on(T.EVENTS.answer.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SEND_ANSWER.key,e)}),e.on(T.EVENTS.offer.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SEND_OFFER.key,e)}),e.on(T.EVENTS.forceClose.key,()=>{const t={dst:e.remoteId,connectionId:e.id};this.socket.send(h.MESSAGE_TYPES.CLIENT.SEND_FORCE_CLOSE.key,t)})}_setupRoomMessageHandlers(e){e.on(X.MESSAGE_EVENTS.broadcast.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.ROOM_SEND_DATA.key,e)}),e.on(X.MESSAGE_EVENTS.getLog.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.ROOM_GET_LOGS.key,e)}),e.on(X.MESSAGE_EVENTS.leave.key,t=>{delete this.rooms[e.name],this.socket.send(h.MESSAGE_TYPES.CLIENT.ROOM_LEAVE.key,t)})}_setupSFURoomMessageHandlers(e){this._setupRoomMessageHandlers(e),e.on(X.MESSAGE_EVENTS.offerRequest.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SFU_GET_OFFER.key,e)}),e.on(X.MESSAGE_EVENTS.answer.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SFU_ANSWER.key,e)}),e.on(X.MESSAGE_EVENTS.candidate.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SFU_CANDIDATE.key,e)})}_setupMeshRoomMessageHandlers(e){this._setupRoomMessageHandlers(e),e.on(ee.MESSAGE_EVENTS.offer.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SEND_OFFER.key,e)}),e.on(ee.MESSAGE_EVENTS.answer.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SEND_ANSWER.key,e)}),e.on(ee.MESSAGE_EVENTS.candidate.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.SEND_CANDIDATE.key,e)}),e.on(ee.MESSAGE_EVENTS.getPeers.key,e=>{this.socket.send(h.MESSAGE_TYPES.CLIENT.ROOM_GET_USERS.key,e)})}_abort(e,t){d.error("Aborting!"),this.disconnect(!0);const n=new Error(t);n.type=e,d.error(n),this.emit(ne.EVENTS.error.key,n)}_addConnection(e,t){this.connections[e]||(this.connections[e]=[]),this.connections[e].push(t),this._setupConnectionMessageHandlers(t)}_storeMessage(e,t){this._queuedMessages[t.connectionId]||(this._queuedMessages[t.connectionId]=[]),this._queuedMessages[t.connectionId].push({type:e,payload:t})}_cleanup(){if(this.connections)for(const e of Object.keys(this.connections))this._cleanupPeer(e);this.emit(ne.EVENTS.close.key)}_cleanupPeer(e){if(this.connections[e])for(const t of this.connections[e])t.close(!1)}static get EVENTS(){return te}}t.default=ne}]).default}));