You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
4 lines
85 KiB
4 lines
85 KiB
2 years ago
|
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.P2P=e()}})(function(){var e,t,r;return function n(e,t,r){function i(a,s){if(!t[a]){if(!e[a]){var f=typeof require=="function"&&require;if(!s&&f)return f(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=t[a]={exports:{}};e[a][0].call(u.exports,function(t){var r=e[a][1][t];return i(r?r:t)},u,u.exports,n,e,t,r)}return t[a].exports}var o=typeof require=="function"&&require;for(var a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,r){},{}],2:[function(e,t,r){var n=e("base64-js");var i=e("ieee754");var o=e("is-array");r.Buffer=f;r.SlowBuffer=c;r.INSPECT_MAX_BYTES=50;f.poolSize=8192;var a=1073741823;var s={};f.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0);var t=new Uint8Array(e);t.foo=function(){return 42};return t.foo()===42&&typeof t.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(r){return false}}();function f(e,t,r){if(!(this instanceof f))return new f(e,t,r);var n=typeof e;var i;if(n==="number"){i=+e}else if(n==="string"){i=f.byteLength(e,t)}else if(n==="object"&&e!==null){if(e.type==="Buffer"&&o(e.data))e=e.data;i=+e.length}else{throw new TypeError("must start with number, buffer, array or string")}if(i>a)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+a.toString(16)+" bytes");if(i<0)i=0;else i>>>=0;var c=this;if(f.TYPED_ARRAY_SUPPORT){c=f._augment(new Uint8Array(i))}else{c.length=i;c._isBuffer=true}var u;if(f.TYPED_ARRAY_SUPPORT&&typeof e.byteLength==="number"){c._set(e)}else if(P(e)){if(f.isBuffer(e)){for(u=0;u<i;u++)c[u]=e.readUInt8(u)}else{for(u=0;u<i;u++)c[u]=(e[u]%256+256)%256}}else if(n==="string"){c.write(e,0,t)}else if(n==="number"&&!f.TYPED_ARRAY_SUPPORT&&!r){for(u=0;u<i;u++){c[u]=0}}if(i>0&&i<=f.poolSize)c.parent=s;return c}function c(e,t,r){if(!(this instanceof c))return new c(e,t,r);var n=new f(e,t,r);delete n.parent;return n}f.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};f.compare=function(e,t){if(!f.isBuffer(e)||!f.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;var r=e.length;var n=t.length;for(var i=0,o=Math.min(r,n);i<o&&e[i]===t[i];i++){}if(i!==o){r=e[i];n=t[i]}if(r<n)return-1;if(n<r)return 1;return 0};f.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};f.concat=function(e,t){if(!o(e))throw new TypeError("Usage: Buffer.concat(list[, length])");if(e.length===0){return new f(0)}else if(e.length===1){return e[0]}var r;if(t===undefined){t=0;for(r=0;r<e.length;r++){t+=e[r].length}}var n=new f(t);var i=0;for(r=0;r<e.length;r++){var a=e[r];a.copy(n,i);i+=a.length}return n};f.byteLength=function(e,t){var r;e=e+"";switch(t||"utf8"){case"ascii":case"binary":case"raw":r=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=e.length*2;break;case"hex":r=e.length>>>1;break;case"utf8":case"utf-8":r=j(e).length;break;case"base64":r=O(e).length;break;default:r=e.length}return r};f.prototype.length=undefined;f.prototype.parent=undefined;f.prototype.toString=function(e,t,r){var n=false;t=t>>>0;r=r===undefined||r===Infinity?this.length:r>>>0;if(!e)e="utf8";if(t<0)t=0;if(r>this.length)r=this.length;if(r<=t)return"";while(true){switch(e){case"hex":return w(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return y(this,t,r);case"binary":return m(this,t,r);case"base64":return v(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}};f.prototype.equals=function(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(thi
|
||
|
c("onerror",t);y();e.removeListener("error",g);if(o.listenerCount(e,"error")===0)e.emit("error",t)}if(!e._events||!e._events.error)e.on("error",g);else if(n(e._events.error))e._events.error.unshift(g);else e._events.error=[g,e._events.error];function v(){e.removeListener("finish",b);y()}e.once("close",v);function b(){c("onfinish");e.removeListener("close",v);y()}e.once("finish",b);function y(){c("unpipe");i.unpipe(e)}e.emit("pipe",i);if(!a.flowing){c("pipe resume");i.resume()}return e};function A(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&o.listenerCount(e,"data")){t.flowing=true;S(e)}}}l.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1){if(e&&e!==t.pipes)return this;if(!e)e=t.pipes;t.pipes=null;t.pipesCount=0;t.flowing=false;if(e)e.emit("unpipe",this);return this}if(!e){var r=t.pipes;var n=t.pipesCount;t.pipes=null;t.pipesCount=0;t.flowing=false;for(var i=0;i<n;i++)r[i].emit("unpipe",this);return this}var i=L(t.pipes,e);if(i===-1)return this;t.pipes.splice(i,1);t.pipesCount-=1;if(t.pipesCount===1)t.pipes=t.pipes[0];e.emit("unpipe",this);return this};l.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t);if(e==="data"&&false!==this._readableState.flowing){this.resume()}if(e==="readable"&&this.readable){var i=this._readableState;if(!i.readableListening){i.readableListening=true;i.emittedReadable=false;i.needReadable=true;if(!i.reading){var o=this;r.nextTick(function(){c("readable nexttick read 0");o.read(0)})}else if(i.length){m(this,i)}}}return n};l.prototype.addListener=l.prototype.on;l.prototype.resume=function(){var e=this._readableState;if(!e.flowing){c("resume");e.flowing=true;if(!e.reading){c("resume read 0");this.read(0)}C(this,e)}return this};function C(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;r.nextTick(function(){k(e,t)})}}function k(e,t){t.resumeScheduled=false;e.emit("resume");S(e);if(t.flowing&&!t.reading)e.read(0)}l.prototype.pause=function(){c("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){c("pause");this._readableState.flowing=false;this.emit("pause")}return this};function S(e){var t=e._readableState;c("flow",t.flowing);if(t.flowing){do{var r=e.read()}while(null!==r&&t.flowing)}}l.prototype.wrap=function(e){var t=this._readableState;var r=false;var n=this;e.on("end",function(){c("wrapped end");if(t.decoder&&!t.ended){var e=t.decoder.end();if(e&&e.length)n.push(e)}n.push(null)});e.on("data",function(i){c("wrapped data");if(t.decoder)i=t.decoder.write(i);if(!i||!t.objectMode&&!i.length)return;var o=n.push(i);if(!o){r=true;e.pause()}});for(var i in e){if(s.isFunction(e[i])&&s.isUndefined(this[i])){this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i)}}var o=["error","close","destroy","pause","resume"];I(o,function(t){e.on(t,n.emit.bind(n,t))});n._read=function(t){c("wrapped _read",t);if(r){r=false;e.resume()}};return n};l._fromList=R;function R(e,t){var r=t.buffer;var n=t.length;var o=!!t.decoder;var a=!!t.objectMode;var s;if(r.length===0)return null;if(n===0)s=null;else if(a)s=r.shift();else if(!e||e>=n){if(o)s=r.join("");else s=i.concat(r,n);r.length=0}else{if(e<r[0].length){var f=r[0];s=f.slice(0,e);r[0]=f.slice(e)}else if(e===r[0].length){s=r.shift()}else{if(o)s="";else s=new i(e);var c=0;for(var u=0,l=r.length;u<l&&c<e;u++){var f=r[0];var h=Math.min(e-c,f.length);if(o)s+=f.slice(0,h);else f.copy(s,c,0,h);if(h<f.length)r[0]=f.slice(h);else r.shift();c+=h}}}return s}function T(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");if(!t.endEmitted){t.ended=true;r.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function I(e,t){for(var r=0,n=e.length;r<n;r++){t(e[r],r)}}function L(e,t){for(var r=0,n=e.length;r<n;r++){if(e[r]===t)return r}return-1}}).call(this,e("_process"))},{"./_stream_duplex":11,_process:9,buffer:2,"core-util-is":16,events:6,inherits:7,isarray:8,stream:21,"string_dec
|
||
|
|
||
|
};l.prototype._onChannelClose=function(){var e=this;if(e.destroyed)return;e._debug("on channel close");e._destroy()};l.prototype._onAddStream=function(e){var t=this;if(t.destroyed)return;t._debug("on add stream");t.emit("stream",e.stream)};l.prototype._onError=function(e){var t=this;if(t.destroyed)return;t._debug("error %s",e.message||e);t._destroy(e)};l.prototype._debug=function(){var e=this;var t=[].slice.call(arguments);var r=e.channelName&&e.channelName.substring(0,7);t[0]="["+r+"] "+t[0];n.apply(null,t)};function h(){}}).call(this,e("buffer").Buffer)},{buffer:2,debug:25,"get-browser-rtc":34,hat:31,inherits:32,"is-typedarray":35,once:37,stream:21,"typedarray-to-buffer":38}],34:[function(e,t,r){t.exports=function n(){if(typeof window==="undefined")return null;var e={RTCPeerConnection:window.mozRTCPeerConnection||window.RTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.mozRTCSessionDescription||window.RTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.mozRTCIceCandidate||window.RTCIceCandidate||window.webkitRTCIceCandidate};if(!e.RTCPeerConnection)return null;return e}},{}],35:[function(e,t,r){t.exports=o;o.strict=a;o.loose=s;var n=Object.prototype.toString;var i={"[object Int8Array]":true,"[object Int16Array]":true,"[object Int32Array]":true,"[object Uint8Array]":true,"[object Uint8ClampedArray]":true,"[object Uint16Array]":true,"[object Uint32Array]":true,"[object Float32Array]":true,"[object Float64Array]":true};function o(e){return a(e)||s(e)}function a(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return i[n.call(e)]}},{}],36:[function(e,t,r){t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach(function(t){r[t]=e[t]});return r;function r(){var t=new Array(arguments.length);for(var r=0;r<t.length;r++){t[r]=arguments[r]}var n=e.apply(this,t);var i=t[t.length-1];if(typeof n==="function"&&n!==i){Object.keys(i).forEach(function(e){n[e]=i[e]})}return n}}},{}],37:[function(e,t,r){var n=e("wrappy");t.exports=n(i);i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:true})});function i(e){var t=function(){if(t.called)return t.value;t.called=true;return t.value=e.apply(this,arguments)};t.called=false;return t}},{wrappy:36}],38:[function(e,t,r){(function(r){var n=e("is-typedarray").strict;t.exports=function(e){var t=r.TYPED_ARRAY_SUPPORT?r._augment:function(e){return new r(e)};if(e instanceof Uint8Array){return t(e)}else if(e instanceof ArrayBuffer){return t(new Uint8Array(e))}else if(n(e)){return t(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}else{return new r(e)}}}).call(this,e("buffer").Buffer)},{buffer:2,"is-typedarray":35}],39:[function(e,t,r){(function(t){var n=e("isarray");var i=e("./is-buffer");r.deconstructPacket=function(e){var t=[];var r=e.data;function o(e){if(!e)return e;if(i(e)){var r={_placeholder:true,num:t.length};t.push(e);return r}else if(n(e)){var a=new Array(e.length);for(var s=0;s<e.length;s++){a[s]=o(e[s])}return a}else if("object"==typeof e&&!(e instanceof Date)){var a={};for(var f in e){a[f]=o(e[f])}return a}return e}var a=e;a.data=o(r);a.attachments=t.length;return{packet:a,buffers:t}};r.reconstructPacket=function(e,t){var r=0;function i(e){if(e&&e._placeholder){var r=t[e.num];return r}else if(n(e)){for(var o=0;o<e.length;o++){e[o]=i(e[o])}return e}else if(e&&"object"==typeof e){for(var a in e){e[a]=i(e[a])}return e}return e}e.data=i(e.data);e.attachments=undefined;return e};r.removeBlobs=function(e,r){function o(e,f,c){if(!e)return e;if(t.Blob&&e instanceof Blob||t.File&&e instanceof File){a++;var u=new FileReader;u.onload=function(){if(c){c[f]=this.result}else{s=this.result}if(!--a){r(s)}};u.readAsArrayBuffer(e)}else if(n(e)){for(var l=0;l<e.length;l++){o(e[l],l,e)}}else
|