UNPKG

zby_im_sdk

Version:

直播云imSDK

1 lines 93.4 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.zbyIm=e():t.zbyIm=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=24)}([function(t,e,n){"use strict";var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}t.exports=r},function(t,e,n){"use strict";(function(t){var r=n(40),o=n(41),i=n(42),s=n(43),a=n(44),c=n(45),u=navigator.userAgent.match(/Android/i),l=/PhantomJS/i.test(navigator.userAgent),h=u||l;e.protocol=3;var f=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},p=r(f),d={type:"error",data:"parser error"},y=n(46);function m(t,e,n){for(var r=new Array(t.length),o=a(t.length,n),i=function(t,n,o){e(n,function(e,n){r[t]=n,o(e,r)})},s=0;s<t.length;s++)i(s,t[s],o)}e.encodePacket=function(n,r,o,i){"function"==typeof r&&(i=r,r=!1),"function"==typeof o&&(i=o,o=null);var s=void 0===n.data?void 0:n.data.buffer||n.data;if(t.ArrayBuffer&&s instanceof ArrayBuffer)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=t.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=f[t.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return r(s.buffer)}(n,r,i);if(y&&s instanceof t.Blob)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);if(h)return function(t,n,r){if(!n)return e.encodeBase64Packet(t,r);var o=new FileReader;return o.onload=function(){t.data=o.result,e.encodePacket(t,n,!0,r)},o.readAsArrayBuffer(t.data)}(t,n,r);var o=new Uint8Array(1);o[0]=f[t.type];var i=new y([o.buffer,t.data]);return r(i)}(n,r,i);if(s&&s.base64)return function(t,n){var r="b"+e.packets[t.type]+t.data.data;return n(r)}(n,i);var a=f[n.type];return void 0!==n.data&&(a+=o?c.encode(String(n.data)):String(n.data)),i(""+a)},e.encodeBase64Packet=function(n,r){var o,i="b"+e.packets[n.type];if(y&&n.data instanceof t.Blob){var s=new FileReader;return s.onload=function(){var t=s.result.split(",")[1];r(i+t)},s.readAsDataURL(n.data)}try{o=String.fromCharCode.apply(null,new Uint8Array(n.data))}catch(t){for(var a=new Uint8Array(n.data),c=new Array(a.length),u=0;u<a.length;u++)c[u]=a[u];o=String.fromCharCode.apply(null,c)}return i+=t.btoa(o),r(i)},e.decodePacket=function(t,n,r){if("string"==typeof t||void 0===t){if("b"==t.charAt(0))return e.decodeBase64Packet(t.substr(1),n);if(r)try{t=c.decode(t)}catch(t){return d}var o=t.charAt(0);return Number(o)==o&&p[o]?t.length>1?{type:p[o],data:t.substring(1)}:{type:p[o]}:d}o=new Uint8Array(t)[0];var s=i(t,1);return y&&"blob"===n&&(s=new y([s])),{type:p[o],data:s}},e.decodeBase64Packet=function(e,n){var r=p[e.charAt(0)];if(!t.ArrayBuffer)return{type:r,data:{base64:!0,data:e.substr(1)}};var o=s.decode(e.substr(1));return"blob"===n&&y&&(o=new y([o])),{type:r,data:o}},e.encodePayload=function(t,n,r){"function"==typeof n&&(r=n,n=null);var i=o(t);if(n&&i)return y&&!h?e.encodePayloadAsBlob(t,r):e.encodePayloadAsArrayBuffer(t,r);if(!t.length)return r("0:");m(t,function(t,r){e.encodePacket(t,!!i&&n,!0,function(t){r(null,function(t){return t.length+":"+t}(t))})},function(t,e){return r(e.join(""))})},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);var o;if("function"==typeof n&&(r=n,n=null),""==t)return r(d,0,1);for(var i,s,a="",c=0,u=t.length;c<u;c++){var l=t.charAt(c);if(":"!=l)a+=l;else{if(""==a||a!=(i=Number(a)))return r(d,0,1);if(a!=(s=t.substr(c+1,i)).length)return r(d,0,1);if(s.length){if(o=e.decodePacket(s,n,!0),d.type==o.type&&d.data==o.data)return r(d,0,1);if(!1===r(o,c+i,u))return}c+=i,a=""}}return""!=a?r(d,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,n){if(!t.length)return n(new ArrayBuffer(0));m(t,function(t,n){e.encodePacket(t,!0,!0,function(t){return n(null,t)})},function(t,e){var r=e.reduce(function(t,e){var n;return t+(n="string"==typeof e?e.length:e.byteLength).toString().length+n+2},0),o=new Uint8Array(r),i=0;return e.forEach(function(t){var e="string"==typeof t,n=t;if(e){for(var r=new Uint8Array(t.length),s=0;s<t.length;s++)r[s]=t.charCodeAt(s);n=r.buffer}o[i++]=e?0:1;var a=n.byteLength.toString();for(s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(r=new Uint8Array(n),s=0;s<r.length;s++)o[i++]=r[s]}),n(o.buffer)})},e.encodePayloadAsBlob=function(t,n){m(t,function(t,n){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var r=new Uint8Array(t.length),o=0;o<t.length;o++)r[o]=t.charCodeAt(o);t=r.buffer,e[0]=0}var i=(t instanceof ArrayBuffer?t.byteLength:t.size).toString(),s=new Uint8Array(i.length+1);for(o=0;o<i.length;o++)s[o]=parseInt(i[o]);if(s[i.length]=255,y){var a=new y([e.buffer,s.buffer,t]);n(null,a)}})},function(t,e){return n(new y(e))})},e.decodePayloadAsBinary=function(t,n,r){"function"==typeof n&&(r=n,n=null);for(var o=t,s=[],a=!1;o.byteLength>0;){for(var c=new Uint8Array(o),u=0===c[0],l="",h=1;255!=c[h];h++){if(l.length>310){a=!0;break}l+=c[h]}if(a)return r(d,0,1);o=i(o,2+l.length),l=parseInt(l);var f=i(o,0,l);if(u)try{f=String.fromCharCode.apply(null,new Uint8Array(f))}catch(t){var p=new Uint8Array(f);f="";for(h=0;h<p.length;h++)f+=String.fromCharCode(p[h])}s.push(f),o=i(o,l)}var y=s.length;s.forEach(function(t,o){r(e.decodePacket(t,n,!0),o,y)})}}).call(this,n(0))},function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function o(){var t;try{t=e.storage.debug}catch(t){}return t}(e=t.exports=n(27)).log=function(){return"object"===("undefined"==typeof console?"undefined":r(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(){var t=arguments,n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),!n)return t;var r="color: "+this.color,o=0,i=0;return(t=[t[0],r,"color: inherit"].concat(Array.prototype.slice.call(t,1)))[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&"%c"===t&&(i=++o)}),t.splice(i,0,r),t},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=o,e.useColors=function(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){return JSON.stringify(t)},e.enable(o())},function(t,e,n){"use strict";t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},function(t,e,n){"use strict";t.exports=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function o(){var t;try{t=e.storage.debug}catch(t){}return t}(e=t.exports=n(47)).log=function(){return"object"===("undefined"==typeof console?"undefined":r(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(){var t=arguments,n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),!n)return t;var r="color: "+this.color,o=0,i=0;return(t=[t[0],r,"color: inherit"].concat(Array.prototype.slice.call(t,1)))[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&"%c"===t&&(i=++o)}),t.splice(i,0,r),t},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=o,e.useColors=function(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){return JSON.stringify(t)},e.enable(o())},function(t,e,n){"use strict";var r=n(29)("socket.io-parser"),o=n(32),i=(n(3),n(33)),s=n(34),a=n(14);function c(){}function u(t){var n="",i=!1;return n+=t.type,e.BINARY_EVENT!=t.type&&e.BINARY_ACK!=t.type||(n+=t.attachments,n+="-"),t.nsp&&"/"!=t.nsp&&(i=!0,n+=t.nsp),null!=t.id&&(i&&(n+=",",i=!1),n+=t.id),null!=t.data&&(i&&(n+=","),n+=o.stringify(t.data)),r("encoded %j as %s",t,n),n}function l(){this.reconstructor=null}function h(t){this.reconPack=t,this.buffers=[]}function f(t){return{type:e.ERROR,data:"parser error"}}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=c,e.Decoder=l,c.prototype.encode=function(t,n){(r("encoding packet %j",t),e.BINARY_EVENT==t.type||e.BINARY_ACK==t.type)?function(t,e){s.removeBlobs(t,function(t){var n=s.deconstructPacket(t),r=u(n.packet),o=n.buffers;o.unshift(r),e(o)})}(t,n):n([u(t)])},i(l.prototype),l.prototype.add=function(t){var n;if("string"==typeof t)n=function(t){var n={},i=0;if(n.type=Number(t.charAt(0)),null==e.types[n.type])return f();if(e.BINARY_EVENT==n.type||e.BINARY_ACK==n.type){for(var s="";"-"!=t.charAt(++i)&&(s+=t.charAt(i),i!=t.length););if(s!=Number(s)||"-"!=t.charAt(i))throw new Error("Illegal attachments");n.attachments=Number(s)}if("/"==t.charAt(i+1))for(n.nsp="";++i;){var a=t.charAt(i);if(","==a)break;if(n.nsp+=a,i==t.length)break}else n.nsp="/";var c=t.charAt(i+1);if(""!==c&&Number(c)==c){for(n.id="";++i;){var a=t.charAt(i);if(null==a||Number(a)!=a){--i;break}if(n.id+=t.charAt(i),i==t.length)break}n.id=Number(n.id)}if(t.charAt(++i))try{n.data=o.parse(t.substr(i))}catch(t){return f()}return r("decoded %s as %j",t,n),n}(t),e.BINARY_EVENT==n.type||e.BINARY_ACK==n.type?(this.reconstructor=new h(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!a(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,this.emit("decoded",n))}},l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},h.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length==this.reconPack.attachments){var e=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},h.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e){(function(e){t.exports=e}).call(this,{})},function(t,e,n){"use strict";var r=n(38);t.exports=function(t){var e=t.xdomain,n=t.xscheme,o=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||r))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!n&&o)return new XDomainRequest}catch(t){}if(!e)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}},function(t,e,n){"use strict";var r=n(1),o=n(10);function i(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders}t.exports=i,o(i.prototype),i.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},i.prototype.open=function(){return"closed"!=this.readyState&&""!=this.readyState||(this.readyState="opening",this.doOpen()),this},i.prototype.close=function(){return"opening"!=this.readyState&&"open"!=this.readyState||(this.doClose(),this.onClose()),this},i.prototype.send=function(t){if("open"!=this.readyState)throw new Error("Transport not open");this.write(t)},i.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},i.prototype.onData=function(t){var e=r.decodePacket(t,this.socket.binaryType);this.onPacket(e)},i.prototype.onPacket=function(t){this.emit("packet",t)},i.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,n){"use strict";function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},r.prototype.once=function(t,e){var n=this;function r(){n.off(t,r),e.apply(this,arguments)}return this._callbacks=this._callbacks||{},r.fn=e,this.on(t,r),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks[t];if(!r)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks[t];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){"use strict";e.encode=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},e.decode=function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},function(t,e,n){"use strict";var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,o=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,n=t.indexOf("["),i=t.indexOf("]");-1!=n&&-1!=i&&(t=t.substring(0,n)+t.substring(n,i).replace(/:/g,";")+t.substring(i,t.length));for(var s=r.exec(t||""),a={},c=14;c--;)a[o[c]]=s[c]||"";return-1!=n&&-1!=i&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e,n){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";(function(e){t.exports=function(t){return e.Buffer&&e.Buffer.isBuffer(t)||e.ArrayBuffer&&t instanceof ArrayBuffer}}).call(this,n(0))},function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n(35),i=n(20),s=n(21),a=n(6),c=n(22),u=n(23),l=n(2)("socket.io-client:manager"),h=n(19),f=n(55),p=Object.prototype.hasOwnProperty;function d(t,e){if(!(this instanceof d))return new d(t,e);t&&"object"==(void 0===t?"undefined":r(t))&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new f({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[],this.encoder=new a.Encoder,this.decoder=new a.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}t.exports=d,d.prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)p.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},d.prototype.updateSocketIds=function(){for(var t in this.nsps)p.call(this.nsps,t)&&(this.nsps[t].id=this.engine.id)},s(d.prototype),d.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},d.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},d.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},d.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},d.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},d.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},d.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},d.prototype.open=d.prototype.connect=function(t){if(l("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;l("opening %s",this.uri),this.engine=o(this.uri,this.opts);var e=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var r=c(e,"open",function(){n.onopen(),t&&t()}),i=c(e,"error",function(e){if(l("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",e),t){var r=new Error("Connection error");r.data=e,t(r)}else n.maybeReconnectOnOpen()});if(!1!==this._timeout){var s=this._timeout;l("connect attempt will timeout after %d",s);var a=setTimeout(function(){l("connect attempt timed out after %d",s),r.destroy(),e.close(),e.emit("error","timeout"),n.emitAll("connect_timeout",s)},s);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(r),this.subs.push(i),this},d.prototype.onopen=function(){l("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(c(t,"data",u(this,"ondata"))),this.subs.push(c(t,"ping",u(this,"onping"))),this.subs.push(c(t,"pong",u(this,"onpong"))),this.subs.push(c(t,"error",u(this,"onerror"))),this.subs.push(c(t,"close",u(this,"onclose"))),this.subs.push(c(this.decoder,"decoded",u(this,"ondecoded")))},d.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},d.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},d.prototype.ondata=function(t){this.decoder.add(t)},d.prototype.ondecoded=function(t){this.emit("packet",t)},d.prototype.onerror=function(t){l("error",t),this.emitAll("error",t)},d.prototype.socket=function(t){var e=this.nsps[t];if(!e){e=new i(this,t),this.nsps[t]=e;var n=this;e.on("connecting",r),e.on("connect",function(){e.id=n.engine.id}),this.autoConnect&&r()}function r(){~h(n.connecting,e)||n.connecting.push(e)}return e},d.prototype.destroy=function(t){var e=h(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},d.prototype.packet=function(t){l("writing packet %j",t);var e=this;e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(n){for(var r=0;r<n.length;r++)e.engine.write(n[r],t.options);e.encoding=!1,e.processPacketQueue()}))},d.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},d.prototype.cleanup=function(){var t;for(l("cleanup");t=this.subs.shift();)t.destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},d.prototype.close=d.prototype.disconnect=function(){l("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"==this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},d.prototype.onclose=function(t){l("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},d.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)l("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();l("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(l("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(l("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(l("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},d.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){"use strict";(function(t){var r=n(8),o=n(39),i=n(49),s=n(50);e.polling=function(e){var n=!1,s=!1,a=!1!==e.jsonp;if(t.location){var c="https:"==location.protocol,u=location.port;u||(u=c?443:80),n=e.hostname!=location.hostname||u!=e.port,s=e.secure!=c}if(e.xdomain=n,e.xscheme=s,"open"in new r(e)&&!e.forceJSONP)return new o(e);if(!a)throw new Error("JSONP disabled");return new i(e)},e.websocket=s}).call(this,n(0))},function(t,e,n){"use strict";var r=n(9),o=n(11),i=n(1),s=n(4),a=n(18),c=n(5)("engine.io-client:polling");t.exports=l;var u=null!=new(n(8))({xdomain:!1}).responseType;function l(t){var e=t&&t.forceBase64;u&&!e||(this.supportsBinary=!1),r.call(this,t)}s(l,r),l.prototype.name="polling",l.prototype.doOpen=function(){this.poll()},l.prototype.pause=function(t){var e=this;function n(){c("paused"),e.readyState="paused",t()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(c("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){c("pre-pause polling complete"),--r||n()})),this.writable||(c("we are currently writing - waiting to pause"),r++,this.once("drain",function(){c("pre-pause writing complete"),--r||n()}))}else n()},l.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},l.prototype.onData=function(t){var e=this;c("polling got data %s",t);i.decodePayload(t,this.socket.binaryType,function(t,n,r){if("opening"==e.readyState&&e.onOpen(),"close"==t.type)return e.onClose(),!1;e.onPacket(t)}),"closed"!=this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"==this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},l.prototype.doClose=function(){var t=this;function e(){c("writing close packet"),t.write([{type:"close"}])}"open"==this.readyState?(c("transport open - closing"),e()):(c("transport not open - deferring close"),this.once("open",e))},l.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};e=this;i.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,n)})},l.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=a()),this.supportsBinary||t.sid||(t.b64=1),t=o.encode(t),this.port&&("https"==e&&443!=this.port||"http"==e&&80!=this.port)&&(n=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t}},function(t,e,n){"use strict";var r,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,s={},a=0,c=0;function u(t){var e="";do{e=o[t%i]+e,t=Math.floor(t/i)}while(t>0);return e}function l(){var t=u(+new Date);return t!==r?(a=0,r=t):t+"."+u(a++)}for(;c<i;c++)s[o[c]]=c;l.encode=u,l.decode=function(t){var e=0;for(c=0;c<t.length;c++)e=e*i+s[t.charAt(c)];return e},t.exports=l},function(t,e,n){"use strict";var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e,n){"use strict";var r=n(6),o=n(21),i=n(53),s=n(22),a=n(23),c=n(2)("socket.io-client:socket"),u=n(54);t.exports=f;var l={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},h=o.prototype.emit;function f(t,e){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.io.autoConnect&&this.open()}o(f.prototype),f.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[s(t,"open",a(this,"onopen")),s(t,"packet",a(this,"onpacket")),s(t,"close",a(this,"onclose"))]}},f.prototype.open=f.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"==this.io.readyState&&this.onopen(),this.emit("connecting"),this)},f.prototype.send=function(){var t=i(arguments);return t.unshift("message"),this.emit.apply(this,t),this},f.prototype.emit=function(t){if(l.hasOwnProperty(t))return h.apply(this,arguments),this;var e=i(arguments),n=r.EVENT;u(e)&&(n=r.BINARY_EVENT);var o={type:n,data:e,options:{}};return o.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),o.id=this.ids++),this.connected?this.packet(o):this.sendBuffer.push(o),delete this.flags,this},f.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},f.prototype.onopen=function(){c("transport is open - connecting"),"/"!=this.nsp&&this.packet({type:r.CONNECT})},f.prototype.onclose=function(t){c("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},f.prototype.onpacket=function(t){if(t.nsp==this.nsp)switch(t.type){case r.CONNECT:this.onconnect();break;case r.EVENT:case r.BINARY_EVENT:this.onevent(t);break;case r.ACK:case r.BINARY_ACK:this.onack(t);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",t.data)}},f.prototype.onevent=function(t){var e=t.data||[];c("emitting event %j",e),null!=t.id&&(c("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?h.apply(this,e):this.receiveBuffer.push(e)},f.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var o=i(arguments);c("sending ack %j",o);var s=u(o)?r.BINARY_ACK:r.ACK;e.packet({type:s,id:t,data:o})}}},f.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(c("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):c("bad ack %s",t.id)},f.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},f.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)h.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},f.prototype.ondisconnect=function(){c("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},f.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},f.prototype.close=f.prototype.disconnect=function(){return this.connected&&(c("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},f.prototype.compress=function(t){return this.flags=this.flags||{},this.flags.compress=t,this}},function(t,e,n){"use strict";function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,n){"use strict";t.exports=function(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}}},function(t,e,n){"use strict";var r=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=r.call(arguments,2);return function(){return e.apply(t,n.concat(r.call(arguments)))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=a(n(25)),i=a(n(56)),s=n(57);function a(t){return t&&t.__esModule?t:{default:t}}var c=["device","orgId","classId","classType","userId","userImg","username","userRole","usercode | usertoken","teacherId","videoMode"],u={version:"0.0.1",history:1,classmode:"1",status:[{code:"01",msg:"control信道连接失败!"},{code:"02",msg:"message信道连接失败!"},{code:"03",msg:"老师进入教室"},{code:"04",msg:"老师离开教室"},{code:"05",msg:"已开启全体禁言"},{code:"06",msg:"您已被禁言"},{code:"07",msg:"已取消全体禁言"},{code:"08",msg:"您已被取消禁言"},{code:"09",msg:"课程已开始"},{code:"10",msg:"课程已结束"},{code:"11",msg:"您已进入教室"}]},l=function(t){var e={instid:t.orgId,room:t.classId,userid:t.userId};return"code"==t.classType?e.code=t.usercode:e.token=t.usertoken,e},h=function(t,e){var n={role:"teacher"==t.userRole?"1":"2",history:u.history,room:t.classId,userid:t.userId,username:t.username,avatar:t.userImg,playmode:t.videoMode,device:t.device,instid:t.orgId};return e&&(n.classmode=u.classmode),n},f=null,p=!1,d=new i.default,y={},m=void 0,g=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.initializer(e)}return r(t,[{key:"version",get:function(){return"0.0.1"}},{key:"history",get:function(){return 1}},{key:"classmode",get:function(){return"1"}},{key:"constant",get:function(){return u}}],[{key:"init",value:function(e){return new t(e)}}]),r(t,[{key:"initializer",value:function(t){var e=this;this.index=0,this.clOk=!1,this.imOk=!1,this.addStreamTemp=null,this.removeStreamUrl=null,this.events=this.events||d,this.on=d.on.bind(this.events),this.emit=d.emit.bind(this.events),y=t,setTimeout(function(){e.events.emit("test")},6e3)}},{key:"initIm",value:function(){this._initIm(y)}},{key:"_initIm",value:function(t){var e=this;(0,s.optionsValid)(c,t),Object.keys(t).forEach(function(e){"function"==typeof t[e]&&d.on(e,t[e])}),this.uid=t.userId,this.tid=t.teacherId,this.username=t.username,this.userRole=t.userRole,this.classId=t.classId;var n=(0,o.default)(t.url+"/control"),r=(0,o.default)(t.url+"/chat",{transports:["websocket"]});n.on("connect",function(){e.clOk=!0,console.log("cl con"),d.emit("handlerConnected"),n.emit("authenticate",l(t))}),n.on("authenticated",function(){e._onControlAuth(t);var n=l(t);n.mode="simple",r.emit("authenticate",n)}),n.on("unauthorized",function(){e._handlerStatusChange(t,0)}),n.on("stream",function(n){console.log("json",n),e._onControlStream(t,n)}),n.on("netstate",function(n){e._handlerPing(t,n)}),n.on("offline",function(n){n.role&&"1"==n.role&&e._handlerStatusChange(t,3)}),n.on("join_room",function(n){n.role&&"1"==n.role&&e._handlerStatusChange(t,2)}),n.on("force_exit",function(){e.emit("handlerExit"),e.disConnect()}),n.on("online_counts",function(t){console.log("online_counts",t),e.emit("handlerOnlineCounts",t.onlinecounts)}),n.on("disconnect",function(){e.clOk=!1,e.emit("handlerDisconnect"),console.log("cl dis")}),r.on("connect",function(){e.imOk=!0,console.log("im con")}),r.on("authenticated",function(){e._onMessageAuth(t)}),r.on("unauthorized",function(){e._handlerStatusChange(t,1)}),r.on("notice",function(t){e.emit("handlerNotice",t)}),r.on("message",function(t){t&&"authorizemic"==t.mtype?e.emit("handlerStatusChange",{code:"00",msg:t.message}):e.emit("handlerMsg",t)}),r.on("unspeak",function(n){e._unspeak(t,n)}),r.on("disconnect",function(){e.imOk=!1,console.log("im dis")}),this.cl=n,this.im=r}},{key:"_handlerStatusChange",value:function(t,e){this.emit("handlerStatusChange",u.status[e])}},{key:"_onControlAuth",value:function(t){var e=this;this.cl.emit("join_room",h(t,!0),function(n){if(console.log("control join room",n),n&&0==n.code){e._handlerStatusChange(t,10),console.log("emit join_room",n),e.emit("handlerOnlineCounts",n.data.onlinecounts),e.cl.emit("history_message",{},function(n){if(n&&0==n.code)for(var r=0;r<n.data.history_list.length;r++)e._handlerClass(t,n.data.history_list[r])}),console.log("--------------------------------------------");var r={api:"join",appId:"",roomId:t.classId,actorId:t.userId,actorName:t.username,actorType:t.userRole,streamService:"tm",canTalk:t.canTalk,version:u.version},o="teacher"==t.userRole?"":e.tid;e._sendStream("stream",JSON.stringify(r),o,"0"),e.addStream()}})}},{key:"_onMessageAuth",value:function(t){var e=this;this.im.emit("join_room",h(t,!1),function(n){n&&0==n.code&&(e.im.emit("get_notice",{},function(t){t&&0==t.code&&e.emit("handlerNotice",t.data)}),e.getHistoryMsg(function(t){return e.emit("handlerMsg",t,!0)}),e.im.emit("unspeak_list",{},function(n){return e._unpeakList(t,n)}))})}},{key:"_handlerPing",value:function(t,e){if(e){var n=JSON.parse(e.message);"pingStreamTalker"==n.api&&this.emit("handlerStreamTalker",n)}}},{key:"_onControlStream",value:function(t,e){if(e&&(this._handlerClass(t,e),"stream"==e.mtype&&e.message)){var n=JSON.parse(e.message);"onlineDoc"==n.api&&this.emit("handlerMoveTalkWin",n.command),n&&"authorizeStream"==n.api&&this.emit("handlerInterconnect",n),n&&"enableTalk"==n.api&&this.emit("handlerEnableTalk",n.enabled),"teacher"==n.actorType&&("join"!=n.api&&"joinAck"!=n.api||this._handlerStatusChange(t,2),console.log("addStream:",n.api,this.events),"addStream"==n.api&&this.events.emit("handlerAddStream",n)),"onlineTest"==n.api&&(m=n.command.id,this.emit("handlerQuestion",n)),"updateStreamDeviceStatus"==n.api&&("1"==n.streamType&&n.streamUrl.indexOf("_1")>-1&&("2"==n.status||"3"==n.status||"4"==n.status)&&this.emit("handlerCameraClosed"),"1"==n.streamType&&n.streamUrl.indexOf("_1")>-1&&"1"==n.status&&this.emit("handlerCameraOpened"))}}},{key:"_sendStream",value:function(t,e,n,r){this.clOk&&this.cl.emit("stream",{index:++this.index,uuid:this._getUUID(),mtype:t,targetid:n,message:e,save:r})}},{key:"_unpeakList",value:function(t,e){if(this.emit("handlerChatEnable"),e)if(0==e.data.message[0])this._handlerStatusChange(t,4),this.emit("handlerChatDisable",0);else for(var n=0;n<e.data.message.length;n++)if(e.data.message[n]==this.uid)return this._handlerStatusChange(t,5),void this.emit("handlerChatDisable",1)}},{key:"_unspeak",value:function(t,e){e&&e.status&&(0==e.targetid||"all"==e.targetid?("enable"==e.message&&(this._handlerStatusChange(t,4),this.emit("handlerChatDisable",0)),"disable"==e.message&&(this._handlerStatusChange(t,6),this.emit("handlerChatEnable",0))):e.targetid==this.uid&&("enable"==e.message&&(this._handlerStatusChange(t,5),this.emit("handlerChatDisable",1)),"disable"==e.message&&(this._handlerStatusChange(t,7),this.emit("handlerChatEnable",1))))}},{key:"_getUUID",value:function(){return this.uid+"_2_"+this.index+"_"+(new Date).getTime()}},{key:"_handlerClass",value:function(t,e){if(e&&"class"==e.mtype){console.log("json:",e);var n=JSON.parse(e.message).cmdtype;"start"==n&&(this._handlerStatusChange(t,8),this.emit("handlerClassStarted",e.unixtime)),"end"==n&&(this._handlerStatusChange(t,9),this.emit("handlerClassEnded",e.unixtime))}}},{key:"getHistoryMsg",value:function(t){if(this.imOk&&!p){var e={};f&&(e.msgid=f),this.im.emit("history_message",e,function(n){if(console.log("=========hjson",n),n&&0==n.code){p=!n.data.next_page;for(var r=0;r<n.data.history_list.length;r++){var o=n.data.history_list[r];0==r&&(f=o._id),t&&t(o)}}console.log(f,p,e)})}}},{key:"sendMsg",value:function(t,e){this.imOk&&this.im.emit("message",{save:"1",index:0,mtype:"message",targetid:"",message:t},function(t){t&&0==t.code&&e&&e()})}},{key:"changeClass",value:function(t,e,n,r,o){var i={appid:"",className:n,classType:e,cmdtype:r,roomId:t,userId:o},s=JSON.stringify(i);this._sendStream("class",s,"","1")}},{key:"addStream",value:function(t){if(this.addStreamTemp){var e=this.addStreamTemp,n={appId:"",api:"addStream",roomId:e.classId,actorType:e.actorType?e.actorType:"teacher",actorId:e.userId,actorName:e.userName,streamUrl:e.url,streamType:e.streamType?e.streamType:"4",playMode:e.playMode?e.playMode:"1",streamService:e.streamService?e.streamService:"tm",version:this.constant.version,streamDevice:e.streamDevice?e.streamDevice:"1"};console.log(n),console.log("send stream"),this._sendStream("stream",JSON.stringify(n),t||"","0"),this.removeStreamUrl=e,this.addStreamTemp=null}}},{key:"sendInfo",value:function(t){this._sendStream("stream",t,this.tid,"0")}},{key:"sendQuestion",value:function(t){if(void 0!==m&&""!=m){var e={api:"onlineTest",tid:m,command:{qid:m,qoption:t}},n=JSON.stringify(e);this._sendStream("stream",n,this.tid,"0")}else console.log("未发现题目信息!")}},{key:"sendTalk",value:function(t){switch(t){case 1:this.addStreamTemp={classId:this.classId,url:"_"+this.classId+"_"+this.uid+"_1",userId:this.uid,userName:this.username,actorType:"student",streamType:3,playMode:2,streamDevice:2,streamService:"zego"},this.addStream(this.tid)}}},{key:"rejectTalk",value:function(t){var e={api:"rejectTalk",reason:t,actorId:this.uid,version:1,actorName:this.username};this._sendStream("stream",JSON.stringify(e),this.tid,"0")}},{key:"streamTalkerAck",value:function(t){var e={api:"streamTalkerAck",actorId:this.uid,talking:t,version:1};this.clOk&&this.cl.emit("netstate",{index:++this.index,uuid:this._getUUID(),mtype:"streamtalker",targetid:this.tid,message:JSON.stringify(e),save:"0"})}},{key:"canTalk",value:function(t){var e={canTalk:t},n={api:"join",appId:"",roomId:this.classId,actorId:this.uid,actorName:this.username,actorType:this.userRole,streamService:"tm",version:this.constant.version};if(e&&e instanceof Object)for(var r in e)n[r]=e[r];var o="teacher"==this.userRole?"":this.tid;this._sendStream("stream",JSON.stringify(n),o,"0")}},{key:"removeStream",value:function(t){if(this.removeStreamUrl){var e={api:"removeStream",streamUrl:this.removeStreamUrl.url};console.log(e),this._sendStream("stream",JSON.stringify(e),t||"","0")}}},{key:"leaveRoom",value:function(t,e,n,r){var o={appId:"",api:"leave",roomId:t,actorId:e,version:this.constant.version},i="teacher"==n?"":r;this._sendStream("stream",JSON.stringify(o),i,"0")}},{key:"disConnect",value:function(){this.cl.emit("leave_room"),this.im.emit("leave_room"),this.cl.disconnect(),this.im.disconnect(),this.clOk=!1,this.imOk=!1,f=null,p=!1,this.addStreamTemp=null,this.removeStreamUrl=null}}]),t}();e.default=g},function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=n(26),i=n(6),s=n(15),a=n(2)("socket.io-client");t.exports=e=u;var c=e.managers={};function u(t,e){"object"==(void 0===t?"undefined":r(t))&&(e=t,t=void 0),e=e||{};var n,i=o(t),u=i.source,l=i.id,h=i.path,f=c[l]&&h in c[l].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||f?(a("ignoring socket cache for %s",u),n=s(u,e)):(c[l]||(a("new io instance for %s",u),c[l]=s(u,e)),n=c[l]),n.socket(i.path)}e.protocol=i.protocol,e.connect=u,e.Manager=n(15),e.Socket=n(20)},function(t,e,n){"use strict";(function(e){var r=n(12),o=n(2)("socket.io-client:url");t.exports=function(t,n){var i=t,n=n||e.location;null==t&&(t=n.protocol+"//"+n.host);"string"==typeof t&&("/"==t.charAt(0)&&(t="/"==t.charAt(1)?n.protocol+t:n.host+t),/^(https?|wss?):\/\//.test(t)||(o("protocol-less url %s",t),t=void 0!==n?n.protocol+"//"+t:"https://"+t),o("parse %s",t),i=r(t));i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443"));i.path=i.path||"/";var s=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+s+":"+i.port,i.href=i.protocol+"://"+s+(n&&n.port==i.port?"":":"+i.port),i}}).call(this,n(0))},function(t,e,n){"use strict";(e=t.exports=function(t){function n(){}function i(){var t=i,n=+new Date,s=n-(r||n);t.diff=s,t.prev=r,t.curr=n,r=n,null==t.useColors&&(t.useColors=e.useColors()),null==t.color&&t.useColors&&(t.color=e.colors[o++%e.colors.length]);var a=Array.prototype.slice.call(arguments);a[0]=e.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var c=0;a[0]=a[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;c++;var o=e.formatters[r];if("function"==typeof o){var i=a[c];n=o.call(t,i),a.splice(c,1),c--}return n}),"function"==typeof e.formatArgs&&(a=e.formatArgs.apply(t,a));var u=i.log||e.log||console.log.bind(console);u.apply(t,a)}n.enabled=!1,i.enabled=!0;var s=e.enabled(t)?i:n;return s.namespace=t,s}).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){e.save(t);for(var n=(t||"").split(/[\s,]+/),r=n.length,o=0;o<r;o++)n[o]&&("-"===(t=n[o].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){var n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1},e.humanize=n(28),e.names=[],e.skips=[],e.formatters={};var r,o=0},function(t,e,n){"use strict";var r=1e3,o=60*r,i=60*o,s=24*i,a=365.25*s;function c(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}t.exports=function(t,e){return e=e||{},"string"==typeof t?function(t){if((t=""+t).length>1e4)return;var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*a;case"days":case"day":case"d":return n*s;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;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*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}(t):e.long?function(t){return c(t,s,"day")||c(t,i,"hour")||c(t,o,"minute")||c(t,r,"second")||t+" ms"}(t):function(t){return t>=s?Math.round(t/s)+"d":t>=i?Math.round(t/i)+"h":t>=o?Math.round(t/o)+"m":t>=r?Math.round(t/r)+"s":t+"ms"}(t)}},function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function o(){var t;try{t=e.storage.debug}catch(t){}return t}(e=t.exports=n(30)).log=function(){return"object"===("undefined"==typeof console?"undefined":r(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(){var t=arguments,n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),!n)return t;var r="color: "+this.color,o=0,i=0;return(t=[t[0],r,"color: inherit"].concat(Array.prototype.slice.call(t,1)))[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&"%c"===t&&(i=++o)}),t.splice(i,0,r),t},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=o,e.useColors=function(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){return JSON.stringify(t)},e.enable(o())},function(t,e,n){"use strict";(e=t.exports=function(t){function n(){}function i(){var t=i,n=+new Date,s=n-(r||n);t.diff=s,t.prev=r,t.curr=n,r=n,null==t.useColors&&(t.useColors=e.useColors()),null==t.color&&t.useColors&&(t.color=e.colors[o++%e.colors.length]);var a=Array.prototype.slice.call(arguments);a[0]=e.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var c=0;a[0]=a[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;c++;var o=e.formatters[r];if("function"==typeof o){var i=a[c];n=o.call(t,i),a.splice(c,1),c--}return n}),"function"==typeof e.formatArgs&&(a=e.formatArgs.apply(t,a));var u=i.log||e.log||console.log.bind(console);u.apply(t,a)}n.enabled=!1,i.enabled=!0;var s=e.enabled(t)?i:n;return s.namespace=t,s}).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){e.save(t);for(var n=(t||"").split(/[\s,]+/),r=n.length,o=0;o<r;o++)n[o]&&("-"===(t=n[o].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))},e.enabled=function(t){var n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1},e.humanize=n(31),e.names=[],e.skips=[],e.formatters={};var r,o=0},function(t,e,n){"use strict";var r=1e3,o=60*r,i=60*o,s=24*i,a=365.25*s;function c(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}t.exports=function(t,e){return e=e||{},"string"==typeof t?function(t){if((t=""+t).length>1e4)return;var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*a;case"days":case"day":case"d":return n*s;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;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*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}(t):e.long?function(t){return c(t,s,"day")||c(t,i,"hour")||c(t,o,"minute")||c(t,r,"second")||t+" ms"}(t):function(t){return t>=s?Math.round(t/s)+"d":t>=i?Math.round(t/i)+"h":t>=o?Math.round(t/o)+"m":t>=r?Math.round(t/r)+"s":t+"ms"}(t)}},function(t,e,n){"use strict";(function(t,r){var o,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};(function(){var s=n(7),a={function:!0,object:!0},c=a[i(e)]&&e&&!e.nodeType&&e,u=a["undefined"==typeof window?"undefined":i(window)]&&window||this,l=c&&a[i(t)]&&t&&!t.nodeType&&"object"==(void 0===r?"undefined":i(r))&&r;function h(t,e){t||(t=u.Object()),e||(e=u.Object());var n=t.Number||u.Number,r=t.String||u.String,o=t.Object||u.Object,s=t.Date||u.Date,c=t.SyntaxError||u.SyntaxError,l=t.TypeError||