UNPKG

@liascript/exporter

Version:
5 lines 107 kB
!function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function t(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var n=e.parcelRequire55a5;n.register("9U0AO",(function(e,t){var r=n("9Klpk"),i=n("3bWnf"),o=n("kb0qF"),a=n("bWNdT"),s=n("cwBhL").Buffer,c=n("dwfPl"),u=n("gQh22"),l=n("h1Pcp"),d=n("bbor2"),f=n("3Uq0m")("p2pt"),h=function(e){"use strict";(0,o.default)(n,e);var t=(0,a.default)(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(0,r.default)(this,n),(e=t.call(this)).announceURLs=i,e.trackers={},e.peers={},e.msgChunks={},e.responseWaiting={},o&&e.setIdentifier(o),e._peerIdBuffer=u(20),e._peerId=e._peerIdBuffer.toString("hex"),e._peerIdBinary=e._peerIdBuffer.toString("binary"),f("my peer id: "+e._peerId),e}return(0,i.default)(n,[{key:"setIdentifier",value:function(e){this.identifierString=e,this.infoHash=d.sync(e).toLowerCase(),this._infoHashBuffer=s.from(this.infoHash,"hex"),this._infoHashBinary=this._infoHashBuffer.toString("binary")}},{key:"start",value:function(){var e=this;this.on("peer",(function(t){var n=!1;e.peers[t.id]||(n=!0,e.peers[t.id]={},e.responseWaiting[t.id]={}),t.on("connect",(function(){e.peers[t.id][t.channelName]=t,n&&e.emit("peerconnect",t)})),t.on("data",(function(n){if(e.emit("data",t,n),n=n.toString(),f("got a message from "+t.id),"^"===n[0])try{n=JSON.parse(n.slice(1)),t.respond=e._peerRespond(t,n.id);var r=e._chunkHandler(n);!1!==r&&(n.o&&(r=JSON.parse(r)),e.responseWaiting[t.id][n.id]?(e.responseWaiting[t.id][n.id]([t,r]),delete e.responseWaiting[t.id][n.id]):e.emit("msg",t,r),e._destroyChunks(n.id))}catch(e){console.log(e)}})),t.on("error",(function(n){e._removePeer(t),f("Error in connection : "+n)})),t.on("close",(function(){e._removePeer(t),f("Connection closed with "+t.id)}))})),this.on("update",(function(t){var n=e.trackers[e.announceURLs.indexOf(t.announce)];e.emit("trackerconnect",n,e.getTrackerStats())})),this.on("warning",(function(t){e.emit("trackerwarning",t,e.getTrackerStats())})),this._fetchPeers()}},{key:"addTracker",value:function(e){if(-1!==this.announceURLs.indexOf(e))throw new Error("Tracker already added");var t=this.announceURLs.push(e);this.trackers[t]=new c(this,e),this.trackers[t].announce(this._defaultAnnounceOpts())}},{key:"removeTracker",value:function(e){var t=this.announceURLs.indexOf(e);if(-1===t)throw new Error("Tracker does not exist");this.trackers[t].peers=[],this.trackers[t].destroy(),delete this.trackers[t],delete this.announceURLs[t]}},{key:"_removePeer",value:function(e){if(!this.peers[e.id])return!1;delete this.peers[e.id][e.channelName],0===Object.keys(this.peers[e.id]).length&&(this.emit("peerclose",e),delete this.responseWaiting[e.id],delete this.peers[e.id])}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=this;return new Promise((function(i,o){var a={id:""!==n?n:Math.floor(1e5*Math.random()+1e5),msg:t};"object"==typeof t&&(a.msg=JSON.stringify(t),a.o=1);try{if(!e.connected)for(var s in r.peers[e.id])if((e=r.peers[e.id][s]).connected)break;r.responseWaiting[e.id]||(r.responseWaiting[e.id]={}),r.responseWaiting[e.id][a.id]=i}catch(e){return o(Error("Connection to peer closed"+e))}for(var c=0,u="";a.msg.length>0;)a.c=c,u=a.msg.slice(16e3),a.msg=a.msg.slice(0,16e3),u||(a.last=!0),e.send("^"+JSON.stringify(a)),a.msg=u,c++;f("sent a message to "+e.id)}))}},{key:"requestMorePeers",value:function(){var e=this;return new Promise((function(t){for(var n in e.trackers)e.trackers[n].announce(e._defaultAnnounceOpts());t(e.peers)}))}},{key:"getTrackerStats",value:function(){var e=0;for(var t in this.trackers)this.trackers[t].socket&&this.trackers[t].socket.connected&&e++;return{connected:e,total:this.announceURLs.length}}},{key:"destroy",value:function(){var e;for(e in this.peers)for(var t in this.peers[e])this.peers[e][t].destroy();for(e in this.trackers)this.trackers[e].destroy()}},{key:"_peerRespond",value:function(e,t){var n=this;return function(r){return n.send(e,r,t)}}},{key:"_chunkHandler",value:function(e){return this.msgChunks[e.id]||(this.msgChunks[e.id]=[]),this.msgChunks[e.id][e.c]=e.msg,!!e.last&&this.msgChunks[e.id].join("")}},{key:"_destroyChunks",value:function(e){delete this.msgChunks[e]}},{key:"_defaultAnnounceOpts",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return null==e.numwant&&(e.numwant=50),null==e.uploaded&&(e.uploaded=0),null==e.downloaded&&(e.downloaded=0),e}},{key:"_fetchPeers",value:function(){for(var e in this.announceURLs)this.trackers[e]=new c(this,this.announceURLs[e]),this.trackers[e].announce(this._defaultAnnounceOpts())}}]),n}(l);e.exports=h})),n.register("dwfPl",(function(e,t){var r=n("9Klpk"),i=n("3bWnf"),o=n("kb0qF"),a=n("bWNdT"),s=n("fElHP"),c=n("3Uq0m")("bittorrent-tracker:websocket-tracker"),u=n("6KQef"),l=n("gQh22"),d=n("fR1r3"),f=n("lfll6"),h=n("5WITx"),p=n("fXqp1"),g={},_=function(e){"use strict";(0,o.default)(n,e);var t=(0,a.default)(n);function n(e,i){var o;return(0,r.default)(this,n),o=t.call(this,e,i),c("new websocket tracker %s",i),o.peers={},o.socket=null,o.reconnecting=!1,o.retries=0,o.reconnectTimer=null,o.expectingResponse=!1,o._openSocket(),o}return(0,i.default)(n,[{key:"announce",value:function(e){var t=this;if(!this.destroyed&&!this.reconnecting)if(this.socket.connected){var n=Object.assign({},e,{action:"announce",info_hash:this.client._infoHashBinary,peer_id:this.client._peerIdBinary});if(this._trackerId&&(n.trackerid=this._trackerId),"stopped"===e.event||"completed"===e.event)this._send(n);else{var r=Math.min(e.numwant,5);this._generateOffers(r,(function(e){n.numwant=r,n.offers=e,t._send(n)}))}}else this.socket.once("connect",(function(){t.announce(e)}))}},{key:"scrape",value:function(e){var t=this;if(!this.destroyed&&!this.reconnecting)if(this.socket.connected){var n={action:"scrape",info_hash:Array.isArray(e.infoHash)&&e.infoHash.length>0?e.infoHash.map((function(e){return e.toString("binary")})):e.infoHash&&e.infoHash.toString("binary")||this.client._infoHashBinary};this._send(n)}else this.socket.once("connect",(function(){t.scrape(e)}))}},{key:"destroy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;if(this.destroyed)return e(null);for(var t in this.destroyed=!0,clearInterval(this.interval),clearTimeout(this.reconnectTimer),this.peers){var n=this.peers[t];clearTimeout(n.trackerTimeout),n.destroy()}if(this.peers=null,this.socket&&(this.socket.removeListener("connect",this._onSocketConnectBound),this.socket.removeListener("data",this._onSocketDataBound),this.socket.removeListener("close",this._onSocketCloseBound),this.socket.removeListener("error",this._onSocketErrorBound),this.socket=null),this._onSocketConnectBound=null,this._onSocketErrorBound=null,this._onSocketDataBound=null,this._onSocketCloseBound=null,g[this.announceUrl]&&(g[this.announceUrl].consumers-=1),g[this.announceUrl].consumers>0)return e();var r,i=g[this.announceUrl];if(delete g[this.announceUrl],i.on("error",y),i.once("close",e),!this.expectingResponse)return o();function o(){r&&(clearTimeout(r),r=null),i.removeListener("data",o),i.destroy(),i=null}r=setTimeout(o,h.DESTROY_TIMEOUT),i.once("data",o)}},{key:"_openSocket",value:function(){var e=this;if(this.destroyed=!1,this.peers||(this.peers={}),this._onSocketConnectBound=function(){e._onSocketConnect()},this._onSocketErrorBound=function(t){e._onSocketError(t)},this._onSocketDataBound=function(t){e._onSocketData(t)},this._onSocketCloseBound=function(){e._onSocketClose()},this.socket=g[this.announceUrl],this.socket)g[this.announceUrl].consumers+=1,this.socket.connected&&this._onSocketConnectBound();else{var t,n=new URL(this.announceUrl);this.client._proxyOpts&&!(t="wss:"===n.protocol?this.client._proxyOpts.httpsAgent:this.client._proxyOpts.httpAgent)&&this.client._proxyOpts.socksProxy&&(t=new f.Agent(s(this.client._proxyOpts.socksProxy),"wss:"===n.protocol)),this.socket=g[this.announceUrl]=new d({url:this.announceUrl,agent:t}),this.socket.consumers=1,this.socket.once("connect",this._onSocketConnectBound)}this.socket.on("data",this._onSocketDataBound),this.socket.once("close",this._onSocketCloseBound),this.socket.once("error",this._onSocketErrorBound)}},{key:"_onSocketConnect",value:function(){this.destroyed||this.reconnecting&&(this.reconnecting=!1,this.retries=0,this.announce(this.client._defaultAnnounceOpts()))}},{key:"_onSocketData",value:function(e){if(!this.destroyed){this.expectingResponse=!1;try{e=JSON.parse(e)}catch(e){return void this.client.emit("warning",new Error("Invalid tracker response"))}"announce"===e.action?this._onAnnounceResponse(e):"scrape"===e.action?this._onScrapeResponse(e):this._onSocketError(new Error("invalid action in WS response: ".concat(e.action)))}}},{key:"_onAnnounceResponse",value:function(e){var t=this;if(e.info_hash===this.client._infoHashBinary){if(!e.peer_id||e.peer_id!==this.client._peerIdBinary){c("received %s from %s for %s",JSON.stringify(e),this.announceUrl,this.client.infoHash);var n=e["failure reason"];if(n)return this.client.emit("warning",new Error(n));var r=e["warning message"];r&&this.client.emit("warning",new Error(r));var i=e.interval||e["min interval"];i&&this.setInterval(1e3*i);var o,a=e["tracker id"];if(a&&(this._trackerId=a),null!=e.complete){var s=Object.assign({},e,{announce:this.announceUrl,infoHash:h.binaryToHex(e.info_hash)});this.client.emit("update",s)}if(e.offer&&e.peer_id&&(c("creating peer (from remote offer)"),(o=this._createPeer()).id=h.binaryToHex(e.peer_id),o.once("signal",(function(n){var r={action:"announce",info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary,to_peer_id:e.peer_id,answer:n,offer_id:e.offer_id};t._trackerId&&(r.trackerid=t._trackerId),t._send(r)})),this.client.emit("peer",o),o.signal(e.offer)),e.answer&&e.peer_id){var u=h.binaryToHex(e.offer_id);(o=this.peers[u])?(o.id=h.binaryToHex(e.peer_id),this.client.emit("peer",o),o.signal(e.answer),clearTimeout(o.trackerTimeout),o.trackerTimeout=null,delete this.peers[u]):c("got unexpected answer: ".concat(JSON.stringify(e.answer)))}}}else c("ignoring websocket data from %s for %s (looking for %s: reused socket)",this.announceUrl,h.binaryToHex(e.info_hash),this.client.infoHash)}},{key:"_onScrapeResponse",value:function(e){var t=this;e=e.files||{};var n=Object.keys(e);0!==n.length?n.forEach((function(n){var r=Object.assign(e[n],{announce:t.announceUrl,infoHash:h.binaryToHex(n)});t.client.emit("scrape",r)})):this.client.emit("warning",new Error("invalid scrape response"))}},{key:"_onSocketClose",value:function(){this.destroyed||(this.destroy(),this._startReconnectTimer())}},{key:"_onSocketError",value:function(e){this.destroyed||(this.destroy(),this.client.emit("warning",e),this._startReconnectTimer())}},{key:"_startReconnectTimer",value:function(){var e=this,t=Math.floor(3e5*Math.random())+Math.min(1e4*Math.pow(2,this.retries),36e5);this.reconnecting=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout((function(){e.retries++,e._openSocket()}),t),this.reconnectTimer.unref&&this.reconnectTimer.unref(),c("reconnecting socket in %s ms",t)}},{key:"_send",value:function(e){if(!this.destroyed){this.expectingResponse=!0;var t=JSON.stringify(e);c("send %s",t),this.socket.send(t)}}},{key:"_generateOffers",value:function(e,t){var n=function(){var e=l(20).toString("hex");c("creating peer (from _generateOffers)");var t=i.peers[e]=i._createPeer({initiator:!0});t.once("signal",(function(t){o.push({offer:t,offer_id:h.hexToBinary(e)}),r()})),t.trackerTimeout=setTimeout((function(){c("tracker timeout: destroying peer"),t.trackerTimeout=null,delete i.peers[e],t.destroy()}),5e4),t.trackerTimeout.unref&&t.trackerTimeout.unref()},r=function(){o.length===e&&(c("generated %s offers",e),t(o))},i=this,o=[];c("generating %s offers",e);for(var a=0;a<e;++a)n();r()}},{key:"_createPeer",value:function(e){var t=function(e){n.client.emit("warning",new Error("Connection error: ".concat(e.message))),r.destroy()},n=this;e=Object.assign({trickle:!1,config:n.client._rtcConfig,wrtc:n.client._wrtc},e);var r=new u(e);return r.once("error",t),r.once("connect",(function e(){r.removeListener("error",t),r.removeListener("connect",e)})),r}}]),n}(p);function y(){}_.prototype.DEFAULT_ANNOUNCE_INTERVAL=3e4,_._socketPool=g,e.exports=_})),n.register("fElHP",(function(e,t){var r=n("cwBhL").Buffer,i=function(){"use strict";var e,t,n,i=function(e,t){return null!=t&&e instanceof t},o=function(e){return Object.prototype.toString.call(e)},a=function(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t};try{e=Map}catch(t){e=function(){}}try{t=Set}catch(e){t=function(){}}try{n=Promise}catch(e){n=function(){}}function s(o,c,u,l,d){"object"==typeof c&&(u=c.depth,l=c.prototype,d=c.includeNonEnumerable,c=c.circular);var f=[],h=[],p=void 0!==r;return void 0===c&&(c=!0),void 0===u&&(u=1/0),function o(u,g){if(null===u)return null;if(0===g)return u;var _,y;if("object"!=typeof u)return u;if(i(u,e))_=new e;else if(i(u,t))_=new t;else if(i(u,n))_=new n((function(e,t){u.then((function(t){e(o(t,g-1))}),(function(e){t(o(e,g-1))}))}));else if(s.__isArray(u))_=[];else if(s.__isRegExp(u))_=new RegExp(u.source,a(u)),u.lastIndex&&(_.lastIndex=u.lastIndex);else if(s.__isDate(u))_=new Date(u.getTime());else{if(p&&r.isBuffer(u))return _=r.allocUnsafe?r.allocUnsafe(u.length):new r(u.length),u.copy(_),_;i(u,Error)?_=Object.create(u):void 0===l?(y=Object.getPrototypeOf(u),_=Object.create(y)):(_=Object.create(l),y=l)}if(c){var v=f.indexOf(u);if(-1!=v)return h[v];f.push(u),h.push(_)}for(var b in i(u,e)&&u.forEach((function(e,t){var n=o(t,g-1),r=o(e,g-1);_.set(n,r)})),i(u,t)&&u.forEach((function(e){var t=o(e,g-1);_.add(t)})),u){var m;y&&(m=Object.getOwnPropertyDescriptor(y,b)),m&&null==m.set||(_[b]=o(u[b],g-1))}if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(u);for(b=0;b<w.length;b++){var k=w[b];(!(C=Object.getOwnPropertyDescriptor(u,k))||C.enumerable||d)&&(_[k]=o(u[k],g-1),C.enumerable||Object.defineProperty(_,k,{enumerable:!1}))}}if(d){var S=Object.getOwnPropertyNames(u);for(b=0;b<S.length;b++){var C,E=S[b];(C=Object.getOwnPropertyDescriptor(u,E))&&C.enumerable||(_[E]=o(u[E],g-1),Object.defineProperty(_,E,{enumerable:!1}))}}return _}(o,u)}return s.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},s.__objToStr=o,s.__isDate=function(e){return"object"==typeof e&&"[object Date]"===o(e)},s.__isArray=function(e){return"object"==typeof e&&"[object Array]"===o(e)},s.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===o(e)},s.__getRegExpFlags=a,s}();e.exports&&(e.exports=i)})),n.register("3Uq0m",(function(e,t){var r,i=n("84cK9");e.exports.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)}},e.exports.save=function(t){try{t?e.exports.storage.setItem("debug",t):e.exports.storage.removeItem("debug")}catch(e){}},e.exports.load=function(){var t;try{t=e.exports.storage.getItem("debug")}catch(e){}return!t&&void 0!==i&&"env"in i&&(t=void 0),t},e.exports.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));var e},e.exports.storage=function(){try{return localStorage}catch(e){}}(),e.exports.destroy=(r=!1,function(){r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),e.exports.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"],e.exports.log=console.debug||console.log||function(){},e.exports=n("9out4")(e.exports),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),n.register("9out4",(function(e,t){var r=n("6Wo7Q");e.exports=function(e){var t=function(e,t){var n=o(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n},i=function(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")};function o(e){var n,r,i,a=null;function s(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(s.enabled){var i=s,a=Number(new Date),c=a-(n||a);i.diff=c,i.prev=n,i.curr=a,n=a,t[0]=o.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");var u=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(function(e,n){if("%%"===e)return"%";u++;var r=o.formatters[n];if("function"==typeof r){var a=t[u];e=r.call(i,a),t.splice(u,1),u--}return e})),o.formatArgs.call(i,t),(i.log||o.log).apply(i,t)}}return s.namespace=e,s.useColors=o.useColors(),s.color=o.selectColor(e),s.extend=t,s.destroy=o.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:function(){return null!==a?a:(r!==o.namespaces&&(r=o.namespaces,i=o.enabled(e)),i)},set:function(e){a=e}}),"function"==typeof o.init&&o.init(s),s}return o.debug=o,o.default=o,o.coerce=function(e){return e instanceof Error?e.stack||e.message:e},o.disable=function(){var e=(0,r.default)(o.names.map(i)).concat((0,r.default)(o.skips.map(i).map((function(e){return"-"+e})))).join(",");return o.enable(""),e},o.enable=function(e){var t;o.save(e),o.namespaces=e,o.names=[],o.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),r=n.length;for(t=0;t<r;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?o.skips.push(new RegExp("^"+e.slice(1)+"$")):o.names.push(new RegExp("^"+e+"$")))},o.enabled=function(e){if("*"===e[e.length-1])return!0;var t,n;for(t=0,n=o.skips.length;t<n;t++)if(o.skips[t].test(e))return!1;for(t=0,n=o.names.length;t<n;t++)if(o.names[t].test(e))return!0;return!1},o.humanize=n("9LOoR"),o.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((function(t){o[t]=e[t]})),o.names=[],o.skips=[],o.formatters={},o.selectColor=function(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return o.colors[Math.abs(t)%o.colors.length]},o.enable(o.load()),o}})),n.register("9LOoR",(function(e,t){var r=n("rJmE6"),i=1e3,o=6e4,a=36e5,s=864e5;function c(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var n,u,l=void 0===e?"undefined":(0,r.default)(e);if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return n*s;case"hours":case"hour":case"hrs":case"hr":case"h":return n*a;case"minutes":case"minute":case"mins":case"min":case"m":return n*o;case"seconds":case"second":case"secs":case"sec":case"s":return n*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===l&&isFinite(e))return t.long?(n=e,(u=Math.abs(n))>=s?c(n,u,s,"day"):u>=a?c(n,u,a,"hour"):u>=o?c(n,u,o,"minute"):u>=i?c(n,u,i,"second"):n+" ms"):function(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=a?Math.round(e/a)+"h":t>=o?Math.round(e/o)+"m":t>=i?Math.round(e/i)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}})),n.register("6KQef",(function(e,t){ /*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ var r=n("9Klpk"),i=n("3bWnf"),o=n("kb0qF"),a=n("1Qswt"),s=n("bWNdT"),c=n("3Uq0m")("simple-peer"),u=n("jttaJ"),l=n("gQh22"),d=n("dBbLm"),f=n("cfDOX"),h=n("6GRLr"),p=n("cwBhL").Buffer,g=65536;function _(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}var y=function(e){"use strict";(0,o.default)(n,e);var t=(0,s.default)(n);function n(e){var i;if((0,r.default)(this,n),e=Object.assign({allowHalfOpen:!1},e),(i=t.call(this,e))._id=l(4).toString("hex").slice(0,7),i._debug("new peer %o",e),i.channelName=e.initiator?e.channelName||l(20).toString("hex"):null,i.initiator=e.initiator||!1,i.channelConfig=e.channelConfig||n.channelConfig,i.channelNegotiated=i.channelConfig.negotiated,i.config=Object.assign({},n.config,e.config),i.offerOptions=e.offerOptions||{},i.answerOptions=e.answerOptions||{},i.sdpTransform=e.sdpTransform||function(e){return e},i.streams=e.streams||(e.stream?[e.stream]:[]),i.trickle=void 0===e.trickle||e.trickle,i.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,i.iceCompleteTimeout=e.iceCompleteTimeout||5e3,i.destroyed=!1,i.destroying=!1,i._connected=!1,i.remoteAddress=void 0,i.remoteFamily=void 0,i.remotePort=void 0,i.localAddress=void 0,i.localFamily=void 0,i.localPort=void 0,i._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:u(),!i._wrtc)throw"undefined"==typeof window?h(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):h(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");i._pcReady=!1,i._channelReady=!1,i._iceComplete=!1,i._iceCompleteTimer=null,i._channel=null,i._pendingCandidates=[],i._isNegotiating=!1,i._firstNegotiation=!0,i._batchedNegotiation=!1,i._queuedNegotiation=!1,i._sendersAwaitingStable=[],i._senderMap=new Map,i._closingInterval=null,i._remoteTracks=[],i._remoteStreams=[],i._chunk=null,i._cb=null,i._interval=null;try{i._pc=new i._wrtc.RTCPeerConnection(i.config)}catch(e){return i.destroy(h(e,"ERR_PC_CONSTRUCTOR")),(0,a.default)(i)}return i._isReactNativeWebrtc="number"==typeof i._pc._peerConnectionId,i._pc.oniceconnectionstatechange=function(){i._onIceStateChange()},i._pc.onicegatheringstatechange=function(){i._onIceStateChange()},i._pc.onconnectionstatechange=function(){i._onConnectionStateChange()},i._pc.onsignalingstatechange=function(){i._onSignalingStateChange()},i._pc.onicecandidate=function(e){i._onIceCandidate(e)},"object"==typeof i._pc.peerIdentity&&i._pc.peerIdentity.catch((function(e){i.destroy(h(e,"ERR_PC_PEER_IDENTITY"))})),i.initiator||i.channelNegotiated?i._setupData({channel:i._pc.createDataChannel(i.channelName,i.channelConfig)}):i._pc.ondatachannel=function(e){i._setupData(e)},i.streams&&i.streams.forEach((function(e){i.addStream(e)})),i._pc.ontrack=function(e){i._onTrack(e)},i._debug("initial negotiation"),i._needsNegotiation(),i._onFinishBound=function(){i._onFinish()},i.once("finish",i._onFinishBound),i}return(0,i.default)(n,[{key:"bufferSize",get:function(){return this._channel&&this._channel.bufferedAmount||0}},{key:"connected",get:function(){return this._connected&&"open"===this._channel.readyState}},{key:"address",value:function(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}},{key:"signal",value:function(e){var t=this;if(!this.destroying){if(this.destroyed)throw h(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then((function(){t.destroyed||(t._pendingCandidates.forEach((function(e){t._addIceCandidate(e)})),t._pendingCandidates=[],"offer"===t._pc.remoteDescription.type&&t._createAnswer())})).catch((function(e){t.destroy(h(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(h(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}},{key:"_addIceCandidate",value:function(e){var t=this,n=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(n).catch((function(e){!n.address||n.address.endsWith(".local")?("Ignoring unsupported ICE candidate.",console.warn("Ignoring unsupported ICE candidate.")):t.destroy(h(e,"ERR_ADD_ICE_CANDIDATE"))}))}},{key:"send",value:function(e){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}},{key:"addTransceiver",value:function(e,t){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(h(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transceiverRequest:{kind:e,init:t}})}}},{key:"addStream",value:function(e){var t=this;if(!this.destroying){if(this.destroyed)throw h(new Error("cannot addStream after peer is destroyed"),"ERR_DESTROYED");this._debug("addStream()"),e.getTracks().forEach((function(n){t.addTrack(n,e)}))}}},{key:"addTrack",value:function(e,t){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot addTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("addTrack()");var n=this._senderMap.get(e)||new Map,r=n.get(t);if(r)throw r.removed?h(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):h(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");r=this._pc.addTrack(e,t),n.set(t,r),this._senderMap.set(e,n),this._needsNegotiation()}}},{key:"replaceTrack",value:function(e,t,n){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot replaceTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("replaceTrack()");var r=this._senderMap.get(e),i=r?r.get(n):null;if(!i)throw h(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,r),null!=i.replaceTrack?i.replaceTrack(t):this.destroy(h(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}}},{key:"removeTrack",value:function(e,t){if(!this.destroying){if(this.destroyed)throw h(new Error("cannot removeTrack after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSender()");var n=this._senderMap.get(e),r=n?n.get(t):null;if(!r)throw h(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{r.removed=!0,this._pc.removeTrack(r)}catch(e){"NS_ERROR_UNEXPECTED"===e.name?this._sendersAwaitingStable.push(r):this.destroy(h(e,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}}},{key:"removeStream",value:function(e){var t=this;if(!this.destroying){if(this.destroyed)throw h(new Error("cannot removeStream after peer is destroyed"),"ERR_DESTROYED");this._debug("removeSenders()"),e.getTracks().forEach((function(n){t.removeTrack(n,e)}))}}},{key:"_needsNegotiation",value:function(){var e=this;this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,f((function(){e._batchedNegotiation=!1,e.initiator||!e._firstNegotiation?(e._debug("starting batched negotiation"),e.negotiate()):e._debug("non-initiator initial negotiation request discarded"),e._firstNegotiation=!1})))}},{key:"negotiate",value:function(){var e=this;if(!this.destroying){if(this.destroyed)throw h(new Error("cannot negotiate after peer is destroyed"),"ERR_DESTROYED");this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout((function(){e._createOffer()}),0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{type:"renegotiate",renegotiate:!0})),this._isNegotiating=!0}}},{key:"destroy",value:function(e){this._destroy(e,(function(){}))}},{key:"_destroy",value:function(e,t){var n=this;this.destroyed||this.destroying||(this.destroying=!0,this._debug("destroying (error: %s)",e&&(e.message||e)),f((function(){if(n.destroyed=!0,n.destroying=!1,n._debug("destroy (error: %s)",e&&(e.message||e)),n.readable=n.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),n._connected=!1,n._pcReady=!1,n._channelReady=!1,n._remoteTracks=null,n._remoteStreams=null,n._senderMap=null,clearInterval(n._closingInterval),n._closingInterval=null,clearInterval(n._interval),n._interval=null,n._chunk=null,n._cb=null,n._onFinishBound&&n.removeListener("finish",n._onFinishBound),n._onFinishBound=null,n._channel){try{n._channel.close()}catch(e){}n._channel.onmessage=null,n._channel.onopen=null,n._channel.onclose=null,n._channel.onerror=null}if(n._pc){try{n._pc.close()}catch(e){}n._pc.oniceconnectionstatechange=null,n._pc.onicegatheringstatechange=null,n._pc.onsignalingstatechange=null,n._pc.onicecandidate=null,n._pc.ontrack=null,n._pc.ondatachannel=null}n._pc=null,n._channel=null,e&&n.emit("error",e),n.emit("close"),t()})))}},{key:"_setupData",value:function(e){var t=this;if(!e.channel)return this.destroy(h(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=g),this.channelName=this._channel.label,this._channel.onmessage=function(e){t._onChannelMessage(e)},this._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()},this._channel.onopen=function(){t._onChannelOpen()},this._channel.onclose=function(){t._onChannelClose()},this._channel.onerror=function(e){var n=e.error instanceof Error?e.error:new Error("Datachannel error: ".concat(e.message," ").concat(e.filename,":").concat(e.lineno,":").concat(e.colno));t.destroy(h(n,"ERR_DATA_CHANNEL"))};var n=!1;this._closingInterval=setInterval((function(){t._channel&&"closing"===t._channel.readyState?(n&&t._onChannelClose(),n=!0):n=!1}),5e3)}},{key:"_read",value:function(){}},{key:"_write",value:function(e,t,n){if(this.destroyed)return n(h(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(e){return this.destroy(h(e,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>g?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}},{key:"_onFinish",value:function(){var e=this;if(!this.destroyed){var t=function(){setTimeout((function(){return e.destroy()}),1e3)};this._connected?t():this.once("connect",t)}}},{key:"_startIceCompleteTimeout",value:function(){var e=this;this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout((function(){e._iceComplete||(e._iceComplete=!0,e._debug("iceComplete timeout completed"),e.emit("iceTimeout"),e.emit("_iceComplete"))}),this.iceCompleteTimeout))}},{key:"_createOffer",value:function(){var e=this;this.destroyed||this._pc.createOffer(this.offerOptions).then((function(t){if(!e.destroyed){e.trickle||e.allowHalfTrickle||(t.sdp=_(t.sdp)),t.sdp=e.sdpTransform(t.sdp);var n=function(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp})}};e._pc.setLocalDescription(t).then((function(){e._debug("createOffer success"),e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))})).catch((function(t){e.destroy(h(t,"ERR_SET_LOCAL_DESCRIPTION"))}))}})).catch((function(t){e.destroy(h(t,"ERR_CREATE_OFFER"))}))}},{key:"_requestMissingTransceivers",value:function(){var e=this;this._pc.getTransceivers&&this._pc.getTransceivers().forEach((function(t){t.mid||!t.sender.track||t.requested||(t.requested=!0,e.addTransceiver(t.sender.track.kind))}))}},{key:"_createAnswer",value:function(){var e=this;this.destroyed||this._pc.createAnswer(this.answerOptions).then((function(t){if(!e.destroyed){e.trickle||e.allowHalfTrickle||(t.sdp=_(t.sdp)),t.sdp=e.sdpTransform(t.sdp);var n=function(){if(!e.destroyed){var n=e._pc.localDescription||t;e._debug("signal"),e.emit("signal",{type:n.type,sdp:n.sdp}),e.initiator||e._requestMissingTransceivers()}};e._pc.setLocalDescription(t).then((function(){e.destroyed||(e.trickle||e._iceComplete?n():e.once("_iceComplete",n))})).catch((function(t){e.destroy(h(t,"ERR_SET_LOCAL_DESCRIPTION"))}))}})).catch((function(t){e.destroy(h(t,"ERR_CREATE_ANSWER"))}))}},{key:"_onConnectionStateChange",value:function(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(h(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}},{key:"_onIceStateChange",value:function(){if(!this.destroyed){var e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(h(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(h(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}}},{key:"getStats",value:function(e){var t=this,n=function(e){return"[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach((function(t){Object.assign(e,t)})),e};0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then((function(t){var r=[];t.forEach((function(e){r.push(n(e))})),e(null,r)}),(function(t){return e(t)})):this._pc.getStats.length>0?this._pc.getStats((function(r){if(!t.destroyed){var i=[];r.result().forEach((function(e){var t={};e.names().forEach((function(n){t[n]=e.stat(n)})),t.id=e.id,t.type=e.type,t.timestamp=e.timestamp,i.push(n(t))})),e(null,i)}}),(function(t){return e(t)})):e(null,[])}},{key:"_maybeReady",value:function(){var e=this;if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),!this._connected&&!this._connecting&&this._pcReady&&this._channelReady){this._connecting=!0;var t=function(){e.destroyed||e.getStats((function(n,r){if(!e.destroyed){n&&(r=[]);var i={},o={},a={},s=!1;r.forEach((function(e){"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(i[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(o[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(a[e.id]=e)}));var c=function(t){s=!0;var n=o[t.localCandidateId];n&&(n.ip||n.address)?(e.localAddress=n.ip||n.address,e.localPort=Number(n.port)):n&&n.ipAddress?(e.localAddress=n.ipAddress,e.localPort=Number(n.portNumber)):"string"==typeof t.googLocalAddress&&(n=t.googLocalAddress.split(":"),e.localAddress=n[0],e.localPort=Number(n[1])),e.localAddress&&(e.localFamily=e.localAddress.includes(":")?"IPv6":"IPv4");var r=i[t.remoteCandidateId];r&&(r.ip||r.address)?(e.remoteAddress=r.ip||r.address,e.remotePort=Number(r.port)):r&&r.ipAddress?(e.remoteAddress=r.ipAddress,e.remotePort=Number(r.portNumber)):"string"==typeof t.googRemoteAddress&&(r=t.googRemoteAddress.split(":"),e.remoteAddress=r[0],e.remotePort=Number(r[1])),e.remoteAddress&&(e.remoteFamily=e.remoteAddress.includes(":")?"IPv6":"IPv4"),e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)};if(r.forEach((function(e){"transport"===e.type&&e.selectedCandidatePairId&&c(a[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&c(e)})),s||Object.keys(a).length&&!Object.keys(o).length){if(e._connecting=!1,e._connected=!0,e._chunk){try{e.send(e._chunk)}catch(n){return e.destroy(h(n,"ERR_DATA_CHANNEL"))}e._chunk=null,e._debug('sent chunk from "write before connect"');var u=e._cb;e._cb=null,u(null)}"number"!=typeof e._channel.bufferedAmountLowThreshold&&(e._interval=setInterval((function(){return e._onInterval()}),150),e._interval.unref&&e._interval.unref()),e._debug("connect"),e.emit("connect")}else setTimeout(t,100)}}))};t()}}},{key:"_onInterval",value:function(){!this._cb||!this._channel||this._channel.bufferedAmount>g||this._onChannelBufferedAmountLow()}},{key:"_onSignalingStateChange",value:function(){var e=this;this.destroyed||("stable"===this._pc.signalingState&&(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach((function(t){e._pc.removeTrack(t),e._queuedNegotiation=!0})),this._sendersAwaitingStable=[],this._queuedNegotiation?(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()):(this._debug("negotiated"),this.emit("negotiated"))),this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}},{key:"_onIceCandidate",value:function(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{type:"candidate",candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}},{key:"_onChannelMessage",value:function(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=p.from(t)),this.push(t)}}},{key:"_onChannelBufferedAmountLow",value:function(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var e=this._cb;this._cb=null,e(null)}}},{key:"_onChannelOpen",value:function(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}},{key:"_onChannelClose",value:function(){this.destroyed||(this._debug("on channel close"),this.destroy())}},{key:"_onTrack",value:function(e){var t=this;this.destroyed||e.streams.forEach((function(n){t._debug("on track"),t.emit("track",e.track,n),t._remoteTracks.push({track:e.track,stream:n}),t._remoteStreams.some((function(e){return e.id===n.id}))||(t._remoteStreams.push(n),f((function(){t._debug("on stream"),t.emit("stream",n)})))}))}},{key:"_debug",value:function(){var e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],c.apply(null,e)}}]),n}(d.Duplex);y.WEBRTC_SUPPORT=!!u(),y.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},y.channelConfig={},e.exports=y})),n.register("jttaJ",(function(e,t){e.exports=function(){if("undefined"==typeof globalThis)return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null}})),n.register("gQh22",(function(t,r){var i=n("84cK9"),o=65536,a=n("701cS").Buffer,s=e.crypto||e.msCrypto;s&&s.getRandomValues?t.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var n=a.allocUnsafe(e);if(e>0)if(e>o)for(var r=0;r<e;r+=o)s.getRandomValues(n.slice(r,r+o));else s.getRandomValues(n);return"function"==typeof t?i.nextTick((function(){t(null,n)})):n}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}})),n.register("701cS",(function(e,t){ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ var r=n("cwBhL"),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,e.exports),e.exports.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}})),n.register("dBbLm",(function(e,t){(t=e.exports=n("5C7Ae")).Stream=t,t.Readable=t,t.Writable=n("gtuFE"),t.Duplex=n("2BOHu"),t.Transform=n("dtVM5"),t.PassThrough=n("aBHiK"),t.finished=n("9Yd4J"),t.pipeline=n("g9epQ")})),n.register("5C7Ae",(function(t,r){var i,o=n("84cK9");t.exports=R,R.ReadableState=E,n("h1Pcp").EventEmitter;var a,s=function(e,t){return e.listeners(t).length},c=n("106Iz"),u=n("cwBhL").Buffer,l=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},d=n("lfll6");a=d&&d.debuglog?d.debuglog("stream"):function(){};var f,h,p,g=n("i67zd"),_=n("euM1N"),y=n("dsoWb").getHighWaterMark,v=n("7Me6A").codes,b=v.ERR_INVALID_ARG_TYPE,m=v.ERR_STREAM_PUSH_AFTER_EOF,w=v.ERR_METHOD_NOT_IMPLEMENTED,k=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n("1e7Tp")(R,c);var S=_.errorOrDestroy,C=["error","close","destroy","pause","resume"];function E(e,t,r){i=i||n("2BOHu"),e=e||{},"boolean"!=typeof r&&(r=t instanceof i),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=y(this,e,"readableHighWaterMark",r),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(f||(f=n("2m9Ak").StringDecoder),this.decoder=new f(e.encoding),this.encoding=e.encoding)}function R(e){if(i=i||n("2BOHu"),!(this instanceof R))return new R(e);var t=this instanceof i;this._readableState=new E(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),c.call(this)}function T(e,t,n,r,i){a("readableAddChunk",t);var o,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(a("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?L(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,N(e)))}}(e,s);else if(i||(o=function(e,t){var n,r;return r=t,u.isBuffer(r)||r instanceof l||"string"==typeof t||void 0===t||e.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],t)),n}(s,t)),o)S(e,o);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r)s.endEmitted?S(e,new k):O(e,s,t,!0);else if(s.ended)S(e,new m);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?O(e,s,t,!1):M(e,s)):O(e,s,t,!1)}else r||(s.reading=!1,M(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function O(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&L(e)),M(e,t)}Object.defineProperty(R.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),R.prototype.destroy=_.destroy,R.prototype._undestroy=_.undestroy,R.prototype._destroy=function(e,t){t(e)},R.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=u.from(e,t),t=""),n=!0),T(this,e,t,!1,n)},R.prototype.unshift=function(e){return T(this,e,null,!0,!1)},R.prototype.isPaused=function(){return!1===this._readableState.flowing},R.prototype.setEncoding=function(e){f||(f=n("2m9Ak").StringDecoder);var t=new f(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var A=1073741824;function x(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=A?e=A:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function L(e){var t=e._readableState;a("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(a("emitReadable",t.flowing),t.emittedReadable=!0,o.nextTick(N,e))}function N(e){var t=e._readableState;a("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,F(e)}function M(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(P,e,t))}function P(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(a("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function j(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function I(e){a("readable nexttick read 0"),e.read(0)}function D(e,t){a("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),F(e),t.flowing&&!t.reading&&e.read(0)}function F(e){var t=e._readableState;for(a("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function U(e){var t=e._readableState;a("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,o.nextTick(W,t,e))}function W(e,t){if(a("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function H(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}R.prototype.read=function(e){a("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return a("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):L(this),null;if(0===(e=x(e,t))&&t.ended)return 0===t.length&&U(this),null;var r,i=t.needReadable;return a("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&a("length less than watermark",i=!0),t.ended||t.reading?a("reading or ended",i=!1):i&&(a("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=x(n,t))),null===(r=e>0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&U(this)),null!==r&&this.emit("data",r),r},R.prototype._read=function(e){S(this,new w("_read()"))},R.prototype.pipe=function(e,t){var n=function(e,t){a("onunpipe"),e===f&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,i())},r=function(){a("onend"),e.end()},i=function(){a("cleanup"),e.removeListener("close",u),e.removeListener("finish",l),e.removeListener("drain",g),e.removeListener("error",y),e.removeListener("unpipe",n),f.removeListener("end",r),f.removeListener("end",d),f.removeListener("data",c),_=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||g()},c=function(t){a("ondata");var n=e.write(t);a("dest.write",n),!1===n&&((1===h.pipesCount&&h.pipes===e||h.pipesCount>1&&-1!==H(h.pipes,e))&&!_&&(a("false write response, pause",h.awaitDrain),h.awaitDrain++),f.pause())},u=function(){e.removeListener("finish",l),d()},l=function(){a("onfinish"),e.removeListener("close",u),d()},d=function(){a("unpipe"),f.unpipe(e)},f=this,h=this._readable