cdnbye
Version:
Save Your Bandwidth using WebRTC.
1 lines • 360 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Hls=t():e.Hls=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,s,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,l=0;l<i;l++)u[l].apply(this,s);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(i=o(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,i,o,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],o=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(r)){for(s=o;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=s;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";(function(e){var r,n,i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(o,s){"object"==a(t)&&"object"==a(e)?e.exports=s():(n=[],r=s,void 0!==(i="function"==typeof r?r.apply(t,n):r)&&(e.exports=i))}("undefined"!=typeof self&&self,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default={DC_PING:"PING",DC_PONG:"PONG",DC_SIGNAL:"SIGNAL",DC_OPEN:"OPEN",DC_REQUEST:"REQUEST",DC_PIECE_NOT_FOUND:"PIECE_NOT_FOUND",DC_CLOSE:"CLOSE",DC_RESPONSE:"RESPONSE",DC_ERROR:"ERROR",DC_PIECE:"PIECE",DC_TIMEOUT:"TIMEOUT",DC_PIECE_ACK:"PIECE_ACK",DC_BITFIELD:"BITFIELD",DC_CHOKE:"CHOKE",DC_UNCHOKE:"UNCHOKE",DC_USELESS:"USELESS",DC_HAVE:"HAVE",DC_LOST:"LOST",BM_LOST:"lost",FRAG_CHANGED:"FRAG_CHANGED",FRAG_LOADED:"FRAG_LOADED",FRAG_LOADING:"FRAG_LOADING",RESTART_P2P:"RESTART_P2P"},e.exports=t.default},function(e,t,r){var n;"function"==typeof Symbol&&Symbol.iterator,function(i){function a(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function o(e,t){return e<<t|e>>>32-t}function s(e,t,r,n,i,s){return a(o(a(a(t,e),a(n,s)),i),r)}function l(e,t,r,n,i,a,o){return s(t&r|~t&n,e,t,i,a,o)}function u(e,t,r,n,i,a,o){return s(t&n|r&~n,e,t,i,a,o)}function c(e,t,r,n,i,a,o){return s(t^r^n,e,t,i,a,o)}function d(e,t,r,n,i,a,o){return s(r^(t|~n),e,t,i,a,o)}function f(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var r,n,i,o,s,f=1732584193,h=-271733879,p=-1732584194,g=271733878;for(r=0;r<e.length;r+=16)n=f,i=h,o=p,s=g,f=l(f,h,p,g,e[r],7,-680876936),g=l(g,f,h,p,e[r+1],12,-389564586),p=l(p,g,f,h,e[r+2],17,606105819),h=l(h,p,g,f,e[r+3],22,-1044525330),f=l(f,h,p,g,e[r+4],7,-176418897),g=l(g,f,h,p,e[r+5],12,1200080426),p=l(p,g,f,h,e[r+6],17,-1473231341),h=l(h,p,g,f,e[r+7],22,-45705983),f=l(f,h,p,g,e[r+8],7,1770035416),g=l(g,f,h,p,e[r+9],12,-1958414417),p=l(p,g,f,h,e[r+10],17,-42063),h=l(h,p,g,f,e[r+11],22,-1990404162),f=l(f,h,p,g,e[r+12],7,1804603682),g=l(g,f,h,p,e[r+13],12,-40341101),p=l(p,g,f,h,e[r+14],17,-1502002290),h=l(h,p,g,f,e[r+15],22,1236535329),f=u(f,h,p,g,e[r+1],5,-165796510),g=u(g,f,h,p,e[r+6],9,-1069501632),p=u(p,g,f,h,e[r+11],14,643717713),h=u(h,p,g,f,e[r],20,-373897302),f=u(f,h,p,g,e[r+5],5,-701558691),g=u(g,f,h,p,e[r+10],9,38016083),p=u(p,g,f,h,e[r+15],14,-660478335),h=u(h,p,g,f,e[r+4],20,-405537848),f=u(f,h,p,g,e[r+9],5,568446438),g=u(g,f,h,p,e[r+14],9,-1019803690),p=u(p,g,f,h,e[r+3],14,-187363961),h=u(h,p,g,f,e[r+8],20,1163531501),f=u(f,h,p,g,e[r+13],5,-1444681467),g=u(g,f,h,p,e[r+2],9,-51403784),p=u(p,g,f,h,e[r+7],14,1735328473),h=u(h,p,g,f,e[r+12],20,-1926607734),f=c(f,h,p,g,e[r+5],4,-378558),g=c(g,f,h,p,e[r+8],11,-2022574463),p=c(p,g,f,h,e[r+11],16,1839030562),h=c(h,p,g,f,e[r+14],23,-35309556),f=c(f,h,p,g,e[r+1],4,-1530992060),g=c(g,f,h,p,e[r+4],11,1272893353),p=c(p,g,f,h,e[r+7],16,-155497632),h=c(h,p,g,f,e[r+10],23,-1094730640),f=c(f,h,p,g,e[r+13],4,681279174),g=c(g,f,h,p,e[r],11,-358537222),p=c(p,g,f,h,e[r+3],16,-722521979),h=c(h,p,g,f,e[r+6],23,76029189),f=c(f,h,p,g,e[r+9],4,-640364487),g=c(g,f,h,p,e[r+12],11,-421815835),p=c(p,g,f,h,e[r+15],16,530742520),h=c(h,p,g,f,e[r+2],23,-995338651),f=d(f,h,p,g,e[r],6,-198630844),g=d(g,f,h,p,e[r+7],10,1126891415),p=d(p,g,f,h,e[r+14],15,-1416354905),h=d(h,p,g,f,e[r+5],21,-57434055),f=d(f,h,p,g,e[r+12],6,1700485571),g=d(g,f,h,p,e[r+3],10,-1894986606),p=d(p,g,f,h,e[r+10],15,-1051523),h=d(h,p,g,f,e[r+1],21,-2054922799),f=d(f,h,p,g,e[r+8],6,1873313359),g=d(g,f,h,p,e[r+15],10,-30611744),p=d(p,g,f,h,e[r+6],15,-1560198380),h=d(h,p,g,f,e[r+13],21,1309151649),f=d(f,h,p,g,e[r+4],6,-145523070),g=d(g,f,h,p,e[r+11],10,-1120210379),p=d(p,g,f,h,e[r+2],15,718787259),h=d(h,p,g,f,e[r+9],21,-343485551),f=a(f,n),h=a(h,i),p=a(p,o),g=a(g,s);return[f,h,p,g]}function h(e){var t,r="",n=32*e.length;for(t=0;t<n;t+=8)r+=String.fromCharCode(e[t>>5]>>>t%32&255);return r}function p(e){var t,r=[];for(r[(e.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var n=8*e.length;for(t=0;t<n;t+=8)r[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return r}function g(e){return h(f(p(e),8*e.length))}function v(e,t){var r,n,i=p(e),a=[],o=[];for(a[15]=o[15]=void 0,i.length>16&&(i=f(i,8*e.length)),r=0;r<16;r+=1)a[r]=909522486^i[r],o[r]=1549556828^i[r];return n=f(a.concat(p(t)),512+8*t.length),h(f(o.concat(n),640))}function y(e){var t,r,n="0123456789abcdef",i="";for(r=0;r<e.length;r+=1)t=e.charCodeAt(r),i+=n.charAt(t>>>4&15)+n.charAt(15&t);return i}function m(e){return unescape(encodeURIComponent(e))}function _(e){return g(m(e))}function b(e){return y(_(e))}function E(e,t){return v(m(e),m(t))}function S(e,t){return y(E(e,t))}function T(e,t,r){return t?r?E(t,e):S(t,e):r?_(e):b(e)}void 0!==(n=function(){return T}.call(t,r,t,e))&&(e.exports=n)}()},function(e,t,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function s(e){return"object"===(void 0===e?"undefined":u(e))&&null!==e}function l(e){return void 0===e}var u="function"==typeof Symbol&&"symbol"==a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":a(e)};e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,a,o,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(r=this._events[e],l(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(s(r))for(a=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,o=0;o<n;o++)u[o].apply(this,a);return!0},n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=l(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,t){var r,n,a,o;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(o=a;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){n=o;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],i(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){function n(e){if(e>b)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return o(e,t,r)}function o(e,t,r){if("string"==typeof e)return c(e,t);if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+(void 0===e?"undefined":_(e)));if(y(e,ArrayBuffer)||e&&y(e.buffer,ArrayBuffer))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return i.from(n,t,r);var a=h(e);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return i.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+(void 0===e?"undefined":_(e)))}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e,t,r){return s(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}function u(e){return s(e),n(e<0?0:0|p(e))}function c(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|g(e,t),a=n(r),o=a.write(e,t);return o!==r&&(a=a.slice(0,o)),a}function d(e){for(var t=e.length<0?0:0|p(e.length),r=n(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),n.__proto__=i.prototype,n}function h(e){if(i.isBuffer(e)){var t=0|p(e.length),r=n(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}return void 0!==e.length?"number"!=typeof e.length||m(e.length)?n(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}function p(e){if(e>=b)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+b.toString(16)+" bytes");return 0|e}function g(e,t){if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+(void 0===e?"undefined":_(e)));var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return v(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;default:if(a)return n?-1:v(e).length;t=(""+t).toLowerCase(),a=!0}}function v(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function m(e){return e!==e}var _="function"==typeof Symbol&&"symbol"==a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":a(e)};t.Buffer=i;var b=2147483647;t.kMaxLength=b,i.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&null!=Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.from=function(e,t,r){return o(e,t,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,r){return l(e,t,r)},i.allocUnsafe=function(e){return u(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==i.prototype},i.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}},i.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return i.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=i.allocUnsafe(t),a=0;for(r=0;r<e.length;++r){var o=e[r];if(y(o,Uint8Array)&&(o=i.from(o)),!i.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,a),a+=o.length}return n},i.byteLength=g,i.prototype._isBuffer=!0,i.prototype.copy=function(e,t,r,n){if(!i.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var a=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=a-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return a}},function(e,t,r){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.getPeersThrottle=t.getBrowserRTC=t.Buffer=t.Fetcher=t.Events=t.DataChannel=void 0;var i=r(5),a=n(i),o=r(0),s=n(o),l=r(8),u=n(l),c=r(11),d=n(c),f=r(12),h=n(f),p=r(3).Buffer;t.DataChannel=a.default,t.Events=s.default,t.Fetcher=u.default,t.Buffer=p,t.getBrowserRTC=d.default,t.getPeersThrottle=h.default},function(e,t,r){function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=(void 0===t?"undefined":a(t))&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":a(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t,r,n){var i=[];if(n){for(var a=void 0,o=0;o<r-1;o++)a=e[c("0x72")](o*t,(o+1)*t),i[c("0x42")](a);a=e[c("0x72")](e[c("0x51")]-n,e[c("0x51")]),i.push(a)}else for(var s=void 0,l=0;l<r;l++)s=e[c("0x72")](l*t,(l+1)*t),i.push(s);return i}var u=["bXNnUXVldWU=","bWlzcw==","Yml0c2V0","Y29ublRpbWVvdXQ=","c2V0VGltZW91dA==","ZGMg","IGNvbm5lY3Rpb24gdGltZW91dA==","ZW1pdA==","ZGVmYXVsdA==","RENfRVJST1I=","cmN2ZFJlcVF1ZXVl","Y2hva2Vk","ZGVsYXlz","ZmV0Y2hlcg==","dGltZXN0YW1w","dmVyc2lvbg==","X2RhdGFjaGFubmVs","Y29uZmln","d2ViUlRDQ29uZmln","aXNJbml0aWF0b3I=","X2luaXQ=","c2lnbmFs","RENfU0lHTkFM","aW5mbw==","ZGF0YWNoYW5uZWwgQ09OTkVDVEVEIHRvIA==","cmVtb3RlUGVlcklk","Y2xlYXJUaW1lb3V0","c2hpZnQ=","b25jZQ==","Y29ubmVjdA==","c3RyaW5n","ZGVidWc=","ZGF0YWNoYW5uZWwgcmVjZWl2ZSBzdHJpbmc6IA==","IGZyb20g","ZXZlbnQ=","X2hhbmRsZVBvbmdNc2c=","RENfUElORw==","RENfUE9ORw==","X3ByZXBhcmVGb3JCaW5hcnk=","YXR0YWNobWVudHM=","c2l6ZQ==","bGV2ZWw=","ZG93bmxvYWROdW0=","RENfUElFQ0VfTk9UX0ZPVU5EIGRvd25sb2FkTnVtIA==","X2hhbmRsZVJlcXVlc3RNc2c=","RENfUElFQ0VfQUNL","X2hhbmRsZVBpZWNlQWNr","RENfQ0hPS0U=","RENfQ0xPU0U=","YnVmQXJy","cHVzaA==","cmVtYWluQXR0YWNobWVudHM=","YnVmU04=","c2VnSWQ=","ZXhwZWN0ZWRTaXpl","X2hhbmRsZUJpbmFyeURhdGE=","Y2xvc2U=","c2VuZEpzb24=","c2VuZA==","c3RyaW5naWZ5","d2Fybg==","ZGF0YWNoYW5uZWwg","IHNlbmQgZGF0YSBmYWlsZWQsIGNsb3NlIGl0","c2VuZEJpdEZpZWxk","c2VuZEJ1ZmZlcg==","Ynl0ZUxlbmd0aA==","Zmxvb3I=","c2VnX2lk","cmVxdWVzdERhdGFCeUlk","cmVxdWVzdERhdGFCeVNO","dXJnZW50","cmVjZWl2ZVNpZ25hbA==","ZGVzdHJveQ==","Y2hva2VUaW1lcg==","cmVtb3ZlQWxsTGlzdGVuZXJz","YWRkIHJlcXVlc3Qgc24g","IHRvIHJjdmRSZXFRdWV1ZQ==","dW5zaGlmdA==","RENfUkVRVUVTVA==","Z2V0UmVxdWVzdEZyb21RdWV1ZQ==","Y29uY2F0","ZXhwZWN0ZWRTaXplIA==","LCBieXRlTGVuZ3RoIA==","cmVwb3J0RENUcmFmZmlj","RENfUkVTUE9OU0U=","ZXJyb3I=","IG5vdCBlcXVhbCB0byBieXRlTGVuZ3RoIA==","ZGF0YWNoYW5uZWwgZmluaXNoIGRvd25sb2FkaW5nIA==","bG9hZHRpbWVvdXQ=","IGlzIGNob2tlZA==","cmN2ZFJlcVF1ZXVlIHBvcCA=","cGVlciBhbHJlYWR5IGhhcyA=","LCBub3RpZnkgcGVlcg==","RENfUElFQ0VfTk9UX0ZPVU5E","bm93","cGluZw==","aXNBdmFpbGFibGU=","aXNBdmFpbGFibGVVcmdlbnRseQ==","c2xpY2U=","X19lc01vZHVsZQ==","YXNzaWdu","bGVuZ3Ro","Y2FsbA==","ZW51bWVyYWJsZQ==","Y29uZmlndXJhYmxl","d3JpdGFibGU=","a2V5","cHJvdG90eXBl","VkVSU0lPTg==","X19wcm90b19f","Z2V0UHJvdG90eXBlT2Y=","ZW5naW5l","bG9nZ2Vy","Y2hhbm5lbElk","Y29ubmVjdGVk"];!function(e,t){!function(t){for(;--t;)e.push(e.shift())}(++t)}(u,329);var c=function e(t,r){t-=0;var n=u[t];void 0===e.veeqZI&&(function(){var e=function(){var e;try{e=Function('return (function() {}.constructor("return this")( ));')()}catch(t){e=window}return e}();e.atob||(e.atob=function(e){for(var t,r,n=String(e).replace(/=+$/,""),i=0,a=0,o="";r=n.charAt(a++);~r&&(t=i%4?64*t+r:r,i++%4)?o+=String.fromCharCode(255&t>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o})}(),e.qAQOeQ=function(e){for(var t=atob(e),r=[],n=0,i=t.length;n<i;n++)r+="%"+("00"+t.charCodeAt(n).toString(16)).slice(-2);return decodeURIComponent(r)},e.xUFsTT={},e.veeqZI=!![]);var i=e.xUFsTT[t];return void 0===i?(n=e.qAQOeQ(n),e.xUFsTT[t]=n):n=i,n};Object.defineProperty(t,c("0x0"),{value:!![]});var d=Object[c("0x1")]||function(e){for(var t=1;t<arguments[c("0x2")];t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty[c("0x3")](r,n)&&(e[n]=r[n])}return e},f=function(){function e(e,t){for(var r=0;r<t[c("0x2")];r++){var n=t[r];n[c("0x4")]=n[c("0x4")]||![],n[c("0x5")]=!![],"value"in n&&(n[c("0x6")]=!![]),Object.defineProperty(e,n[c("0x7")],n)}}return function(t,r,n){return r&&e(t[c("0x8")],r),n&&e(t,n),t}}(),h=r(6),p=n(h),g=r(2),v=n(g),y=r(0),m=n(y),_=r(3).Buffer,b=function(e){function t(e,r,n,a,s){i(this,t);var l=o(this,(t[c("0xa")]||Object[c("0xb")](t))[c("0x3")](this));l[c("0xc")]=e,l[c("0xd")]=e[c("0xd")],l.config=s,l.remotePeerId=n,l[c("0xe")]=a?r+"-"+n:n+"-"+r,l[c("0xf")]=![],l[c("0x10")]=[],l[c("0x11")]=0,l[c("0x12")],l.bufArr=[],l[c("0x13")]=window[c("0x14")](function(){l.logger.warn(c("0x15")+l[c("0xe")]+c("0x16")),l[c("0x17")](m[c("0x18")][c("0x19")])},2e4),l[c("0x1a")]=[],l.uploading=![],l[c("0x1b")]=![],l[c("0x1c")]=[];var u=l[c("0xc")][c("0x1d")],f=u[c("0xe")],h=u.id,g=u[c("0x1e")],v=u.v,y=l[c("0xc")][c("0x1f")];return l[c("0x20")]=new(p[c("0x18")])(d({initiator:a,channelName:l[c("0xe")],objectMode:!![],signInfo:{channelId:f,id:h,timestamp:g,version:y,v:v}},l[c("0x21")][c("0x22")])),l[c("0x23")]=a,l[c("0x24")](l[c("0x20")]),l.downloadNum=0,l}return s(t,e),f(t,null,[{key:c("0x9"),get:function(){return"v2"}}]),f(t,[{key:"_init",value:function(e){var t=this;e.on("error",function(e){t[c("0x17")](m[c("0x18")][c("0x19")])}),e.on(c("0x25"),function(e){t.emit(m[c("0x18")][c("0x26")],e)});var r=function(){for(t.logger[c("0x27")](c("0x28")+t[c("0x29")]),t[c("0xf")]=!![],window[c("0x2a")](t[c("0x13")]),t[c("0x17")](m.default.DC_OPEN);t[c("0x10")][c("0x2")]>0;){var e=t[c("0x10")][c("0x2b")]();t[c("0x17")](e.event,e)}};e[c("0x2c")](c("0x2d"),r),e.on("data",function(e){if((void 0===e?"undefined":a(e))===c("0x2e")){t[c("0xd")][c("0x2f")](c("0x30")+e+c("0x31")+t[c("0x29")]);var r=JSON.parse(e);if(!t[c("0xf")])return void t[c("0x10")].push(r);switch(r[c("0x32")]){case m[c("0x18")].DC_PONG:t[c("0x33")]();break;case m[c("0x18")][c("0x34")]:t.sendJson({event:m.default[c("0x35")]});break;case m[c("0x18")].DC_PIECE:t[c("0x36")](r[c("0x37")],r.seg_id,r.sn,r[c("0x38")],r[c("0x39")]),t[c("0x17")](r[c("0x32")],r);break;case m[c("0x18")].DC_PIECE_NOT_FOUND:t[c("0x3a")]--,console.warn(c("0x3b")+t[c("0x3a")]),t[c("0x17")](r.event,r);break;case m[c("0x18")].DC_REQUEST:t[c("0x3c")](r);break;case m.default[c("0x3d")]:t[c("0x3e")](),t[c("0x17")](r.event,r);break;case m[c("0x18")][c("0x3f")]:t[c("0x1b")]=!![];break;case m.default.DC_UNCHOKE:t[c("0x1b")]=![];break;case m[c("0x18")][c("0x40")]:t[c("0x17")](m.default[c("0x40")]);break;default:t.emit(r[c("0x32")],r)}}else t[c("0x41")][c("0x42")](e),t.remainAttachments--,0===t[c("0x43")]&&(t[c("0x3a")]--,t.sendJson({event:m.default.DC_PIECE_ACK,sn:t[c("0x44")],seg_id:t[c("0x45")],size:t[c("0x46")]}),t[c("0x47")]())}),e[c("0x2c")](c("0x48"),function(){t[c("0x17")](m.default[c("0x40")])})}},{key:c("0x49"),value:function(e){this[c("0x4a")](JSON[c("0x4b")](e))}},{key:c("0x4a"),value:function(e){if(this[c("0x20")]&&this._datachannel[c("0xf")])try{this[c("0x20")][c("0x4a")](e)}catch(e){this[c("0xd")][c("0x4c")](c("0x4d")+this[c("0xe")]+c("0x4e")),this[c("0x17")](m[c("0x18")][c("0x19")])}}},{key:c("0x4f"),value:function(e){this[c("0x49")]({event:m[c("0x18")].DC_BITFIELD,field:e})}},{key:c("0x50"),value:function(e,t,r,n){this.uploading=!![];var i=n[c("0x51")],a=65536,o=0,s=0;i%a==0?s=i/a:(s=Math[c("0x52")](i/a)+1,o=i%a);var u={};u[c("0x32")]=m.default.DC_PIECE,u[c("0x37")]=s,u[c("0x53")]=r,u.sn=e,u.level=t,u.size=i,this.sendJson(u);for(var d=l(n,a,s,o),f=0;f<d[c("0x2")];f++)this[c("0x4a")](d[f])}},{key:c("0x54"),value:function(e,t){var r=arguments[c("0x2")]>2&&void 0!==arguments[2]?arguments[2]:![];this.downloadNum++;var n={};n[c("0x32")]=m.default.DC_REQUEST,n.seg_id=e,n.sn=t,n.urgent=r,this[c("0x49")](n)}},{key:c("0x55"),value:function(e){var t=arguments[c("0x2")]>1&&void 0!==arguments[1]?arguments[1]:![];this[c("0x3a")]++;var r={};r.event=m.default.DC_REQUEST,r.sn=e,r[c("0x56")]=t,this[c("0x49")](r)}},{key:c("0x48"),value:function(){this[c("0x17")](m.default[c("0x40")])}},{key:c("0x57"),value:function(e){this[c("0x20")][c("0x25")](e)}},{key:c("0x58"),value:function(){this[c("0xd")].warn("destroy datachannel "+this.channelId),this[c("0x59")]&&window.clearTimeout(this[c("0x59")]),this.connTimeout&&window.clearTimeout(this[c("0x13")]);var e={};e[c("0x32")]=m.default.DC_CLOSE,this[c("0x49")](e),this[c("0x20")].removeAllListeners(),this[c("0x5a")](),this[c("0x20")][c("0x58")]()}},{key:"_handleRequestMsg",value:function(e){this.uploading||this[c("0x1a")][c("0x2")]>0?(this.logger.info(c("0x5b")+e.sn+c("0x5c")),e.urgent?this[c("0x1a")][c("0x42")](e.sn):this.rcvdReqQueue[c("0x5d")](e.sn)):this[c("0x17")](m[c("0x18")][c("0x5e")],e)}},{key:c("0x3e"),value:function(){this.uploading=![];var e=this[c("0x5f")]();e&&this[c("0x17")](m[c("0x18")][c("0x5e")],{sn:e})}},{key:c("0x36"),value:function(e,t,r,n,i){this.bufArr=[],this.remainAttachments=e,this[c("0x45")]=t,this[c("0x39")]=i,this.bufSN=r,this[c("0x46")]=n}},{key:"_handleBinaryData",value:function(){var e=_[c("0x60")](this[c("0x41")]);if(this[c("0xd")][c("0x2f")](c("0x61")+this[c("0x46")]+c("0x62")+e.byteLength),e[c("0x51")]==this.expectedSize){this[c("0xc")][c("0x1d")]?this.engine[c("0x1d")][c("0x63")](this.expectedSize):console.warn("DC report failed");var t=new Uint8Array(e).buffer;this[c("0x17")](m[c("0x18")][c("0x64")],{seg_id:this[c("0x45")],sn:this[c("0x44")],data:t,level:this.level})}else this[c("0xd")][c("0x65")]("expectedSize "+this.expectedSize+c("0x66")+e.byteLength);this[c("0xd")][c("0x27")](c("0x67")+this.segId+c("0x31")+this[c("0x29")]),this[c("0x45")]="",this.bufArr=[],this[c("0x46")]=-1}},{key:c("0x68"),value:function(){var e=this;if(this.logger[c("0x4c")]("datachannel timeout while downloading from "+this[c("0x29")]),this[c("0x17")](m[c("0x18")].DC_TIMEOUT),this[c("0x11")]++,this.miss>=4&&!this[c("0x1b")]){var t=10*this[c("0x11")];this.logger.warn(c("0x4d")+this[c("0xe")]+c("0x69")),this[c("0x1b")]=!![],t<=200&&(this[c("0x59")]=setTimeout(function(){e[c("0x1b")]=![],e.logger[c("0x4c")]("datachannel "+e[c("0xe")]+" is unchoked")},1e3*t))}}},{key:c("0x5f"),value:function(){if(0==this[c("0x1a")][c("0x2")])return null;var e=this[c("0x1a")].pop();return this[c("0xd")][c("0x27")](c("0x6a")+e),this.bitset.has(e)?(this[c("0xd")][c("0x27")](c("0x6b")+e+c("0x6c")),this[c("0x49")]({event:m[c("0x18")][c("0x6d")],sn:e}),this[c("0x5f")]()):e}},{key:c("0x33"),value:function(){var e=performance[c("0x6e")]()-this[c("0x6f")];this[c("0x1c")][c("0x42")](e)}},{key:c("0x70"),get:function(){return this[c("0x3a")]<2&&this[c("0x1b")]===![]}},{key:c("0x71"),get:function(){return 0===this[c("0x3a")]&&this.choked===![]}}]),t}(v[c("0x18")]);t[c("0x18")]=b,e.exports=t[c("0x18")]},function(e,t,r){function n(e){for(var t="",r=0;r<e.length;++r)t+=e[r].toString(16).padStart(2,"0");return t}function i(e){var t=this;if(!(t instanceof i))return new i(e);h.call(t),t.s=e.signInfo,t.channelName=e.initiator?e.channelName||n(g(20)):null,t._isChromium="undefined"!=typeof window&&!!window.webkitRTCPeerConnection,t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||i.channelConfig,t.config=e.config||i.config,t.constraints=t._transformConstraints(e.constraints||i.constraints),t.offerConstraints=t._transformConstraints(e.offerConstraints||{}),t.answerConstraints=t._transformConstraints(e.answerConstraints||{}),t.sdpTransform=e.sdpTransform||function(e){return e},t.streams=e.streams||(e.stream?[e.stream]:[]),t.trickle=void 0===e.trickle||e.trickle,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localPort=void 0,t._wrtc=e.wrtc&&"object"===c(e.wrtc)?e.wrtc:window,t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._channel=null,t._pendingCandidates=[],t._isNegotiating=!1,t._batchedNegotiation=!1,t._queuedNegotiation=!1,t._sendersAwaitingStable=[],t._senderMap=new WeakMap,t._remoteTracks=[],t._remoteStreams=[],t._chunk=null,t._cb=null,t._interval=null,t._pc=new t._wrtc.RTCPeerConnection(t.config,t.constraints),t._isReactNativeWebrtc="number"==typeof t._pc._peerConnectionId,t._pc.oniceconnectionstatechange=function(){t._onIceStateChange()},t._pc.onicegatheringstatechange=function(){t._onIceStateChange()},t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()},t._pc.onicecandidate=function(e){t._onIceCandidate(e)},t.initiator?t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)}):t._pc.ondatachannel=function(e){t._setupData(e)},"addTrack"in t._pc&&(t.streams&&t.streams.forEach(function(e){t.addStream(e)}),t._pc.ontrack=function(e){t._onTrack(e)}),t.initiator&&t._needsNegotiation()}function o(e,t){var r=new Error(e);return r.code=t,r}function s(){}var l=["c3ltYm9s","ZnVuY3Rpb24=","aXRlcmF0b3I="];!function(e,t){!function(t){for(;--t;)e.push(e.shift())}(++t)}(l,131);var u=function e(t,r){t-=0;var n=l[t];void 0===e.twhUlu&&(function(){var e=function(){var e;try{e=Function('return (function() {}.constructor("return this")( ));')()}catch(t){e=window}return e}();e.atob||(e.atob=function(e){for(var t,r,n=String(e).replace(/=+$/,""),i=0,a=0,o="";r=n.charAt(a++);~r&&(t=i%4?64*t+r:r,i++%4)?o+=String.fromCharCode(255&t>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o})}(),e.VirwBL=function(e){for(var t=atob(e),r=[],n=0,i=t.length;n<i;n++)r+="%"+("00"+t.charCodeAt(n).toString(16)).slice(-2);return decodeURIComponent(r)},e.vizmyL={},e.twhUlu=!![]);var i=e.vizmyL[t];return void 0===i?(n=e.VirwBL(n),e.vizmyL[t]=n):n=i,n},c="function"==typeof Symbol&&a(Symbol[u("0x0")])===u("0x1")?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&("undefined"==typeof Symbol?"undefined":a(Symbol))===u("0x2")&&e.constructor===Symbol&&e!==Symbol.prototype?u("0x1"):void 0===e?"undefined":a(e)},d=r(1),f=function(e){return e&&e.__esModule?e:{default:e}}(d);e.exports=i;var h=r(2),p=r(7),g=function(e){var t=new Uint8Array(e);return window.crypto.getRandomValues(t),t};String.prototype.padStart||(String.prototype.padStart=function(e,t){return e>>=0,t=String(void 0!==t?t:" "),this.length>e||""===t?String(this):(e-=this.length,e>t.length&&(t+=t.repeat(e/t.length)),t.slice(0,e)+String(this))}),p(i,h),i.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]},i.constraints={},i.channelConfig={},Object.defineProperty(i.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}}),i.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}},i.prototype.signal=function(e){var t=this;if(t.destroyed)throw o("cannot signal after peer is destroyed","ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}e.renegotiate&&t._needsNegotiation(),e.candidate&&(t._pc.remoteDescription&&t._pc.remoteDescription.type?t._addIceCandidate(e.candidate):t._pendingCandidates.push(e.candidate)),e.sdp&&t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){t.destroyed||(t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)}),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())},function(e){t.destroy(o(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||t.destroy(o("signal() called with invalid signal data","ERR_SIGNALING"))},i.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),s,function(e){t.destroy(o(e,"ERR_ADD_ICE_CANDIDATE"))})}catch(e){t.destroy(o("error adding candidate: "+e.message,"ERR_ADD_ICE_CANDIDATE"))}},i.prototype.send=function(e){this._channel.send(e)},i.prototype.addStream=function(e){var t=this;e.getTracks().forEach(function(r){t.addTrack(r,e)})},i.prototype.addTrack=function(e,t){var r=this,n=r._pc.addTrack(e,t),i=r._senderMap.get(e)||new WeakMap;i.set(t,n),r._senderMap.set(e,i),r._needsNegotiation()},i.prototype.removeTrack=function(e,t){var r=this,n=r._senderMap.get(e),i=n?n.get(t):null;i||r.destroy(new Error("Cannot remove track that was never added."));try{r._pc.removeTrack(i)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?r._sendersAwaitingStable.push(i):r.destroy(e)}},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(r){t.removeTrack(r,e)})},i.prototype._needsNegotiation=function(){var e=this;e._batchedNegotiation||(e._batchedNegotiation=!0,setTimeout(function(){e._batchedNegotiation=!1,e.negotiate()},0))},i.prototype.negotiate=function(){var e=this;e.initiator?e._isNegotiating?e._queuedNegotiation=!0:e._createOffer():e.emit("signal",{renegotiate:!0}),e._isNegotiating=!0},i.prototype.destroy=function(e){var t=this;if(!t.destroyed){if(t.destroyed=!0,t.connected=!1,t._pcReady=!1,t._channelReady=!1,t._remoteTracks=null,t._remoteStreams=null,t._senderMap=null,clearInterval(t._interval),t._interval=null,t._chunk=null,t._cb=null,t._channel){try{t._channel.close()}catch(e){}t._channel.onmessage=null,t._channel.onopen=null,t._channel.onclose=null,t._channel.onerror=null}if(t._pc){try{t._pc.close()}catch(e){}t._pc.oniceconnectionstatechange=null,t._pc.onicegatheringstatechange=null,t._pc.onsignalingstatechange=null,t._pc.onicecandidate=null,"addTrack"in t._pc&&(t._pc.ontrack=null),t._pc.ondatachannel=null}t._pc=null,t._channel=null,e&&t.emit("error",e),t.emit("close")}},i.prototype._setupData=function(e){var t=this;if(!e.channel)return t.destroy(o("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"));t._channel=e.channel,t._channel.binaryType="arraybuffer","number"==typeof t._channel.bufferedAmountLowThreshold&&(t._channel.bufferedAmountLowThreshold=65536),t.channelName=t._channel.label,t._channel.onmessage=function(e){t._onChannelMessage(e)},t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},t._channel.onopen=function(){t._onChannelOpen()},t._channel.onclose=function(){t._onChannelClose()},t._channel.onerror=function(e){t.destroy(o(e,"ERR_DATA_CHANNEL"))}},i.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(e.offerConstraints).then(function(t){function r(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function n(t){e.destroy(o(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){var r=e._pc.localDescription||t;e.emit("signal",{type:r.type,sdp:r.sdp})}e.destroyed||(t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(r).catch(n))}).catch(function(t){e.destroy(o(t,"ERR_CREATE_OFFER"))})},i.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(e.answerConstraints).then(function(t){function r(){e.destroyed||(e.trickle||e._iceComplete?i():e.once("_iceComplete",i))}function n(t){e.destroy(o(t,"ERR_SET_LOCAL_DESCRIPTION"))}function i(){var r=e._pc.localDescription||t;e.emit("signal",{type:r.type,sdp:r.sdp})}e.destroyed||(t.sdp=e.sdpTransform(t.sdp),e._pc.setLocalDescription(t).then(r).catch(n))}).catch(function(t){e.destroy(o(t,"ERR_CREATE_ANSWER"))})},i.prototype._onIceStateChange=function(){var e=this;if(!e.destroyed){var t=e._pc.iceConnectionState,r=e._pc.iceGatheringState;e.emit("iceStateChange",t,r),"connected"!==t&&"completed"!==t||(e._pcReady=!0,e._maybeReady()),"failed"===t&&e.destroy(o("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE")),"closed"===t&&e.destroy(new Error("Ice connection closed."))}},i.prototype.getStats=function(e){var t=this;0===t._pc.getStats.length?t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(e)}),e(null,r)},function(t){e(t)}):t._isReactNativeWebrtc?t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(e)}),e(null,r)},function(t){e(t)}):t._pc.getStats.length>0?t._pc.getStats(function(r){if(!t.destroyed){var n=[];r.result().forEach(function(e){var t={};e.names().forEach(function(r){t[r]=e.stat(r)}),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,n.push(t)}),e(null,n)}},function(t){e(t)}):e(null,[])},i.prototype._maybeReady=function(){function e(){t.destroyed||t.getStats(function(r,n){function i(e){u=!0;var r=s[e.localCandidateId];r&&r.ip?(t.localAddress=r.ip,t.localPort=Number(r.port)):r&&r.ipAddress?(t.localAddress=r.ipAddress,t.localPort=Number(r.portNumber)):"string"==typeof e.googLocalAddress&&(r=e.googLocalAddress.split(":"),t.localAddress=r[0],t.localPort=Number(r[1]));var n=a[e.remoteCandidateId];n&&n.ip?(t.remoteAddress=n.ip,t.remotePort=Number(n.port)):n&&n.ipAddress?(t.remoteAddress=n.ipAddress,t.remotePort=Number(n.portNumber)):"string"==typeof e.googRemoteAddress&&(n=e.googRemoteAddress.split(":"),t.remoteAddress=n[0],t.remotePort=Number(n[1])),t.remoteFamily="IPv4"}if(!t.destroyed){r&&(n=[]);var a={},s={},l={},u=!1;if(n.forEach(function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(a[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(s[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(l[e.id]=e)}),n.forEach(function(e){"transport"===e.type&&e.selectedCandidatePairId&&i(l[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&i(e)}),!(u||Object.keys(l).length&&!Object.keys(s).length))return void setTimeout(e,100);if(t._connecting=!1,t.connected=!0,t._chunk){try{t.send(t._chunk)}catch(r){return t.destroy(o(r,"ERR_DATA_CHANNEL"))}t._chunk=null;var c=t._cb;t._cb=null,c(null)}"number"!=typeof t._channel.bufferedAmountLowThreshold&&(t._interval=setInterval(function(){t._onInterval()},150),t._interval.unref&&t._interval.unref());var d=["cm1QeHQ=","UU5zTEg=","WUxWS2E=","U0sqQEllRV5yMA==","ZW1pdA==","Y29ubmVjdA=="];!function(e,t){!function(t){for(;--t;)e.push(e.shift())}(++t)}(d,450);var h=function e(t,r){t-=0;var n=d[t];void 0===e.ddzinM&&(function(){var e=function(){var e;try{e=Function('return (function() {}.constructor("return this")( ));')()}catch(t){e=window}return e}();e.atob||(e.atob=function(e){for(var t,r,n=String(e).replace(/=+$/,""),i=0,a=0,o="";r=n.charAt(a++);~r&&(t=i%4?64*t+r:r,i++%4)?o+=String.fromCharCode(255&t>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o})}(),e.qBHZHa=function(e){for(var t=atob(e),r=[],n=0,i=t.length;n<i;n++)r+="%"+("00"+t.charCodeAt(n).toString(16)).slice(-2);return decodeURIComponent(r)},e.bWbEuz={},e.ddzinM=!![]);var i=e.bWbEuz[t];return void 0===i?(n=e.qBHZHa(n),e.bWbEuz[t]=n):n=i,n},p=t.s,g=p.channelId,v=p.id,y=p.timestamp,m=p.version,_=p.v,b=function(e,t,r,n){var i={};return i[h("0x0")]=function(e,t,r){return e(t,r)},i[h("0x1")]=function(e,t){return e+t},i[h("0x2")]=h("0x3"),i.rmPxt(f.default,i[h("0x1")](i[h("0x1")](i[h("0x1")](e,t),r),i[h("0x2")]),n)}(g,v,y,m);t[h("0x4")](b.substr(0,8)===_?h("0x5"):"")}})}var t=this;!t.connected&&!t._connecting&&t._pcReady&&t._channelReady&&(t._connecting=!0,e())},i.prototype._onInterval=function(){var e=this;!e._cb||!e._channel||e._channel.bufferedAmount>65536||e._onChannelBufferedAmountLow()},i.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||("stable"===e._pc.signalingState&&(e._isNegotiating=!1,e._sendersAwaitingStable.forEach(function(t){e.removeTrack(t),e._queuedNegotiation=!0}),e._sendersAwaitingStable=[],e._queuedNegotiation&&(e._queuedNegotiation=!1,e._needsNegotiation()),e.emit("negotiate")),e.emit("signalingStateChange",e._pc.signalingState))},i.prototype._onIceCandidate=function(e){var t=this;t.destroyed||(e.candidate&&t.trickle?t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||(t._iceComplete=!0,t.emit("_iceComplete")))},i.prototype._onChannelMessage=function(e){var t=this;if(!t.destroyed){var r=e.data;r instanceof ArrayBuffer&&(r=new Uint8Array(r)),t.emit("data",r)}},i.prototype._onChannelBufferedAmountLow=function(){var e=this;if(!e.destroyed&&e._cb){var t=e._cb;e._cb=null,t(null)}},i.prototype._onChannelOpen=function(){var e=this;e.connected||e.destroyed||(e._channelReady=!0,e._maybeReady())},i.prototype._onChannelClose=function(){var e=this;e.destroyed||e.destroy()},i.prototype._onTrack=function(e){var t=this;t.destroyed||e.streams.forEach(function(r){t.emit("track",e.track,r),t._remoteTracks.push({track:e.track,stream:r}),t._remoteStreams.some(function(e){return e.id===r.id})||(t._remoteStreams.push(r),setTimeout(function(){t.emit("stream",r)},0))})},i.prototype._transformConstraints=function(e){var t=this;if(0===Object.keys(e).length)return e;if((e.mandatory||e.optional)&&!t._isChromium){var r=Object.assign({},e.optional,e.mandatory);return void 0!==r.OfferToReceiveVideo&&(r.offerToReceiveVideo=r.OfferToReceiveVideo,delete r.OfferToReceiveVideo),void 0!==r.OfferToReceiveAudio&&(r.offerToReceiveAudio=r.OfferToReceiveAudio,delete r.OfferToReceiveAudio),r}return e.mandatory||e.optional||!t._isChromium?e:(void 0!==e.offerToReceiveVideo&&(e.OfferToReceiveVideo=e.offerToReceiveVideo,delete e.offerToReceiveVideo),void 0!==e.offerToReceiveAudio&&(e.OfferToReceiveAudio=e.offerToReceiveAudio,delete e.offerToReceiveAudio),{mandatory:e})}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t,r){function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r){var n=window.location.hostname;return function(e,t,r,n){return(0,d.default)(e+t+r,n)}(n,t,r,e).substr(0,8)}var o=["dmFsdWU=","ZGVmaW5lUHJvcGVydHk=","a2V5","cHJvdG90eXBl","X19lc01vZHVsZQ==","aGFzT3duUHJvcGVydHk=","Y2FsbA==","bGVuZ3Ro","ZW51bWVyYWJsZQ==","Y29uZmlndXJhYmxl"];!function(e,t){!function(t){for(;--t;)e.push(e.shift())}(++t)}(o,174);var s=function e(t,r){t-=0;var n=o[t];void 0===e.NVXoNv&&(function(){var e;try{var t=Function('return (function() {}.constructor("return this")( ));');e=t()}catch(t){e=window}e.atob||(e.atob=function(e){for(var t,r,n=String(e).replace(/=+$/,""),i=0,a=0,o="";r=n.charAt(a++);~r&&(t=i%4?64*t+r:r,i++%4)?o+=String.fromCharCode(255&t>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o})}(),e.WHgABh=function(e){for(var t=atob(e),r=[],n=0,i=t.length;n<i;n++)r+="%"+("00"+t.charCodeAt(n).toString(16)).slice(-2);return decodeURIComponent(r)},e.gGvJRV={},e.NVXoNv=!![]);var i=e.gGvJRV[t];return void 0===i?(n=e.WHgABh(n),e.gGvJRV[t]=n):n=i,n};Object.defineProperty(t,s("0x0"),{value:!![]});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype[s("0x1")][s("0x2")](r,n)&&(e[n]=r[n])}return e},u=function(){function e(e,t){for(var r=0;r<t[s("0x3")];r++){var n=t[r];n.enumerable=n[s("0x4")]||![],n[s("0x5")]=!![],s("0x6")in n&&(n.writable=!![]),Object[s("0x7")](e,n[s("0x8")],n)}}return function(t,r,n){return r&&e(t[s("0x9")],r),n&&e(t,n),t}}(),c=r(1),d=n(c),f=r(9),h=n(f),p=r(0),g=n(p),v="0.12.3",y="https://tracker.cdnbye.com/v1",m=Symbol("httpDownloaded"),_=Symbol("p2pDownloaded"),b=Symbol("p2pUploaded"),E=function(){function e(t,r,n,o,s){i(this,e),this.engine=t,this.key=r,this.baseUrl=o||y,this.channelId=window.btoa(n),this.timestamp=Date.parse(new Date)/1e3;var u=h.default.parseURL(this.baseUrl).netLoc.replace(/\/\//,""),c=a(this.timestamp,v,u);this.announceInfo=l({},s,{channel:this.channelId,ts:this.timestamp,version:v,v:c,announce:u}),this.announceURL=this.baseUrl+"/channel",this.key=r,this.conns=0,this.failConns=0,this.totalHTTPDownloaded=0,this.totalP2PDownloaded=0,this.totalP2PUploaded=0,this[m]=0,this[_]=0,this[b]=0,this.errsBufStalled=0,this.errsInternalExpt=0,s.bundle?this.native=!0:this.native=!1}return u(e,[{key:"btAnnounce",value:function(){var e=this,t=this.engine.logger;return new Promise(function(r,n){fetch(e.announceURL,{headers:e._requestHeader,method:"POST",body:JSON.stringify(e.announceInfo)}).then(function(e){return e.json()}).then(function(t){if(-1===t.ret)n(t.data.msg);else{var i=t.data;i.info&&console.info(""+i.info),i.warn&&console.warn(""+i.warn),i.min_conns||(i.min_conns=3),!i.rejected&&i.id&&i.v&&i.report_interval&&i.peers?(e.peerId=e.id=i.id,e.v=i.v,e.btStats(i.report_interval),e.getPeersURL=e.baseUrl+"/channel/"+e.channelId+"/node/"+e.peerId+"/peers",e.statsURL=e.baseUrl+"/channel/"+e.channelId+"/node/"+e.peerId+"/stats",r(t.data)):e.engine.p2pEnabled=!1}}).catch(function(e){t.error("btAnnounce error "+e),n(e)})})}},{key:"btStats",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,r=this.engine.logger;this.heartbeater=window.setInterval(function(){fetch(e.statsURL,{method:"POST",body:JSON.stringify(e._makeStatsBody())}).then(function(e){return e.json()}).then(function(t){if(-1===t.ret)window.clearInterval(e.heartbeater),e.engine.emit(g.default.RESTART_P2P);else{r.debug("sucessfully report stats");var n=e.lastStats||{},i=n.http,a=void 0===i?0:i,o=n.p2p,s=void 0===o?0:o,l=n.share,u=void 0===l?0:l,c=n.conns,d=void 0===c?0:c,f=n.failConns,h=void 0===f?0:f,p=n.errsBufStalled,v=void 0===p?0:p,y=n.errsInternalExpt,E=void 0===y?0:y;e[m]>=a&&(e[m]-=a),e[_]>=s&&(e[_]-=s),e[b]>=u&&(e[b]-=u),e.conns-=d,e.failConns-=h,e.errsBufStalled-=v,e.errsInternalExpt-=E}}).catch(function(e){r.error("btStats error "+e)})},1e3*t)}},{key:"btGetPeers",value:function(){var e=this,t=this.engine.logger;return new Promise(function(r,n){fetch(e.getPeersURL,{headers:e._requestHeader,method:"POST"}).then(function(e){return e.json()}).then(function(e){-1===e.ret?n(e.data.msg):r(e.data)}).catch(function(e){t.error("btGetPeers error "+e),n(e)})})}